Browse Source

完善系统设置模块功能

liling 1 year ago
parent
commit
d59df02d5a

+ 39 - 6
service/controllers/busAdminController.go

@@ -251,8 +251,8 @@ func (c *BusAdminController) GetLinkStyleModelList() {
 //	@Param 	model_name 		formData   string  	true 	"模型名称"
 //	@Param 	vol_id 			formData   int  	true 	"电压等级ID"
 //	@Param 	line_link_style	formData   int  	true 	"接线方式ID"
-//	@Param 	ied_types		formData   string  	false 	"包含的装置类型。多个类型之间使用逗号分隔。"
-//	@Param 	relation_json	formData   string  	false 	"模型定义内容。Json序列串。"
+//	@Param 	ied_types		formData   string  	false 	"包含的装置类型,关联代码:ied_type。多个类型之间使用逗号分隔。"
+//	@Param 	relation_json	formData   string  	false 	"模型定义内容。svg源代码(xml格式)。"
 //	@Param 	area_type 		formData   string  	false 	"间隔类型。关联代码:area_type"
 // 	@Success     200    {object} ResultOK 成功
 // 	@Failure 	 500 	{object} ResultError  失败
@@ -268,22 +268,22 @@ func (c *BusAdminController) SaveSysModelInfo() {
 	obj.Model.VolId, _ = c.GetInt("vol_id")
 	obj.Model.LineLinkStyle, _ = c.GetInt("line_link_style")
 	obj.Model.RelationJson = c.GetString("relation_json")
-	if obj.Model.ModelName == "" {
+	if id == 0 && obj.Model.ModelName == "" {
 		c.Data["json"] = c.ResultError("模型名称不能为空")
 		c.ServeJSON()
 		return
 	}
-	if obj.Model.VolId == 0 {
+	if id == 0 && obj.Model.VolId == 0 {
 		c.Data["json"] = c.ResultError("电压等级不能为空")
 		c.ServeJSON()
 		return
 	}
-	if obj.Model.LineLinkStyle == 0 {
+	if id == 0 && obj.Model.LineLinkStyle == 0 {
 		c.Data["json"] = c.ResultError("接线方式不能为空")
 		c.ServeJSON()
 		return
 	}
-	if obj.Model.AreaType == 0 {
+	if id == 0 && obj.Model.AreaType == 0 {
 		c.Data["json"] = c.ResultError("间隔类型不能为空")
 		c.ServeJSON()
 		return
@@ -437,3 +437,36 @@ func (c *BusAdminController) ResetCheckAreaByID() {
 	c.Data["json"] = c.ResultOK("", 0)
 	c.ServeJSON()
 }
+
+// @Summary 查询指定电压等级及接线方式下的检测间隔分析结果
+//	@Description  查询指定电压等级及接线方式下的检测间隔分析结果
+// 	@Tags         业务管理服务
+// 	@Accept       x-www-form-urlencoded
+// 	@Produce      json
+//	@Param 	scd_id 			formData   int  true 	"SCD文件ID"
+//	@Param 	vol_id 			formData   int  false 	"电压等级ID"
+//	@Param 	link_style_id	formData   int  false 	"接线方式ID"
+// 	@Success     200    {object} ResultOK 成功
+// 	@Failure 	 500 	{object} ResultError  失败
+// @router /admin/get/check_area [get]
+func (c *BusAdminController) GetCheckAreaByVolID() {
+	id, _ := c.GetInt64("scd_id")
+	if id == 0 {
+		c.Data["json"] = c.ResultError("SCD文件ID不能为空!")
+		c.ServeJSON()
+		return
+	}
+	volid, _ := c.GetInt("vol_id")
+	lsid, _ := c.GetInt("link_style_id")
+	obj := new(bo.CheckAreaMgr)
+	obj.SetUserInfo(c.GetCurrentUserInfo())
+	obj.ScdId = id
+	lst, err := obj.GetAreaListByVol(id, volid, lsid)
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
+	}
+	c.Data["json"] = c.ResultOK(lst, 0)
+	c.ServeJSON()
+}

+ 1 - 1
service/lastupdate.tmp

@@ -1 +1 @@
-{"G:\\工作目录\\ME\\GoProject\\src\\scd_check_tools\\controllers":1697012970168849700,"G:\\工作目录\\ME\\GoProject\\src\\scd_check_tools\\upgrade":1697010325409069900}
+{"G:\\工作目录\\ME\\GoProject\\src\\scd_check_tools\\controllers":1702649929273426200,"G:\\工作目录\\ME\\GoProject\\src\\scd_check_tools\\upgrade":1697010325409069900}

+ 0 - 4
service/main.go

@@ -86,10 +86,6 @@ var (
 func main() {
 	runtime.GOMAXPROCS(cpunum)
 	logger.Logger.Init()
-	//fmt.Println(new(bo.ScdParse).ParseIedName("GYCK01"))
-	//base64Str, _ := os.ReadFile("C:\\Users\\lenovo\\Desktop\\1666608995.jpg")
-	//log.Println(string(base64Str))
-	//tools.Base64MakePic(string(base64Str), "C:\\Users\\lenovo\\Desktop\\test.jpg")
 	logger.Logger.Println(tools.NowTime() + " 当前操作系统:" + string(runtime.GOOS) + " " + runtime.GOARCH)
 	conf.LoadAppConf()
 	dbtype := tools.IsEmpty(conf.GlobalConfig["dbtype"])

+ 110 - 12
service/models/bo/check_sys_model.go

@@ -1,6 +1,8 @@
 package bo
 
 import (
+	"encoding/json"
+	"encoding/xml"
 	"errors"
 	"fmt"
 	"scd_check_tools/logger"
@@ -28,6 +30,38 @@ type T_data_model_defualt struct {
 	Ur            int    // '更新人' ,
 	Ut            string `orm:"-"` // '更新时间'
 }
+type ModelNodeStruct struct {
+	XMLName xml.Name       `xml:"flow"`
+	Nodes   []*INodeStruct `xml:"nodes"`
+	Edges   []*IEdges      `xml:"edges"`
+}
+type INodeStruct struct {
+	Id         string       `xml:"id"`
+	Type       string       `xml:"type"`
+	X          string       `xml:"x"`
+	Y          string       `xml:"y"`
+	Text       *IText       `xml:"text"`
+	Properties *Iproperties `xml:"properties"`
+}
+type IText struct {
+	X     string `xml:"x"`
+	Y     string `xml:"y"`
+	Value string `xml:"value"`
+}
+type Iproperties struct {
+	IedType string `xml:"ied_type"`
+}
+
+type IEdges struct {
+	Id           string           `xml:"id"`
+	Type         string           `xml:"type"`
+	SourceNodeId string           `xml:"sourceNodeId"`
+	TargetNodeId string           `xml:"targetNodeId"`
+	Properties   *ILineProperties `xml:"properties"`
+}
+type ILineProperties struct {
+	Issv string `xml:"issv"` // SV|GOOSE
+}
 
 //内置检测模型管理对象
 type SysCheckModelMgr struct {
@@ -75,11 +109,19 @@ func (c *SysCheckModelMgr) Save() (err error) {
 		}
 		c.Model.Cr, _ = strconv.Atoi(c.GetUserId())
 		newid, err2 := db.Insert(&c.Model)
-		if err2 == nil && c.Model.RelationJson != "" {
-			m2 := new(SysCheckModelIedRelationMgr)
-			m2.SetUserInfo(c.GetUserInfo())
-			m2.Model.ModelId = int(newid)
-			err = m2.Save(c.Model.RelationJson)
+		if err2 == nil {
+			//添加接线方式与模型关系
+			lm := new(LinkStyleModelMgr)
+			lm.Model.LinkstyleId = c.Model.LineLinkStyle
+			lm.Model.ModelId = int(newid)
+			lm.SetUserInfo(c.GetUserInfo())
+			lm.Save()
+			if c.Model.RelationJson != "" {
+				m2 := new(SysCheckModelIedRelationMgr)
+				m2.SetUserInfo(c.GetUserInfo())
+				m2.Model.ModelId = int(newid)
+				//err = m2.Save(c.Model.RelationJson)
+			}
 		}
 		if err2 != nil {
 			err = err2
@@ -105,6 +147,15 @@ func (c *SysCheckModelMgr) Save() (err error) {
 		}
 		if c.Model.LineLinkStyle == 0 {
 			c.Model.LineLinkStyle = tmpObj.LineLinkStyle
+		} else if c.Model.LineLinkStyle != tmpObj.LineLinkStyle {
+			//更新接线方式与模型关系
+			lm := new(LinkStyleModelMgr)
+			lm.Model.LinkstyleId = tmpObj.LineLinkStyle
+			lm.Model.ModelId = c.Model.Id
+			lm.SetUserInfo(c.GetUserInfo())
+			lm.Delete() //清除原来的关系
+			lm.Model.LinkstyleId = c.Model.LineLinkStyle
+			lm.Save()
 		}
 		if c.Model.VolId == 0 {
 			c.Model.VolId = tmpObj.VolId
@@ -112,11 +163,57 @@ func (c *SysCheckModelMgr) Save() (err error) {
 		if c.Model.IsSys == 0 {
 			c.Model.IsSys = tmpObj.IsSys
 		}
-		m2 := new(SysCheckModelIedRelationMgr)
-		m2.SetUserInfo(c.GetUserInfo())
-		m2.Model.ModelId = c.Model.Id
-		err = m2.Save(c.Model.RelationJson) //先执行这
-		if c.Model.RelationJson == "" {
+
+		if c.Model.RelationJson != "" {
+			// 解析出模型需要的装置类型
+			modelJson := map[string]interface{}{}
+			err = json.Unmarshal([]byte(c.Model.RelationJson), &modelJson)
+			/* <nodes>
+			   <id>5d787390-ebbb-4e97-93d2-87f6a63f7c44</id>
+			   <type>rect</type>
+			   <x>417</x>
+			   <y>202</y>
+			   <properties>
+			     <ied_type>PM</ied_type>
+			   </properties>
+			   <text>
+			     <x>417</x>
+			     <y>202</y>
+			     <value>母线保护</value>
+			   </text>
+			 </nodes>*/
+			/*nodes := new(ModelNodeStruct)
+			err = xml.Unmarshal([]byte(`<flow>`+c.Model.RelationJson+`</flow>`), &nodes)
+			*/
+			if err != nil {
+				logger.Logger.Error(err)
+				dblog.Description = fmt.Sprintf("保存%s信息失败:%s,操作数据:%+v", sysCheckModelDesc, err.Error(), c.Model)
+				dblog.Fail2()
+				return err
+			}
+			/*
+				if nodes.Nodes != nil && len(nodes.Nodes) > 0 {
+					iedtypes := []string{}
+					for _, ritem := range nodes.Nodes {
+						iedtypes = append(iedtypes, ritem.Properties.IedType)
+					}
+					c.Model.IedTypes = strings.Join(iedtypes, ",")
+				}
+			*/
+			if modelJson["nodes"] != nil {
+				nodes := modelJson["nodes"].([]interface{})
+				iedtypes := []string{}
+				for _, ritem := range nodes {
+					properties := ritem.(map[string]interface{})["properties"].(map[string]interface{})
+					iedtypes = append(iedtypes, tools.IsEmpty(properties["ied_type"]))
+				}
+				c.Model.IedTypes = strings.Join(iedtypes, ",")
+			}
+			m2 := new(SysCheckModelIedRelationMgr)
+			m2.SetUserInfo(c.GetUserInfo())
+			m2.Model.ModelId = c.Model.Id
+			err = m2.Save(modelJson) //先执行这
+		} else {
 			c.Model.RelationJson = tmpObj.RelationJson
 		}
 		if err == nil {
@@ -141,11 +238,12 @@ func (c *SysCheckModelMgr) One() (T_data_model_defualt, error) {
 		return c.Model, errors.New("未指定id")
 	}
 	o := orm.NewOrm()
-	err := o.Read(&c.Model)
+	tmpMod := T_data_model_defualt{Id: c.Model.Id}
+	err := o.Read(&tmpMod)
 	if err != nil {
 		logger.Logger.Error(err)
 	}
-	return c.Model, err
+	return tmpMod, err
 }
 
 //根据model中指定的id删除

+ 33 - 37
service/models/bo/check_sysmodel_ied_relation.go

@@ -1,13 +1,11 @@
 package bo
 
 import (
-	"encoding/json"
 	"fmt"
 	"scd_check_tools/logger"
 	"scd_check_tools/models/enum"
 	"scd_check_tools/tools"
 	"strconv"
-	"strings"
 
 	"sync"
 
@@ -45,14 +43,9 @@ func init() {
 }
 
 //保存检测模型装置关系信息
-func (c *SysCheckModelIedRelationMgr) Save(jsonstr string) (err error) {
-	data := []map[string]interface{}{}
-	if jsonstr != "" {
-		err = json.Unmarshal([]byte(jsonstr), &data)
-		if err != nil {
-			logger.Logger.Error(err)
-			return err
-		}
+func (c *SysCheckModelIedRelationMgr) Save(nodes map[string]interface{}) (err error) {
+	if nodes == nil {
+		return
 	}
 	dblog := new(SystemLog)
 	dblog.SetUserInfo(c.GetUserInfo())
@@ -67,34 +60,37 @@ func (c *SysCheckModelIedRelationMgr) Save(jsonstr string) (err error) {
 		dblog.Description = fmt.Sprintf("保存%s信息失败:%s,操作数据:%+v", sysCheckModel_iedRelationDesc, err.Error(), c.Model)
 		dblog.Fail2()
 	} else {
-		tmpMap := map[string]map[string]interface{}{}
-		for _, item := range data {
-			ind := tools.IsEmpty(item["ind"])
-			tmpMap[ind] = item
+		tmpMap := map[string]interface{}{}
+		for _, item2 := range nodes["nodes"].([]interface{}) {
+			item := item2.(map[string]interface{})
+			tmpMap[tools.IsEmpty(item["id"])] = item
 		}
-		for _, item := range data {
-			iedtype := tools.IsEmpty(item["t"])
-			out := item["out"].([]interface{})
-			for _, ind := range out {
-				ind_item := tools.IsEmpty(ind)
-				isSv := strings.Split(ind_item, ":")
-				newm := T_data_model_relation_def{}
-				newm.ModelId = c.Model.ModelId
-				newm.Cr, _ = strconv.Atoi(c.GetUserId())
-				newm.FromIedCode = iedtype
-				newm.FromIedName = iedtype
-				if len(isSv) == 2 {
-					newm.InType = "SV"
-				} else {
-					newm.InType = "GOOSE"
-				}
-				newm.ToIedCode = tools.IsEmpty(tmpMap[isSv[0]]["t"])
-				newm.ToIedName = newm.ToIedCode
-				_, err = db.Insert(&newm)
-				if err != nil {
-					logger.Logger.Error(err)
-					return err
-				}
+		for _, line2 := range nodes["edges"].([]interface{}) {
+			line := line2.(map[string]interface{})
+			sourceied := tools.IsEmpty(line["sourceNodeId"])
+			targetied := tools.IsEmpty(line["targetNodeId"])
+			isSv := ""
+			if line["properties"] != nil {
+				isSv = tools.IsEmpty(line["properties"].(map[string]interface{})["issv"])
+			}
+			newm := T_data_model_relation_def{}
+			newm.ModelId = c.Model.ModelId
+			newm.Cr, _ = strconv.Atoi(c.GetUserId())
+			item := tmpMap[sourceied].(map[string]interface{})
+			newm.FromIedCode = tools.IsEmpty(item["properties"].(map[string]interface{})["ied_type"])
+			newm.FromIedName = tools.IsEmpty(item["text"].(map[string]interface{})["value"])
+			if isSv == "" {
+				newm.InType = "GOOSE"
+			} else {
+				newm.InType = isSv
+			}
+			item = tmpMap[targetied].(map[string]interface{})
+			newm.ToIedCode = tools.IsEmpty(item["properties"].(map[string]interface{})["ied_type"])
+			newm.ToIedName = tools.IsEmpty(item["text"].(map[string]interface{})["value"])
+			_, err = db.Insert(&newm)
+			if err != nil {
+				logger.Logger.Error(err)
+				return err
 			}
 		}
 		dblog.Description = fmt.Sprintf("保存%s信息成功,操作数据:%+v", sysCheckModel_iedRelationDesc, c.Model)

+ 358 - 17
service/models/bo/checktools_area.go

@@ -164,11 +164,20 @@ func (c *CheckAreaMgr) GetAreaList(scdid int64) ([]orm.Params, error) {
 }
 
 //获取指定scd和电压等级的间隔信息
-func (c *CheckAreaMgr) GetAreaListByVol(scdid int64, vl int32) ([]orm.Params, error) {
+func (c *CheckAreaMgr) GetAreaListByVol(scdid int64, vl, linkstyleid int) ([]orm.Params, error) {
 	db := orm.NewOrm()
-	sql := "select * from t_data_check_area where scd_id=? and voltage_level=? order by name"
+	sql := "select t1.id model_id, t1.model_name,t1.vol_id,g1.name vol_name,t1.line_link_style,ls.name,t.id area_id, t.area_name,t.ut,t.ur from t_data_check_area t right join t_data_model_defualt t1 on t.model_id=t1.id left join t_data_link_style ls on t1.line_link_style=ls.id left join global_const_code g1 on t1.vol_id=g1.id and g1.parentcode='voltage_level' where t.scd_id=? "
+	params := []interface{}{scdid}
+	if vl > 0 {
+		sql = sql + " and t1.vol_id=? "
+		params = append(params, vl)
+	}
+	if linkstyleid > 0 {
+		sql = sql + " and t1.line_link_style=? "
+		params = append(params, linkstyleid)
+	}
 	rowset := []orm.Params{}
-	_, err := db.Raw(sql, scdid, vl).Values(&rowset)
+	_, err := db.Raw(sql, params).Values(&rowset)
 	sqllog := fmt.Sprintf("SQL:%s 参数:%+v", sql, []interface{}{scdid, vl})
 	if err != nil {
 		logger.Logger.Error(err, sqllog)
@@ -290,6 +299,22 @@ func (c *CheckAreaMgr) ParseModelArea() {
 	for _, r := range iedlst {
 		iedMap[tools.IsEmpty(r["ied_name"])] = r
 	}
+	//先分析母联间隔,如果没有选择母联间隔时,主变间隔中不包含母联终端装置
+	HasAreaJ := false
+	for _, row := range c.CheckModelList {
+		areaCode := tools.IsEmpty(row["area_type_code"])
+		if areaCode == "J" {
+			HasAreaJ = true
+			modelid, _ := strconv.Atoi(tools.IsEmpty(row["id"]))
+			//modelname := tools.IsEmpty(row["model_name"])
+			iedtypes := tools.IsEmpty(row["ied_types"])
+			volcode := strings.ReplaceAll(tools.IsEmpty(row["vol_code"]), "v_level_", "")
+			c.pJ(modelid, volcode, iedtypes, iedMap, "PE")
+			c.pJ(modelid, volcode, iedtypes, iedMap, "PJ")
+			c.pJ(modelid, volcode, iedtypes, iedMap, "PK")
+			c.pJ(modelid, volcode, iedtypes, iedMap, "PF")
+		}
+	}
 	for _, row := range c.CheckModelList {
 		//逐一分析模型定义
 		modelid, _ := strconv.Atoi(tools.IsEmpty(row["id"]))
@@ -314,10 +339,14 @@ func (c *CheckAreaMgr) ParseModelArea() {
 		if modelname == "" || iedtypes == "" {
 			continue
 		}
+		//母联间隔已经提前分析,如果没有母联间隔时,主变间隔中不包含母联终端装置
+		if areaCode == "J" {
+			continue
+		}
 		//获取模型内中装备关系定义
 		//主变间隔分析:需要查站内该电压等级下的高中低压侧装置或者高低压装置组成一个间隔,以主变保护装置(PT)为起始
 		if areaCode == "T" {
-			go c.pT(modelid, iedtypes, iedMap)
+			go c.pT(modelid, iedtypes, iedMap, HasAreaJ)
 		}
 		//线路保护间隔分析:以线路保护测控装置(PL)为开始分析
 		if areaCode == "L" {
@@ -327,8 +356,198 @@ func (c *CheckAreaMgr) ParseModelArea() {
 }
 
 //变压器间隔分析
-func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Params) {
-
+func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Params, HasAreaJ bool) {
+	scdParseMgr := new(ScdParse)
+	db := orm.NewOrm()
+	//获取当前站的各电压等级
+	volRows := []orm.Params{}
+	_, err := db.Raw("select t.vol, CAST(REPLACE(UPPER(g.name),'KV','') as SIGNED) volname from t_area_ied_relation t,global_const_code g  where g.code=CONCAT('v_level_',t.vol) and g.parentcode='voltage_level' and  t.vol!=999 and t.scd_id=? GROUP BY t.vol ORDER BY volname desc", c.ScdId).Values(&volRows)
+	if err != nil {
+		logger.Logger.Error(err)
+		return
+	}
+	if len(volRows) == 0 {
+		logger.Logger.Error(errors.New("该scd未发现任何电压等级的装置"))
+		return
+	}
+	volMap := map[string]string{}
+	volMap["hight"] = tools.IsEmpty(volRows[0]["vol"]) //高压电压
+	if len(volRows) == 2 {
+		volMap["middle"] = ""
+		volMap["low"] = volRows[1]["vol"].(string) //低压电压等级
+	} else {
+		volMap["middle"] = volRows[1]["vol"].(string)           //中压电压等级
+		volMap["low"] = volRows[len(volRows)-1]["vol"].(string) //低压电压等级
+	}
+	for _, row := range ieds {
+		if tools.IsEmpty(row["ied_type"]) != "P" || tools.IsEmpty(row["p_type"]) != "T" {
+			continue
+		}
+		//pmIedName := ""
+		//mmIedName := ""
+		pl_iedname := tools.IsEmpty(row["ied_name"])
+		iednameParts := scdParseMgr.ParseIedName(pl_iedname)
+		//添加间隔数据
+		dbdata := T_data_check_area{
+			ModelId:  modelid,
+			ScdId:    c.ScdId,
+			AreaType: "T",
+			AreaName: tools.IsEmpty(row["area_name"]) + iednameParts[7],
+		}
+		newid, err := db.Insert(&dbdata)
+		if err != nil {
+			logger.Logger.Error(err)
+			return
+		}
+		ins1 := "insert into t_data_check_area_ied(scd_id,area_id,ied_name,ied_type,p_type)values"
+		insvalues := []string{}
+		inAreaIedName := pl_iedname
+		insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "P", "T"))
+		//合智一体IMT/MIT,分高中低压
+		h, m, l := c.getIedListByVol("IMT", ieds, volMap)
+		h = append(h, m...)
+		h = append(h, l...)
+		for _, r := range h {
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			if lastChar == iednameParts[7] {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "IM", "T"))
+			}
+		}
+		h, m, l = c.getIedListByVol("MIT", ieds, volMap)
+		h = append(h, m...)
+		h = append(h, l...)
+		for _, r := range h {
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			if lastChar == iednameParts[7] {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "MI", "T"))
+			}
+		}
+		//母联智能终端IE需要分高中压,无低压侧
+		if HasAreaJ {
+			h, m, l = c.getIedListByVol("IE", ieds, volMap)
+			for _, r := range h {
+				//高压侧,AB套必须与PT装置相同
+				inAreaIedName = tools.IsEmpty(r["ied_name"])
+				tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+				lastChar := tmpIednameParts[7]
+				if lastChar == iednameParts[7] {
+					insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "I", "E"))
+				}
+			}
+			for _, r := range m {
+				//中压侧
+				inAreaIedName = tools.IsEmpty(r["ied_name"])
+				tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+				lastChar := tmpIednameParts[7]
+				if lastChar == "" || lastChar == iednameParts[7] {
+					insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "I", "E"))
+				}
+			}
+		}
+		//合并单元MT分高中低压侧;低压侧无关联母线合并单元MM
+		h, m, l = c.getIedListByVol("MT", ieds, volMap)
+		h = append(h, m...)
+		h = append(h, l...)
+		for _, r := range h {
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			if lastChar == iednameParts[7] {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "M", "T"))
+			}
+		}
+		//测控装置CT分高中低压侧,且可能是多套合并单元MT共用,既不分AB套
+		h, m, l = c.getIedListByVol("CT", ieds, volMap)
+		h = append(h, m...)
+		h = append(h, l...)
+		for _, r := range h {
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			tmpVol := tmpIednameParts[3] + tmpIednameParts[4]
+			//高中低压电压等级相同的
+			if (tmpVol == volMap["low"] || tmpVol == volMap["middle"] || tmpVol == volMap["hight"]) && (lastChar == "" || lastChar == iednameParts[7]) {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "C", "T"))
+			}
+		}
+		//智能终端(IB:开关\IT:分支\IF:分段)分高中低压侧
+		h, m, l = c.getIedListByVol("IB", ieds, volMap)
+		h = append(h, m...)
+		h = append(h, l...)
+		for _, r := range h {
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			tmpVol := tmpIednameParts[3] + tmpIednameParts[4]
+			//高中低压电压等级相同的
+			if (tmpVol == volMap["low"] || tmpVol == volMap["middle"] || tmpVol == volMap["hight"]) && (lastChar == "" || lastChar == iednameParts[7]) {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "I", "B"))
+			}
+		}
+		h, m, l = c.getIedListByVol("IT", ieds, volMap)
+		h = append(h, m...)
+		h = append(h, l...)
+		for _, r := range h {
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			tmpVol := tmpIednameParts[3] + tmpIednameParts[4]
+			//高中低压电压等级相同的
+			if (tmpVol == volMap["low"] || tmpVol == volMap["middle"] || tmpVol == volMap["hight"]) && (lastChar == "" || lastChar == iednameParts[7]) {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "I", "T"))
+			}
+		}
+		h, m, l = c.getIedListByVol("IF", ieds, volMap)
+		h = append(h, m...)
+		h = append(h, l...)
+		for _, r := range h {
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			tmpVol := tmpIednameParts[3] + tmpIednameParts[4]
+			//高中低压电压等级相同的
+			if (tmpVol == volMap["low"] || tmpVol == volMap["middle"] || tmpVol == volMap["hight"]) && (lastChar == "" || lastChar == iednameParts[7]) {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "I", "F"))
+			}
+		}
+		//母线保护PM及母线合并单元MM,可能是多套合并单元MT共用,既不分AB套;低压侧智能终端无关联母线保护
+		h, m, l = c.getIedListByVol("PM", ieds, volMap)
+		for _, r := range h {
+			//高压侧,AB套必须与PT装置相同
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			if lastChar == iednameParts[7] {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "P", "M"))
+				//MM装置
+				mmIedName := c.getMMName(tmpIednameParts, ieds, iednameParts[7])
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, mmIedName, "M", "M"))
+				break
+			}
+		}
+		for _, r := range m {
+			//中压侧
+			inAreaIedName = tools.IsEmpty(r["ied_name"])
+			tmpIednameParts := scdParseMgr.ParseIedName(inAreaIedName)
+			lastChar := tmpIednameParts[7]
+			if lastChar == "" || lastChar == iednameParts[7] {
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "P", "M"))
+				//MM装置
+				mmIedName := c.getMMName(tmpIednameParts, ieds, iednameParts[7])
+				insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, mmIedName, "M", "M"))
+				break
+			}
+		}
+		_, err = db.Raw(ins1 + strings.Join(insvalues, ",")).Exec()
+		if err != nil {
+			logger.Logger.Error(err)
+			return
+		}
+	}
 }
 
 //线路间隔分析
@@ -337,17 +556,21 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
 	scdParseMgr := new(ScdParse)
 	//scdNodeMgr := new(ScdNode)
 	db := orm.NewOrm()
+
 	//scdXmlObject, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
 	for _, row := range ieds {
 		if tools.IsEmpty(row["vol"]) != vol || tools.IsEmpty(row["ied_type"]) != "P" || tools.IsEmpty(row["p_type"]) != "L" {
 			continue
 		}
+		pmIedName := ""
+		mmIedName := ""
 		pl_iedname := tools.IsEmpty(row["ied_name"])
 		iednameParts := scdParseMgr.ParseIedName(pl_iedname)
 		//添加间隔数据
 		dbdata := T_data_check_area{
 			ModelId:  modelid,
 			ScdId:    c.ScdId,
+			AreaType: "L",
 			AreaName: tools.IsEmpty(row["area_name"]) + iednameParts[7],
 		}
 		newid, err := db.Insert(&dbdata)
@@ -364,8 +587,24 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
 				//查找变压器编号
 				//1号变压器->2号变压器->3号
 				inAreaIedName = c.getPMName(iednameParts, ieds)
+				pmIedName = inAreaIedName
+				if mmIedName == "" {
+					insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, ty[0:1], ty[1:2]))
+					pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
+					//使用PM装置的名称去定义MM的名称
+					ty = "MM"
+					inAreaIedName = c.getMMName(pmIedNameParts, ieds, iednameParts[7])
+					mmIedName = inAreaIedName
+				}
 			} else if ty == "MM" {
-				inAreaIedName = c.getMMName(iednameParts, ieds)
+				if pmIedName != "" && mmIedName == "" {
+					pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
+					//使用PM装置的名称去定义MM的名称
+					inAreaIedName = c.getMMName(pmIedNameParts, ieds, iednameParts[7])
+					mmIedName = inAreaIedName
+				} else {
+					continue
+				}
 			} else {
 				inAreaIedName = ty + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
 			}
