|
|
@@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|