hfxc226 3 éve
szülő
commit
bed9d28a1f

+ 8 - 0
platform-dao/src/main/java/com/platform/dao/dto/sb/SbInfoMeasureDTO.java

@@ -471,7 +471,15 @@ public class SbInfoMeasureDTO extends BaseDTO implements Serializable {
      * 是否过滤数据,查询主子数据
      */
     private Boolean parentSearch;
+    /**
+     * 检定日期搜索开始时间
+     */
+    private LocalDate checkDateStart;
 
+    /**
+     * 检定日期搜索结束时间
+     */
+    private LocalDate checkDateEnd;
     /**
      * 有效期搜索开始时间
      */

+ 7 - 7
platform-dao/src/main/resources/mapper/sb/SbInfoMeasureMapper.xml

@@ -207,6 +207,12 @@ sb.scrap_user_name
         <if test="useDept != null">
             and sb.use_dept like concat('%',#{useDept},'%')
         </if>
+        <if test="checkDateStart != null">
+            and sb.check_date <![CDATA[ >= ]]> #{checkDateStart}
+        </if>
+        <if test="checkDateEnd != null">
+            and sb.check_date <![CDATA[ <= ]]> #{checkDateEnd}
+        </if>
         <if test="nextCheckDateStart != null">
             and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
         </if>
@@ -250,13 +256,7 @@ sb.scrap_user_name
         where
         TIMESTAMPDIFF( DAY, CURDATE( ), sb.next_check_date ) <![CDATA[ <= ]]> sb.seat_number
         <if test="keyword != null and keyword != ''">
-            and (
-            sb.name like concat('%',#{keyword},'%')
-            or
-            sb.no like concat('%',#{keyword},'%')
-            or
-            sb.card_no like concat('%',#{keyword},'%')
-            )
+            and sb.name like concat('%',#{keyword},'%')
         </if>
         <if test="zzh != null">
             and sb.zzh = #{zzh}

+ 22 - 0
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoMeasureServiceImpl.java

@@ -115,6 +115,13 @@ public class SbInfoMeasureServiceImpl extends BaseServiceImpl<SbInfoMeasureMappe
         if (model.getIsShow() == null) {
             model.setIsChild(SbInfoShowEnum.NOT_SHOW.getValue());
         }
+        Integer checkPeriod = 12;// 默认12个月
+        if(model.getCheckPeriod() != null){
+            checkPeriod = model.getCheckPeriod();
+        }else{
+            throw new BusinessException("检定设备的检定周期未设置,无法计算下次检定日期,请先设置");
+        }
+        model.setNextCheckDate(model.getCheckDate().minusMonths(-checkPeriod).minusDays(1));
         return super.saveModelHaveCreateInfo(model);
     }
 
@@ -146,11 +153,26 @@ public class SbInfoMeasureServiceImpl extends BaseServiceImpl<SbInfoMeasureMappe
         if (model.getIsFinancing() == null) {
             model.setIsFinancing(SbInfoFinancingEnum.NOT.getValue());
         }
+        Integer checkPeriod = 12;// 默认12个月
+        if(model.getCheckPeriod() != null){
+            checkPeriod = model.getCheckPeriod();
+        }else{
+            throw new BusinessException("检定设备的检定周期未设置,无法计算下次检定日期,请先设置");
+        }
+        model.setNextCheckDate(model.getCheckDate().minusMonths(-checkPeriod).minusDays(1));
         return super.saveModelHaveCreateInfo(model);
     }
 
     @Override
     public void modModelByDTO(SbInfoMeasureDTO model) {
+
+        Integer checkPeriod = 12;// 默认12个月
+        if(model.getCheckPeriod() != null){
+            checkPeriod = model.getCheckPeriod();
+        }else{
+            throw new BusinessException("检定设备的检定周期未设置,无法计算下次检定日期,请先设置");
+        }
+        model.setNextCheckDate(model.getCheckDate().minusMonths(-checkPeriod).minusDays(1));
         super.modModelByDTO(model);
     }
 

+ 2 - 2
platform-service/src/main/java/com/platform/service/sb/impl/SbMeasureLogServiceImpl.java

@@ -102,7 +102,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         if(sbInfo.getCheckPeriod() != null){
             checkPeriod = sbInfo.getCheckPeriod();
         }else{
-            throw new BusinessException("检定设备的检定周期设置,无法计算下次检定日期,请先设置");
+            throw new BusinessException("检定设备的检定周期设置,无法计算下次检定日期,请先设置");
         }
         sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod).minusDays(1));
         sbInfo.setZaiz(model.getName());// 检定单位
@@ -134,7 +134,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         if(sbInfo.getCheckPeriod() != null){
             checkPeriod = sbInfo.getCheckPeriod();
         }else{
-            throw new BusinessException("检定设备的检定周期设置,无法计算下次检定日期,请先设置");
+            throw new BusinessException("检定设备的检定周期设置,无法计算下次检定日期,请先设置");
         }
         sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod).minusDays(1));
         sbInfo.setZaiz(model.getName());// 检定单位