diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index 056343a..f5d3233 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -255,6 +255,12 @@ public class DingInfoPullController { return "推送失败"; } + @ApiOperation(value = "同步企业信息 条线", notes = "同步企业信息 条线") + @GetMapping("/synchronouOrgBiz") + public String synchronouOrgBiz() { + return procDefManage.synchronouOrgBiz(); + } + public static Workbook readExcel(InputStream is, String extString){ Workbook wb = null; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java index 60acd33..6d5ca27 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java @@ -4,11 +4,14 @@ import cn.hutool.core.util.IdUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; +import com.ningdatech.basic.model.GenericResult; import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.organization.constants.ProcDefContant; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; import com.wflow.bean.entity.WflowOrgModelHistorys; import com.wflow.bean.entity.WflowOrgModels; import com.wflow.enums.ProcessDefTypeEnum; @@ -16,6 +19,7 @@ import com.wflow.service.OrgProcdefHistoryService; import com.wflow.service.OrgProcdefService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import java.time.LocalDateTime; @@ -38,6 +42,8 @@ public class ProcDefManage { private final OrgProcdefHistoryService orgProcdefHistoryService; + private final ZwddClient zwddClient; + /** * 初始化 单位配置 * @return @@ -140,4 +146,21 @@ public class ProcDefManage { return "初始化成功"; } + + public String synchronouOrgBiz() { + List orgs = organizationService.list(); + //同步所有的 企业条线 + for(DingOrganization org : orgs){ + GenericResult organization = zwddClient.getOrganizationByCode(org.getOrganizationCode()); + if(organization.isSuccess()){ + DingOrgInfoDTO data = organization.getData(); + String businessStripCodes = data.getBusinessStripCodes(); + if(StringUtils.isNotBlank(businessStripCodes)){ + org.setBusinessStripCodes(businessStripCodes); + organizationService.updateById(org); + } + } + } + return "更新完成"; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java index 10baa5e..6908a4e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java @@ -10,6 +10,7 @@ import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.common.util.ExcelExportStyle; @@ -154,6 +155,32 @@ public class ProjectRenewalFundManage { declaration.setUpdateOn(LocalDateTime.now()); } BeanUtils.copyProperties(dto,declaration); + + //有2个条件要判断 续建资金 + if(Objects.isNull(dto.getId())){ + //1. 如果有审核中的 是不能继续申请的 + long pendingCount = projectRenewalFundDeclarationService.count(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, projectId) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); + VUtils.isTrue(pendingCount > 0L).throwMessage("当前有在审核的续建项目 不能再申请了"); + + //2.是要当前最新资金的下年度 才能申请 + VUtils.isTrue(Objects.isNull(dto.getProjectYear())).throwMessage("新建的续建项目信息 年度不能为空"); + ProjectRenewalFundDeclaration lastRenewalFund = projectRenewalFundDeclarationService.getOne(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, projectId) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus,ProjectRenewalApprovalStatusEnum.PASS.name()) + .orderByDesc(ProjectRenewalFundDeclaration::getProjectYear) + .last(BizConst.LIMIT_1)); + //如果没有续建资金信息 就要比 当前项目的年度要大 + if(Objects.isNull(lastRenewalFund)){ + VUtils.isTrue(project.getProjectYear() >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + }else{ + VUtils.isTrue(lastRenewalFund.getProjectYear() >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + } + } + declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); declaration.setRegionCode(project.getAreaCode()); declaration.setOrgCode(project.getBuildOrgCode());