@@ -73,10 +73,6 @@ public class DeclaredProjectHelper { | |||||
public void checkAmount(ProjectDTO projectInfo) { | public void checkAmount(ProjectDTO projectInfo) { | ||||
if (Objects.nonNull(projectInfo.getDeclareAmount())) { | if (Objects.nonNull(projectInfo.getDeclareAmount())) { | ||||
BigDecimal declareAmount = projectInfo.getDeclareAmount(); | BigDecimal declareAmount = projectInfo.getDeclareAmount(); | ||||
BigDecimal totalAmount = getTotalDeclaredAmount(projectInfo); | |||||
if (declareAmount.compareTo(totalAmount) != 0) { | |||||
throw BizException.wrap("申报总金额【%s】 不等于其它申报金额【%s】", declareAmount, totalAmount); | |||||
} | |||||
//判断 年度计划金额 如果开着的话 | //判断 年度计划金额 如果开着的话 | ||||
if (CollUtil.isEmpty(projectInfo.getPaymentPlanList())) { | if (CollUtil.isEmpty(projectInfo.getPaymentPlanList())) { | ||||
return; | return; | ||||
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Assert; | import com.baomidou.mybatisplus.core.toolkit.Assert; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.hz.pm.api.common.enumeration.BoolDisplayEnum; | |||||
import com.hz.pm.api.common.enumeration.CommonEnum; | import com.hz.pm.api.common.enumeration.CommonEnum; | ||||
import com.hz.pm.api.common.enumeration.ProjectProcessType; | import com.hz.pm.api.common.enumeration.ProjectProcessType; | ||||
import com.hz.pm.api.common.helper.UserInfoHelper; | import com.hz.pm.api.common.helper.UserInfoHelper; | ||||
@@ -58,7 +59,6 @@ import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.function.VUtils; | import com.ningdatech.basic.function.VUtils; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.wflow.bean.entity.WflowModels; | import com.wflow.bean.entity.WflowModels; | ||||
import com.wflow.workflow.bean.dto.OrgInfoDTO; | import com.wflow.workflow.bean.dto.OrgInfoDTO; | ||||
import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | ||||
@@ -76,7 +76,6 @@ import java.time.LocalDateTime; | |||||
import java.util.*; | import java.util.*; | ||||
import java.util.concurrent.atomic.AtomicInteger; | import java.util.concurrent.atomic.AtomicInteger; | ||||
import java.util.function.BiConsumer; | import java.util.function.BiConsumer; | ||||
import java.util.function.Function; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
@@ -118,6 +117,9 @@ public class DeclaredProjectManage { | |||||
user.getMhUnitId()); | user.getMhUnitId()); | ||||
ProjectDTO reqProj = req.getProjectInfo(); | ProjectDTO reqProj = req.getProjectInfo(); | ||||
if (reqProj.getIsTemporaryAugment() == null) { | |||||
reqProj.setIsTemporaryAugment(1); | |||||
} | |||||
reqProj.setBuildOrgCode(user.getMhUnitIdStr()); | reqProj.setBuildOrgCode(user.getMhUnitIdStr()); | ||||
reqProj.setBuildOrgName(user.getMhUnitName()); | reqProj.setBuildOrgName(user.getMhUnitName()); | ||||
@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
import java.util.List; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* MhSystemReplaceController | * MhSystemReplaceController | ||||
@@ -35,6 +37,12 @@ public class MhSystemReplaceController { | |||||
return mhSystemReplaceManage.page(req); | return mhSystemReplaceManage.page(req); | ||||
} | } | ||||
@GetMapping("/option") | |||||
@ApiOperation("绑定改造情况下拉") | |||||
public List<MhSystemReplaceInfoVO> option(MhSystemReplaceReq req) { | |||||
return mhSystemReplaceManage.option(req); | |||||
} | |||||
@GetMapping("/sync") | @GetMapping("/sync") | ||||
@ApiOperation("同步系统改造计划数据") | @ApiOperation("同步系统改造计划数据") | ||||
@WebLog("同步系统改造计划数据") | @WebLog("同步系统改造计划数据") | ||||
@@ -52,4 +52,6 @@ public class ProjectGovSystemReplaceInfos implements Serializable { | |||||
@TableField(fill = FieldFill.INSERT) | @TableField(fill = FieldFill.INSERT) | ||||
private LocalDateTime createOn; | private LocalDateTime createOn; | ||||
private String sourceSystemId; | |||||
} | } |
@@ -27,9 +27,6 @@ public class QxProjectSystemReplaceInfos implements Serializable { | |||||
@TableId(value = "ID", type = IdType.AUTO) | @TableId(value = "ID", type = IdType.AUTO) | ||||
private Long id; | private Long id; | ||||
@ApiModelProperty("源系统ID") | |||||
private String sourceSystemIds; | |||||
@ApiModelProperty("源系统名称") | @ApiModelProperty("源系统名称") | ||||
private String sourceSystemNames; | private String sourceSystemNames; | ||||
@@ -0,0 +1,31 @@ | |||||
package com.hz.pm.api.projectlib.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 2024-08-31 | |||||
*/ | |||||
@Data | |||||
@TableName("QX_PROJECT_SYSTEM_REPLACE_INFOS_RELATION") | |||||
@ApiModel(value = "QxProjectSystemReplaceInfosRelation对象") | |||||
public class QxProjectSystemReplaceInfosRelation { | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
private String sourceSystemId; | |||||
private Long replaceInfosId; | |||||
private Long projectId; | |||||
} |
@@ -3,24 +3,29 @@ package com.hz.pm.api.projectlib.manage; | |||||
import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||
import cn.hutool.core.util.StrUtil; | import cn.hutool.core.util.StrUtil; | ||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.hz.pm.api.common.model.constant.MhUnitConst; | import com.hz.pm.api.common.model.constant.MhUnitConst; | ||||
import com.hz.pm.api.external.MhApiClient; | import com.hz.pm.api.external.MhApiClient; | ||||
import com.hz.pm.api.projectlib.entity.MhSystemReplaceInfo; | |||||
import com.hz.pm.api.projectlib.entity.*; | |||||
import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoDTO; | import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoDTO; | ||||
import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoVO; | import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoVO; | ||||
import com.hz.pm.api.projectlib.model.entity.Project; | |||||
import com.hz.pm.api.projectlib.model.req.MhSystemReplaceReq; | import com.hz.pm.api.projectlib.model.req.MhSystemReplaceReq; | ||||
import com.hz.pm.api.projectlib.service.IMhSystemReplaceInfoService; | |||||
import com.hz.pm.api.projectlib.service.*; | |||||
import com.hz.pm.api.user.helper.MhUnitCache; | import com.hz.pm.api.user.helper.MhUnitCache; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.Collections; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
@@ -38,6 +43,11 @@ public class MhSystemReplaceManage { | |||||
private final IMhSystemReplaceInfoService mhSystemReplaceInfoService; | private final IMhSystemReplaceInfoService mhSystemReplaceInfoService; | ||||
private final MhUnitCache mhUnitCache; | private final MhUnitCache mhUnitCache; | ||||
private final MhApiClient mhApiClient; | private final MhApiClient mhApiClient; | ||||
private final IQxProjectService qxProjectService; | |||||
private final IProjectGovSystemReplaceInfosService projectGovSystemReplaceInfosService; | |||||
private final IQxProjectSystemReplaceInfosService qxProjectSystemReplaceInfosService; | |||||
private final IProjectService projectService; | |||||
private final IQxProjectSystemReplaceInfosRelationService qxProjectSystemReplaceInfosRelationService; | |||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public synchronized void syncMhSystemReplaceInfo() { | public synchronized void syncMhSystemReplaceInfo() { | ||||
@@ -70,6 +80,38 @@ public class MhSystemReplaceManage { | |||||
} | } | ||||
public PageVo<MhSystemReplaceInfoVO> page(MhSystemReplaceReq req) { | public PageVo<MhSystemReplaceInfoVO> page(MhSystemReplaceReq req) { | ||||
LambdaQueryWrapper<MhSystemReplaceInfo> query = buildMhSystemReplaceInfoQuery(req); | |||||
if (req.getBuildOrgCode() != null && req.getBuildOrgCode() != MhUnitConst.ROOT_UNIT_ID) { | |||||
query.in(MhSystemReplaceInfo::getBuildOrgCode, mhUnitCache.getViewChildIdsRecursion(req.getBuildOrgCode())); | |||||
} | |||||
Page<MhSystemReplaceInfo> page = mhSystemReplaceInfoService.page(req.page(), query); | |||||
if (page.getTotal() == 0) { | |||||
return PageVo.empty(); | |||||
} | |||||
List<MhSystemReplaceInfoVO> data = BeanUtil.copyToList(page.getRecords(), MhSystemReplaceInfoVO.class); | |||||
List<String> sourceSystemIds = CollUtils.fieldList(data, MhSystemReplaceInfoVO::getId); | |||||
Map<String, Project> projectMap = listProjectMapBySourceSystemIds(sourceSystemIds); | |||||
Map<String, QxProject> qxProjectMap = listQxProjectBySourceSystemIds(sourceSystemIds); | |||||
for (MhSystemReplaceInfoVO datum : data) { | |||||
String sourceSystemId = datum.getId(); | |||||
Project project = projectMap.get(sourceSystemId); | |||||
if (project != null) { | |||||
datum.setIsCountyProject(Boolean.FALSE); | |||||
datum.setProjectId(project.getId()); | |||||
datum.setProjectName(project.getProjectName()); | |||||
} else { | |||||
QxProject qxProject = qxProjectMap.get(sourceSystemId); | |||||
if (qxProject != null) { | |||||
datum.setIsCountyProject(Boolean.TRUE); | |||||
datum.setProjectId(qxProject.getId()); | |||||
datum.setProjectName(qxProject.getProjectName()); | |||||
} | |||||
} | |||||
} | |||||
return PageVo.of(data, page.getTotal()); | |||||
} | |||||
private static LambdaQueryWrapper<MhSystemReplaceInfo> buildMhSystemReplaceInfoQuery(MhSystemReplaceReq req) { | |||||
LambdaQueryWrapper<MhSystemReplaceInfo> query = Wrappers.lambdaQuery(MhSystemReplaceInfo.class) | LambdaQueryWrapper<MhSystemReplaceInfo> query = Wrappers.lambdaQuery(MhSystemReplaceInfo.class) | ||||
.like(StrUtil.isNotBlank(req.getBuildOrgName()), MhSystemReplaceInfo::getBuildOrgName, req.getBuildOrgName()) | .like(StrUtil.isNotBlank(req.getBuildOrgName()), MhSystemReplaceInfo::getBuildOrgName, req.getBuildOrgName()) | ||||
.and(StrUtil.isNotBlank(req.getSystemName()), q1 -> q1.like(MhSystemReplaceInfo::getSourceName, req.getSystemName()) | .and(StrUtil.isNotBlank(req.getSystemName()), q1 -> q1.like(MhSystemReplaceInfo::getSourceName, req.getSystemName()) | ||||
@@ -90,15 +132,64 @@ public class MhSystemReplaceManage { | |||||
} else { | } else { | ||||
query.orderByDesc(MhSystemReplaceInfo::getPlanFinishDate); | query.orderByDesc(MhSystemReplaceInfo::getPlanFinishDate); | ||||
} | } | ||||
return query; | |||||
} | |||||
public List<MhSystemReplaceInfoVO> option(MhSystemReplaceReq req) { | |||||
LambdaQueryWrapper<MhSystemReplaceInfo> query = buildMhSystemReplaceInfoQuery(req); | |||||
if (req.getBuildOrgCode() != null && req.getBuildOrgCode() != MhUnitConst.ROOT_UNIT_ID) { | if (req.getBuildOrgCode() != null && req.getBuildOrgCode() != MhUnitConst.ROOT_UNIT_ID) { | ||||
query.in(MhSystemReplaceInfo::getBuildOrgCode, mhUnitCache.getViewChildIdsRecursion(req.getBuildOrgCode())); | query.in(MhSystemReplaceInfo::getBuildOrgCode, mhUnitCache.getViewChildIdsRecursion(req.getBuildOrgCode())); | ||||
} | } | ||||
Page<MhSystemReplaceInfo> page = mhSystemReplaceInfoService.page(req.page(), query); | |||||
if (page.getTotal() == 0) { | |||||
return PageVo.empty(); | |||||
query.notExists("select 1 from qx_project_system_replace_infos_relation qpr " + | |||||
"where qpr.source_system_id = mh_system_replace_info.id"); | |||||
query.notExists("select 1 from nd_project_gov_system_replace_infos npr " + | |||||
"where npr.source_system_id = mh_system_replace_info.id"); | |||||
List<MhSystemReplaceInfo> page = mhSystemReplaceInfoService.list(query); | |||||
return BeanUtil.copyToList(page, MhSystemReplaceInfoVO.class); | |||||
} | |||||
private Map<String, Project> listProjectMapBySourceSystemIds(List<String> sourceSystemIds) { | |||||
Wrapper<ProjectGovSystemReplaceInfos> pgsriQuery = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class) | |||||
.select(ProjectGovSystemReplaceInfos::getProjectCode, ProjectGovSystemReplaceInfos::getSourceSystemId) | |||||
.in(ProjectGovSystemReplaceInfos::getSourceSystemId, sourceSystemIds); | |||||
List<ProjectGovSystemReplaceInfos> systemReplaceInfos = projectGovSystemReplaceInfosService.list(pgsriQuery); | |||||
if (CollUtil.isEmpty(systemReplaceInfos)) { | |||||
return Collections.emptyMap(); | |||||
} | } | ||||
List<MhSystemReplaceInfoVO> data = BeanUtil.copyToList(page.getRecords(), MhSystemReplaceInfoVO.class); | |||||
return PageVo.of(data, page.getTotal()); | |||||
Map<String, String> replaceInfoMap = CollUtils.listToMap(systemReplaceInfos, | |||||
ProjectGovSystemReplaceInfos::getSourceSystemId, ProjectGovSystemReplaceInfos::getProjectCode); | |||||
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) | |||||
.in(Project::getProjectCode, replaceInfoMap.values()) | |||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.select(Project::getProjectCode, Project::getId, Project::getProjectName); | |||||
List<Project> projects = projectService.list(query); | |||||
if (CollUtil.isEmpty(projects)) { | |||||
return Collections.emptyMap(); | |||||
} | |||||
Map<String, Project> projectMap = CollUtils.listToMap(projects, Project::getProjectCode); | |||||
return CollUtils.listToMap(replaceInfoMap.entrySet(), Map.Entry::getKey, w -> projectMap.get(w.getValue())); | |||||
} | } | ||||
private Map<String, QxProject> listQxProjectBySourceSystemIds(List<String> sourceSystemIds) { | |||||
Wrapper<QxProjectSystemReplaceInfosRelation> relationQuery = Wrappers.lambdaQuery(QxProjectSystemReplaceInfosRelation.class) | |||||
.select(QxProjectSystemReplaceInfosRelation::getProjectId, QxProjectSystemReplaceInfosRelation::getSourceSystemId) | |||||
.in(QxProjectSystemReplaceInfosRelation::getSourceSystemId, sourceSystemIds); | |||||
List<QxProjectSystemReplaceInfosRelation> relations = qxProjectSystemReplaceInfosRelationService.list(relationQuery); | |||||
if (CollUtil.isEmpty(relations)) { | |||||
return Collections.emptyMap(); | |||||
} | |||||
Map<String, Long> relationMap = CollUtils.listToMap(relations, QxProjectSystemReplaceInfosRelation::getSourceSystemId, | |||||
QxProjectSystemReplaceInfosRelation::getProjectId); | |||||
Wrapper<QxProject> projectQuery = Wrappers.lambdaQuery(QxProject.class) | |||||
.select(QxProject::getId, QxProject::getProjectName) | |||||
.in(QxProject::getId, relationMap.values()); | |||||
List<QxProject> qxProjects = qxProjectService.list(projectQuery); | |||||
if (CollUtil.isEmpty(qxProjects)) { | |||||
return Collections.emptyMap(); | |||||
} | |||||
Map<Long, QxProject> qxProjectMap = CollUtils.listToMap(qxProjects, QxProject::getId); | |||||
return CollUtils.listToMap(relationMap.entrySet(), Map.Entry::getKey, w -> qxProjectMap.get(w.getValue())); | |||||
} | |||||
} | } |
@@ -8,10 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.hz.pm.api.common.util.BizUtils; | import com.hz.pm.api.common.util.BizUtils; | ||||
import com.hz.pm.api.projectlib.entity.MhSystemReplaceInfo; | |||||
import com.hz.pm.api.projectlib.entity.QxProject; | |||||
import com.hz.pm.api.projectlib.entity.QxProjectSystemReplaceInfos; | |||||
import com.hz.pm.api.projectlib.entity.QxPurchase; | |||||
import com.hz.pm.api.projectlib.entity.*; | |||||
import com.hz.pm.api.projectlib.model.dto.QxProjectSystemReplaceInfosDTO; | import com.hz.pm.api.projectlib.model.dto.QxProjectSystemReplaceInfosDTO; | ||||
import com.hz.pm.api.projectlib.model.enumeration.MhSystemReplaceType; | import com.hz.pm.api.projectlib.model.enumeration.MhSystemReplaceType; | ||||
import com.hz.pm.api.projectlib.model.enumeration.QxProjectStatus; | import com.hz.pm.api.projectlib.model.enumeration.QxProjectStatus; | ||||
@@ -20,10 +17,7 @@ import com.hz.pm.api.projectlib.model.vo.QxProjectDetailVO; | |||||
import com.hz.pm.api.projectlib.model.vo.QxProjectSystemReplaceInfosVO; | import com.hz.pm.api.projectlib.model.vo.QxProjectSystemReplaceInfosVO; | ||||
import com.hz.pm.api.projectlib.model.vo.QxProjectVO; | import com.hz.pm.api.projectlib.model.vo.QxProjectVO; | ||||
import com.hz.pm.api.projectlib.model.vo.QxPurchaseVO; | import com.hz.pm.api.projectlib.model.vo.QxPurchaseVO; | ||||
import com.hz.pm.api.projectlib.service.IMhSystemReplaceInfoService; | |||||
import com.hz.pm.api.projectlib.service.IQxProjectService; | |||||
import com.hz.pm.api.projectlib.service.IQxProjectSystemReplaceInfosService; | |||||
import com.hz.pm.api.projectlib.service.IQxPurchaseService; | |||||
import com.hz.pm.api.projectlib.service.*; | |||||
import com.hz.pm.api.user.helper.MhUnitQueryHelper; | import com.hz.pm.api.user.helper.MhUnitQueryHelper; | ||||
import com.hz.pm.api.user.helper.MhUnitQueryHelper.UnitQueryState; | import com.hz.pm.api.user.helper.MhUnitQueryHelper.UnitQueryState; | ||||
import com.hz.pm.api.user.util.LoginUserUtil; | import com.hz.pm.api.user.util.LoginUserUtil; | ||||
@@ -55,6 +49,7 @@ public class QxProjectManage { | |||||
private final IQxProjectService qxProjectService; | private final IQxProjectService qxProjectService; | ||||
private final IMhSystemReplaceInfoService mhSystemReplaceInfoService; | private final IMhSystemReplaceInfoService mhSystemReplaceInfoService; | ||||
private final IQxProjectSystemReplaceInfosService qxProjectSystemReplaceInfosService; | private final IQxProjectSystemReplaceInfosService qxProjectSystemReplaceInfosService; | ||||
private final IQxProjectSystemReplaceInfosRelationService qxProjectSystemReplaceInfosRelationService; | |||||
private final IQxPurchaseService qxPurchaseService; | private final IQxPurchaseService qxPurchaseService; | ||||
private void checkExistProject(String projectName, Long buildOrgCode) { | private void checkExistProject(String projectName, Long buildOrgCode) { | ||||
@@ -80,6 +75,7 @@ public class QxProjectManage { | |||||
w -> MhSystemReplaceType.IT.eq(w.getReplaceType())); | w -> MhSystemReplaceType.IT.eq(w.getReplaceType())); | ||||
List<QxProjectSystemReplaceInfos> projectSystemReplaceInfos = new ArrayList<>(); | List<QxProjectSystemReplaceInfos> projectSystemReplaceInfos = new ArrayList<>(); | ||||
List<MhSystemReplaceInfo> itReplaceInfos = replaceInfosMap.get(true); | List<MhSystemReplaceInfo> itReplaceInfos = replaceInfosMap.get(true); | ||||
List<String> tmpSourceSystemIds = new ArrayList<>(); | |||||
if (CollUtil.isNotEmpty(itReplaceInfos)) { | if (CollUtil.isNotEmpty(itReplaceInfos)) { | ||||
Map<String, List<MhSystemReplaceInfo>> group = CollUtils.group(itReplaceInfos, MhSystemReplaceInfo::getTargetName); | Map<String, List<MhSystemReplaceInfo>> group = CollUtils.group(itReplaceInfos, MhSystemReplaceInfo::getTargetName); | ||||
for (Map.Entry<String, List<MhSystemReplaceInfo>> entry : group.entrySet()) { | for (Map.Entry<String, List<MhSystemReplaceInfo>> entry : group.entrySet()) { | ||||
@@ -89,7 +85,7 @@ public class QxProjectManage { | |||||
item.setReplaceType(value.get(0).getReplaceType()); | item.setReplaceType(value.get(0).getReplaceType()); | ||||
item.setTargetSystemName(value.get(0).getTargetName()); | item.setTargetSystemName(value.get(0).getTargetName()); | ||||
item.setSourceSystemNames(CollUtils.joinByComma(value, MhSystemReplaceInfo::getSourceName)); | item.setSourceSystemNames(CollUtils.joinByComma(value, MhSystemReplaceInfo::getSourceName)); | ||||
item.setSourceSystemIds(CollUtils.joinByComma(value, MhSystemReplaceInfo::getId)); | |||||
tmpSourceSystemIds.add(CollUtils.joinByComma(value, MhSystemReplaceInfo::getId)); | |||||
projectSystemReplaceInfos.add(item); | projectSystemReplaceInfos.add(item); | ||||
} | } | ||||
} | } | ||||
@@ -101,12 +97,22 @@ public class QxProjectManage { | |||||
item.setReplaceType(mhSystemReplaceInfo.getReplaceType()); | item.setReplaceType(mhSystemReplaceInfo.getReplaceType()); | ||||
item.setTargetSystemName(mhSystemReplaceInfo.getTargetName()); | item.setTargetSystemName(mhSystemReplaceInfo.getTargetName()); | ||||
item.setSourceSystemNames(mhSystemReplaceInfo.getSourceName()); | item.setSourceSystemNames(mhSystemReplaceInfo.getSourceName()); | ||||
item.setSourceSystemIds(mhSystemReplaceInfo.getId()); | |||||
tmpSourceSystemIds.add(mhSystemReplaceInfo.getId()); | |||||
projectSystemReplaceInfos.add(item); | projectSystemReplaceInfos.add(item); | ||||
} | } | ||||
} | } | ||||
if (CollUtil.isNotEmpty(projectSystemReplaceInfos)) { | if (CollUtil.isNotEmpty(projectSystemReplaceInfos)) { | ||||
qxProjectSystemReplaceInfosService.saveBatch(projectSystemReplaceInfos); | qxProjectSystemReplaceInfosService.saveBatch(projectSystemReplaceInfos); | ||||
List<QxProjectSystemReplaceInfosRelation> relations = new ArrayList<>(); | |||||
for (int i = 0; i < tmpSourceSystemIds.size(); i++) { | |||||
QxProjectSystemReplaceInfos replaceInfos = projectSystemReplaceInfos.get(i); | |||||
QxProjectSystemReplaceInfosRelation relation = new QxProjectSystemReplaceInfosRelation(); | |||||
relation.setSourceSystemId(tmpSourceSystemIds.get(i)); | |||||
relation.setReplaceInfosId(replaceInfos.getId()); | |||||
relation.setProjectId(project.getId()); | |||||
relations.add(relation); | |||||
} | |||||
qxProjectSystemReplaceInfosRelationService.saveBatch(relations); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -0,0 +1,16 @@ | |||||
package com.hz.pm.api.projectlib.mapper; | |||||
import com.hz.pm.api.projectlib.entity.QxProjectSystemReplaceInfosRelation; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 2024-08-31 | |||||
*/ | |||||
public interface QxProjectSystemReplaceInfosRelationMapper extends BaseMapper<QxProjectSystemReplaceInfosRelation> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.hz.pm.api.projectlib.mapper.QxProjectSystemReplaceInfosRelationMapper"> | |||||
</mapper> |
@@ -51,4 +51,13 @@ public class MhSystemReplaceInfoVO { | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
private LocalDateTime actualFinishDate; | private LocalDateTime actualFinishDate; | ||||
@ApiModelProperty("是否区县项目") | |||||
private Boolean isCountyProject; | |||||
@ApiModelProperty("项目名称") | |||||
private String projectName; | |||||
@ApiModelProperty("项目ID") | |||||
private Long projectId; | |||||
} | } |
@@ -26,13 +26,13 @@ public enum GovSystemReplaceTypeEnum { | |||||
INFRASTRUCTURE("基础设施", 3, null), | INFRASTRUCTURE("基础设施", 3, null), | ||||
UNIFIED_CONSTRUCTION_APPLICATION("统建应用", 4, null), | UNIFIED_CONSTRUCTION_APPLICATION("统建应用", 4, null), | ||||
NEW_BUILT("新建", 5, null), | NEW_BUILT("新建", 5, null), | ||||
SUSPEND("暂缓", 6, null); | |||||
SUSPEND("暂缓", 6, null), | |||||
NATURAL_ELIMINATION("自然淘汰", 7, MhSystemReplaceType.NE); | |||||
private final String val; | private final String val; | ||||
private final Integer code; | private final Integer code; | ||||
private final MhSystemReplaceType mhReplaceType; | private final MhSystemReplaceType mhReplaceType; | ||||
public static Optional<GovSystemReplaceTypeEnum> get(Integer code) { | public static Optional<GovSystemReplaceTypeEnum> get(Integer code) { | ||||
return Arrays.stream(values()) | return Arrays.stream(values()) | ||||
.filter(w -> w.getCode().equals(code)) | .filter(w -> w.getCode().equals(code)) | ||||
@@ -0,0 +1,16 @@ | |||||
package com.hz.pm.api.projectlib.service; | |||||
import com.hz.pm.api.projectlib.entity.QxProjectSystemReplaceInfosRelation; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 2024-08-31 | |||||
*/ | |||||
public interface IQxProjectSystemReplaceInfosRelationService extends IService<QxProjectSystemReplaceInfosRelation> { | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.hz.pm.api.projectlib.service.impl; | |||||
import com.hz.pm.api.projectlib.entity.QxProjectSystemReplaceInfosRelation; | |||||
import com.hz.pm.api.projectlib.mapper.QxProjectSystemReplaceInfosRelationMapper; | |||||
import com.hz.pm.api.projectlib.service.IQxProjectSystemReplaceInfosRelationService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 2024-08-31 | |||||
*/ | |||||
@Service | |||||
public class QxProjectSystemReplaceInfosRelationServiceImpl extends ServiceImpl<QxProjectSystemReplaceInfosRelationMapper, QxProjectSystemReplaceInfosRelation> implements IQxProjectSystemReplaceInfosRelationService { | |||||
} |
@@ -0,0 +1,44 @@ | |||||
package com.hz.pm.api.projectlib; | |||||
import com.hz.pm.api.AppTests; | |||||
import com.hz.pm.api.projectlib.entity.QxProjectSystemReplaceInfos; | |||||
import com.hz.pm.api.projectlib.entity.QxProjectSystemReplaceInfosRelation; | |||||
import com.hz.pm.api.projectlib.service.IQxProjectSystemReplaceInfosRelationService; | |||||
import com.hz.pm.api.projectlib.service.IQxProjectSystemReplaceInfosService; | |||||
import org.junit.Test; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* ProjectTests | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 21:00 2024/8/31 | |||||
*/ | |||||
public class ProjectTest extends AppTests { | |||||
@Autowired | |||||
private IQxProjectSystemReplaceInfosRelationService qxProjectSystemReplaceInfosRelationService; | |||||
@Autowired | |||||
private IQxProjectSystemReplaceInfosService qxProjectSystemReplaceInfosService; | |||||
@Test | |||||
public void test() { | |||||
List<QxProjectSystemReplaceInfos> list = qxProjectSystemReplaceInfosService.list(); | |||||
for (QxProjectSystemReplaceInfos infos : list) { | |||||
for (String s : infos.getSourceSystemIds().split(",")) { | |||||
QxProjectSystemReplaceInfosRelation relation = new QxProjectSystemReplaceInfosRelation(); | |||||
relation.setProjectId(infos.getProjectId()); | |||||
relation.setReplaceInfosId(infos.getId()); | |||||
relation.setSourceSystemId(s); | |||||
qxProjectSystemReplaceInfosRelationService.save(relation); | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -217,11 +217,17 @@ mh-system-replace-sync: | |||||
thread-pool-util: | thread-pool-util: | ||||
request: | request: | ||||
core-pool-size: 5 | |||||
max-pool-size: 10 | |||||
core-pool-size: 2 | |||||
max-pool-size: 4 | |||||
queue-capacity: 100 | queue-capacity: 100 | ||||
keep-alive-seconds: 120 | keep-alive-seconds: 120 | ||||
thread-name-prefix: request-executor- | thread-name-prefix: request-executor- | ||||
scheduler: | scheduler: | ||||
core-pool-size: 2 | core-pool-size: 2 | ||||
thread-name-prefix: scheduler-executor- | |||||
thread-name-prefix: scheduler-executor- | |||||
random-invite: | |||||
thread-pool-properties: | |||||
core-pool-size: 2 | |||||
thread-name-prefix: expert-invite-executor- | |||||
early-warning-without-submit: | |||||
open: true |
@@ -55,7 +55,7 @@ public class CodeGen { | |||||
} | } | ||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
generate("WendyYang", "projectlib", PATH_YYD, "QX_PROJECT_SYSTEM_REPLACE_INFOS"); | |||||
generate("WendyYang", "projectlib", PATH_YYD, "QX_PROJECT_SYSTEM_REPLACE_INFOS_RELATION"); | |||||
} | } | ||||
} | } |