Browse Source

Merge remote-tracking branch 'origin/master'

master
CMM 1 year ago
parent
commit
25172b8d72
1 changed files with 12 additions and 23 deletions
  1. +12
    -23
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java

+ 12
- 23
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java View File

@@ -19,12 +19,14 @@ 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.*;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PaymentPlanVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsVO;
import com.ningdatech.pmapi.projectdeclared.service.IContractService;
import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService;
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService;
@@ -47,7 +49,6 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
@@ -349,15 +350,9 @@ public class ConstructionManage {
query.orderByAsc(Project::getDeliveryTime);
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));

AtomicInteger serialNumber = new AtomicInteger(0);
collect = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportDTO);
@@ -382,8 +377,6 @@ public class ConstructionManage {
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -397,19 +390,14 @@ public class ConstructionManage {
*/
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)
LambdaQueryWrapper<PreInsAcceptancePerson> query = Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.eq(PreInsAcceptancePerson::getProjectId, projectId)
.orderByAsc(PreInsAcceptancePerson::getCreateOn));

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

.orderByAsc(PreInsAcceptancePerson::getCreateOn);
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(query);
vo.setAcceptancePersons(convertPersons(acceptancePersons));
return vo;
}

@@ -417,8 +405,9 @@ public class ConstructionManage {
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());
}

/**


Loading…
Cancel
Save