suntianwu 2 anni fa
parent
commit
5987249f5f

+ 22 - 2
purchase-admin/src/main/java/com/ozs/web/controller/pm/PmPurchaseExecutionController.java

@@ -16,8 +16,10 @@ import com.ozs.common.annotation.Log;
 import com.ozs.common.constant.ModularConstans;
 import com.ozs.common.constant.ModularConstans;
 import com.ozs.common.core.controller.BaseController;
 import com.ozs.common.core.controller.BaseController;
 import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.core.domain.AjaxResult;
+import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.domain.entity.SysUser;
 import com.ozs.common.core.domain.entity.SysUser;
 import com.ozs.common.enums.*;
 import com.ozs.common.enums.*;
+import com.ozs.common.utils.DateUtils;
 import com.ozs.common.utils.RandomUtil;
 import com.ozs.common.utils.RandomUtil;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.pm.doman.*;
 import com.ozs.pm.doman.*;
@@ -25,9 +27,11 @@ import com.ozs.pm.doman.vo.requestVo.*;
 import com.ozs.pm.doman.vo.responseVo.PmDemandResVo;
 import com.ozs.pm.doman.vo.responseVo.PmDemandResVo;
 import com.ozs.pm.service.*;
 import com.ozs.pm.service.*;
 import com.ozs.system.domain.SysFileRef;
 import com.ozs.system.domain.SysFileRef;
+import com.ozs.system.service.ISysDictTypeService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 
 
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.ObjectUtils;
@@ -36,6 +40,7 @@ import org.springframework.web.bind.annotation.*;
 
 
 import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotEmpty;
 import java.util.*;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * 采购执行Controller
  * 采购执行Controller
@@ -43,6 +48,7 @@ import java.util.*;
  * @author ruoyi
  * @author ruoyi
  * @date 2023-01-16
  * @date 2023-01-16
  */
  */
+@Slf4j
 @Api(tags = "采购执行")
 @Api(tags = "采购执行")
 @RestController
 @RestController
 @RequestMapping("/pm/purchaseExecution")
 @RequestMapping("/pm/purchaseExecution")
