Browse Source

采购标段改成 多个

tags/24080901
PoffyZhang 1 year ago
parent
commit
d7bdc6ad9c
8 changed files with 63 additions and 31 deletions
  1. +19
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java
  2. +22
    -17
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  3. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectProcureDTO.java
  4. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectSaveDTO.java
  5. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectPushReq.java
  6. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectDetailVO.java
  7. +11
    -7
      syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java
  8. +2
    -1
      syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ProjectSaveDTO.java

+ 19
- 3
pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java View File

@@ -1,10 +1,14 @@
package com.ningdatech.pmapi.gov.convert;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.ningdatech.pmapi.gov.model.dto.*;
import com.ningdatech.pmapi.gov.model.req.*;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname ProjectConvert
@@ -26,12 +30,24 @@ public class ProjectConvert {
req.setApprove(convertApprove(saveDTO.getApprove()));
req.setCimplement(convertCimplement(saveDTO.getCimplement()));
req.setMimplement(convertMimplement(saveDTO.getMimplement()));
req.setProcure(convertProcure(saveDTO.getProcure()));
req.setProcures(convertProcures(saveDTO.getProcures()));
return req;
}

private static ProjectProcureReq convertProcure(GovBizProjectProcureDTO procure) {
ProjectProcureReq req = BeanUtil.copyProperties(procure,ProjectProcureReq.class);
private static List<ProjectProcureReq> convertProcures(List<GovBizProjectProcureDTO> procures) {
if(CollUtil.isEmpty(procures)){
return Collections.emptyList();
}

List<ProjectProcureReq> req = procures.stream()
.map(p -> {
ProjectProcureReq r = BeanUtil.copyProperties(p, ProjectProcureReq.class);
if(Objects.nonNull(p.getId())){
r.setTongID(p.getId().intValue());
}
return r;
})
.collect(Collectors.toList());
return req;
}



+ 22
- 17
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java View File

@@ -189,12 +189,13 @@ public class GovProjectCollectionManage {
}

//5.最后查询采购信息
GovBizProjectProcure procure = procureService.getOne(Wrappers.lambdaQuery(GovBizProjectProcure.class)
List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, projId)
.orderByDesc(GovBizProjectProcure::getBizTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(procure)){
res.setProcure(BeanUtil.copyProperties(procure, GovBizProjectProcureVO.class));
.orderByDesc(GovBizProjectProcure::getBizTime));
if(CollUtil.isNotEmpty(procures)){
res.setProcures(procures.stream()
.map(p -> BeanUtil.copyProperties(p, GovBizProjectProcureVO.class))
.collect(Collectors.toList()));
}

return res;
@@ -329,27 +330,31 @@ public class GovProjectCollectionManage {
}

// 6.保存 采购信息
GovBizProjectProcureDTO procure = saveDTO.getProcure();
procure.setBaseProjId(baseProjId);
procure.setBaseProjName(baseProjName);
if(Objects.nonNull(procure)){
GovBizProjectProcure oldProcure = procureService.getOne(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
List<GovBizProjectProcureDTO> procures = saveDTO.getProcures();
for(GovBizProjectProcureDTO procure : procures){
procure.setBaseProjId(baseProjId);
procure.setBaseProjName(baseProjName);

GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class);
saveProcure.setBaseProjId(baseProjId);
if(Objects.nonNull(oldProcure)){
saveProcure.setId(oldProcure.getId());

if(Objects.nonNull(saveBase.getBaseAreaCode())){
saveProcure.setAreaCode(saveBase.getBaseAreaCode());
}
if(Objects.isNull(procure.getId())){
saveProcure.setTongTime(LocalDateTime.now());
}else{
if(Objects.nonNull(saveBase.getBaseAreaCode())){
saveProcure.setAreaCode(saveBase.getBaseAreaCode());
//如果是修改 那就看下库里是否有
Long id = saveProcure.getId();
GovBizProjectProcure old = procureService.getById(id);
if(Objects.isNull(old)){
saveProcure.setId(null);
}
saveProcure.setTongTime(LocalDateTime.now());
}
procureService.saveOrUpdate(saveProcure);
}


//7. 推送数据
pushProject(saveDTO);



+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectProcureDTO.java View File

@@ -23,6 +23,9 @@ public class GovBizProjectProcureDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("id")
private Long id;

@ApiModelProperty("项目编号")
private String baseProjId;



+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectSaveDTO.java View File

@@ -6,6 +6,7 @@ import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;

/**
* <p>
@@ -43,5 +44,5 @@ public class GovBizProjectSaveDTO implements Serializable {
private GovBizProjectMimplementDTO mimplement;

@ApiModelProperty("项目采购信息")
private GovBizProjectProcureDTO procure;
private List<GovBizProjectProcureDTO> procures;
}

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectPushReq.java View File

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
* @Classname ProjectPushReq
@@ -28,5 +29,5 @@ public class ProjectPushReq {

private ProjectMimplementReq mimplement;

private ProjectProcureReq procure;
private List<ProjectProcureReq> procures;
}

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectDetailVO.java View File

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;

/**
* <p>
@@ -41,5 +42,5 @@ public class GovBizProjectDetailVO implements Serializable {
private GovBizProjectMimplementVO mimplement;

@ApiModelProperty("项目采购信息")
private GovBizProjectProcureVO procure;
private List<GovBizProjectProcureVO> procures;
}

+ 11
- 7
syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java View File

@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;

/**
@@ -127,16 +128,19 @@ public class ProjectReceiveManage {
}

// 6.保存 采购信息
ProjectProcure procure = dto.getProcure();
if(Objects.nonNull(procure)){
ProjectProcure oldProcure = procureService.getOne(Wrappers.lambdaQuery(ProjectProcure.class)
.eq(ProjectProcure::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));

List<ProjectProcure> procures = dto.getProcures();
for(ProjectProcure procure : procures){
ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class);
saveProcure.setBaseProjId(baseProjId);
if(Objects.isNull(oldProcure)){
if(Objects.isNull(saveProcure.getTongID())){
saveProcure.setTongTime(LocalDateTime.now());
}else{
//如果是修改 那就看下库里是否有
Integer tongId = saveProcure.getTongID();
ProjectProcure old = procureService.getById(tongId);
if(Objects.isNull(old)){
saveProcure.setTongID(null);
}
}
saveProcure.setBizTime(LocalDateTime.now());
procureService.saveOrUpdate(saveProcure);


+ 2
- 1
syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ProjectSaveDTO.java View File

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
* @Classname ProjectSaveDTO
@@ -29,5 +30,5 @@ public class ProjectSaveDTO {

private ProjectMimplement mimplement;

private ProjectProcure procure;
private List<ProjectProcure> procures;
}

Loading…
Cancel
Save