From 7ea82c44c119e30f13451e86911b32ad40ff86d8 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 16 八月 2023 09:15:41 +0800
Subject: [PATCH] 修復bug

---
 server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java b/server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java
index b955f0b..e0e1c37 100644
--- a/server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java
@@ -97,7 +97,9 @@
                 || Objects.isNull(workPlansSaveDTO.getNum())
                 || Objects.isNull(workPlansSaveDTO.getFactoryId())
                 || Objects.isNull(workPlansSaveDTO.getUnitId())
-                || Objects.isNull(workPlansSaveDTO.getMaterialId())){
+                || Objects.isNull(workPlansSaveDTO.getMaterialId())
+                || Objects.isNull(workPlansSaveDTO.getStartDate())
+                || workPlansSaveDTO.getStartDate().getTime() > workPlansSaveDTO.getPlanDate().getTime()){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         WorkPlans workPlans = new WorkPlans();
@@ -173,11 +175,16 @@
                     i.setFinishUnQualifiedNum(Objects.isNull(plansExtListVO.getUnqulifiedNum())?Constants.ZERO:plansExtListVO.getUnqulifiedNum());
                     i.setFinishNum(Objects.isNull(plansExtListVO.getDoneNum())?Constants.ZERO:plansExtListVO.getDoneNum());
                 }
-                if (Objects.nonNull(i.getPlanDate())){
-                    i.setHasExpire(DateUtil.toDateLocalDateTime(i.getPlanDate()).toLocalDate().isBefore(LocalDate.now()));
-                }else {
-                    i.setHasExpire(false);
+
+                if ( !i.getStatus().equals(Constants.WORKPLANHISTORY_TYPE.done) &&
+                        !i.getStatus().equals(Constants.WORKPLANHISTORY_TYPE.close)){
+                    if (Objects.nonNull(i.getPlanDate())){
+                        i.setHasExpire(DateUtil.toDateLocalDateTime(i.getPlanDate()).toLocalDate().isBefore(LocalDate.now()));
+                    }else {
+                        i.setHasExpire(false);
+                    }
                 }
+
 
             });
         }
@@ -372,8 +379,14 @@
         if(Constants.formatIntegerNum(p.getNum())<=0){
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗��"+(index+2)+"銆戣銆愯鍒掔敓浜ф暟閲忋�戞暟鎹敊璇紒");
         }
+        if(p.getStartDate() == null){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗��"+(index+2)+"銆戣銆愯鍒掑紑濮嬫棩鏈熴�戞暟鎹敊璇紝姝g‘鏍煎紡涓猴細yyyy-MM-dd锛堝2022-06-07锛夛紒");
+        }
         if(p.getPlanDate() == null){
-            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗��"+(index+2)+"銆戣銆愯鍒掓棩鏈熴�戞暟鎹敊璇紝姝g‘鏍煎紡涓猴細yyyy-MM-dd锛堝2022-06-07锛夛紒");
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗��"+(index+2)+"銆戣銆愯鍒掔粨鏉熸棩鏈熴�戞暟鎹敊璇紝姝g‘鏍煎紡涓猴細yyyy-MM-dd锛堝2022-06-07锛夛紒");
+        }
+        if(p.getPlanDate().getTime() <= p.getStartDate().getTime()){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗��"+(index+2)+"銆戣銆愯鍒掑紑濮嬫棩鏈熴�戣鏃╀簬銆愯鍒掔粨鏉熸棩鏈熴�戯紒");
         }
         if(StringUtils.isBlank(p.getMaterialCode())){
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗��"+(index+2)+"銆戣銆愪骇鍝佺紪鐮併�戞暟鎹敊璇紒");

--
Gitblit v1.9.3