Jelajahi Sumber

已知问题修改

y 2 tahun lalu
induk
melakukan
b4e5e8392a

+ 12 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

@@ -51,6 +51,9 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
     @Autowired
     private InvAccountProfitService invAccountProfitService;
 
+    @Autowired
+    private InvAccountIncoiceService invAccountIncoiceService;
+
 
     @Value("${upload.file.path}")
     String uploadFilePath;
@@ -127,6 +130,9 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
         insAccountOperateMapper.insert(invAccountOperate);
 
         List<InvAccountOp> list = invAccountEntOpList(entProfit, entAccount, entAccountCard, applyAmount,invAccountOperate.getAccountOperateId());
+        list.forEach(invAccountOp -> {
+            invAccountOp.setInvoiceId(invAccountOperate.getAccountOperateId());
+        });
         invAccountOpService.saveBatch(list);
 
         return HttpResult.ok("新增收入成功");
@@ -201,6 +207,12 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
                 queryWrapper.eq(InvAccountOp::getAccountOperateId, invAccountOperate1.getAccountOperateId());
                 opList.addAll(invAccountOpService.list(queryWrapper));
             });
+            if(invAccountOperate.getInvoiceId() != null){
+                InvAccountIncoice byId = invAccountIncoiceService.getById(invAccountOperate.getInvoiceId());
+                byId.setPayoutMoney(new BigDecimal(byId.getPayoutMoney()).subtract(new BigDecimal(invAccountOperate.getApplyAmount())).toString());
+                byId.setNotPayoutMoney(new BigDecimal(byId.getNotPayoutMoney()).add(new BigDecimal(invAccountOperate.getApplyAmount())).toString());
+                invAccountIncoiceService.updateById(byId);
+            }
 
             invAccountOpService.removeBatchByIds(opList);
             invAccountCardService.updateBatchById(invAccountCards);