Просмотр исходного кода

修改项目档案信息招标登记信息与采购备案

master
WendyYang 1 год назад
Родитель
Сommit
f7922da26f
7 измененных файлов: 113 добавлений и 77 удалений
  1. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java
  3. +5
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java
  4. +57
    -46
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java
  5. +37
    -24
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java
  6. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Purchase.java
  7. +10
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPurchaseService.java

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java Просмотреть файл

@@ -226,7 +226,7 @@ public class ProjectFileManage {
ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId);
List<ProcessDetailVO> processDetailVos = projectLibManage.processScheduleDetail(projectId);
ProjectReviewDetailVO projectReviewDetailVo = expertReviewManage.projectExpertReviewDetail(projectCode);
PurchaseVO purchaseVo = purchaseManage.detailByProjectId(projectId);
List<PurchaseVO> purchaseVos = purchaseManage.detailByProjectId(projectId);
ContractVO contractVo = constructionManage.detailContractByProjectId(projectId);
PreInsVO preInsVo = constructionManage.detailPreInsByProjectId(projectId);
FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProjectId(projectId);
@@ -234,7 +234,7 @@ public class ProjectFileManage {
projectFileVo.setProjectDetailVo(projectDetailVo);
projectFileVo.setProcessDetailVos(processDetailVos);
projectFileVo.setProjectReviewDetailVo(projectReviewDetailVo);
projectFileVo.setPurchaseVo(purchaseVo);
projectFileVo.setPurchaseVos(purchaseVos);
projectFileVo.setContractVo(contractVo);
projectFileVo.setPreInsVo(preInsVo);
projectFileVo.setFinalAcceptanceVo(finalAcceptanceVo);


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java Просмотреть файл

@@ -35,7 +35,7 @@ public class ProjectFileVO {
private ProjectReviewDetailVO projectReviewDetailVo;

@ApiModelProperty("招标登记详情")
private PurchaseVO purchaseVo;
private List<PurchaseVO> purchaseVos;

@ApiModelProperty("合同登记详情")
private ContractVO contractVo;


+ 5
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java Просмотреть файл

@@ -15,7 +15,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
* @Classname PurchaseController
@@ -42,15 +44,15 @@ public class PurchaseController {

@ApiOperation(value = "采购结果备案详情", notes = "采购结果备案详情")
@GetMapping("/detail/{projectId}")
public PurchaseVO detailByProjectId(@PathVariable Long projectId) {
public List<PurchaseVO> detailByProjectId(@PathVariable Long projectId) {
return purchaseManage.detailByProjectId(projectId);
}

@GetMapping("/export")
@ApiOperation("待采购结果备案列表导出")
@WebLog("待采购结果备案列表导出")
public void exportList(ProjectListReq req, HttpServletResponse response){
ExcelDownUtil.downXls(response,req,purchaseManage::exportList);
public void exportList(ProjectListReq req, HttpServletResponse response) {
ExcelDownUtil.downXls(response, req, purchaseManage::exportList);
}

@ApiOperation(value = "填写采购结果", notes = "填写采购结果")


+ 57
- 46
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java Просмотреть файл

@@ -4,20 +4,18 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.common.util.ExcelExportStyle;
import com.ningdatech.pmapi.projectdeclared.model.dto.*;
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService;
@@ -35,11 +33,14 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@@ -64,6 +65,7 @@ public class PurchaseManage {

/**
* 待采购的-项目列表
*
* @param req
* @return
*/
@@ -72,9 +74,9 @@ public class PurchaseManage {
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
//待采购状态
query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
query.orderByAsc(Project::getApprovalDate);
Page<Project> page = projectService.page(req.page(), query);
long total;
@@ -108,16 +110,16 @@ public class PurchaseManage {
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
//待采购状态
query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
query.orderByAsc(Project::getApprovalDate);
List<Project> records = projectService.list(query);

AtomicInteger serialNumber = new AtomicInteger(0);
List<DeclaredProjectExportDTO> data = Lists.newArrayList();

if(CollUtil.isNotEmpty(records)){
if (CollUtil.isNotEmpty(records)) {
data = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportDTO);
@@ -133,7 +135,7 @@ public class PurchaseManage {
}

String fileName = "采购结果待备案项目列表";
ExcelDownUtil.setFileName(fileName,response);
ExcelDownUtil.setFileName(fileName, response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class)
@@ -148,19 +150,18 @@ public class PurchaseManage {

/**
* 获取采购结果备案详情
*
* @param projectId
* @return
*/
public PurchaseVO detailByProjectId(Long projectId) {
Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class)
.eq(Purchase::getProjectId, projectId)
.last(BizConst.LIMIT_1));

return BeanUtil.copyProperties(purchase,PurchaseVO.class);
public List<PurchaseVO> detailByProjectId(Long projectId) {
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
return BeanUtil.copyToList(purchases, PurchaseVO.class);
}

/**
* 填写采购结果
*
* @param dto
* @return
*/
@@ -175,40 +176,50 @@ public class PurchaseManage {
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!");

//首先要判断 项目当前状态 是不是 采购结果备案
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.getCode().equals(project.getStatus()) ||
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage()))
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus())
|| !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage()))
.throwMessage("提交失败 该项目不是 待采购备案状态或者已立项阶段");

Purchase purchaseEntity = new Purchase();
Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class)
.eq(Purchase::getProjectId, projectId)
.last(BizConst.LIMIT_1));

BeanUtil.copyProperties(dto,purchaseEntity);
if(Objects.isNull(purchase)){
purchaseEntity.setCreateOn(LocalDateTime.now());
purchaseEntity.setCreateBy(employeeCode);
}else{
purchaseEntity.setId(purchase.getId());
}
purchaseEntity.setProjectId(projectId);
if(purchaseService.saveOrUpdate(purchaseEntity)){
//如果 需要推送项目和应用管理的话 只有遂昌县才有
// String areaCode = project.getAreaCode();
// String appCode = dto.getAppCode();
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){
// try{
//
// }catch (Exception e){
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage());
// }
// }
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
Map<Long, Purchase> purchaseMap = CollUtils.listToMap(purchases, Purchase::getId);
List<Purchase> purchaseEntities = CollUtils.convert(dto.getTenders(), w -> {
Purchase purchase = BeanUtil.copyProperties(w, Purchase.class);
purchase.setProjectId(projectId);
if (!purchaseMap.containsKey(w.getId())) {
purchase.setCreateBy(employeeCode);
}
return purchase;
});

if (purchaseService.saveOrUpdateBatch(purchaseEntities)) {
// 如果 需要推送项目和应用管理的话 只有遂昌县才有
// String areaCode = project.getAreaCode();
// String appCode = dto.getAppCode();
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){
// try{
//
// }catch (Exception e){
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage());
// }
// }
//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setTransactionAmount(dto.getTransactionAmount());
project.setTransactionTime(dto.getTransactionTime());

// 获最的成时以总成交金
LocalDateTime lastTransactionTime = null;
BigDecimal transactionAmountTotal = BigDecimal.ZERO;
for (Purchase purchase : purchases) {
if (lastTransactionTime == null) {
lastTransactionTime = purchase.getTransactionTime();
} else if (purchase.getTransactionTime().isAfter(lastTransactionTime)) {
lastTransactionTime = purchase.getTransactionTime();
}
transactionAmountTotal = transactionAmountTotal.add(purchase.getTransactionAmount());
}

project.setTransactionAmount(transactionAmountTotal);
project.setTransactionTime(lastTransactionTime);
projectService.updateById(project);

return "填写成功";


+ 37
- 24
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java Просмотреть файл

@@ -6,9 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
* @Classname Purchase
@@ -16,8 +18,8 @@ import java.time.LocalDateTime;
* @Date 2023/5/29 10:00
* @Author PoffyZhang
*/
@ApiModel(value = "采购对象", description = "采购对象")
@Data
@ApiModel(value = "采购对象", description = "采购对象")
@AllArgsConstructor
public class PurchaseSaveDTO {

@@ -25,37 +27,48 @@ public class PurchaseSaveDTO {
@NotNull(message = "请传项目ID")
private Long projectId;

@ApiModelProperty("供应商")
private String supplier;
@NotEmpty(message = "标段信息不能为空")
private List<TenderDTO> tenders;

@Data
public static class TenderDTO {

@ApiModelProperty("标段ID")
private Long id;

@ApiModelProperty("供应商")
private String supplier;

@ApiModelProperty("供应商联系人")
private String supplierContact;

@ApiModelProperty("供应商联系人")
private String supplierContact;
@ApiModelProperty("供应商联系方式")
private String supplierContactInfo;

@ApiModelProperty("供应商联系方式")
private String supplierContactInfo;
@ApiModelProperty("采购方式 1公开招标 2自行采购")
private Integer purchaseMethod;

@ApiModelProperty("采购方式 1公开招标 2自行采购")
private Integer purchaseMethod;
@ApiModelProperty("成交金额")
private BigDecimal transactionAmount;

@ApiModelProperty("成交金额")
private BigDecimal transactionAmount;
@ApiModelProperty("成交时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime transactionTime;

@ApiModelProperty("成交时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime transactionTime;
@ApiModelProperty("代理机构")
private String agency;

@ApiModelProperty("代理机构")
private String agency;
@ApiModelProperty("投标文件")
private String biddingDoc;

@ApiModelProperty("投标文件")
private String biddingDoc;
@ApiModelProperty("招标文件")
private String bidDoc;

@ApiModelProperty("招标文件")
private String bidDoc;
@ApiModelProperty("中标通知书")
private String acceptanceLetter;

@ApiModelProperty("中标通知书")
private String acceptanceLetter;
@ApiModelProperty("应用编码")
private String appCode;

@ApiModelProperty("应用编码")
private String appCode;
}
}

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Purchase.java Просмотреть файл

@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;


+ 10
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPurchaseService.java Просмотреть файл

@@ -1,11 +1,15 @@
package com.ningdatech.pmapi.projectdeclared.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;

import java.util.List;

/**
* <p>
* 服务类
* 服务类
* </p>
*
* @author zpf
@@ -13,4 +17,9 @@ import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
*/
public interface IPurchaseService extends IService<Purchase> {

default List<Purchase> listByProjectId(Long projectId) {
return list(Wrappers.lambdaQuery(Purchase.class)
.eq(Purchase::getProjectId, projectId));
}

}

Загрузка…
Отмена
Сохранить