diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java index 98ddd0d..384e942 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java @@ -133,7 +133,7 @@ public class ConstructionPlanManage { ); params.setFormData(dto.getFormData()); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId,projectInfo); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("建设方案项目申报成功 【{}】", instanceId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 1b136ac..2ae6b51 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -53,6 +53,8 @@ import com.wflow.workflow.bean.dto.OrgInfoDTO; import com.wflow.workflow.bean.vo.ProcessStartParamsVo; import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessModelService; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -108,8 +110,7 @@ public class DeclaredProjectManage { public String startTheProcess(DefaultDeclaredDTO dto) { UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); Long userId = userInfoDetails.getUserId(); - VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(userInfoDetails.getUserId())) - .throwMessage("获取登录用户失败!"); + VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); ProjectDTO projectInfo = dto.getProjectInfo(); projectInfo.setAreaCode(userInfoDetails.getRegionCode()); @@ -117,6 +118,11 @@ public class DeclaredProjectManage { projectInfo.setBuildOrgCode(userInfoDetails.getOrganizationCode()); projectInfo.setBuildOrgName(userInfoDetails.getOrganizationName()); + //项目名称去重 + defaultDeclaredProjectManage.checkDuplication(projectInfo); + //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 + defaultDeclaredProjectManage.checkAmount(projectInfo); + //如果主管单位没有 那么主管单位就是自己 if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){ projectInfo.setSuperOrgCode(userInfoDetails.getOrganizationCode()); @@ -148,9 +154,6 @@ public class DeclaredProjectManage { throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); } - //项目名称去重 - defaultDeclaredProjectManage.checkDuplication(projectInfo); - ProcessStartParamsVo params = new ProcessStartParamsVo(); params.setUser(defaultDeclaredProjectManage.buildUser(userId)); params.setProcessUsers(Collections.emptyMap()); @@ -166,7 +169,7 @@ public class DeclaredProjectManage { // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 Project project = new Project(); BeanUtils.copyProperties(projectInfo,project); - Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId,project); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("申报项目成功 【{}】", instanceId); @@ -202,6 +205,11 @@ public class DeclaredProjectManage { Project projectInfo = projectService.getById(projectDto.getId()); VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + //项目名称去重 + defaultDeclaredProjectManage.checkDuplication(projectDto); + //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 + defaultDeclaredProjectManage.checkAmount(projectDto); + String regionCode = projectInfo.getAreaCode(); WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) .eq(WflowModels::getRegionCode, regionCode) @@ -232,7 +240,7 @@ public class DeclaredProjectManage { // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 Project project = new Project(); BeanUtils.copyProperties(projectInfo,project); - Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId,project); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("重新申报项目成功 【{}】", instanceId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java index 0d2f524..34ad67b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -73,6 +74,30 @@ public class DefaultDeclaredProjectManage { .throwMessage(String.format("修改失败 此项目名 【%s】 已存在!",project.getProjectName())); } + public void checkAmount(ProjectDTO projectInfo) { + 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("申报失败! 申报总金额【{}】 不等于其它申报金额 【{}】",declareAmount,totalAmount)); + + BigDecimal annualPlanAmount = projectInfo.getAnnualPlanAmount(); + BigDecimal annualGovSuperAmount = projectInfo.getAnnualPlanGovSuperiorFinanceAmount(); + BigDecimal annualOwnSuperAmount = projectInfo.getAnnualPlanGovOwnFinanceAmount(); + BigDecimal annualBankLendingAmount = projectInfo.getAnnualPlanBankLendingAmount(); + BigDecimal annualHaveAmount = projectInfo.getAnnualPlanHaveAmount(); + BigDecimal anualOtherAmount = projectInfo.getAnnualPlanOtherAmount(); + BigDecimal totalAnnual = annualGovSuperAmount + .add(annualOwnSuperAmount).add(annualBankLendingAmount).add(annualHaveAmount).add(anualOtherAmount); + VUtils.isTrue(annualPlanAmount.compareTo(totalAnnual) != 0) + .throwMessage(String.format("申报失败! 年度支付总金额【{}】 不等于其它年度支付金额 【{}】",annualPlanAmount,totalAnnual)); + } + public ProcessInstanceUserDto buildUser(Long userId){ UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); @@ -87,7 +112,7 @@ public class DefaultDeclaredProjectManage { .build(); } - public Map getOrgModelInfo(Long userId,Project project) { + public Map buildOrgModelMap(Long userId,Project project) { Map orgMap = new HashMap<>(); // 查出所有的单位流程配置 @@ -168,7 +193,7 @@ public class DefaultDeclaredProjectManage { } // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = getOrgModelInfo(userId,projectInfo); + Map orgModelMap = buildOrgModelMap(userId,projectInfo); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("提交预审项目成功 【{}】", instanceId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java index 5159896..2107c67 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java @@ -103,7 +103,7 @@ public class ReviewByDeptJointManage { params.setFormData(formData); // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId,project); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("部门联审申报成功 【{}】", instanceId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/enumeration/ProjectProvincialAuditStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/enumeration/ProjectProvincialAuditStatusEnum.java new file mode 100644 index 0000000..e830d4e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/enumeration/ProjectProvincialAuditStatusEnum.java @@ -0,0 +1,27 @@ +package com.ningdatech.pmapi.provincial.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @Classname ProjectProvincialAuditStatusEnum + * @Description + * @Date 2023/3/16 11:04 + * @Author PoffyZhang + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum ProjectProvincialAuditStatusEnum { + /** + * 省级联审的状态 + */ + AUDITING(1,"审核中"), + SUCCESS(2,"审核通过"), + FAIL(3,"审核不通过"); + + private Integer code; + private String desc; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProcessCommentRes.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProcessCommentRes.java new file mode 100644 index 0000000..44bd830 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProcessCommentRes.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.provincial.model.res; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + * @Classname ProcessCommentDTO + * @Description + * @Date 2023/3/2 15:25 + * @Author PoffyZhang + */ +@Data +@Builder +@ApiModel(value = "ProcessCommentRes", description = "省局返回流程审核详情") +public class ProcessCommentRes { + + @ApiModelProperty("任务id") + private String taskId; + + @ApiModelProperty("comment") + private String comment; + + @ApiModelProperty("流程步骤") + private String stepName; + + @ApiModelProperty("审批状态") + private String status; + + @ApiModelProperty("审批人") + private String label; + + @ApiModelProperty("时间") + private String approverTime; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialApplicationRes.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialApplicationRes.java new file mode 100644 index 0000000..ae67383 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialApplicationRes.java @@ -0,0 +1,102 @@ +package com.ningdatech.pmapi.provincial.model.res; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModel; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Classname ProvincialApplicationDTO + * @Description + * @Date 2023/3/2 10:06 + * @Author PoffyZhang + */ +@Data +@Builder +@ApiModel(value = "ProvincialApplicationRes", description = "") +public class ProvincialApplicationRes implements Serializable { + + + //云 信息 + private List clouds; + //是否初次建设 1是 2不是 + private Integer isFirst; + //应用名称 + private String applicationName; + //关联 关联的IRS应用code + private String applicationCode; + //关联的IRS应用name + private String relatedExistsApplication; + //1: '办公类系统',2: '业务应用类系统',3: '门户网站',4: '宣传微博/微信公众号',5: '硬件类系统',6: '工具类系统',99: '其他' + private Integer applicationType; + //建设层级 1:国家 2:省级 3:市级 4:县(市、区) + private Integer buildLevel; + //是否统建 0:否 1:是 + private Integer isUniteBuild; + //统建类型 1:全省统建 2:全市统建 + private Integer unionBuildKind; + //应用简介 + private String applicationSummary; + //应用备注 + private String applicationRemark; + //应用总投资测算明细 + private String applicationEstimateFile; + //是否数改系统 0:否 1:是 + private Integer isFiveDomain; + //1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔 + private String fiveDomain; + //业务领域 + private String bizDomain; + //否涉及业务协同 0:否 1:是 + private Integer isBizCooperate; + //协同单位111111 + private String cooperativeUnit; + //用户范围 0: '机关事业单位人员','0-1': '跨部门跨系统','0-2': '系统内地方各级','0-3': '本部门本级','0-4': '处室内部','0-6': '主管处室内部','0-5': '其他',1: '企业', 2: '社会公众',3: '其他' 多个用英文,分隔 + private String userRange; + //是否使用政务云资源 1使用 + private Integer useGovCloud; + //是否符合国家信息技术应用创新相关规范 0:否 1:是 + private Integer nationalITSpec; + //网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机 + private String netEnv; + //等保级别 1:一级 2:二级 3:三级 4:四级 5:五级 + private Integer secrecyGrade; + //密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级 + private Integer passwordGrade; + //是否是S2 0:否 1:是 + private Integer isS2; + //一本账应用名称 + private String accountAppName; + //领域”大脑”一本帐名称 + private String brainAccountAppName; + //是否使用公共数据 + private Integer useCommonData; + //使用的公共数据名称 + private String dataName; + //使用公共组件的名称 + private String commonComponents; + //是否使用公共组件 + private Integer useCommonComponent; + //是否产生公共组件 + private Integer isProduceCommonComponent; + //产生的组件名称 + private String produceCommonComponent; + //发布端 '浙里办','浙政钉','数字化改革门户','支付宝','微信','网页','PC客户端','APP端' + private String publishSide; + + @Builder + @JsonIgnoreProperties(value = { "handler"}) + public static class Cloud implements Serializable { + //云资源台数 11 + private Integer cloudNums; + //云资源类型 云服务器(ECS) + private String cloudType; + //云资源规格 1核8G + private String cloudBasicSpec; + //云资源描述 + private String cloudUseDescription; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialProjectRes.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialProjectRes.java new file mode 100644 index 0000000..62670a0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialProjectRes.java @@ -0,0 +1,132 @@ +package com.ningdatech.pmapi.provincial.model.res; + +import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Classname ProvincialProjectDTO + * @Description + * @Date 2023/3/2 10:06 + * @Author PoffyZhang + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "ProvincialProjectDTO", description = "") +public class ProvincialProjectRes implements Serializable { + + @ApiModelProperty("项目审核结果 1审核中 2审核通过 3审核不通过") + private Integer projectStatus; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("重大项目名称") + private String projectName; + + @ApiModelProperty("重大项目code 21位") + private String projectId; + + @ApiModelProperty("项目类型 1新建 2续建") + private Integer projectType; + + @ApiModelProperty("项目总投资(万元)") + private BigDecimal totalMoney; + + @ApiModelProperty("项目年度预算(万元)") + private BigDecimal yearBudget; + + @ApiModelProperty("自有资金,政府投资-本级财政资金,政府投资-上级补助资金") + private String budgetFrom; + + @ApiModelProperty("预算年度 2023") + private String year; + + @ApiModelProperty("财政code 32") + private String financialCode; + + @ApiModelProperty("发改code 23") + private String developCode; + + @ApiModelProperty("开始时间 比如2022-11-18") + private String beginTime; + + @ApiModelProperty("结束时间 比如2022-12-13") + private String endTime; + + @ApiModelProperty("立项依据1111") + private String buildBasis; + + @ApiModelProperty("立项依据材料 [{\"fileId\":\"\"}]") + private String buildBasisFile; + + @ApiModelProperty("项目概述") + private String projectSummary; + + @ApiModelProperty("负责人") + private String responsibleMan; + + @ApiModelProperty("联系人联系方式") + private String responsibleManPhone; + + @ApiModelProperty("联系人") + private String contactName; + + @ApiModelProperty("联系人联系方式") + private String contactPhone; + + @ApiModelProperty("建设单位 比如财政局") + private String buildUnit; + + @ApiModelProperty("建设单位浙政钉code") + private String buildUnitCode; + + @ApiModelProperty("主管单位") + private String superUnit; + + @ApiModelProperty("主管单位浙政钉code") + private String superUnitCode; + + @ApiModelProperty("可研报告文件") + private String researchReport; + + @ApiModelProperty("项目申报书") + private String projectApplyFile; + + @ApiModelProperty("项目总投资测算明细") + private String projectEstimateFile; + + @ApiModelProperty("申报单位主要职责") + private String unitThreePlan; + + @ApiModelProperty("其他附件") + private String otherFile; + + @ApiModelProperty("项目备注111") + private String projectRemark; + + @ApiModelProperty("是否有效 1有效 2无效 3撤回") + private Integer isEffective; + + @ApiModelProperty("是否包含应用 1包含") + private Integer includeApplication; + + @ApiModelProperty("app信息") + private List applicationInfo; + + @ApiModelProperty("审核信息") + private List processComment; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java index e99a0eb..d5be163 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java @@ -3,9 +3,11 @@ package com.ningdatech.pmapi.provincial.service.impl; import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.SecureUtil; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.ningdatech.basic.model.ApiResponse; import com.ningdatech.pmapi.common.config.ProvincialProperties; import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; +import com.ningdatech.pmapi.provincial.model.res.ProvincialProjectRes; import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -89,15 +91,17 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc String signature = getSha256(timeStamp,provincialProperties.getDetailUrl(), HttpMethod.POST.name()); + JSONObject jsonBaby = new JSONObject(); + jsonBaby.put("projectId",projectId); //发送post请求 - RequestEntity requestEntity = RequestEntity + RequestEntity requestEntity = RequestEntity .post(url) .header("Accept", MediaType.APPLICATION_JSON.toString()) .header("X-Hmac-Auth-Key",provincialProperties.getKey()) .header("X-Hmac-Auth-Signature",signature) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) - .body(projectId); //也可以是DTO + .body(jsonBaby); //也可以是DTO try { responseEntity = restTemplate.exchange(requestEntity,ApiResponse.class); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java new file mode 100644 index 0000000..3542bbe --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java @@ -0,0 +1,91 @@ +package com.ningdatech.pmapi.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.http.HttpStatus; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.provincial.enumeration.ProjectProvincialAuditStatusEnum; +import com.ningdatech.pmapi.provincial.model.res.ProvincialProjectRes; +import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; +import com.ningdatech.pmapi.scheduler.contants.TaskContant; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * @Classname CheckProvincialReviewResultTask + * @Description 去获取省级联审结果任务 + * @Date 2023/3/16 10:12 + * @Author PoffyZhang + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class CheckProvincialReviewResultTask { + + private final IJoinReviewProvincialBureauService reviewProvincialBureauService; + + private final IProjectService projectService; + private final StateMachineUtils stateMachineUtils; + + @Scheduled(cron = "0 */5 * * * ?") + public void statusFlow() throws UnknownHostException { + //测试暂时用自己电脑HOST + if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { + //1. 定时取 省级部门联审中的项目 去取项目 + List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED) + .eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .orderByAsc(Project::getCreateOn)); + + log.info("需要去查询省级联审结果的项目 size:{}",projectList.size()); + if(CollUtil.isEmpty(projectList)){ + log.info("没有正在省级联审中的项目!"); + return; + } + + //遍历 + for(Project project: projectList){ + try{ + ApiResponse apiResponse = reviewProvincialBureauService.processInfo(String.valueOf(project.getId())); + log.info("项目 【{}】 去获取省局联审结果 :{}",project.getId(),apiResponse); + if(Objects.isNull(apiResponse) || !Integer.valueOf(HttpStatus.HTTP_OK).equals(apiResponse.getCode())){ + log.info("项目 【{}】 去获取省局联审结果失败",project.getId()); + continue; + } + ProvincialProjectRes projectRes = JSON.parseObject(JSON.toJSONString(apiResponse.getData()), + ProvincialProjectRes.class); + + if(ProjectProvincialAuditStatusEnum.AUDITING.getCode().equals(projectRes.getProjectStatus())){ + log.info("此项目 【{}】 还在审核中",projectRes.getProjectId()); + }else if(ProjectProvincialAuditStatusEnum.SUCCESS.getCode().equals(projectRes.getProjectStatus())){ + log.info("此项目 【{}】 审核通过",projectRes.getProjectId()); + stateMachineUtils.pass(project); + project.setUpdateOn(LocalDateTime.now()); + projectService.updateById(project); + }else if(ProjectProvincialAuditStatusEnum.SUCCESS.getCode().equals(projectRes.getProjectStatus())){ + log.info("此项目 【{}】 审核不通过",projectRes.getProjectId()); + stateMachineUtils.reject(project); + project.setUpdateOn(LocalDateTime.now()); + projectService.updateById(project); + }else{ + log.info("此项目 【{}】 审核结果错误",projectRes.getProjectId()); + } + }catch (Exception e){ + log.error("项目审核信息获取异常 projectId:【" + project.getId() + "】 异常内容:" + e.getMessage()); + } + } + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java index 8865be1..d182e28 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java @@ -42,8 +42,8 @@ public class ProjectStatusFlowTask { @Scheduled(cron = "0 */1 * * * ?") public void statusFlow() throws UnknownHostException { - //测试暂时用自己电脑HOST - if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { + //测试暂时用自己207 + if (TaskContant.Host.HOST_207.equals(InetAddress.getLocalHost().getHostName())) { //1. 定时取 项目暂存表的数据 去进行状态继续流转 List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) .eq(ProjectStaging::getDead,Boolean.FALSE) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java index 0e81153..7fc1bc3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java @@ -46,10 +46,10 @@ public class WorkNoticeFlowTask { private final INdWorkNoticeStagingService workNoticeStagingService; private final ZwddClient zwddClient; - // @Scheduled(cron = "0 */1 * * * ?") + @Scheduled(cron = "0 */1 * * * ?") public void statusFlow() throws UnknownHostException { //测试暂时用自己电脑HOST - if (TaskContant.Host.HOST_CMM.equals(InetAddress.getLocalHost().getHostName())) { + if (TaskContant.Host.HOST_207.equals(InetAddress.getLocalHost().getHostName())) { //1. 定时取 工作通知暂存表的数据进行发送 List stagingList = workNoticeStagingService.list(Wrappers.lambdaQuery(WorkNoticeStaging.class) .eq(WorkNoticeStaging::getDead, Boolean.FALSE)