LAPTOP-FO2T5SIU\35838 hace 7 meses
padre
commit
57b7dee02b

+ 18 - 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){
-        InvoiceManageDto result = modelService.getInfoByContract(id);
+    public Object getInfoByContract(String id,String invoiceGoodsName){
+        InvoiceManageDto result = modelService.getInfoByContract(id,invoiceGoodsName);
         return result;
     }
 
@@ -98,6 +98,22 @@ public class InvoiceManageController extends BaseController {
         return modelService.getBankTaxRateByFloor(id);
     }
 
+    /**
+     * 查询对应的银行
+     * @param contractId
+     * @param paymentType
+     * @return
+     */
+    @PostMapping(value = "getBankTaxRateByFloor_2",produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public Object getBankTaxRateByFloor(String contractId,String paymentType) {
+        if(!StringUtils.isNotEmpty(contractId)){
+            return AjaxResult.error(503, "参数不能为空");
+        }
+        return modelService.getBankTaxRateByFloor(contractId,paymentType);
+    }
+
+
     @PostMapping(value = "batchListVo",produces = {"application/json;charset=UTF-8"})
     @ResponseBody
     public List<InvoiceManageDto> batchListVo(String invoiceManages){

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

@@ -23,6 +23,8 @@ import com.idea.invoice.mapper.InvoiceManageExtendMapper;
 import com.idea.invoice.mapper.InvoiceManageMapper;
 import com.idea.invoice.model.*;
 import com.idea.invoice.util.InvoiceConstant;
+import com.idea.paymentManagement.model.PayLog;
+import com.idea.paymentManagement.model.PayLogExample;
 import com.idea.paymentManagement.service.PayLogService;
 import com.rockstar.common.base.BaseService;
 import com.rockstar.common.domain.AjaxResult;
@@ -206,7 +208,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
      * @param contractId
      * @return
      */
-    public InvoiceManageDto getInfoByContract(String contractId){
+    public InvoiceManageDto getInfoByContract(String contractId,String invoiceGoodsName){
 
         InvoiceManageDto invoiceManage = new InvoiceManageDto();
         // 合同信息
@@ -225,6 +227,14 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
                 builder.append(item.getName()).append("身份证号:").append(item.getIdentityCard()).append("\n");
             }
         }
+        PayLogExample payLogExample = new PayLogExample();
+        payLogExample.createCriteria().andContractIdEqualTo(contractId).andStatusEqualTo(0);
+        List<PayLog> payLogs = payLogService.selectByExample(payLogExample);
+        BigDecimal money = BigDecimal.ZERO;
+        for(PayLog payLog : payLogs){
+            money = money.add(payLog.getPayMoney());
+        }
+
         invoiceManage.setContractId(contractId);
         invoiceManage.setCustomerManagementId(contract.getCustomerManagementId());
         invoiceManage.setContractNumber(contract.getContractNumber());
@@ -233,10 +243,10 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         invoiceManage.setInvoiceHeaderNumber(buyer.getIdentityCard());
         // TODO: 2024/10/17 商品编码目前为空 对接接口后调整
         invoiceManage.setInvoiceGoodsCode(InvoiceConstant.INVOICE_GOODS_CODE_ADVANCE_PAYMENT);
-        invoiceManage.setInvoiceGoodsName(room.getDiscName());
+        invoiceManage.setInvoiceGoodsName(invoiceGoodsName + room.getGroupName());
         invoiceManage.setSpecifications(room.getBuildName()+ "-" + room.getRoomNo());
         invoiceManage.setInvoiceCount(new BigDecimal(contract.getActualBuildArea().toString()));
-        invoiceManage.setInvoiceAmount(contract.getBuyerMoney());
+        invoiceManage.setInvoiceAmount(money);
         invoiceManage.setInvoiceTax("0");
         invoiceManage.setRemark(builder.toString());
         return invoiceManage;
@@ -286,6 +296,45 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         return jsonObject;
     }
 
+    /**
+     *
+     * @param contractId
+     * @param paymentType 1-房款,2-专项维修资金
+     * @return
+     */
+    public JSONObject getBankTaxRateByFloor(String contractId,String paymentType) {
+        JSONObject jsonObject = new JSONObject();
+        String result = "";
+        String dictLabel = sysDictService.getDictLabel("PAYMENT_TYPE", paymentType);
+        InvoiceBankExample example = new InvoiceBankExample();
+        example.createCriteria().andSuitCostTypeLike("%" + dictLabel + "%");
+        List<InvoiceBank> bankList = invoiceBankService.selectByExample(example);
+        if (CollectionUtils.isNotEmpty(bankList)) {
+            ContractManage parkContractManage = contractManageService.selectByPrimaryKey(contractId);
+            ParkRoom parkRoom = parkRoomMapper.selectByPrimaryKey(parkContractManage.getHouseId());
+            if (StringUtils.isNotEmpty(parkRoom.getDiscId())) {
+                for (InvoiceBank invoiceBank : bankList) {
+                    if (StringUtils.isNotEmpty(invoiceBank.getSuitFloor())) {
+                        String[] floors = invoiceBank.getSuitFloor().split(",");
+                        for (String floor : floors) {
+                            if (parkRoom.getDiscId().contains(floor)) {
+                                result = invoiceBank.getBankName() + invoiceBank.getBankBranchName() + invoiceBank.getBankNumber();
+                                jsonObject.put("invoiceSellerBank", result);
+                                // 预收款发票税率默认为0
+                                jsonObject.put("invoiceTax", "0");
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+
+        }
+
+        return jsonObject;
+    }
+
+
     /**
      * 批量开票列表
      * @param invoiceManages

+ 5 - 3
pro-base/src/main/java/com/idea/paymentManagement/service/MaintenanceFundsManagementService.java

@@ -145,13 +145,15 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
         Integer collectionStatus = contractManage.getFundCollectionStatus();
         // 完全收款
         if(collectionStatus == 2){
-            // 查询该合同是否已生成 正式发票
+            // 查询该合同是否已生成 正式发票 且类型是专项维修资金
             InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
-            invoiceManageExample.createCriteria().andTypeEqualTo("2").andContractIdEqualTo(model.getContractId());
+            invoiceManageExample.createCriteria().andTypeEqualTo("2")
+                    .andContractIdEqualTo(model.getContractId())
+                    .andPaymentTypeEqualTo("2");
             List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
             if(CollectionUtils.isEmpty(invoiceManages)){
                 // 生成一条待推送的开票信息
-                InvoiceManage invoiceManage = invoiceManageService.getInfoByContract(model.getContractId());
+                InvoiceManage invoiceManage = invoiceManageService.getInfoByContract(model.getContractId(),"*不动产*&");
                 // 正式发票
                 invoiceManage.setType("2");
                 // 专项维修资金

+ 25 - 28
pro-base/src/main/java/com/idea/paymentManagement/service/PayLogService.java

@@ -106,22 +106,22 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
 
     @Override
     public int updateByExample(PayLog PayLog, PayLogExample PayLogExample) {
-        return 0;
+        return modelMapper.updateByExample(PayLog,PayLogExample);
     }
 
     @Override
     public List<PayLog> selectByExample(PayLogExample PayLogExample) {
-        return null;
+        return modelMapper.selectByExample(PayLogExample);
     }
 
     @Override
     public long countByExample(PayLogExample PayLogExample) {
-        return 0;
+        return modelMapper.countByExample(PayLogExample);
     }
 
     @Override
     public int deleteByExample(PayLogExample PayLogExample) {
-        return 0;
+        return modelMapper.deleteByExample(PayLogExample);
     }
 
 
@@ -161,29 +161,26 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
                 // 全部收款
                 contractManage.setCollectionStatus(2);
 
-                // 查询合同的专项维修基础 收款情况
-                Integer fundCollectionStatus = contractManage.getFundCollectionStatus();
-                // 完全收款
-                if(fundCollectionStatus == 2){
-                    // 查询该合同是否已生成 正式发票
-                    InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
-                    invoiceManageExample.createCriteria().andTypeEqualTo("1").andContractIdEqualTo(model.getContractId());
-                    List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
-                    if(CollectionUtils.isEmpty(invoiceManages)){
-                        // 新增待推送的开票信息
-                        InvoiceManageDto invoiceManage = invoiceManageService.getInfoByContract(model.getContractId());
-                        // 正式发票
-                        invoiceManage.setType("2");
-                        // 房款
-                        invoiceManage.setPaymentType("1");
-                        invoiceManage.setSendStatus("0");
-                        invoiceManage.setInvoiceStatus("0");
-                        invoiceManage.setInvoiceTax(null);
-                        invoiceManage.setRemark(null);
-                        invoiceManage.setCreateUser(ShiroUtils.getUserId());
-                        invoiceManage.setCreateTime(new Date());
-                        invoiceManageService.insertSelective(invoiceManage);
-                    }
+                // 查询该合同是否已生成 正式发票
+                InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
+                invoiceManageExample.createCriteria().andTypeEqualTo("1")
+                        .andContractIdEqualTo(model.getContractId())
+                        .andPaymentTypeEqualTo("1");
+                List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
+                if(CollectionUtils.isEmpty(invoiceManages)){
+                    // 新增待推送的开票信息
+                    InvoiceManageDto invoiceManage = invoiceManageService.getInfoByContract(model.getContractId(),"*不动产*&");
+                    // 正式发票
+                    invoiceManage.setType("2");
+                    // 房款
+                    invoiceManage.setPaymentType("1");
+                    invoiceManage.setSendStatus("0");
+                    invoiceManage.setInvoiceStatus("0");
+                    invoiceManage.setInvoiceTax(null);
+                    invoiceManage.setRemark(null);
+                    invoiceManage.setCreateUser(ShiroUtils.getUserId());
+                    invoiceManage.setCreateTime(new Date());
+                    invoiceManageService.insertSelective(invoiceManage);
                 }
             }
         }
@@ -278,7 +275,7 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
     public PayLog getByContractId(String contractId, Integer payType) {
 
         PayLogExample payLogExample = new PayLogExample();
-        payLogExample.createCriteria().andContractIdEqualTo(contractId).andPayTypeEqualTo(payType);
+        payLogExample.createCriteria().andContractIdEqualTo(contractId).andPayTypeEqualTo(payType).andStatusEqualTo(0);
         List<PayLog> payLogs = modelMapper.selectByExample(payLogExample);
         return payLogs.get(0);
 

+ 1 - 0
pro-base/src/main/resources/mybatis/paymentManagement/MaintenanceFundsManagementExtendMapper.xml

@@ -21,6 +21,7 @@
         and maintenance_funds_management.customer_management_id in (select customer_management_id from buyer where name like concat('%',#{buyerName},'%'))
       </if>
     </where>
+    order by created_at desc
   </select>