liling пре 2 година
родитељ
комит
0ccc75a300

+ 5 - 3
service/controllers/attachmentController.go

@@ -88,6 +88,7 @@ func (c *AttachmentController) UploadFile() {
 	file := strings.Join([]string{".", "static", "upload", newFilename}, PthSep)
 	os.MkdirAll(strings.Join([]string{".", "static", "upload"}, PthSep), fs.ModeDir)
 	err = c.SaveToFile("file", file)
+	doc_id := int32(0)
 	if err != nil {
 		logger.Logger.Error(err)
 		c.Data["json"] = c.ResultError(err.Error())
@@ -221,7 +222,7 @@ func (c *AttachmentController) UploadFile() {
 				if datatype != "scd" {
 					attachmentMgrObj.Model.IedName = strings.Split(fn, ".")[0]
 				}
-				attachmentMgrObj.Save()
+				doc_id, _ = attachmentMgrObj.Save()
 			}
 		} else if attachment_type != "" {
 			//写附件表
@@ -244,7 +245,7 @@ func (c *AttachmentController) UploadFile() {
 			attachmentMgrObj.Model.FileType = attachment_type
 			attachmentMgrObj.Model.IedName = ied_name
 			attachmentMgrObj.Model.CheckFlag = 0
-			attachmentMgrObj.Save()
+			doc_id, _ = attachmentMgrObj.Save()
 		}
 		f, _ := exec.LookPath(os.Args[0])
 		fp, _ := filepath.Abs(f)
@@ -253,7 +254,8 @@ func (c *AttachmentController) UploadFile() {
 		if res != "" {
 			res = file[1:]
 		}
-		returninfo := map[string]string{"filename": file_name, "path": res}
+		logger.Logger.Debug(fmt.Sprintf("fileid=====%d", doc_id))
+		returninfo := map[string]string{"filename": file_name, "path": res, "fileid": tools.IsEmpty(doc_id)}
 		c.Data["json"] = c.ResultOK(returninfo, 0)
 	}
 	c.ServeJSON()

+ 74 - 0
service/controllers/busAdminController.go

@@ -470,3 +470,77 @@ func (c *BusAdminController) GetCheckAreaByVolID() {
 	c.Data["json"] = c.ResultOK(lst, 0)
 	c.ServeJSON()
 }
+
+// @Summary 查询指定检测间隔下的IED装置列表
+//	@Description  查询指定检测间隔下的IED装置列表
+// 	@Tags         业务管理服务
+// 	@Accept       x-www-form-urlencoded
+// 	@Produce      json
+//	@Param 	scd_id 			formData   int  true 	"SCD文件ID"
+//	@Param 	area_id 		formData   int  true 	"检测间隔ID"
+// 	@Success     200    {object} ResultOK 成功
+// 	@Failure 	 500 	{object} ResultError  失败
+// @router /admin/get/check_area/ied [get]
+func (c *BusAdminController) GetCheckAreaIedByAreaID() {
+	id, _ := c.GetInt64("scd_id")
+	if id == 0 {
+		c.Data["json"] = c.ResultError("SCD文件ID不能为空!")
+		c.ServeJSON()
+		return
+	}
+	area_id, _ := c.GetInt("area_id")
+	obj := new(bo.CheckAreaMgr)
+	obj.SetUserInfo(c.GetCurrentUserInfo())
+	obj.ScdId = id
+	lst, err := obj.GetIedList(id, area_id)
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
+	}
+	c.Data["json"] = c.ResultOK(lst, 0)
+	c.ServeJSON()
+}
+
+// @Summary 修改并保存指定检测间隔下的IED装置列表
+//	@Description  修改并保存指定检测间隔下的IED装置列表
+// 	@Tags         业务管理服务
+// 	@Accept       x-www-form-urlencoded
+// 	@Produce      json
+//	@Param 	scd_id 		formData   int  	true 	"SCD文件ID"
+//	@Param 	area_id 	formData   int  	true 	"检测间隔ID"
+//	@Param  ied_ids     formData   string 	true	"IED装置name列表,多个ied采用逗号分隔。如:PT1001,PL1001,..."
+// 	@Success     200    {object} ResultOK 成功
+// 	@Failure 	 500 	{object} ResultError  失败
+// @router /admin/update/check_area/ied [post]
+func (c *BusAdminController) SaveCheckAreaIedByAreaID() {
+	id, _ := c.GetInt64("scd_id")
+	if id == 0 {
+		c.Data["json"] = c.ResultError("SCD文件ID不能为空!")
+		c.ServeJSON()
+		return
+	}
+	area_id, _ := c.GetInt("area_id")
+	ieds := c.GetString("ied_ids")
+	if area_id == 0 {
+		c.Data["json"] = c.ResultError("检测间隔ID不能为空!")
+		c.ServeJSON()
+		return
+	}
+	if ieds == "" {
+		c.Data["json"] = c.ResultError("检测间隔装置列表不能为空!")
+		c.ServeJSON()
+		return
+	}
+	obj := new(bo.CheckAreaMgr)
+	obj.SetUserInfo(c.GetCurrentUserInfo())
+	obj.ScdId = id
+	err := obj.UpdateIeds(id, area_id, ieds)
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
+	}
+	c.Data["json"] = c.ResultOK("", 0)
+	c.ServeJSON()
+}

+ 1 - 1
service/controllers/reportController.go

