Browse Source

初验备案

master
PoffyZhang 1 year ago
parent
commit
e3373c46d5
17 changed files with 390 additions and 6 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java
  2. +14
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java
  3. +100
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java
  4. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.java
  5. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.xml
  6. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectExportDTO.java
  7. +30
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java
  8. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsSaveDTO.java
  9. +50
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PreInsAcceptancePerson.java
  10. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java
  11. +47
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PreInsAcceptancePersonVO.java
  12. +34
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PreInsVO.java
  13. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPreInsAcceptancePersonService.java
  14. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PreInsAcceptancePersonServiceImpl.java
  15. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  16. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  17. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java View File

@@ -226,7 +226,7 @@ public class ProjectDeclareAction {
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED")
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode());
}

@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED")


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

@@ -6,8 +6,10 @@ 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.PreInsSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
@@ -70,4 +72,16 @@ public class ConstructionController {
public void exportPreList(ProjectListReq req, HttpServletResponse response){
ExcelDownUtil.downXls(response,req,constructionManage::exportPreList);
}

@ApiOperation(value = "初验备案的详情-通过项目ID", notes = "初验备案的详情-通过项目ID")
@GetMapping("/pre-ins/detail/{projectId}")
public PreInsVO detailPreInsByProjectId(@PathVariable Long projectId) {
return constructionManage.detailPreInsByProjectId(projectId);
}

@ApiOperation(value = "填写初验信息", notes = "填写初验信息")
@PostMapping("/submit-pre-ins")
public String submitPreIns(@Validated @RequestBody PreInsSaveDTO dto) {
return constructionManage.submitPreIns(dto);
}
}

+ 100
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java View File

@@ -18,15 +18,16 @@ 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.PreInsSaveDTO;
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.PreInsAcceptancePerson;
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.model.vo.*;
import com.ningdatech.pmapi.projectdeclared.service.IContractService;
import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService;
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService;
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
@@ -76,6 +77,8 @@ public class ConstructionManage {

private final IPaymentPlanService paymentPlanService;

private final IPreInsAcceptancePersonService acceptancePersonService;

private final StateMachineUtils stateMachineUtils;

/**
@@ -282,7 +285,12 @@ public class ConstructionManage {
stateMachineUtils.pass(project);
}
project.setUpdateOn(LocalDateTime.now());
project.setDeliveryTime(dto.getDeliveryTime());
if(Objects.nonNull(dto.getDeliveryTime())){
project.setDeliveryTime(dto.getDeliveryTime());
}
if(Objects.nonNull(dto.getTotalAmount())){
project.setContractAmount(dto.getTotalAmount());
}
projectService.updateById(project);

return "填写成功";
@@ -339,6 +347,8 @@ public class ConstructionManage {
item.setTransactionTime(purchase.getTransactionTime());
}
item.setDeliveryTime(w.getDeliveryTime());
item.setContractAmount(w.getContractAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
return item;
});
return PageVo.of(records, total);
@@ -375,6 +385,8 @@ public class ConstructionManage {
exportDTO.setCreateOn(createOnStr);
exportDTO.setSerialNumber(serialNumber.incrementAndGet());
exportDTO.setDeliveryTime(r.getDeliveryTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
exportDTO.setContractAmount(r.getContractAmount());
exportDTO.setAnnualPlanAmount(r.getAnnualPlanAmount());
return exportDTO;
}).collect(Collectors.toList());
}
@@ -394,4 +406,88 @@ public class ConstructionManage {
throw new RuntimeException(e);
}
}

/**
* 查询初验信息
* @param projectId
* @return
*/
public PreInsVO detailPreInsByProjectId(Long projectId) {
Project project = projectService.getById(projectId);

PreInsVO vo = new PreInsVO();
vo.setProjectId(projectId);
vo.setPreliminaryInspectionMaterials(project.getPreliminaryInspectionMaterials());

List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.eq(PreInsAcceptancePerson::getProjectId, projectId)
.orderByAsc(PreInsAcceptancePerson::getCreateOn));

if(CollUtil.isNotEmpty(acceptancePersons)){
vo.setAcceptancePersons(convertPersons(acceptancePersons));
}

return vo;
}

private List<PreInsAcceptancePersonVO> convertPersons(List<PreInsAcceptancePerson> acceptancePersons) {
if(CollUtil.isEmpty(acceptancePersons)){
return Collections.emptyList();
}

return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u,PreInsAcceptancePersonVO.class)).collect(Collectors.toList());
}

