Browse Source

完善计量检定功能

hfxc226 2 years ago
parent
commit
26ce2f1f7b

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/dto/sb/SbInfoDTO.java

@@ -32,6 +32,10 @@ public class SbInfoDTO extends BaseDTO implements Serializable {
      */
     @Transient
     private String changeReason;
+    /**
+     * 设备位号
+     */
+    private String positionNo;
 
     /**
      * 状态变更实际操作人姓名

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/entity/sb/SbInfo.java

@@ -24,6 +24,10 @@ public class SbInfo implements Serializable {
      * 自定义参数列表
      */
     private String paramList;
+    /**
+     * 设备位号
+     */
+    private String positionNo;
     /**
      * 验收单id
      */

+ 1 - 1
platform-dao/src/main/java/com/platform/dao/mapper/sb/SbInfoMapper.java

@@ -129,7 +129,7 @@ public interface SbInfoMapper extends MyMapper<SbInfo> {
      */
     void updateBatchValue(List<SbInfo> list);
 
-    List selectPageInfoForWarn(SbInfoDTO record);
+    List<SbInfoVO> selectPageInfoForWarn(SbInfoDTO record);
 
     SbTreeVO getSbTree(SbInfoDTO sbInfoDTO);
 

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/vo/sb/SbInfoVO.java

@@ -29,6 +29,10 @@ public class SbInfoVO extends BaseVO implements Serializable {
      * 自定义参数列表:[{name:name1, content:content1},{name:name2, content:content2}]
      */
     private String paramList;
+    /**
+     * 设备位号
+     */
+    private String positionNo;
     /**
      * 验收单id
      */

+ 25 - 17
platform-dao/src/main/resources/mapper/sb/SbInfoMapper.xml

@@ -5,6 +5,7 @@
         id
         , no,
 financing_no,
+position_no,
 financing_no_two,
 financing_no_third,
 financing_no_four,
@@ -81,15 +82,13 @@ scrap_user_name
     </sql>
 
     <sql id="Left_Column">
-        sb
-        .
-        id
-        , sb.no,
+        sb.id, sb.no,
 sb.financing_no_two,
 sb.financing_no_third,
 sb.financing_no_four,
 sb.financing_no_five,
 sb.financing_no,
+sb.position_no,
 sb.name,  sb.initial_value,
         sb.current_value, sb.cut_value,
         sb.is_child, sb.is_measure, sb.measure_status,
@@ -218,6 +217,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="positionId != null and positionId!=''">
             and sb.position_id = #{positionId}
         </if>
+        <if test="positionNo != null and positionNo!=''">
+            and sb.position_no = #{positionNo}
+        </if>
         <if test="likeDeptCode != null and likeDeptCode!=''">
             and sdDept.dept_code like concat(#{likeDeptCode},'%')
         </if>
@@ -408,6 +410,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="isMeasure != null">
             and sb.is_measure = #{isMeasure}
         </if>
+        <if test="positionNo != null and positionNo!=''">
+            and sb.position_no = #{positionNo}
+        </if>
         <if test="measureStatus != null">
             and sb.measure_status = #{measureStatus}
         </if>
@@ -459,14 +464,8 @@ user.real_name as saveUserName,sb.repair_dept_id
 
     <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
             resultType="com.platform.dao.vo.sb.SbInfoVO">
-        select
-        <include refid="Left_Column"/>
+        select sb.*
         from t_sb_info sb
-        left join t_sb_type sbType on sb.type_id = sbType.id
-        left join t_firm_producer producer on sb.producer_id = producer.id
-        left join t_sb_position position on sb.position_id = position.id
-        left join t_sys_user user on sb.save_user = user.user_id
-        left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
         where
         TIMESTAMPDIFF( DAY, CURDATE( ), sb.next_check_date ) <![CDATA[ <= ]]> sb.seat_number
         <if test="keyword != null and keyword != ''">
@@ -476,9 +475,6 @@ user.real_name as saveUserName,sb.repair_dept_id
             sb.no like concat('%',#{keyword},'%')
             )
         </if>
-        <if test="likeDeptCode != null and likeDeptCode!=''">
-            and sdDept.dept_code like concat(#{likeDeptCode},'%')
-        </if>
         <if test="financingNo != null and financingNo!=''">
             and sb.financing_no like concat(#{financingNo},'%')
         </if>
@@ -494,6 +490,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="isMeasure != null">
             and sb.is_measure = #{isMeasure}
         </if>
+        <if test="positionNo != null and positionNo!=''">
+            and sb.position_no = #{positionNo}
+        </if>
         <if test="measureStatus != null">
             and sb.measure_status = #{measureStatus}
         </if>
@@ -624,9 +623,18 @@ user.real_name as saveUserName,sb.repair_dept_id
         <foreach collection="list" item="item" index="index" open="" close="" separator=";">
             update t_sb_info
             <set>
-                last_baoyang_time=#{item.lastBaoyangTimes},
-                last_baoyang_hours=#{item.lastBaoyangHours},
-                last_baoyang_miles=#{item.lastBaoyangMiles}
+                <if test="item.lastBaoyangTimes != null">
+                    last_baoyang_time=#{item.lastBaoyangTimes},
+                </if>
+                <if test="item.lastBaoyangHours != null">
+                    last_baoyang_hours=#{item.lastBaoyangHours},
+                </if>
+                <if test="item.lastBaoyangMiles != null">
+                    last_baoyang_miles=#{item.lastBaoyangMiles},
+                </if>
+                <if test="item.measureStatus != null">
+                    measure_status= #{item.measureStatus}
+                </if>
             </set>
             where id = #{item.id}
         </foreach>

+ 11 - 1
platform-rest/src/main/java/com/platform/rest/task/SbTask.java

@@ -1,12 +1,13 @@
 package com.platform.rest.task;
 
 import com.platform.service.monthly.MonthlySbThreeRateService;
+import com.platform.service.sb.SbInfoService;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
 /**
- * @Description 维修任务处理
+ * @Description 点检任务生成
  * @Author liuyu
  * @Date 2020-05-09 16:40:01
  * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
 public class SbTask {
     private final MonthlySbThreeRateService monthlySbThreeRateService;
 
+    private final SbInfoService sbInfoService;
     /**
      * 点检任务生成
      */
@@ -24,4 +26,12 @@ public class SbTask {
         monthlySbThreeRateService.getThreeRateNow();
     }
 
+
+    /**
+     * 待检定定时生成
+     */
+    public void generateSbMeasureLog() {
+        sbInfoService.generateSbMeasureLog();
+    }
+
 }

+ 3 - 1
platform-service/src/main/java/com/platform/service/sb/SbInfoService.java

@@ -284,7 +284,7 @@ public interface SbInfoService extends IBaseService<SbInfo, SbInfoDTO> {
      * @param pageSize
      * @return
      */
-    public MyVOPage<SbInfoVO> selectPageInfoForWarn(SbInfoDTO record, int pageNum, int pageSize);
+     MyVOPage<SbInfoVO> selectPageInfoForWarn(SbInfoDTO record, int pageNum, int pageSize);
 
     void updateBatchChild(List<SbInfoDTO> sbInfoDTOList);
 
@@ -318,4 +318,6 @@ public interface SbInfoService extends IBaseService<SbInfo, SbInfoDTO> {
      * @return
      */
     String updateImportUpdateForLongYan(MultipartFile file);
+
+    void generateSbMeasureLog();
 }

+ 29 - 1
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -757,6 +757,35 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         }
     }
 
+    /**
+     * 定时任务,对需要检定的进行检定状态设置,
+     * 1:根据设备的检定预警周期
+     * 2:筛选
+     *      a) 检定状态为正常的
+     *      b) 当前日期+预警天数>有效期的
+     *
+     */
+    @Override
+    public void generateSbMeasureLog() {
+        SbInfoDTO record = new SbInfoDTO();
+        record.setUseType(SbUseType.BGCL.getValue());
+        record.setMeasureStatus(YesNoEnum.NO.getValue());
+        record.setIsMeasure(YesNoEnum.YES.getValue());
+        List<SbInfoVO> list = mapper.selectPageInfoForWarn(record);
+        List<SbInfoVO> updateList = new ArrayList<>();
+        if(CollectionUtil.isNotEmpty(list)){
+            for(SbInfoVO vo:list){
+                SbInfoVO update = new SbInfoVO();
+                update.setId(vo.getId());
+                update.setMeasureStatus(YesNoEnum.YES.getValue());
+                updateList.add(update);
+            }
+        }
+        if(CollectionUtil.isNotEmpty(updateList)){
+            updateBatch(updateList);
+        }
+    }
+
     /**
      * 更新和记录修改
      * @param sbInfos
@@ -2227,7 +2256,6 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
     public MyVOPage<SbInfoVO> selectPageInfoForWarn(SbInfoDTO record, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
         record.setUseType(SbUseType.BGCL.getValue());
-        PageHelper.startPage(pageNum, pageSize);
         return new MyVOPage<>(mapper.selectPageInfoForWarn(record));
     }