Browse Source

更改撤销对账时删除t_fee_do从表逻辑,改为根据id修改t_fee_do相对应的数据逻辑,更改原因:在撤销对账时,虽然删掉了对应从表数据,但是业务编号数据会被覆盖制空

nzf 3 năm trước cách đây
mục cha
commit
1247a46d9c

+ 17 - 10
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -1316,21 +1316,28 @@ public class TFeeServiceImpl implements ITFeeService {
         tFee.setUpdateTime(new Date());
         tFeeMapper.updateTFee(tFee);
         // 删除从表
-        tFeeDoMapper.deleteByFPid(tFee.getfId());
+        // tFeeDoMapper.deleteByFPid(tFee.getfId());
         //  财务从表
         if (StringUtils.isNotNull(tfeeDo)) {
             JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
             List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
             for (TFeeDo tFeeDo : tFeeDoList) {
-                tFeeDo.setfPid(tFee.getfId());
-                tFeeDo.setCreateBy(loginUser.getUser().getUserName());
-                tFeeDo.setCreateTime(new Date());
-                tFeeDoMapper.insertTFeeDo(tFeeDo);
-                // 跟新费用明细
-                int m = updateBillsFees(tFee.getfId(), tFeeDo, fBilltype);
-                if (m == 0) {
-                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                    return AjaxResult.error("更新费用明细失败");
+                if (StringUtils.isNull(tFeeDo.getfId())) { // 需写入数据
+                    tFeeDo.setfPid(tFee.getfId());
+                    tFeeDo.setCreateBy(loginUser.getUser().getUserName());
+                    tFeeDo.setCreateTime(new Date());
+                    tFeeDoMapper.insertTFeeDo(tFeeDo);
+                    // 跟新费用明细
+                    int m = updateBillsFees(tFee.getfId(), tFeeDo, fBilltype);
+                    if (m == 0) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("更新费用明细失败");
+                    }
+                } else { // 需更改数据
+                    TFeeDo tfdo = tFeeDoMapper.selectTFeeDoById(tFeeDo.getfId());
+                    tfdo.setUpdateBy(loginUser.getUser().getUserName());
+                    tfdo.setUpdateTime(new Date());
+                    tFeeDoMapper.updateTFeeDo(tfdo);
                 }
             }
         }