@@ -379,15 +379,14 @@ public class DashboardProjectManage { | |||||
//2.转换项目信息 | //2.转换项目信息 | ||||
if(Objects.nonNull(project)){ | if(Objects.nonNull(project)){ | ||||
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); | ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); | ||||
//todo: 超期逻辑 | |||||
projectInfo.setOverdueSituation("即将超期"); | projectInfo.setOverdueSituation("即将超期"); | ||||
projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); | projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); | ||||
projectInfo.setStatus(Objects.nonNull(project.getStatus()) ? project.getStatus().toString() : null); | |||||
//3.项目状态情况 | //3.项目状态情况 | ||||
projectInfo.setStatusSituation(generateProjectStatus(project)); | projectInfo.setStatusSituation(generateProjectStatus(project)); | ||||
res.setProjectInfo(projectInfo); | res.setProjectInfo(projectInfo); | ||||
}else if(Objects.nonNull(baseInfo)){ | }else if(Objects.nonNull(baseInfo)){ | ||||
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo,ProtraitProjectInfoVO.class); | ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo,ProtraitProjectInfoVO.class); | ||||
//todo: 超期逻辑 | |||||
projectInfo.setOverdueSituation("即将超期"); | projectInfo.setOverdueSituation("即将超期"); | ||||
projectInfo.setSafetyInputRate("0"); | projectInfo.setSafetyInputRate("0"); | ||||
if(Objects.nonNull(apply)){ | if(Objects.nonNull(apply)){ | ||||
@@ -404,10 +403,10 @@ public class DashboardProjectManage { | |||||
projectInfo.setBuildOrgCode(baseInfo.getBaseBuildDeprtDing()); | projectInfo.setBuildOrgCode(baseInfo.getBaseBuildDeprtDing()); | ||||
//3.项目状态情况 | //3.项目状态情况 | ||||
projectInfo.setStatusSituation(generateProjectStatus(baseInfo)); | projectInfo.setStatusSituation(generateProjectStatus(baseInfo)); | ||||
projectInfo.setStatus(baseInfo.getBaseProjSetProg()); | |||||
res.setProjectInfo(projectInfo); | res.setProjectInfo(projectInfo); | ||||
}else if(Objects.nonNull(operationBase)){ | }else if(Objects.nonNull(operationBase)){ | ||||
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(operationBase,ProtraitProjectInfoVO.class); | ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(operationBase,ProtraitProjectInfoVO.class); | ||||
//todo: 超期逻辑 | |||||
projectInfo.setOverdueSituation("即将超期"); | projectInfo.setOverdueSituation("即将超期"); | ||||
projectInfo.setSafetyInputRate("0"); | projectInfo.setSafetyInputRate("0"); | ||||
if(Objects.nonNull(apply)){ | if(Objects.nonNull(apply)){ | ||||
@@ -424,6 +423,7 @@ public class DashboardProjectManage { | |||||
projectInfo.setBuildOrgCode(operationBase.getBaseBuildDeprtDing()); | projectInfo.setBuildOrgCode(operationBase.getBaseBuildDeprtDing()); | ||||
//3.项目状态情况 | //3.项目状态情况 | ||||
projectInfo.setStatusSituation(generateProjectStatus(operationBase)); | projectInfo.setStatusSituation(generateProjectStatus(operationBase)); | ||||
projectInfo.setStatus(operationBase.getBaseProjSetProg()); | |||||
res.setProjectInfo(projectInfo); | res.setProjectInfo(projectInfo); | ||||
} | } | ||||
@@ -49,6 +49,9 @@ public class ProtraitProjectInfoVO { | |||||
@ApiModelProperty("超期情况") | @ApiModelProperty("超期情况") | ||||
private String overdueSituation; | private String overdueSituation; | ||||
@ApiModelProperty("状态") | |||||
private String status; | |||||
@ApiModelProperty("项目状态情况") | @ApiModelProperty("项目状态情况") | ||||
private List<ProtraitProjectStatusSituationVO> statusSituation; | private List<ProtraitProjectStatusSituationVO> statusSituation; | ||||
} | } | ||||
@@ -45,4 +45,15 @@ public enum ProjectRenewalApprovalStatusEnum { | |||||
return StringUtils.EMPTY; | return StringUtils.EMPTY; | ||||
} | } | ||||
public static ProjectRenewalApprovalStatusEnum match(String name) { | |||||
if (StringUtils.isBlank(name)) { | |||||
return null; | |||||
} | |||||
for (ProjectRenewalApprovalStatusEnum t : ProjectRenewalApprovalStatusEnum.values()) { | |||||
if (name.equals(t.name())) { | |||||
return t; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
} | } |
@@ -121,10 +121,11 @@ public class EarlyWarningListener { | |||||
String employeeCode = hai.getAssignee(); | String employeeCode = hai.getAssignee(); | ||||
String taskId = hai.getTaskId(); | String taskId = hai.getTaskId(); | ||||
String path = "toDoCenter/handleDuringExamine?instanceId=" + | String path = "toDoCenter/handleDuringExamine?instanceId=" + | ||||
instanceId + "&projectId=1610&nodeId=" + nodeId + "&taskId=" + taskId; | |||||
instanceId + "&projectId=" + projectId + "&nodeId=" + nodeId + "&taskId=" + taskId; | |||||
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,pi.getInstType(), | earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,pi.getInstType(), | ||||
hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() | hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() | ||||
,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType,path,batchEmployees); | |||||
,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType, | |||||
path,batchEmployees,nodeId); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -233,7 +233,7 @@ public class EarlyWarningInstanceNotStartTask { | |||||
for (String employeeCode : batchEmployees) { | for (String employeeCode : batchEmployees) { | ||||
earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, time, biz, | earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, time, biz, | ||||
needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject, | needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject, | ||||
WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr); | |||||
WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr,null); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -385,7 +385,7 @@ public class EarlyWarningInstanceNotStartTask { | |||||
for(Integer noticeType : noticeTypes){ | for(Integer noticeType : noticeTypes){ | ||||
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent,time,biz, | earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent,time,biz, | ||||
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, | needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, | ||||
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path,employeeCode); | |||||
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path,employeeCode,null); | |||||
} | } | ||||
} | } | ||||
@@ -500,7 +500,7 @@ public class EarlyWarningInstanceNotStartTask { | |||||
for(Integer noticeType : noticeTypes){ | for(Integer noticeType : noticeTypes){ | ||||
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent,time,null, | earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent,time,null, | ||||
needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, | needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, | ||||
WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr); | |||||
WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr,needToWaringProject.getId().toString()); | |||||
} | } | ||||
} | } | ||||
@@ -3,13 +3,25 @@ package com.ningdatech.pmapi.scheduler.task; | |||||
import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||
import cn.hutool.core.date.StopWatch; | import cn.hutool.core.date.StopWatch; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.WarningOperationTypeEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import com.ningdatech.pmapi.sys.enumeration.ProjectEarlyWarningStatusEnum; | import com.ningdatech.pmapi.sys.enumeration.ProjectEarlyWarningStatusEnum; | ||||
import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; | import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; | ||||
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; | |||||
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; | |||||
import com.ningdatech.pmapi.sys.service.IProjectEarlyWarningService; | import com.ningdatech.pmapi.sys.service.IProjectEarlyWarningService; | ||||
import com.wflow.enums.WarningRuleTypeEnum; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.flowable.engine.TaskService; | |||||
import org.flowable.task.api.Task; | |||||
import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
import org.springframework.scheduling.annotation.Scheduled; | import org.springframework.scheduling.annotation.Scheduled; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
@@ -34,6 +46,12 @@ public class EarlyWarningProjectTask { | |||||
private final IProjectEarlyWarningService projectEarlyWarningService; | private final IProjectEarlyWarningService projectEarlyWarningService; | ||||
private final IEarlyWarningRecordsService earlyWarningRecordsService; | |||||
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | |||||
private final TaskService taskService; | |||||
@Value("${hostname}") | @Value("${hostname}") | ||||
private String HOST_NAME; | private String HOST_NAME; | ||||
@@ -127,19 +145,168 @@ public class EarlyWarningProjectTask { | |||||
log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); | log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); | ||||
} | } | ||||
private void checkRenewalFundWarning(List<ProjectEarlyWarning> renewalFundWarning) { | |||||
private void checkRenewalFundWarning(List<ProjectEarlyWarning> renewalFundWarnings) { | |||||
if(CollUtil.isEmpty(renewalFundWarnings)){ | |||||
return; | |||||
} | |||||
for(ProjectEarlyWarning renewalFundWarning : renewalFundWarnings){ | |||||
String projectCode = renewalFundWarning.getProjectCode(); | |||||
Project project = projectService.getProjectByCode(projectCode); | |||||
if(Objects.isNull(project)){ | |||||
continue; | |||||
} | |||||
WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | |||||
.eq(WflowEarlyWarningRecords::getProjectCode, projectCode) | |||||
.eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode()) | |||||
.orderByDesc(WflowEarlyWarningRecords::getWarningTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.isNull(record)){ | |||||
continue; | |||||
} | |||||
//借用了NODEID 其实 是续建id | |||||
String nodeId = record.getNodeId(); | |||||
ProjectRenewalFundDeclaration renewalFund = renewalFundDeclarationService.getById(nodeId); | |||||
if(Objects.isNull(renewalFund)){ | |||||
continue; | |||||
} | |||||
String approvalStatus = renewalFund.getApprovalStatus(); | |||||
ProjectRenewalApprovalStatusEnum match = ProjectRenewalApprovalStatusEnum | |||||
.match(approvalStatus); | |||||
if(Objects.nonNull(match)){ | |||||
//如果是已经审批 | |||||
if(match.name().equals(ProjectRenewalApprovalStatusEnum.PASS.name())){ | |||||
renewalFundWarning.setRenewalFundWarning(Boolean.FALSE); | |||||
//其它三种 都没有 说明已经正常了 | |||||
if(!renewalFundWarning.getProcessWarning() && | |||||
!renewalFundWarning.getDeclaredWarning() && | |||||
!renewalFundWarning.getOperationWarning()){ | |||||
renewalFundWarning.setNormal(Boolean.TRUE); | |||||
renewalFundWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); | |||||
} | |||||
projectEarlyWarningService.updateById(renewalFundWarning); | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
private void checkOperationWarning(List<ProjectEarlyWarning> operationWarning) { | |||||
private void checkOperationWarning(List<ProjectEarlyWarning> operationWarnings) { | |||||
if(CollUtil.isEmpty(operationWarnings)){ | |||||
return; | |||||
} | |||||
for( ProjectEarlyWarning operationWarning : operationWarnings){ | |||||
String projectCode = operationWarning.getProjectCode(); | |||||
Project project = projectService.getProjectByCode(projectCode); | |||||
if(Objects.isNull(project)){ | |||||
continue; | |||||
} | |||||
WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | |||||
.eq(WflowEarlyWarningRecords::getProjectCode, projectCode) | |||||
.eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode()) | |||||
.orderByDesc(WflowEarlyWarningRecords::getWarningTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.isNull(record)){ | |||||
continue; | |||||
} | |||||
Integer biz = record.getBiz(); | |||||
WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); | |||||
if(Objects.isNull(operationTypeEnum)){ | |||||
continue; | |||||
} | |||||
Integer projectStutas = operationTypeEnum.getProjectStutas(); | |||||
//已经不是这个状态了 说明已经被提交了 | |||||
if(!projectStutas.equals(project.getStatus())){ | |||||
operationWarning.setOperationWarning(Boolean.FALSE); | |||||
//其它三种 都没有 说明已经正常了 | |||||
if(!operationWarning.getProcessWarning() && | |||||
!operationWarning.getDeclaredWarning() && | |||||
!operationWarning.getRenewalFundWarning()){ | |||||
operationWarning.setNormal(Boolean.TRUE); | |||||
operationWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); | |||||
} | |||||
projectEarlyWarningService.updateById(operationWarning); | |||||
} | |||||
} | |||||
} | } | ||||
private void checkDeclaredWarning(List<ProjectEarlyWarning> declaredWarning) { | |||||
private void checkDeclaredWarning(List<ProjectEarlyWarning> declaredWarnings) { | |||||
if(CollUtil.isEmpty(declaredWarnings)){ | |||||
return; | |||||
} | |||||
for( ProjectEarlyWarning declaredWarning : declaredWarnings){ | |||||
String projectCode = declaredWarning.getProjectCode(); | |||||
Project project = projectService.getProjectByCode(projectCode); | |||||
if(Objects.isNull(project)){ | |||||
continue; | |||||
} | |||||
WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | |||||
.eq(WflowEarlyWarningRecords::getProjectCode, projectCode) | |||||
.eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.DECLARED_WARNING.getCode()) | |||||
.orderByDesc(WflowEarlyWarningRecords::getWarningTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.isNull(record)){ | |||||
continue; | |||||
} | |||||
Integer biz = record.getBiz(); | |||||
WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); | |||||
if(Objects.isNull(flowTypeEnum)){ | |||||
continue; | |||||
} | |||||
Integer projectStutas = flowTypeEnum.getProjectStutas(); | |||||
//已经不是这个状态了 说明已经被提交了 | |||||
if(!projectStutas.equals(project.getStatus())){ | |||||
declaredWarning.setDeclaredWarning(Boolean.FALSE); | |||||
//其它三种 都没有 说明已经正常了 | |||||
if(!declaredWarning.getProcessWarning() && | |||||
!declaredWarning.getOperationWarning() && | |||||
!declaredWarning.getRenewalFundWarning()){ | |||||
declaredWarning.setNormal(Boolean.TRUE); | |||||
declaredWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); | |||||
} | |||||
projectEarlyWarningService.updateById(declaredWarning); | |||||
} | |||||
} | |||||
} | } | ||||
private void checkProcessWarning(List<ProjectEarlyWarning> processWarning) { | |||||
/** | |||||
* 流程 查看 是否已经处理过 | |||||
* @param processWarnings | |||||
*/ | |||||
private void checkProcessWarning(List<ProjectEarlyWarning> processWarnings) { | |||||
if(CollUtil.isEmpty(processWarnings)){ | |||||
return; | |||||
} | |||||
for( ProjectEarlyWarning processWarning : processWarnings){ | |||||
String projectCode = processWarning.getProjectCode(); | |||||
WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | |||||
.eq(WflowEarlyWarningRecords::getProjectCode, projectCode) | |||||
.orderByDesc(WflowEarlyWarningRecords::getWarningTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.isNull(record)){ | |||||
continue; | |||||
} | |||||
String nodeId = record.getNodeId(); | |||||
if(StringUtils.isBlank(nodeId)){ | |||||
continue; | |||||
} | |||||
List<Task> tasks = taskService.createTaskQuery() | |||||
.taskDefinitionKey(nodeId) | |||||
.list(); | |||||
if(CollUtil.isEmpty(tasks)){ | |||||
//说明 已经审批通过了 | |||||
processWarning.setProcessWarning(Boolean.FALSE); | |||||
//其它三种 都没有 说明已经正常了 | |||||
if(!processWarning.getDeclaredWarning() && | |||||
!processWarning.getOperationWarning() && | |||||
!processWarning.getRenewalFundWarning()){ | |||||
processWarning.setNormal(Boolean.TRUE); | |||||
processWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); | |||||
} | |||||
projectEarlyWarningService.updateById(processWarning); | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -57,7 +57,8 @@ public class EarlyWarningManage { | |||||
*/ | */ | ||||
public void doEarlyWarning(String noticeMethod,String noticeContent, Integer timeout,Integer biz, | public void doEarlyWarning(String noticeMethod,String noticeContent, Integer timeout,Integer biz, | ||||
LocalDateTime startTime,String employeeCode, | LocalDateTime startTime,String employeeCode, | ||||
Project project,Integer ruleType,Integer noticeType,String path,String batchEmployees) { | |||||
Project project,Integer ruleType,Integer noticeType, | |||||
String path,String batchEmployees,String nodeId) { | |||||
//1.存入 预警记录 | //1.存入 预警记录 | ||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); | UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); | ||||
WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); | WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); | ||||
@@ -107,6 +108,7 @@ public class EarlyWarningManage { | |||||
records.setPath(path); | records.setPath(path); | ||||
records.setBatchEmployees(batchEmployees); | records.setBatchEmployees(batchEmployees); | ||||
records.setBiz(biz); | records.setBiz(biz); | ||||
records.setNodeId(nodeId); | |||||
earlyWarningRecordsService.save(records); | earlyWarningRecordsService.save(records); | ||||
//2.消息提醒 | //2.消息提醒 | ||||
@@ -116,6 +116,9 @@ public class WflowEarlyWarningRecords implements Serializable { | |||||
@ApiModelProperty(value = "路径") | @ApiModelProperty(value = "路径") | ||||
private String path; | private String path; | ||||
@ApiModelProperty(value = "审批节点ID") | |||||
private String nodeId; | |||||
@ApiModelProperty(value = "这一批要通知的员工号") | @ApiModelProperty(value = "这一批要通知的员工号") | ||||
private String batchEmployees; | private String batchEmployees; | ||||
@@ -34,6 +34,9 @@ public class ProjectEarlyWarningVO implements Serializable { | |||||
@ApiModelProperty(value = "项目编码") | @ApiModelProperty(value = "项目编码") | ||||
private String projectCode; | private String projectCode; | ||||
@ApiModelProperty(value = "项目名称") | |||||
private String projectName; | |||||
@ApiModelProperty(value = "区域") | @ApiModelProperty(value = "区域") | ||||
private String areaCode; | private String areaCode; | ||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | import com.ningdatech.pmapi.common.constant.BizConst; | ||||
import com.ningdatech.pmapi.projectlib.mapper.ProjectMapper; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import com.ningdatech.pmapi.sys.enumeration.ProjectEarlyWarningStatusEnum; | import com.ningdatech.pmapi.sys.enumeration.ProjectEarlyWarningStatusEnum; | ||||
@@ -105,7 +104,7 @@ public class ProjectEarlyWarningServiceImpl extends ServiceImpl<ProjectEarlyWarn | |||||
warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); | warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); | ||||
break; | break; | ||||
case ADVENT: | case ADVENT: | ||||
warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); | |||||
warning.setStatus(ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()); | |||||
break; | break; | ||||
default: | default: | ||||
warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); | warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); | ||||
@@ -128,4 +128,11 @@ public class UserFullInfoDTO { | |||||
} | } | ||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
} | } | ||||
public Boolean notAdmin() { | |||||
if(!getSuperAdmin() && !getRegionAdmin() && !getIsOrgAdmin()){ | |||||
return Boolean.TRUE; | |||||
} | |||||
return Boolean.FALSE; | |||||
} | |||||
} | } |
@@ -108,7 +108,7 @@ public class WorkbenchManage { | |||||
}, ForkJoinPool.commonPool()), | }, ForkJoinPool.commonPool()), | ||||
CompletableFuture.runAsync(() -> { | CompletableFuture.runAsync(() -> { | ||||
//4.项目预警记录 | //4.项目预警记录 | ||||
res.setProjectEarlyWarning(getProjectEarlyWarning()); | |||||
res.setProjectEarlyWarning(getProjectEarlyWarning(user)); | |||||
}, ForkJoinPool.commonPool()) | }, ForkJoinPool.commonPool()) | ||||
).join(); | ).join(); | ||||
@@ -122,17 +122,31 @@ public class WorkbenchManage { | |||||
return res; | return res; | ||||
} | } | ||||
private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning() { | |||||
private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning(UserFullInfoDTO user) { | |||||
WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); | WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); | ||||
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.eq(user.getRegionAdmin(),Project::getAreaCode,user.getRegionCode()) | |||||
.eq(user.getIsOrgAdmin() || user.notAdmin(),Project::getBuildOrgCode,user.getEmpPosUnitCode())); | |||||
Set<String> projectCodeS = Sets.newHashSet(); | |||||
Map<String,String> projectNameMap = projects.stream() | |||||
.filter(p -> projectCodeS.add(p.getProjectCode())) | |||||
.collect(Collectors.toMap(Project::getProjectCode,Project::getProjectName)); | |||||
//4.1 | //4.1 | ||||
//累积预警统计 | //累积预警统计 | ||||
WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics(); | WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics(); | ||||
Long overCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | Long overCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | ||||
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) | .eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) | ||||
.or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType))); | |||||
.or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType)) | |||||
.eq(user.getRegionAdmin(),WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()) | |||||
.eq(user.getIsOrgAdmin() || user.notAdmin(),WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode())); | |||||
accumulate.setOver(overCount.intValue()); | accumulate.setOver(overCount.intValue()); | ||||
Long adventCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | Long adventCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | ||||
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode())); | |||||
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode()) | |||||
.eq(user.getRegionAdmin(),WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()) | |||||
.eq(user.getIsOrgAdmin() || user.notAdmin(),WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode())); | |||||
accumulate.setAdvent(adventCount.intValue()); | accumulate.setAdvent(adventCount.intValue()); | ||||
projectEarlyWarning.setAccumulate(accumulate); | projectEarlyWarning.setAccumulate(accumulate); | ||||
@@ -143,13 +157,19 @@ public class WorkbenchManage { | |||||
Page<ProjectEarlyWarning> adventPage = Page.of(1,1000); | Page<ProjectEarlyWarning> adventPage = Page.of(1,1000); | ||||
Page<ProjectEarlyWarning> normalPage = Page.of(1,1000); | Page<ProjectEarlyWarning> normalPage = Page.of(1,1000); | ||||
LambdaQueryWrapper<ProjectEarlyWarning> overWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) | LambdaQueryWrapper<ProjectEarlyWarning> overWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) | ||||
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.OVER_TIME.name()); | |||||
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.OVER_TIME.name()) | |||||
.eq(user.getRegionAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) | |||||
.eq(user.getIsOrgAdmin() || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); | |||||
projectEarlyWarningService.page(overPage,overWrapper); | projectEarlyWarningService.page(overPage,overWrapper); | ||||
LambdaQueryWrapper<ProjectEarlyWarning> adventWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) | LambdaQueryWrapper<ProjectEarlyWarning> adventWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) | ||||
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()); | |||||
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()) | |||||
.eq(user.getRegionAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) | |||||
.eq(user.getIsOrgAdmin() || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); | |||||
projectEarlyWarningService.page(adventPage,adventWrapper); | projectEarlyWarningService.page(adventPage,adventWrapper); | ||||
LambdaQueryWrapper<ProjectEarlyWarning> normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) | LambdaQueryWrapper<ProjectEarlyWarning> normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) | ||||
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()); | |||||
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()) | |||||
.eq(user.getRegionAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) | |||||
.eq(user.getIsOrgAdmin() || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); | |||||
projectEarlyWarningService.page(normalPage,normalWrapper); | projectEarlyWarningService.page(normalPage,normalWrapper); | ||||
WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); | WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); | ||||
@@ -162,6 +182,8 @@ public class WorkbenchManage { | |||||
projectEarlyWarning.setCurrent(cuurent); | projectEarlyWarning.setCurrent(cuurent); | ||||
List<WflowEarlyWarningRecords> warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | List<WflowEarlyWarningRecords> warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | ||||
.eq(user.getRegionAdmin(),WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()) | |||||
.eq(user.getIsOrgAdmin() || user.notAdmin(),WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()) | |||||
.orderByDesc(WflowEarlyWarningRecords::getWarningTime)); | .orderByDesc(WflowEarlyWarningRecords::getWarningTime)); | ||||
Set<String> projectCodeSet = Sets.newHashSet(); | Set<String> projectCodeSet = Sets.newHashSet(); | ||||
Map<String, WflowEarlyWarningRecords> warningMap = warningRecords.stream() | Map<String, WflowEarlyWarningRecords> warningMap = warningRecords.stream() | ||||
@@ -183,6 +205,7 @@ public class WorkbenchManage { | |||||
vo.setBatchEmployees(record.getBatchEmployees()); | vo.setBatchEmployees(record.getBatchEmployees()); | ||||
vo.setRecordId(record.getId()); | vo.setRecordId(record.getId()); | ||||
} | } | ||||
vo.setProjectName(projectNameMap.get(o.getProjectCode())); | |||||
return vo; | return vo; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
projectEarlyWarning.setOvers(PageVo.of(overVos,overPage.getTotal())); | projectEarlyWarning.setOvers(PageVo.of(overVos,overPage.getTotal())); | ||||
@@ -205,6 +228,7 @@ public class WorkbenchManage { | |||||
vo.setBatchEmployees(record.getBatchEmployees()); | vo.setBatchEmployees(record.getBatchEmployees()); | ||||
vo.setRecordId(record.getId()); | vo.setRecordId(record.getId()); | ||||
} | } | ||||
vo.setProjectName(projectNameMap.get(o.getProjectCode())); | |||||
return vo; | return vo; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
projectEarlyWarning.setAdvents(PageVo.of(adventVos,adventPage.getTotal())); | projectEarlyWarning.setAdvents(PageVo.of(adventVos,adventPage.getTotal())); | ||||
@@ -227,6 +251,7 @@ public class WorkbenchManage { | |||||
vo.setBatchEmployees(record.getBatchEmployees()); | vo.setBatchEmployees(record.getBatchEmployees()); | ||||
vo.setRecordId(record.getId()); | vo.setRecordId(record.getId()); | ||||
} | } | ||||
vo.setProjectName(projectNameMap.get(o.getProjectCode())); | |||||
return vo; | return vo; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
projectEarlyWarning.setNormals(PageVo.of(normalVos,normalPage.getTotal())); | projectEarlyWarning.setNormals(PageVo.of(normalVos,normalPage.getTotal())); | ||||
@@ -265,20 +290,16 @@ public class WorkbenchManage { | |||||
VUtils.isTrue(StringUtils.isBlank(batchEmployees)) | VUtils.isTrue(StringUtils.isBlank(batchEmployees)) | ||||
.throwMessage("催办失败,员工为空!"); | .throwMessage("催办失败,员工为空!"); | ||||
String[] employees = batchEmployees.split(StrPool.COMMA); | String[] employees = batchEmployees.split(StrPool.COMMA); | ||||
// Integer hours = LocalDateTime.now(); | |||||
//算出 当前和他的 小时差 | |||||
Long between = ChronoUnit.HOURS.between(instStart,LocalDateTime.now()); | Long between = ChronoUnit.HOURS.between(instStart,LocalDateTime.now()); | ||||
Integer times = 0; | Integer times = 0; | ||||
for(String employee : employees){ | for(String employee : employees){ | ||||
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,between.intValue(),biz, | earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,between.intValue(),biz, | ||||
instStart,employee,project, | instStart,employee,project, | ||||
ruleType,noticeType,path,batchEmployees); | |||||
ruleType,noticeType,path,batchEmployees,record.getNodeId()); | |||||
times++; | times++; | ||||
} | } | ||||
return "催办成功了" + times + "个人"; | return "催办成功了" + times + "个人"; | ||||
} | } | ||||
public static void main(String[] args) { | |||||
System.out.println(ChronoUnit.HOURS.between(LocalDateTime.now(),LocalDateTime.now().plusMonths(1))); | |||||
} | |||||
} | } |