Browse Source

合同备案 接口

tags/24080901
PoffyZhang 1 year ago
parent
commit
f8f87c56bb
22 changed files with 897 additions and 14 deletions
  1. +63
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java
  2. +282
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java
  3. +25
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java
  4. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.java
  5. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.xml
  6. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.java
  7. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.xml
  8. +60
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContractSaveDTO.java
  9. +13
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectExportDTO.java
  10. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PaymentPlanSaveDTO.java
  11. +70
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Contract.java
  12. +53
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PaymentPlan.java
  13. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Purchase.java
  14. +77
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ContractVO.java
  15. +54
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java
  16. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IContractService.java
  17. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPaymentPlanService.java
  18. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ContractServiceImpl.java
  19. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PaymentPlanServiceImpl.java
  20. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  21. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  22. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java

+ 63
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java View File

@@ -0,0 +1,63 @@
package com.ningdatech.pmapi.projectdeclared.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.manage.ConstructionManage;
import com.ningdatech.pmapi.projectdeclared.manage.ProjectAdjustmentManage;
import com.ningdatech.pmapi.projectdeclared.manage.PurchaseManage;
import com.ningdatech.pmapi.projectdeclared.model.dto.ContractSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;

/**
* @Classname ConstructionController
* @Description 申报项目-建设中
* @Date 2023/5/29 09:29
* @Author PoffyZhang
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/api/v1/declared/construction")
@Api(value = "ConstructionController", tags = "申报管理-建设中")
@RequiredArgsConstructor
public class ConstructionController {
private final ConstructionManage constructionManage;

@ApiOperation(value = "待合同备案的项目列表", notes = "合同备案的项目列表")
@GetMapping("/contract/project-list")
public PageVo<ProjectLibListItemVO> projectlist(@ModelAttribute ProjectListReq req) {
return constructionManage.projectLibList(req);
}

@GetMapping("/contract/export")
@ApiOperation("待合同备案的项目列表导出")
public void exportList(ProjectListReq req, HttpServletResponse response){
ExcelDownUtil.downXls(response,req,constructionManage::exportList);
}

@ApiOperation(value = "合同备案的详情-通过项目ID", notes = "合同备案的详情-通过项目ID")
@GetMapping("/contract/detail/{projectId}")
public ContractVO detailContractByProjectId(@PathVariable Long projectId) {
return constructionManage.detailContractByProjectId(projectId);
}

@ApiOperation(value = "填写合同信息", notes = "填写合同信息")
@PostMapping("/submit-contract")
public String submitContract(@Validated @RequestBody ContractSaveDTO dto) {
return constructionManage.submitContract(dto);
}


}

+ 282
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java View File

@@ -0,0 +1,282 @@
package com.ningdatech.pmapi.projectdeclared.manage;

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.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.ContractSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PaymentPlanVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectdeclared.service.IContractService;
import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService;
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
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.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

/**
* @Classname ContructionManage
* @Description
* @Date 2023/5/29 14:48
* @Author PoffyZhang
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class ConstructionManage {

private final IProjectService projectService;
private final UserInfoHelper userInfoHelper;

private final IPurchaseService purchaseService;

private final IContractService contractService;

private final IPaymentPlanService paymentPlanService;

private final StateMachineUtils stateMachineUtils;

/**
* 待采购的-项目列表
* @param req
* @return
*/
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
//建设中状态
query.eq(Project::getStatus,ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest,Boolean.TRUE);
query.orderByAsc(Project::getTransactionTime);
Page<Project> page = projectService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
return PageVo.empty();
}

List<Long> projectIds = page.getRecords().stream().map(Project::getId).collect(Collectors.toList());

List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, projectIds));
Map<Long, Purchase> purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v));

List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
item.setCreateOn(w.getCreateOn());
item.setDeclaredAmount(w.getDeclareAmount());
item.setStage(w.getStage());
item.setStatus(w.getStatus());
item.setProjectType(w.getProjectType());
item.setProjectYear(w.getProjectYear());
item.setBuildOrg(w.getBuildOrgName());
item.setBizDomain(w.getBizDomain());
item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
item.setApprovedAmount(w.getApprovalAmount());
item.setApprovalDate(w.getApprovalDate());
if(purchaseMap.containsKey(w.getId())){
Purchase purchase = purchaseMap.get(w.getId());
item.setTransactionAmount(purchase.getTransactionAmount());
item.setTransactionTime(purchase.getTransactionTime());
}
return item;
});
return PageVo.of(records, total);
}

public void exportList(HttpServletResponse response, ProjectListReq param) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
//待采购状态
query.eq(Project::getStatus,ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest,Boolean.TRUE);
query.orderByAsc(Project::getTransactionTime);
List<Project> records = projectService.list(query);