@@ -42,7 +42,7 @@ func (c *ReportController) SavereportTplInfo() {
 	obj.Model = bo.T_data_report_tpl{Id: id}
 	obj.Model.Name = c.GetString("name")
 	obj.Model.Memo = c.GetString("memo")
-	obj.Model.DocId, _ = c.GetInt("report_id")
+	obj.Model.DocId, _ = c.GetInt("doc_id")
 	obj.Model.State, _ = c.GetInt("state")
 	if obj.Model.Id == 0 && obj.Model.State == 0 {
 		obj.Model.State = 1

+ 4 - 0
service/controllers/screenController.go

@@ -5,6 +5,7 @@ import (
 	"scd_check_tools/global"
 	"scd_check_tools/models/bo"
 	"scd_check_tools/tools"
+	"strconv"
 	"strings"
 )
 
@@ -244,6 +245,9 @@ func (c *ScreenController) ScdParseStep1() {
 	if err != nil {
 		c.Data["json"] = c.ResultError(err.Error())
 	} else {
+		checkArea := new(bo.CheckAreaMgr)
+		checkArea.ScdId, _ = strconv.ParseInt(scdid, 10, 64)
+		checkArea.ParseModelArea()
 		c.Data["json"] = c.ResultOK(scdid, 0)
 	}
 	c.ServeJSON()

+ 55 - 4
service/controllers/taskController.go

@@ -15,6 +15,7 @@ import (
 	"fmt"
 	"scd_check_tools/models/bo"
 	"scd_check_tools/tools"
+	"time"
 )
 
 //检测任务服务
@@ -36,7 +37,7 @@ func init() {
 //	@Param 	memo 		formData   string  	false 	"任务说明"
 //	@Param 	report_id 	formData   int  	true 	"报告模板ID"
 //	@Param 	scd_id 		formData   int  	true 	"SCD文件ID"
-//	@Param 	modelids 	formData   array  	true 	"间隔-模型关系。数据格式:[[间隔id,模型id],[间隔id,模型id],..]多个间隔-模型关系之间逗号分隔"
+//	@Param 	modelids 	formData   string  	true 	"模型ID。多个模型ID之间逗号分隔"
 // 	@Success     200    {object} ResultOK 成功
 // 	@Failure 	 500 	{object} ResultError  失败
 // @router /task/save [post]
@@ -52,7 +53,7 @@ func (c *TaskController) SaveTaskInfo() {
 	obj.Model.ScdId, _ = c.GetInt64("scd_id")
 	obj.Model.State = 0
 	if obj.Model.Id == 0 {
-		obj.Model.Code = fmt.Sprintf("T-%d-%s%s", obj.Model.StationId, tools.NowTime())
+		obj.Model.Code = fmt.Sprintf("T-%d-%s", obj.Model.StationId, time.Now().Format("20060102150405"))
 	} else {
 		obj.Model.Code = c.GetString("code")
 	}
@@ -82,8 +83,8 @@ func (c *TaskController) SaveTaskInfo() {
 		c.ServeJSON()
 		return
 	}
-	area_models := [][]int{}
-	err1 := json.Unmarshal([]byte(modelids), &area_models)
+	area_models := []int{}
+	err1 := json.Unmarshal([]byte(`[`+modelids+`]`), &area_models)
 	if err1 != nil {
 		c.Data["json"] = c.ResultError(err1.Error())
 		c.ServeJSON()
@@ -242,3 +243,53 @@ func (c *TaskController) GetTaskList() {
 	c.Data["json"] = c.ResultOK(lst, cnt)
 	c.ServeJSON()
 }
+
+// @Summary 获取指定检测任务的详细信息
+//	@Description  获取指定检测任务的详细信息
+// 	@Tags         检测任务服务接口
+// 	@Accept       x-www-form-urlencoded
+// 	@Produce      json
+//	@Param 	id 		query   int  true 	"任务ID"
+// 	@Success     200    {object} ResultOK 成功
+// 	@Failure 	 500 	{object} ResultError  失败
+// @router /task/info [get]
+func (c *TaskController) GetTaskInfo() {
+	obj := new(bo.TaskMgr)
+	obj.SetUserInfo(c.GetCurrentUserInfo())
+	obj.Model = bo.T_data_task{}
+	obj.Model.Id, _ = c.GetInt("id")
+	lst, err := obj.One()
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
+	}
+	scdmgr := new(bo.ScdMgr)
+	scdinfo, err := scdmgr.One(tools.IsEmpty(lst.ScdId))
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
+	}
+	models, _, err := obj.GetModels()
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
+	}
+	result := map[string]interface{}{}
+	result["id"] = lst.Id
+	result["code"] = lst.Code
+	result["cr"] = lst.Cr
+	result["ct"] = lst.Ct
+	result["end_time"] = lst.EndTime
+	result["memo"] = lst.Memo
+	result["name"] = lst.Name
+	result["report_id"] = lst.ReportId
+	result["scd_id"] = lst.ScdId
+	result["scd_info"] = scdinfo
+	result["start_time"] = lst.StartTime
+	result["models"] = models
+	c.Data["json"] = c.ResultOK(result, 1)
+	c.ServeJSON()
+}

+ 8 - 6
service/models/bo/attachment.go

@@ -1,13 +1,13 @@
 package bo
 
 import (
-	"scd_check_tools/logger"
-	"scd_check_tools/models/enum"
-	"scd_check_tools/tools"
 	"errors"
 	"fmt"
 	"log"
 	"os"
+	"scd_check_tools/logger"
+	"scd_check_tools/models/enum"
+	"scd_check_tools/tools"
 	"strconv"
 	"strings"
 
@@ -211,7 +211,7 @@ func (c *AttachmentMgr) TypeStat(param map[string]interface{}) (map[string]inter
 	return result, nil
 }
 
-func (c *AttachmentMgr) Save() (err error) {
+func (c *AttachmentMgr) Save() (id int32, err error) {
 	db := orm.NewOrm()
 	c.Model.CreatedBy = c.GetUserId()
 	c.Model.CreatedTime = tools.NowTime()
@@ -221,10 +221,12 @@ func (c *AttachmentMgr) Save() (err error) {
 	dblog.Logtype = enum.LogType_Insert
 	dblog.Eventtype = enum.OptEventType_Bus
 	dblog.Eventlevel = enum.OptEventLevel_Hight
+	newid := int64(0)
 	if c.Model.Id == 0 {
-		_, err = db.Insert(&c.Model)
+		newid, err = db.Insert(&c.Model)
 	} else {
 		_, err = db.Update(&c.Model)
+		newid = int64(c.Model.Id)
 	}
 	if err != nil {
 		logger.Logger.Error(err, fmt.Sprintf("原始数据:%+v", c.Model))
@@ -234,7 +236,7 @@ func (c *AttachmentMgr) Save() (err error) {
 		dblog.Description = fmt.Sprintf("上传附件%s成功", c.Model.FileName)
 		dblog.Success2()
 	}
-	return err
+	return int32(newid), err
 }
 
 func (c *AttachmentMgr) One() (T_sys_attachment, error) {

+ 37 - 14
service/models/bo/checktools_area.go

@@ -113,7 +113,20 @@ func (c *CheckAreaMgr) Init(scdid int64) {
 			volid = stationonof.AreaLevel
 		}
 	*/
-	c.CheckModelList, _ = new(SysCheckModelMgr).GetModelsByVolid()
+	tmplist, _ := new(SysCheckModelMgr).GetModelsByVolid()
+	scdModels, _, _ := new(TaskMgr).GetModelsByScdID(c.ScdId)
+	ms := map[string]interface{}{}
+	for _, row := range scdModels {
+		ms[tools.IsEmpty(row["model_id"])] = row
+	}
+	for _, row := range tmplist {
+		modelid := tools.IsEmpty(row["id"])
+		if ms[modelid] != nil {
+			c.CheckModelList = append(c.CheckModelList, row)
+		}
+	}
+	ms = nil
+	tmplist = nil
 }
 
 //保存指定间隔所属的电压等级
@@ -177,7 +190,7 @@ func (c *CheckAreaMgr) GetAreaListByVol(scdid int64, vl, linkstyleid int) ([]orm
 		params = append(params, linkstyleid)
 	}
 	rowset := []orm.Params{}
-	_, err := db.Raw(sql, params).Values(&rowset)
+	_, err := db.Raw(sql+" order by t1.vol_id,t1.line_link_style,t1.id", params).Values(&rowset)
 	sqllog := fmt.Sprintf("SQL:%s 参数:%+v", sql, []interface{}{scdid, vl})
 	if err != nil {
 		logger.Logger.Error(err, sqllog)
@@ -189,15 +202,11 @@ func (c *CheckAreaMgr) GetAreaListByVol(scdid int64, vl, linkstyleid int) ([]orm
 }
 
 //获取指定间隔下的IED列表
-func (c *CheckAreaMgr) GetIedList(scdid int64, voltage_level_id, areaid int32, device_type string) ([]orm.Params, error) {
+func (c *CheckAreaMgr) GetIedList(scdid int64, areaid int) ([]orm.Params, error) {
 	db := orm.NewOrm()
-	sql := "select * from t_data_check_area t,t_data_check_area_ied t1 where t.scd_id=? and t.id=t1.area_id "
+	sql := "select t1.* from t_data_check_area t,t_data_check_area_ied t1 where t.scd_id=? and t.id=t1.area_id "
 	sqlParamters := []interface{}{}
 	sqlParamters = append(sqlParamters, scdid)
-	if voltage_level_id > 0 {
-		sql = sql + " and t.voltage_level=?"
-		sqlParamters = append(sqlParamters, voltage_level_id)
-	}
 	if areaid > 0 {
 		sql = sql + " and t1.area_id=?"
 		sqlParamters = append(sqlParamters, areaid)
@@ -210,11 +219,6 @@ func (c *CheckAreaMgr) GetIedList(scdid int64, voltage_level_id, areaid int32, d
 		return nil, errors.New("无效的SCD")
 	}
 	rowset := []orm.Params{}
-	if device_type != "" {
-		//根据装备类型查询IED
-		sql = sql + " and t1.ied_type=?"
-		sqlParamters = append(sqlParamters, device_type)
-	}
 	_, err := db.Raw(sql, sqlParamters).Values(&rowset)
 	sqllog := fmt.Sprintf("SQL:%s 参数:%+v", sql, sqlParamters)
 	if err != nil {
@@ -224,7 +228,7 @@ func (c *CheckAreaMgr) GetIedList(scdid int64, voltage_level_id, areaid int32, d
 		scdNode := new(ScdNode)
 
 		for _, row := range rowset {
-			iedid, _ := strconv.ParseInt(tools.IsEmpty(row["ied_id"]), 10, 64)
+			iedid, _ := strconv.ParseInt(tools.IsEmpty(row["ied_name"]), 10, 64)
 			iedObj := scdNode.GetIedByID(scdXmlObj, tools.IsEmpty(scdid), iedid)
 			if iedObj == nil {
 				continue
@@ -241,6 +245,25 @@ func (c *CheckAreaMgr) GetIedList(scdid int64, voltage_level_id, areaid int32, d
 	return rowset, nil
 }
 
+//更新指定间隔下的装置定义
+func (c *CheckAreaMgr) UpdateIeds(scdid int64, areaid int, ieds string) error {
+	db := orm.NewOrm()
+	iedlist := strings.Split(ieds, ",")
+	_, err := db.Raw("delete from t_data_check_area_ied where scd_id=? and area_id=?", scdid, areaid).Exec()
+	if err != nil {
+		logger.Logger.Error(err)
+		return err
+	}
+	for _, row := range iedlist {
+		_, err = db.Raw("insert into t_data_check_area_ied(scd_id,area_id,ied_name)values(?,?,?)", scdid, areaid, row).Exec()
+		if err != nil {
+			logger.Logger.Error(err)
+			break
+		}
+	}
+	return err
+}
+
 //获取指定SCD的IED类型列表
 func (c *CheckAreaMgr) GetIedTypeList(scdid int64) ([]orm.Params, error) {
 	db := orm.NewOrm()

+ 18 - 0
service/models/bo/scd_file_parse.go

@@ -293,6 +293,7 @@ func (c *ScdParse) SchemaValid(scdid, scdname, scdFilePath string) ([]string, er
 			mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%s", stationid, scdid), string(dataMsg))
 		}(scdid, stationid, validResultPath, scdYFcheckRuleid)
 	}
+	new(TaskMgr).SetStep(tools.IsEmpty(scdid), enum.TaskStep_SCD_syntax_parse.Code(), 2)
 	//开始语义校验
 	logger.Logger.Info("======开始进行语义校验")
 	checkObj.TestCheckRule()
@@ -739,11 +740,13 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 	db.Raw(sql, scdName, scdPath).Values(&rowset)
 	if len(rowset) > 0 {
 		scdid = tools.IsEmpty(rowset[0]["id"])
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Loading.Code(), 1)
 		if _, h := global.GoCahce.Get(scdid); h {
 			//已经解析到内存中,则不再解析
 			data := map[string]string{"name": scdName, "stationid": stationid, "rootid": "", "state": "1", "node": "load-file", "msg": ""}
 			dataMsg, _ := json.Marshal(data)
 			mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s", stationid), string(dataMsg))
+			new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Loading.Code(), 2)
 			return scdid, nil
 		} else {
 			//判断是否有解析完成的持久化文件
@@ -754,6 +757,8 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 				logger.Logger.Debug("=====结果文件" + scdPath + ".parsed.xml已存在,直接加载")
 				sclNodeObj, err := c.LoadScdXml(scdPath + ".parsed.xml")
 				if err == nil {
+					new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Loading.Code(), 2)
+					new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Parse.Code(), 1)
 					global.GoCahce.Set(scdPath, scdid, -1)
 					global.GoCahce.Set(scdid, sclNodeObj, -1)
 					data := map[string]string{"name": scdName, "stationid": stationid, "rootid": "", "state": "1", "node": "load-file", "msg": ""}
@@ -764,8 +769,10 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 					//go new(ScdMgr).CrcCheck(scdid)
 					//开始校验该SCD
 					//go c.SchemaValid(scdid, scdName, scdPath)
+					new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Parse.Code(), 2)
 				} else {
 					logger.Logger.Error(err, "异常SCD文件:"+scdPath)
+					new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Parse.Code(), 3, err.Error())
 					return "", err
 				}
 				return scdid, nil
@@ -782,19 +789,24 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 		return "", errors.New("系统繁忙:" + msg + ",请稍候(约5分钟)再试")
 	}
 	logger.Logger.Debug(fmt.Sprintf("=======开始加载解析SCD:%s", scdName))
+	new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Loading.Code(), 1)
 	//新解析scd,先进行文件格式化。搞成一行一行的
 	node_cnt, err2 := c.ForamtScdPath(scdPath)
 	if err2 != nil {
 		mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%d/error", stationid, 0), scdName+"解析时发生错误,解析终止!")
 		logger.Logger.Error(err2, "异常SCD文件:"+scdPath)
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Loading.Code(), 3, err2.Error())
 		return "", err2
 	}
 	sclNodeObj, err := c.LoadScdXml(scdPath)
 	if err != nil {
 		mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%d/error", stationid, 0), scdName+"解析时发生错误,解析终止!")
 		logger.Logger.Error(err, "异常SCD文件:"+scdPath)
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Loading.Code(), 3, err.Error())
 		return "", err
 	}
+	new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Loading.Code(), 2)
+	new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Parse.Code(), 1)
 	iedList := []string{}
 	isBay := false //是否有间隔节点
 	bayList := []*node_attr.NVoltage{}
@@ -804,6 +816,7 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 	scdmgr.Idseq = c.Idseq //初始化节点管理对象的ID序列
 	if scdid == "" {
 		scdmgr.RootID = scdmgr.GetID()
+		scdid = tools.IsEmpty(scdmgr.RootID)
 	} else {
 		scdmgr.RootID, _ = strconv.ParseInt(scdid, 10, 64)
 	}
@@ -1904,6 +1917,7 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 	} else {
 		mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%d/error", stationid, scdmgr.RootID), scdName+"格式化时发生错误,解析终止!")
 		logger.Logger.Error(err)
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Parse.Code(), 3, err.Error())
 		return "", err
 	}
 
@@ -1914,6 +1928,7 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 	if err != nil {
 		mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%d/error", stationid, scdmgr.RootID), scdName+"初始化创建时发生错误,解析终止!")
 		logger.Logger.Error(err)
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Parse.Code(), 3, err.Error())
 		return "", err
 	}
 	scdmgr.RootID = newscdid
@@ -1960,15 +1975,18 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 	if err != nil {
 		logger.Logger.Error(err, fmt.Sprintf("SQL:%s", fmt.Sprintf("%s%s", node_ins, strings.Join(iedList, ","))))
 	}
+	new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Parse.Code(), 2)
 	return fmt.Sprintf("%d", scdmgr.RootID), nil
 }
 
 //scd完整解析过程二:校验SCD
 func (c *ScdParse) XmlCheckParse(scdid int64) (err error) {
 	//开始校验该SCD
+	new(TaskMgr).SetStep(tools.IsEmpty(scdid), enum.TaskStep_SCD_syntax_parse.Code(), 1)
 	_, err = c.SchemaValid(tools.IsEmpty(scdid), "", "")
 	if err != nil {
 		logger.Logger.Error(err)
+		new(TaskMgr).SetStep(tools.IsEmpty(scdid), enum.TaskStep_SCD_syntax_parse.Code(), 3, err.Error())
 		return err
 	}
 	scdmgr := new(ScdNode)

+ 22 - 8
service/models/bo/scd_mgr.go

@@ -1,13 +1,6 @@
 package bo
 
 import (
-	"scd_check_tools/conf"
-	"scd_check_tools/global"
-	"scd_check_tools/logger"
-	"scd_check_tools/models/enum"
-	"scd_check_tools/models/node_attr"
-	"scd_check_tools/mqtt"
-	"scd_check_tools/tools"
 	"encoding/json"
 	"encoding/xml"
 	"errors"
@@ -18,6 +11,13 @@ import (
 	"os/exec"
 	"regexp"
 	"runtime"
+	"scd_check_tools/conf"
+	"scd_check_tools/global"
+	"scd_check_tools/logger"
+	"scd_check_tools/models/enum"
+	"scd_check_tools/models/node_attr"
+	"scd_check_tools/mqtt"
+	"scd_check_tools/tools"
 	"strconv"
 	"strings"
 	"sync"
@@ -724,6 +724,7 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 	dataMsg, _ := json.Marshal(data)
 	mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%s", station_id, scdid), string(dataMsg))
 	//crc提取开始
+	new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_crc_extract.Code(), 1)
 	global.IedCrcMakeState.Store(fmt.Sprintf("crc_%s", scdid), "1")
 	osname := string(runtime.GOOS)
 	var subProcess *exec.Cmd
@@ -825,12 +826,17 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 	if err != nil {
 		logger.Logger.Error(err)
 	}
+	data = map[string]string{"name": scdname, "stationid": station_id, "rootid": scdid, "state": "1", "node": "crc-file", "msg": ""}
+	dataMsg, _ = json.Marshal(data)
+	mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%s", station_id, scdid), string(dataMsg))
+	new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_crc_extract.Code(), 2)
 	dirChar := string(os.PathSeparator)
 	tmpPart := []string{".", "static", "upload", "ied", scdid}
 	ccdpath := strings.Join(tmpPart, dirChar)
 	os.MkdirAll(ccdpath, fs.ModePerm)
 	go func(scdid, scdname, station_id, scdpath, ccdpath string) {
 		//提取CCD文件
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_ccd_extract.Code(), 1)
 		logger.Logger.Debug("====开始提取IED装置CCD文件...")
 		ccdFileSqls := []string{}
 		for iedname, _ := range crcmap {
@@ -957,13 +963,16 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 			odb.Raw("insert into t_sys_attachment(station_id,scd_id,ied_name,file_name,file_size,save_path,file_type,file_suffix,check_flag,created_time)values" + strings.Join(ccdFileSqls, ",")).Exec()
 			ccdFileSqls = nil
 		}
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_ccd_extract.Code(), 2)
 		logger.Logger.Debug("====IED装置CCD文件提取完成!")
