forked from wuweidong/hzims-back-huoshan
				
			
				 38 changed files with 1742 additions and 0 deletions
			
			
		@ -0,0 +1,48 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.entity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||||
 | 
					import lombok.Data; | 
				
			||||||
 | 
					import org.springblade.core.mp.base.BaseEntity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data | 
				
			||||||
 | 
					@TableName("irrbdgate") | 
				
			||||||
 | 
					public class IrrBDGate extends BaseEntity { | 
				
			||||||
 | 
					    private String strobeCode; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String stcd; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String watergateCode; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String producingArea; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String factory; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String strobeType; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String strobeMaterial; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Double height; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Double width; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Double thickness; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String motivity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String type; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Short velocity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String areaCode; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String lrcd; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String szhldm; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Float dongj; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Float beiw; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Float discharge; | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,14 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.entity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data | 
				
			||||||
 | 
					public class IrrBDGateRefData { | 
				
			||||||
 | 
					    private String strobeCode; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String refstcd; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String refqpoint; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String refzpoint; | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,64 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.entity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||||
 | 
					import io.swagger.annotations.ApiModelProperty; | 
				
			||||||
 | 
					import lombok.Data; | 
				
			||||||
 | 
					import org.springblade.core.mp.base.BaseEntity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Date; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * 水库信息表 | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					@Data | 
				
			||||||
 | 
					@TableName("st_rsr_bsin") | 
				
			||||||
 | 
					public class StRsrBsin extends BaseEntity { | 
				
			||||||
 | 
					    @ApiModelProperty("水库代码") | 
				
			||||||
 | 
					    private String rscd; | 
				
			||||||
 | 
					    @ApiModelProperty("水库名称") | 
				
			||||||
 | 
					    private String rtunm; | 
				
			||||||
 | 
					    @ApiModelProperty("主管部门") | 
				
			||||||
 | 
					    private String cmdp; | 
				
			||||||
 | 
					    @ApiModelProperty("主管部门联系电话") | 
				
			||||||
 | 
					    private String cmdptel; | 
				
			||||||
 | 
					    @ApiModelProperty("河流名称") | 
				
			||||||
 | 
					    private String rvcd; | 
				
			||||||
 | 
					    @ApiModelProperty("水系名称") | 
				
			||||||
 | 
					    private String hnnm; | 
				
			||||||
 | 
					    @ApiModelProperty("流域名称") | 
				
			||||||
 | 
					    private String ctcd; | 
				
			||||||
 | 
					    @ApiModelProperty("东经") | 
				
			||||||
 | 
					    private Double eslg; | 
				
			||||||
 | 
					    @ApiModelProperty("北纬") | 
				
			||||||
 | 
					    private Double nrlt; | 
				
			||||||
 | 
					    @ApiModelProperty("站址") | 
				
			||||||
 | 
					    private String stlc; | 
				
			||||||
 | 
					    @ApiModelProperty("行政区划码") | 
				
			||||||
 | 
					    private String addvcd; | 
				
			||||||
 | 
					    @ApiModelProperty("基面名称") | 
				
			||||||
 | 
					    private String dtmnm; | 
				
			||||||
 | 
					    @ApiModelProperty("基面高程") | 
				
			||||||
 | 
					    private Double dtmel; | 
				
			||||||
 | 
					    @ApiModelProperty("基面修正值") | 
				
			||||||
 | 
					    private Double dtpr; | 
				
			||||||
 | 
					    @ApiModelProperty("报汛等级") | 
				
			||||||
 | 
					    private String frgrd; | 
				
			||||||
 | 
					    @ApiModelProperty("集水面积") | 
				
			||||||
 | 
					    private Double drna; | 
				
			||||||
 | 
					    @ApiModelProperty("拼音码") | 
				
			||||||
 | 
					    private String phcd; | 
				
			||||||
 | 
					    @ApiModelProperty("启用标志") | 
				
			||||||
 | 
					    private String usfl; | 
				
			||||||
 | 
					    @ApiModelProperty("备注") | 
				
			||||||
 | 
					    private String comments; | 
				
			||||||
 | 
					    @ApiModelProperty("建成时间") | 
				
			||||||
 | 
					    private Date buildTime; | 
				
			||||||
 | 
					    @ApiModelProperty("最大坝高") | 
				
			||||||
 | 
					    private Double maxdmhg; | 
				
			||||||
 | 
					    @ApiModelProperty("坝型") | 
				
			||||||
 | 
					    private String dmtp; | 
				
			||||||
 | 
					    @ApiModelProperty("库区GIS范围") | 
				
			||||||
 | 
					    private String gisRange; | 
				
			||||||
 | 
					    @ApiModelProperty("水库功能(可多选)") | 
				
			||||||
 | 
					    private String rsfn; | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,62 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.entity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.annotation.IdType; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.annotation.TableId; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||||
 | 
					import io.swagger.annotations.ApiModelProperty; | 
				
			||||||
 | 
					import lombok.Data; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.Serializable; | 
				
			||||||
 | 
					import java.util.Date; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * 水库防洪信息 | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					@Data | 
				
			||||||
 | 
					@TableName("st_rsr_hych") | 
				
			||||||
 | 
					public class StRsrHych implements Serializable { | 
				
			||||||
 | 
					    @ApiModelProperty("水库代码") | 
				
			||||||
 | 
					    @TableId(type = IdType.INPUT) | 
				
			||||||
 | 
					    private String rscd; | 
				
			||||||
 | 
					    @ApiModelProperty("水库类型") | 
				
			||||||
 | 
					    private String rsvrtp; | 
				
			||||||
 | 
					    @ApiModelProperty("坝顶高程") | 
				
			||||||
 | 
					    private Double damel; | 
				
			||||||
 | 
					    @ApiModelProperty("控制流域面积") | 
				
			||||||
 | 
					    private Double cnctar; | 
				
			||||||
 | 
					    @ApiModelProperty("校核洪水位") | 
				
			||||||
 | 
					    private Double chfl; | 
				
			||||||
 | 
					    @ApiModelProperty("设计洪水位") | 
				
			||||||
 | 
					    private Double dsfl; | 
				
			||||||
 | 
					    @ApiModelProperty("正常高水位") | 
				
			||||||
 | 
					    private Double normz; | 
				
			||||||
 | 
					    @ApiModelProperty("死水位") | 
				
			||||||
 | 
					    private Double ddwz; | 
				
			||||||
 | 
					    @ApiModelProperty("汛限水位") | 
				
			||||||
 | 
					    private Double mjfl; | 
				
			||||||
 | 
					    @ApiModelProperty("兴利水位") | 
				
			||||||
 | 
					    private Double actz; | 
				
			||||||
 | 
					    @ApiModelProperty("总库容") | 
				
			||||||
 | 
					    private Double ttcp; | 
				
			||||||
 | 
					    @ApiModelProperty("防洪库容") | 
				
			||||||
 | 
					    private Double fldcp; | 
				
			||||||
 | 
					    @ApiModelProperty("兴利库容") | 
				
			||||||
 | 
					    private Double actcp; | 
				
			||||||
 | 
					    @ApiModelProperty("死库容") | 
				
			||||||
 | 
					    private Double ddcp; | 
				
			||||||
 | 
					    @ApiModelProperty("历史最高库水位") | 
				
			||||||
 | 
					    private Double hhrz; | 
				
			||||||
 | 
					    @ApiModelProperty("历史最大蓄水量") | 
				
			||||||
 | 
					    private Double hmxw; | 
				
			||||||
 | 
					    @ApiModelProperty("历史最高库水位(蓄水量)时间") | 
				
			||||||
 | 
					    private Date maxleveltime; | 
				
			||||||
 | 
					    @ApiModelProperty("低水位告警值") | 
				
			||||||
 | 
					    private Double laz; | 
				
			||||||
 | 
					    @ApiModelProperty("启动预报流量标准") | 
				
			||||||
 | 
					    private Double sfq; | 
				
			||||||
 | 
					    @ApiModelProperty("时间戳") | 
				
			||||||
 | 
					    private Date moditime; | 
				
			||||||
 | 
					    @ApiModelProperty("更新时间") | 
				
			||||||
 | 
					    private Date dtuptm; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,38 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.vo; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrBsin; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class StRsrBsinVo extends StRsrBsin { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //行政区划名称
 | 
				
			||||||
 | 
					    private String addvcdnm; | 
				
			||||||
 | 
					    /***  水位*/ | 
				
			||||||
 | 
					    private String waterLevel; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*** 库容*/ | 
				
			||||||
 | 
					    private  String capacity; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getAddvcdnm() { | 
				
			||||||
 | 
					        return addvcdnm; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setAddvcdnm(String addvcdnm) { | 
				
			||||||
 | 
					        this.addvcdnm = addvcdnm; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getWaterLevel() { | 
				
			||||||
 | 
					        return waterLevel; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setWaterLevel(String waterLevel) { | 
				
			||||||
 | 
					        this.waterLevel = waterLevel; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getCapacity() { | 
				
			||||||
 | 
					        return capacity; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setCapacity(String capacity) { | 
				
			||||||
 | 
					        this.capacity = capacity; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,23 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||||
 | 
					<project xmlns="http://maven.apache.org/POM/4.0.0" | 
				
			||||||
 | 
					         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 
				
			||||||
 | 
					         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | 
				
			||||||
 | 
					    <modelVersion>4.0.0</modelVersion> | 
				
			||||||
 | 
					    <parent> | 
				
			||||||
 | 
					        <groupId>com.hnac.hzims</groupId> | 
				
			||||||
 | 
					        <artifactId>hzims-service-api</artifactId> | 
				
			||||||
 | 
					        <version>4.0.0-SNAPSHOT</version> | 
				
			||||||
 | 
					    </parent> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <artifactId>digital-twin-display-api</artifactId> | 
				
			||||||
 | 
					    <packaging>jar</packaging> | 
				
			||||||
 | 
					    <version>${hzims.project.version}</version> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <properties> | 
				
			||||||
 | 
					        <maven.compiler.source>8</maven.compiler.source> | 
				
			||||||
 | 
					        <maven.compiler.target>8</maven.compiler.target> | 
				
			||||||
 | 
					        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 
				
			||||||
 | 
					    </properties> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</project> | 
				
			||||||
@ -0,0 +1,165 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.controller; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.IrrBDGate; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.service.IGateInfoService; | 
				
			||||||
 | 
					import io.swagger.annotations.Api; | 
				
			||||||
 | 
					import io.swagger.annotations.ApiOperation; | 
				
			||||||
 | 
					import io.swagger.annotations.ApiParam; | 
				
			||||||
 | 
					import lombok.AllArgsConstructor; | 
				
			||||||
 | 
					import org.springblade.core.mp.support.Condition; | 
				
			||||||
 | 
					import org.springblade.core.mp.support.Query; | 
				
			||||||
 | 
					import org.springblade.core.secure.utils.AuthUtil; | 
				
			||||||
 | 
					import org.springblade.core.tool.api.R; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.StringUtil; | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.servlet.http.HttpServletRequest; | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@RestController | 
				
			||||||
 | 
					@RequestMapping("/reservoirBaseInfo/gateInfo") | 
				
			||||||
 | 
					@AllArgsConstructor | 
				
			||||||
 | 
					@Api(value = "闸门信息", tags = "闸门信息接口") | 
				
			||||||
 | 
					public class GateInfoController { | 
				
			||||||
 | 
					    private final IGateInfoService gateInfoService; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RequestMapping(value = "save", method = {RequestMethod.POST}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("添加闸门") | 
				
			||||||
 | 
					    public R addGate(@RequestBody IrrBDGate irrBDGate) { | 
				
			||||||
 | 
					        String deptId = AuthUtil.getDeptId(); | 
				
			||||||
 | 
					        IrrBDGate tmp = new IrrBDGate(); | 
				
			||||||
 | 
					        tmp.setStrobeCode(irrBDGate.getStrobeCode()); | 
				
			||||||
 | 
					        tmp.setStcd(irrBDGate.getStcd()); | 
				
			||||||
 | 
					        List<IrrBDGate> page = gateInfoService.list(tmp); | 
				
			||||||
 | 
					        if (page != null && !page.isEmpty()) { | 
				
			||||||
 | 
					            return R.fail(500, "存在重复的闸门代码为:" + irrBDGate.getStrobeCode() + "的数据"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return R.data(gateInfoService.addGate(irrBDGate)); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RequestMapping(value = "remove", method = {RequestMethod.POST}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("删除闸门") | 
				
			||||||
 | 
					    public R deleteGate(@ApiParam(value = "闸门id") @RequestParam Long id) { | 
				
			||||||
 | 
					        boolean i = gateInfoService.removeById(id); | 
				
			||||||
 | 
					        if (i) { | 
				
			||||||
 | 
					            return R.data(true, "删除成功"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return R.fail(500, "不存在此记录"); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RequestMapping(value = "updateGate", method = {RequestMethod.POST}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("修改闸门") | 
				
			||||||
 | 
					    public R updateGate(@RequestBody IrrBDGate irrBDGate) { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        irrBDGate.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); | 
				
			||||||
 | 
					        int i = gateInfoService.updateGate(irrBDGate); | 
				
			||||||
 | 
					        if (i>0) { | 
				
			||||||
 | 
					            return R.data(true, "修改成功"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return R.fail(500, "修改失败"); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RequestMapping(value = "pageList", method = {RequestMethod.GET}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("查询闸门") | 
				
			||||||
 | 
					    public R pageList(@ModelAttribute IrrBDGate irrBDGate, HttpServletRequest request, Query query) { | 
				
			||||||
 | 
					        String deptId=request.getHeader("dept-id"); | 
				
			||||||
 | 
					        if(StringUtil.isEmpty(deptId)) { | 
				
			||||||
 | 
					            deptId =AuthUtil.getDeptId(); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(StringUtil.isNotBlank(deptId)) { | 
				
			||||||
 | 
					            irrBDGate.setCreateDept(Long.valueOf(deptId)); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        IPage<IrrBDGate> page = gateInfoService.selectGate(irrBDGate, Condition.getPage(query)); | 
				
			||||||
 | 
					        return R.data(page, "查询成功"); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RequestMapping(value = "list", method = {RequestMethod.GET}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("查询闸门") | 
				
			||||||
 | 
					    public R list(@ModelAttribute IrrBDGate irrBDGate) { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        irrBDGate.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); | 
				
			||||||
 | 
					        List<IrrBDGate> list = gateInfoService.list(irrBDGate); | 
				
			||||||
 | 
					        return R.data(list, "查询成功"); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 修改闸门配置 | 
				
			||||||
 | 
					     * | 
				
			||||||
 | 
					     * @return | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @RequestMapping(value = "saveRef", method = {RequestMethod.POST}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("修改闸门配置") | 
				
			||||||
 | 
					    public R saveRef(@RequestBody IrrBDGateRefData irrBDGateRef) { | 
				
			||||||
 | 
					        int i = gateInfoService.addGateRef(irrBDGateRef); | 
				
			||||||
 | 
					        if (i > 0) { | 
				
			||||||
 | 
					            return R.data(true, "修改成功"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return R.fail(500, "修改失败"); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 删除闸门配置 | 
				
			||||||
 | 
					     * | 
				
			||||||
 | 
					     * @return | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @RequestMapping(value = "removeRef", method = {RequestMethod.POST}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("删除闸门配置") | 
				
			||||||
 | 
					    public R deleteGateRef(@ApiParam(value = "闸门编码") @RequestParam String gateCode) { | 
				
			||||||
 | 
					        int i = gateInfoService.deleteGateRef(gateCode); | 
				
			||||||
 | 
					        if (i > 0) { | 
				
			||||||
 | 
					            return R.data(true, "删除成功"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return R.fail(500, "删除失败"); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 修改闸门配置 | 
				
			||||||
 | 
					     * | 
				
			||||||
 | 
					     * @return | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @RequestMapping(value = "updateRef", method = {RequestMethod.POST}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("修改闸门配置") | 
				
			||||||
 | 
					    public R updateGateRef(@RequestBody IrrBDGateRefData irrBDGateRef) { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        int i = gateInfoService.updateGateRef(irrBDGateRef); | 
				
			||||||
 | 
					        if (i > 0) { | 
				
			||||||
 | 
					            return R.data(true, "修改成功"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return R.fail(500, "修改失败"); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 查询闸门配置 | 
				
			||||||
 | 
					     * | 
				
			||||||
 | 
					     * @return | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @RequestMapping(value = "detailRef", method = {RequestMethod.GET}) | 
				
			||||||
 | 
					    @ResponseBody | 
				
			||||||
 | 
					    @ApiOperation("查询闸门配置") | 
				
			||||||
 | 
					    public R listRef(@ApiParam(value = "闸门编码") @RequestParam String gateCode) { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        IrrBDGateRefData res = gateInfoService.detailRef(gateCode); | 
				
			||||||
 | 
					        return R.data(res, "查询成功"); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,165 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.controller; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrBsin; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrHych; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.service.IStRsrBsinService; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.service.IStRsrHychService; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.vo.StRsrBsinVo; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.wrapper.StRsrBsinWrapper; | 
				
			||||||
 | 
					import io.swagger.annotations.*; | 
				
			||||||
 | 
					import lombok.AllArgsConstructor; | 
				
			||||||
 | 
					import org.springblade.common.cache.CacheNames; | 
				
			||||||
 | 
					import org.springblade.core.boot.ctrl.BladeController; | 
				
			||||||
 | 
					import org.springblade.core.mp.support.Condition; | 
				
			||||||
 | 
					import org.springblade.core.mp.support.Query; | 
				
			||||||
 | 
					import org.springblade.core.secure.utils.AuthUtil; | 
				
			||||||
 | 
					import org.springblade.core.tool.api.R; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.Func; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.StringUtil; | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*; | 
				
			||||||
 | 
					import springfox.documentation.annotations.ApiIgnore; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.servlet.http.HttpServletRequest; | 
				
			||||||
 | 
					import java.util.HashMap; | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					import java.util.Map; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@RestController | 
				
			||||||
 | 
					@RequestMapping("/reservoir/stRsrBsin") | 
				
			||||||
 | 
					@AllArgsConstructor | 
				
			||||||
 | 
					@Api(value = "水库信息", tags = "水库信息接口") | 
				
			||||||
 | 
					public class StRsrBsinController extends BladeController implements CacheNames { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final IStRsrBsinService stRsrBsinService; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final IStRsrHychService stRsrHychService; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 分页 | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @GetMapping("/pageList") | 
				
			||||||
 | 
					    @ApiImplicitParams({ | 
				
			||||||
 | 
					            @ApiImplicitParam(name = "rscd", value = "水库代码", paramType = "query", dataType = "string"), | 
				
			||||||
 | 
					            @ApiImplicitParam(name = "rtunm", value = "水库名称", paramType = "query", dataType = "string") | 
				
			||||||
 | 
					    }) | 
				
			||||||
 | 
					    @ApiOperationSupport(order = 1) | 
				
			||||||
 | 
					    @ApiOperation(value = "分页", notes = "传入stRsrBsin") | 
				
			||||||
 | 
					    public R<IPage<StRsrBsinVo>> pageList(@ApiIgnore @RequestParam Map<String, Object> param, Query query, HttpServletRequest request) { | 
				
			||||||
 | 
					        LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper(); | 
				
			||||||
 | 
					        if(param.get("rscd")!=null) { | 
				
			||||||
 | 
					            wrapper.like(StRsrBsin::getRscd,param.get("rscd")); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        if(param.get("rtunm")!=null) { | 
				
			||||||
 | 
					            wrapper.like(StRsrBsin::getRtunm,param.get("rtunm")); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        String deptId=request.getHeader("dept-id"); | 
				
			||||||
 | 
					        if(StringUtil.isEmpty(deptId)) { | 
				
			||||||
 | 
					            deptId =AuthUtil.getDeptId(); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        if(StringUtil.isNotBlank(deptId)) { | 
				
			||||||
 | 
					            wrapper.like(StRsrBsin::getCreateDept,deptId); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        IPage<StRsrBsin> pages = stRsrBsinService.page(Condition.getPage(query), wrapper); | 
				
			||||||
 | 
					        return R.data(StRsrBsinWrapper.build().pageVO(pages)); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 列表 | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @GetMapping("/list") | 
				
			||||||
 | 
					    @ApiImplicitParams({ | 
				
			||||||
 | 
					            @ApiImplicitParam(name = "rscd", value = "水库代码", paramType = "query", dataType = "string"), | 
				
			||||||
 | 
					            @ApiImplicitParam(name = "rtunm", value = "水库名称", paramType = "query", dataType = "string") | 
				
			||||||
 | 
					    }) | 
				
			||||||
 | 
					    @ApiOperationSupport(order = 2) | 
				
			||||||
 | 
					    @ApiOperation(value = "列表", notes = "传入stRsrBsin") | 
				
			||||||
 | 
					    public R<List<StRsrBsinVo>> list(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletRequest request) { | 
				
			||||||
 | 
					        LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper(); | 
				
			||||||
 | 
					        if(param.get("rscd")!=null) { | 
				
			||||||
 | 
					            wrapper.like(StRsrBsin::getRscd,param.get("rscd")); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        if(param.get("rtunm")!=null) { | 
				
			||||||
 | 
					            wrapper.like(StRsrBsin::getRtunm,param.get("rtunm")); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        String deptId = request.getHeader("dept-id"); | 
				
			||||||
 | 
					        if (StringUtil.isEmpty(deptId)) { | 
				
			||||||
 | 
					            deptId = AuthUtil.getDeptId(); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        if (StringUtil.isNotBlank(deptId)) { | 
				
			||||||
 | 
					            wrapper.like(StRsrBsin::getCreateDept, deptId); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        List<StRsrBsin> list = stRsrBsinService.list(wrapper); | 
				
			||||||
 | 
					        return R.data(StRsrBsinWrapper.build().listVO(list)); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 详情 | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @GetMapping("/detail") | 
				
			||||||
 | 
					    @ApiOperationSupport(order = 3) | 
				
			||||||
 | 
					    @ApiOperation(value = "详情", notes = "传入stRsrBsin") | 
				
			||||||
 | 
					    public R<Map<String,Object>> detail(StRsrBsin stRsrBsin) { | 
				
			||||||
 | 
					        Map<String,Object> data=new HashMap<>(); | 
				
			||||||
 | 
					        StRsrBsin detail = stRsrBsinService.getOne(Condition.getQueryWrapper(stRsrBsin)); | 
				
			||||||
 | 
					        data.put("stRsrBsin", StRsrBsinWrapper.build().entityVO(detail)); | 
				
			||||||
 | 
					        //防洪信息
 | 
				
			||||||
 | 
					        StRsrHych param=new StRsrHych(); | 
				
			||||||
 | 
					        param.setRscd(stRsrBsin.getRscd()); | 
				
			||||||
 | 
					        StRsrHych stRsrHych=stRsrHychService.getOne(Condition.getQueryWrapper(param)); | 
				
			||||||
 | 
					        data.put("stRsrHych",stRsrHych); | 
				
			||||||
 | 
					        return R.data(data); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 新增 | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @PostMapping("/save") | 
				
			||||||
 | 
					    @ApiOperationSupport(order = 4) | 
				
			||||||
 | 
					    @ApiOperation(value = "新增", notes = "传入stRsrBsin") | 
				
			||||||
 | 
					    public R save(@RequestBody StRsrBsin stRsrBsin) { | 
				
			||||||
 | 
					        if(stRsrBsin==null){ | 
				
			||||||
 | 
					            return R.fail("水库信息不能为空"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper(); | 
				
			||||||
 | 
					        wrapper.eq(StRsrBsin::getRscd,stRsrBsin.getRscd()); | 
				
			||||||
 | 
					        List<StRsrBsin> list =stRsrBsinService.list(wrapper); | 
				
			||||||
 | 
					        if(list!=null && !list.isEmpty()){ | 
				
			||||||
 | 
					            return R.fail("水库编码已存在"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        wrapper=new LambdaQueryWrapper(); | 
				
			||||||
 | 
					        wrapper.eq(StRsrBsin::getRtunm,stRsrBsin.getRtunm()); | 
				
			||||||
 | 
					        list =stRsrBsinService.list(wrapper); | 
				
			||||||
 | 
					        if(list!=null && !list.isEmpty()){ | 
				
			||||||
 | 
					            return R.fail("水库名称已存在"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return R.status(stRsrBsinService.save(stRsrBsin)); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 修改 | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @PostMapping("/update") | 
				
			||||||
 | 
					    @ApiOperationSupport(order = 5) | 
				
			||||||
 | 
					    @ApiOperation(value = "修改", notes = "传入stRsrBsin") | 
				
			||||||
 | 
					    public R update(@RequestBody StRsrBsin stRsrBsin) { | 
				
			||||||
 | 
					        return R.status(stRsrBsinService.updateById(stRsrBsin)); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/remove") | 
				
			||||||
 | 
					    @ApiOperationSupport(order = 6) | 
				
			||||||
 | 
					    @ApiOperation(value = "逻辑删除", notes = "ids") | 
				
			||||||
 | 
					    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { | 
				
			||||||
 | 
					        boolean temp = stRsrBsinService.deleteLogic(Func.toLongList(ids)); | 
				
			||||||
 | 
					        return R.status(temp); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,16 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.mapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.IrrBDGate; | 
				
			||||||
 | 
					import org.apache.ibatis.annotations.Param; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IrrBDGateMapper extends BaseMapper<IrrBDGate> { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    IPage<IrrBDGate> selectByExample(@Param("example") IrrBDGate example, IPage<IrrBDGate> page); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    List<IrrBDGate> selectByExample(@Param("example") IrrBDGate example); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,49 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||||
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			||||||
 | 
					<mapper namespace="com.hnac.hzims.baseinfo.mapper.IrrBDGateMapper"> | 
				
			||||||
 | 
					    <resultMap id="BaseResultMap" type="com.hnac.hzims.baseinfo.entity.IrrBDGate" > | 
				
			||||||
 | 
					        <id column="ID" property="id" jdbcType="BIGINT" /> | 
				
			||||||
 | 
					        <result column="STROBE_CODE" property="strobeCode" jdbcType="VARCHAR" /> | 
				
			||||||
 | 
					        <result column="WATERGATE_CODE" property="watergateCode" jdbcType="CHAR" /> | 
				
			||||||
 | 
					        <result column="PRODUCING_AREA" property="producingArea" jdbcType="VARCHAR" /> | 
				
			||||||
 | 
					        <result column="FACTORY" property="factory" jdbcType="VARCHAR" /> | 
				
			||||||
 | 
					        <result column="STROBE_TYPE" property="strobeType" jdbcType="CHAR" /> | 
				
			||||||
 | 
					        <result column="STROBE_MATERIAL" property="strobeMaterial" jdbcType="CHAR" /> | 
				
			||||||
 | 
					        <result column="HEIGHT" property="height" jdbcType="DECIMAL" /> | 
				
			||||||
 | 
					        <result column="WIDTH" property="width" jdbcType="DECIMAL" /> | 
				
			||||||
 | 
					        <result column="THICKNESS" property="thickness" jdbcType="DECIMAL" /> | 
				
			||||||
 | 
					        <result column="MOTIVITY" property="motivity" jdbcType="CHAR" /> | 
				
			||||||
 | 
					        <result column="TYPE" property="type" jdbcType="CHAR" /> | 
				
			||||||
 | 
					        <result column="VELOCITY" property="velocity" jdbcType="DECIMAL" /> | 
				
			||||||
 | 
					        <result column="AREA_CODE" property="areaCode" jdbcType="VARCHAR" /> | 
				
			||||||
 | 
					        <result column="LRCD" property="lrcd" jdbcType="VARCHAR" /> | 
				
			||||||
 | 
					        <result column="SZHLDM" property="szhldm" jdbcType="VARCHAR" /> | 
				
			||||||
 | 
					        <result column="DONGJ" property="dongj" jdbcType="REAL" /> | 
				
			||||||
 | 
					        <result column="BEIW" property="beiw" jdbcType="REAL" /> | 
				
			||||||
 | 
					        <result column="DISCHARGE" property="discharge" jdbcType="REAL" /> | 
				
			||||||
 | 
					        <result column="STCD" property="stcd" jdbcType="VARCHAR" /> | 
				
			||||||
 | 
					    </resultMap> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <sql id="Base_Column_List" > | 
				
			||||||
 | 
					        ID,STROBE_CODE, WATERGATE_CODE, PRODUCING_AREA, FACTORY, STROBE_TYPE, STROBE_MATERIAL, | 
				
			||||||
 | 
					        HEIGHT, WIDTH, THICKNESS, MOTIVITY, TYPE, VELOCITY, AREA_CODE, LRCD, SZHLDM, DONGJ, | 
				
			||||||
 | 
					        BEIW, DISCHARGE,STCD | 
				
			||||||
 | 
					    </sql> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="selectByExample" resultMap="BaseResultMap"> | 
				
			||||||
 | 
					        select <include refid="Base_Column_List"/> | 
				
			||||||
 | 
					        from irrbdgate | 
				
			||||||
 | 
					        where is_deleted = 0 | 
				
			||||||
 | 
					        <if test="example.createDept!=null"> | 
				
			||||||
 | 
					            and CREATE_DEPT like concat(#{example.createDept},'%') | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					        <if test="example.strobeCode!=null"> | 
				
			||||||
 | 
					            and STROBE_CODE = #{example.strobeCode} | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					        <if test="example.stcd!=null"> | 
				
			||||||
 | 
					            and STCD = #{example.stcd} | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					    </select> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</mapper> | 
				
			||||||
@ -0,0 +1,14 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.mapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IrrBDGateRefDataMapper { | 
				
			||||||
 | 
					    int insertSelective(IrrBDGateRefData record); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int updateByPrimaryKeySelective(IrrBDGateRefData record); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    IrrBDGateRefData selectByPrimaryKey(String strobeCode); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int deleteByPrimaryKey(String strobeCode); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,78 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||||
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			||||||
 | 
					<mapper namespace="com.hnac.hzims.baseinfo.mapper.IrrBDGateRefDataMapper"> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <resultMap id="BaseResultMap" type="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" > | 
				
			||||||
 | 
					        <id column="STROBE_CODE" property="strobeCode" jdbcType="CHAR" /> | 
				
			||||||
 | 
					        <result column="REFSTCD" property="refstcd" jdbcType="CHAR" /> | 
				
			||||||
 | 
					        <result column="REFQPOINT" property="refqpoint" jdbcType="VARCHAR" /> | 
				
			||||||
 | 
					        <result column="REFZPOINT" property="refzpoint" jdbcType="CHAR" /> | 
				
			||||||
 | 
					    </resultMap> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <sql id="Base_Column_List" > | 
				
			||||||
 | 
					        STROBE_CODE, REFSTCD, REFQPOINT, REFZPOINT | 
				
			||||||
 | 
					    </sql> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <insert id="insertSelective" parameterType="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" > | 
				
			||||||
 | 
					        insert into irrbdgate_refdata | 
				
			||||||
 | 
					        <trim prefix="(" suffix=")" suffixOverrides="," > | 
				
			||||||
 | 
					            <if test="strobeCode != null" > | 
				
			||||||
 | 
					                STROBE_CODE, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					            <if test="refstcd != null" > | 
				
			||||||
 | 
					                REFSTCD, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					            <if test="refqpoint != null" > | 
				
			||||||
 | 
					                REFQPOINT, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					            <if test="refzpoint != null" > | 
				
			||||||
 | 
					                REFZPOINT, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					        </trim> | 
				
			||||||
 | 
					        <trim prefix="values (" suffix=")" suffixOverrides="," > | 
				
			||||||
 | 
					            <if test="strobeCode != null" > | 
				
			||||||
 | 
					                #{strobeCode,jdbcType=CHAR}, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					            <if test="refstcd != null" > | 
				
			||||||
 | 
					                #{refstcd,jdbcType=CHAR}, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					            <if test="refqpoint != null" > | 
				
			||||||
 | 
					                #{refqpoint,jdbcType=VARCHAR}, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					            <if test="refzpoint != null" > | 
				
			||||||
 | 
					                #{refzpoint,jdbcType=CHAR}, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					        </trim> | 
				
			||||||
 | 
					    </insert> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <update id="updateByPrimaryKeySelective" parameterType="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" > | 
				
			||||||
 | 
					        update irrbdgate_refdata | 
				
			||||||
 | 
					        <set > | 
				
			||||||
 | 
					            <if test="refstcd != null" > | 
				
			||||||
 | 
					                REFSTCD = #{refstcd,jdbcType=CHAR}, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					            <if test="refqpoint != null" > | 
				
			||||||
 | 
					                REFQPOINT = #{refqpoint,jdbcType=VARCHAR}, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					            <if test="refzpoint != null" > | 
				
			||||||
 | 
					                REFZPOINT = #{refzpoint,jdbcType=CHAR}, | 
				
			||||||
 | 
					            </if> | 
				
			||||||
 | 
					        </set> | 
				
			||||||
 | 
					        where STROBE_CODE = #{strobeCode,jdbcType=CHAR} | 
				
			||||||
 | 
					    </update> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > | 
				
			||||||
 | 
					        select | 
				
			||||||
 | 
					        <include refid="Base_Column_List" /> | 
				
			||||||
 | 
					        from irrbdgate_refdata | 
				
			||||||
 | 
					        where STROBE_CODE = #{strobeCode,jdbcType=CHAR} | 
				
			||||||
 | 
					    </select> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > | 
				
			||||||
 | 
					        delete from irrbdgate_refdata | 
				
			||||||
 | 
					        where STROBE_CODE = #{strobeCode,jdbcType=CHAR} | 
				
			||||||
 | 
					    </delete> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</mapper> | 
				
			||||||
@ -0,0 +1,15 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.mapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrBsin; | 
				
			||||||
 | 
					import org.apache.ibatis.annotations.Param; | 
				
			||||||
 | 
					import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					import java.util.Map; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface StRsrBsinMapper extends UserDataScopeBaseMapper<StRsrBsin> { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    IPage<Map<String,Object>> selectByParam(IPage page, @Param("param") Map<String,Object> param); | 
				
			||||||
 | 
					    List<Map<String,Object>> selectByParam(@Param("param") Map<String,Object> param); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,29 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||||
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			||||||
 | 
					<mapper namespace="com.hnac.hzims.baseinfo.mapper.StRsrBsinMapper"> | 
				
			||||||
 | 
					    <select id="selectByParam" resultType="java.util.HashMap"> | 
				
			||||||
 | 
					        select bsin.id,bsin.rscd,hych.rsvrtp,bsin.RTUNM,bsin.ESLG,bsin.NRLT, | 
				
			||||||
 | 
					        bsin.GIS_RANGE as gisRange,bsin.rvcd,bsin.stlc,hych.mjfl from st_rsr_bsin bsin | 
				
			||||||
 | 
					        left join  st_rsr_hych hych on bsin.rscd=hych.RSCD | 
				
			||||||
 | 
					        WHERE  bsin.IS_DELETED = 0 | 
				
			||||||
 | 
					        <if test=" param.deptId!=null and param.deptId!='' "> | 
				
			||||||
 | 
					            and bsin.CREATE_DEPT like concat(#{param.deptId},'%') | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					        <if test=" param.rtunm!=null and param.rtunm!='' "> | 
				
			||||||
 | 
					            and bsin.RTUNM like concat('%',#{param.rtunm},'%') | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					        <if test=" param.dmtp!=null and param.dmtp!='' "> | 
				
			||||||
 | 
					            and bsin.DMTP=#{param.dmtp} | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					        <if test=" param.rsfn!=null and param.rsfn!='' "> | 
				
			||||||
 | 
					            and  bsin.RSFN=#{param.rsfn} | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					        <if test=" param.rsvrtp!=null"> | 
				
			||||||
 | 
					            and hych.RSVRTP=#{param.rsvrtp} | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					        <if test=" param.areaCode!=null"> | 
				
			||||||
 | 
					            and bsin.ADDVCD like concat(#{param.areaCode},'%') | 
				
			||||||
 | 
					        </if> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    </select> | 
				
			||||||
 | 
					</mapper> | 
				
			||||||
@ -0,0 +1,7 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.mapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrHych; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface StRsrHychMapper extends BaseMapper<StRsrHych> { | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,5 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||||
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			||||||
 | 
					<mapper namespace="com.hnac.hzims.baseinfo.mapper.StRsrHychMapper"> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</mapper> | 
				
			||||||
@ -0,0 +1,25 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.extension.service.IService; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.IrrBDGate; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IGateInfoService extends IService<IrrBDGate> { | 
				
			||||||
 | 
					    boolean addGate(IrrBDGate irrBDGate); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int updateGate(IrrBDGate irrBDGate); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    IPage<IrrBDGate> selectGate(IrrBDGate irrBDGate, IPage<IrrBDGate> page); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int addGateRef(IrrBDGateRefData irrBDGateRefdata); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int deleteGateRef(String gateCode); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int updateGateRef(IrrBDGateRefData irrBDGateRefdata); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    IrrBDGateRefData detailRef(String gateCode); | 
				
			||||||
 | 
					    List<IrrBDGate> list(IrrBDGate irrBDGate); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,11 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrBsin; | 
				
			||||||
 | 
					import org.springblade.core.mp.base.BaseService; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					import java.util.Map; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IStRsrBsinService extends BaseService<StRsrBsin> { | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,10 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrHych; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IStRsrHychService { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    StRsrHych getOne(QueryWrapper<StRsrHych> wrapper); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,75 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.service.impl; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.IrrBDGate; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.mapper.IrrBDGateMapper; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.mapper.IrrBDGateRefDataMapper; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.service.IGateInfoService; | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||||
 | 
					import org.springframework.stereotype.Service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Service | 
				
			||||||
 | 
					public class GateInfoServiceImpl extends ServiceImpl<IrrBDGateMapper, IrrBDGate> implements IGateInfoService { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired | 
				
			||||||
 | 
					    IrrBDGateMapper irrBDGateMapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired | 
				
			||||||
 | 
					    IrrBDGateRefDataMapper irrBDGateRefDataMapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public boolean addGate(IrrBDGate irrBDGate) { | 
				
			||||||
 | 
					        return this.save(irrBDGate); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public int updateGate(IrrBDGate irrBDGate) { | 
				
			||||||
 | 
					        //编辑时如果站点更换清除之前数据配置
 | 
				
			||||||
 | 
					        IrrBDGate judgeGate = this.getById(irrBDGate.getId()); | 
				
			||||||
 | 
					        this.updateById(irrBDGate); | 
				
			||||||
 | 
					        if (!irrBDGate.getCreateDept().equals(judgeGate.getCreateDept())) { | 
				
			||||||
 | 
					            irrBDGateRefDataMapper.deleteByPrimaryKey(irrBDGate.getStrobeCode()); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return 1; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public IPage<IrrBDGate> selectGate(IrrBDGate irrBDGate, IPage<IrrBDGate> page) { | 
				
			||||||
 | 
					        IPage<IrrBDGate> irrBDGates =  irrBDGateMapper.selectByExample(irrBDGate, page); | 
				
			||||||
 | 
					        return irrBDGates; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public int addGateRef(IrrBDGateRefData irrBDGateRefdata) { | 
				
			||||||
 | 
					        int i = irrBDGateRefDataMapper.insertSelective(irrBDGateRefdata); | 
				
			||||||
 | 
					        return i; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public int deleteGateRef(String gateCode) { | 
				
			||||||
 | 
					        int i = irrBDGateRefDataMapper.deleteByPrimaryKey(gateCode); | 
				
			||||||
 | 
					        return i; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public int updateGateRef(IrrBDGateRefData irrBDGateRefdata) { | 
				
			||||||
 | 
					        int i = irrBDGateRefDataMapper.updateByPrimaryKeySelective(irrBDGateRefdata); | 
				
			||||||
 | 
					        return i; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public IrrBDGateRefData detailRef(String gateCode) { | 
				
			||||||
 | 
					        IrrBDGateRefData res = irrBDGateRefDataMapper.selectByPrimaryKey(gateCode); | 
				
			||||||
 | 
					        return res; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public List<IrrBDGate> list(IrrBDGate irrBDGate) { | 
				
			||||||
 | 
					        List<IrrBDGate> irrBDGates =  irrBDGateMapper.selectByExample(irrBDGate); | 
				
			||||||
 | 
					        return irrBDGates; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,19 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.service.impl; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrBsin; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.mapper.StRsrBsinMapper; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.service.IStRsrBsinService; | 
				
			||||||
 | 
					import org.springblade.core.mp.base.BaseServiceImpl; | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||||
 | 
					import org.springframework.stereotype.Service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.HashMap; | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					import java.util.Map; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Service | 
				
			||||||
 | 
					public class StRsrBsinServiceImpl extends BaseServiceImpl<StRsrBsinMapper, StRsrBsin> implements IStRsrBsinService { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,23 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.service.impl; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrHych; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.mapper.StRsrHychMapper; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.service.IStRsrHychService; | 
				
			||||||
 | 
					import org.springframework.stereotype.Service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Resource; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Service | 
				
			||||||
 | 
					public class StRsrHychServiceImpl implements IStRsrHychService { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource | 
				
			||||||
 | 
					    StRsrHychMapper stRsrHychMapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public StRsrHych getOne(QueryWrapper<StRsrHych> wrapper) { | 
				
			||||||
 | 
					        return stRsrHychMapper.selectOne(wrapper); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,32 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.baseinfo.wrapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.entity.StRsrBsin; | 
				
			||||||
 | 
					import com.hnac.hzims.baseinfo.vo.StRsrBsinVo; | 
				
			||||||
 | 
					import org.springblade.core.mp.support.BaseEntityWrapper; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.BeanUtil; | 
				
			||||||
 | 
					import org.springblade.system.cache.RegionCache; | 
				
			||||||
 | 
					import org.springblade.system.entity.Region; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Objects; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class StRsrBsinWrapper extends BaseEntityWrapper<StRsrBsin, StRsrBsinVo> { | 
				
			||||||
 | 
					    public StRsrBsinWrapper() { | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static StRsrBsinWrapper build() { | 
				
			||||||
 | 
					        return new StRsrBsinWrapper(); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public StRsrBsinVo entityVO(StRsrBsin entity) { | 
				
			||||||
 | 
					        if(entity == null){ | 
				
			||||||
 | 
					            return null; | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        StRsrBsinVo stRsrBsinVo = Objects.requireNonNull(BeanUtil.copy(entity, StRsrBsinVo.class)); | 
				
			||||||
 | 
					        Region region=RegionCache.getByCode(entity.getAddvcd()); | 
				
			||||||
 | 
					        if(region!=null) { | 
				
			||||||
 | 
					            stRsrBsinVo.setAddvcdnm(region.getName()); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return stRsrBsinVo; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,194 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.equipment.controller; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			||||||
 | 
					import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.entity.EmInfoEntity; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.entity.EmTreeNode; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.service.IEmInfoService; | 
				
			||||||
 | 
					import io.swagger.annotations.*; | 
				
			||||||
 | 
					import lombok.AllArgsConstructor; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.validation.Valid; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			||||||
 | 
					import org.springblade.core.boot.ctrl.BladeController; | 
				
			||||||
 | 
					import com.hnac.hzims.common.constant.CommonConstant; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springblade.core.mp.support.Condition; | 
				
			||||||
 | 
					import org.springblade.core.mp.support.Query; | 
				
			||||||
 | 
					import org.springblade.core.secure.utils.AuthUtil; | 
				
			||||||
 | 
					import org.springblade.core.tool.api.R; | 
				
			||||||
 | 
					import org.springblade.core.tool.node.ForestNodeMerger; | 
				
			||||||
 | 
					import org.springblade.core.tool.node.INode; | 
				
			||||||
 | 
					import org.springblade.core.tool.node.TreeNode; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.CollectionUtil; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.Func; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.StringUtil; | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||||
 | 
					import springfox.documentation.annotations.ApiIgnore; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.entity.EmOreanizationEntity; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.vo.EmOreanizationVO; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.wrapper.EmOreanizationWrapper; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.service.IEmOreanizationService; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.Serializable; | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					import java.util.Map; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * 设备组织控制器 | 
				
			||||||
 | 
					 * | 
				
			||||||
 | 
					 * @author moze | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					@RestController | 
				
			||||||
 | 
					@AllArgsConstructor | 
				
			||||||
 | 
					@RequestMapping("/em/oreanization") | 
				
			||||||
 | 
					@Api(value = "设备组织结构", tags = "设备组织结构") | 
				
			||||||
 | 
					public class EmOreanizationController extends BladeController { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private final IEmOreanizationService em_oreanizationService; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private final IEmInfoService emInfoService; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** | 
				
			||||||
 | 
						 * 详情 | 
				
			||||||
 | 
						 */ | 
				
			||||||
 | 
						@GetMapping("/detail") | 
				
			||||||
 | 
						@ApiOperationSupport(order = 1) | 
				
			||||||
 | 
						@ApiOperation(value = "详情", notes = "传入ID") | 
				
			||||||
 | 
						public R<EmOreanizationEntity> detail(@ApiParam(value = "主键", required = true) @RequestParam String id) { | 
				
			||||||
 | 
							EmOreanizationEntity detail = em_oreanizationService.getById(Func.toLong(id)); | 
				
			||||||
 | 
							return R.data(detail); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** | 
				
			||||||
 | 
						 * 加载当前站点设备的组织结构 | 
				
			||||||
 | 
						 */ | 
				
			||||||
 | 
						/*@GetMapping("/initLoad") | 
				
			||||||
 | 
						@ApiOperationSupport(order = 2) | 
				
			||||||
 | 
						@ApiOperation(value = "初始化加载", notes = "加载当前站点设备的组织结构") | 
				
			||||||
 | 
						public R<List<TreeNode>> init() { | 
				
			||||||
 | 
							return R.data(em_oreanizationService.initLoad(AuthUtil.getTenantId())); | 
				
			||||||
 | 
						}*/ | 
				
			||||||
 | 
						@ApiOperation("获取目录树形结构") | 
				
			||||||
 | 
						@GetMapping("/initLoad") | 
				
			||||||
 | 
						public R<List<EmTreeNode>> getStructTree()  { | 
				
			||||||
 | 
							return em_oreanizationService.groupTree(); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** | 
				
			||||||
 | 
						 * 新增 | 
				
			||||||
 | 
						 */ | 
				
			||||||
 | 
						@PostMapping("/save") | 
				
			||||||
 | 
						@ApiOperationSupport(order = 3) | 
				
			||||||
 | 
						@ApiOperation(value = "新增", notes = "传入em_oreanization") | 
				
			||||||
 | 
						public R save(@Valid @RequestBody EmOreanizationEntity em_oreanization) { | 
				
			||||||
 | 
							if (StringUtil.isNotBlank(em_oreanization.getPid() + "")) { | 
				
			||||||
 | 
								List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ | 
				
			||||||
 | 
									//eq("PID", em_oreanization.getPid());
 | 
				
			||||||
 | 
									eq("NAME", em_oreanization.getName()); | 
				
			||||||
 | 
								}}); | 
				
			||||||
 | 
								if (CollectionUtil.isNotEmpty(emOreanizationEntities)) { | 
				
			||||||
 | 
									return R.fail("名称已存在!"); | 
				
			||||||
 | 
								} | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							em_oreanization.setSort(em_oreanizationService.sort(em_oreanization.getPid())); | 
				
			||||||
 | 
							return R.status(em_oreanizationService.save(em_oreanization)); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** | 
				
			||||||
 | 
						 * 修改 | 
				
			||||||
 | 
						 */ | 
				
			||||||
 | 
						@PostMapping("/update") | 
				
			||||||
 | 
						@ApiOperationSupport(order = 4) | 
				
			||||||
 | 
						@ApiOperation(value = "修改", notes = "传入em_oreanization") | 
				
			||||||
 | 
						public R update(@Valid @RequestBody EmOreanizationEntity em_oreanization) { | 
				
			||||||
 | 
							List<EmOreanizationEntity> list = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ | 
				
			||||||
 | 
								eq("ID", em_oreanization.getId()); | 
				
			||||||
 | 
								eq("NAME", em_oreanization.getName()); | 
				
			||||||
 | 
							}}); | 
				
			||||||
 | 
							if (CollectionUtil.isEmpty(list)) { | 
				
			||||||
 | 
								List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ | 
				
			||||||
 | 
									eq("PID", em_oreanization.getPid()); | 
				
			||||||
 | 
									eq("NAME", em_oreanization.getName()); | 
				
			||||||
 | 
								}}); | 
				
			||||||
 | 
								if (CollectionUtil.isNotEmpty(emOreanizationEntities)) { | 
				
			||||||
 | 
									return R.fail("同级名称已存在!"); | 
				
			||||||
 | 
								} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							return R.status(em_oreanizationService.updateOrg(em_oreanization)); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** | 
				
			||||||
 | 
						 * 备用-新增或修改 | 
				
			||||||
 | 
						 */ | 
				
			||||||
 | 
						@PostMapping("/submit") | 
				
			||||||
 | 
						@ApiOperationSupport(order = 5) | 
				
			||||||
 | 
						@ApiOperation(value = "新增或修改", notes = "传入em_oreanization") | 
				
			||||||
 | 
						public R submit(@Valid @RequestBody EmOreanizationEntity em_oreanization) { | 
				
			||||||
 | 
							if (StringUtil.isNotBlank(em_oreanization.getPid() + "")) { | 
				
			||||||
 | 
								List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ | 
				
			||||||
 | 
									eq("NAME", em_oreanization.getName()); | 
				
			||||||
 | 
									eq("PID", em_oreanization.getPid()); | 
				
			||||||
 | 
								}}); | 
				
			||||||
 | 
								if (CollectionUtil.isNotEmpty(emOreanizationEntities)) { | 
				
			||||||
 | 
									return R.fail("同级名称已存在!"); | 
				
			||||||
 | 
								} | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							return R.status(em_oreanizationService.saveOrUpdate(em_oreanization)); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** | 
				
			||||||
 | 
						 * 删除 | 
				
			||||||
 | 
						 */ | 
				
			||||||
 | 
						@PostMapping("/remove") | 
				
			||||||
 | 
						@ApiOperationSupport(order = 6) | 
				
			||||||
 | 
						@ApiOperation(value = "逻辑删除", notes = "传入ids") | 
				
			||||||
 | 
						public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { | 
				
			||||||
 | 
							String[] split = ids.split(","); | 
				
			||||||
 | 
							for (String id : split) { | 
				
			||||||
 | 
								List<EmOreanizationEntity> isThere = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ | 
				
			||||||
 | 
									eq("PID", id); | 
				
			||||||
 | 
								}}); | 
				
			||||||
 | 
								if (CollectionUtil.isNotEmpty(isThere)) { | 
				
			||||||
 | 
									return R.fail("请先删除子组织"); | 
				
			||||||
 | 
								} | 
				
			||||||
 | 
								List<EmInfoEntity> refOreanization = emInfoService.list(new QueryWrapper<EmInfoEntity>() {{ | 
				
			||||||
 | 
									eq("REF_OREANIZATION", id); | 
				
			||||||
 | 
								}}); | 
				
			||||||
 | 
								if (CollectionUtil.isNotEmpty(refOreanization)) { | 
				
			||||||
 | 
									return R.fail("请先删除设备信息"); | 
				
			||||||
 | 
								} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							return R.status(em_oreanizationService.deleteLogic(Func.toLongList(ids))); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** | 
				
			||||||
 | 
						 * 下移 | 
				
			||||||
 | 
						 */ | 
				
			||||||
 | 
						@PostMapping("/down") | 
				
			||||||
 | 
						@ApiOperationSupport(order = 7) | 
				
			||||||
 | 
						@ApiOperation(value = "下移", notes = "传入ID") | 
				
			||||||
 | 
						public R down(@ApiParam(value = "主键", required = true) @RequestParam String id1, @ApiParam(value = "主键", required = true) @RequestParam String id2) { | 
				
			||||||
 | 
							return R.status(em_oreanizationService.translocation(Func.toLong(id1), Func.toLong(id2))); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** | 
				
			||||||
 | 
						 * 上移 | 
				
			||||||
 | 
						 */ | 
				
			||||||
 | 
						@PostMapping("/up") | 
				
			||||||
 | 
						@ApiOperationSupport(order = 8) | 
				
			||||||
 | 
						@ApiOperation(value = "上移", notes = "传入ID") | 
				
			||||||
 | 
						public R up(@ApiParam(value = "主键", required = true) @RequestParam String id1, @ApiParam(value = "主键", required = true) @RequestParam String id2) { | 
				
			||||||
 | 
							return R.status(em_oreanizationService.translocation(Func.toLong(id1), Func.toLong(id2))); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,21 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.equipment.mapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springblade.core.datascope.annotation.UserDataAuth; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.entity.EmOreanizationEntity; | 
				
			||||||
 | 
					import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; | 
				
			||||||
 | 
					import org.springblade.core.tool.node.TreeNode; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 *  Mapper 接口 | 
				
			||||||
 | 
					 * | 
				
			||||||
 | 
					 * @author Chill | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					public interface EmOreanizationMapper extends UserDataScopeBaseMapper<EmOreanizationEntity> { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@UserDataAuth | 
				
			||||||
 | 
						List<TreeNode> selectTreeList(String tenantId); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int selectMaxSort(Long pid); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,47 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||||
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			||||||
 | 
					<mapper namespace="com.hnac.hzims.equipment.mapper.EmOreanizationMapper"> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- 通用查询映射结果 --> | 
				
			||||||
 | 
					    <resultMap id="em_oreanizationResultMap" type="com.hnac.hzims.equipment.entity.EmOreanizationEntity"> | 
				
			||||||
 | 
					        <result column="ID" property="id"/> | 
				
			||||||
 | 
					        <result column="PID" property="pid"/> | 
				
			||||||
 | 
					        <result column="STATUS" property="status"/> | 
				
			||||||
 | 
					        <result column="NAME" property="name"/> | 
				
			||||||
 | 
					        <result column="TYPE_CODE" property="typeCode"/> | 
				
			||||||
 | 
					        <result column="SORT" property="sort"/> | 
				
			||||||
 | 
					        <result column="REMARK" property="remark"/> | 
				
			||||||
 | 
					        <result column="TENANT_ID" property="tenantId"/> | 
				
			||||||
 | 
					        <result column="CREATE_TIME" property="createTime"/> | 
				
			||||||
 | 
					        <result column="UPDATE_TIME" property="updateTime"/> | 
				
			||||||
 | 
					        <result column="CREATE_USER" property="createUser"/> | 
				
			||||||
 | 
					        <result column="UPDATE_USER" property="updateUser"/> | 
				
			||||||
 | 
					        <result column="IS_DELETED" property="isDeleted"/> | 
				
			||||||
 | 
					        <result column="CREATE_DEPT" property="createDept"/> | 
				
			||||||
 | 
					    </resultMap> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="selectTreeList" resultType="org.springblade.core.tool.node.TreeNode" parameterType="string"> | 
				
			||||||
 | 
					        SELECT | 
				
			||||||
 | 
					            ID AS 'key', | 
				
			||||||
 | 
					            PID AS parentId, | 
				
			||||||
 | 
					            NAME AS title, | 
				
			||||||
 | 
					            ID AS 'value', | 
				
			||||||
 | 
					            Id, | 
				
			||||||
 | 
					            CREATE_USER, | 
				
			||||||
 | 
					            CREATE_DEPT | 
				
			||||||
 | 
					        FROM | 
				
			||||||
 | 
					            HZIMS_EM_OREANIZATION | 
				
			||||||
 | 
					        WHERE IS_DELETED=0 | 
				
			||||||
 | 
					        and TENANT_ID = #{tenantId} | 
				
			||||||
 | 
					        ORDER BY | 
				
			||||||
 | 
					            PID, | 
				
			||||||
 | 
					            SORT | 
				
			||||||
 | 
					    </select> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="selectMaxSort" resultType="integer"> | 
				
			||||||
 | 
					        SELECT IFNULL(MAX(SORT),0) | 
				
			||||||
 | 
					        FROM HZIMS_EM_OREANIZATION | 
				
			||||||
 | 
					        WHERE PID=#{pid} | 
				
			||||||
 | 
					    </select> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</mapper> | 
				
			||||||
@ -0,0 +1,10 @@ | 
				
			|||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563307857514502', 0, 'equipment', 'em_attach', 'menu', '/equipment/em_attach', NULL, 1, 1, 0, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563307857514503', '1369563307857514502', 'em_attach_add', '新增', 'add', '/equipment/em_attach/add', 'plus', 1, 2, 1, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563307857514504', '1369563307857514502', 'em_attach_edit', '修改', 'edit', '/equipment/em_attach/edit', 'form', 2, 2, 2, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563307857514505', '1369563307857514502', 'em_attach_delete', '删除', 'delete', '/api/equipment/em_attach/remove', 'delete', 3, 2, 3, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563307857514506', '1369563307857514502', 'em_attach_view', '查看', 'view', '/equipment/em_attach/view', 'file-text', 4, 2, 2, 1, NULL, 0); | 
				
			||||||
@ -0,0 +1,10 @@ | 
				
			|||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306376925191', 0, 'equipment', 'em_info', 'menu', '/equipment/em_info', NULL, 1, 1, 0, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306376925192', '1369563306376925191', 'em_info_add', '新增', 'add', '/equipment/em_info/add', 'plus', 1, 2, 1, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306376925193', '1369563306376925191', 'em_info_edit', '修改', 'edit', '/equipment/em_info/edit', 'form', 2, 2, 2, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306376925194', '1369563306376925191', 'em_info_delete', '删除', 'delete', '/api/equipment/em_info/remove', 'delete', 3, 2, 3, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306376925195', '1369563306376925191', 'em_info_view', '查看', 'view', '/equipment/em_info/view', 'file-text', 4, 2, 2, 1, NULL, 0); | 
				
			||||||
@ -0,0 +1,10 @@ | 
				
			|||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369816257129451526', 0, 'equipment', 'em_model', 'menu', '/equipment/em_model', NULL, 1, 1, 0, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369816257129451527', '1369816257129451526', 'em_model_add', '新增', 'add', '/equipment/em_model/add', 'plus', 1, 2, 1, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369816257129451528', '1369816257129451526', 'em_model_edit', '修改', 'edit', '/equipment/em_model/edit', 'form', 2, 2, 2, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369816257129451529', '1369816257129451526', 'em_model_delete', '删除', 'delete', '/api/equipment/em_model/remove', 'delete', 3, 2, 3, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369816257129451530', '1369816257129451526', 'em_model_view', '查看', 'view', '/equipment/em_model/view', 'file-text', 4, 2, 2, 1, NULL, 0); | 
				
			||||||
@ -0,0 +1,10 @@ | 
				
			|||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563308268556289', 0, 'equipment', 'em_model_param', 'menu', '/equipment/em_model_param', NULL, 1, 1, 0, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563308268556290', '1369563308268556289', 'em_model_param_add', '新增', 'add', '/equipment/em_model_param/add', 'plus', 1, 2, 1, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563308268556291', '1369563308268556289', 'em_model_param_edit', '修改', 'edit', '/equipment/em_model_param/edit', 'form', 2, 2, 2, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563308268556292', '1369563308268556289', 'em_model_param_delete', '删除', 'delete', '/api/equipment/em_model_param/remove', 'delete', 3, 2, 3, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563308268556293', '1369563308268556289', 'em_model_param_view', '查看', 'view', '/equipment/em_model_param/view', 'file-text', 4, 2, 2, 1, NULL, 0); | 
				
			||||||
@ -0,0 +1,10 @@ | 
				
			|||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563305466761217', 0, 'equipment', 'em_oreanization', 'menu', '/equipment/em_oreanization', NULL, 1, 1, 0, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563305466761218', '1369563305466761217', 'em_oreanization_add', '新增', 'add', '/equipment/em_oreanization/add', 'plus', 1, 2, 1, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563305466761219', '1369563305466761217', 'em_oreanization_edit', '修改', 'edit', '/equipment/em_oreanization/edit', 'form', 2, 2, 2, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563305466761220', '1369563305466761217', 'em_oreanization_delete', '删除', 'delete', '/api/equipment/em_oreanization/remove', 'delete', 3, 2, 3, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563305466761221', '1369563305466761217', 'em_oreanization_view', '查看', 'view', '/equipment/em_oreanization/view', 'file-text', 4, 2, 2, 1, NULL, 0); | 
				
			||||||
@ -0,0 +1,10 @@ | 
				
			|||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306804744193', 0, 'equipment', 'em_param', 'menu', '/equipment/em_param', NULL, 1, 1, 0, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306804744194', '1369563306804744193', 'em_param_add', '新增', 'add', '/equipment/em_param/add', 'plus', 1, 2, 1, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306804744195', '1369563306804744193', 'em_param_edit', '修改', 'edit', '/equipment/em_param/edit', 'form', 2, 2, 2, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306804744196', '1369563306804744193', 'em_param_delete', '删除', 'delete', '/api/equipment/em_param/remove', 'delete', 3, 2, 3, 1, NULL, 0); | 
				
			||||||
 | 
					INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) | 
				
			||||||
 | 
					VALUES ('1369563306804744197', '1369563306804744193', 'em_param_view', '查看', 'view', '/equipment/em_param/view', 'file-text', 4, 2, 2, 1, NULL, 0); | 
				
			||||||
@ -0,0 +1,32 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.equipment.service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.entity.EmTreeNode; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.vo.EmOreanizationVO; | 
				
			||||||
 | 
					import org.springblade.core.mp.base.BaseService; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.entity.EmOreanizationEntity; | 
				
			||||||
 | 
					import org.springblade.core.tool.api.R; | 
				
			||||||
 | 
					import org.springblade.core.tool.node.INode; | 
				
			||||||
 | 
					import org.springblade.core.tool.node.TreeNode; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.validation.Valid; | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * 服务类 | 
				
			||||||
 | 
					 * | 
				
			||||||
 | 
					 * @author moze | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					public interface IEmOreanizationService extends BaseService<EmOreanizationEntity> { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						List<TreeNode> initLoad(String tenantId); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						boolean translocation(long id1, long id2); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						boolean updateOrg(@Valid EmOreanizationEntity em_oreanization); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						boolean saveOrg(@Valid EmOreanizationEntity em_oreanization); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						R<List<EmTreeNode>> groupTree(); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Integer sort(Long id); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,162 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.equipment.service.impl; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.entity.EmTreeNode; | 
				
			||||||
 | 
					import org.springblade.core.mp.base.BaseServiceImpl; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.entity.EmOreanizationEntity; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.mapper.EmOreanizationMapper; | 
				
			||||||
 | 
					import com.hnac.hzims.equipment.service.IEmOreanizationService; | 
				
			||||||
 | 
					import org.springblade.core.tool.api.R; | 
				
			||||||
 | 
					import org.springblade.core.tool.node.ForestNodeMerger; | 
				
			||||||
 | 
					import org.springblade.core.tool.node.TreeNode; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.Func; | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||||
 | 
					import org.springframework.stereotype.Service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.validation.Valid; | 
				
			||||||
 | 
					import java.util.ArrayList; | 
				
			||||||
 | 
					import java.util.Date; | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					import java.util.Objects; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 *  服务实现类 | 
				
			||||||
 | 
					 * | 
				
			||||||
 | 
					 * @author Chill | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					@Service | 
				
			||||||
 | 
					public class EmOreanizationServiceImpl extends BaseServiceImpl<EmOreanizationMapper, EmOreanizationEntity> implements IEmOreanizationService { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Autowired | 
				
			||||||
 | 
						private  EmOreanizationMapper oreanizationMapper; | 
				
			||||||
 | 
						@Override | 
				
			||||||
 | 
						public List<TreeNode> initLoad(String tenantId) { | 
				
			||||||
 | 
							List<TreeNode> treeList = oreanizationMapper.selectTreeList(tenantId); | 
				
			||||||
 | 
							return ForestNodeMerger.merge(treeList); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override | 
				
			||||||
 | 
						public boolean translocation(long id1, long id2) { | 
				
			||||||
 | 
							EmOreanizationEntity org1 =  this.getById(id1); | 
				
			||||||
 | 
							EmOreanizationEntity org2 =  this.getById(id2); | 
				
			||||||
 | 
							boolean flag = false; | 
				
			||||||
 | 
							if(Func.isNotEmpty(org1) && Func.isNotEmpty(org2)){ | 
				
			||||||
 | 
								Integer sort = org1.getSort(); | 
				
			||||||
 | 
								org1.setSort(org2.getSort()); | 
				
			||||||
 | 
								org2.setSort(sort); | 
				
			||||||
 | 
								List<EmOreanizationEntity> rows = new ArrayList<EmOreanizationEntity>(); | 
				
			||||||
 | 
								rows.add(org1); | 
				
			||||||
 | 
								rows.add(org2); | 
				
			||||||
 | 
								flag = this.updateBatchById(rows); | 
				
			||||||
 | 
							}else { | 
				
			||||||
 | 
								flag = false; | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							return flag; | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override | 
				
			||||||
 | 
						public boolean updateOrg(@Valid EmOreanizationEntity em_oreanization) { | 
				
			||||||
 | 
							EmOreanizationEntity temp = this.getById(em_oreanization.getId()); | 
				
			||||||
 | 
							// 处理序号问题
 | 
				
			||||||
 | 
							if(Func.isNotEmpty(temp) | 
				
			||||||
 | 
								&& temp.getPid() != null | 
				
			||||||
 | 
								&& em_oreanization.getPid() != null | 
				
			||||||
 | 
							    && temp.getPid().longValue() != em_oreanization.getPid().longValue()){ | 
				
			||||||
 | 
								int maxSort = oreanizationMapper.selectMaxSort(em_oreanization.getPid()) + 1; | 
				
			||||||
 | 
								em_oreanization.setSort(maxSort); | 
				
			||||||
 | 
								return this.updateById(em_oreanization); | 
				
			||||||
 | 
							}else { | 
				
			||||||
 | 
								return this.updateById(em_oreanization); | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override | 
				
			||||||
 | 
						public boolean saveOrg(EmOreanizationEntity em_oreanization) { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							int maxSort = oreanizationMapper.selectMaxSort(em_oreanization.getPid()) + 1; | 
				
			||||||
 | 
							em_oreanization.setSort(maxSort); | 
				
			||||||
 | 
							int cnt = oreanizationMapper.insert(em_oreanization); | 
				
			||||||
 | 
							return cnt > 0; | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override | 
				
			||||||
 | 
						public R<List<EmTreeNode>> groupTree() { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							QueryWrapper<EmOreanizationEntity> queryWrapper = new QueryWrapper<EmOreanizationEntity>() {{ | 
				
			||||||
 | 
								eq("PID",0); | 
				
			||||||
 | 
							}}; | 
				
			||||||
 | 
							queryWrapper.orderByAsc("PID","SORT"); | 
				
			||||||
 | 
							//数据库里所有pid为空的为根节点组织
 | 
				
			||||||
 | 
							List<EmOreanizationEntity> structs = oreanizationMapper.selectList(queryWrapper); | 
				
			||||||
 | 
							//查询所有数据  ListAll
 | 
				
			||||||
 | 
							QueryWrapper<EmOreanizationEntity> queryWrapper2 = new QueryWrapper<EmOreanizationEntity>() {{ | 
				
			||||||
 | 
							}}; | 
				
			||||||
 | 
							queryWrapper2.orderByAsc("PID","SORT"); | 
				
			||||||
 | 
							List<EmOreanizationEntity> resultList = oreanizationMapper.selectList(queryWrapper2); | 
				
			||||||
 | 
							//把组织信息换成节点
 | 
				
			||||||
 | 
							List<EmTreeNode> rootNodes = new ArrayList<>(); | 
				
			||||||
 | 
							for (EmOreanizationEntity struct : structs) { | 
				
			||||||
 | 
								EmTreeNode treeNode = new EmTreeNode(); | 
				
			||||||
 | 
								treeNode.setId(struct.getId()); | 
				
			||||||
 | 
								treeNode.setParentId(struct.getPid()); | 
				
			||||||
 | 
								treeNode.setTitle(struct.getName()); | 
				
			||||||
 | 
								treeNode.setLevel(1); | 
				
			||||||
 | 
								rootNodes.add(groupToNode(treeNode)); | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							//生成树
 | 
				
			||||||
 | 
							List<EmTreeNode> nodeList = createGroupAndStationTree(resultList, rootNodes); | 
				
			||||||
 | 
							return R.data(nodeList); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override | 
				
			||||||
 | 
						public Integer sort(Long id) { | 
				
			||||||
 | 
							return oreanizationMapper.selectMaxSort(id) + 1; | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private EmTreeNode groupToNode(EmTreeNode treeNode) { | 
				
			||||||
 | 
							if (Objects.isNull(treeNode)) { | 
				
			||||||
 | 
								return null; | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							return treeNode; | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public List<EmTreeNode> createGroupAndStationTree(List<EmOreanizationEntity> resultList, List<EmTreeNode> rootNodes) { | 
				
			||||||
 | 
							if (rootNodes == null || rootNodes.size() < 1) { | 
				
			||||||
 | 
								return null; | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							//遍历根节点
 | 
				
			||||||
 | 
							for (EmTreeNode rootNode : rootNodes) { | 
				
			||||||
 | 
								//找到子节点
 | 
				
			||||||
 | 
								List<EmTreeNode> childNodes = listGroupNodeByPid(resultList,rootNode.getId()+"",rootNode.getLevel()); | 
				
			||||||
 | 
								//如果没有数据了,就跳出循环
 | 
				
			||||||
 | 
								if (childNodes == null || childNodes.size() == 0) { | 
				
			||||||
 | 
									continue; | 
				
			||||||
 | 
								} | 
				
			||||||
 | 
								//遍历子节点
 | 
				
			||||||
 | 
								rootNode.setChildren(createGroupAndStationTree(resultList, childNodes)); | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							return rootNodes; | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public List<EmTreeNode> listGroupNodeByPid(List<EmOreanizationEntity> resultList, String id,Integer level){ | 
				
			||||||
 | 
							List<EmTreeNode> childNodes = new ArrayList<>(); | 
				
			||||||
 | 
							level = level+1; | 
				
			||||||
 | 
							for (EmOreanizationEntity struct : resultList) { | 
				
			||||||
 | 
								EmTreeNode treeNode = new EmTreeNode(); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if(id.equals(struct.getPid()+"")){ | 
				
			||||||
 | 
									treeNode.setId(struct.getId()); | 
				
			||||||
 | 
									treeNode.setParentId(struct.getPid()); | 
				
			||||||
 | 
									treeNode.setTitle(struct.getName()); | 
				
			||||||
 | 
									treeNode.setLevel(level); | 
				
			||||||
 | 
									childNodes.add(treeNode); | 
				
			||||||
 | 
								} | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
							return childNodes; | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,33 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.message_alarm.mqtt; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.alibaba.fastjson.JSONObject; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.entity.MessageResponseData; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.strategy.FactoryStrategy; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.strategy.Strategy; | 
				
			||||||
 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			||||||
 | 
					import org.springblade.mqtt.customer.IMqttReceive; | 
				
			||||||
 | 
					import org.springblade.mqtt.customer.annotation.MqttReceive; | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||||
 | 
					import org.springframework.stereotype.Service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//告警消费主题
 | 
				
			||||||
 | 
					@Service | 
				
			||||||
 | 
					@MqttReceive(topicName = "message_alarm_center/handleFlowWarn") | 
				
			||||||
 | 
					@Slf4j | 
				
			||||||
 | 
					public class MessageFlowWranConsumer implements IMqttReceive {//消费(flowAlarm)json数据
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired | 
				
			||||||
 | 
					    FactoryStrategy factoryForStrategy; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public void handlerMessage(String message) { | 
				
			||||||
 | 
					        log.info("收到告警消息: "+message); | 
				
			||||||
 | 
					        //解析消息 发送消息
 | 
				
			||||||
 | 
					        MessageResponseData responseData= JSONObject.parseObject(message,MessageResponseData.class); | 
				
			||||||
 | 
					        //获取对应策略
 | 
				
			||||||
 | 
					        Strategy strategy=factoryForStrategy.getStrategy(responseData.getBodyType()); | 
				
			||||||
 | 
					        if(strategy!=null) {//执行
 | 
				
			||||||
 | 
					            strategy.handleJson(responseData); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,191 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.message_alarm.strategy; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.alibaba.fastjson.JSON; | 
				
			||||||
 | 
					import com.alibaba.fastjson.JSONArray; | 
				
			||||||
 | 
					import com.alibaba.fastjson.JSONObject; | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
				
			||||||
 | 
					import com.hnac.hzims.common.logs.utils.StringUtils; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.dto.MessageDTO; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.entity.MessageMonitorObjAttr; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.entity.MessageResponseData; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.entity.MessageSendInfo; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.enums.PushTypeEnum; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.enums.TemplateTypeEnum; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.mapper.MessageMonitorObjAttrMapper; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.service.IMessageStrategyService; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.util.CheckDataRationalUtil; | 
				
			||||||
 | 
					import com.hnac.hzims.message_alarm.vo.MessageObjTemplateVo; | 
				
			||||||
 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			||||||
 | 
					import org.springblade.core.tool.api.R; | 
				
			||||||
 | 
					import org.springblade.flow.core.entity.BladeFlow; | 
				
			||||||
 | 
					import org.springblade.flow.core.feign.IFlowClient; | 
				
			||||||
 | 
					import org.springblade.system.user.entity.User; | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||||
 | 
					import org.springframework.stereotype.Component; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Resource; | 
				
			||||||
 | 
					import java.util.ArrayList; | 
				
			||||||
 | 
					import java.util.HashMap; | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					import java.util.Map; | 
				
			||||||
 | 
					import java.util.stream.Collectors; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//告警解析策略
 | 
				
			||||||
 | 
					@Component("flowWarn") | 
				
			||||||
 | 
					@Slf4j | 
				
			||||||
 | 
					public class FlowWarnStrategy implements Strategy { | 
				
			||||||
 | 
					    @Autowired | 
				
			||||||
 | 
					    IMessageStrategyService messageStrategyService; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired | 
				
			||||||
 | 
					    IFlowClient flowClient; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource | 
				
			||||||
 | 
					    private MessageMonitorObjAttrMapper messageMonitorObjAttrMapper; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public void handleJson(MessageResponseData responseData) { | 
				
			||||||
 | 
					        log.info("入参responseData:{}", responseData); | 
				
			||||||
 | 
					        //可执行模板
 | 
				
			||||||
 | 
					        List<MessageObjTemplateVo> executableTemplate = null; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //解析属性列表数据
 | 
				
			||||||
 | 
					        List<Map<String, Object>> attrListByObject = CheckDataRationalUtil.parseAttrListByObject(responseData.getData()); | 
				
			||||||
 | 
					        if (attrListByObject == null || attrListByObject.isEmpty()) { | 
				
			||||||
 | 
					            return; | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //查找符合条件的模板
 | 
				
			||||||
 | 
					        List<MessageObjTemplateVo> list = messageStrategyService.queryMessageObjTemplateVo(responseData.getSchemeId(), | 
				
			||||||
 | 
					                responseData.getDeviceCode(), TemplateTypeEnum.FLOW_WARN.getCode()); | 
				
			||||||
 | 
					        log.info("告警模板总个数:" + list.size()); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //筛选出可执行的模板
 | 
				
			||||||
 | 
					        if (list != null && !list.isEmpty()) { | 
				
			||||||
 | 
					            executableTemplate = new ArrayList<>(); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //获取数据中的最高级
 | 
				
			||||||
 | 
					            int highLevel = CheckDataRationalUtil.getHighLevel(attrListByObject); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for (MessageObjTemplateVo vo : list) { | 
				
			||||||
 | 
					                //校验模板与数据属性吻合度
 | 
				
			||||||
 | 
					                boolean checkAttr = CheckDataRationalUtil.checkAttr(vo, responseData); | 
				
			||||||
 | 
					                if (!checkAttr) { | 
				
			||||||
 | 
					                    continue; | 
				
			||||||
 | 
					                } | 
				
			||||||
 | 
					                //对象有属性的 针对自己的等级评价
 | 
				
			||||||
 | 
					                // 对象不包含属性的 已字段中的最高等级评价
 | 
				
			||||||
 | 
					                boolean checkObj = CheckDataRationalUtil.checkAlarmObj(vo, attrListByObject, highLevel); | 
				
			||||||
 | 
					                if (!checkObj) {//筛选出可执行的模板
 | 
				
			||||||
 | 
					                    continue; | 
				
			||||||
 | 
					                } | 
				
			||||||
 | 
					                // 替换模板content
 | 
				
			||||||
 | 
					                String templateContent = buildContent(responseData.getData(), vo.getTemplateContent()); | 
				
			||||||
 | 
					                vo.setTemplateContent(templateContent); | 
				
			||||||
 | 
					                executableTemplate.add(vo); | 
				
			||||||
 | 
					            } | 
				
			||||||
 | 
					            log.info("告警模板符合个数:" + executableTemplate.size()); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //发送消息+存储消息
 | 
				
			||||||
 | 
					            for (MessageObjTemplateVo vo : executableTemplate) { | 
				
			||||||
 | 
					                //解析模板内容
 | 
				
			||||||
 | 
					                String message = CheckDataRationalUtil.parseContent(vo.getTemplateContent(), responseData); | 
				
			||||||
 | 
					                log.info("模板:" + vo.getTemplateTitle() + ",发送告警消息:" + message); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //组装消息
 | 
				
			||||||
 | 
					//                // 造假数据
 | 
				
			||||||
 | 
					//                MessageSendInfo info = new MessageSendInfo();
 | 
				
			||||||
 | 
					//                HashMap<Long, String> map = new HashMap<>();
 | 
				
			||||||
 | 
					//                map.put(1710229795322830849L, "绿色小水电");
 | 
				
			||||||
 | 
					//                info.setPerson(map);
 | 
				
			||||||
 | 
					//                info.setTenantId("20000");
 | 
				
			||||||
 | 
					//                info.setObjectSource("111");
 | 
				
			||||||
 | 
					//                info.setPhones("13107280912");
 | 
				
			||||||
 | 
					//                info.setMessage(message);
 | 
				
			||||||
 | 
					//                info.setTitle("title");
 | 
				
			||||||
 | 
					//                info.setObjectCode("JSCZ001");
 | 
				
			||||||
 | 
					//                info.setSchemeId(1769602788549591042L);
 | 
				
			||||||
 | 
					                MessageSendInfo info = messageStrategyService.getSendMessageInfo(vo, message); | 
				
			||||||
 | 
					                if (info == null) { | 
				
			||||||
 | 
					                    continue; | 
				
			||||||
 | 
					                } | 
				
			||||||
 | 
					                //发送消息
 | 
				
			||||||
 | 
					                if (PushTypeEnum.SMS.getCode().equals(info.getPushType())) { | 
				
			||||||
 | 
					                    // todo 短信配置
 | 
				
			||||||
 | 
					//                     高板岩一站 电站生态流量预警:核定流量0.02(m³/s),当前日均流量0.017(m³/s),建议生态流量后续9小时的实时流量值不低于0.054(m³/s)
 | 
				
			||||||
 | 
					                    messageStrategyService.sendFlowWarnMessage(message, info.getPhones()); | 
				
			||||||
 | 
					                } else { | 
				
			||||||
 | 
					//                    messageStrategyService.sendInfo(info);
 | 
				
			||||||
 | 
					                } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //启动流程实例
 | 
				
			||||||
 | 
					                if (vo.getProcessKey() != null && !"".equals(vo.getProcessKey().trim())) {//I II III IV 启动流程
 | 
				
			||||||
 | 
					                    Map<String, Object> variables = new HashMap<>(); | 
				
			||||||
 | 
					                    variables.put("alarm_msg", message); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    String processInstanceId = null; | 
				
			||||||
 | 
					                    if (vo.getAutoStartProcess() != null && vo.getAutoStartProcess().intValue() == 1) {//自动触发
 | 
				
			||||||
 | 
					                        R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceByKey(vo.getProcessKey(), "message_alarm_center", variables); | 
				
			||||||
 | 
					                        processInstanceId = bladeFlowR.getData().getProcessInstanceId(); | 
				
			||||||
 | 
					                    } | 
				
			||||||
 | 
					                    //保存信息
 | 
				
			||||||
 | 
					                    messageStrategyService.saveFlowWarnMessage(info, processInstanceId, vo.getProcessKey(), vo.getAlarmLevel(), JSON.toJSONString(responseData)); | 
				
			||||||
 | 
					                } else {//V无需启动流程  需要相关人员确认一下
 | 
				
			||||||
 | 
					                    messageStrategyService.saveFlowWarnMessage(info, null, null, vo.getAlarmLevel(), JSON.toJSONString(responseData)); | 
				
			||||||
 | 
					                } | 
				
			||||||
 | 
					            } | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final static String JOIN_CODE = "、"; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 组装消息模板 | 
				
			||||||
 | 
					     * | 
				
			||||||
 | 
					     * @param templateContent 模板 | 
				
			||||||
 | 
					     * @param responseData    数据 | 
				
			||||||
 | 
					     * @return | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    private MessageDTO messageMake(String phones, String templateContent, MessageResponseData responseData, List<Map<String, Object>> list) { | 
				
			||||||
 | 
					        MessageDTO messageDto = new MessageDTO(); | 
				
			||||||
 | 
					        messageDto.setStation(responseData.getObjectName()); | 
				
			||||||
 | 
					        messageDto.setTime(responseData.getCreateDate()); | 
				
			||||||
 | 
					        messageDto.setPhone(phones); | 
				
			||||||
 | 
					        Map<String, String> keyToAttr = messageMonitorObjAttrMapper.selectList(new LambdaQueryWrapper<MessageMonitorObjAttr>() {{ | 
				
			||||||
 | 
					            eq(MessageMonitorObjAttr::getInstanceCode, responseData.getDeviceCode()); | 
				
			||||||
 | 
					        }}).stream().collect(Collectors.toMap(MessageMonitorObjAttr::getAttrCode, MessageMonitorObjAttr::getAttrName)); | 
				
			||||||
 | 
					        //拼接所有属性key值
 | 
				
			||||||
 | 
					        List<String> keyList = CheckDataRationalUtil.getAttrList(templateContent); | 
				
			||||||
 | 
					        //获取对应value值
 | 
				
			||||||
 | 
					        StringBuilder valueStr = new StringBuilder(); | 
				
			||||||
 | 
					        StringBuilder keyStr = new StringBuilder(); | 
				
			||||||
 | 
					        for (String key : keyList) { | 
				
			||||||
 | 
					            String tmpKey = key.replaceAll("\\{", "").replaceAll("}", ""); | 
				
			||||||
 | 
					            Object value = CheckDataRationalUtil.getDataByKey(tmpKey, list); | 
				
			||||||
 | 
					            if (value != null) { | 
				
			||||||
 | 
					                keyStr.append(getKeyName(keyToAttr, tmpKey)); | 
				
			||||||
 | 
					                valueStr.append(value.toString()); | 
				
			||||||
 | 
					                valueStr.append(JOIN_CODE); | 
				
			||||||
 | 
					                keyStr.append(JOIN_CODE); | 
				
			||||||
 | 
					            } | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        valueStr.deleteCharAt(valueStr.length() - 1); | 
				
			||||||
 | 
					        keyStr.deleteCharAt(keyStr.length() - 1); | 
				
			||||||
 | 
					        messageDto.setNum(valueStr.toString()); | 
				
			||||||
 | 
					        messageDto.setType(keyStr.toString()); | 
				
			||||||
 | 
					        log.info("messageMake {}", messageDto); | 
				
			||||||
 | 
					        return messageDto; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //获取当前key对应名称
 | 
				
			||||||
 | 
					    private String getKeyName(Map<String, String> objAttr, String key) { | 
				
			||||||
 | 
					        return StringUtils.isEmpty(objAttr.get(key)) ? "-" : objAttr.get(key); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String buildContent(String data, String templateContent) { | 
				
			||||||
 | 
					        JSONArray array = JSON.parseArray(data); | 
				
			||||||
 | 
					        Map map = JSON.parseObject(array.get(0).toString(), Map.class); | 
				
			||||||
 | 
					        return map.get("suggest").toString(); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue