@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSON; | |||||
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.google.common.collect.Lists; | |||||
import com.google.common.collect.Maps; | import com.google.common.collect.Maps; | ||||
import com.hz.pm.api.common.helper.RegionCacheHelper; | import com.hz.pm.api.common.helper.RegionCacheHelper; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
@@ -29,10 +28,8 @@ import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||||
import com.hz.pm.api.projectdeclared.service.IOperationService; | import com.hz.pm.api.projectdeclared.service.IOperationService; | ||||
import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; | import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; | ||||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | import com.hz.pm.api.projectdeclared.service.IPurchaseService; | ||||
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; | |||||
import com.hz.pm.api.projectdeclared.utils.ProjectCodeGenUtil; | |||||
import com.hz.pm.api.projectlib.model.entity.*; | import com.hz.pm.api.projectlib.model.entity.*; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeEnum; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | import com.hz.pm.api.projectlib.model.req.ProjectListReq; | ||||
import com.hz.pm.api.projectlib.service.*; | import com.hz.pm.api.projectlib.service.*; | ||||
import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; | import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; | ||||
@@ -106,7 +103,7 @@ public class GovProjectCollectionManage { | |||||
private final IGovBizProjectProcureService procureService; | private final IGovBizProjectProcureService procureService; | ||||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | |||||
private final ProjectCodeGenUtil projectCodeGenUtil; | |||||
private final IGovBizProjectDraftService draftService; | private final IGovBizProjectDraftService draftService; | ||||
@@ -682,7 +679,7 @@ public class GovProjectCollectionManage { | |||||
//如果是新增的话 要生成 项目编号 | //如果是新增的话 要生成 项目编号 | ||||
if (StringUtils.isBlank(baseProjId) || DRAFT.equals(baseProjId)) { | if (StringUtils.isBlank(baseProjId) || DRAFT.equals(baseProjId)) { | ||||
baseProjId = generateProjectCodeUtil.generateProjectCode(req); | |||||
baseProjId = projectCodeGenUtil.generateProjectCode(req); | |||||
saveBase.setBaseProjId(baseProjId); | saveBase.setBaseProjId(baseProjId); | ||||
} | } | ||||
@@ -882,7 +879,7 @@ public class GovProjectCollectionManage { | |||||
//如果是新增的话 要生成 项目编号 | //如果是新增的话 要生成 项目编号 | ||||
if (StringUtils.isBlank(baseProjId) || DRAFT.equals(baseProjId)) { | if (StringUtils.isBlank(baseProjId) || DRAFT.equals(baseProjId)) { | ||||
baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); | |||||
baseProjId = projectCodeGenUtil.generateProjectCode(saveDTO); | |||||
saveBase.setBaseProjId(baseProjId); | saveBase.setBaseProjId(baseProjId); | ||||
} | } | ||||
@@ -1757,7 +1754,7 @@ public class GovProjectCollectionManage { | |||||
GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); | GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); | ||||
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); | saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); | ||||
saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); | saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); | ||||
String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); | |||||
String newProjId = projectCodeGenUtil.generateProjectCode(saveDTO); | |||||
baseinfo.setBaseProjId(newProjId); | baseinfo.setBaseProjId(newProjId); | ||||
baseinfoService.updateById(baseinfo); | baseinfoService.updateById(baseinfo); | ||||
@@ -1820,7 +1817,7 @@ public class GovProjectCollectionManage { | |||||
GovOperationProjectSaveDTO saveDTO = new GovOperationProjectSaveDTO(); | GovOperationProjectSaveDTO saveDTO = new GovOperationProjectSaveDTO(); | ||||
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); | saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); | ||||
saveDTO.setBaseinfo(BeanUtil.copyProperties(operationBase, GovOperationProjectBaseinfoDTO.class)); | saveDTO.setBaseinfo(BeanUtil.copyProperties(operationBase, GovOperationProjectBaseinfoDTO.class)); | ||||
String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); | |||||
String newProjId = projectCodeGenUtil.generateProjectCode(saveDTO); | |||||
operationBase.setBaseProjId(newProjId); | operationBase.setBaseProjId(newProjId); | ||||
operationProjectBaseinfoService.updateById(operationBase); | operationProjectBaseinfoService.updateById(operationBase); | ||||
@@ -1,10 +1,9 @@ | |||||
package com.hz.pm.api.projectdeclared.utils; | package com.hz.pm.api.projectdeclared.utils; | ||||
import cn.hutool.core.lang.Assert; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.basic.function.VUtils; | |||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.model.constant.RegionConst; | import com.hz.pm.api.common.model.constant.RegionConst; | ||||
import com.hz.pm.api.gov.contants.BizProjectContant; | |||||
import com.hz.pm.api.gov.model.dto.*; | import com.hz.pm.api.gov.model.dto.*; | ||||
import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; | import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; | ||||
import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo; | import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo; | ||||
@@ -19,7 +18,7 @@ import lombok.RequiredArgsConstructor; | |||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.time.LocalDateTime; | |||||
import java.time.LocalDate; | |||||
import java.util.Objects; | import java.util.Objects; | ||||
/** | /** | ||||
@@ -30,23 +29,19 @@ import java.util.Objects; | |||||
*/ | */ | ||||
@Component | @Component | ||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class GenerateProjectCodeUtil { | |||||
public class ProjectCodeGenUtil { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final IGovBizProjectBaseinfoService baseinfoService; | private final IGovBizProjectBaseinfoService baseinfoService; | ||||
private final IGovOperationProjectBaseinfoService operationProjectBaseinfoService; | private final IGovOperationProjectBaseinfoService operationProjectBaseinfoService; | ||||
public String generateProjectCode(ProjectDTO project) { | public String generateProjectCode(ProjectDTO project) { | ||||
// 获取所属行政区划代码(9位) | |||||
// String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; | |||||
String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; | String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; | ||||
// 获取建设年度 (10-13) | // 获取建设年度 (10-13) | ||||
String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) | String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) | ||||
: String.valueOf(LocalDateTime.now().getYear()); | |||||
// 14-15 项目类型 | |||||
String projectType = project.getProjectType(); | |||||
: String.valueOf(LocalDate.now().getYear()); | |||||
// 16-20 项目序号00001 | // 16-20 项目序号00001 | ||||
String currentCode = areaCode + year + projectType; | |||||
String currentCode = areaCode + year; | |||||
// 16-20 项目序号00001 | // 16-20 项目序号00001 | ||||
//要查询 两边的项目序号 | //要查询 两边的项目序号 | ||||
Long max = getMaxProjectCode(currentCode); | Long max = getMaxProjectCode(currentCode); | ||||
@@ -56,15 +51,12 @@ public class GenerateProjectCodeUtil { | |||||
public String generateProjectCode(ProjectCollection project) { | public String generateProjectCode(ProjectCollection project) { | ||||
// 获取所属行政区划代码(9位) | // 获取所属行政区划代码(9位) | ||||
// String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; | |||||
String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; | String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; | ||||
// 获取建设年度 (10-13) | // 获取建设年度 (10-13) | ||||
String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) | String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) | ||||
: String.valueOf(LocalDateTime.now().getYear()); | |||||
// 14-15 项目类型 | |||||
String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType(); | |||||
: String.valueOf(LocalDate.now().getYear()); | |||||
// 16-20 项目序号00001 | // 16-20 项目序号00001 | ||||
String currentCode = areaCode + year + projectType; | |||||
String currentCode = areaCode + year; | |||||
// 16-20 项目序号00001 | // 16-20 项目序号00001 | ||||
//要查询 最大的项目编号 | //要查询 最大的项目编号 | ||||
Long max = getMaxProjectCode(currentCode); | Long max = getMaxProjectCode(currentCode); | ||||
@@ -75,20 +67,15 @@ public class GenerateProjectCodeUtil { | |||||
public String generateProjectCode(GovBizProjectSaveDTO dto) { | public String generateProjectCode(GovBizProjectSaveDTO dto) { | ||||
// 获取所属行政区划代码(9位) | // 获取所属行政区划代码(9位) | ||||
GovBizProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); | GovBizProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); | ||||
Assert.notNull(baseinfo, "没有项目基本信息 无法生成项目编号!"); | |||||
GovBizProjectApplyDTO apply = dto.getApply(); | GovBizProjectApplyDTO apply = dto.getApply(); | ||||
Assert.notNull(apply, "没有项目申报信息 无法生成项目编号!"); | |||||
VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); | |||||
VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); | |||||
// String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); | |||||
String areaCode = RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST; | String areaCode = RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST; | ||||
// 获取建设年度 (10-13) | // 获取建设年度 (10-13) | ||||
String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() | String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() | ||||
: String.valueOf(LocalDateTime.now().getYear()); | |||||
// 14-15 项目类型 | |||||
String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() : | |||||
BizProjectContant.ProjectCollection.IS_EFFECTIVE; | |||||
String currentCode = areaCode + year + projectType; | |||||
: String.valueOf(LocalDate.now().getYear()); | |||||
String currentCode = areaCode + year; | |||||
// 16-20 项目序号00001 | // 16-20 项目序号00001 | ||||
//要查询 最大的项目编号 | //要查询 最大的项目编号 | ||||
Long max = getMaxProjectCode(currentCode); | Long max = getMaxProjectCode(currentCode); | ||||
@@ -99,20 +86,15 @@ public class GenerateProjectCodeUtil { | |||||
public String generateProjectCode(GovOperationProjectSaveDTO dto) { | public String generateProjectCode(GovOperationProjectSaveDTO dto) { | ||||
// 获取所属行政区划代码(9位) | // 获取所属行政区划代码(9位) | ||||
GovOperationProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); | GovOperationProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); | ||||
Assert.notNull(baseinfo, "没有项目基本信息 无法生成项目编号!"); | |||||
GovBizProjectApplyDTO apply = dto.getApply(); | GovBizProjectApplyDTO apply = dto.getApply(); | ||||
Assert.notNull(apply, "没有项目申报信息 无法生成项目编号!"); | |||||
VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); | |||||
VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); | |||||
// String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); | |||||
String areaCode = RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST; | String areaCode = RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST; | ||||
// 获取建设年度 (10-13) | // 获取建设年度 (10-13) | ||||
String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() | String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() | ||||
: String.valueOf(LocalDateTime.now().getYear()); | |||||
// 14-15 项目类型 | |||||
String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() : | |||||
BizProjectContant.ProjectCollection.IS_EFFECTIVE; | |||||
String currentCode = areaCode + year + projectType; | |||||
: String.valueOf(LocalDate.now().getYear()); | |||||
String currentCode = areaCode + year; | |||||
// 16-20 项目序号00001 | // 16-20 项目序号00001 | ||||
//要查询 最大的项目编号 | //要查询 最大的项目编号 | ||||
Long max = getMaxProjectCode(currentCode); | Long max = getMaxProjectCode(currentCode); | ||||
@@ -120,7 +102,7 @@ public class GenerateProjectCodeUtil { | |||||
return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); | return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); | ||||
} | } | ||||
private Long getMaxProjectCode(String currentCode) { | |||||
private synchronized Long getMaxProjectCode(String currentCode) { | |||||
long max = 0L; | long max = 0L; | ||||
GovBizProjectBaseinfo baseMax = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | GovBizProjectBaseinfo baseMax = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | ||||
.like(GovBizProjectBaseinfo::getBaseProjId, currentCode) | .like(GovBizProjectBaseinfo::getBaseProjId, currentCode) | ||||
@@ -148,4 +130,5 @@ public class GenerateProjectCodeUtil { | |||||
max = max + 1; | max = max + 1; | ||||
return max; | return max; | ||||
} | } | ||||
} | } |
@@ -10,6 +10,7 @@ import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import org.springframework.web.multipart.MultipartFile; | |||||
import javax.validation.Valid; | import javax.validation.Valid; | ||||
@@ -53,5 +54,20 @@ public class MhProjectController { | |||||
declaredRecordManage.restartDeclaredRecord(req); | declaredRecordManage.restartDeclaredRecord(req); | ||||
} | } | ||||
@ApiOperation("初始化信产项目至项目库") | |||||
@GetMapping("/initProjectLib") | |||||
public void initMhProjectToProjectLib() { | |||||
declaredRecordManage.initMhProjectToProject(); | |||||
} | |||||
@GetMapping("/importReplaceSystemInfos") | |||||
public void importReplaceSystemInfos(MultipartFile file) { | |||||
declaredRecordManage.importReplaceSystemInfos(file); | |||||
} | |||||
@GetMapping("/importProjectFinanceInfos") | |||||
public void importProjectFinanceInfos(MultipartFile file) { | |||||
declaredRecordManage.importProjectFinanceInfos(file); | |||||
} | |||||
} | } |
@@ -1,9 +1,13 @@ | |||||
package com.hz.pm.api.projectlib.manage; | package com.hz.pm.api.projectlib.manage; | ||||
import cn.hutool.core.bean.BeanUtil; | |||||
import cn.hutool.core.lang.Assert; | import cn.hutool.core.lang.Assert; | ||||
import cn.hutool.core.map.MapUtil; | |||||
import cn.hutool.core.util.StrUtil; | import cn.hutool.core.util.StrUtil; | ||||
import cn.hutool.poi.excel.ExcelUtil; | |||||
import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
import com.alibaba.fastjson.TypeReference; | import com.alibaba.fastjson.TypeReference; | ||||
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.conditions.update.LambdaUpdateWrapper; | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
@@ -19,19 +23,21 @@ import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; | |||||
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; | 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.dto.ProjectConditionDTO; | ||||
import com.hz.pm.api.projectdeclared.service.IProjectDraftService; | import com.hz.pm.api.projectdeclared.service.IProjectDraftService; | ||||
import com.hz.pm.api.projectdeclared.utils.ProjectCodeGenUtil; | |||||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | |||||
import com.hz.pm.api.projectlib.model.dto.ImportProjectFinanceInfosDTO; | |||||
import com.hz.pm.api.projectlib.model.dto.ImportReplaceSystemInfosDTO; | |||||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | ||||
import com.hz.pm.api.projectlib.model.entity.MhProject; | import com.hz.pm.api.projectlib.model.entity.MhProject; | ||||
import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; | import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; | ||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; | import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; | ||||
import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; | import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; | ||||
import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO; | import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO; | ||||
import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService; | |||||
import com.hz.pm.api.projectlib.service.IMhProjectService; | |||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | |||||
import com.hz.pm.api.projectlib.service.*; | |||||
import com.hz.pm.api.staging.enums.MsgTypeEnum; | import com.hz.pm.api.staging.enums.MsgTypeEnum; | ||||
import com.hz.pm.api.sys.manage.NoticeManage; | import com.hz.pm.api.sys.manage.NoticeManage; | ||||
import com.hz.pm.api.todocenter.constant.WorkNoticeConst; | import com.hz.pm.api.todocenter.constant.WorkNoticeConst; | ||||
@@ -53,9 +59,13 @@ import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
import org.springframework.web.multipart.MultipartFile; | |||||
import java.io.InputStream; | |||||
import java.math.BigDecimal; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.*; | import java.util.*; | ||||
import java.util.concurrent.atomic.AtomicInteger; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
@@ -71,6 +81,7 @@ import java.util.stream.Collectors; | |||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class DeclaredRecordManage { | public class DeclaredRecordManage { | ||||
private final ProjectCodeGenUtil projectCodeGenUtil; | |||||
private final IMhProjectService mhProjectService; | private final IMhProjectService mhProjectService; | ||||
private final IMhProjectSchemaTargetDataService schemaTargetDataService; | private final IMhProjectSchemaTargetDataService schemaTargetDataService; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
@@ -82,6 +93,7 @@ public class DeclaredRecordManage { | |||||
private final ProcessInstanceService processInstanceService; | private final ProcessInstanceService processInstanceService; | ||||
private final ProjectLibManage projectLibManage; | private final ProjectLibManage projectLibManage; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | private final INdProjectStatusChangeService projectStatusChangeService; | ||||
private final IProjectGovSystemReplaceInfosService systemReplaceInfosService; | |||||
private LambdaQueryWrapper<MhProject> buildQuery(DeclaredProjectListReq req) { | private LambdaQueryWrapper<MhProject> buildQuery(DeclaredProjectListReq req) { | ||||
LambdaQueryWrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class) | LambdaQueryWrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class) | ||||
@@ -337,5 +349,133 @@ public class DeclaredRecordManage { | |||||
projectStatusChangeService.save(change); | projectStatusChangeService.save(change); | ||||
} | } | ||||
@Transactional(rollbackFor = Exception.class) | |||||
public synchronized void initMhProjectToProject() { | |||||
Wrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class) | |||||
.isNotNull(MhProject::getProjectCode); | |||||
List<MhProject> mhProjects = mhProjectService.list(query); | |||||
if (mhProjects.isEmpty()) { | |||||
return; | |||||
} | |||||
for (MhProject mhProject : mhProjects) { | |||||
if (StrUtil.isNotBlank(mhProject.getProjectCode())) { | |||||
continue; | |||||
} | |||||
LocalDateTime now = LocalDateTime.now(); | |||||
Project project = new Project(); | |||||
project.setProjectName(mhProject.getProjectName()); | |||||
project.setBuildOrgCode(String.valueOf(mhProject.getUnitId())); | |||||
project.setBuildOrgName(mhProject.getUnitName()); | |||||
project.setUnitStrip(mhProject.getUnitStrip()); | |||||
project.setVersion(0); | |||||
project.setNewest(Boolean.TRUE); | |||||
project.setStatus(ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.getCode()); | |||||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||||
ProjectDTO tmpProject = BeanUtil.copyProperties(project, ProjectDTO.class); | |||||
String projectCode = projectCodeGenUtil.generateProjectCode(tmpProject); | |||||
project.setProjectCode(projectCode); | |||||
project.setCreateOn(now); | |||||
project.setCreateBy(0L); | |||||
project.setUpdateOn(now); | |||||
project.setUpdateBy(0L); | |||||
projectService.save(project); | |||||
mhProjectService.update(Wrappers.lambdaUpdate(MhProject.class) | |||||
.set(MhProject::getProjectCode, projectCode) | |||||
.eq(MhProject::getId, mhProject.getId())); | |||||
} | |||||
} | |||||
public void importProjectFinanceInfos(MultipartFile file) { | |||||
try (InputStream is = file.getInputStream()) { | |||||
List<Map<String, Object>> rows = ExcelUtil.getReader(is).readAll(); | |||||
if (rows.isEmpty()) { | |||||
return; | |||||
} | |||||
List<ImportProjectFinanceInfosDTO> importDataList = CollUtils.fieldList(rows, w -> { | |||||
String projectName = MapUtil.getStr(w, "项目名称"); | |||||
Assert.notBlank(projectName, "项目名称不能为空"); | |||||
ImportProjectFinanceInfosDTO financeInfo = new ImportProjectFinanceInfosDTO(); | |||||
financeInfo.setProjectName(projectName); | |||||
financeInfo.setUnitName(MapUtil.getStr(w, "单位名称")); | |||||
financeInfo.setDeclareAmount(MapUtil.get(w, "合计", BigDecimal.class)); | |||||
financeInfo.setDeclareHaveAmount(MapUtil.get(w, "其他资金", BigDecimal.class)); | |||||
financeInfo.setDeclareGovOwnFinanceAmount(MapUtil.get(w, "市本级信息化专项资金", BigDecimal.class)); | |||||
financeInfo.setDeclareGovSuperiorFinanceAmount(MapUtil.get(w, "上级补助资金", BigDecimal.class)); | |||||
return financeInfo; | |||||
}); | |||||
List<Project> projects = new ArrayList<>(); | |||||
for (ImportProjectFinanceInfosDTO importData : importDataList) { | |||||
Project project = projectService.getByProjectName(importData.getProjectName()); | |||||
Assert.notNull(project, "项目不存在:%s", importData.getProjectName()); | |||||
project.setDeclareAmount(importData.getDeclareAmount()); | |||||
project.setDeclareGovOwnFinanceAmount(importData.getDeclareGovOwnFinanceAmount()); | |||||
project.setDeclareGovSuperiorFinanceAmount(importData.getDeclareGovSuperiorFinanceAmount()); | |||||
project.setDeclareHaveAmount(importData.getDeclareHaveAmount()); | |||||
projects.add(project); | |||||
} | |||||
projectService.updateBatchById(projects); | |||||
} catch (Exception e) { | |||||
log.info("读取数据失败:", e); | |||||
throw new BizException(e); | |||||
} | |||||
} | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public void importReplaceSystemInfos(MultipartFile file) { | |||||
try (InputStream is = file.getInputStream()) { | |||||
List<Map<String, Object>> rows = ExcelUtil.getReader(is) | |||||
.readAll(); | |||||
if (rows.isEmpty()) { | |||||
return; | |||||
} | |||||
List<ImportReplaceSystemInfosDTO> importDataList = CollUtils.convert(rows, w -> { | |||||
ImportReplaceSystemInfosDTO importData = new ImportReplaceSystemInfosDTO(); | |||||
importData.setProjectName(MapUtil.getStr(w, "项目名称")); | |||||
Assert.notBlank(importData.getProjectName(), "项目名称不能为空"); | |||||
importData.setReplaceType(MapUtil.getStr(w, "替代方式")); | |||||
importData.setSourceName(MapUtil.getStr(w, "替代前系统")); | |||||
importData.setTargetName(MapUtil.getStr(w, "替代后系统")); | |||||
importData.setUnitName(MapUtil.getStr(w, "单位")); | |||||
if (StrUtil.equals(importData.getReplaceType(), "/") | |||||
|| StrUtil.isBlank(importData.getReplaceType())) { | |||||
importData.setReplaceType(null); | |||||
} else { | |||||
GovSystemReplaceTypeEnum typeEnum = GovSystemReplaceTypeEnum.getByVal(importData.getReplaceType()) | |||||
.orElseThrow(() -> BizException.wrap("替代方式无效:%s", importData.getReplaceType())); | |||||
importData.setReplaceTypeCode(typeEnum.getCode()); | |||||
} | |||||
return importData; | |||||
}); | |||||
Map<String, List<ImportReplaceSystemInfosDTO>> groupByProject = CollUtils.group(importDataList, | |||||
ImportReplaceSystemInfosDTO::getProjectName); | |||||
List<Long> projectIds = new ArrayList<>(); | |||||
List<ProjectGovSystemReplaceInfos> replaceInfos = new ArrayList<>(); | |||||
for (Map.Entry<String, List<ImportReplaceSystemInfosDTO>> entry : groupByProject.entrySet()) { | |||||
Project project = projectService.getByProjectName(entry.getKey()); | |||||
Assert.notNull(project, "项目不存在:%s", entry.getKey()); | |||||
projectIds.add(project.getId()); | |||||
Map<String, Integer> batchNoMap = new HashMap<>(); | |||||
AtomicInteger integer = new AtomicInteger(1); | |||||
for (ImportReplaceSystemInfosDTO w : entry.getValue()) { | |||||
Integer batchNo = batchNoMap.computeIfAbsent(w.getTargetName(), | |||||
k -> integer.getAndIncrement()); | |||||
ProjectGovSystemReplaceInfos replaceInfo = new ProjectGovSystemReplaceInfos(); | |||||
replaceInfo.setProjectId(project.getId()); | |||||
Integer typeCode = w.getReplaceTypeCode(); | |||||
replaceInfo.setReplaceType(typeCode == null ? "/" : typeCode.toString()); | |||||
replaceInfo.setBatchNo(batchNo); | |||||
replaceInfo.setSourceSystem(w.getSourceName()); | |||||
replaceInfo.setTargetSystem(w.getTargetName()); | |||||
replaceInfos.add(replaceInfo); | |||||
} | |||||
} | |||||
systemReplaceInfosService.removeByProjectIds(projectIds); | |||||
systemReplaceInfosService.saveBatch(replaceInfos); | |||||
} catch (Exception e) { | |||||
log.info("读取数据失败:", e); | |||||
throw new BizException(e); | |||||
} | |||||
} | |||||
} | } |
@@ -8,13 +8,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.model.constant.RegionConst; | import com.hz.pm.api.common.model.constant.RegionConst; | ||||
import com.hz.pm.api.common.helper.RegionCacheHelper; | import com.hz.pm.api.common.helper.RegionCacheHelper; | ||||
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; | |||||
import com.hz.pm.api.projectdeclared.utils.ProjectCodeGenUtil; | |||||
import com.hz.pm.api.projectlib.model.dto.ProjectCollectionSaveDTO; | import com.hz.pm.api.projectlib.model.dto.ProjectCollectionSaveDTO; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectCollection; | import com.hz.pm.api.projectlib.model.entity.ProjectCollection; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | import com.hz.pm.api.projectlib.model.req.ProjectListReq; | ||||
import com.hz.pm.api.projectlib.model.vo.ProjectCollectionVO; | import com.hz.pm.api.projectlib.model.vo.ProjectCollectionVO; | ||||
import com.hz.pm.api.projectlib.service.IProjectCollectionService; | import com.hz.pm.api.projectlib.service.IProjectCollectionService; | ||||
import com.hz.pm.api.sys.model.dto.RegionDTO; | |||||
import com.hz.pm.api.user.security.model.UserInfoDetails; | import com.hz.pm.api.user.security.model.UserInfoDetails; | ||||
import com.hz.pm.api.user.util.LoginUserUtil; | import com.hz.pm.api.user.util.LoginUserUtil; | ||||
import com.ningdatech.basic.function.VUtils; | import com.ningdatech.basic.function.VUtils; | ||||
@@ -44,7 +43,7 @@ public class ProjectCollectionManage { | |||||
private final RegionCacheHelper regionCacheHelper; | private final RegionCacheHelper regionCacheHelper; | ||||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | |||||
private final ProjectCodeGenUtil projectCodeGenUtil; | |||||
/** | /** | ||||
* 项目归集 | * 项目归集 | ||||
@@ -110,7 +109,7 @@ public class ProjectCollectionManage { | |||||
VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目归集不存在!"); | VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目归集不存在!"); | ||||
projectCollection.setId(dto.getId()); | projectCollection.setId(dto.getId()); | ||||
} else { | } else { | ||||
projectCollection.setProjectCode(generateProjectCodeUtil.generateProjectCode(projectCollection)); | |||||
projectCollection.setProjectCode(projectCodeGenUtil.generateProjectCode(projectCollection)); | |||||
projectCollection.setCreateBy(user.getUsername()); | projectCollection.setCreateBy(user.getUsername()); | ||||
projectCollection.setCreateOn(LocalDateTime.now()); | projectCollection.setCreateOn(LocalDateTime.now()); | ||||
} | } | ||||
@@ -22,6 +22,7 @@ import com.hz.pm.api.common.model.entity.ExcelExportWriter; | |||||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | ||||
import com.hz.pm.api.common.util.BizUtils; | import com.hz.pm.api.common.util.BizUtils; | ||||
import com.hz.pm.api.common.util.ExcelDownUtil; | import com.hz.pm.api.common.util.ExcelDownUtil; | ||||
import com.hz.pm.api.common.util.StrUtils; | |||||
import com.hz.pm.api.dashboard.handle.ApplicationHandler; | import com.hz.pm.api.dashboard.handle.ApplicationHandler; | ||||
import com.hz.pm.api.datascope.model.DataScopeDTO; | import com.hz.pm.api.datascope.model.DataScopeDTO; | ||||
import com.hz.pm.api.datascope.utils.DataScopeUtil; | import com.hz.pm.api.datascope.utils.DataScopeUtil; | ||||
@@ -49,7 +50,7 @@ import com.hz.pm.api.projectdeclared.model.vo.*; | |||||
import com.hz.pm.api.projectdeclared.service.IOperationService; | import com.hz.pm.api.projectdeclared.service.IOperationService; | ||||
import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; | import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; | ||||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | import com.hz.pm.api.projectdeclared.service.IPurchaseService; | ||||
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; | |||||
import com.hz.pm.api.projectdeclared.utils.ProjectCodeGenUtil; | |||||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | ||||
import com.hz.pm.api.projectlib.handle.ProcessExecuteChainHandle; | import com.hz.pm.api.projectlib.handle.ProcessExecuteChainHandle; | ||||
import com.hz.pm.api.projectlib.helper.ProjectHelper; | import com.hz.pm.api.projectlib.helper.ProjectHelper; | ||||
@@ -125,7 +126,7 @@ public class ProjectLibManage { | |||||
private final ProcessExecuteChainHandle processExecuteHandle; | private final ProcessExecuteChainHandle processExecuteHandle; | ||||
private final FileService fileService; | private final FileService fileService; | ||||
private final IProjectApplicationService projectApplicationService; | private final IProjectApplicationService projectApplicationService; | ||||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | |||||
private final ProjectCodeGenUtil projectCodeGenUtil; | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final StateMachineUtil stateMachineUtil; | private final StateMachineUtil stateMachineUtil; | ||||
private final INdProjectDelayApplyService projectDelayApplyService; | private final INdProjectDelayApplyService projectDelayApplyService; | ||||
@@ -701,10 +702,12 @@ public class ProjectLibManage { | |||||
} | } | ||||
vo.setSystemReplaceInfos(getGovSystemReplaceInfos(project.getId())); | vo.setSystemReplaceInfos(getGovSystemReplaceInfos(project.getId())); | ||||
//审批信息 | //审批信息 | ||||
ProcessDetailReq req = new ProcessDetailReq(); | |||||
req.setInstanceId(project.getInstCode()); | |||||
req.setProjectId(project.getId()); | |||||
vo.setProcess(todoService.getProcessDetail(req)); | |||||
if (StrUtils.isNotBlank(project.getInstCode())) { | |||||
ProcessDetailReq req = new ProcessDetailReq(); | |||||
req.setInstanceId(project.getInstCode()); | |||||
req.setProjectId(project.getId()); | |||||
vo.setProcess(todoService.getProcessDetail(req)); | |||||
} | |||||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(projectCode); | List<Long> allVersionProjectIds = projectService.allVersionProjectIds(projectCode); | ||||
// 查询采购备案 | // 查询采购备案 | ||||
@@ -883,7 +886,7 @@ public class ProjectLibManage { | |||||
project.setStatus(status.getCode()); | project.setStatus(status.getCode()); | ||||
project.setInstCode(instanceId); | project.setInstCode(instanceId); | ||||
project.setSponsor(String.valueOf(userId)); | project.setSponsor(String.valueOf(userId)); | ||||
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); | |||||
String projectCode = projectCodeGenUtil.generateProjectCode(projectDto); | |||||
project.setProjectCode(projectCode); | project.setProjectCode(projectCode); | ||||
if (projectService.save(project)) { | if (projectService.save(project)) { | ||||
saveApplication(projectDto, project, null); | saveApplication(projectDto, project, null); | ||||
@@ -0,0 +1,50 @@ | |||||
package com.hz.pm.api.projectlib.model.dto; | |||||
import lombok.Data; | |||||
import java.math.BigDecimal; | |||||
/** | |||||
* <p> | |||||
* ImportReplaceSystemInfosDTO | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 16:01 2024/3/2 | |||||
*/ | |||||
@Data | |||||
public class ImportProjectFinanceInfosDTO { | |||||
/** | |||||
* 单位名称 | |||||
*/ | |||||
private String unitName; | |||||
/** | |||||
* 项目名称 | |||||
*/ | |||||
private String projectName; | |||||
/** | |||||
* 合计 | |||||
*/ | |||||
private BigDecimal declareAmount; | |||||
/** | |||||
* 其他资金 | |||||
*/ | |||||
private BigDecimal declareHaveAmount; | |||||
/** | |||||
* 市本级信息化专项资金 | |||||
*/ | |||||
private BigDecimal declareGovOwnFinanceAmount; | |||||
/** | |||||
* 上级补助资金 | |||||
*/ | |||||
private BigDecimal declareGovSuperiorFinanceAmount; | |||||
} |
@@ -0,0 +1,28 @@ | |||||
package com.hz.pm.api.projectlib.model.dto; | |||||
import lombok.Data; | |||||
/** | |||||
* <p> | |||||
* ImportReplaceSystemInfosDTO | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 16:01 2024/3/2 | |||||
*/ | |||||
@Data | |||||
public class ImportReplaceSystemInfosDTO { | |||||
private String unitName; | |||||
private String sourceName; | |||||
private String replaceType; | |||||
private String targetName; | |||||
private String projectName; | |||||
private Integer replaceTypeCode; | |||||
} |
@@ -41,6 +41,12 @@ public enum GovSystemReplaceTypeEnum { | |||||
.findFirst(); | .findFirst(); | ||||
} | } | ||||
public static Optional<GovSystemReplaceTypeEnum> getByVal(String val) { | |||||
return Arrays.stream(values()) | |||||
.filter(w -> w.getVal().equals(val)) | |||||
.findFirst(); | |||||
} | |||||
public static String getVal(Integer code) { | public static String getVal(Integer code) { | ||||
return get(code) | return get(code) | ||||
.flatMap(w -> Optional.of(w.getVal())) | .flatMap(w -> Optional.of(w.getVal())) | ||||
@@ -1,11 +1,15 @@ | |||||
package com.hz.pm.api.projectlib.service; | package com.hz.pm.api.projectlib.service; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | ||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import java.util.Collection; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 服务类 | |||||
* 服务类 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author WendyYang | * @author WendyYang | ||||
@@ -13,4 +17,11 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||||
*/ | */ | ||||
public interface IProjectGovSystemReplaceInfosService extends IService<ProjectGovSystemReplaceInfos> { | public interface IProjectGovSystemReplaceInfosService extends IService<ProjectGovSystemReplaceInfos> { | ||||
default void removeByProjectIds(Collection<Long> projectIds) { | |||||
LambdaQueryWrapper<ProjectGovSystemReplaceInfos> query = Wrappers | |||||
.lambdaQuery(ProjectGovSystemReplaceInfos.class) | |||||
.in(ProjectGovSystemReplaceInfos::getProjectId, projectIds); | |||||
remove(query); | |||||
} | |||||
} | } |
@@ -74,4 +74,12 @@ public interface IProjectService extends IService<Project> { | |||||
return list(query); | return list(query); | ||||
} | } | ||||
default Project getByProjectName(String projectName) { | |||||
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getProjectName, projectName) | |||||
.orderByDesc(Project::getVersion) | |||||
.last(BizConst.LIMIT_1); | |||||
return getOne(query); | |||||
} | |||||
} | } |