-		data := map[string]string{"name": scdname, "stationid": station_id, "rootid": scdid, "state": "1", "node": "crc-file", "msg": ""}
+		data := map[string]string{"name": scdname, "stationid": station_id, "rootid": scdid, "state": "1", "node": "ccd-file", "msg": ""}
 		dataMsg, _ := json.Marshal(data)
 		mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%s", station_id, scdid), string(dataMsg))
 	}(scdid, scdname, station_id, scdpath, ccdpath)
 	//icd,cid提取
 	go func(scdid, savepath string) {
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_cid_extract.Code(), 1)
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_icd_extract.Code(), 1)
 		logger.Logger.Debug("====开始提取SCD【" + scdid + "】的IED装置ICD、CID文件...")
 		scdXmlObj, serr := new(ScdParse).GetScdXmlObjectBySCDID(scdid)
 		if serr != nil {
@@ -1180,6 +1189,11 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 			odb.Raw("insert into t_sys_attachment(station_id,scd_id,ied_name,file_name,file_size,save_path,file_type,file_suffix,check_flag,created_time)values" + strings.Join(xxxFileSqls, ",")).Exec()
 			xxxFileSqls = nil
 		}
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_cid_extract.Code(), 2)
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_icd_extract.Code(), 2)
+		data := map[string]string{"name": scdname, "stationid": station_id, "rootid": scdid, "state": "1", "node": "cid-file", "msg": ""}
+		dataMsg, _ := json.Marshal(data)
+		mqtt.PublishMessage(fmt.Sprintf("/jujutong/scd_check_tools/parse/%s/%s", station_id, scdid), string(dataMsg))
 	}(scdid, ccdpath)
 	return true, nil
 }