@@ -392,7 +631,91 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
 			logger.Logger.Error(err)
 			return
 		}
+		//如果mm装置还未确定
+		if mmIedName == "" {
+			pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
+			inAreaIedName := c.getMMName(pmIedNameParts, ieds, iednameParts[7])
+			_, err = db.Raw(ins1 + fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "M", "M")).Exec()
+			if err != nil {
+				logger.Logger.Error(err)
+				return
+			}
+		}
+	}
+}
+
+//母联间隔分析
+func (c *CheckAreaMgr) pJ(modelid int, vol, iedtypes string, ieds map[string]orm.Params, pjIed string) {
+	scdParseMgr := new(ScdParse)
+	//scdNodeMgr := new(ScdNode)
+	db := orm.NewOrm()
+	//scdXmlObject, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
+	for _, row := range ieds {
+		if tools.IsEmpty(row["vol"]) != vol || tools.IsEmpty(row["ied_type"]) != "P" || tools.IsEmpty(row["p_type"]) != pjIed[1:2] {
+			continue
+		}
+		pmIedName := ""
+		mmIedName := ""
+		pl_iedname := tools.IsEmpty(row["ied_name"])
+		iednameParts := scdParseMgr.ParseIedName(pl_iedname)
+		//添加间隔数据
+		dbdata := T_data_check_area{
+			ModelId:  modelid,
+			ScdId:    c.ScdId,
+			AreaType: "J",
+			AreaName: tools.IsEmpty(row["area_name"]) + iednameParts[7],
+		}
+		newid, err := db.Insert(&dbdata)
+		if err != nil {
+			logger.Logger.Error(err)
+			return
+		}
+		ins1 := "insert into t_data_check_area_ied(scd_id,area_id,ied_name,ied_type,p_type)values"
+		insvalues := []string{}
+		for _, ty := range strings.Split(iedtypes, ",") {
+			inAreaIedName := ""
+			if ty == "PM" {
+				//母线保护和母线合并单元装置编号跟随变压器
+				//查找变压器编号
+				//1号变压器->2号变压器->3号
+				inAreaIedName = c.getPMName(iednameParts, ieds)
+				pmIedName = inAreaIedName
+				if mmIedName == "" {
+					insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, ty[0:1], ty[1:2]))
+					pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
+					//使用PM装置的名称去定义MM的名称
+					ty = "MM"
+					inAreaIedName = c.getMMName(pmIedNameParts, ieds, iednameParts[7])
+					mmIedName = inAreaIedName
+				}
+			} else if ty == "MM" {
+				if pmIedName != "" && mmIedName == "" {
+					pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
+					//使用PM装置的名称去定义MM的名称
+					inAreaIedName = c.getMMName(pmIedNameParts, ieds, iednameParts[7])
+					mmIedName = inAreaIedName
+				} else {
+					continue
+				}
+			} else {
+				ty = ty[0:1] + pjIed[1:2]
+				inAreaIedName = ty + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
+				//判断与基准保护装置相同套号的装置是否存在
+				if ieds[inAreaIedName] == nil {
+					//尝试去除套号
+					inAreaIedName = ty + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6]
+				}
+			}
+			insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, ty[0:1], ty[1:2]))
+		}
+		_, err = db.Raw(ins1 + strings.Join(insvalues, ",")).Exec()
+		if err != nil {
+			logger.Logger.Error(err)
+			return
+		}
+
 	}