AtomicInteger serialNumber = new AtomicInteger(0);
List<DeclaredProjectExportDTO> collect = Lists.newArrayList();
if(CollUtil.isNotEmpty(records)){
List<Long> projectIds = records.stream().map(Project::getId).collect(Collectors.toList());

List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, projectIds));
Map<Long, Purchase> purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v));

collect = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
exportDTO.setCreateOn(createOnStr);
exportDTO.setSerialNumber(serialNumber.incrementAndGet());
if(purchaseMap.containsKey(r.getId())){
Purchase purchase = purchaseMap.get(r.getId());
exportDTO.setTransactionAmount(purchase.getTransactionAmount());
exportDTO.setTransactionTime(purchase.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
return exportDTO;
}).collect(Collectors.toList());
}

String fileName = "合同备案项目列表";
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

/**
* 获取合同备案详情
* @param projectId
* @return
*/
public ContractVO detailContractByProjectId(Long projectId) {
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class)
.eq(Contract::getProjectId, projectId)
.last(BizConst.LIMIT_1));

ContractVO vo = BeanUtil.copyProperties(contract, ContractVO.class);

List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class)
.eq(PaymentPlan::getProjectId, projectId));

if(CollUtil.isNotEmpty(payments)){
vo.setPayments(convertPayments(payments));
}

return vo;
}

private List<PaymentPlanVO> convertPayments(List<PaymentPlan> payments) {
if(CollUtil.isEmpty(payments)){
return Collections.emptyList();
}
return payments.stream().map(p -> BeanUtil.copyProperties(p,PaymentPlanVO.class))
.collect(Collectors.toList());
}

/**
* 填写合同信息
* @param dto
* @return
*/
public String submitContract(ContractSaveDTO dto) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
String employeeCode = user.getEmployeeCode();
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!");

Long projectId = dto.getProjectId();
VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!");
Project project = projectService.getNewProject(dto.getProjectId());
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!");

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

Contract contractEntity = new Contract();
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class)
.eq(Contract::getProjectId, projectId)
.last(BizConst.LIMIT_1));

BeanUtil.copyProperties(dto,contractEntity);
if(Objects.isNull(contract)){
contractEntity.setCreateOn(LocalDateTime.now());
contractEntity.setCreateBy(employeeCode);
}else{
contractEntity.setId(contract.getId());
}
contractEntity.setProjectId(projectId);
if(contractService.saveOrUpdate(contractEntity)){
//存 付款计划信心
if(Objects.nonNull(dto.getPayments())){
//先删除
paymentPlanService.remove(Wrappers.lambdaQuery(PaymentPlan.class)
.eq(PaymentPlan::getProjectId,projectId));
if(CollUtil.isNotEmpty(dto.getPayments())){
List<PaymentPlan> payments = dto.getPayments().stream().map(d -> {
PaymentPlan plan = BeanUtil.copyProperties(d, PaymentPlan.class);
plan.setProjectId(projectId);
plan.setCreateOn(LocalDateTime.now());
plan.setUpdateOn(LocalDateTime.now());
plan.setCreateBy(employeeCode);
plan.setUpdateBy(employeeCode);
return plan;
}).collect(Collectors.toList());

paymentPlanService.saveBatch(payments);
}
}
}

//判断下 如果和初验都完成了 才进入下一阶段
if(StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())){
//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setDeliveryTime(dto.getDeliveryTime());
projectService.updateById(project);
}

return "填写成功";
}
}

+ 25
- 11
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java View File

@@ -1,10 +1,12 @@
package com.ningdatech.pmapi.projectdeclared.manage;

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;
@@ -35,6 +37,7 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
@@ -71,6 +74,7 @@ public class PurchaseManage {
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;
if ((total = page.getTotal()) == 0) {
@@ -106,19 +110,27 @@ public class PurchaseManage {
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> collect = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
exportDTO.setCreateOn(createOnStr);
exportDTO.setSerialNumber(serialNumber.incrementAndGet());
return exportDTO;
}).collect(Collectors.toList());
List<DeclaredProjectExportDTO> data = Lists.newArrayList();

if(CollUtil.isNotEmpty(records)){
data = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
exportDTO.setCreateOn(createOnStr);
exportDTO.setSerialNumber(serialNumber.incrementAndGet());
exportDTO.setApprovedAmount(r.getApprovalAmount());
exportDTO.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
return exportDTO;
}).collect(Collectors.toList());
}

