@@ -47,4 +47,6 @@ public interface UserInfoHelper { | |||||
* @return | * @return | ||||
*/ | */ | ||||
String getUserEmpPosUnitCode(Long userId); | String getUserEmpPosUnitCode(Long userId); | ||||
String getMainOrgCode(String empPosUnitCode); | |||||
} | } |
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; | |||||
import cn.hutool.core.collection.CollectionUtil; | import cn.hutool.core.collection.CollectionUtil; | ||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | import com.baomidou.mybatisplus.core.toolkit.StringUtils; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | ||||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | ||||
@@ -232,4 +233,15 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||||
UserFullInfoDTO userFullInfo = getUserFullInfo(userId); | UserFullInfoDTO userFullInfo = getUserFullInfo(userId); | ||||
return userFullInfo.getEmpPosUnitCode(); | return userFullInfo.getEmpPosUnitCode(); | ||||
} | } | ||||
@Override | |||||
public String getMainOrgCode(String empPosUnitCode) { | |||||
DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) | |||||
.eq(DingOrganization::getOrganizationCode, empPosUnitCode) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.isNull(org)){ | |||||
return null; | |||||
} | |||||
return org.getParentCode(); | |||||
} | |||||
} | } |
@@ -172,4 +172,11 @@ public class GovProjectCollectionController { | |||||
public void stagingConvertPdf3(@RequestParam(required = false) String projId) { | public void stagingConvertPdf3(@RequestParam(required = false) String projId) { | ||||
collectionTask.stagingConvertPdf3(projId); | collectionTask.stagingConvertPdf3(projId); | ||||
} | } | ||||
@PostMapping("/rebuild-project-code") | |||||
@ApiOperation("重新生成项目编号") | |||||
@WebLog("重新生成项目编号") | |||||
public String stagingConvertPdf3(@RequestBody List<String> projIds) { | |||||
return collectionManage.rebuildProjectCode(projIds); | |||||
} | |||||
} | } |
@@ -11,6 +11,7 @@ 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.Lists; | ||||
import com.google.common.collect.Maps; | import com.google.common.collect.Maps; | ||||
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.StrPool; | import com.ningdatech.basic.util.StrPool; | ||||
@@ -1689,4 +1690,73 @@ public class GovProjectCollectionManage { | |||||
e.printStackTrace(); | e.printStackTrace(); | ||||
} | } | ||||
} | } | ||||
public String rebuildProjectCode(List<String> baseProjIds){ | |||||
if(CollUtil.isEmpty(baseProjIds)){ | |||||
throw new BizException("项目编号不能为空"); | |||||
} | |||||
for(String baseProjId : baseProjIds){ | |||||
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||||
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) | |||||
.orderByDesc(GovBizProjectBaseinfo::getTongTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.eq(GovBizProjectApply::getBaseProjId, baseProjId) | |||||
.orderByDesc(GovBizProjectApply::getTongTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.isNull(baseinfo)){ | |||||
System.out.println("项目不存在 直接下一个"); | |||||
continue; | |||||
} | |||||
GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); | |||||
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); | |||||
saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); | |||||
String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); | |||||
baseinfo.setBaseProjId(newProjId); | |||||
baseinfoService.updateById(baseinfo); | |||||
apply.setBaseProjId(newProjId); | |||||
projectApplyService.updateById(apply); | |||||
GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) | |||||
.eq(GovBizProjectApprove::getBaseProjId, baseProjId) | |||||
.orderByDesc(GovBizProjectApprove::getTongTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(approve)){ | |||||
approve.setBaseProjId(newProjId); | |||||
approveService.updateById(approve); | |||||
} | |||||
GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) | |||||
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId) | |||||
.orderByDesc(GovBizProjectCimplement::getTongTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(cimplement)){ | |||||
cimplement.setBaseProjId(newProjId); | |||||
cimplement.setBaseBidCode(newProjId); | |||||
cimplementService.updateById(cimplement); | |||||
} | |||||
GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) | |||||
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId) | |||||
.orderByDesc(GovBizProjectMimplement::getTongTime) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(mimplement)){ | |||||
mimplement.setBaseProjId(newProjId); | |||||
mimplement.setBaseBidCode(newProjId); | |||||
mimplementService.updateById(mimplement); | |||||
} | |||||
List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) | |||||
.eq(GovBizProjectProcure::getBaseProjId, baseProjId)); | |||||
for(GovBizProjectProcure procure : procures){ | |||||
procure.setBaseProjId(newProjId); | |||||
procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); | |||||
procureService.updateById(procure); | |||||
} | |||||
} | |||||
return "运行成功 重新生成" + baseProjIds.size() + "个项目编号"; | |||||
} | |||||
} | } |
@@ -83,6 +83,7 @@ public class ProjectIrsManage { | |||||
ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class); | ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class); | ||||
JSONObject body = forEntity.getBody(); | JSONObject body = forEntity.getBody(); | ||||
log.info("core biz :{}",body); | log.info("core biz :{}",body); | ||||
JSONObject datas = body.getJSONObject("datas"); | JSONObject datas = body.getJSONObject("datas"); | ||||
if(Objects.nonNull(datas)){ | if(Objects.nonNull(datas)){ | ||||
return datas; | return datas; | ||||
@@ -476,10 +476,24 @@ public class DeclaredProjectManage { | |||||
}else if(BizConst.PRE.equals(active) || | }else if(BizConst.PRE.equals(active) || | ||||
BizConst.PROD.equals(active)){ | BizConst.PROD.equals(active)){ | ||||
jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); | jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); | ||||
// List<ProjectCoreBiz> list = coreBizService.list(Wrappers.lambdaQuery(ProjectCoreBiz.class) | |||||
// .eq(ProjectCoreBiz::getOrgCode, user.getEmpPosUnitCode()) | |||||
// .like(StringUtils.isNotBlank(businessName), ProjectCoreBiz::getMatterName, businessName)); | |||||
// jsonObject.put("data",list); | |||||
//主管单位的 | |||||
String mainOrgCode = userInfoHelper.getMainOrgCode(user.getEmpPosUnitCode()); | |||||
if(StringUtils.isNotBlank(mainOrgCode)){ | |||||
JSONObject mainOrgCoreBiz = projectIrsManage.searchCoreBiz(businessName, | |||||
mainOrgCode,limit,page); | |||||
if(Objects.nonNull(mainOrgCoreBiz) && | |||||
CollUtil.isNotEmpty(mainOrgCoreBiz.getJSONArray(BizConst.RESPONSE_KEY_DATA))){ | |||||
JSONArray mainOrgCoreArray = mainOrgCoreBiz.getJSONArray(BizConst.RESPONSE_KEY_DATA); | |||||
if(Objects.nonNull(jsonObject)){ | |||||
if(Objects.isNull(jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA))){ | |||||
jsonObject.put(BizConst.RESPONSE_KEY_DATA,mainOrgCoreArray); | |||||
}else{ | |||||
jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA).addAll(mainOrgCoreArray); | |||||
jsonObject.put(BizConst.RESPONSE_KEY_DATA,mainOrgCoreArray); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
return jsonObject; | return jsonObject; | ||||
} | } | ||||