@@ -55,7 +61,8 @@ public class PmPurchaseExecutionController extends BaseController {
     private BaseAgencyService baseAgencyService;
     private BaseAgencyService baseAgencyService;
     @Autowired
     @Autowired
     private BaseExpertService baseExpertService;
     private BaseExpertService baseExpertService;
-
+    @Autowired
+    private ISysDictTypeService iSysDictTypeService;
     @Autowired
     @Autowired
     private PmDemandExpertRefService pmDemandExpertRefService;
     private PmDemandExpertRefService pmDemandExpertRefService;
     @Autowired
     @Autowired
@@ -661,9 +668,22 @@ public class PmPurchaseExecutionController extends BaseController {
             pmDemandUpdate.setDemandId(demandId);
             pmDemandUpdate.setDemandId(demandId);
             pmDemandUpdate.setProjectStatus(PmProjectStatus.CONTRACT_WAIT_FILL.getCode());
             pmDemandUpdate.setProjectStatus(PmProjectStatus.CONTRACT_WAIT_FILL.getCode());
             pmDemandUpdate.setRealPurchaseFinishTime(new Date());
             pmDemandUpdate.setRealPurchaseFinishTime(new Date());
-            pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
+
             pmDemandUpdate.setUpdateTime(new Date());
             pmDemandUpdate.setUpdateTime(new Date());
             pmDemandUpdate.setUpdateBy(getUserId().toString());
             pmDemandUpdate.setUpdateBy(getUserId().toString());
+
+            List<SysDictData> data = iSysDictTypeService.selectDictDataByType("alert_time_setting");
+            int setting3 = Integer.parseInt(data.stream().filter(item -> item.getDictLabel().equals("计划交付(实施)时间")).collect(Collectors.toList()).get(0).getDictValue());
+            log.info("******** setting3 == " + setting3);
+            //计划交付时间:根据数据阈值中设置的交付时间进行判断,进行预警
+            int diff3 = DateUtils.differentDaysByMillisecond(pmDemand.getPlanDeliverTime(), DateUtils.parseDate(DateUtils.getDate()));
+            if (ObjectUtils.isEmpty(pmDemand.getRealDeliverTime()) && diff3 >= setting3) {
+                log.info("******** 计划交付预警: " + pmDemand.getProjectName());
+                pmDemandUpdate.setWarnStatus(WarnStatus.PLAN_DELIVER_WARNING.getCode());
+            } else{
+                pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
+            }
+
             return success(pmDemandService.updateById(pmDemandUpdate));
             return success(pmDemandService.updateById(pmDemandUpdate));
         } else {
         } else {
             return error("保存上传附件失败");
             return error("保存上传附件失败");

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

@@ -22,7 +22,6 @@ import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.domain.entity.SysUser;
 import com.ozs.common.core.domain.entity.SysUser;
-import com.ozs.common.core.domain.model.LoginUser;
 import com.ozs.common.enums.BidWinningStatus;
 import com.ozs.common.enums.BidWinningStatus;
 import com.ozs.common.enums.ExpertType;
 import com.ozs.common.enums.ExpertType;
 import com.ozs.common.enums.IsExcess;
 import com.ozs.common.enums.IsExcess;
@@ -803,7 +802,6 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
 
 
         SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
         SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
         Long deptId = sysUser.getDeptId();
         Long deptId = sysUser.getDeptId();
-        SysDept sysDept = deptMapper.selectDeptById(deptId);
         pmAuditDeptRefService.insertPmAuditDeptRefs(pmDemandReqVo.getDemandId()
         pmAuditDeptRefService.insertPmAuditDeptRefs(pmDemandReqVo.getDemandId()
                 , "2"
                 , "2"
                 , deptId
                 , deptId
@@ -814,10 +812,24 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         PmDemand pmDemandUpdate = new PmDemand();
         PmDemand pmDemandUpdate = new PmDemand();
         pmDemandUpdate.setDemandId(pmDemand.getDemandId());
         pmDemandUpdate.setDemandId(pmDemand.getDemandId());
         pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
         pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
-        pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
         pmDemandUpdate.setRealDemandCommitTime(DateUtils.getNowDate());
         pmDemandUpdate.setRealDemandCommitTime(DateUtils.getNowDate());
         pmDemandUpdate.setUpdateBy(pmDemandReqVo.getUpdateBy());
         pmDemandUpdate.setUpdateBy(pmDemandReqVo.getUpdateBy());
         pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
         pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
+
+
+        List<SysDictData> data = iSysDictTypeService.selectDictDataByType("alert_time_setting");
+        int setting2 = Integer.parseInt(data.stream().filter(item -> item.getDictLabel().equals("计划完成时间")).collect(Collectors.toList()).get(0).getDictValue());
+        log.info("******** setting2 == " + setting2);
+
+        //采购完成时间:根据数据阈值中设置的采购完成时间进行判断,进行预警
+        int diff2 = DateUtils.differentDaysByMillisecond(pmDemand.getPlanPurchaseFinishTime(), DateUtils.parseDate(DateUtils.getDate()));
+        if (ObjectUtils.isEmpty(pmDemand.getRealPurchaseFinishTime()) && diff2 >= setting2) {
+            log.info("******** 采购完成预警: " + pmDemand.getProjectName());
+            pmDemandUpdate.setWarnStatus(WarnStatus.PURCHASE_FINISH_WARNING.getCode());
+        } else{
+            pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
+        }
+
         return this.updateById(pmDemandUpdate);
         return this.updateById(pmDemandUpdate);
     }
     }
 
 
@@ -1753,6 +1765,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
             pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
             pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
             pmDemandUpdate.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
             pmDemandUpdate.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
             pmDemandUpdate.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
             pmDemandUpdate.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
+
             return this.updateById(pmDemandUpdate);
             return this.updateById(pmDemandUpdate);
 
 
         } else {
         } else {