+
 }
 
 //根据参考ied name找出应该关联PM装置
@@ -411,20 +734,38 @@ func (c *CheckAreaMgr) getPMName(iednameParts []string, ieds map[string]orm.Para
 }
 
 //根据参考ied name找出应该关联MM装置
-func (c *CheckAreaMgr) getMMName(iednameParts []string, ieds map[string]orm.Params) string {
-	tmpIedName := "MM" + iednameParts[3] + iednameParts[4] + iednameParts[5] + "1" + iednameParts[7]
-	iedObj := ieds[tmpIedName]
-	if iedObj != nil {
-	} else {
-		tmpIedName = "MM" + iednameParts[3] + iednameParts[4] + iednameParts[5] + "2" + iednameParts[7]
-		iedObj = ieds[tmpIedName]
-		if iedObj != nil {
-			return tmpIedName
-		}
+func (c *CheckAreaMgr) getMMName(iednameParts []string, ieds map[string]orm.Params, ab string) string {
+	tmpIedName := "MM" + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + ab
+	if ieds[tmpIedName] == nil {
+		tmpIedName = "MM" + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
 	}
 	return tmpIedName
 }
 
+//根据当前设备列表,分析出电压等级(高、中、低)的设备列表
+// CT测控、IT智能终端、MT合并单元需要判断是否是本体装置,是则将其归为主变高压侧
+func (c *CheckAreaMgr) getIedListByVol(iedtype string, ieds map[string]orm.Params, vollevel map[string]string) (hightLst, middleLst, lowLst []orm.Params) {
+	tmpLst := map[string][]orm.Params{}
+	for _, v := range vollevel {
+		tmpLst[v] = []orm.Params{}
+	}
+	scdParseMgr := new(ScdParse)
+	for _, row := range ieds {
+		pl_iedname := tools.IsEmpty(row["ied_name"])
+		if pl_iedname[0:len(iedtype)] != iedtype {
+			continue
+		}
+		iednameParts := scdParseMgr.ParseIedName(pl_iedname)
+		volvalue := iednameParts[3] + iednameParts[4]
+		if tmpLst[volvalue] == nil {
+			tmpLst[volvalue] = []orm.Params{row}
+		} else {
+			tmpLst[volvalue] = append(tmpLst[volvalue], row)
+		}
+	}
+	return tmpLst[vollevel["hight"]], tmpLst[vollevel["middle"]], tmpLst[vollevel["low"]]
+}
+
 //测试
 func (c *CheckAreaMgr) TestAppendNode(iedname string) {
 	//t := t_scd_node_scl{NodeName: iedname}

+ 1 - 1
service/models/bo/link_style_area.go

@@ -121,7 +121,7 @@ func (c *LinkStyleModelMgr) List(pageno, pagesize int) ([]orm.Params, int, error
 	dblog.Eventlevel = enum.OptEventLevel_Low
 	o := orm.NewOrm()
 	sqlParamters := []interface{}{}
-	sql := "select t.* from t_data_link_style_model t where 1=1 "
+	sql := "select t.*,t1.model_name from t_data_link_style_model t,t_data_model_defualt t1 where t.model_id=t1.id "
 
 	if c.Model.Id > 0 {
 		sql += " and t.id=?"

+ 4 - 2
service/models/bo/scd_file_parse.go

@@ -3338,6 +3338,7 @@ func (c *ScdParse) ParseIedName(name string) []string {
 	//补全实际ied name为8位
 	new_ied_name_full := []string{"", "", "", "", "", "", "", ""}
 	tl := len(name)
+	logger.Logger.Debug(fmt.Sprintf("ied name:%s", name))
 	if tl > 4 {
 		//至少有5位置编码才可能补全
 		lastchar := name[tl-1:]
@@ -3366,9 +3367,10 @@ func (c *ScdParse) ParseIedName(name string) []string {
 		}
 		tl = len(name)
 		new_ied_name_full[2] = name[tl-1 : tl]
-		if len(name) == 2 {
+		if tl == 2 {
 			new_ied_name_full[0] = name[0:1]
-		} else {
+		} else if tl > 2 {
+			logger.Logger.Debug(fmt.Sprintf("ied name:%s", name))
 			new_ied_name_full[1] = name[1:2]
 			new_ied_name_full[0] = name[0:1]
 		}

+ 17 - 15
service/models/bo/scd_node_rule.go

@@ -1,17 +1,17 @@
 package bo
 
 import (
+	"errors"
+	"fmt"
+	"log"
+	"os"
+	"runtime"
 	"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"
-	"errors"
-	"fmt"
-	"log"
-	"os"
-	"runtime"
 	"strconv"
 	"strings"
 	"sync"
@@ -2489,21 +2489,23 @@ func (c *ScdNodeRule) iedIntAddrDoiOrDaiExist(iedname, intAddr string) (obj inte
 											}
 										}
 										das := strings.Split(daname, ".")
-										for _, sdi := range doi.SDI {
-											if sdi.Name == das[0] {
-												for _, dai := range sdi.DAI {
-													if dai.Name == das[1] {
-														return dai, cdc
-													}
-												}
-												for _, sdi2 := range sdi.SDI {
-													for _, dai := range sdi2.DAI {
+										if len(das) > 1 {
+											for _, sdi := range doi.SDI {
+												if sdi.Name == das[0] {
+													for _, dai := range sdi.DAI {
 														if dai.Name == das[1] {
 															return dai, cdc
 														}
 													}
+													for _, sdi2 := range sdi.SDI {
+														for _, dai := range sdi2.DAI {
+															if dai.Name == das[1] {
+																return dai, cdc
+															}
+														}
+													}
+													return nil, cdc
 												}
-												return nil, cdc
 											}
 										}
 										return nil, cdc

+ 9 - 0
service/routers/commentsRouter_____________ME_GoProject_src_scd_check_tools_controllers.go

@@ -540,6 +540,15 @@ func init() {
 
     beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"],
         beego.ControllerComments{
+            Method: "GetCheckAreaByVolID",
+            Router: "/admin/get/check_area",
+            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"},

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

@@ -10,6 +10,50 @@
     },
     "basePath": "api",
     "paths": {
+        "/admin/get/check_area": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "查询指定电压等级及接线方式下的检测间隔分析结果",
+                "description": "查询指定电压等级及接线方式下的检测间隔分析结果",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "vol_id",
+                        "description": "电压等级ID",
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "link_style_id",
+                        "description": "接线方式ID",
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/admin/linkstyle-model/delete": {
             "post": {
                 "tags": [
@@ -463,13 +507,13 @@
                     {
                         "in": "formData",
                         "name": "ied_types",
-                        "description": "包含的装置类型。多个类型之间使用逗号分隔。",
+                        "description": "包含的装置类型,关联代码:ied_type。多个类型之间使用逗号分隔。",
                         "type": "string"
                     },
                     {
                         "in": "formData",
                         "name": "relation_json",
-                        "description": "模型定义内容。Json序列串。",
+                        "description": "模型定义内容。svg源代码(xml格式)。",
                         "type": "string"
                     },
                     {

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

@@ -8,6 +8,36 @@ info:
     email: 3116246@qq.com
 basePath: api
 paths:
+  /admin/get/check_area:
+    get:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 查询指定电压等级及接线方式下的检测间隔分析结果
+      description: 查询指定电压等级及接线方式下的检测间隔分析结果
+      parameters:
+      - in: formData
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: vol_id
+        description: 电压等级ID
+        type: integer
+        format: int64
+      - in: formData
+        name: link_style_id
+        description: 接线方式ID
+        type: integer
+        format: int64
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /admin/linkstyle-model/delete:
     post:
       tags:
@@ -321,11 +351,11 @@ paths:
         format: int64
       - in: formData
         name: ied_types
-        description: 包含的装置类型。多个类型之间使用逗号分隔。
+        description: 包含的装置类型,关联代码:ied_type。多个类型之间使用逗号分隔。
         type: string
       - in: formData
         name: relation_json
-        description: 模型定义内容。Json序列串
+        description: 模型定义内容。svg源代码(xml格式)
         type: string
       - in: formData
         name: area_type

+ 46 - 2
service/swagger/swagger.json

@@ -10,6 +10,50 @@
     },
     "basePath": "api",
     "paths": {
+        "/admin/get/check_area": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "查询指定电压等级及接线方式下的检测间隔分析结果",
+                "description": "查询指定电压等级及接线方式下的检测间隔分析结果",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "vol_id",
+                        "description": "电压等级ID",
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "link_style_id",
+                        "description": "接线方式ID",
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/admin/linkstyle-model/delete": {
             "post": {
                 "tags": [
@@ -463,13 +507,13 @@
                     {
                         "in": "formData",
                         "name": "ied_types",
-                        "description": "包含的装置类型。多个类型之间使用逗号分隔。",
+                        "description": "包含的装置类型,关联代码:ied_type。多个类型之间使用逗号分隔。",
                         "type": "string"
                     },
                     {
                         "in": "formData",
                         "name": "relation_json",
-                        "description": "模型定义内容。Json序列串。",
+                        "description": "模型定义内容。svg源代码(xml格式)。",
                         "type": "string"
                     },
                     {

+ 32 - 2
service/swagger/swagger.yml

@@ -8,6 +8,36 @@ info:
     email: 3116246@qq.com
 basePath: api
 paths:
+  /admin/get/check_area:
+    get:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 查询指定电压等级及接线方式下的检测间隔分析结果
+      description: 查询指定电压等级及接线方式下的检测间隔分析结果
+      parameters:
+      - in: formData
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: vol_id
+        description: 电压等级ID
+        type: integer
+        format: int64
+      - in: formData
+        name: link_style_id
+        description: 接线方式ID
+        type: integer
+        format: int64
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /admin/linkstyle-model/delete:
     post:
       tags:
@@ -321,11 +351,11 @@ paths:
         format: int64
       - in: formData
         name: ied_types
-        description: 包含的装置类型。多个类型之间使用逗号分隔。
+        description: 包含的装置类型,关联代码:ied_type。多个类型之间使用逗号分隔。
         type: string
       - in: formData
         name: relation_json
-        description: 模型定义内容。Json序列串
+        description: 模型定义内容。svg源代码(xml格式)
         type: string
       - in: formData
         name: area_type

+ 1 - 0
service/test/test.go

@@ -190,6 +190,7 @@ func (t *UnitTest) AddTest15() {
 }
 
 func (t *UnitTest) Test16() {
+	return
 	testobj := new(bo.CheckAreaMgr)
 	testobj.ScdId = 4000002
 	logger.Logger.Println(fmt.Sprintf("============正在测试[生成检测模型间隔]方法,参数:"))