LAPTOP-FO2T5SIU\35838 před 5 měsíci
rodič
revize
434e80f6fa

+ 14 - 6
pro-base/src/main/java/com/idea/buildManage/controller/ParkRoomController.java

@@ -3,11 +3,9 @@ package com.idea.buildManage.controller;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
+import com.idea.buildManage.dto.ProjectHouseVo;
 import com.idea.buildManage.excel.*;
-import com.idea.buildManage.model.MnpBuilding;
-import com.idea.buildManage.model.ParkFloorDisc;
-import com.idea.buildManage.model.ParkInfo;
-import com.idea.buildManage.model.ParkRoom;
+import com.idea.buildManage.model.*;
 import com.idea.buildManage.response.ParkRoomResponse;
 import com.idea.buildManage.service.MnpBuildingService;
 import com.idea.buildManage.service.ParkFloorDiscService;
@@ -36,6 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -226,8 +225,17 @@ public class ParkRoomController extends BaseController {
         return result;
     }
 
-
-
+    /**
+     * 项目概览 房间列表
+     * @param discId
+     * @return
+     */
+    @PostMapping(value = "projectHouseVoList")
+    @ResponseBody
+    public Object projectHouseVoList(String discId) {
+        List<ProjectHouseVo> result = modelService.projectHouseVoList(discId);
+        return result;
+    }
 
 
 

+ 2 - 1
pro-base/src/main/java/com/idea/buildManage/dto/ProjectHouseVo.java

@@ -1,6 +1,7 @@
 package com.idea.buildManage.dto;
 
 import com.idea.buildManage.model.ParkRoom;
+import com.idea.buildManage.response.ParkRoomResponse;
 import lombok.Data;
 
 import java.util.List;
@@ -10,7 +11,7 @@ public class ProjectHouseVo {
 
     private String buildName;
 
-    private List<ParkRoom> roomList;
+    private List<ParkRoomResponse> roomList;
 
 
 }

+ 2 - 0
pro-base/src/main/java/com/idea/buildManage/response/ParkRoomResponse.java

@@ -106,4 +106,6 @@ public class ParkRoomResponse extends ParkRoom {
 
     private String houseTypeStr;
 
+    private String projectStatusStr;
+
 }

+ 81 - 9
pro-base/src/main/java/com/idea/buildManage/service/ParkRoomService.java

@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.idea.buildManage.constant.ConstantNodeType;
+import com.idea.buildManage.dto.ProjectHouseVo;
 import com.idea.buildManage.excel.MnpBuildingExcel;
 import com.idea.buildManage.excel.ParkRoomExcel;
 import com.idea.buildManage.excel.WriteHandlerStrategy;
@@ -260,12 +261,12 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
         Map<String, HouseType> houseTypesMap = houseTypes.stream()
                 .collect(Collectors.toMap(
                         HouseType::getId,
-                        HouseType->HouseType,
+                        HouseType -> HouseType,
                         (existing, replacement) -> existing // 保留现有值
                 ));
 
