Browse Source

在住客户筛选

xiongzhu 6 years ago
parent
commit
48214a61cb

+ 3 - 0
src/main/java/com/izouma/zhumj/dto/report/CheckinInfoReportDTO.java

@@ -89,6 +89,9 @@ public class CheckinInfoReportDTO {
     @ExcelProperty(value = "团队")
     private String teamName;
 
+    @ApiModelProperty(value = "合同", name = "contractNumber")
+    @ExcelProperty(value = "合同")
+    private String contractNumber;
 
     @ApiModelProperty(value = "床位号", name = "bedName")
     @ExcelProperty(value = "床位号")

+ 9 - 0
src/main/java/com/izouma/zhumj/service/CheckinInfoService.java

@@ -395,6 +395,8 @@ public class CheckinInfoService {
         List<User> userList = userRepo
                 .findAllByIdNoIn(checkinInfoList.stream().map(CheckinInfo::getIdNo).filter(Objects::nonNull)
                         .collect(Collectors.toSet()));
+        List<Contract> contractList = contractRepo.findAllById(checkinInfoList.stream().map(CheckinInfo::getOrderId)
+                .filter(Objects::nonNull).collect(Collectors.toSet()));
 
         List<CheckinInfoReportDTO> checkinInfoReportDTOList = new ArrayList<>();
         for (CheckinInfo checkinInfo : checkinInfoList) {
@@ -409,6 +411,12 @@ public class CheckinInfoService {
                     .anyMatch(userDTO -> userDTO.getIdNo().equalsIgnoreCase(checkinInfo.getIdNo())
                             && userDTO.getOpenId() != null
                             && !userDTO.isTemporal());
+            String contractNumber = null;
+            if (checkinInfo.getOrderId() != null) {
+                contractNumber = contractList.stream()
+                        .filter(contract -> checkinInfo.getOrderId().equals(contract.getId()))
+                        .findAny().map(Contract::getContractNumber).orElse(null);
+            }
             checkinInfoReportDTOList.add(CheckinInfoReportDTO.builder()
                     .id(checkinInfo.getId())
                     .roomName(roomName)
@@ -427,6 +435,7 @@ public class CheckinInfoService {
                     .phone(checkinInfo.getPhone())
                     .money(money)
                     .teamName(checkinInfo.getTeamName())
+                    .contractNumber(contractNumber)
                     .bedName(bedName)
                     .checkinType(checkinInfo.getCheckInType().getDescription())
                     .hasWx(hasWx)

+ 1 - 0
src/main/vue/src/views/CheckinInfoReport.vue

@@ -70,6 +70,7 @@
             <el-table-column prop="roomName" label="房间" width="80"> </el-table-column>
             <el-table-column prop="bedName" label="床位号" width="80"> </el-table-column>
             <el-table-column prop="teamName" label="团队" width="120" show-overflow-tooltip> </el-table-column>
+            <el-table-column prop="contractNumber" label="合同" width="120" show-overflow-tooltip> </el-table-column>
             <el-table-column prop="name" label="姓名" show-overflow-tooltip> </el-table-column>
             <el-table-column prop="sex" label="姓别"> </el-table-column>
             <el-table-column prop="idNo" label="证件号" width="180"> </el-table-column>

+ 1 - 7
src/test/java/com/izouma/zhumj/repo/sale/ContractRepoTest.java

@@ -295,12 +295,6 @@ public class ContractRepoTest extends ZhumjApplicationTests {
 
     @Test
     public void findById() {
-        Contract contract = contractRepo.findById(815272L).get();
-        for (ContractStore contractStore : contract.getContractStoreList()) {
-            System.out.println("contractStore " + contractStore.getId());
-            for (ContractRoomType contractRoomType : contractStore.getRoomList()) {
-                System.out.println("contractRoomType " + contractRoomType.getId());
-            }
-        }
+        contractRepo.findAllById(new ArrayList<>());
     }
 }