LAPTOP-FO2T5SIU\35838 5 months ago
parent
commit
01c4fa339f

+ 18 - 0
pro-base/src/main/java/com/idea/customerManagement/excel/TempDepositExcel.java

@@ -0,0 +1,18 @@
+package com.idea.customerManagement.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+@Data
+public class TempDepositExcel {
+
+    @ExcelProperty(value = "楼栋")
+    private String buildName;
+
+    @ExcelProperty(value = "户号")
+    private String roomNo;
+
+    @ExcelProperty(value = "收款时间")
+    private String collectionTime;
+
+}

+ 2 - 1
pro-base/src/main/java/com/idea/customerManagement/mapper/CustomerManagementExtendMapper.java

@@ -16,7 +16,8 @@ public interface CustomerManagementExtendMapper {
 
     CustomerManagement getByNum(String num);
 
-    ParkRoom getByBuildHouseName(String buildName, String roomNo);
+    ParkRoom getByBuildHouseName(@Param("buildName") String buildName,
+                                 @Param("roomNo") String roomNo);
 
     List<CustomerManagementDto> reportList(CustomerManagementDto record);
 

+ 4 - 1
pro-base/src/main/java/com/idea/customerManagement/service/ContractManageService.java

@@ -196,8 +196,12 @@ public class ContractManageService implements BaseService<ContractManage, Contra
     public int edit(ContractManage model){
 
         ContractManage newRecord = selectByPrimaryKey(model.getId());
+        CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(model.getCustomerManagementId());
+
         model.setUpdatedAt(new Date());
         model.setUpdatedId(ShiroUtils.getUserId());
+        // 刷新买受人
+        model.setBuyerName(customerManagement.getBuyerName());
         // 如果是已签约动作 并且当前状态为待签约
         if(model.getContractStatus() == 2 && newRecord.getContractStatus() == 1){
             // 定金转房款 部分收款
@@ -208,7 +212,6 @@ public class ContractManageService implements BaseService<ContractManage, Contra
             parkRoom.setSoldStatus(3);
             parkRoomService.updateByPrimaryKeySelective(parkRoom);
             // 更新客户管理 购房状态 已签约
-            CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(model.getCustomerManagementId());
             customerManagement.setStatus(3);
             customerManagementMapper.updateByPrimaryKeySelective(customerManagement);
             // 更新定金管理 收取状态

+ 98 - 1
pro-base/src/main/java/com/idea/customerManagement/service/CustomerManagementService.java

@@ -27,12 +27,17 @@ import com.idea.customerManagement.dto.CustomerManagementDto;
 import com.idea.customerManagement.excel.CustomerManagementExcel;
 import com.idea.customerManagement.excel.TempContractExcel;
 import com.idea.customerManagement.excel.TempCusExcel;
+import com.idea.customerManagement.excel.TempDepositExcel;
 import com.idea.customerManagement.mapper.ContractManageMapper;
 import com.idea.customerManagement.mapper.CustomerManagementExtendMapper;
 import com.idea.customerManagement.mapper.CustomerManagementMapper;
 import com.idea.customerManagement.mapper.RoomSelectionInfoMapper;
 import com.idea.customerManagement.model.*;
+import com.idea.invoice.model.ReceiptManage;
+import com.idea.invoice.service.ReceiptManageService;
 import com.idea.invoice.util.InvoiceUtil;
+import com.idea.paymentManagement.mapper.PayLogMapper;
+import com.idea.paymentManagement.model.PayLog;
 import com.idea.util.DateUtils;
 import com.idea.util.ExcelUtils;
 import com.idea.util.ReplaceWord;
@@ -96,6 +101,8 @@ public class CustomerManagementService implements BaseService<CustomerManagement
     private ParkRoomService parkRoomService;
     @Autowired
     private ContractManageService contractManageService;
+    @Autowired
+    private PayLogMapper payLogMapper;
 
 
     @Override
@@ -1196,7 +1203,11 @@ public class CustomerManagementService implements BaseService<CustomerManagement
 
     }
 
-
+    /**
+     * 更新合同信息
+     * @param file
+     * @throws IOException
+     */
     public void tempContractUpdate(MultipartFile file) throws IOException {
 
         // 读取excel
@@ -1292,4 +1303,90 @@ public class CustomerManagementService implements BaseService<CustomerManagement
 
     }
 
+
+
+    /**
+     * 更新定金信息
+     * @param file
+     * @throws IOException
+     */
+    public void tempDepositUpdate(MultipartFile file) throws IOException {
+
+        // 读取excel
+        ExcelUtils excelUtils = new ExcelUtils();
+        List<TempDepositExcel> list = excelUtils.excelImport(file.getInputStream(), TempDepositExcel.class,"惠景二期",1);
+        BigDecimal decimal = new BigDecimal("10000");
+        for(TempDepositExcel excel : list){
+            System.out.println("excel信息" + excel.toString());
+
+            String buildName = excel.getBuildName();
+            String roomNo = excel.getRoomNo();
+            String collectionTime = excel.getCollectionTime();
+            ParkRoom room = extendMapper.getByBuildHouseName(buildName, roomNo);
+
+            // 更新定金状态
+            RoomSelectionInfoExample example = new RoomSelectionInfoExample();
+            example.createCriteria().andHouseIdEqualTo(room.getId());
+            List<RoomSelectionInfo> deposits = roomSelectionInfoMapper.selectByExample(example);
+            if(CollectionUtils.isNotEmpty(deposits)){
+                RoomSelectionInfo model = deposits.get(0);
+                model.setUpdatedAt(new Date());
+                model.setUpdatedId("1");
+                model.setStatus(2);
+                model.setCollectionId("1");
+                model.setCollectionTime(DateUtils.parseDate(collectionTime));
+                model.setPaymentMethod(1);
+                model.setReceivedAmount(decimal);
+                roomSelectionInfoMapper.updateByPrimaryKeySelective(model);
+
+                ContractManageExample contractManageExample = new ContractManageExample();
+                contractManageExample.createCriteria().andCustomerManagementIdEqualTo(model.getCustomerManagementId());
+                List<ContractManage> contractManages = contractManageService.selectByExample(contractManageExample);
+                if(CollectionUtils.isNotEmpty(contractManages)){
+
+                    String contractId = contractManages.get(0).getId();
+                    // 新增一条定金收款记录
+                    PayLog payLog = new PayLog();
+                    payLog.setId(IdUtil.simpleUUID());
+                    payLog.setBusinessId(model.getId());
+                    payLog.setHouseId(model.getHouseId());
+                    payLog.setContractId(contractId);
+                    payLog.setCustomerManagementId(model.getCustomerManagementId());
+                    // 收款类型 预收款
+                    payLog.setPayType(1);
+                    // 款项内容 定金
+                    payLog.setContentType(1);
+                    payLog.setPayMoney(model.getReceivedAmount());
+                    payLog.setPayTime(new Date());
+                    payLog.setPaymentMethod(model.getPaymentMethod());
+                    payLog.setStatus(0);
+                    payLog.setPaymentStatus(1);
+                    payLog.setCreatedAt(new Date());
+                    payLog.setCreatedBy("1");
+                    payLog.setSerialNumber(model.getSerialNumber());
+                    payLog.setBankName(model.getBankName());
+                    payLog.setBankBranchName(model.getBankBranchName());
+                    payLog.setBankNumber(model.getBankNumber());
+                    payLogMapper.insertSelective(payLog);
+                }
+
+
+
+            }
+
+        }
+
+    }
+
+
+
+
+
+
+
+
+
+
+
+
 }

+ 2 - 0
pro-wx/src/main/java/com/idea/pro/wx/controller/buildManage/WxParkRoomController.java

@@ -203,6 +203,8 @@ public class WxParkRoomController extends BaseController {
 //        customerManagementService.tempCusUpdate2(file);
 //        customerManagementService.tempContractUpdate(file);
 //        invoiceTask.sendCustomer();
+        customerManagementService.tempDepositUpdate(file);
+
         return success();
     }