调整返回格式

This commit is contained in:
hecan 2024-07-29 16:16:18 +08:00
parent cf845501c0
commit e1277beb60
1 changed files with 12 additions and 11 deletions

View File

@ -232,9 +232,8 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
jsonObjectUser.put("mdmCode", mdmCode);
jsonStr.put("jsonStr", jsonObjectUser);
//先查询编码和名称查询是否存在
JsonResultEntity jsonResultEntity = comparisonServiceimpl.queryEntityPage(jsonStr);
Object attribute = jsonResultEntity.getAttribute();
logger.info("得到的attribute值为{}", attribute);
Object attribute = comparisonServiceimpl.queryEntityPage(jsonStr);
logger.info("得到的attribute值为{}", jsonStr.toJSONString(attribute));
JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute);
JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list");
//如果jsonArrayList为null说明没有值在表中不存在
@ -250,20 +249,22 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
hashMap.put("mdmCode", mdmCode);
hashMap.put("optionName", "数智中台");
jsonStr.put("jsonStr", hashMap);
JsonResultEntity result = comparisonServiceimpl.saveEntity(jsonStr);
if(!result.isFlag()){
throw new BaseSystemException("主数据保存失败"+ result.getMsg());
}
Object result = comparisonServiceimpl.saveEntity(jsonStr);
logger.info("新增结果为:{}", JSON.toJSONString(result));
// if(!result.isFlag()){
// throw new BaseSystemException("主数据保存失败"+ result.getMsg());
// }
} else {
hashMap.put("appName","数智中台");
hashMap.put("appCode","800004");
hashMap.put("mdmCode", mdmCode);
hashMap.put("optionName", "数智中台");
jsonStr.put("jsonStr", hashMap);
JsonResultEntity result = comparisonServiceimpl.updateEntity(jsonStr);
if(!result.isFlag()){
//throw new BaseSystemException("主数据更新失败"+ result.getMsg());
}
Object result = comparisonServiceimpl.updateEntity(jsonStr);
logger.info("更新结果为:{}", JSON.toJSONString(result));
// if(!result.isFlag()){
// //throw new BaseSystemException("主数据更新失败"+ result.getMsg());
// }
}
}
return null;