Browse Source

仪表优化

3254194295 7 months ago
parent
commit
9d4c26e201

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/dto/sb/SbMeasureLogDTO.java

@@ -102,6 +102,8 @@ public class SbMeasureLogDTO extends BaseDTO implements Serializable {
      * 执行日期
      */
     private LocalDate lastDate;
+
+    private LocalDate youXiaoDate;//检定有效期
     /**
      * 上次生成时间
      */

+ 3 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbMeasureLogVO3.java

@@ -26,6 +26,9 @@ public class ExportSbMeasureLogVO3 implements Serializable {
      */
     @Excel(name = "检定时间")
     private LocalDate lastDate;
+
+    @Excel(name = "检定有效期")
+    private LocalDate youXiaoDate;
     /**
      * 编码
      */

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

@@ -228,6 +228,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         sbInfo.setParentId(sbInfo.getParentId());
         sbInfo.setPositionId(sbInfo.getPositionId());
         sbInfo.setCheckDate(model.getLastDate());
+        sbInfo.setNextCheckDate(model.getYouXiaoDate());
         //sbInfo.setPositionNo(model.getSbPositionNo());
 //        Integer checkPeriod = 12;// 默认12个月
 //        if (model.getCheckPeriod() != null) {
@@ -411,14 +412,14 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         model.setId(sbMeasureLog.getId());
         sbInfo.setParentId(sbInfo.getParentId());
         sbInfo.setPositionId(sbInfo.getPositionId());
-        sbInfo.setCheckDate(model.getLastDate());
+        sbInfo.setCheckDate(model.getLastDate()==null?LocalDate.now():model.getLastDate());
         //sbInfo.setPositionNo(model.getSbPositionNo());
         Integer checkPeriod = 12;// 默认12个月
-        if (model.getCheckPeriod() != null) {
-            checkPeriod = model.getCheckPeriod();
-        } else {
-            throw new BusinessException("检定设备的检定周期未设置,无法计算下次检定日期,请先设置");
-        }
+//        if (model.getCheckPeriod() != null) {
+//            checkPeriod = model.getCheckPeriod();
+//        } else {
+//            throw new BusinessException("检定设备的检定周期未设置,无法计算下次检定日期,请先设置");
+//        }
 
         // 判断位号是否已经存在,且是否是被设备,如果不是则弹出提示
         /*if(StringUtils.isNotBlank(model.getSbPositionNo())){
@@ -433,7 +434,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
             }
 
         }*/
-        sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod).minusDays(1));
+        sbInfo.setNextCheckDate(model.getYouXiaoDate());
         sbInfo.setZaiz(model.getName());// 检定单位
         sbInfo.setSbdh(model.getNo());// 检定编号
         sbInfo.setRemark(model.getRemark());// 备注