ソースを参照

Merge remote-tracking branch 'origin/dev' into dev

caozj 1 年間 前
コミット
4f20334797

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

@@ -199,6 +199,8 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
         }
         //赋值已打款金额
         oldAccountPayment.setAmount(add);
+        //赋值最后一次打款时间、
+        oldAccountPayment.setExpensesTime(accountPaymentDto.getExpensesTime());
         updateById(oldAccountPayment);
 
         //创建打款记录

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

@@ -6,14 +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.transaction.po.Transaction;
 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.transaction.TransactionService;
 import com.fjhx.account.service.write.WriteOffRecordsService;
 import com.fjhx.common.service.corporation.CorporationService;
 import com.fjhx.common.utils.Assert;
@@ -50,7 +50,7 @@ public class WriteOffRecordsServiceImpl extends ServiceImpl<WriteOffRecordsMappe
     @Autowired
     private AccountManagementService accountManagementService;
     @Autowired
-    private TaxRefundDetailsService taxRefundDetailsService;
+    private TransactionService transactionService;
 
     @Override
     public Page<WriteOffRecordsVo> getPage(WriteOffRecordsSelectDto dto) {
@@ -79,15 +79,16 @@ public class WriteOffRecordsServiceImpl extends ServiceImpl<WriteOffRecordsMappe
         accountPayment.setStatus("20");
         accountPaymentService.updateById(accountPayment);
 
+        //赋值最后一次打款时间
+        writeOffRecordsDto.setAccountPaymentDate(accountPayment.getExpensesTime());
+        this.save(writeOffRecordsDto);
+
         List<AccountPaymentRecords> accountPaymentRecordsList = accountPaymentRecordsService.list(
                 q -> q.eq(AccountPaymentRecords::getAccountPaymentId, accountPayment.getId())
         );
         for (AccountPaymentRecords accountPaymentRecords : accountPaymentRecordsList) {
             //清理历史附件
             ObsFileUtil.removeFile(accountPaymentRecords.getId());
-            //赋值之前的打款时间
-            writeOffRecordsDto.setAccountPaymentDate(accountPaymentRecords.getExpensesTime());
-            this.save(writeOffRecordsDto);
             AccountManagement accountManagement = accountManagementService.getById(accountPaymentRecords.getAccountManagementId());
             if (ObjectUtil.isEmpty(accountManagement)) {
                 throw new ServiceException("资金账户不存在:" + accountPaymentRecords.getAccountManagementId());
@@ -105,16 +106,18 @@ public class WriteOffRecordsServiceImpl extends ServiceImpl<WriteOffRecordsMappe
                     .eq(AccountRemainder::getId, accountRemainder.getId())
                     .setSql("remainder = remainder + " + accountPaymentRecords.getAmount())
             );
-            //删除打款对应的流水
-            AccountRunningWater accountRunningWater = accountRunningWaterService.getOne(q -> q.eq(AccountRunningWater::getBusinessId, accountPayment.getId()));
-            Assert.notEmpty(accountRunningWater, "查询不到打款流水信息");
+        }
+        //删除打款对应的流水
+        List<AccountRunningWater> accountRunningWaterList = accountRunningWaterService.list(q -> q.eq(AccountRunningWater::getBusinessId, accountPayment.getId()));
+        Assert.notEmpty(accountRunningWaterList, "查询不到打款流水信息");
+        for (AccountRunningWater accountRunningWater : accountRunningWaterList) {
             //删除往来信息
             Integer isTransaction = accountRunningWater.getIsTransaction();
             isTransaction = ObjectUtil.isEmpty(isTransaction) ? 0 : isTransaction;
             if (1 == isTransaction) {
-                TaxRefundDetails taxRefundDetails = taxRefundDetailsService.getOne(q -> q.eq(TaxRefundDetails::getAccountRunningWaterId, accountRunningWater.getId()));
-                if (ObjectUtil.isNotEmpty(taxRefundDetails)) {
-                    taxRefundDetailsService.removeById(taxRefundDetails.getId());
+                Transaction transaction = transactionService.getOne(q -> q.eq(Transaction::getAccountRunningWaterId, accountRunningWater.getId()));
+                if (ObjectUtil.isNotEmpty(transaction)) {
+                    transactionService.removeById(transaction.getId());
                 }
             }
             accountRunningWaterService.removeById(accountRunningWater);