Explorar el Código

待办事项--计划完成时间提醒

buzhanyi hace 2 años
padre
commit
89d269b239

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

@@ -949,7 +949,7 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
         //少于设定时间便提醒
         if (surplus < remindTine && surplus > 0) {
             //剩余天数(向上取整)
-            int i = new Double(Math.ceil(surplus / 1000 / 60 / 60 / 24)).intValue();
+            int i = (int) Math.ceil(surplus / 1000 / 60 / 60 / 24);
             if (i > 0) {
                 subTips = "距离计划提报时间不足" + i + "天";
             }

+ 57 - 53
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanYearsServiceImpl.java

@@ -198,36 +198,9 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
         return planYearsList;
     }
 
-    @Transactional
-    @Override
-    public AjaxResult insertPlanYears(PlanYearsStandardVo yearsStandardVo) {
-        if (planYearsMapper.countProjectName(yearsStandardVo.getProjectName()) > 0) {
-            return AjaxResult.error("该项目名称已经存在");
-        }
-        PlanYears ofYears = new PlanYears();
-        try {
-            BeanUtils.copyProperties(yearsStandardVo, ofYears);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        //判断是否为超额计划
-        ofYears.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
-        ofYears.setCreateTime(new Date());
-        planYearsMapper.insertPlanYears(ofYears);
-        log.info("id:{}" , ofYears.getPlanYearId());
-        List<SysFileRef> sysFileRefs = yearsStandardVo.getSysFileRefs();
-        if (!ObjectUtils.isEmpty(sysFileRefs)) {
-            for (SysFileRef ref : sysFileRefs) {
-                ref.setRedId(ofYears.getPlanYearId());
-                ref.setType(SysFileRefEnum.PLAN_YEAR.getType());
-                ref.setCreated(ofYears.getCreated());
-                ref.setCreateTime(new Date());
-                ref.setUpdated(ofYears.getCreated());
-                ref.setUpdateTime(new Date());
-                sysFileRefMapper.insert(ref);
-            }
-        }
-        return AjaxResult.success();
+    public static void main(String[] args) {
+        int i = (int) Math.ceil(6.66);
+        System.err.println(i);
     }
 
     @Override
@@ -1073,18 +1046,50 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
         return AjaxResult.error("没有查到相关数据!");
     }
 
+    @Transactional
+    @Override
+    public AjaxResult insertPlanYears(PlanYearsStandardVo yearsStandardVo) {
+        if (planYearsMapper.countProjectName(yearsStandardVo.getProjectName()) > 0) {
+            return AjaxResult.error("该项目名称已经存在");
+        }
+        PlanYears ofYears = new PlanYears();
+        try {
+            BeanUtils.copyProperties(yearsStandardVo, ofYears);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        //判断是否为超额计划
+        ofYears.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
+        ofYears.setCreateTime(new Date());
+        planYearsMapper.insertPlanYears(ofYears);
+        log.info("id:{}", ofYears.getPlanYearId());
+        List<SysFileRef> sysFileRefs = yearsStandardVo.getSysFileRefs();
+        if (!ObjectUtils.isEmpty(sysFileRefs)) {
+            for (SysFileRef ref : sysFileRefs) {
+                ref.setRedId(ofYears.getPlanYearId());
+                ref.setType(SysFileRefEnum.PLAN_YEAR.getType());
+                ref.setCreated(ofYears.getCreated());
+                ref.setCreateTime(new Date());
+                ref.setUpdated(ofYears.getCreated());
+                ref.setUpdateTime(new Date());
+                sysFileRefMapper.insert(ref);
+            }
+        }
+        return AjaxResult.success();
+    }
+
     @Override
     public List<PlanYears> queryPage(PlanYearsStandardVo vo) throws ParseException {
         Map<String, Object> params = vo.getParams();
         if (!ObjectUtils.isEmpty(vo.getParams())) {
             if (!ObjectUtils.isEmpty(vo.getParams().get("beginTime"))) {
-                params.put("beginTime" , vo.getParams().get("beginTime").toString() + "-01");
+                params.put("beginTime", vo.getParams().get("beginTime").toString() + "-01");
             }
             if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
                 SimpleDateFormat dateFormaH = new SimpleDateFormat("yyyy-MM");
                 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                 Date ofMonth = DateUtils.getLastDayOfMonth(dateFormaH.parse(vo.getParams().get("endTime").toString()));
-                params.put("endTime" , dateFormat.format(ofMonth) + " 23:59:59:999");
+                params.put("endTime", dateFormat.format(ofMonth) + " 23:59:59:999");
             }
         }
         vo.setParams(params);
@@ -1140,24 +1145,6 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
         return planYears;
     }
 
-    private List<SysFileInfo> getSysFileInfoList(Long redId, Integer type) {
-        HashMap<String, Object> map = new HashMap<>();
-        map.put("red_id" , redId);
-        map.put("type" , type);
-        List<SysFileRef> fileRefs = sysFileRefService.listByMap(map);
-        if (!ObjectUtils.isEmpty(fileRefs)) {
-            List<SysFileInfo> fileInfos = new ArrayList<>();
-            for (SysFileRef ref : fileRefs) {
-                SysFileInfo fileInfo = fileService.getById(ref.getFileId());
-                fileInfos.add(fileInfo);
-            }
-            return fileInfos;
-        } else {
-            return null;
-        }
-
-    }
-
     /**
      * 查询已被催告发函的计划
      *
@@ -1527,6 +1514,24 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
         return planYearsMapper.idNotInQuarter();
     }
 
+    private List<SysFileInfo> getSysFileInfoList(Long redId, Integer type) {
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("red_id", redId);
+        map.put("type", type);
+        List<SysFileRef> fileRefs = sysFileRefService.listByMap(map);
+        if (!ObjectUtils.isEmpty(fileRefs)) {
+            List<SysFileInfo> fileInfos = new ArrayList<>();
+            for (SysFileRef ref : fileRefs) {
+                SysFileInfo fileInfo = fileService.getById(ref.getFileId());
+                fileInfos.add(fileInfo);
+            }
+            return fileInfos;
+        } else {
+            return null;
+        }
+
+    }
+
     /**
      * 根据年度计划提报时间的阈值进行提示
      *
@@ -1545,7 +1550,7 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
         //少于设定天数便提醒
         if (surplus < remindTime && surplus > 0) {
             //剩余天数(向上取整)
-            int i = new Double(Math.ceil(surplus / 1000 / 60 / 60 / 24)).intValue();
+            int i = (int) Math.ceil(surplus / 1000 / 60 / 60 / 24);
             if (i > 0) {
                 return "距离计划提报时间不足" + i + "天";
             }
@@ -1557,7 +1562,7 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
         //少于设定阈值便提醒
         if (surplusTwo < alertTime && surplusTwo > 0) {
             //剩余天数(向上取整)
-            int i = new Double(Math.ceil(surplusTwo / 1000 / 60 / 60 / 24)).intValue();
+            int i = (int) Math.ceil(surplusTwo / 1000 / 60 / 60 / 24);
             if (i > 0) {
                 return "距离计划完成采购时间不足" + i + "天";
             }
@@ -1565,5 +1570,4 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
 
         return "";
     }
-
 }

+ 1 - 1
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -4136,8 +4136,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
             //少于一周便提醒
             double surplus = planDeliverTime.getTime() - System.currentTimeMillis();
             if (surplus < remindTine) {
-                int i = new Double(Math.ceil(surplus / 1000 / 60 / 60 / 24)).intValue();
                 //剩余天数(向上取整)
+                int i = (int) Math.ceil(surplus / 1000 / 60 / 60 / 24);
                 if (i > 0) {
                     return "距离计划交付时间不足" + i + "天";
                 } else {