From e3aae0ec49b7423d4e8a9c903fe0b9852c89d6b6 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 08 十一月 2024 11:15:17 +0800 Subject: [PATCH] RTU升级任务增加两个属性,及线束、执行一些逻辑 --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskSv.java | 40 ++++++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/UgRtuTaskMapper.java | 29 +++++++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/UgRtuTaskMapper.xml | 53 +++++++++++- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/UgRtuTask.java | 25 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java | 86 ++++++++++++++++++++- pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 2 pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml | 4 7 files changed, 225 insertions(+), 14 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/UgRtuTaskMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/UgRtuTaskMapper.java index d0f9f34..fc74ad8 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/UgRtuTaskMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/UgRtuTaskMapper.java @@ -83,4 +83,33 @@ * @return update count */ int updateByPrimaryKey(UgRtuTask record); + /** + * execute by primary key + * @param id primaryKey + * @return deleteCount + */ + int executeById(Long id); + + /** + * over by primary key + * @param id primaryKey + * @return deleteCount + */ + int overById(Long id); + + /** + * is execute by primary key + * @param id primaryKey + * @return deleteCount + */ + int isExecuteById(Long id); + + /** + * is over by primary key + * @param id primaryKey + * @return deleteCount + */ + int isOverById(Long id); + + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/UgRtuTask.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/UgRtuTask.java index 0abf832..9fd1ca5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/UgRtuTask.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/UgRtuTask.java @@ -65,10 +65,28 @@ public Date dt; /** + * 鏄惁鎵ц锛�1鏄紝0鍚︼級 + */ + @Schema(description = "鏄惁鎵ц锛�1鏄紝0鍚︼級", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Byte isExecute; + + /** + * 鏄惁鎵ц + */ + @Schema(description = "鏄惁鎵ц", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String isExecuteStr; + + /** * 鏄惁缁撴潫锛�1鏄紝0鍚︼級 */ @Schema(description = "鏄惁缁撴潫锛�1鏄紝0鍚︼級", requiredMode = Schema.RequiredMode.NOT_REQUIRED) public Byte isOver; + + /** + * 鏄惁缁撴潫 + */ + @Schema(description = "鏄惁缁撴潫", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String isOverStr; /** * 鍒犻櫎鏍囪瘑 @@ -77,4 +95,11 @@ @JSONField(serialize=false) public Byte deleted; + public void init(){ + this.dt = new Date(); + this.isExecute = 0 ; + this.isOver = 0 ; + this.deleted = 0 ; + } + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml index ed9eb26..80e789b 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml @@ -5,9 +5,9 @@ #name: ym type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull + url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull # url: jdbc:mysql://8.130.130.233:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull - url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +# url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index 7564bf5..b4cbcac 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -77,7 +77,7 @@ pipIrr: global: - dev: false #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse + dev: true #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse dsName: ym #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О nginx: webPort: 54321 diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/UgRtuTaskMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/UgRtuTaskMapper.xml index 50752e7..a8d38c4 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/UgRtuTaskMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/UgRtuTaskMapper.xml @@ -9,17 +9,20 @@ <result column="creator" jdbcType="VARCHAR" property="creator" /> <result column="remark" jdbcType="VARCHAR" property="remark" /> <result column="dt" jdbcType="TIMESTAMP" property="dt" /> + <result column="is_execute" jdbcType="TINYINT" property="isExecute" /> <result column="is_over" jdbcType="TINYINT" property="isOver" /> <result column="deleted" jdbcType="TINYINT" property="deleted" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> - id, program_id, creator, remark, dt, is_over, deleted + id, program_id, creator, remark, dt, is_execute, is_over, deleted </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <!--@mbg.generated--> select - <include refid="Base_Column_List" /> + <include refid="Base_Column_List" />, + (CASE WHEN is_execute = 1 THEN '鏄�' ELSE '鍚�' END) AS isExecuteStr, + (CASE WHEN is_over = 1 THEN '鏄�' ELSE '鍚�' END) AS isOverStr from ug_rtu_task where id = #{id,jdbcType=BIGINT} </select> @@ -55,7 +58,9 @@ select <include refid="Base_Column_List" > <property name="alias" value="bd"/> - </include> + </include>, + (CASE WHEN bd.is_execute = 1 THEN '鏄�' ELSE '鍚�' END) AS isExecuteStr, + (CASE WHEN bd.is_over = 1 THEN '鏄�' ELSE '鍚�' END) AS isOverStr from ug_rtu_task bd where bd.deleted != 1 <trim prefix="and" suffixOverrides="and"> @@ -86,10 +91,11 @@ <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.UgRtuTask"> <!--@mbg.generated--> insert into ug_rtu_task (id, program_id, creator, - remark, dt, is_over, deleted + remark, dt, is_execute, is_over, deleted ) values (#{id,jdbcType=BIGINT}, #{programId,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, - #{remark,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{isOver,jdbcType=TINYINT}, #{deleted,jdbcType=TINYINT} + #{remark,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{isExecute,jdbcType=TINYINT}, + #{isOver,jdbcType=TINYINT}, #{deleted,jdbcType=TINYINT} ) </insert> <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.UgRtuTask"> @@ -110,6 +116,9 @@ </if> <if test="dt != null"> dt, + </if> + <if test="isExecute != null"> + is_execute, </if> <if test="isOver != null"> is_over, @@ -133,6 +142,9 @@ </if> <if test="dt != null"> #{dt,jdbcType=TIMESTAMP}, + </if> + <if test="isExecute != null"> + #{isExecute,jdbcType=TINYINT}, </if> <if test="isOver != null"> #{isOver,jdbcType=TINYINT}, @@ -158,7 +170,10 @@ <if test="dt != null"> dt = #{dt,jdbcType=TIMESTAMP}, </if> - <if test="isOver != null"> + <if test="isExecute != null"> + is_execute = #{isExecute,jdbcType=TINYINT}, + </if> + <if test="isOver != null"> is_over = #{isOver,jdbcType=TINYINT}, </if> <if test="deleted != null"> @@ -174,8 +189,34 @@ creator = #{creator,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR}, dt = #{dt,jdbcType=TIMESTAMP}, + is_execute = #{isExecute,jdbcType=TINYINT}, is_over = #{isOver,jdbcType=TINYINT}, deleted = #{deleted,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} </update> + + <update id="executeById" parameterType="java.lang.Long"> + update ug_rtu_task set is_execute = 1 + where id = #{id,jdbcType=BIGINT} + </update> + + <update id="overById" parameterType="java.lang.Long"> + update ug_rtu_task set is_over = 1 + where id = #{id,jdbcType=BIGINT} + </update> + + <select id="isExecuteById" parameterType="java.lang.Long" resultType="java.lang.Integer"> + select + is_execute + from ug_rtu_task + where id = #{id,jdbcType=BIGINT} + </select> + + <select id="isOverById" parameterType="java.lang.Long" resultType="java.lang.Integer"> + select + is_over + from ug_rtu_task + where id = #{id,jdbcType=BIGINT} + </select> + </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java index 38822a4..59ab39b 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java @@ -25,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController; import java.io.UnsupportedEncodingException; -import java.util.Date; import java.util.List; import java.util.Objects; @@ -137,9 +136,7 @@ } UgRtuTask po = new UgRtuTask(); vo.toPo(po); - po.dt = new Date(); - po.isOver = 0 ; - po.deleted = 0 ; + po.init(); int count; try { count = this.sv.save(po); @@ -192,6 +189,85 @@ /** + * 鎵цRTU鍗囩骇浠诲姟 + * @param id RTU鍗囩骇浠诲姟ID + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "鎵цRTU鍗囩骇浠诲姟", description = "鎻愪氦RTU鍗囩骇浠诲姟ID锛岃繘琛屾墽琛�") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @GetMapping(path = "execute") + @SsoAop() + public BaseResponse<Boolean> execute(Long id){ + if(id == null){ + return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ; + } + int count; + try { + count = this.sv.isOver(id) ; + if(count > 0){ + return BaseResponseUtils.buildError("浠诲姟宸茬粡缁撴潫锛屼笉鑳藉啀鎵ц") ; + } + count = this.sv.isExecute(id) ; + if(count > 0){ + return BaseResponseUtils.buildError("浠诲姟宸茬粡鎵ц锛屼笉鑳藉啀鎵ц") ; + } + count = this.sv.execute(id); + } catch (Exception e) { + log.error("缁撴潫RTU鍗囩骇浠诲姟寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + if(count <= 0){ + return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ; + }else{ + return BaseResponseUtils.buildSuccess(true) ; + } + } + + /** + * 缁撴潫RTU鍗囩骇浠诲姟 + * @param id RTU鍗囩骇浠诲姟ID + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "缁撴潫RTU鍗囩骇浠诲姟", description = "鎻愪氦RTU鍗囩骇浠诲姟ID锛岃繘琛岀粨鏉�") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @GetMapping(path = "over") + @SsoAop() + public BaseResponse<Boolean> over(Long id){ + if(id == null){ + return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ; + } + int count; + try {count = this.sv.isOver(id) ; + if(count > 0){ + return BaseResponseUtils.buildError("浠诲姟宸茬粡缁撴潫锛屼笉鐢ㄥ啀缁撴潫") ; + } + count = this.sv.over(id); + } catch (Exception e) { + log.error("缁撴潫RTU鍗囩骇浠诲姟寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + if(count <= 0){ + return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ; + }else{ + return BaseResponseUtils.buildSuccess(true) ; + } + } + + /** * 鍒犻櫎RTU鍗囩骇浠诲姟 * @param id RTU鍗囩骇浠诲姟ID * @return 鏄惁鎴愬姛 @@ -219,7 +295,7 @@ return BaseResponseUtils.buildException(e.getMessage()) ; } if(count <= 0){ - return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; + return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ; }else{ return BaseResponseUtils.buildSuccess(true) ; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskSv.java index 4d974fc..d5363aa 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskSv.java @@ -80,6 +80,46 @@ } /** + * 鎵ц浠诲姟 + * @param id 瀹炰綋ID + * @return 鏁伴噺 + */ + @Transactional + public int execute(Long id){ + return this.dao.executeById(id) ; + } + + /** + * 缁撴潫浠诲姟 + * @param id 瀹炰綋ID + * @return 鏁伴噺 + */ + @Transactional + public int over(Long id){ + return this.dao.overById(id) ; + } + + /** + * 鎵ц浠诲姟 + * @param id 瀹炰綋ID + * @return 鏁伴噺 + */ + @Transactional + public int isExecute(Long id){ + return this.dao.isExecuteById(id) ; + } + + /** + * 缁撴潫浠诲姟 + * @param id 瀹炰綋ID + * @return 鏁伴噺 + */ + @Transactional + public int isOver(Long id){ + return this.dao.isOverById(id) ; + } + + /** * 閫昏緫鍒犻櫎瀹炰綋 * @param id 瀹炰綋ID * @return 鏁伴噺 -- Gitblit v1.8.0