From 2b0e875855e781c16e32187aa5552ee12ddcefa0 Mon Sep 17 00:00:00 2001
From: jiaosong <jiaosong6760@dingtalk.com>
Date: 星期五, 18 八月 2023 12:11:55 +0800
Subject: [PATCH] #产出计算

---
 server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 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 b25630b..a5f024f 100644
--- a/server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java
@@ -32,6 +32,7 @@
 import org.springframework.web.multipart.MultipartFile;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -96,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();
@@ -172,6 +175,16 @@
                     i.setFinishUnQualifiedNum(Objects.isNull(plansExtListVO.getUnqulifiedNum())?Constants.ZERO:plansExtListVO.getUnqulifiedNum());
                     i.setFinishNum(Objects.isNull(plansExtListVO.getDoneNum())?Constants.ZERO:plansExtListVO.getDoneNum());
                 }
+                i.setHasExpire(false);
+                i.setStatus(Constants.formatIntegerNum(i.getStatus()));
+                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()));
+                    }
+                }
+
+
             });
         }
         return PageData.from(new PageInfo<>(result));
@@ -385,7 +398,7 @@
         }
 
         Date pDate = DateUtil.getDateFromString(DateUtil.getShortTime(p.getPlanDate()) +" 00:00:00");
-        Date nDate =  DateUtil.getDateFromString(DateUtil.getShortTime(DateUtil.getCurrentDate()) +" 00:00:00");
+        Date nDate =  DateUtil.getDateFromString(DateUtil.getShortTime(DateUtil.getCurrentDate()) +" 23:59:59");
         if( nDate.getTime() > pDate.getTime()){
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝璁″垝鐢熶骇鏃ユ湡蹇呴』涓轰粖澶╀互鍚庣殑鏃ユ湡锛�");
         }

--
Gitblit v1.9.3