浏览代码

修复发起对账、收费、付费,保存或者撤销审批后,再次进入发起对账收费付费时待审数据业务编号被异常抹掉~

nzf 3 年之前
父节点
当前提交
566a2a70b9
共有 1 个文件被更改,包括 13 次插入9 次删除
  1. 13 9
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

+ 13 - 9
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -789,8 +789,6 @@ public class TFeeServiceImpl implements ITFeeService {
             }
         }
         TFee tFee = JSONArray.parseObject(tfee, TFee.class);
-        // 声明业务编号 list
-        List<String> fSrcBillnos = new ArrayList<>();
         String billstatus = "";
         if (isApprove) {
             billstatus = "4";
@@ -817,13 +815,14 @@ public class TFeeServiceImpl implements ITFeeService {
         // 删除从表
         //tFeeDoMapper.deleteByFPid(tFee.getfId());
         messageMap.put("tFee", tFee);
-        // fSrcBillnos.add(tFee.getfSrcBillno());
+        // 声明业务编号 list
+        List<String> fSrcBillnos = new ArrayList<>();
         //  财务从表
         if (StringUtils.isNotNull(tfeeDo) && !"[]".equals(tfeeDo)) {
             JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
             List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
             for (TFeeDo tFeeDo : tFeeDoList) {
-                if (StringUtils.isNull(tFeeDo.getfId())) {
+                if (StringUtils.isNull(tFeeDo.getfId())) { // 走新建
                     Map<String, Object> map = this.judgeMoney(tFeeDo.getfSrcid(), tFeeDo.getfAmt(), fBilltype, tFeeDo.getfFeeid());
                     if (!(Boolean) map.get("flag")) {
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -838,11 +837,16 @@ public class TFeeServiceImpl implements ITFeeService {
                         fSrcBillnos.add(tFeeDo.getfSrcBillno());
                     }
                     tFeeDoMapper.insertTFeeDo(tFeeDo);
-                } else {
-                    // 走了修改
-                    tFeeDo.setUpdateBy(loginUser.getUser().getUserName());
-                    tFeeDo.setUpdateTime(new Date());
-                    tFeeDoMapper.updateTFeeDo(tFeeDo);
+                } else { // 走修改
+                    // 根据传递的 tFeeDo的 id 获取到该条数据,避免直接传递是数据直接覆盖
+                    TFeeDo tfDo = tFeeDoMapper.selectTFeeDoById(tFeeDo.getfId());
+                    if (StringUtils.isNotNull(tfDo.getfSrcBillno())){
+                        // 装载业务编号
+                        fSrcBillnos.add(tfDo.getfSrcBillno());
+                    }
+                    tfDo.setUpdateBy(loginUser.getUser().getUserName());
+                    tfDo.setUpdateTime(new Date());
+                    tFeeDoMapper.updateTFeeDo(tfDo);
                 }
             }
         }