|
@@ -32,12 +32,12 @@ public class PmTaskServer {
|
|
|
/**
|
|
|
* 更新预警状态
|
|
|
*/
|
|
|
- public void updateDemandWarnStatus(){
|
|
|
+ public void updateDemandWarnStatus() {
|
|
|
log.info("******** 项目更新预警状态任务 开始");
|
|
|
LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<>();
|
|
|
lw.ne(PmDemand::getProjectStatus, PmProjectStatus.COMPLETION_CONSTRUCTION.getCode());
|
|
|
List<PmDemand> list = this.pmDemandService.list(lw);
|
|
|
- if(ObjectUtils.isEmpty(list)){
|
|
|
+ if (ObjectUtils.isEmpty(list)) {
|
|
|
return;
|
|
|
}
|
|
|
Date now = DateUtils.parseDate(DateUtils.getDate());
|
|
@@ -49,9 +49,13 @@ public class PmTaskServer {
|
|
|
log.info("******** setting2 == " + setting2);
|
|
|
int setting3 = Integer.parseInt(data.stream().filter(item -> item.getDictLabel().equals("计划交付(实施)时间")).collect(Collectors.toList()).get(0).getDictValue());
|
|
|
log.info("******** setting3 == " + setting3);
|
|
|
- list.forEach(item-> {
|
|
|
+ list.forEach(item -> {
|
|
|
//需求提报时间:根据数据阈值中设置的提报时间进行判断,进行预警
|
|
|
int diff1 = DateUtils.differentDaysByMillisecond(item.getPlanDemandSubTime(), now);
|
|
|
+ //采购完成时间:根据数据阈值中设置的采购完成时间进行判断,进行预警
|
|
|
+ int diff2 = DateUtils.differentDaysByMillisecond(item.getPlanPurchaseFinishTime(), now);
|
|
|
+ //计划交付时间:根据数据阈值中设置的交付时间进行判断,进行预警
|
|
|
+ int diff3 = DateUtils.differentDaysByMillisecond(item.getPlanDeliverTime(), now);
|
|
|
if (ObjectUtils.isEmpty(item.getRealDemandCommitTime()) && diff1 > 0 && diff1 <= setting1) {
|
|
|
log.info("******** 需求提报预警: " + item.getProjectName());
|
|
|
PmDemand pmDemand = new PmDemand();
|
|
@@ -65,49 +69,48 @@ public class PmTaskServer {
|
|
|
pmDemandUpdate.setDemandId(item.getDemandId());
|
|
|
pmDemandUpdate.setWarnStatus(WarnStatus.DEMAND_COMMT_EX.getCode());
|
|
|
updateList.add(pmDemandUpdate);
|
|
|
- }
|
|
|
- //采购完成时间:根据数据阈值中设置的采购完成时间进行判断,进行预警
|
|
|
- int diff2 = DateUtils.differentDaysByMillisecond(item.getPlanPurchaseFinishTime(), now);
|
|
|
- if (ObjectUtils.isEmpty(item.getRealPurchaseFinishTime()) && diff2 > 0 && diff2 <= setting2) {
|
|
|
- log.info("******** 采购完成预警: " + item.getProjectName());
|
|
|
- PmDemand pmDemand = new PmDemand();
|
|
|
- pmDemand.setDemandId(item.getDemandId());
|
|
|
- pmDemand.setWarnStatus(WarnStatus.PURCHASE_FINISH_WARNING.getCode());
|
|
|
- updateList.add(pmDemand);
|
|
|
} else {
|
|
|
- if (ObjectUtils.isEmpty(item.getRealPurchaseFinishTime()) && item.getPlanPurchaseFinishTime().getTime() < System.currentTimeMillis()) {
|
|
|
- log.info("******** 采购完成逾期: " + item.getProjectName());
|
|
|
- PmDemand pmDemandUpdate = new PmDemand();
|
|
|
- pmDemandUpdate.setDemandId(item.getDemandId());
|
|
|
- pmDemandUpdate.setWarnStatus(WarnStatus.PURCHASE_FINISH_EX.getCode());
|
|
|
- updateList.add(pmDemandUpdate);
|
|
|
- }
|
|
|
- //计划交付时间:根据数据阈值中设置的交付时间进行判断,进行预警
|
|
|
- int diff3 = DateUtils.differentDaysByMillisecond(item.getPlanDeliverTime(), now);
|
|
|
- if (ObjectUtils.isEmpty(item.getRealDeliverTime()) && diff3 > 0 && diff3 <= setting3) {
|
|
|
- log.info("******** 计划交付预警: " + item.getProjectName());
|
|
|
+ if (ObjectUtils.isEmpty(item.getRealPurchaseFinishTime()) && diff2 > 0 && diff2 <= setting2) {
|
|
|
+ log.info("******** 采购完成预警: " + item.getProjectName());
|
|
|
PmDemand pmDemand = new PmDemand();
|
|
|
pmDemand.setDemandId(item.getDemandId());
|
|
|
- pmDemand.setWarnStatus(WarnStatus.PLAN_DELIVER_WARNING.getCode());
|
|
|
+ pmDemand.setWarnStatus(WarnStatus.PURCHASE_FINISH_WARNING.getCode());
|
|
|
updateList.add(pmDemand);
|
|
|
} else {
|
|
|
- if (ObjectUtils.isEmpty(item.getRealDeliverTime()) && item.getPlanDeliverTime().getTime() < System.currentTimeMillis()) {
|
|
|
- log.info("******** 计划交付逾期: " + item.getProjectName());
|
|
|
+ if (ObjectUtils.isEmpty(item.getRealPurchaseFinishTime()) && item.getPlanPurchaseFinishTime().getTime() < System.currentTimeMillis()) {
|
|
|
+ log.info("******** 采购完成逾期: " + item.getProjectName());
|
|
|
PmDemand pmDemandUpdate = new PmDemand();
|
|
|
pmDemandUpdate.setDemandId(item.getDemandId());
|
|
|
- pmDemandUpdate.setWarnStatus(WarnStatus.PLAN_DELIVER_EX.getCode());
|
|
|
+ pmDemandUpdate.setWarnStatus(WarnStatus.PURCHASE_FINISH_EX.getCode());
|
|
|
updateList.add(pmDemandUpdate);
|
|
|
+ } else {
|
|
|
+ if (ObjectUtils.isEmpty(item.getRealDeliverTime()) && diff3 > 0 && diff3 <= setting3) {
|
|
|
+ log.info("******** 计划交付预警: " + item.getProjectName());
|
|
|
+ PmDemand pmDemand = new PmDemand();
|
|
|
+ pmDemand.setDemandId(item.getDemandId());
|
|
|
+ pmDemand.setWarnStatus(WarnStatus.PLAN_DELIVER_WARNING.getCode());
|
|
|
+ updateList.add(pmDemand);
|
|
|
+ } else {
|
|
|
+ if (ObjectUtils.isEmpty(item.getRealDeliverTime()) && item.getPlanDeliverTime().getTime() < System.currentTimeMillis()) {
|
|
|
+ log.info("******** 计划交付逾期: " + item.getProjectName());
|
|
|
+ PmDemand pmDemandUpdate = new PmDemand();
|
|
|
+ pmDemandUpdate.setDemandId(item.getDemandId());
|
|
|
+ pmDemandUpdate.setWarnStatus(WarnStatus.PLAN_DELIVER_EX.getCode());
|
|
|
+ updateList.add(pmDemandUpdate);
|
|
|
+ } else {
|
|
|
+ PmDemand pmDemand = new PmDemand();
|
|
|
+ pmDemand.setDemandId(item.getDemandId());
|
|
|
+ pmDemand.setWarnStatus(WarnStatus.NORMAL.getCode());
|
|
|
+ updateList.add(pmDemand);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- PmDemand pmDemand = new PmDemand();
|
|
|
- pmDemand.setDemandId(item.getDemandId());
|
|
|
- pmDemand.setWarnStatus(WarnStatus.NORMAL.getCode());
|
|
|
- updateList.add(pmDemand);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- if(!ObjectUtils.isEmpty(updateList)){
|
|
|
+ if (!ObjectUtils.isEmpty(updateList)) {
|
|
|
this.pmDemandService.updateBatchById(updateList);
|
|
|
}
|
|
|
log.info("******** 项目更新预警状态任务 结束");
|