/**
* 填写初验信息
* @param dto
* @return
*/
public String submitPreIns(PreInsSaveDTO 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("提交失败 该项目不是 建设中或者已立项阶段");

//初验人员
if(Objects.nonNull(dto.getAcceptancePersons())){
//先删除
acceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.eq(PreInsAcceptancePerson::getProjectId,projectId));
if(CollUtil.isNotEmpty(dto.getAcceptancePersons())){
List<PreInsAcceptancePerson> persons = dto.getAcceptancePersons().stream().map(d -> {
PreInsAcceptancePerson person = BeanUtil.copyProperties(d, PreInsAcceptancePerson.class);
person.setProjectId(projectId);
person.setCreateOn(LocalDateTime.now());
person.setUpdateOn(LocalDateTime.now());
person.setCreateBy(employeeCode);
person.setUpdateBy(employeeCode);
return person;
}).collect(Collectors.toList());

acceptancePersonService.saveBatch(persons);
}
}


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

return "填写成功";
}
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.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.PreInsAcceptancePerson;

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

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.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.PreInsAcceptancePersonMapper">

</mapper>

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

@@ -56,4 +56,10 @@ public class DeclaredProjectExportDTO {

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

@ExcelProperty("合同金额")
private BigDecimal contractAmount;

@ExcelProperty("年度预算")
private BigDecimal annualPlanAmount;
}

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

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

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
* @Classname PreInsAcceptancePerson
* @Description 初验人员
* @Date 2023/5/30 15:35
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "PreInsAcceptancePersonSaveDTO", description = "")
public class PreInsAcceptancePersonSaveDTO {

private static final long serialVersionUID = 1L;

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

@ApiModelProperty("人员名称")
private String personName;

@ApiModelProperty("单位")
private String unit;
}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsSaveDTO.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 javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

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

private static final long serialVersionUID = 1L;

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

@ApiModelProperty("初验材料")
@NotBlank(message = "请提交初验材料")
private String preliminaryInspectionMaterials;

@ApiModelProperty("初验验收人员")
private List<PreInsAcceptancePersonSaveDTO> acceptancePersons;
}

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PreInsAcceptancePerson
* @Description 初验人员
* @Date 2023/5/30 15:35
* @Author PoffyZhang
*/
@Data
@TableName("nd_pre_ins_acceptance_person")
@ApiModel(value = "PreInsAcceptancePerson", description = "")
public class PreInsAcceptancePerson {

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 String personName;

@ApiModelProperty("单位")
private String unit;
}

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

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

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
@@ -51,7 +52,7 @@ public class PaymentPlanVO {
private String ratio;

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

}

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
* @Classname PreInsAcceptancePerson
* @Description 初验人员
* @Date 2023/5/30 15:35
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "PreInsAcceptancePersonVO", description = "")
public class PreInsAcceptancePersonVO {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
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 String personName;

@ApiModelProperty("单位")
private String unit;
}

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

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

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
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;
import java.util.List;

/**
* @Classname PreInsVO
* @Description
* @Date 2023/5/30 15:35
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "PreInsVO", description = "初验备案详情")
public class PreInsVO {

private static final long serialVersionUID = 1L;

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

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

@ApiModelProperty("初验验收人员")
private List<PreInsAcceptancePersonVO> acceptancePersons;
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPreInsAcceptancePersonService.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.PreInsAcceptancePerson;

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

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PreInsAcceptancePersonServiceImpl.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.PreInsAcceptancePersonMapper;
import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson;
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author zpf
* @since 2023-02-05
*/
@Service
public class PreInsAcceptancePersonServiceImpl extends ServiceImpl<PreInsAcceptancePersonMapper, PreInsAcceptancePerson>
implements IPreInsAcceptancePersonService {

}

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

@@ -344,4 +344,7 @@ public class Project implements Serializable {

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

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

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

@@ -350,6 +350,9 @@ public class ProjectDetailVO {
@ApiModelProperty("终验材料")
private String finalAcceptanceMaterials;

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


public String getProjectTypeName() {
if (Objects.nonNull(this.projectType)) {


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

@@ -94,6 +94,12 @@ public class ProjectLibListItemVO {
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime deliveryTime;

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

@ApiModelProperty("年度支付计划-年度支付计划(元)")
private BigDecimal annualPlanAmount;

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


Loading…
Cancel
Save