LAPTOP-FO2T5SIU\35838 9 hónapja%!(EXTRA string=óta)
szülő
commit
4da7121593

+ 2 - 2
pro-base/src/main/java/com/idea/invoice/controller/InvoiceManageController.java

@@ -79,8 +79,8 @@ public class InvoiceManageController extends BaseController {
 
     @PostMapping(value = "getByContractId",produces = {"application/json;charset=UTF-8"})
     @ResponseBody
-    public Object getInfoByContract(String id,String invoiceGoodsName){
-        InvoiceManageDto result = modelService.getInfoByContract(id,invoiceGoodsName);
+    public Object getInfoByContract(String id,String invoiceGoodsName,Integer payType){
+        InvoiceManageDto result = modelService.getInfoByContract(id,invoiceGoodsName,payType);
         return result;
     }
 

+ 2 - 0
pro-base/src/main/java/com/idea/invoice/dto/InvoiceManageDto.java

@@ -10,6 +10,8 @@ public class InvoiceManageDto extends InvoiceManage {
 
     private BigDecimal totalPrice;
 
+    private BigDecimal buyerMoney;
+
     private BigDecimal maintenanceTotalPrice;
 
     /**

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

@@ -2,6 +2,7 @@ package com.idea.invoice.service;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -137,11 +138,10 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
         List<InvoiceManageDto> list = extendMapper.listByModel(model);
         for(InvoiceManageDto invoiceManage : list){
-            BigDecimal totalPrice = invoiceManage.getTotalPrice();
-            BigDecimal maintenanceTotalPrice = invoiceManage.getMaintenanceTotalPrice();
-            String money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), null);
-            invoiceManage.setReceivableMoney(totalPrice.add(maintenanceTotalPrice));
-            invoiceManage.setReceivedMoney(new BigDecimal(money));
+//            String money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), null);
+//            invoiceManage.setReceivedMoney(new BigDecimal(money));
+            // 预收款发票 已收金额
+            invoiceManage.setReceivedMoney(invoiceManage.getInvoiceAmount());
         }
         return new PageInfo<>(list);
     }
@@ -191,7 +191,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
             // 房款
             if(invoiceManage.getPaymentType().equals("1")){
                 money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), 1);
-                invoiceManage.setReceivableMoney(invoiceManage.getTotalPrice());
+                invoiceManage.setReceivableMoney(invoiceManage.getBuyerMoney());
             }
             // 专项维修资金
             if(invoiceManage.getPaymentType().equals("2")){
@@ -208,7 +208,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
      * @param contractId
      * @return
      */
-    public InvoiceManageDto getInfoByContract(String contractId,String invoiceGoodsName){
+    public InvoiceManageDto getInfoByContract(String contractId,String invoiceGoodsName,Integer payType){
 
         InvoiceManageDto invoiceManage = new InvoiceManageDto();
         // 合同信息
@@ -228,7 +228,12 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
             }
         }
         PayLogExample payLogExample = new PayLogExample();
-        payLogExample.createCriteria().andContractIdEqualTo(contractId).andStatusEqualTo(0);
+        PayLogExample.Criteria criteria = payLogExample.createCriteria();
+        criteria.andContractIdEqualTo(contractId)
+                .andStatusEqualTo(0);
+        if(ObjectUtil.isNotNull(payType)){
+            criteria.andPayTypeEqualTo(payType);
+        }
         List<PayLog> payLogs = payLogService.selectByExample(payLogExample);
         BigDecimal money = BigDecimal.ZERO;
         for(PayLog payLog : payLogs){

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

@@ -153,7 +153,8 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
             List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
             if(CollectionUtils.isEmpty(invoiceManages)){
                 // 生成一条待推送的开票信息
-                InvoiceManage invoiceManage = invoiceManageService.getInfoByContract(model.getContractId(),"*不动产*&");
+                InvoiceManage invoiceManage = invoiceManageService.getInfoByContract(model.getContractId(),
+                        "*不动产*&",2);
                 // 正式发票
                 invoiceManage.setType("2");
                 // 专项维修资金
@@ -162,6 +163,8 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
                 invoiceManage.setInvoiceStatus("0");
                 invoiceManage.setInvoiceTax(null);
                 invoiceManage.setRemark(null);
+                invoiceManage.setCreateUser(ShiroUtils.getUserId());
+                invoiceManage.setCreateTime(new Date());
                 invoiceManageService.insertSelective(invoiceManage);
             }
         }

+ 7 - 6
pro-base/src/main/java/com/idea/paymentManagement/service/PayLogService.java

@@ -152,9 +152,9 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
         ContractManage contractManage = contractManageMapper.selectByPrimaryKey(model.getContractId());
         if (model.getPayType() == 1) {
             String receivedMoneyStr = extendMapper.getMoneyByContractId(model.getContractId(), model.getPayType());
-            BigDecimal totalPrice = contractManage.getTotalPrice();
+            BigDecimal buyerMoney = contractManage.getBuyerMoney();
             BigDecimal receivedMoney = new BigDecimal(receivedMoneyStr);
-            if (receivedMoney.doubleValue() < totalPrice.doubleValue()) {
+            if (receivedMoney.doubleValue() < buyerMoney.doubleValue()) {
                 // 部分收款
                 contractManage.setCollectionStatus(1);
             } else {
@@ -169,7 +169,8 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
                 List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
                 if(CollectionUtils.isEmpty(invoiceManages)){
                     // 新增待推送的开票信息
-                    InvoiceManageDto invoiceManage = invoiceManageService.getInfoByContract(model.getContractId(),"*不动产*&");
+                    InvoiceManageDto invoiceManage = invoiceManageService.getInfoByContract(model.getContractId(),
+                            "*不动产*&",1);
                     // 正式发票
                     invoiceManage.setType("2");
                     // 房款
@@ -262,9 +263,9 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
         BigDecimal arrears = BigDecimal.ZERO;
         // 应收
         BigDecimal receivableMoney = BigDecimal.ZERO;
-        if(ObjectUtil.isNotNull(contractManage.getTotalPrice())){
-            arrears = contractManage.getTotalPrice().subtract(receivedMoney);
-            receivableMoney = contractManage.getTotalPrice();
+        if(ObjectUtil.isNotNull(contractManage.getBuyerMoney())){
+            arrears = contractManage.getBuyerMoney().subtract(receivedMoney);
+            receivableMoney = contractManage.getBuyerMoney();
         }
         payLogDto.setReceivableMoney(receivableMoney);
         payLogDto.setReceivedMoney(receivedMoney);

+ 2 - 1
pro-base/src/main/resources/mybatis/invoice/InvoiceManageExtendMapper.xml

@@ -5,7 +5,7 @@
 
   <select id="listByModel" resultType="com.idea.invoice.dto.InvoiceManageDto">
       select i.*,cm.id contractId,cm.contract_number,cm.record_number,cm.buyer_name,cm.house_name,
-             ifnull(cm.total_price,0) total_price,
+             ifnull(cm.buyer_money,0) buyer_money,
              ifnull(cm.maintenance_total_price,0) maintenance_total_price,
              cm.collection_status,cm.fund_collection_status
       from invoice_manage i
@@ -39,6 +39,7 @@
               and i.invoice_date &lt;= #{sendDateTo}
           </if>
       </where>
+      order by i.create_time desc
   </select>
 
 

+ 5 - 3
pro-base/src/main/resources/mybatis/paymentManagement/PayLogExtendMapper.xml

@@ -16,8 +16,9 @@
   </select>
 
   <select id="listByModel" resultType="com.idea.customerManagement.dto.ContractManageDto">
-    select contract_manage.*, ifnull(sum(pay_log.pay_money),0) receivedMoney,
-           ifnull(contract_manage.total_price - sum(pay_log.pay_money),0) arrears
+    select contract_manage.*,
+           ifnull(sum(pay_log.pay_money),0) receivedMoney,
+           ifnull(contract_manage.buyer_money - sum(pay_log.pay_money),0) arrears
     from contract_manage
     left join pay_log on contract_manage.id = pay_log.contract_id and pay_log.pay_type = #{payType}
     <where>
@@ -32,7 +33,8 @@
         and contract_manage.customer_management_id in (select customer_management_id from buyer where name like concat('%',#{buyerName},'%'))
       </if>
     </where>
-    group by contract_manage.id
+      group by contract_manage.id
+      ORDER BY contract_manage.created_at DESC
   </select>