Преглед изворни кода

对应状态 推送 对应数据表

master
PoffyZhang пре 1 година
родитељ
комит
bbfdd431a7
4 измењених фајлова са 190 додато и 64 уклоњено
  1. +0
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java
  2. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/GovProjectStatusEnum.java
  3. +59
    -0
      syn-data-task/src/main/java/com/ningdatech/syndataapi/open/enumeration/GovProjectStatusEnum.java
  4. +119
    -61
      syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java

+ 0
- 3
pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java Прегледај датотеку

@@ -2,15 +2,12 @@ package com.ningdatech.pmapi.gov.convert;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.gov.contants.BizProjectContant;
import com.ningdatech.pmapi.gov.model.dto.*;
import com.ningdatech.pmapi.gov.model.req.*;
import com.ningdatech.pmapi.gov.model.vo.*;
import com.ningdatech.pmapi.gov.utils.ProjectCollectionUtil;
import org.apache.commons.lang3.StringUtils;

import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
import java.util.Objects;


+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/GovProjectStatusEnum.java Прегледај датотеку

@@ -44,4 +44,16 @@ public enum GovProjectStatusEnum {
}
return StringUtils.EMPTY;
}

public static GovProjectStatusEnum match(String code) {
if (StringUtils.isBlank(code)) {
return null;
}
for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) {
if (code.equals(t.getCode())) {
return t;
}
}
return null;
}
}

+ 59
- 0
syn-data-task/src/main/java/com/ningdatech/syndataapi/open/enumeration/GovProjectStatusEnum.java Прегледај датотеку

@@ -0,0 +1,59 @@
package com.ningdatech.syndataapi.open.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
* GovProjectStatusEnum
*
* @return
* @author ZPF
* @since 2023/10/24 16:27
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum GovProjectStatusEnum {
/**
* 项目归集 状态
*/
APPROVAL("01", "评审中"),
PENDING("02", "待立项"),
REJECTED("03","已驳回"),
APPROVED("04","已立项"),
PURCHASED("05","已采购"),
HAS_PRE_INS("06","已初验"),
HAS_FINAL_INS("07","已终验"),
TERMINATED("00","已终止");

private String code;
private String desc;

public static String getDescByCode(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}

public static GovProjectStatusEnum match(String code) {
if (StringUtils.isBlank(code)) {
return null;
}
for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) {
if (code.equals(t.getCode())) {
return t;
}
}
return null;
}
}

+ 119
- 61
syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java Прегледај датотеку

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.syndataapi.common.constant.BizConst;
import com.ningdatech.syndataapi.open.enumeration.GovProjectStatusEnum;
import com.ningdatech.syndataapi.scheduler.model.dto.ProjectBaseInfoDTO;
import com.ningdatech.syndataapi.scheduler.model.dto.ProjectSaveDTO;
import com.ningdatech.syndataapi.scheduler.model.entity.*;
@@ -58,71 +59,58 @@ public class ProjectReceiveManage {
.eq(ProjectBaseInfo::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo,ProjectBaseInfo.class);
if(Objects.isNull(oldBaseInfo)){
//如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update
if(StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())){
saveBase.setOp(BizConst.OP_UPDATE);
}else{
saveBase.setOp(BizConst.OP_INSERT);
}
saveBase.setTongTime(LocalDateTime.now());
}else {
saveBase.setOp(BizConst.OP_INSERT);
saveBase.setTongID(oldBaseInfo.getTongID());
}
saveBase.setBizTime(LocalDateTime.now());
baseInfoService.saveOrUpdate(saveBase);

// 2.保存 申报信息
ProjectApply apply = dto.getApply();

ProjectApply oldApply = applyService.getOne(Wrappers.lambdaQuery(ProjectApply.class)
.eq(ProjectApply::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));

ProjectApply saveApply = BeanUtil.copyProperties(apply,ProjectApply.class);
saveApply.setBaseProjId(baseProjId);
if(Objects.isNull(oldApply)){
//如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update
if(StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())){
saveApply.setOp(BizConst.OP_UPDATE);
}else{
saveApply.setOp(BizConst.OP_INSERT);
}
saveApply.setTongTime(LocalDateTime.now());
}else{
saveApply.setOp(BizConst.OP_INSERT);
saveApply.setTongID(oldApply.getTongID());
//项目状态
String baseProjSetProg = saveBase.getBaseProjSetProg();
if(StringUtils.isBlank(baseProjSetProg)){
return "无状态不保存";
}

saveApply.setBizTime(LocalDateTime.now());
applyService.saveOrUpdate(saveApply);

// 3.保存 审批信息
ProjectApprove approve = dto.getApprove();

ProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(ProjectApprove.class)
.eq(ProjectApprove::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));

