|
@@ -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);
|
|
|
}
|
|
|
}
|
|
|
}
|