通用数据写入日志增加错误返回信息
This commit is contained in:
parent
71c1d1bfb3
commit
435665c944
|
@ -15,6 +15,6 @@ public interface IControlsLogDao extends IBaseDao<ControlsLogEntity, String> {
|
|||
* @Date 2024/6/5 15:29
|
||||
* **/
|
||||
@DS("master")
|
||||
ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName,String dataType);
|
||||
ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName,String dataType,String remark);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class ControlsLogDaoImpl extends MybatisGenericDao<ControlsLogEntity, St
|
|||
|
||||
//操作日志新增
|
||||
@Override
|
||||
public ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName,String dataType) {
|
||||
public ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName,String dataType,String remark) {
|
||||
ControlsLogEntity controlsLogEntity=new ControlsLogEntity();
|
||||
controlsLogEntity.setId(UUIDUtils.getUUID());
|
||||
controlsLogEntity.setFormmainId(formmainId);
|
||||
|
@ -26,6 +26,7 @@ public class ControlsLogDaoImpl extends MybatisGenericDao<ControlsLogEntity, St
|
|||
controlsLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
controlsLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
controlsLogEntity.setOrg_id("0");
|
||||
controlsLogEntity.setRemark(remark);
|
||||
ControlsLogEntity save = super.save(getSqlIdPrifx() + "saveControlsLog", controlsLogEntity);
|
||||
return save;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||
logger.info("=======新增时候主表data_id不能为空============");
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2","新增时候主表data_id为空");
|
||||
return BaseResult.getFailureMessageEntity("新增时候主表data_id不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if(!checkStr(jsonObjectDetails.getString("data_id"))){
|
||||
logger.info("=======新增时候明细data_id不能为空============");
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2","新增时候明细data_id为空");
|
||||
return BaseResult.getFailureMessageEntity("新增时候明细data_id不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -256,8 +256,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if (entity.getRuleValue() != null && entity.getDbType().equals("1")) {
|
||||
//如果值为空,说明没有传这个字段或者这个字段的值为空
|
||||
if (jsonObjectMain.getString(entity.getEnName()) == null || jsonObjectMain.getString(entity.getEnName()).equals("")) {
|
||||
logger.info(entity.getDbName() + "表的" + entity.getEnName() + "字段不能为空");
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2",entity.getDbName() + "表的" + entity.getEnName() + "字段为空");
|
||||
return BaseResult.getFailureMessageEntity(entity.getDbName() + "表的" + entity.getEnName() + "字段不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +303,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候生成单据规则错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2","保存通用数据时候生成单据规则错误:"+e.getMessage());
|
||||
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
|
@ -310,7 +311,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
} catch (Exception e) {
|
||||
logger.info("通用数据保存接口中查询单据规则错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2","通用数据保存接口中查询单据规则错误:"+e.getMessage());
|
||||
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
|
@ -327,8 +328,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if (entity.getRuleValue() != null && entity.getDbType().equals("2")) {
|
||||
//如果值为空,说明没有传这个字段或者这个字段的值为空
|
||||
if (jsonObjectDetails.getString(entity.getEnName()) == null || jsonObjectDetails.getString(entity.getEnName()).equals("")) {
|
||||
logger.info(entity.getDbName() + "表的" + entity.getEnName() + "字段不能为空");
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2",entity.getDbName() + "表的" + entity.getEnName() + "字段为空");
|
||||
return BaseResult.getFailureMessageEntity(entity.getDbName() + "表的" + entity.getEnName() + "字段不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +374,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
jsonObjectList.remove(null);
|
||||
list.add(jsonObjectList);
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "1");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "1",null);
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("status", "200");
|
||||
json1.put("list", list);
|
||||
|
@ -380,7 +382,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2","保存通用数据时候错误:"+e.getMessage());
|
||||
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
|
@ -432,6 +434,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if(main!=null){
|
||||
jsonObjectMain = JSONObject.parseObject(main);
|
||||
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2","更新时候主表data_id为空");
|
||||
return BaseResult.getFailureMessageEntity("更新时候主表data_id不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -442,6 +445,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObjectDetails = jsonArray.getJSONObject(i);
|
||||
if(!checkStr(jsonObjectDetails.getString("data_id"))){
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2","更新明细表时候明细表data_id为空");
|
||||
return BaseResult.getFailureMessageEntity("更新明细表时候明细表data_id不能为空");
|
||||
}
|
||||
jsonObjectDetails.put("table_name", keyPair.getKey());
|
||||
|
@ -465,6 +469,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparison.setFields(fields);
|
||||
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparison);
|
||||
if(CollectionUtils.isEmpty(comparisonEntitiePages)){
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2","根据data_id查询id数据为空");
|
||||
return BaseResult.getFailureMessageEntity("根据data_id查询id数据为空,请检查data_id");
|
||||
}
|
||||
|
||||
|
@ -528,7 +533,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
jsonObjectList.remove(null);
|
||||
jsonObjects.add(jsonObjectList);
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","1");
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","1",null);
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("status","200");
|
||||
json1.put("list",jsonObjects);
|
||||
|
@ -539,7 +544,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
} catch (Exception e) {
|
||||
logger.info("更新通用数据时候错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2");
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2","更新通用数据时候错误:"+e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("更新失败");
|
||||
}
|
||||
}
|
||||
|
@ -591,6 +596,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if(main!=null){
|
||||
jsonObjectMain = JSONObject.parseObject(main);
|
||||
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2","更新时候主表data_id为空");
|
||||
return BaseResult.getFailureMessageEntity("更新时候主表data_id不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -624,13 +630,14 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparison.setFields(fields);
|
||||
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparison);
|
||||
if(CollectionUtils.isEmpty(comparisonEntitiePages)){
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2","根据data_id查询id数据为空");
|
||||
return BaseResult.getFailureMessageEntity("根据data_id查询id数据为空,请检查data_id");
|
||||
}
|
||||
|
||||
//递归删除树结构 1.树 2.列表
|
||||
/* //递归删除树结构 1.树 2.列表
|
||||
if(comparisonEntities.get(0).getViewName().equals("1")){
|
||||
return recursiveDeleteComparison(comparisonEntitiePages,comparisonEntity);
|
||||
}
|
||||
}*/
|
||||
|
||||
String id = String.valueOf(comparisonEntitiePages.get(0).get("id"));
|
||||
|
||||
|
@ -647,7 +654,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparisonDetailsDao.deleteComparisonDetails(comparisonDetailsEntity);
|
||||
// controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
|
||||
}
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","1");
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","1",null);
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("status","200");
|
||||
json1.put("integer",integer);
|
||||
|
@ -657,7 +664,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
}
|
||||
}catch (Exception e){
|
||||
logger.info("删除通用数据数据错误:{}",e.getMessage());
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2");
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2","删除通用数据数据错误:"+e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("删除失败");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue