Browse Source

项目归集 推送 支持 指定编号 推送

tags/24080901
PoffyZhang 1 year ago
parent
commit
8b56c8869c
4 changed files with 65 additions and 1 deletions
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java
  2. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java
  4. +55
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java View File

@@ -162,6 +162,13 @@ public class GovProjectCollectionController {
collectionTask.doTask();
}

@PostMapping("/push-task-single")
@ApiOperation("主动调用定时器方法")
@WebLog("主动调用定时器方法")
public void pushTaskSingle(@RequestBody List<String> projectCodes) throws UnknownHostException {
collectionTask.doTaskSingle(projectCodes);
}

@PostMapping("/staging-convert-pdf")
@ApiOperation("把库存的项目归集的文件 都转换成PDF文件存入字段")
@WebLog("主动转换库存的文件都为PDF文件")


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java View File

@@ -193,6 +193,7 @@ public class GovProjectCollectionManage {
.gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin())
.le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax())
.eq(StringUtils.isNotBlank(req.getProjectType()),GovBizProjectBaseinfo::getBaseProjType,req.getProjectType())
.in(CollUtil.isNotEmpty(req.getProjectCodes()),GovBizProjectBaseinfo::getBaseProjId,req.getProjectCodes())
.in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.BUILD.getCode().equals(req.getOldProjectType()),
GovBizProjectBaseinfo::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(),
ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode()))
@@ -256,6 +257,7 @@ public class GovProjectCollectionManage {
.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())
.in(CollUtil.isNotEmpty(req.getProjectCodes()),GovOperationProjectBaseinfo::getBaseProjId,req.getProjectCodes())
.eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE)
.orderByDesc(GovOperationProjectBaseinfo::getBizTime);
operationProjectBaseinfoService.page(page,wrapper);


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java View File

@@ -396,7 +396,7 @@ public class ProjectRenewalFundManage {
}

//判断金额
checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount());
// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount());

declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name());
if(Objects.nonNull(project)){


+ 55
- 0
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java View File

@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.scheduler.task;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.StopWatch;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.common.constant.BizConst;
@@ -432,4 +433,58 @@ public class SynProjectCollectionTask {
procureService.updateById(procure);
}
}

public void doTaskSingle(List<String> projectCodes) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();

log.info("数据同步任务 指定项目编号 :{}",projectCodes);

if(CollUtil.isEmpty(projectCodes)){
throw new BizException("不能为空!");
}

//全量项目归集
ProjectListReq req = new ProjectListReq();
req.setPageNumber(PAGE_NUMBER);
req.setPageSize(1000);
PageVo<GovBizProjectListVO> projectCollectionPage = collectionManage.list(req);

log.info("projectCollections size :{}",projectCollectionPage.getTotal());

for(GovBizProjectListVO vo : projectCollectionPage.getRecords()){
GovBizProjectDetailVO projectDetail = collectionManage.detail(vo.getBaseProjId());
collectionManage.pushProjectVo(projectDetail);
}

//2.运维备案项目
PageVo<GovBizProjectListVO> operationList = collectionManage.operationList(req);
log.info("operation list size :{}",operationList.getTotal());
for(GovBizProjectListVO vo : operationList.getRecords()){
GovOperationProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId());
GovOperationProjectBaseinfoVO baseinfo = operationDetail.getBaseinfo();
if(Objects.isNull(baseinfo) || Objects.isNull(baseinfo.getPush()) ||
Boolean.FALSE.equals(baseinfo.getPush())){
log.info("此运维项目不用推送:" + vo.getBaseProjId());
}
collectionManage.pushProjectVo(operationDetail);
}

//3.申报项目 需要推送的项目
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest,Boolean.TRUE)
.eq(Project::getPush,Boolean.TRUE)
.in(Project::getProjectCode,projectCodes));
log.info("projects need push size :{}",projects.size());
for(Project project : projects){
ProjectDetailVO projectDetailVO = projectLibManage.detailProjectCode(project.getProjectCode());
GovBizProjectDetailVO vo = ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService);
if(Objects.nonNull(vo)){
collectionManage.pushProjectVo(vo);
}
}

stopWatch.stop();
log.info("数据同步任务 指定项目编号 结束====={}s",stopWatch.getTotalTimeSeconds());
}
}

Loading…
Cancel
Save