@@ -52,12 +52,24 @@ public class GovProjectCollectionController { | |||||
return collectionManage.list(req); | return collectionManage.list(req); | ||||
} | } | ||||
@GetMapping("/operation/list") | |||||
@ApiOperation("运维项目项目归集列表") | |||||
public PageVo<GovBizProjectListVO> operationList(ProjectListReq req) { | |||||
return collectionManage.operationList(req); | |||||
} | |||||
@GetMapping("/detail/{projId}") | @GetMapping("/detail/{projId}") | ||||
@ApiOperation("项目归集详情") | @ApiOperation("项目归集详情") | ||||
public GovBizProjectDetailVO detail(@PathVariable String projId) { | public GovBizProjectDetailVO detail(@PathVariable String projId) { | ||||
return collectionManage.detail(projId); | return collectionManage.detail(projId); | ||||
} | } | ||||
@GetMapping("/operation/detail/{projId}") | |||||
@ApiOperation("运维项目归集详情") | |||||
public GovBizProjectDetailVO operationDetail(@PathVariable String projId) { | |||||
return collectionManage.operationDetail(projId); | |||||
} | |||||
@PostMapping("/save") | @PostMapping("/save") | ||||
@ApiOperation("项目归集保存") | @ApiOperation("项目归集保存") | ||||
@WebLog("项目归集保存") | @WebLog("项目归集保存") | ||||
@@ -65,6 +77,13 @@ public class GovProjectCollectionController { | |||||
return collectionManage.save(saveDTO,null); | return collectionManage.save(saveDTO,null); | ||||
} | } | ||||
@PostMapping("/operation/save") | |||||
@ApiOperation("运维项目归集保存") | |||||
@WebLog("运维项目归集保存") | |||||
public String operationSave(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) { | |||||
return collectionManage.operationSave(saveDTO,null); | |||||
} | |||||
@PostMapping("/remove/{projId}") | @PostMapping("/remove/{projId}") | ||||
@ApiOperation("项目归集删除") | @ApiOperation("项目归集删除") | ||||
@WebLog("项目归集删除") | @WebLog("项目归集删除") | ||||
@@ -77,6 +77,8 @@ public class GovProjectCollectionManage { | |||||
private final IGovBizProjectBaseinfoService baseinfoService; | private final IGovBizProjectBaseinfoService baseinfoService; | ||||
private final IGovOperationProjectBaseinfoService operationProjectBaseinfoService; | |||||
private final IGovBizProjectApproveService approveService; | private final IGovBizProjectApproveService approveService; | ||||
private final IGovBizProjectCimplementService cimplementService; | private final IGovBizProjectCimplementService cimplementService; | ||||
@@ -187,6 +189,62 @@ public class GovProjectCollectionManage { | |||||
} | } | ||||
/** | /** | ||||
* 运维项目归集列表 | |||||
* @param req | |||||
* @return | |||||
*/ | |||||
public PageVo<GovBizProjectListVO> operationList(ProjectListReq req) { | |||||
Page<GovOperationProjectBaseinfo> page = req.page(); | |||||
LambdaQueryWrapper<GovOperationProjectBaseinfo> wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) | |||||
.like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectBaseinfo::getBaseProjName,req.getProjectName()) | |||||
.like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) | |||||
.eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectBaseinfo::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) | |||||
.eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) | |||||
.gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMin()) | |||||
.le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMax()) | |||||
.eq(StringUtils.isNotBlank(req.getProjectType()),GovOperationProjectBaseinfo::getBaseProjType,req.getProjectType()) | |||||
.eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) | |||||
.orderByDesc(GovOperationProjectBaseinfo::getBizTime); | |||||
operationProjectBaseinfoService.page(page,wrapper); | |||||
if(CollUtil.isEmpty(page.getRecords())){ | |||||
return PageVo.empty(); | |||||
} | |||||
List<String> projIds = page.getRecords().stream() | |||||
.filter(p -> Objects.nonNull(p) && StringUtils.isNotBlank(p.getBaseProjId())) | |||||
.map(GovOperationProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); | |||||
Map<String,GovBizProjectApply> applyMap = Maps.newHashMap(); | |||||
if(CollUtil.isNotEmpty(projIds)){ | |||||
List<GovBizProjectApply> applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.in(GovBizProjectApply::getBaseProjId,projIds) | |||||
.eq(GovBizProjectApply::getDeleted,Boolean.FALSE)); | |||||
applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId,a -> a)); | |||||
} | |||||
Map<String, GovBizProjectApply> finalApplyMap = applyMap; | |||||
List<GovBizProjectListVO> res = page.getRecords().stream().map(p -> { | |||||
GovBizProjectListVO vo = new GovBizProjectListVO(); | |||||
vo.setBaseAreaCode(p.getBaseAreaCode()); | |||||
vo.setBaseAreaName(p.getBaseAreaName()); | |||||
vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); | |||||
vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); | |||||
vo.setBaseProjId(p.getBaseProjId()); | |||||
vo.setBaseProjName(p.getBaseProjName()); | |||||
if(finalApplyMap.containsKey(p.getBaseProjId())){ | |||||
GovBizProjectApply apply = finalApplyMap.get(p.getBaseProjId()); | |||||
vo.setBaseProjDeclAmount(apply.getBaseProjDeclAmount()); | |||||
vo.setBaseProjTotalAmount(apply.getBaseProjTotalAmount()); | |||||
vo.setBaseProjSetYear(apply.getBaseProjSetYear()); | |||||
} | |||||
return vo; | |||||
}).collect(Collectors.toList()); | |||||
return PageVo.of(res,page.getTotal()); | |||||
} | |||||
/** | |||||
* 草稿箱列表 | * 草稿箱列表 | ||||
* @param req | * @param req | ||||
* @return | * @return | ||||
@@ -330,6 +388,68 @@ public class GovProjectCollectionManage { | |||||
return res; | return res; | ||||
} | } | ||||
public GovBizProjectDetailVO operationDetail(String projId) { | |||||
GovBizProjectDetailVO res = new GovBizProjectDetailVO(); | |||||
//1.先查 基本信息 | |||||
GovOperationProjectBaseinfo baseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) | |||||
.eq(GovOperationProjectBaseinfo::getBaseProjId, projId) | |||||
.orderByDesc(GovOperationProjectBaseinfo::getBizTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.isNull(baseinfo)){ | |||||
return res; | |||||
} | |||||
res.setBaseProjId(baseinfo.getBaseProjId()); | |||||
res.setBaseProjName(baseinfo.getBaseProjName()); | |||||
res.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoVO.class)); | |||||
//2.再查 申报信息 | |||||
GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.eq(GovBizProjectApply::getBaseProjId, projId) | |||||
.orderByDesc(GovBizProjectApply::getBizTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(apply)){ | |||||
res.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyVO.class)); | |||||
} | |||||
//3.再查 审批信息 | |||||
GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.eq(GovBizProjectApprove::getBaseProjId, projId) | |||||
.orderByDesc(GovBizProjectApprove::getBizTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(approve)){ | |||||
res.setApprove(BeanUtil.copyProperties(approve, GovBizProjectApproveVO.class)); | |||||
} | |||||
//4 对应查询 实施项目还是运维项目 | |||||
GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) | |||||
.eq(GovBizProjectCimplement::getBaseProjId, projId) | |||||
.orderByDesc(GovBizProjectCimplement::getBizTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(cimplement)){ | |||||
res.setCimplement(BeanUtil.copyProperties(cimplement, GovBizProjectCimplementVO.class)); | |||||
} | |||||
GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) | |||||
.eq(GovBizProjectMimplement::getBaseProjId, projId) | |||||
.orderByDesc(GovBizProjectMimplement::getBizTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(mimplement)){ | |||||
res.setMimplement(BeanUtil.copyProperties(mimplement, GovBizProjectMimplementVO.class)); | |||||
} | |||||
//5.最后查询采购信息 | |||||
List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||||
.eq(GovBizProjectProcure::getBaseProjId, projId) | |||||
.orderByDesc(GovBizProjectProcure::getBizTime)); | |||||
if(CollUtil.isNotEmpty(procures)){ | |||||
res.setProcures(procures.stream() | |||||
.map(p -> BeanUtil.copyProperties(p, GovBizProjectProcureVO.class)) | |||||
.collect(Collectors.toList())); | |||||
} | |||||
return res; | |||||
} | |||||
/** | /** | ||||
* 草稿箱详情 | * 草稿箱详情 | ||||
* @param draftId | * @param draftId | ||||
@@ -603,6 +723,214 @@ public class GovProjectCollectionManage { | |||||
} | } | ||||
/** | /** | ||||
* 运维项目保存 | |||||
* @param saveDTO | |||||
* @param user | |||||
* @return | |||||
*/ | |||||
public String operationSave(GovBizProjectSaveDTO saveDTO, UserInfoDetails user) { | |||||
if(Objects.isNull(user)){ | |||||
user = LoginUserUtil.loginUserDetail(); | |||||
} | |||||
GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); | |||||
String baseProjId = saveDTO.getBaseProjId(); | |||||
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; | |||||
String baseProjName = base.getBaseProjName(); | |||||
//1.保存基本信息 | |||||
GovBizProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); | |||||
baseinfo.setBaseProjId(baseProjId); | |||||
baseinfo.setBaseProjName(baseProjName); | |||||
baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); | |||||
GovOperationProjectBaseinfo oldBaseInfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) | |||||
.eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
//项目名去重 | |||||
checkNameOperation(baseProjName,baseProjId); | |||||
GovOperationProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovOperationProjectBaseinfo.class); | |||||
saveBase.setBaseProjName(baseProjName); | |||||
saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); | |||||
if(Objects.nonNull(oldBaseInfo)){ | |||||
saveBase.setId(oldBaseInfo.getId()); | |||||
saveBase.setBaseAreaCode(null); | |||||
}else{ | |||||
saveBase.setTongTime(LocalDateTime.now()); | |||||
saveBase.setBaseAreaCode(baseAreaCode); | |||||
saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY)); | |||||
} | |||||
saveBase.setAreaCode(RegionConst.RC_LS); | |||||
saveBase.setBizTime(LocalDateTime.now()); | |||||
saveBase.setUpdateBy(user.getUsername()); | |||||
saveBase.setUpdateOn(LocalDateTime.now()); | |||||
//如果是新增的话 要生成 项目编号 | |||||
if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ | |||||
baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); | |||||
saveBase.setBaseProjId(baseProjId); | |||||
} | |||||
operationProjectBaseinfoService.saveOrUpdate(saveBase); | |||||
// 2.保存 申报信息 | |||||
GovBizProjectApplyDTO apply = saveDTO.getApply(); | |||||
if(Objects.nonNull(apply)){ | |||||
apply.setBaseProjId(baseProjId); | |||||
apply.setBaseProjName(baseProjName); | |||||
GovBizProjectApply oldApply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.eq(GovBizProjectApply::getBaseProjId, baseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
GovBizProjectApply saveApply = BeanUtil.copyProperties(apply,GovBizProjectApply.class); | |||||
saveApply.setBaseProjId(baseProjId); | |||||
if(Objects.nonNull(oldApply)){ | |||||
saveApply.setId(oldApply.getId()); | |||||
}else{ | |||||
saveApply.setTongTime(LocalDateTime.now()); | |||||
} | |||||
if(Objects.nonNull(saveApply.getBaseProjStartTime()) && | |||||
Objects.nonNull(saveApply.getBaseProjEndTime())){ | |||||
saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), | |||||
saveApply.getBaseProjEndTime())); | |||||
} | |||||
saveApply.setAreaCode(RegionConst.RC_LS); | |||||
saveApply.setBizTime(LocalDateTime.now()); | |||||
saveApply.setUpdateBy(user.getUsername()); | |||||
saveApply.setUpdateOn(LocalDateTime.now()); | |||||
if(projectApplyService.saveOrUpdate(saveApply)){ | |||||
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); | |||||
} | |||||
} | |||||
// 3.保存 审批信息 | |||||
GovBizProjectApproveDTO approve = saveDTO.getApprove(); | |||||
if(Objects.nonNull(approve)){ | |||||
approve.setBaseProjId(baseProjId); | |||||
approve.setBaseProjName(baseProjName); | |||||
GovBizProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.eq(GovBizProjectApprove::getBaseProjId, baseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve,GovBizProjectApprove.class); | |||||
saveApprove.setBaseProjId(baseProjId); | |||||
if(Objects.nonNull(oldApprove)){ | |||||
saveApprove.setId(oldApprove.getId()); | |||||
}else{ | |||||
saveApprove.setTongTime(LocalDateTime.now()); | |||||
} | |||||
saveApprove.setBizTime(LocalDateTime.now()); | |||||
saveApprove.setAreaCode(RegionConst.RC_LS); | |||||
saveApprove.setUpdateBy(user.getUsername()); | |||||
saveApprove.setUpdateOn(LocalDateTime.now()); | |||||
if(approveService.saveOrUpdate(saveApprove)){ | |||||
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); | |||||
} | |||||
} | |||||
// 4.保存 建设项目 实施信息 | |||||
GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); | |||||
if(Objects.nonNull(cimplement)){ | |||||
cimplement.setBaseProjId(baseProjId); | |||||
cimplement.setBaseProjName(baseProjName); | |||||
cimplement.setBaseBidCode(baseProjId); | |||||
cimplement.setBaseBidName(baseProjName); | |||||
GovBizProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) | |||||
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,GovBizProjectCimplement.class); | |||||
saveCimplement.setBaseProjId(baseProjId); | |||||
saveCimplement.setBaseBidCode(baseProjId); | |||||
saveCimplement.setBaseBidName(baseProjName); | |||||
if(Objects.nonNull(oldCimplement)){ | |||||
saveCimplement.setId(oldCimplement.getId()); | |||||
}else{ | |||||
saveCimplement.setTongTime(LocalDateTime.now()); | |||||
} | |||||
saveCimplement.setAreaCode(RegionConst.RC_LS); | |||||
saveCimplement.setBizTime(LocalDateTime.now()); | |||||
saveCimplement.setUpdateBy(user.getUsername()); | |||||
saveCimplement.setUpdateOn(LocalDateTime.now()); | |||||
if(cimplementService.saveOrUpdate(saveCimplement)){ | |||||
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); | |||||
} | |||||
} | |||||
// 5.保存 运维项目 实施信息 | |||||
GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); | |||||
if(Objects.nonNull(mimplement)){ | |||||
mimplement.setBaseProjId(baseProjId); | |||||
mimplement.setBaseProjName(baseProjName); | |||||
mimplement.setBaseBidCode(baseProjId); | |||||
mimplement.setBaseBidName(baseProjName); | |||||
GovBizProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) | |||||
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,GovBizProjectMimplement.class); | |||||
saveMimplement.setBaseProjId(baseProjId); | |||||
saveMimplement.setBaseBidCode(baseProjId); | |||||
saveMimplement.setBaseBidName(baseProjName); | |||||
if(Objects.nonNull(oldMimplement)){ | |||||
saveMimplement.setId(oldMimplement.getId()); | |||||
}else{ | |||||
saveMimplement.setTongTime(LocalDateTime.now()); | |||||
} | |||||
if(Objects.nonNull(saveBase.getAreaCode())){ | |||||
saveMimplement.setAreaCode(saveBase.getAreaCode()); | |||||
} | |||||
saveMimplement.setAreaCode(RegionConst.RC_LS); | |||||
saveMimplement.setBizTime(LocalDateTime.now()); | |||||
saveMimplement.setUpdateBy(user.getUsername()); | |||||
saveMimplement.setUpdateOn(LocalDateTime.now()); | |||||
if(mimplementService.saveOrUpdate(saveMimplement)){ | |||||
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement,oldMimplement,saveMimplement)); | |||||
} | |||||
} | |||||
// 6.保存 采购信息 | |||||
List<GovBizProjectProcureDTO> procures = saveDTO.getProcures(); | |||||
if(Objects.nonNull(procures)){ | |||||
procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||||
.eq(GovBizProjectProcure::getBaseProjId,baseProjId)); | |||||
String finalBaseProjId = baseProjId; | |||||
UserInfoDetails finalUser = user; | |||||
Integer index = 1; | |||||
for(GovBizProjectProcureDTO procure : procures){ | |||||
procure.setBaseProjId(finalBaseProjId); | |||||
procure.setBaseProjName(baseProjName); | |||||
procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); | |||||
GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); | |||||
saveProcure.setBaseProjId(finalBaseProjId); | |||||
saveProcure.setId(null); | |||||
saveProcure.setAreaCode(RegionConst.RC_LS); | |||||
saveProcure.setTongTime(LocalDateTime.now()); | |||||
saveProcure.setBizTime(LocalDateTime.now()); | |||||
saveProcure.setUpdateBy(finalUser.getUsername()); | |||||
saveProcure.setUpdateOn(LocalDateTime.now()); | |||||
if(procureService.save(saveProcure)){ | |||||
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure,null,saveProcure)); | |||||
} | |||||
index++; | |||||
} | |||||
} | |||||
//7. 推送数据(改为定时推送了) | |||||
// pushProject(saveDTO); | |||||
//如果是草稿箱来的 就要删除 | |||||
if(Objects.nonNull(saveDTO.getDraftId())){ | |||||
draftService.removeById(saveDTO.getDraftId()); | |||||
} | |||||
return BizConst.SAVE_SUCCESS; | |||||
} | |||||
/** | |||||
* 计算2个时间的月份 | * 计算2个时间的月份 | ||||
* @param baseProjStartTime | * @param baseProjStartTime | ||||
* @param baseProjEndTime | * @param baseProjEndTime | ||||
@@ -789,6 +1117,14 @@ public class GovProjectCollectionManage { | |||||
.throwMessage("项目名重复"); | .throwMessage("项目名重复"); | ||||
} | } | ||||
private void checkNameOperation(String baseProjName, String baseProjId) { | |||||
VUtils.isTrue(operationProjectBaseinfoService.count(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) | |||||
.eq(GovOperationProjectBaseinfo::getBaseProjName,baseProjName) | |||||
.eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) | |||||
.ne(GovOperationProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) | |||||
.throwMessage("项目名重复"); | |||||
} | |||||
/** | /** | ||||
* 推送项目 | * 推送项目 | ||||
* @param saveDTO | * @param saveDTO | ||||
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.gov.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author zpf | |||||
* @since 2023-08-23 | |||||
*/ | |||||
public interface GovOperationProjectBaseinfoMapper extends BaseMapper<GovOperationProjectBaseinfo> { | |||||
} |
@@ -0,0 +1,118 @@ | |||||
package com.ningdatech.pmapi.gov.model.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 io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* 运维项目基本信息表 | |||||
* </p> | |||||
* | |||||
* @author ZPF | |||||
* @since 2023-10-07 | |||||
*/ | |||||
@Data | |||||
@TableName("gov_operation_project_baseinfo") | |||||
@ApiModel(value = "GovOperationProjectBaseinfo对象", description = "运维项目基本信息表") | |||||
public class GovOperationProjectBaseinfo implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("主键") | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
@ApiModelProperty("项目编号") | |||||
private String baseProjId; | |||||
@ApiModelProperty("基本项目名称") | |||||
private String baseProjName; | |||||
@ApiModelProperty("基本项目区域code") | |||||
private String baseAreaCode; | |||||
@ApiModelProperty("基本项目区域名") | |||||
private String baseAreaName; | |||||
@ApiModelProperty("是否涉密") | |||||
private String baseProjIsConfidentiality; | |||||
@ApiModelProperty("项目类型") | |||||
private String baseProjType; | |||||
@ApiModelProperty("内容类别") | |||||
private String baseConstructionType; | |||||
@ApiModelProperty("项目状态") | |||||
private String baseProjSetProg; | |||||
@ApiModelProperty("信息是否有效") | |||||
private String isEffective; | |||||
@ApiModelProperty("是否省级 1省级 2非省级") | |||||
private Integer baseProvManDeprtType; | |||||
@ApiModelProperty("上级主管单位") | |||||
private String baseProvManDeprt; | |||||
@ApiModelProperty("上级主管单位钉id") | |||||
private String baseProvManDeprtDing; | |||||
@ApiModelProperty("本级主管单位") | |||||
private String baseManDeprt; | |||||
@ApiModelProperty("本级主管单位ding code") | |||||
private String baseManDeprtDing; | |||||
@ApiModelProperty("本级主管单位社会统一信用代码") | |||||
private String baseManDepartUsci; | |||||
@ApiModelProperty("建设单位") | |||||
private String baseBuildDeprt; | |||||
@ApiModelProperty("建设单位Ding Code") | |||||
private String baseBuildDeprtDing; | |||||
@ApiModelProperty("建设单位社会统一信用代码") | |||||
private String baseBuildDepartUsci; | |||||
@ApiModelProperty("项目负责人") | |||||
private String baseProjPrincipal; | |||||
@ApiModelProperty("项目负责人手机号") | |||||
private String baseProjPrincipalCall; | |||||
@ApiModelProperty("项目联系人") | |||||
private String baseProjContacts; | |||||
@ApiModelProperty("项目联系人联系方式") | |||||
private String baseProjContactsCall; | |||||
@ApiModelProperty("数据来源") | |||||
private String areaCode; | |||||
@ApiModelProperty("生产时间") | |||||
private LocalDateTime bizTime; | |||||
@ApiModelProperty("操作标记") | |||||
private String op; | |||||
@ApiModelProperty("入库时间") | |||||
private LocalDateTime tongTime; | |||||
@ApiModelProperty("逻辑删除") | |||||
private Boolean deleted; | |||||
@ApiModelProperty("最后修改时间") | |||||
private LocalDateTime updateOn; | |||||
@ApiModelProperty("最后修改人") | |||||
private String updateBy; | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.gov.service; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author zpf | |||||
* @since 2023-08-23 | |||||
*/ | |||||
public interface IGovOperationProjectBaseinfoService extends IService<GovOperationProjectBaseinfo> { | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package com.ningdatech.pmapi.gov.service.impl; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.ningdatech.pmapi.gov.mapper.GovOperationProjectBaseinfoMapper; | |||||
import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; | |||||
import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author zpf | |||||
* @since 2023-08-23 | |||||
*/ | |||||
@Service | |||||
public class GovOperationProjectBaseinfoServiceImpl extends | |||||
ServiceImpl<GovOperationProjectBaseinfoMapper, GovOperationProjectBaseinfo> implements IGovOperationProjectBaseinfoService { | |||||
} |
@@ -9,7 +9,9 @@ import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; | |||||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; | import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; | ||||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; | import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; | ||||
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; | import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; | ||||
import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; | |||||
import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; | import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; | ||||
import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService; | |||||
import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant; | import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant; | ||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
@@ -36,6 +38,9 @@ public class GenerateProjectCodeUtil { | |||||
@Autowired | @Autowired | ||||
private IGovBizProjectBaseinfoService baseinfoService; | private IGovBizProjectBaseinfoService baseinfoService; | ||||
@Autowired | |||||
private IGovOperationProjectBaseinfoService operationProjectBaseinfoService; | |||||
public String generateProjectCode(ProjectDTO project){ | public String generateProjectCode(ProjectDTO project){ | ||||
// 获取所属行政区划代码(9位) | // 获取所属行政区划代码(9位) | ||||
String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; | String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; | ||||
@@ -56,6 +61,14 @@ public class GenerateProjectCodeUtil { | |||||
if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ | if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ | ||||
max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | ||||
} | } | ||||
GovOperationProjectBaseinfo operationBaseMax = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) | |||||
.like(GovOperationProjectBaseinfo::getBaseProjId, currentCode) | |||||
.orderByDesc(GovOperationProjectBaseinfo::getBaseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())){ | |||||
Long operationMax = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | |||||
max = Math.max(max,operationMax); | |||||
} | |||||
Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) | Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) | ||||
.like(Project::getProjectCode, currentCode) | .like(Project::getProjectCode, currentCode) | ||||
.orderByDesc(Project::getProjectCode) | .orderByDesc(Project::getProjectCode) | ||||
@@ -89,6 +102,14 @@ public class GenerateProjectCodeUtil { | |||||
if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ | if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ | ||||
max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | ||||
} | } | ||||
GovOperationProjectBaseinfo operationBaseMax = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) | |||||
.like(GovOperationProjectBaseinfo::getBaseProjId, currentCode) | |||||
.orderByDesc(GovOperationProjectBaseinfo::getBaseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())){ | |||||
Long operationMax = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | |||||
max = Math.max(max,operationMax); | |||||
} | |||||
Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) | Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) | ||||
.like(Project::getProjectCode, currentCode) | .like(Project::getProjectCode, currentCode) | ||||
.orderByDesc(Project::getProjectCode) | .orderByDesc(Project::getProjectCode) | ||||
@@ -128,6 +149,14 @@ public class GenerateProjectCodeUtil { | |||||
if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ | if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ | ||||
max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | ||||
} | } | ||||
GovOperationProjectBaseinfo operationBaseMax = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) | |||||
.like(GovOperationProjectBaseinfo::getBaseProjId, currentCode) | |||||
.orderByDesc(GovOperationProjectBaseinfo::getBaseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())){ | |||||
Long operationMax = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); | |||||
max = Math.max(max,operationMax); | |||||
} | |||||
Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) | Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) | ||||
.like(Project::getProjectCode, currentCode) | .like(Project::getProjectCode, currentCode) | ||||
.orderByDesc(Project::getProjectCode) | .orderByDesc(Project::getProjectCode) | ||||
@@ -198,6 +198,94 @@ | |||||
</if> | </if> | ||||
</if> | </if> | ||||
) | ) | ||||
UNION ALL | |||||
( | |||||
SELECT | |||||
3 AS from_type, | |||||
b.id id, | |||||
b.base_proj_name project_name, | |||||
CAST(apply.base_proj_set_year AS INTEGER) project_year, | |||||
b.base_build_deprt_ding build_org_code, | |||||
b.base_build_deprt build_org_name, | |||||
b.base_proj_id project_code, | |||||
b.base_proj_type project_type, | |||||
b.base_area_name area, | |||||
(CASE WHEN b.base_area_code IS NOT NULL then substring(b.base_area_code,0,6) end) area_code, | |||||
apply.base_proj_decl_amount declare_amount, | |||||
approve.base_initial_review_total_money approval_amount, | |||||
NULL stage, | |||||
CAST(b.base_proj_set_prog AS INTEGER) status, | |||||
NULL annual_plan_amount, | |||||
NULL biz_domain, | |||||
NULL inst_code, | |||||
NULL is_higher_super_org, | |||||
NULL pre_plan_project_id, | |||||
b.tong_time create_on, | |||||
b.biz_time update_on | |||||
FROM gov_operation_project_baseinfo b | |||||
LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | |||||
LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | |||||
WHERE b.deleted = false | |||||
<if test="req.id != null"> | |||||
and b.id = #{req.id} | |||||
</if> | |||||
<if test="req.regionCode != null and req.regionCode != ''"> | |||||
and b.base_area_code = concat(#{req.regionCode},'000') | |||||
</if> | |||||
<if test="req.areaCode != null and req.areaCode != ''"> | |||||
and b.base_area_code = concat(#{req.regionCode},'000') | |||||
</if> | |||||
<if test="req.projectName != null and req.projectName != ''"> | |||||
and b.base_proj_name like concat('%',#{req.projectName},'%') | |||||
</if> | |||||
<if test="req.projectType != null and req.projectType != ''"> | |||||
and b.base_proj_type = #{req.projectType} | |||||
</if> | |||||
<if test="req.buildOrgName != null and req.buildOrgName != ''"> | |||||
and b.base_build_deprt like concat('%',#{req.buildOrgName},'%') | |||||
</if> | |||||
<if test="req.status != null"> | |||||
and b.base_proj_set_prog = #{req.status} | |||||
</if> | |||||
<if test="req.projectYear != null"> | |||||
and apply.base_proj_set_year = #{req.projectYear} | |||||
</if> | |||||
<if test="req.createOnMin != null"> | |||||
and b.tong_time >= #{req.createOnMin} | |||||
</if> | |||||
<if test="req.createOnMax != null"> | |||||
and b.tong_time <= #{req.createOnMax} | |||||
</if> | |||||
<if test="req.declareAmountMin != null"> | |||||
and apply.base_proj_decl_amount >= #{req.declareAmountMin} | |||||
</if> | |||||
<if test="req.declareAmountMax != null"> | |||||
and apply.base_proj_decl_amount <= #{req.declareAmountMax} | |||||
</if> | |||||
<if test="req.approveAmountMin != null"> | |||||
and approve.base_initial_review_total_money >= #{req.approveAmountMin} | |||||
</if> | |||||
<if test="req.approveAmountMax != null"> | |||||
and approve.base_initial_review_total_money <= #{req.approveAmountMax} | |||||
</if> | |||||
<if test="req.userType != null and req.userType == 'normal'"> | |||||
and b.base_build_deprt_ding = #{req.userValue} | |||||
</if> | |||||
<if test="req.userType != null and req.userType == 'org'"> | |||||
and b.base_build_deprt_ding = #{req.userValue} | |||||
</if> | |||||
<if test="req.userType != null and req.userType == 'region'"> | |||||
<if test="req.regionCodes != null"> | |||||
and b.base_area_code in | |||||
<foreach close=")" collection="req.regionCodes" item="code" open="(" separator=","> | |||||
concat(#{code},'000') | |||||
</foreach> | |||||
</if> | |||||
<if test="req.userRegionCode != null"> | |||||
and b.base_area_code = concat(#{req.userRegionCode},'000') | |||||
</if> | |||||
</if> | |||||
) | |||||
) ORDER BY update_on DESC | ) ORDER BY update_on DESC | ||||
</select> | </select> | ||||
@@ -313,7 +401,7 @@ | |||||
UNION ALL | UNION ALL | ||||
( | ( | ||||
SELECT | SELECT | ||||
2 AS from_type, | |||||
3 AS from_type, | |||||
b.id id, | b.id id, | ||||
b.base_proj_name project_name, | b.base_proj_name project_name, | ||||
CAST(apply.base_proj_set_year AS INTEGER) project_year, | CAST(apply.base_proj_set_year AS INTEGER) project_year, | ||||
@@ -334,7 +422,7 @@ | |||||
NULL pre_plan_project_id, | NULL pre_plan_project_id, | ||||
b.tong_time create_on, | b.tong_time create_on, | ||||
b.biz_time update_on | b.biz_time update_on | ||||
FROM gov_biz_project_baseinfo b | |||||
FROM gov_operation_project_baseinfo b | |||||
LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | ||||
LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | ||||
WHERE b.deleted = false and b.base_proj_type in ('04','05') | WHERE b.deleted = false and b.base_proj_type in ('04','05') | ||||