소스 검색

Merge remote-tracking branch 'origin/master'

master
CMM 1 년 전
부모
커밋
c90a5633a5
2개의 변경된 파일47개의 추가작업 그리고 65개의 파일을 삭제
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java
  2. +46
    -64
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java 파일 보기

@@ -66,7 +66,7 @@ public class ConstructionController {

@ApiOperation(value = "待初验备案的项目列表", notes = "待初验备案的项目列表")
@GetMapping("/pre-ins/project-list")
public PageVo<ProjectLibListItemVO> preProjectlist(@ModelAttribute ProjectListReq req) {
public PageVo<ProjectLibListItemVO> preProjectList(@ModelAttribute ProjectListReq req) {
return constructionManage.preProjectlist(req);
}



+ 46
- 64
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java 파일 보기

@@ -83,6 +83,7 @@ public class ConstructionManage {

/**
* 待采购的-项目列表
*
* @param req
* @return
*/
@@ -91,22 +92,15 @@ public class ConstructionManage {
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.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());
@@ -124,11 +118,6 @@ public class ConstructionManage {
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);
@@ -139,15 +128,15 @@ public class ConstructionManage {
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.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)){
if (CollUtil.isNotEmpty(records)) {
List<Long> projectIds = records.stream().map(Project::getId).collect(Collectors.toList());

List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class)
@@ -164,7 +153,7 @@ public class ConstructionManage {
exportDTO.setSerialNumber(serialNumber.incrementAndGet());
exportDTO.setApprovedAmount(r.getApprovalAmount());
exportDTO.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
if(purchaseMap.containsKey(r.getId())){
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")));
@@ -174,7 +163,7 @@ public class ConstructionManage {
}

String fileName = "合同备案项目列表";
ExcelDownUtil.setFileName(fileName,response);
ExcelDownUtil.setFileName(fileName, response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class)
@@ -191,6 +180,7 @@ public class ConstructionManage {

/**
* 获取合同备案详情
*
* @param projectId
* @return
*/
@@ -205,22 +195,22 @@ public class ConstructionManage {
.eq(PaymentPlan::getProjectId, projectId)
.orderByAsc(PaymentPlan::getPaymentTime));

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

return vo;
}

private List<PaymentPlanVO> convertPayments(List<PaymentPlan> payments,BigDecimal totalAmount) {
if(CollUtil.isEmpty(payments)){
private List<PaymentPlanVO> convertPayments(List<PaymentPlan> payments, BigDecimal totalAmount) {
if (CollUtil.isEmpty(payments)) {
return Collections.emptyList();
}
return payments.stream().map(p -> {
PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class);
vo.setRatio((Objects.isNull(totalAmount)||totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%"
vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%"
: p.getPaymentAmount().multiply(BigDecimal.valueOf(100))
.divide(totalAmount,BigDecimal.ROUND_CEILING,BigDecimal.ROUND_CEILING) + "%");
.divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%");
return vo;
})
.collect(Collectors.toList());
@@ -228,6 +218,7 @@ public class ConstructionManage {

/**
* 填写合同信息
*
* @param dto
* @return
*/
@@ -251,21 +242,21 @@ public class ConstructionManage {
.eq(Contract::getProjectId, projectId)
.last(BizConst.LIMIT_1));

BeanUtil.copyProperties(dto,contractEntity);
if(Objects.isNull(contract)){
BeanUtil.copyProperties(dto, contractEntity);
if (Objects.isNull(contract)) {
contractEntity.setCreateOn(LocalDateTime.now());
contractEntity.setCreateBy(employeeCode);
}else{
} else {
contractEntity.setId(contract.getId());
}
contractEntity.setProjectId(projectId);
if(contractService.saveOrUpdate(contractEntity)){
if (contractService.saveOrUpdate(contractEntity)) {
//存 付款计划信心
if(Objects.nonNull(dto.getPayments())){
if (Objects.nonNull(dto.getPayments())) {
//先删除
paymentPlanService.remove(Wrappers.lambdaQuery(PaymentPlan.class)
.eq(PaymentPlan::getProjectId,projectId));
if(CollUtil.isNotEmpty(dto.getPayments())){
.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);
@@ -282,15 +273,15 @@ public class ConstructionManage {
}

//判断下 如果和初验都完成了 才进入下一阶段
if(StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())){
if (StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())) {
//进入到下一状态
stateMachineUtils.pass(project);
}
project.setUpdateOn(LocalDateTime.now());
if(Objects.nonNull(dto.getDeliveryTime())){
if (Objects.nonNull(dto.getDeliveryTime())) {
project.setDeliveryTime(dto.getDeliveryTime());
}
if(Objects.nonNull(dto.getTotalAmount())){
if (Objects.nonNull(dto.getTotalAmount())) {
project.setContractAmount(dto.getTotalAmount());
}
projectService.updateById(project);
@@ -300,6 +291,7 @@ public class ConstructionManage {

/**
* 待初验项目列表
*
* @param req
* @return
*/
@@ -308,9 +300,9 @@ public class ConstructionManage {
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.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
//交货时间 排序
query.isNotNull(Project::getDeliveryTime);
query.orderByAsc(Project::getDeliveryTime);
@@ -319,13 +311,6 @@ public class ConstructionManage {
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());
@@ -343,11 +328,6 @@ public class ConstructionManage {
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());
}
item.setDeliveryTime(w.getDeliveryTime());
item.setContractAmount(w.getContractAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
@@ -361,9 +341,9 @@ public class ConstructionManage {
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.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
//交货时间 排序
query.isNotNull(Project::getDeliveryTime);
query.orderByAsc(Project::getDeliveryTime);
@@ -371,7 +351,7 @@ public class ConstructionManage {

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

List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class)
@@ -394,7 +374,7 @@ public class ConstructionManage {
}

String fileName = "合同备案项目列表";
ExcelDownUtil.setFileName(fileName,response);
ExcelDownUtil.setFileName(fileName, response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class)
@@ -411,6 +391,7 @@ public class ConstructionManage {

/**
* 查询初验信息
*
* @param projectId
* @return
*/
@@ -425,7 +406,7 @@ public class ConstructionManage {
.eq(PreInsAcceptancePerson::getProjectId, projectId)
.orderByAsc(PreInsAcceptancePerson::getCreateOn));

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

@@ -433,15 +414,16 @@ public class ConstructionManage {
}

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

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

/**
* 填写初验信息
*
* @param dto
* @return
*/
@@ -461,11 +443,11 @@ public class ConstructionManage {
.throwMessage("提交失败 该项目不是 建设中或者已立项阶段");

//初验人员
if(Objects.nonNull(dto.getAcceptancePersons())){
if (Objects.nonNull(dto.getAcceptancePersons())) {
//先删除
acceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.eq(PreInsAcceptancePerson::getProjectId,projectId));
if(CollUtil.isNotEmpty(dto.getAcceptancePersons())){
.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);
@@ -482,7 +464,7 @@ public class ConstructionManage {


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


불러오는 중...
취소
저장