LAPTOP-FO2T5SIU\35838 6 months ago
parent
commit
19887166c7

+ 1 - 0
pro-base/src/main/java/com/idea/customerManagement/service/IntentionalDepositService.java

@@ -411,6 +411,7 @@ public class IntentionalDepositService implements BaseService<IntentionalDeposit
         // 新增一条定金收款记录
         PayLog payLog = new PayLog();
         payLog.setId(IdUtil.simpleUUID());
+        payLog.setBusinessId(roomSelectionInfoId);
         payLog.setHouseId(houseId);
         payLog.setContractId(contractId);
         payLog.setCustomerManagementId(customerManagementId);

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

@@ -308,7 +308,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         invoiceManage.setInvoiceHeaderName(buyer.getName());
         invoiceManage.setInvoiceHeaderNumber(buyer.getIdentityCard());
         // TODO: 2024/10/17 商品编码目前为空 对接接口后调整
-        invoiceManage.setInvoiceGoodsCode(InvoiceConstant.INVOICE_GOODS_CODE_ADVANCE_PAYMENT);
+//        invoiceManage.setInvoiceGoodsCode(InvoiceConstant.INVOICE_GOODS_CODE_ADVANCE_PAYMENT);
         invoiceManage.setInvoiceGoodsName(invoiceGoodsName + room.getGroupName());
         invoiceManage.setSpecifications(room.getBuildName() + "-" + room.getRoomNo());
         invoiceManage.setInvoiceCount(new BigDecimal(contract.getActualBuildArea().toString()));

+ 12 - 0
pro-base/src/main/java/com/idea/paymentManagement/controller/MaintenanceFundsManagementController.java

@@ -52,6 +52,18 @@ public class MaintenanceFundsManagementController extends BaseController {
         return result(result);
     }
 
+    /**
+     * 收款登记 修改
+     * @param model
+     * @return
+     */
+    @PostMapping(value = "edit",produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public AjaxResult edit(MaintenanceFundsManagement model){
+        int result = modelService.edit(model);
+        return result(result);
+    }
+
     /**
      * 查询对应的银行
      * @param contractId

+ 63 - 1
pro-base/src/main/java/com/idea/paymentManagement/service/MaintenanceFundsManagementService.java

@@ -21,6 +21,7 @@ import com.idea.paymentManagement.mapper.PayLogMapper;
 import com.idea.paymentManagement.model.MaintenanceFundsManagement;
 import com.idea.paymentManagement.model.MaintenanceFundsManagementExample;
 import com.idea.paymentManagement.model.PayLog;
+import com.idea.paymentManagement.model.PayLogExample;
 import com.rockstar.common.base.BaseService;
 import com.rockstar.frame.model.extend.DateTrans;
 import com.rockstar.frame.model.extend.Tablepar;
@@ -29,6 +30,7 @@ import com.rockstar.util.StringUtils;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.Arrays;
@@ -127,11 +129,13 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
 
         contractManageMapper.updateByPrimaryKeySelective(contractManage);
 
+        String id = IdUtil.simpleUUID();
+        model.setId(id);
         model.setHouseId(contractManage.getHouseId());
         model.setCustomerManagementId(contractManage.getCustomerManagementId());
         model.setCreatedId(ShiroUtils.getUserId());
         model.setCreatedAt(new Date());
-        int result = insertSelective(model);
+        int result = insertWithoutId(model);
 
         // 新增一条定金收款记录
         PayLog payLog = new PayLog();
@@ -139,6 +143,7 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
         payLog.setHouseId(contractManage.getHouseId());
         payLog.setContractId(model.getContractId());
         payLog.setCustomerManagementId(contractManage.getCustomerManagementId());
+        payLog.setBusinessId(id);
         // 收款类型 专项维修资金
         payLog.setPayType(2);
         // 款项内容 专项维修资金
@@ -185,6 +190,63 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
     }
 
 
+    /**
+     * 收款登记
+     * @param model
+     * @return
+     */
+    @Transactional
+    public int edit(MaintenanceFundsManagement model){
+
+        // 更新合同 专项维修资金收取状态
+        ContractManage contractManage = contractManageMapper.selectByPrimaryKey(model.getContractId());
+        BigDecimal payMoney = model.getPayMoney();
+        BigDecimal maintenanceTotalPrice = contractManage.getMaintenanceTotalPrice();
+        if(payMoney.doubleValue() >= maintenanceTotalPrice.doubleValue()){
+            // 已收款
+            contractManage.setFundCollectionStatus(2);
+        }else {
+            // 部分收款
+            contractManage.setFundCollectionStatus(4);
+        }
+
+        contractManageMapper.updateByPrimaryKeySelective(contractManage);
+
+        model.setHouseId(contractManage.getHouseId());
+        model.setCustomerManagementId(contractManage.getCustomerManagementId());
+        model.setCreatedId(ShiroUtils.getUserId());
+        model.setCreatedAt(new Date());
+        int result = updateByPrimaryKeySelective(model);
+
+        // 更新对应的收款记录
+        PayLogExample payLogExample = new PayLogExample();
+        payLogExample.createCriteria().andBusinessIdEqualTo(model.getId()).andPayTypeEqualTo(2);
+        List<PayLog> payLogs = payLogMapper.selectByExample(payLogExample);
+        if(CollectionUtils.isNotEmpty(payLogs) && payLogs.size() == 1){
+            PayLog payLog = payLogs.get(0);
+            payLog.setPayMoney(model.getPayMoney());
+            payLog.setUpdatedAt(new Date());
+            payLog.setUpdatedBy(ShiroUtils.getUserId());
+            payLogMapper.updateByPrimaryKeySelective(payLog);
+        }
+
+        // 更新对应的 未推送 未开票 专项维修资金 正式发票
+        InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
+        invoiceManageExample.createCriteria().andTypeEqualTo("2")
+                .andContractIdEqualTo(model.getContractId())
+                .andPaymentTypeEqualTo("2")
+                .andSendStatusEqualTo("0");
+        List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
+        if(CollectionUtils.isEmpty(invoiceManages) && invoiceManages.size() == 1){
+            InvoiceManage invoiceManage = invoiceManages.get(0);
+            invoiceManage.setInvoiceAmount(payMoney);
+            invoiceManageService.updateByPrimaryKeySelective(invoiceManage);
+        }
+
+        return result;
+    }
+
+
     public PageInfo<ContractManageDto> listByModel(Tablepar tablepar, ContractManageDto model, DateTrans dt) {
         PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
         List<ContractManageDto> list = extendMapper.listByModel(model);

+ 3 - 0
pro-base/src/main/resources/mybatis/customerManagement/RoomSelectionInfoExtendMapper.xml

@@ -55,6 +55,9 @@
             <if test="roomNo !=null and roomNo != ''">
                 and park_room.room_no like concat('%',#{roomNo},'%')
             </if>
+            <if test="status !=null and status != ''">
+                and room_selection_info.status = #{status}
+            </if>
         </where>
         order by created_at desc
     </select>