String fileName = "采购结果待备案项目列表";
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
@@ -127,7 +139,7 @@ public class PurchaseManage {
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
.doWrite(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -184,6 +196,8 @@ public class PurchaseManage {
//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setTransactionAmount(dto.getTransactionAmount());
project.setTransactionTime(dto.getTransactionTime());
projectService.updateById(project);

return "填写成功";


+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.projectdeclared.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;

/**
* <p>
* Mapper 接口
* </p>
*
* @author zpf
* @since 2023-02-05
*/
public interface ContractMapper extends BaseMapper<Contract> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.projectdeclared.mapper.ContractMapper">

</mapper>

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.projectdeclared.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan;

/**
* <p>
* Mapper 接口
* </p>
*
* @author zpf
* @since 2023-02-05
*/
public interface PaymentPlanMapper extends BaseMapper<PaymentPlan> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.projectdeclared.mapper.PaymentPlanMapper">

</mapper>

+ 60
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContractSaveDTO.java View File

@@ -0,0 +1,60 @@
package com.ningdatech.pmapi.projectdeclared.model.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname Contract
* @Description
* @Date 2023/5/30 15:35
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "合同对象", description = "")
public class ContractSaveDTO {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目ID")
@NotNull(message = "项目ID不能为空")
private Long projectId;

@ApiModelProperty("合同名称")
private String name;

@ApiModelProperty("合同总金额")
private BigDecimal totalAmount;

@ApiModelProperty("供应商开户行")
private String supplierBank;

@ApiModelProperty("供应商开户行帐号")
private String supplierAccount;

@ApiModelProperty("质保期 年")
private Integer warrantyPeriod;

@ApiModelProperty("质保金")
private BigDecimal retentionMoney;

@ApiModelProperty("合同完成时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime contractTime;

@ApiModelProperty("交货日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime deliveryTime;

@ApiModelProperty("附件")
private String attachment;

@ApiModelProperty("支付计划")
private List<PaymentPlanSaveDTO> payments;
}

+ 13
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectExportDTO.java View File

@@ -1,12 +1,12 @@
package com.ningdatech.pmapi.projectdeclared.model.dto;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;


@@ -42,4 +42,16 @@ public class DeclaredProjectExportDTO {
@ExcelProperty("项目状态")
private String statusName;

@ExcelProperty("批复金额")
private BigDecimal approvedAmount;

@ExcelProperty("立项批复时间")
private String approvalDate;

@ExcelProperty("成交金额")
private BigDecimal transactionAmount;

@ExcelProperty("成交时间")
private String transactionTime;

}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PaymentPlanSaveDTO.java View File

@@ -0,0 +1,36 @@
package com.ningdatech.pmapi.projectdeclared.model.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PaymentPlan
* @Description
* @Date 2023/5/30 16:11
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "PaymentPlan", description = "")
public class PaymentPlanSaveDTO {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("计划金额")
private BigDecimal planAmount;

@ApiModelProperty("支付金额")
private BigDecimal paymentAmount;

@ApiModelProperty("支付时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime paymentTime;

}

+ 70
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Contract.java View File

@@ -0,0 +1,70 @@
package com.ningdatech.pmapi.projectdeclared.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.joda.time.LocalDate;

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

/**
* @Classname Contract
* @Description
* @Date 2023/5/30 15:35
* @Author PoffyZhang
*/
@Data
@TableName("nd_contract")
@ApiModel(value = "合同对象", description = "")
public class Contract {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("创建人")
private String createBy;

@ApiModelProperty("修改人人")
private String updateBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("合同名称")
private String name;

@ApiModelProperty("合同总金额")
private BigDecimal totalAmount;

@ApiModelProperty("供应商开户行")
private String supplierBank;

@ApiModelProperty("供应商开户行帐号")
private String supplierAccount;

@ApiModelProperty("质保期 年")
private Integer warrantyPeriod;

@ApiModelProperty("质保金")
private BigDecimal retentionMoney;

@ApiModelProperty("合同完成时间")
private LocalDateTime contractTime;

@ApiModelProperty("交货日期")
private LocalDateTime deliveryTime;

@ApiModelProperty("附件")
private String attachment;

@ApiModelProperty("项目ID")
private Long projectId;
}

+ 53
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PaymentPlan.java View File

@@ -0,0 +1,53 @@
package com.ningdatech.pmapi.projectdeclared.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PaymentPlan
* @Description
* @Date 2023/5/30 16:11
* @Author PoffyZhang
*/
@Data
@TableName("nd_payment_plan")
@ApiModel(value = "PaymentPlan", description = "")
public class PaymentPlan {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("创建人")
private String createBy;

@ApiModelProperty("修改人人")
private String updateBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("计划金额")
private BigDecimal planAmount;

@ApiModelProperty("支付金额")
private BigDecimal paymentAmount;

@ApiModelProperty("支付时间")
private LocalDateTime paymentTime;

}

+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Purchase.java View File

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

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**


+ 77
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ContractVO.java View File

@@ -0,0 +1,77 @@
package com.ningdatech.pmapi.projectdeclared.model.vo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname Contract
* @Description
* @Date 2023/5/30 15:35
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "ContractVO", description = "")
public class ContractVO {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
private Long id;

@ApiModelProperty("创建人")
@TableField(fill = FieldFill.INSERT)
private String createBy;

@ApiModelProperty("修改人人")
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("合同名称")
private String name;

@ApiModelProperty("合同总金额")
private BigDecimal totalAmount;

@ApiModelProperty("供应商开户行")
private String supplierBank;

@ApiModelProperty("供应商开户行帐号")
private String supplierAccount;

@ApiModelProperty("质保期 年")
private Integer warrantyPeriod;

@ApiModelProperty("质保金")
private BigDecimal retentionMoney;

@ApiModelProperty("合同完成时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime contractTime;

@ApiModelProperty("交货日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime deliveryTime;

@ApiModelProperty("附件")
private String attachment;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("支付计划")
private List<PaymentPlanVO> payments;
}

+ 54
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java View File

@@ -0,0 +1,54 @@
package com.ningdatech.pmapi.projectdeclared.model.vo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PaymentPlan
* @Description
* @Date 2023/5/30 16:11
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "PaymentPlanVO", description = "")
public class PaymentPlanVO {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
private Long id;

@ApiModelProperty("创建人")
@TableField(fill = FieldFill.INSERT)
private String createBy;

@ApiModelProperty("修改人人")
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("计划金额")
private BigDecimal planAmount;

@ApiModelProperty("支付金额")
private BigDecimal paymentAmount;

@ApiModelProperty("支付时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime paymentTime;

}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IContractService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.projectdeclared.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;

/**
* <p>
* 服务类
* </p>
*
* @author zpf
* @since 2023-05-29
*/
public interface IContractService extends IService<Contract> {

}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPaymentPlanService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.projectdeclared.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan;

/**
* <p>
* 服务类
* </p>
*
* @author zpf
* @since 2023-05-29
*/
public interface IPaymentPlanService extends IService<PaymentPlan> {

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ContractServiceImpl.java View File

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.projectdeclared.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.projectdeclared.mapper.ContractMapper;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
import com.ningdatech.pmapi.projectdeclared.service.IContractService;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author zpf
* @since 2023-02-05
*/
@Service
public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
implements IContractService {

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PaymentPlanServiceImpl.java View File

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.projectdeclared.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.projectdeclared.mapper.PaymentPlanMapper;
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan;
import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author zpf
* @since 2023-02-05
*/
@Service
public class PaymentPlanServiceImpl extends ServiceImpl<PaymentPlanMapper, PaymentPlan>
implements IPaymentPlanService {

}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java View File

@@ -329,4 +329,19 @@ public class Project implements Serializable {

@ApiModelProperty("是否是最新版本")
private Boolean newest;

@ApiModelProperty("成交金额")
private BigDecimal transactionAmount;

@ApiModelProperty("成交时间")
private LocalDateTime transactionTime;

@ApiModelProperty("交货时间")
private LocalDateTime deliveryTime;

@ApiModelProperty("初验材料")
private String preliminaryInspectionMaterials;

@ApiModelProperty("终验材料")
private String finalAcceptanceMaterials;
}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java View File

@@ -1,6 +1,8 @@
package com.ningdatech.pmapi.projectlib.model.vo;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import io.swagger.annotations.ApiModel;
@@ -331,6 +333,24 @@ public class ProjectDetailVO {
private LocalDateTime createOn;
private LocalDateTime updateOn;

@ApiModelProperty("成交金额")
private BigDecimal transactionAmount;

@ApiModelProperty("成交时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime transactionTime;

@ApiModelProperty("交货时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime deliveryTime;

@ApiModelProperty("初验材料")
private String preliminaryInspectionMaterials;

@ApiModelProperty("终验材料")
private String finalAcceptanceMaterials;


public String getProjectTypeName() {
if (Objects.nonNull(this.projectType)) {
Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType))


+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.projectlib.model.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
@@ -82,6 +83,17 @@ public class ProjectLibListItemVO {

private String projectTypeName;

@ApiModelProperty("成交金额")
private BigDecimal transactionAmount;

@ApiModelProperty("成交时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime transactionTime;

@ApiModelProperty("交货时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime deliveryTime;

public String getProjectTypeName() {
if (Objects.nonNull(this.projectType)) {
Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType))


Loading…
Cancel
Save