diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/IControlsLogDao.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/IControlsLogDao.java index 873bcc62..aa3d9df8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/IControlsLogDao.java +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/IControlsLogDao.java @@ -15,6 +15,6 @@ public interface IControlsLogDao extends IBaseDao { * @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); } diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/impl/ControlsLogDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/impl/ControlsLogDaoImpl.java index 034ca37e..d90d3044 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/impl/ControlsLogDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/impl/ControlsLogDaoImpl.java @@ -12,7 +12,7 @@ public class ControlsLogDaoImpl extends MybatisGenericDao 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 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 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 } 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 } 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 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 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 } 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 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 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 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 comparison.setFields(fields); List> 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 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 } 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 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 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 comparison.setFields(fields); List> 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 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 } }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("删除失败"); } }