@@ -41,4 +41,5 @@ public class DataScopeUtil { | |||
} | |||
return DataScopeContext.getDataScope(loginUser.getRoleCode().name()); | |||
} | |||
} |
@@ -570,7 +570,7 @@ public class ConstructionManage { | |||
processParam.setFormData(Collections.emptyMap()); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = projectService.getById(req.getProjectId()); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectHelper.buildOrgModelMap(user, project); | |||
String instanceId = processInstanceService.startProcessLs(model, processParam, orgMap); | |||
ProjectInst projectInst = new ProjectInst(); | |||
@@ -4,8 +4,8 @@ import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.lang.Assert; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Maps; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
@@ -13,25 +13,21 @@ import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.model.constant.TypeReferenceConst; | |||
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO; | |||
import com.hz.pm.api.projectdeclared.model.vo.DeclaredProjectStatisticsVO; | |||
import com.hz.pm.api.projectdeclared.service.IDeclaredStatisticsService; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.bean.entity.WflowOrgModels; | |||
import com.wflow.enums.OrgTypeEnum; | |||
import com.wflow.enums.ProcessDefTypeEnum; | |||
import com.wflow.exception.BusinessException; | |||
import com.wflow.service.OrgProcdefService; | |||
import com.wflow.workflow.bean.dto.OrgInfoDTO; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | |||
import com.wflow.workflow.service.ProcessModelService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
@@ -54,78 +50,67 @@ public class DeclaredProjectHelper { | |||
private final IProjectService projectService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final ProcessModelService processModelService; | |||
private final OrgProcdefService orgProcdefService; | |||
private final IDeclaredStatisticsService statisticsService; | |||
/** | |||
* 公共的发起流程方法 | |||
* 项目名称去重 | |||
* | |||
* @param project \ | |||
*/ | |||
public void startProcess(ProjectDTO projectDTO, UserFullInfoDTO user, Integer processType) { | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getProcessType, processType) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
throw new BusinessException("找不到对应流程配置"); | |||
public void projectNameDuplicateCheck(ProjectDTO project) { | |||
String projectCode = project.getProjectCode(); | |||
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getProjectName, project.getProjectName()) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.ne(Objects.nonNull(projectCode), Project::getProjectCode, projectCode) | |||
.last(BizConst.LIMIT_1); | |||
if (projectService.count(query) > 0) { | |||
throw BizException.wrap("项目名【%s】已存在", project.getProjectName()); | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(buildUser(user)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
BeanUtils.copyProperties(projectDTO, conditionDto); | |||
Map<String, Object> formData = Maps.newHashMap(); | |||
formData.putAll(JSON.parseObject(JSON.toJSONString(conditionDto), TypeReferenceConst.STR_OBJ_MAP)); | |||
params.setFormData(formData); | |||
} | |||
//项目名称去重 | |||
public void checkDuplication(ProjectDTO project) { | |||
VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getProjectName, project.getProjectName()) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.ne(Objects.nonNull(project.getProjectCode()), Project::getProjectCode, project.getProjectCode())) > 0) | |||
.throwMessage(String.format("修改失败 此项目名 【%s】 已存在!", project.getProjectName())); | |||
} | |||
public void checkAmount(ProjectDTO projectInfo) { | |||
if (Objects.nonNull(projectInfo.getDeclareAmount())) { | |||
BigDecimal declareAmount = projectInfo.getDeclareAmount(); | |||
BigDecimal govSuperFinanceAmount = projectInfo.getDeclareGovSuperiorFinanceAmount(); | |||
BigDecimal govOwnFinanceAmount = projectInfo.getDeclareGovOwnFinanceAmount(); | |||
BigDecimal bankLendingAmount = projectInfo.getDeclareBankLendingAmount(); | |||
BigDecimal haveAmount = projectInfo.getDeclareHaveAmount(); | |||
BigDecimal otherAmount = projectInfo.getDeclareOtherAmount(); | |||
BigDecimal totalAmount = govSuperFinanceAmount | |||
.add(govOwnFinanceAmount).add(bankLendingAmount).add(haveAmount).add(otherAmount); | |||
VUtils.isTrue(declareAmount.compareTo(totalAmount) != 0) | |||
.throwMessage(String.format("申报失败! 申报总金额【%s】 不等于其它申报金额 【%s】", declareAmount, totalAmount)); | |||
BigDecimal totalAmount = getTotalDeclaredAmount(projectInfo); | |||
if (declareAmount.compareTo(totalAmount) != 0) { | |||
throw BizException.wrap("申报总金额【%s】 不等于其它申报金额【%s】", declareAmount, totalAmount); | |||
} | |||
//判断 年度计划金额 如果开着的话 | |||
if (CollUtil.isNotEmpty(projectInfo.getPaymentPlanList())) { | |||
for (ProjectPaymentPlanDTO paymentPlan : projectInfo.getPaymentPlanList()) { | |||
BigDecimal annualPlanAmount = paymentPlan.getAnnualPlanAmount(); | |||
VUtils.isTrue(annualPlanAmount.compareTo(BigDecimal.ZERO) <= 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能小于等于0", annualPlanAmount)); | |||
VUtils.isTrue(annualPlanAmount.compareTo(declareAmount) > 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能大于申报金额 【%s】", annualPlanAmount, declareAmount)); | |||
BigDecimal annualGovSuperAmount = paymentPlan.getAnnualPlanGovSuperiorFinanceAmount(); | |||
BigDecimal annualOwnSuperAmount = paymentPlan.getAnnualPlanGovOwnFinanceAmount(); | |||
BigDecimal annualHaveAmount = paymentPlan.getAnnualPlanHaveAmount(); | |||
BigDecimal totalAnnual = annualGovSuperAmount.add(annualOwnSuperAmount).add(annualHaveAmount); | |||
VUtils.isTrue(annualPlanAmount.compareTo(totalAnnual) != 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】", annualPlanAmount, totalAnnual)); | |||
} | |||
if (CollUtil.isEmpty(projectInfo.getPaymentPlanList())) { | |||
return; | |||
} | |||
for (ProjectPaymentPlanDTO paymentPlan : projectInfo.getPaymentPlanList()) { | |||
BigDecimal annualPlanAmount = paymentPlan.getAnnualPlanAmount(); | |||
VUtils.isTrue(annualPlanAmount.compareTo(BigDecimal.ZERO) <= 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能小于等于0", annualPlanAmount)); | |||
VUtils.isTrue(annualPlanAmount.compareTo(declareAmount) > 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能大于申报金额 【%s】", annualPlanAmount, declareAmount)); | |||
BigDecimal annualGovSuperAmount = paymentPlan.getAnnualPlanGovSuperiorFinanceAmount(); | |||
BigDecimal annualOwnSuperAmount = paymentPlan.getAnnualPlanGovOwnFinanceAmount(); | |||
BigDecimal annualHaveAmount = paymentPlan.getAnnualPlanHaveAmount(); | |||
BigDecimal totalAnnual = annualGovSuperAmount.add(annualOwnSuperAmount).add(annualHaveAmount); | |||
VUtils.isTrue(annualPlanAmount.compareTo(totalAnnual) != 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】", annualPlanAmount, totalAnnual)); | |||
} | |||
} | |||
} | |||
private static BigDecimal getTotalDeclaredAmount(ProjectDTO projectInfo) { | |||
BigDecimal govSuperFinanceAmount = projectInfo.getDeclareGovSuperiorFinanceAmount(); | |||
BigDecimal govOwnFinanceAmount = projectInfo.getDeclareGovOwnFinanceAmount(); | |||
BigDecimal bankLendingAmount = projectInfo.getDeclareBankLendingAmount(); | |||
BigDecimal haveAmount = projectInfo.getDeclareHaveAmount(); | |||
BigDecimal otherAmount = projectInfo.getDeclareOtherAmount(); | |||
return govSuperFinanceAmount | |||
.add(govOwnFinanceAmount) | |||
.add(bankLendingAmount) | |||
.add(haveAmount) | |||
.add(otherAmount); | |||
} | |||
public ProcessInstanceUserDto buildUser(UserFullInfoDTO user) { | |||
return ProcessInstanceUserDto.builder() | |||
.userId(user.getUserIdStr()) | |||
@@ -150,20 +135,14 @@ public class DeclaredProjectHelper { | |||
.build(); | |||
} | |||
public Map<String, OrgInfoDTO> buildOrgModelMap(Long userId, Project project) { | |||
public Map<String, OrgInfoDTO> buildOrgModelMap(UserInfoDetails user, Project project) { | |||
Map<String, OrgInfoDTO> orgMap = new HashMap<>(); | |||
// 查出所有的单位流程配置 | |||
List<WflowOrgModels> orgModelsList = orgProcdefService.list(); | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
if (Objects.isNull(userFullInfo)) { | |||
log.warn("取不到员工 返回空map"); | |||
return Collections.emptyMap(); | |||
} | |||
String startOrgCode = userFullInfo.getMhUnitIdStr(); | |||
String startOrgName = userFullInfo.getMhUnitName(); | |||
String startOrgCode = user.getMhUnitIdStr(); | |||
String startOrgName = user.getMhUnitName(); | |||
String startOrgParentCode; | |||
String startOrgParentName; | |||
// 如果申报时 上级主管单位,由该单位自己审核 | |||
@@ -296,18 +275,6 @@ public class DeclaredProjectHelper { | |||
return orgMap; | |||
} | |||
//根据提交者的单位 | |||
public DeclaredProjectStatisticsVO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user) { | |||
//查此人建设单位的项目 | |||
return statisticsService.getOrgStatistics(user.getMhUnitIdStr(), year); | |||
} | |||
//根据提交者的区域 他是区管或者超管 | |||
public DeclaredProjectStatisticsVO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user) { | |||
//查此人建设单位的项目 | |||
return statisticsService.getRegionStatistics(null, year); | |||
} | |||
/** | |||
* 把条件值放入工作流 用于判断条件 根据dto | |||
* | |||
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessType; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.TypeReferenceConst; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.ExcelExportStyle; | |||
import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; | |||
@@ -110,7 +111,7 @@ public class DeclaredProjectManage { | |||
reqProj.setBuildOrgName(user.getMhUnitName()); | |||
//项目名称去重 | |||
declaredProjectHelper.checkDuplication(reqProj); | |||
declaredProjectHelper.projectNameDuplicateCheck(reqProj); | |||
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 | |||
declaredProjectHelper.checkAmount(reqProj); | |||
@@ -137,15 +138,12 @@ public class DeclaredProjectManage { | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
BeanUtils.copyProperties(req.getProjectInfo(), conditionDto); | |||
req.getFormData().putAll( | |||
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() { | |||
}) | |||
); | |||
req.getFormData().putAll(JSON.parseObject(JSON.toJSONString(conditionDto), TypeReferenceConst.STR_OBJ_MAP)); | |||
params.setFormData(req.getFormData()); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(reqProj, project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user, project); | |||
String instanceId = processService.startProcessLs(model, params, orgModelMap); | |||
log.info("申报项目成功 【{}】", instanceId); | |||
@@ -185,7 +183,7 @@ public class DeclaredProjectManage { | |||
if (StringUtils.isNotBlank(reqProj.getProjectName()) && | |||
!reqProj.getProjectName().equals(projectInfo.getProjectName())) { | |||
reqProj.setProjectCode(projectInfo.getProjectCode()); | |||
declaredProjectHelper.checkDuplication(reqProj); | |||
declaredProjectHelper.projectNameDuplicateCheck(reqProj); | |||
} | |||
//写死 是否有主管单位 | |||
@@ -220,7 +218,7 @@ public class DeclaredProjectManage { | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(reqProj, project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user, project); | |||
String instId = processService.startProcessLs(model, instParam, orgModelMap); | |||
log.info("重新申报项目成功:{} ==> {}", project.getProjectCode(), instId); | |||
@@ -380,14 +378,14 @@ public class DeclaredProjectManage { | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
List<DeclaredProjectExportDTO> collect = records.stream().map(r -> { | |||
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); | |||
BeanUtils.copyProperties(r, exportDTO); | |||
exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); | |||
exportDTO.setStatusName(ProjectStatus.getDesc(r.getStatus())); | |||
DeclaredProjectExportDTO item = new DeclaredProjectExportDTO(); | |||
BeanUtils.copyProperties(r, item); | |||
item.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); | |||
item.setStatusName(ProjectStatus.getDesc(r.getStatus())); | |||
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); | |||
exportDTO.setCreateOn(createOnStr); | |||
exportDTO.setSerialNumber(serialNumber.incrementAndGet()); | |||
return exportDTO; | |||
item.setCreateOn(createOnStr); | |||
item.setSerialNumber(serialNumber.incrementAndGet()); | |||
return item; | |||
}).collect(Collectors.toList()); | |||
String fileName = "项目申报列表"; | |||
ExcelDownUtil.setFileName(fileName, response); | |||
@@ -84,7 +84,8 @@ public class FinalAcceptanceManage { | |||
private final ProjectStateMachineUtil projectStateMachineUtil; | |||
private final TenderStateMachineUtil tenderStateMachineUtil; | |||
private final IProjectInstService projectInstService; | |||
private final HandlerManage handlerManage; | |||
//================================================================================================================== | |||
private static final List<TenderStatus> FINAL_INSPECTED_TENDER_STATUS; | |||
@@ -191,18 +192,18 @@ public class FinalAcceptanceManage { | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
List<DeclaredProjectExportDTO> collect = Lists.newArrayList(); | |||
if (CollUtil.isNotEmpty(records)) { | |||
collect = records.stream().map(r -> { | |||
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); | |||
BeanUtils.copyProperties(r, exportDTO); | |||
exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); | |||
exportDTO.setStatusName(ProjectStatus.getDesc(r.getStatus())); | |||
records.forEach(r -> { | |||
DeclaredProjectExportDTO item = new DeclaredProjectExportDTO(); | |||
BeanUtils.copyProperties(r, item); | |||
item.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); | |||
item.setStatusName(ProjectStatus.getDesc(r.getStatus())); | |||
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); | |||
exportDTO.setCreateOn(createOnStr); | |||
exportDTO.setSerialNumber(serialNumber.incrementAndGet()); | |||
exportDTO.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ? | |||
item.setCreateOn(createOnStr); | |||
item.setSerialNumber(serialNumber.incrementAndGet()); | |||
item.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ? | |||
NdDateUtils.format(r.getPlanAcceptanceTime(), "yyyy-MM-dd") : StringUtils.EMPTY); | |||
return exportDTO; | |||
}).collect(Collectors.toList()); | |||
collect.add(item); | |||
}); | |||
} | |||
String fileName = "待终验申请项目列表"; | |||
@@ -265,7 +266,7 @@ public class FinalAcceptanceManage { | |||
params.setProcessUsers(Collections.emptyMap()); | |||
params.setFormData(Collections.emptyMap()); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user, project); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgMap); | |||
log.info("终验方案项目申报成功 【{}】", instanceId); | |||
@@ -81,7 +81,7 @@ public class ProjectReviewManage { | |||
processParam.setProcessUsers(Collections.emptyMap()); | |||
processParam.setFormData(Collections.emptyMap()); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectHelper.buildOrgModelMap(user, project); | |||
String instanceId = processInstanceService.startProcessLs(model, processParam, orgMap); | |||
ProjectInst projectInst = new ProjectInst(); | |||
@@ -571,7 +571,7 @@ public class PurchaseManage { | |||
instParam.setProcessUsers(Collections.emptyMap()); | |||
instParam.setFormData(Collections.emptyMap()); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user, project); | |||
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); | |||
testValidStateMachineUtil.pass(purchase); | |||
purchaseService.updateById(purchase); | |||
@@ -635,7 +635,7 @@ public class PurchaseManage { | |||
instParam.setProcessUsers(Collections.emptyMap()); | |||
instParam.setFormData(Collections.emptyMap()); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user, project); | |||
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); | |||
selfTestStateMachineUtil.pass(purchase); | |||
purchaseService.updateById(purchase); | |||
@@ -680,7 +680,7 @@ public class PurchaseManage { | |||
instParam.setProcessUsers(Collections.emptyMap()); | |||
instParam.setFormData(Collections.emptyMap()); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user, project); | |||
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); | |||
adaptStateMachineUtil.pass(purchase); | |||
purchaseService.updateById(purchase); | |||
@@ -286,7 +286,7 @@ public class DeclaredRecordManage { | |||
projectInfo.setBuildOrgName(user.getMhUnitName()); | |||
// 项目名称去重 | |||
declaredProjectHelper.checkDuplication(projectInfo); | |||
declaredProjectHelper.projectNameDuplicateCheck(projectInfo); | |||
// 写死 是否有主管单位 | |||
projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode()); | |||
@@ -313,7 +313,7 @@ public class DeclaredRecordManage { | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectInfo, project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user, project); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("立项备案成功 【{}】", instanceId); | |||
@@ -352,7 +352,7 @@ public class DeclaredRecordManage { | |||
if (StrUtil.isNotBlank(reqProj.getProjectName()) && | |||
!reqProj.getProjectName().equals(oldProj.getProjectName())) { | |||
reqProj.setProjectCode(oldProj.getProjectCode()); | |||
declaredProjectHelper.checkDuplication(reqProj); | |||
declaredProjectHelper.projectNameDuplicateCheck(reqProj); | |||
} | |||
UnitDTO unit = mhUnitCache.getById(user.getMhUnitId()); | |||
Assert.notNull(unit, "申报单位不存在"); | |||
@@ -386,7 +386,7 @@ public class DeclaredRecordManage { | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(reqProj, project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user, project); | |||
String instId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
//保存项目相关 | |||
@@ -23,6 +23,8 @@ public abstract class AbstractReminderTask { | |||
public abstract String getTaskPropertyName(); | |||
public abstract void execute(); | |||
public boolean open() { | |||
String property = PREFIX + "." + getTaskPropertyName() + "." + OPEN; | |||
Boolean value = environment.getProperty(property, Boolean.class); | |||
@@ -80,7 +80,8 @@ public class DeclaredRecordAbstractReminderTask extends AbstractReminderTask { | |||
private static final String MSG_FMT = "【%s】需要发起立项备案申请,请及时处理。"; | |||
private void declaredRecordReminder() { | |||
@Override | |||
public void execute() { | |||
Wrapper<Project> query = Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getStatus, ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode()); | |||
@@ -154,16 +155,4 @@ public class DeclaredRecordAbstractReminderTask extends AbstractReminderTask { | |||
} | |||
} | |||
@PostConstruct | |||
public void initTask() { | |||
// 初始化立项备案提醒任务 | |||
if (this.open()) { | |||
String cron = this.cron(); | |||
ThreadPoolUtil.SCHEDULER.schedule(this::declaredRecordReminder, triggerContext -> { | |||
CronTrigger cronTrigger = new CronTrigger(cron); | |||
return cronTrigger.nextExecutionTime(triggerContext); | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,40 @@ | |||
package com.hz.pm.api.scheduler.task; | |||
import com.hz.pm.api.common.util.ThreadPoolUtil; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.scheduling.support.CronTrigger; | |||
import org.springframework.stereotype.Component; | |||
import javax.annotation.PostConstruct; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* ReminderTaskContext | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 17:06 2024/4/17 | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
public class ReminderTaskContext { | |||
private final List<AbstractReminderTask> reminderTasks; | |||
@PostConstruct | |||
public void initReminderTask() { | |||
for (AbstractReminderTask task : reminderTasks) { | |||
// 初始化立项备案提醒任务 | |||
if (task.open()) { | |||
String cron = task.cron(); | |||
ThreadPoolUtil.SCHEDULER.schedule(task::execute, trigger -> { | |||
CronTrigger cronTrigger = new CronTrigger(cron); | |||
return cronTrigger.nextExecutionTime(trigger); | |||
}); | |||
} | |||
} | |||
} | |||
} |
@@ -1070,7 +1070,7 @@ public class TodoCenterManage { | |||
//项目名称去重 | |||
if (StringUtils.isNotBlank(projectDto.getProjectName()) && | |||
!projectDto.getProjectName().equals(projectInfo.getProjectName())) { | |||
declaredProjectHelper.checkDuplication(projectDto); | |||
declaredProjectHelper.projectNameDuplicateCheck(projectDto); | |||
} | |||
projectDto.setProjectCode(projectInfo.getProjectCode()); | |||
declaredProjectHelper.checkAmount(projectDto); | |||