pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerMapper.java
@@ -45,11 +45,18 @@ List<VoController> getControllers(Map<?, ?> params); /** * 根据控制器地址获取控制器列表 * 根据控制器编号获取控制器列表 * @param rtuAddr * @return */ List<Map<String, Object>> getControllersByAddr(@Param("rtuAddr") String rtuAddr); List<Map<String, Object>> getControllersByCode(@Param("rtuAddr") String rtuAddr); /** * 根据控制器编号获取控制器列表 * @param rtuAddr * @return */ List<PrController> getControllersByRtuAddr(@Param("rtuAddr") String rtuAddr); /** * 根据控制器编号逻辑删除控制 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerTrampMapper.java
@@ -47,7 +47,7 @@ * @param rutAddr 控制器地址 * @return object by 控制器地址 */ List<PrControllerTramp> selectPrControllerTrampByRtuAddr(String rutAddr); List<PrControllerTramp> getPrControllerTrampByRtuAddr(String rutAddr); /** * update record selective pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrController.java
@@ -8,6 +8,7 @@ import com.dy.common.po.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.*; import org.hibernate.validator.constraints.Length; @@ -43,12 +44,19 @@ private Long id; /** * 取水口ID */ @Schema(description = "取水口ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "取水口ID不能为空") private Long intakeId; /** * 控制器地址 */ @Schema(description = "控制器地址", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "控制器地址不能为空") @Length(message = "控制器地址不大于{max}字",max = 11) private String rtuaddr; private String rtuAddr; /** * 通讯协议 @@ -59,22 +67,16 @@ private String protocol; /** * 在线状态;1-在线,2-离线 * 发现日期时间 */ @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Byte onlinestate; /** * 最近上报时间 */ @Schema(description = "最近上报时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Date reporttime; @Schema(description = "发现日期时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Date findDt; /** * 添加方式;1-系统自动,2-手动 */ @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Byte addways; private Byte addWays; /** * 操作人ID @@ -86,7 +88,7 @@ * 操作时间 */ @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Date operatedt; private Date operateDt; /** * 逻辑删除标识;0-未删除,1-删除 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrControllerTramp.java
@@ -15,8 +15,11 @@ import com.dy.common.po.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.*; import org.hibernate.validator.constraints.Length; import java.util.Date; /** * 流浪控制器 @@ -39,7 +42,7 @@ public Long id; /** * 通讯协议 * 控制器地址 */ @Schema(description = "控制器地址", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "控制器地址不能为空") @@ -55,10 +58,10 @@ public String protocol; /** * 通讯协议 * 发现时间 */ @Schema(description = "发现时间", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "发现时间不能为空") public String findDt;//发现时间( yyyy-mm-dd HH:MM:SS) @NotNull(message = "发现时间不能为空") public Date findDt;//发现时间( yyyy-mm-dd HH:MM:SS) } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoController.java
@@ -32,11 +32,6 @@ @ColumnWidth(15) private String rtuAddr; @Schema(title = "在线状态") @ExcelProperty("在线状态") @ColumnWidth(15) private String onlineState; @Schema(title = "绑定取水口") @ExcelProperty("绑定取水口") @ColumnWidth(10) @@ -49,8 +44,8 @@ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @Schema(title = "最近上报时间") @ExcelProperty("最近上报时间") @Schema(title = "发现日期时间") @ExcelProperty("发现日期时间") @ColumnWidth(30) private Date reportTime; private Date findDt; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml
@@ -5,18 +5,18 @@ <!--@mbg.generated--> <!--@Table pr_controller--> <id column="id" jdbcType="BIGINT" property="id" /> <result column="rtuAddr" jdbcType="VARCHAR" property="rtuaddr" /> <result column="intakeId" jdbcType="BIGINT" property="intakeId" /> <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> <result column="protocol" jdbcType="VARCHAR" property="protocol" /> <result column="onlineState" jdbcType="TINYINT" property="onlinestate" /> <result column="reportTime" jdbcType="TIMESTAMP" property="reporttime" /> <result column="addWays" jdbcType="TINYINT" property="addways" /> <result column="findDt" jdbcType="TIMESTAMP" property="findDt" /> <result column="addWays" jdbcType="TINYINT" property="addWays" /> <result column="operator" jdbcType="BIGINT" property="operator" /> <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> <result column="operateDt" jdbcType="TIMESTAMP" property="operateDt" /> <result column="deleted" jdbcType="TINYINT" property="deleted" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> id, rtuAddr, protocol, onlineState, reportTime, addWays, `operator`, operateDt, deleted id, intakeId, rtuAddr, protocol, findDt, addWays, `operator`, operateDt, deleted </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <!--@mbg.generated--> @@ -32,13 +32,13 @@ </delete> <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrController"> <!--@mbg.generated--> insert into pr_controller (id, rtuAddr, protocol, onlineState, reportTime, addWays, insert into pr_controller (id, intakeId, rtuAddr, protocol, findDt, addWays, `operator`, operateDt, deleted ) values (#{id,jdbcType=BIGINT}, #{rtuaddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{onlinestate,jdbcType=TINYINT}, #{reporttime,jdbcType=TIMESTAMP}, #{addways,jdbcType=TINYINT}, #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT} values (#{id,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{findDt,jdbcType=TIMESTAMP}, #{addWays,jdbcType=TINYINT}, #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT} ) </insert> <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrController"> @@ -48,25 +48,25 @@ <if test="id != null"> id, </if> <if test="rtuaddr != null"> <if test="intakeId != null"> intakeId, </if> <if test="rtuAddr != null"> rtuAddr, </if> <if test="protocol != null"> protocol, </if> <if test="onlinestate != null"> onlineState, <if test="findDt != null"> findDt, </if> <if test="reporttime != null"> reportTime, </if> <if test="addways != null"> <if test="addWays != null"> addWays, </if> <if test="operator != null"> `operator`, </if> <if test="operatedt != null"> <if test="operateDt != null"> operateDt, </if> <if test="deleted != null"> @@ -77,26 +77,26 @@ <if test="id != null"> #{id,jdbcType=BIGINT}, </if> <if test="rtuaddr != null"> #{rtuaddr,jdbcType=VARCHAR}, <if test="intakeId != null"> #{intakeId,jdbcType=BIGINT}, </if> <if test="rtuAddr != null"> #{rtuAddr,jdbcType=VARCHAR}, </if> <if test="protocol != null"> #{protocol,jdbcType=VARCHAR}, </if> <if test="onlinestate != null"> #{onlinestate,jdbcType=TINYINT}, <if test="findDt != null"> #{findDt,jdbcType=TIMESTAMP}, </if> <if test="reporttime != null"> #{reporttime,jdbcType=TIMESTAMP}, </if> <if test="addways != null"> #{addways,jdbcType=TINYINT}, <if test="addWays != null"> #{addWays,jdbcType=TINYINT}, </if> <if test="operator != null"> #{operator,jdbcType=BIGINT}, </if> <if test="operatedt != null"> #{operatedt,jdbcType=TIMESTAMP}, <if test="operateDt != null"> #{operateDt,jdbcType=TIMESTAMP}, </if> <if test="deleted != null"> #{deleted,jdbcType=TINYINT}, @@ -107,26 +107,26 @@ <!--@mbg.generated--> update pr_controller <set> <if test="rtuaddr != null"> rtuAddr = #{rtuaddr,jdbcType=VARCHAR}, <if test="intakeId != null"> intakeId = #{intakeId,jdbcType=BIGINT}, </if> <if test="rtuAddr != null"> rtuAddr = #{rtuAddr,jdbcType=VARCHAR}, </if> <if test="protocol != null"> protocol = #{protocol,jdbcType=VARCHAR}, </if> <if test="onlinestate != null"> onlineState = #{onlinestate,jdbcType=TINYINT}, <if test="findDt != null"> findDt = #{findDt,jdbcType=TIMESTAMP}, </if> <if test="reporttime != null"> reportTime = #{reporttime,jdbcType=TIMESTAMP}, </if> <if test="addways != null"> addWays = #{addways,jdbcType=TINYINT}, <if test="addWays != null"> addWays = #{addWays,jdbcType=TINYINT}, </if> <if test="operator != null"> `operator` = #{operator,jdbcType=BIGINT}, </if> <if test="operatedt != null"> operateDt = #{operatedt,jdbcType=TIMESTAMP}, <if test="operateDt != null"> operateDt = #{operateDt,jdbcType=TIMESTAMP}, </if> <if test="deleted != null"> deleted = #{deleted,jdbcType=TINYINT}, @@ -137,26 +137,27 @@ <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrController"> <!--@mbg.generated--> update pr_controller set rtuAddr = #{rtuaddr,jdbcType=VARCHAR}, set intakeId = #{intakeId,jdbcType=BIGINT}, rtuAddr = #{rtuAddr,jdbcType=VARCHAR}, protocol = #{protocol,jdbcType=VARCHAR}, onlineState = #{onlinestate,jdbcType=TINYINT}, reportTime = #{reporttime,jdbcType=TIMESTAMP}, addWays = #{addways,jdbcType=TINYINT}, findDt = #{findDt,jdbcType=TIMESTAMP}, addWays = #{addWays,jdbcType=TINYINT}, `operator` = #{operator,jdbcType=BIGINT}, operateDt = #{operatedt,jdbcType=TIMESTAMP}, operateDt = #{operateDt,jdbcType=TIMESTAMP}, deleted = #{deleted,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} </update> <!--根据指定获取控制器记录数--> <!--根据指定条件获取控制器记录数--> <select id="getRecordCount" resultType="java.lang.Long"> SELECT COUNT(*) AS recordCount FROM pr_controller con INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id INNER JOIN pr_intake inta ON ic.intakeId = inta.id INNER JOIN pr_intake inta ON con.intakeId = inta.id <where> AND ic.operateType = 1 AND deleted = 0 <if test = "id != null and id > 0"> AND con.id = ${id} @@ -164,10 +165,6 @@ <if test = "rtuAddr != null and rtuAddr !=''"> AND con.rtuAddr like CONCAT('%',#{rtuAddr},'%') </if> <if test = "onlineState != null and onlineState > 0"> AND con.onlineState = ${onlineState} </if> <if test = "bindNumber != null and bindNumber > 0"> @@ -176,22 +173,19 @@ </where> </select> <!--根据指定获取控制器记录--> <!--根据指定条件获取控制器记录--> <select id="getControllers" resultType="com.dy.pipIrrGlobal.voPr.VoController"> SELECT con.rtuAddr AS rtuAddr, (CASE WHEN con.onlineState = 1 THEN "在线" WHEN con.onlineState = 2 THEN "离线" END) AS onlineState, inta.name AS intakeName, (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) AS bindNumber, con.reportTime con.findDt FROM pr_controller con INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id INNER JOIN pr_intake inta ON ic.intakeId = inta.id INNER JOIN pr_intake inta ON con.intakeId = inta.id <where> AND ic.operateType = 1 AND deleted = 0 <if test = "id != null and id > 0"> AND con.id = ${id} @@ -199,10 +193,6 @@ <if test = "rtuAddr != null and rtuAddr !=''"> AND con.rtuAddr like CONCAT('%',#{rtuAddr},'%') </if> <if test = "onlineState != null and onlineState > 0"> AND con.onlineState = ${onlineState} </if> <if test = "bindNumber != null and bindNumber > 0"> @@ -213,12 +203,11 @@ <if test="pageCurr != null and pageSize != null"> LIMIT ${pageCurr}, ${pageSize} </if> </select> <!--根据控制器地址获取控制器列表--> <select id="getControllersByAddr" resultType="java.util.Map"> SELECT id, rtuAddr FROM pr_controller WHERE rtuAddr LIKE CONCAT('%',#{rtuAddr},'%') SELECT id, rtuAddr FROM pr_controller WHERE deleted = 0 AND rtuAddr LIKE CONCAT('%',#{rtuAddr},'%') </select> <!--根据控制器编号逻辑删除控制--> pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerTrampMapper.xml
@@ -7,7 +7,7 @@ <id column="id" jdbcType="BIGINT" property="id" /> <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> <result column="protocol" jdbcType="VARCHAR" property="protocol" /> <result column="findDt" jdbcType="VARCHAR" property="findDt" /> <result column="findDt" jdbcType="TIMESTAMP" property="findDt" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> @@ -20,6 +20,7 @@ from pr_controller_tramp where id = #{id,jdbcType=BIGINT} </select> <select id="selectPrControllerTrampByRtuAddr" parameterType="java.lang.String" resultMap="BaseResultMap"> <!--@mbg.generated--> select @@ -27,6 +28,7 @@ from pr_controller_tramp where rtuAddr = #{rtuAddr,jdbcType=VARCHAR} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <!--@mbg.generated--> delete from pr_controller_tramp @@ -37,7 +39,7 @@ insert into pr_controller_tramp (id, rtuAddr, protocol, findDt) values (#{id,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{findDt,jdbcType=VARCHAR}) #{findDt,jdbcType=TIMESTAMP}) </insert> <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrControllerTramp"> <!--@mbg.generated--> @@ -67,7 +69,7 @@ #{protocol,jdbcType=VARCHAR}, </if> <if test="findDt != null"> #{findDt,jdbcType=VARCHAR}, #{findDt,jdbcType=TIMESTAMP}, </if> </trim> </insert> @@ -82,7 +84,7 @@ protocol = #{protocol,jdbcType=VARCHAR}, </if> <if test="findDt != null"> findDt = #{findDt,jdbcType=VARCHAR}, findDt = #{findDt,jdbcType=TIMESTAMP}, </if> </set> where id = #{id,jdbcType=BIGINT} @@ -92,7 +94,7 @@ update pr_controller_tramp set rtuAddr = #{rtuAddr,jdbcType=VARCHAR}, protocol = #{protocol,jdbcType=VARCHAR}, findDt = #{findDt,jdbcType=VARCHAR} findDt = #{findDt,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> </mapper> pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java
@@ -4,7 +4,6 @@ import com.dy.aceMw.server.rtuData.dbSv.DbSv; import com.dy.common.mw.protocol.Data; import com.dy.common.springUtil.SpringContextUtil; import com.dy.common.util.DateTime; import com.dy.pipIrrGlobal.pojoPr.PrController; import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp; import org.apache.logging.log4j.LogManager; @@ -32,11 +31,11 @@ //数据库中未查询到控制器(RTU实体) //流浪者控制器 PrControllerTramp rtuTramp = sv.getPrControllerTrampByRtuAddr(rtuAddr); if(rtuTramp == null){ rtuTramp = new PrControllerTramp(null, rtuAddr, d.getProtocol(), DateTime.yyyy_MM_dd_HH_mm_ss()) ; this.taskResult = new Object[]{sv, null, rtuTramp} ; this.toNextOneTask(data, TkDealControllerTramp.taskId); } //if(rtuTramp == null){ // rtuTramp = new PrControllerTramp(null, rtuAddr, d.getProtocol(), DateTime.yyyy_MM_dd_HH_mm_ss()) ; // this.taskResult = new Object[]{sv, null, rtuTramp} ; // this.toNextOneTask(data, TkDealControllerTramp.taskId); //} } //不论是否为流浪控制器(RTU实体),都要进行下步工作 this.taskResult = new Object[]{sv, controller, null} ; pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java
@@ -81,7 +81,7 @@ /** * 根据控制器编号获取控制器列表 * @param controllerCode 控制器编号 * @param rtuAddr 控制器地址 * @return 符合条件的控制器列表 */ @Operation(summary = "获得控制器记录", description = "返回取控制器数据") @@ -126,17 +126,23 @@ @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() public BaseResponse<Boolean> add(@RequestBody @Valid DtoController po, BindingResult bindingResult){ //public BaseResponse<Boolean> add(@RequestBody @Valid DtoController po, BindingResult bindingResult){ public BaseResponse<Boolean> add(@RequestBody @Valid PrController po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } PrController prController = DtoToPojo.INSTANCT.po2vo(po); //PrController prController = DtoToPojo.INSTANCT.po2vo(po); //Date operateTime = new Date(); //prController.setOperatedt(operateTime); //prController.setDeleted((byte)0); //prController.setReporttime(operateTime); Date operateTime = new Date(); prController.setOperatedt(operateTime); prController.setDeleted((byte)0); prController.setReporttime(operateTime); Integer rec = Optional.ofNullable(controllerSv.addController(prController)).orElse(0); po.setOperateDt(operateTime); po.setDeleted((byte)0); po.setFindDt(operateTime); Integer rec = Optional.ofNullable(controllerSv.addController(po)).orElse(0); if(rec == 0) { return BaseResponseUtils.buildFail(ProjectResultCode.CONTROLLER_FAIL.getMessage()); } pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/DtoController.java
File was deleted pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/DtoToPojo.java
File was deleted