ProjectApprove saveApprove = BeanUtil.copyProperties(approve,ProjectApprove.class);
saveApprove.setBaseProjId(baseProjId);
if(Objects.isNull(oldApprove)){
//如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update
if(StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())){
saveApprove.setOp(BizConst.OP_UPDATE);
}else{
saveApprove.setOp(BizConst.OP_INSERT);
}
saveApprove.setTongTime(LocalDateTime.now());
}else{
saveApprove.setOp(BizConst.OP_INSERT);
saveApprove.setTongID(oldApprove.getTongID());
//评审中 基本信息和申报信息
GovProjectStatusEnum match = GovProjectStatusEnum.match(baseProjSetProg);
if(Objects.isNull(match)){
return "状态不对 不保存";
}
switch (match){
case APPROVAL:
log.info("评审中状态 保存基本信息和申报信息 :{}",baseProjId);
saveBase(oldBaseInfo,saveBase,baseInfo);
saveApply(dto, baseProjId);
break;
case PENDING:
case APPROVED:
log.info("待立项和已立项状态 保存基本信息,申报信息,评审信息 :{}",baseProjId);
saveBase(oldBaseInfo,saveBase,baseInfo);
saveApply(dto, baseProjId);
saveApprove(dto, baseProjId);
break;
case PURCHASED:
log.info("已采购状态 保存基本信息,申报信息,评审信息,采购信息 :{}",baseProjId);
saveBase(oldBaseInfo,saveBase,baseInfo);
saveApply(dto, baseProjId);
saveApprove(dto, baseProjId);
saveProcure(dto, baseProjId);
break;
case HAS_PRE_INS:
case HAS_FINAL_INS:
log.info("初验终验状态 保存所有信息 :{}",baseProjId);
saveBase(oldBaseInfo,saveBase,baseInfo);
saveApply(dto, baseProjId);
saveApprove(dto, baseProjId);
saveProcure(dto, baseProjId);
saveCimplementOrMimplement(dto, baseProjId);
break;
case REJECTED:
case TERMINATED:
log.info("驳回终止状态 啥都不保存 :{}",baseProjId);
break;
default:
log.info("没有匹配任何状态 保存失败 :{}",baseProjId);
}
saveApprove.setBizTime(LocalDateTime.now());
approveService.saveOrUpdate(saveApprove);

return BizConst.SAVE_SUCCESS;
}

private void saveCimplementOrMimplement(ProjectSaveDTO dto, String baseProjId) {
// 4.保存 建设项目 实施信息
ProjectCimplement cimplement = dto.getCimplement();
if(Objects.nonNull(cimplement)){
@@ -172,7 +160,9 @@ public class ProjectReceiveManage {
saveMimplement.setBizTime(LocalDateTime.now());
mimplementService.saveOrUpdate(saveMimplement);
}
}

private void saveProcure(ProjectSaveDTO dto, String baseProjId) {
// 6.保存 采购信息
List<ProjectProcure> procures = dto.getProcures();
if(Objects.nonNull(procures)){
@@ -197,9 +187,77 @@ public class ProjectReceiveManage {
index ++;
}
}
}

private void saveApprove(ProjectSaveDTO dto, String baseProjId) {
// 3.保存 审批信息
ProjectApprove approve = dto.getApprove();

ProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(ProjectApprove.class)
.eq(ProjectApprove::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));

ProjectApprove saveApprove = BeanUtil.copyProperties(approve,ProjectApprove.class);
saveApprove.setBaseProjId(baseProjId);
if(Objects.isNull(oldApprove)){
//如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update
if(StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())){
saveApprove.setOp(BizConst.OP_UPDATE);
}else{
saveApprove.setOp(BizConst.OP_INSERT);
}
saveApprove.setTongTime(LocalDateTime.now());
}else{
saveApprove.setOp(BizConst.OP_INSERT);
saveApprove.setTongID(oldApprove.getTongID());
}
saveApprove.setBizTime(LocalDateTime.now());
approveService.saveOrUpdate(saveApprove);
}

private void saveApply(ProjectSaveDTO dto, String baseProjId) {
// 2.保存 申报信息
ProjectApply apply = dto.getApply();

return BizConst.SAVE_SUCCESS;
ProjectApply oldApply = applyService.getOne(Wrappers.lambdaQuery(ProjectApply.class)
.eq(ProjectApply::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));

ProjectApply saveApply = BeanUtil.copyProperties(apply,ProjectApply.class);
saveApply.setBaseProjId(baseProjId);
if(Objects.isNull(oldApply)){
//如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update
if(StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())){
saveApply.setOp(BizConst.OP_UPDATE);
}else{
saveApply.setOp(BizConst.OP_INSERT);
}
saveApply.setTongTime(LocalDateTime.now());
}else{
saveApply.setOp(BizConst.OP_INSERT);
saveApply.setTongID(oldApply.getTongID());
}

saveApply.setBizTime(LocalDateTime.now());
applyService.saveOrUpdate(saveApply);
}

//保存基本信息
private void saveBase(ProjectBaseInfo oldBaseInfo, ProjectBaseInfo saveBase,ProjectBaseInfo baseInfo) {
if(Objects.isNull(oldBaseInfo)){
//如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update
if(StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())){
saveBase.setOp(BizConst.OP_UPDATE);
}else{
saveBase.setOp(BizConst.OP_INSERT);
}
saveBase.setTongTime(LocalDateTime.now());
}else {
saveBase.setOp(BizConst.OP_INSERT);
saveBase.setTongID(oldBaseInfo.getTongID());
}
saveBase.setBizTime(LocalDateTime.now());
baseInfoService.saveOrUpdate(saveBase);
}

/**


Loading…
Откажи
Сачувај