-        for(ParkRoomResponse room:list){
-            if(StringUtils.isNotEmpty(room.getHouseTypeId()) && houseTypesMap.containsKey(room.getHouseTypeId())){
+        for (ParkRoomResponse room : list) {
+            if (StringUtils.isNotEmpty(room.getHouseTypeId()) && houseTypesMap.containsKey(room.getHouseTypeId())) {
                 HouseType houseType = houseTypesMap.get(room.getHouseTypeId());
                 String str = houseType.getName() + "," + houseType.getBuildArea() + ",使用面积" + houseType.getUseArea();
                 room.setHouseTypeStr(str);
@@ -545,7 +546,7 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
                     parkRoomNode.setNodeName("预付款");
                     parkRoomNode.setBusinessType(ConstantNodeType.BUSINESS_TYPE_3);
                     parkRoomNode.setOrderNum(3);
-                    if(date != null){
+                    if (date != null) {
                         parkRoomNode.setHandleDate(date);
                     }
                     parkRoomNodes.add(parkRoomNode);
@@ -557,14 +558,14 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
                 if (CollectionUtils.isNotEmpty(invoiceManages)) {
 
                     //查询最大开票时间
-                    Optional<InvoiceManage> max = invoiceManages.stream().filter(item->item.getInvoiceDate() !=null)
+                    Optional<InvoiceManage> max = invoiceManages.stream().filter(item -> item.getInvoiceDate() != null)
                             .max(Comparator.comparing(InvoiceManage::getInvoiceDate));
                     InvoiceManage invoiceManage = max.orElse(null);
                     parkRoomNode = new ParkRoomNode();
                     parkRoomNode.setNodeName("开票");
                     parkRoomNode.setBusinessType(ConstantNodeType.BUSINESS_TYPE_4);
                     parkRoomNode.setOrderNum(4);
-                    if(invoiceManage != null){
+                    if (invoiceManage != null) {
                         parkRoomNode.setHandleDate(invoiceManage.getInvoiceDate());
                     }
                     parkRoomNodes.add(parkRoomNode);
@@ -617,7 +618,7 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
                         parkRoomNode.setNodeName("回购/增购");
                         parkRoomNode.setBusinessType(ConstantNodeType.BUSINESS_TYPE_7);
                         parkRoomNode.setOrderNum(7);
-                        if(buyingMore != null){
+                        if (buyingMore != null) {
                             parkRoomNode.setHandleDate(buyingMore.getSigningDate());
                         }
                         parkRoomNodes.add(parkRoomNode);
@@ -656,10 +657,10 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
                     .max(Comparator.comparing(ParkRoomNode::getHandleDate));
             ParkRoomNode parkRoomNode = max.orElse(null);
             if (parkRoomNode != null) {
-                endDate = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm",parkRoomNode.getHandleDate());
+                endDate = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm", parkRoomNode.getHandleDate());
             }
             Date handleDate = parkRoomNodes.get(0).getHandleDate();
-            startDate = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm",handleDate);
+            startDate = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm", handleDate);
             parkRoomHistory.setStartDate(startDate);
             parkRoomHistory.setEndDate(endDate);
         }
@@ -667,5 +668,76 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
         return result;
     }
 
+    /**
+     * 项目概览 房间列表
+     *
+     * @param discId
+     * @return
+     */
+    public List<ProjectHouseVo> projectHouseVoList(String discId) {
+
+        List<ProjectHouseVo> result = new ArrayList<>();
+
+        // 已签约合同
+        ContractManageExample example = new ContractManageExample();
+        example.createCriteria().andContractStatusEqualTo(2);
+        List<ContractManage> contractManages = contractManageMapper.selectByExample(example);
+        Map<String, ContractManage> contractManageMap = contractManages.stream()
+                .collect(Collectors.toMap(ContractManage::getHouseId, item -> item, (existing, replacement) -> existing));
+
+        // 载体列表
+        MnpBuildingExample buildingExample = new MnpBuildingExample();
+        buildingExample.createCriteria().andDiscIdEqualTo(discId);
+        List<MnpBuilding> mnpBuildings = buildingService.selectByExample(buildingExample);
+        for (MnpBuilding mnpBuilding : mnpBuildings) {
+
+            List<ParkRoomResponse> parkRoomResponses = new ArrayList<>();
+
+            ProjectHouseVo projectHouseVo = new ProjectHouseVo();
+            projectHouseVo.setBuildName(mnpBuilding.getBuildNum());
+
+            // 房间列表
+            ParkRoomExample roomExample = new ParkRoomExample();
+            roomExample.createCriteria().andBuildIdEqualTo(mnpBuilding.getId());
+            List<ParkRoom> parkRooms = selectByExample(roomExample);
+            for (ParkRoom room : parkRooms) {
+                ParkRoomResponse roomResponse = new ParkRoomResponse();
+                roomResponse.setRoomNo(room.getRoomNo());
+                // 已选房 待售
+                if (room.getIsChoose() == 1 && room.getSoldStatus() == 2) {
+                    roomResponse.setProjectStatusStr("已选房");
+                }
+                // 已签约
+                if (room.getSoldStatus() == 3) {
+                    roomResponse.setProjectStatusStr("已签约");
+                    ContractManage contractManage = contractManageMap.get(room.getId());
+                    // 房款 已完全收款
+                    if (contractManage != null && contractManage.getCollectionStatus() == 2) {
+                        roomResponse.setProjectStatusStr("已收款");
+                    }
+                }
+                // 已入驻
+                if (room.getSoldStatus() == 7) {
+                    roomResponse.setProjectStatusStr("已入驻");
+                }
+                // 已退房
+                if (room.getSoldStatus() == 4) {
+                    roomResponse.setProjectStatusStr("已退房");
+                }
+                // 初始状态 待售
+                if (room.getIsChoose() == 0) {
+                    roomResponse.setProjectStatusStr("已选房");
+                }
+                parkRoomResponses.add(roomResponse);
+            }
+
+            projectHouseVo.setRoomList(parkRoomResponses);
+            result.add(projectHouseVo);
+
+        }
+        return result;
+
+    }
+
 
 }

+ 3 - 2
pro-base/src/main/java/com/idea/customerManagement/service/ContractManageService.java

@@ -195,10 +195,11 @@ public class ContractManageService implements BaseService<ContractManage, Contra
      */
     public int edit(ContractManage model){
 
+        ContractManage newRecord = selectByPrimaryKey(model.getId());
         model.setUpdatedAt(new Date());
         model.setUpdatedId(ShiroUtils.getUserId());
-        // 如果是已签约
-        if(model.getContractStatus() == 2){
+        // 如果是已签约动作 并且当前状态为待签约
+        if(model.getContractStatus() == 2 && newRecord.getContractStatus() == 1){
             // 定金转房款 部分收款
             model.setCollectionStatus(1);
             // 更新房间已售状态

+ 23 - 11
pro-base/src/main/java/com/idea/customerManagement/service/IntentionalDepositService.java

@@ -651,7 +651,7 @@ public class IntentionalDepositService implements BaseService<IntentionalDeposit
     public void downLoadReceipt(IntentionalDeposit model, HttpServletResponse response) {
 
         IntentionalDeposit newRecord = selectByPrimaryKey(model.getId());
-        String filePath = "/home/project/settleDown/tem/receipt.docx";
+        String filePath = "/home/project/settleDown/tem/receipt_yxj.docx";
         String sealPath = "/home/project/settleDown/tem/seal.png";
         String fileName = "意向金收据.docx";
         String customerManagementId = newRecord.getCustomerManagementId();
@@ -668,15 +668,15 @@ public class IntentionalDepositService implements BaseService<IntentionalDeposit
                 builder.deleteCharAt(builder.length() - 1);
             }
         }
-        String fullName = "(未选房)";
-        // 意向金只有选房后 才有houseId
-        if (StringUtils.isNotEmpty(newRecord.getHouseId())) {
-            ParkRoomResponse roomResponse = roomExtendMapper.getFullName(newRecord.getHouseId());
-            fullName = roomResponse.getGroupName() + "-"
-                    + roomResponse.getDiscName() + "-"
-                    + roomResponse.getBuildName() + "-"
-                    + roomResponse.getRoomNo();
-        }
+//        String fullName = "(未选房)";
+//        // 意向金只有选房后 才有houseId
+//        if (StringUtils.isNotEmpty(newRecord.getHouseId())) {
+//            ParkRoomResponse roomResponse = roomExtendMapper.getFullName(newRecord.getHouseId());
+//            fullName = roomResponse.getGroupName() + "-"
+//                    + roomResponse.getDiscName() + "-"
+//                    + roomResponse.getBuildName() + "-"
+//                    + roomResponse.getRoomNo();
+//        }
         String serialNumber = newRecord.getSerialNumber();
         String collectionTime = DateUtils.parseDateToStr(DateUtils.DATE_CH, newRecord.getCollectionTime());
         String content = "意向金";
@@ -699,7 +699,7 @@ public class IntentionalDepositService implements BaseService<IntentionalDeposit
         data.put("${collectionTime}", collectionTime);
         data.put("${content}", content);
         data.put("${paymentMethod}", paymentMethod);
-        data.put("${fullName}", fullName);
+//        data.put("${fullName}", fullName);
         data.put("${capital}", capital);
         data.put("${receivedAmount}", receivedAmount);
         sealData.put("${seal}", sealPath);
@@ -708,6 +708,18 @@ public class IntentionalDepositService implements BaseService<IntentionalDeposit
         settingInfoData.put("topOffset", "0");
         settingData.put("${seal}", settingInfoData);
 
+        // 已转定金 用换票模板
+        if(newRecord.getStatus() == 2){
+            filePath = "/home/project/settleDown/tem/receipt_huanpiao_yxj.docx";
+            String sealPath2 = "/home/project/settleDown/tem/huanpiao.png";
+            sealData.put("${huanpiao}", sealPath2);
+
+            settingInfoData = new HashMap<>();
+            settingInfoData.put("leftOffset", "300");
+            settingInfoData.put("topOffset", "0");
+            settingData.put("${huanpiao}", settingInfoData);
+        }
+
         
         try {
             File tempWord = ReplaceWord.operateWord(response, filePath, fileName, data, picData, sealData, settingData);

+ 3 - 1
pro-base/src/main/java/com/idea/invoice/service/ReceiptManageService.java

@@ -174,6 +174,8 @@ public class ReceiptManageService implements BaseService<ReceiptManage, ReceiptM
         PayLog payLog = payLogService.selectByPrimaryKey(receiptManage.getBusinessId());
         switch (receiptManage.getReceiptType()) {
             case "1":
+                // 意向金收据 用另一个模板
+                filePath = "/home/project/settleDown/tem/receipt_yxj.docx";
                 fileName = "意向金收据.docx";
                 IntentionalDeposit record = intentionalDepositMapper.selectByPrimaryKey(receiptManage.getBusinessId());
                 serialNumber = record.getSerialNumber();
@@ -292,7 +294,7 @@ public class ReceiptManageService implements BaseService<ReceiptManage, ReceiptM
         // 已换票 已红冲
         if (receiptManage.getReceiptStatus() == 2 || receiptManage.getReceiptStatus() == 3) {
             filePath = "/home/project/settleDown/tem/receipt_huanpiao.docx";
-            // 意向金收据 已换票的 用另一个模板
+            // 意向金收据 用另一个模板
             if (receiptManage.getReceiptType().equals("1")) {
                 filePath = "/home/project/settleDown/tem/receipt_huanpiao_yxj.docx";
             }