+ 2 - 0
service/models/bo/scd_node_rule.go

@@ -589,6 +589,7 @@ func (c *ScdNodeRule) ResultList(scdname, scdpath string, level, ied_name, node_
 
 //启动自定义校验
 func (c *ScdNodeRule) StartFunctionNodeParse() {
+	new(TaskMgr).SetStep(tools.IsEmpty(c.ScdID), enum.TaskStep_SCD_rule_parse.Code(), 1)
 	c.CheckFunc_header_number(nil)
 	c.CheckFunc_header_name_structure(nil)
 	c.CheckFunc_header_toolid(nil)
@@ -601,6 +602,7 @@ func (c *ScdNodeRule) StartFunctionNodeParse() {
 	c.CheckFunc_communication_connectedap(nil)
 	dATypeMap := c.CheckFunc_datatypetemplates(nil)
 	c.CheckFunc_ied(dATypeMap)
+	new(TaskMgr).SetStep(tools.IsEmpty(c.ScdID), enum.TaskStep_SCD_rule_parse.Code(), 2)
 	//在crc校验完成后将所有校验结果写入数据库
 	go c.CheckFunc_crc()
 	c.doiMap = nil

+ 74 - 2
service/models/bo/task.go

@@ -8,6 +8,7 @@ import (
 	"scd_check_tools/tools"
 	"strconv"
 	"strings"
+	"sync"
 
 	"github.com/astaxie/beego/orm"
 )
@@ -36,6 +37,8 @@ type TaskMgr struct {
 	DeviceBaseModel
 }
 
+var TaskSCD = sync.Map{}
+
 var modelDesc = "检测任务"
 
 func init() {
@@ -102,10 +105,27 @@ func (c *TaskMgr) start(task T_data_task) error {
 	if err != nil {
 		return err
 	}
+	c.Model.Id = task.Id
+	_, cnt, _ := c.GetModels()
+	if cnt == 0 {
+		return errors.New("该检测任务还未配置检测模型")
+	}
+	TaskSCD.Store(task.ScdId, task)
+	db := orm.NewOrm()
+	//清除原步骤及状态
+	db.Raw("delete from t_data_task_check_step where task_id=?", task.Id).Exec()
+	//生成新的步骤
+	db.Raw("insert into t_data_task_check_step(task_id,task_step_id,state) select ?,id,0 from global_const_code where parentcode='CHECK_STEP' order by id", task.Id).Exec()
 	go func() {
 		_, err = scdParse.XmlIEDParse(tools.IsEmpty(scdInfo["station_id"]), tools.IsEmpty(scdInfo["scd_name"]), tools.IsEmpty(scdInfo["path"]))
 		if err == nil {
 			scdParse.XmlCheckParse(task.ScdId)
+			//模型分析
+			c.SetStep(tools.IsEmpty(task.ScdId), enum.TaskStep_SCD_model_parse.Code(), 1)
+			checkAreaMgr := new(CheckAreaMgr)
+			checkAreaMgr.ScdId = task.ScdId
+			//checkAreaMgr.ParseModelArea()
+			c.SetStep(tools.IsEmpty(task.ScdId), enum.TaskStep_SCD_model_parse.Code(), 2)
 		}
 	}()
 	return err
@@ -113,14 +133,35 @@ func (c *TaskMgr) start(task T_data_task) error {
 
 //取消/终止检测
 func (c *TaskMgr) stop(task T_data_task) error {
+	TaskSCD.Delete(task.ScdId)
 	return nil
 }
 
 //完成检测
 func (c *TaskMgr) finish(task T_data_task) error {
+	TaskSCD.Delete(task.ScdId)
 	return nil
 }
 
+//更新检测步骤状态
+func (c *TaskMgr) SetStep(scdid string, stepcode string, state int, msg ...string) {
+	db := orm.NewOrm()
+	scdidint64, _ := strconv.ParseInt(scdid, 10, 64)
+	taskid, has := TaskSCD.Load(scdidint64)
+	if !has {
+		return
+	}
+	errormsg := ""
+	if len(msg) > 0 {
+		errormsg = msg[0]
+	}
+	t1 := "ct" //步骤开始时间字段
+	if state > 1 {
+		t1 = "ut" //步骤结束时间字段
+	}
+	db.Raw("update t_data_task_check_step set state=?,state_msg=?,"+t1+"=now() where task_id=? and task_step_id=(select id from global_const_code where parentcode='CHECK_STEP' and code=?)", state, errormsg, taskid, stepcode).Exec()
+}
+
 //保存任务信息
 func (c *TaskMgr) Save() (id int, err error) {
 	dblog := new(SystemLog)
@@ -169,11 +210,12 @@ func (c *TaskMgr) One() (T_data_task, error) {
 		return c.Model, errors.New("未指定id")
 	}
 	o := orm.NewOrm()
-	err := o.Read(&c.Model)
+	tmp := T_data_task{Id: c.Model.Id}
+	err := o.Read(&tmp)
 	if err != nil {
 		logger.Logger.Error(err)
 	}
-	return c.Model, err
+	return tmp, err
 }
 
 //根据model中指定的id删除检测任务
@@ -200,9 +242,11 @@ func (c *TaskMgr) Delete() (err error) {
 		dblog.Description = fmt.Sprintf("删除%s%s失败:%s", modelDesc, c.Model.Name, err.Error())
 		dblog.Fail2()
 	} else {
+		TaskSCD.Delete(c.Model.ScdId)
 		dblog.Description = fmt.Sprintf("删除%s%s成功", modelDesc, c.Model.Name)
 		dblog.Success2()
 		//同步删除关联数据
+		db.Raw("delete from t_data_task_check_step where task_id=?", c.Model.Id).Exec()
 		scdmgr := new(ScdMgr)
 		scdmgr.SetUserInfo(u)
 		scdmgr.DeleteScd(strconv.FormatInt(c.Model.ScdId, 10), true)
@@ -282,3 +326,31 @@ func (c *TaskMgr) List(pageno, pagesize int) ([]orm.Params, int, error) {
 	}
 	return r, totalCnt, err
 }
+
+//获取指定任务的已选择模型
+func (c *TaskMgr) GetModels() ([]orm.Params, int, error) {
+	if c.Model.Id == 0 {
+		return nil, 0, errors.New("任务ID不能为空")
+	}
+	db := orm.NewOrm()
+	rowset := []orm.Params{}
+	_, err := db.Raw("select t.*,t1.model_name,t1.vol_id,t1.line_link_style from t_data_task_model t,t_data_model_defualt t1 where t.model_id=t1.id and t.task_id=?", c.Model.Id).Values(&rowset)
+	if err != nil {
+		return rowset, 0, err
+	}
+	return rowset, len(rowset), nil
+}
+
+//根据SCD ID获取指定任务的已选择模型
+func (c *TaskMgr) GetModelsByScdID(scdid int64) ([]orm.Params, int, error) {
+	if scdid == 0 {
+		return nil, 0, errors.New("SCD ID不能为空")
+	}
+	db := orm.NewOrm()
+	rowset := []orm.Params{}
+	_, err := db.Raw("select t.*,t1.model_name,t1.vol_id,t1.line_link_style from t_data_task a, t_data_task_model t,t_data_model_defualt t1 where a.id=t.task_id and t.model_id=t1.id and a.scd_id=?", scdid).Values(&rowset)
+	if err != nil {
+		return rowset, 0, err
+	}
+	return rowset, len(rowset), nil
+}

+ 4 - 3
service/models/bo/task_model.go

@@ -37,7 +37,7 @@ func init() {
 }
 
 //保存任务模型信息
-func (c *TaskModelMgr) Save(modelids [][]int) (err error) {
+func (c *TaskModelMgr) Save(modelids []int) (err error) {
 	dblog := new(SystemLog)
 	dblog.SetUserInfo(c.GetUserInfo())
 	dblog.Audittype = enum.AuditType_check_task
@@ -51,8 +51,9 @@ func (c *TaskModelMgr) Save(modelids [][]int) (err error) {
 	db := orm.NewOrm()
 	c.Model.Cr, _ = strconv.Atoi(c.GetUserId())
 	for _, ids := range modelids {
-		c.Model.AreaId = (ids[0])
-		c.Model.ModelId = (ids[1])
+		//c.Model.AreaId = (ids[0])
+		//c.Model.ModelId = (ids[1])
+		c.Model.ModelId = ids
 		_, err = db.Insert(&c.Model)
 		if err != nil {
 			break

+ 48 - 0
service/models/enum/enum_task_step.go

@@ -0,0 +1,48 @@
+package enum
+
+//操作结果类型
+type TaskStep int
+
+const (
+	//加载SCD
+	TaskStep_SCD_Loading TaskStep = iota
+	//解析SCD
+	TaskStep_SCD_Parse
+	//语法分析
+	TaskStep_SCD_syntax_parse
+	TaskStep_SCD_rule_parse
+	TaskStep_SCD_crc_extract
+	TaskStep_SCD_ccd_extract
+	TaskStep_SCD_cid_extract
+	TaskStep_SCD_icd_extract
+	TaskStep_SCD_model_parse
+	TaskStep_SCD_fcda_parse
+)
+
+func (t TaskStep) Code() string {
+	switch t {
+	case TaskStep_SCD_Loading:
+		return "scd_loading"
+	case TaskStep_SCD_Parse:
+		return "scd_parse"
+	case TaskStep_SCD_syntax_parse:
+		return "scd_syntax_parse"
+	case TaskStep_SCD_rule_parse:
+		return "scd_rule_parse"
+	case TaskStep_SCD_ccd_extract:
+		return "scd_ccd_extract"
+	case TaskStep_SCD_cid_extract:
+		return "scd_cid_extract"
+	case TaskStep_SCD_icd_extract:
+		return "scd_icd_extract"
+	case TaskStep_SCD_model_parse:
+		return "scd_model_parse"
+	case TaskStep_SCD_fcda_parse:
+		return "scd_fcda_parse"
+	case TaskStep_SCD_crc_extract:
+		return "scd_crc_extract"
+	default:
+		return ""
+	}
+
+}

+ 27 - 0
service/routers/commentsRouter_____________ME_GoProject_src_scd_check_tools_controllers.go

@@ -549,6 +549,15 @@ func init() {
 
     beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"],
         beego.ControllerComments{
+            Method: "GetCheckAreaIedByAreaID",
+            Router: "/admin/get/check_area/ied",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"],
+        beego.ControllerComments{
             Method: "DeleteLinkStyleModelByID",
             Router: "/admin/linkstyle-model/delete",
             AllowHTTPMethods: []string{"post"},
@@ -646,6 +655,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"],
+        beego.ControllerComments{
+            Method: "SaveCheckAreaIedByAreaID",
+            Router: "/admin/update/check_area/ied",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["scd_check_tools/controllers:FlowController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:FlowController"],
         beego.ControllerComments{
             Method: "DeleteFlowCnf_NodeUser",
@@ -1260,6 +1278,15 @@ func init() {
 
     beego.GlobalControllerRouter["scd_check_tools/controllers:TaskController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:TaskController"],
         beego.ControllerComments{
+            Method: "GetTaskInfo",
+            Router: "/task/info",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["scd_check_tools/controllers:TaskController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:TaskController"],
+        beego.ControllerComments{
             Method: "GetTaskList",
             Router: "/task/list",
             AllowHTTPMethods: []string{"get"},

+ 115 - 2
service/static/swagger/swagger.json

@@ -54,6 +54,44 @@
                 }
             }
         },
+        "/admin/get/check_area/ied": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "查询指定检测间隔下的IED装置列表",
+                "description": "查询指定检测间隔下的IED装置列表",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "area_id",
+                        "description": "检测间隔ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/admin/linkstyle-model/delete": {
             "post": {
                 "tags": [
@@ -573,6 +611,51 @@
                 }
             }
         },
+        "/admin/update/check_area/ied": {
+            "post": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "修改并保存指定检测间隔下的IED装置列表",
+                "description": "修改并保存指定检测间隔下的IED装置列表",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "area_id",
+                        "description": "检测间隔ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "ied_ids",
+                        "description": "IED装置name列表,多个ied采用逗号分隔。如:PT1001,PL1001,...",
+                        "required": true,
+                        "type": "string"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/area/children/list": {
             "get": {
                 "tags": [
@@ -5357,6 +5440,36 @@
                 }
             }
         },
+        "/task/info": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersTaskController"
+                ],
+                "summary": "获取指定检测任务的详细信息",
+                "description": "获取指定检测任务的详细信息",
+                "parameters": [
+                    {
+                        "in": "query",
+                        "name": "id",
+                        "description": "任务ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/task/list": {
             "get": {
                 "tags": [
@@ -5489,9 +5602,9 @@
                     {
                         "in": "formData",
                         "name": "modelids",
-                        "description": "间隔-模型关系。数据格式:[[间隔id,模型id],[间隔id,模型id],..]多个间隔-模型关系之间逗号分隔",
+                        "description": "模型ID。多个模型ID之间逗号分隔",
                         "required": true,
-                        "type": "array"
+                        "type": "string"
                     }
                 ],
                 "responses": {

+ 79 - 2
service/static/swagger/swagger.yml

@@ -38,6 +38,32 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /admin/get/check_area/ied:
+    get:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 查询指定检测间隔下的IED装置列表
+      description: 查询指定检测间隔下的IED装置列表
+      parameters:
+      - in: formData
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: area_id
+        description: 检测间隔ID
+        required: true
+        type: integer
+        format: int64
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /admin/linkstyle-model/delete:
     post:
       tags:
@@ -393,6 +419,37 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /admin/update/check_area/ied:
+    post:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 修改并保存指定检测间隔下的IED装置列表
+      description: 修改并保存指定检测间隔下的IED装置列表
+      parameters:
+      - in: formData
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: area_id
+        description: 检测间隔ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: ied_ids
+        description: IED装置name列表,多个ied采用逗号分隔。如:PT1001,PL1001,...
+        required: true
+        type: string
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /area/children/list:
     get:
       tags:
@@ -3632,6 +3689,26 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /task/info:
+    get:
+      tags:
+      - scd_check_tools/controllersTaskController
+      summary: 获取指定检测任务的详细信息
+      description: 获取指定检测任务的详细信息
+      parameters:
+      - in: query
+        name: id
+        description: 任务ID
+        required: true
+        type: integer
+        format: int64
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /task/list:
     get:
       tags:
@@ -3726,9 +3803,9 @@ paths:
         format: int64
       - in: formData
         name: modelids
-        description: 间隔-模型关系。数据格式:[[间隔id,模型id],[间隔id,模型id],..]多个间隔-模型关系之间逗号分隔
+        description: 模型ID。多个模型ID之间逗号分隔
         required: true
-        type: array
+        type: string
       responses:
         "200":
           description: 成功

+ 115 - 2
service/swagger/swagger.json

@@ -54,6 +54,44 @@
                 }
             }
         },
+        "/admin/get/check_area/ied": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "查询指定检测间隔下的IED装置列表",
+                "description": "查询指定检测间隔下的IED装置列表",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "area_id",
+                        "description": "检测间隔ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/admin/linkstyle-model/delete": {
             "post": {
                 "tags": [
@@ -573,6 +611,51 @@
                 }
             }
         },
+        "/admin/update/check_area/ied": {
+            "post": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "修改并保存指定检测间隔下的IED装置列表",
+                "description": "修改并保存指定检测间隔下的IED装置列表",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "area_id",
+                        "description": "检测间隔ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "ied_ids",
+                        "description": "IED装置name列表,多个ied采用逗号分隔。如:PT1001,PL1001,...",
+                        "required": true,
+                        "type": "string"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/area/children/list": {
             "get": {
                 "tags": [
@@ -5357,6 +5440,36 @@
                 }
             }
         },
+        "/task/info": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersTaskController"
+                ],
+                "summary": "获取指定检测任务的详细信息",
+                "description": "获取指定检测任务的详细信息",
+                "parameters": [
+                    {
+                        "in": "query",
+                        "name": "id",
+                        "description": "任务ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/task/list": {
             "get": {
                 "tags": [
@@ -5489,9 +5602,9 @@
                     {
                         "in": "formData",
                         "name": "modelids",
-                        "description": "间隔-模型关系。数据格式:[[间隔id,模型id],[间隔id,模型id],..]多个间隔-模型关系之间逗号分隔",
+                        "description": "模型ID。多个模型ID之间逗号分隔",
                         "required": true,
-                        "type": "array"
+                        "type": "string"
                     }
                 ],
                 "responses": {

+ 79 - 2
service/swagger/swagger.yml

@@ -38,6 +38,32 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /admin/get/check_area/ied:
+    get:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 查询指定检测间隔下的IED装置列表
+      description: 查询指定检测间隔下的IED装置列表
+      parameters:
+      - in: formData
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: area_id
+        description: 检测间隔ID
+        required: true
+        type: integer
+        format: int64
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /admin/linkstyle-model/delete:
     post:
       tags:
@@ -393,6 +419,37 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /admin/update/check_area/ied:
+    post:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 修改并保存指定检测间隔下的IED装置列表
+      description: 修改并保存指定检测间隔下的IED装置列表
+      parameters:
+      - in: formData
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: area_id
+        description: 检测间隔ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: ied_ids
+        description: IED装置name列表,多个ied采用逗号分隔。如:PT1001,PL1001,...
+        required: true
+        type: string
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /area/children/list:
     get:
       tags:
@@ -3632,6 +3689,26 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /task/info:
+    get:
+      tags:
+      - scd_check_tools/controllersTaskController
+      summary: 获取指定检测任务的详细信息
+      description: 获取指定检测任务的详细信息
+      parameters:
+      - in: query
+        name: id
+        description: 任务ID
+        required: true
+        type: integer
+        format: int64
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /task/list:
     get:
       tags:
@@ -3726,9 +3803,9 @@ paths:
         format: int64
       - in: formData
         name: modelids
-        description: 间隔-模型关系。数据格式:[[间隔id,模型id],[间隔id,模型id],..]多个间隔-模型关系之间逗号分隔
+        description: 模型ID。多个模型ID之间逗号分隔
         required: true
-        type: array
+        type: string
       responses:
         "200":
           description: 成功

+ 2 - 0
service/tools/tool.go

@@ -80,6 +80,8 @@ func IsEmpty(p interface{}, defaultvalue ...string) string {
 	objtype := Typeof(p)
 	if objtype == "int" {
 		return strconv.Itoa(p.(int))
+	} else if objtype == "int32" {
+		return strconv.FormatInt(int64(p.(int32)), 10)
 	} else if objtype == "int64" {
 		return strconv.FormatInt(p.(int64), 10)
 	} else if objtype == "float64" {