Browse Source

多次打款问题处理

yzc 1 year ago
parent
commit
4bfea1dc0a

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountRunningWater.java

@@ -120,4 +120,9 @@ public class AccountRunningWater extends BasePo {
      */
     private Integer deptType;
 
+    /**
+     * 打款记录id
+     */
+    private Long accountPaymentRecordsId;
+
 }

+ 2 - 1
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentServiceImpl.java

@@ -254,7 +254,8 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
         accountRunningWater.setName(accountPaymentDto.getName());
         accountRunningWater.setTransactionTime(accountPaymentRecords.getExpensesTime());
         accountRunningWater.setRemarks(accountPaymentRecords.getRemark());
-        accountRunningWater.setBusinessId(accountPaymentRecords.getId());
+        accountRunningWater.setBusinessId(accountPaymentDto.getId());
+        accountRunningWater.setAccountPaymentRecordsId(accountPaymentRecords.getId());
         //添加流水类型
         accountRunningWater.setType("10");
         //赋值是否往来

+ 12 - 1
hx-account/src/main/java/com/fjhx/account/service/write/impl/WriteOffRecordsServiceImpl.java

@@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.account.entity.account.po.*;
+import com.fjhx.account.entity.tax.po.TaxRefundDetails;
 import com.fjhx.account.entity.write.dto.WriteOffRecordsDto;
 import com.fjhx.account.entity.write.dto.WriteOffRecordsSelectDto;
 import com.fjhx.account.entity.write.po.WriteOffRecords;
 import com.fjhx.account.entity.write.vo.WriteOffRecordsVo;
 import com.fjhx.account.mapper.write.WriteOffRecordsMapper;
 import com.fjhx.account.service.account.*;
+import com.fjhx.account.service.tax.TaxRefundDetailsService;
 import com.fjhx.account.service.write.WriteOffRecordsService;
 import com.fjhx.common.service.corporation.CorporationService;
 import com.fjhx.common.utils.Assert;
@@ -47,6 +49,8 @@ public class WriteOffRecordsServiceImpl extends ServiceImpl<WriteOffRecordsMappe
     private AccountPaymentRecordsService accountPaymentRecordsService;
     @Autowired
     private AccountManagementService accountManagementService;
+    @Autowired
+    private TaxRefundDetailsService taxRefundDetailsService;
 
     @Override
     public Page<WriteOffRecordsVo> getPage(WriteOffRecordsSelectDto dto) {
@@ -102,8 +106,15 @@ public class WriteOffRecordsServiceImpl extends ServiceImpl<WriteOffRecordsMappe
                     .setSql("remainder = remainder + " + accountPaymentRecords.getAmount())
             );
             //删除打款对应的流水
-            AccountRunningWater accountRunningWater = accountRunningWaterService.getOne(q -> q.eq(AccountRunningWater::getBusinessId, accountPaymentRecords.getId()));
+            AccountRunningWater accountRunningWater = accountRunningWaterService.getOne(q -> q.eq(AccountRunningWater::getBusinessId, accountPayment.getId()));
             Assert.notEmpty(accountRunningWater, "查询不到打款流水信息");
+            //删除往来信息
+            if (accountRunningWater.getIsTransaction() == 1) {
+                TaxRefundDetails taxRefundDetails = taxRefundDetailsService.getOne(q -> q.eq(TaxRefundDetails::getAccountRunningWaterId, accountRunningWater.getId()));
+                if (ObjectUtil.isNotEmpty(taxRefundDetails)) {
+                    taxRefundDetailsService.removeById(taxRefundDetails.getId());
+                }
+            }
             accountRunningWaterService.removeById(accountRunningWater);
         }
     }

+ 1 - 1
hx-purchase/src/main/resources/mapper/pay/PayDetailMapper.xml

@@ -74,7 +74,7 @@
         LEFT JOIN purchase t4 ON t1.purchase_id = t4.id
         <where>
             t2.`type` != 3
-            AND t3 .`status` = 10
+            AND t3 .`status` in( 10,15 )
             <if test="contractIds neq null and contractIds.size() > 0">
                 <foreach collection="contractIds" item="contractId" open="AND t4.data_resource_id IN (" separator="," close=")">
                     #{contractId}

+ 0 - 12
hx-sale/src/main/java/com/fjhx/sale/service/statement/impl/SaleStatementServiceImpl.java

@@ -4,28 +4,20 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.account.entity.account.po.AccountPayment;
-import com.fjhx.account.entity.account.po.AccountRequestFundsDetail;
-import com.fjhx.account.entity.account.po.AccountRunningWater;
 import com.fjhx.account.entity.account.vo.AccountRequestFundsDetailVo;
 import com.fjhx.account.entity.tax.po.TaxRefundDetails;
-import com.fjhx.account.service.account.AccountPaymentService;
 import com.fjhx.account.service.account.AccountRequestFundsDetailService;
-import com.fjhx.account.service.account.AccountRequestFundsService;
 import com.fjhx.account.service.account.AccountRunningWaterService;
 import com.fjhx.account.service.tax.TaxRefundDetailsService;
 import com.fjhx.common.entity.currency.po.CurrencyRate;
 import com.fjhx.common.enums.FlowStatusEnum1;
 import com.fjhx.common.service.currency.CurrencyRateService;
 import com.fjhx.customer.service.customer.CustomerService;
-import com.fjhx.flow.enums.FlowStatusEnum;
 import com.fjhx.purchase.entity.pay.po.Pay;
 import com.fjhx.purchase.entity.purchase.enums.PurchaseStatusEnum;
 import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.service.pay.PayDetailService;
-import com.fjhx.purchase.service.purchase.PurchaseDetailService;
 import com.fjhx.purchase.service.purchase.PurchaseService;
 import com.fjhx.sale.entity.claim.po.ClaimContract;
 import com.fjhx.sale.entity.contract.bo.ContractCurrencyRate;
@@ -33,15 +25,12 @@ import com.fjhx.sale.entity.contract.dto.ContractSelectDto;
 import com.fjhx.sale.entity.contract.po.Contract;
 import com.fjhx.sale.entity.contract.vo.ContractBudgetVo;
 import com.fjhx.sale.entity.contract.vo.ContractVo;
-import com.fjhx.sale.entity.purchase.po.EhsdPurchase;
 import com.fjhx.sale.entity.statement.dto.ProfitSettlementDto;
 import com.fjhx.sale.entity.statement.vo.ProfitSettlementVo;
 import com.fjhx.sale.service.claim.ClaimContractService;
-import com.fjhx.sale.service.claim.ClaimService;
 import com.fjhx.sale.service.contract.ContractService;
 import com.fjhx.sale.service.statement.SaleStatementService;
 import com.github.pagehelper.util.StringUtil;
-import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -87,7 +76,6 @@ public class SaleStatementServiceImpl implements SaleStatementService {
 
     @Override
     public Page<ProfitSettlementVo> getProfitSettlement(ProfitSettlementDto dto) {
-
         Page<ContractVo> contractPage = contractService.getProfitSettlement(dto);
         List<ContractVo> records = contractPage.getRecords();
         if (records.size() == 0) {

+ 1 - 0
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -247,6 +247,7 @@
                  LEFT JOIN bytesailing_account.account_management am
                            ON arw.account_management_id = am.id AND am.del_flag = 0
         WHERE c.id = #{contractId}
+        group by arfd.id
         UNION ALL
         SELECT arw.id,
                arw.create_time,