通用数据写入日志增加错误返回信息
This commit is contained in:
parent
988a7789b6
commit
a67169e97a
|
@ -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,8 +189,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if(main!=null){
|
||||
jsonObjectMain = JSONObject.parseObject(main);
|
||||
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,8 +205,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
JSONObject jsonObjectDetails = jsonArray.getJSONObject(i);
|
||||
jsonObjectDetails.put("table_name", keyPair.getKey());
|
||||
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不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -258,8 +260,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() + "字段不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +307,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("保存失败");
|
||||
}
|
||||
|
@ -312,7 +315,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("保存失败");
|
||||
}
|
||||
|
@ -329,8 +332,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() + "字段不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +390,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);
|
||||
|
@ -394,7 +398,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("保存失败");
|
||||
}
|
||||
|
@ -428,6 +432,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparisonEntities=getComparisonEntityCache(comparisonEntity,"main");
|
||||
}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","根据主数据编码查询信息错误:"+e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("更新失败");
|
||||
}
|
||||
JSONObject jsonObjectMain=new JSONObject();
|
||||
|
@ -446,6 +451,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if(main!=null){
|
||||
jsonObjectMain = JSONObject.parseObject(main);
|
||||
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||
logger.info("======更新时候主表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不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -457,6 +464,8 @@ 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"))){
|
||||
logger.info("========更新明细表时候明细表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());
|
||||
|
@ -480,6 +489,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparison.setFields(fields);
|
||||
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparison);
|
||||
if(CollectionUtils.isEmpty(comparisonEntitiePages)){
|
||||
logger.info("=======通用数据更新时候,根据data_id查询id数据为空======");
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -570,7 +581,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);
|
||||
|
@ -581,7 +592,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("更新失败");
|
||||
}
|
||||
}
|
||||
|
@ -618,6 +629,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparisonEntities=getComparisonEntityCache(comparisonEntity,"main");
|
||||
}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","根据主数据编码查询信息错误:"+e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("删除失败");
|
||||
}
|
||||
JSONObject jsonObjectMain=new JSONObject();
|
||||
|
@ -633,7 +645,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if(main!=null){
|
||||
jsonObjectMain = JSONObject.parseObject(main);
|
||||
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||
return BaseResult.getFailureMessageEntity("更新时候主表data_id不能为空");
|
||||
logger.info("======删除时候主表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不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -666,6 +680,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparison.setFields(fields);
|
||||
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparison);
|
||||
if(CollectionUtils.isEmpty(comparisonEntitiePages)){
|
||||
logger.info("=====通用数据删除时候,根据data_id查询id数据为空,请检查data_id====");
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -689,7 +705,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);
|
||||
|
@ -699,7 +715,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