Browse Source

BUG--季度计划提报时间不在阈值范围内

buzhanyi 2 years ago
parent
commit
2052a9fb39

+ 4 - 3
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanQuarterServiceImpl.java

@@ -972,10 +972,11 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         Date thresholdTimeStart = null;
         Date thresholdTimeEnd = null;
-        Date subTime = planQuarter.getPlanDemandSubTime();
+        Calendar instance = Calendar.getInstance();
+        instance.setTime(planQuarter.getPlanDemandSubTime());
         try {
             for (QuarterEnum val : QuarterEnum.values()) {
-                if (val.getInfo().contains(subTime.getMonth() + "")) {
+                if (val.getInfo().contains(instance.get(Calendar.MONTH) + "")) {
                     switch (val.getCode()) {
                         case "1":
                             thresholdTimeStart = dateFormat.parse(thresholdMap.get("第一季度开始时间"));
@@ -997,7 +998,7 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
                 }
             }
             if (!ObjectUtils.isEmpty(thresholdTimeStart) && !ObjectUtils.isEmpty(thresholdTimeEnd)) {
-                if (subTime.before(thresholdTimeStart) || subTime.after(thresholdTimeEnd)) {
+                if (instance.before(thresholdTimeStart) || instance.after(thresholdTimeEnd)) {
                     return false;
                 }
             }