|
|
|
|
@ -47,8 +47,8 @@ public class HusbandryRecordServiceImpl implements HusbandryRecordService { |
|
|
|
|
JSONArray jsonArray = new JSONArray(agriculturalJson); |
|
|
|
|
for (Object obj : jsonArray) { |
|
|
|
|
JSONObject jsonObject = new JSONObject(obj); |
|
|
|
|
jsonObject.put("creator", husbandryRecord.getCreator()); |
|
|
|
|
jsonObject.put("updater", husbandryRecord.getUpdater()); |
|
|
|
|
jsonObject.put("creator", husbandryRecord.getCreator() == null ? husbandryRecord.getUpdater(): husbandryRecord.getCreator()); |
|
|
|
|
jsonObject.put("updater", husbandryRecord.getUpdater() == null ? husbandryRecord.getCreator(): husbandryRecord.getUpdater()); |
|
|
|
|
husbandryRecordMapper.insertAgriculturalUsed(husbandryRecord.getId(), jsonObject); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -64,14 +64,14 @@ public class HusbandryRecordServiceImpl implements HusbandryRecordService { |
|
|
|
|
HusbandryRecordDO updateObj = BeanUtils.toBean(updateReqVO, HusbandryRecordDO.class); |
|
|
|
|
husbandryRecordMapper.updateById(updateObj); |
|
|
|
|
// 删除已添加农资记录
|
|
|
|
|
agriculturalUsedMapper.deleteByHusbandryId(updateReqVO.getHusbandryId()); |
|
|
|
|
agriculturalUsedMapper.deleteByHusbandryId(updateReqVO.getId()); |
|
|
|
|
if (StringUtil.isNotBlank(updateReqVO.getAgriculturalJson())) { |
|
|
|
|
JSONArray jsonArray = new JSONArray(updateReqVO.getAgriculturalJson()); |
|
|
|
|
for (Object obj : jsonArray) { |
|
|
|
|
JSONObject jsonObject = new JSONObject(obj); |
|
|
|
|
jsonObject.put("creator", updateObj.getCreator()); |
|
|
|
|
jsonObject.put("updater", updateObj.getUpdater()); |
|
|
|
|
husbandryRecordMapper.insertAgriculturalUsed(updateReqVO.getHusbandryId(),jsonObject); |
|
|
|
|
jsonObject.put("creator", updateObj.getCreator() == null ? updateObj.getUpdater(): updateObj.getCreator()); |
|
|
|
|
jsonObject.put("updater", updateObj.getUpdater() == null ? updateObj.getCreator(): updateObj.getUpdater()); |
|
|
|
|
husbandryRecordMapper.insertAgriculturalUsed(updateReqVO.getId(),jsonObject); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|