@Test public void checkAll() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/apiext/checkAll?appid=1001") .contentType(MediaType.APPLICATION_JSON_UTF8) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }
@RequestMapping(value = "/checkAll") public ServiceResult<String> checkAll(@RequestParam("appid") String appid, @CurrentUser LoginUser user, HttpServletRequest request) { String baseurl = DasEnv.getBaseUrl(request); String addmsg = "明细请查看 http: try { if (null == appid) { return ServiceResult.fail("ApiExtController.checkByAppid appid " + addmsg); } Project project = projectDao.getProjectByAppId(appid); ConfigCkeckResult<List<ConfigDataResponse>> cr = projectService.getCheckData(user, project); if (cr.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("projectService.getCheckData appid " + addmsg); } List<ConfigDataResponse> configDataResponses = cr.getItem(); ConfigCkeckResult<ConfigCheckItem> configCkeckResult = ConfigCheckBase.checkData(configDataResponses); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("项目配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<DatabaseSet> dbsets = databaseSetDao.getAllDatabaseSetByGroupId(project.getDal_group_id()); if (CollectionUtils.isEmpty(dbsets)) { return ServiceResult.fail("逻辑库配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<ConfigDataResponse> configCheckResponses = databaseSetService.getAllCheckData(user, project.getDal_group_id(), dbsets.get(0)); configCkeckResult = ConfigCheckBase.checkData(configCheckResponses); if (configCkeckResult.getCode() != ConfigCkeckResult.ERROR) { List<DataBaseInfo> list = dataBaseDao.getAllDbByAppId(appid); for (DataBaseInfo dataBaseInfo : list) { cr = databaseService.getCheckData(user, dataBaseInfo); if (cr.getCode() == ConfigCkeckResult.SUCCESS) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } configCkeckResult = ConfigCheckBase.checkData(cr.getItem()); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } } return ServiceResult.success(); } } catch (Exception e) { return ServiceResult.fail("ApiExtController.checkByAppid appid : " + appid + " " + StringUtil.getMessage(e)); } return ServiceResult.fail("物理库校验不通过, 明细请查看 http: }
ApiExtController { @RequestMapping(value = "/checkAll") public ServiceResult<String> checkAll(@RequestParam("appid") String appid, @CurrentUser LoginUser user, HttpServletRequest request) { String baseurl = DasEnv.getBaseUrl(request); String addmsg = "明细请查看 http: try { if (null == appid) { return ServiceResult.fail("ApiExtController.checkByAppid appid " + addmsg); } Project project = projectDao.getProjectByAppId(appid); ConfigCkeckResult<List<ConfigDataResponse>> cr = projectService.getCheckData(user, project); if (cr.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("projectService.getCheckData appid " + addmsg); } List<ConfigDataResponse> configDataResponses = cr.getItem(); ConfigCkeckResult<ConfigCheckItem> configCkeckResult = ConfigCheckBase.checkData(configDataResponses); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("项目配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<DatabaseSet> dbsets = databaseSetDao.getAllDatabaseSetByGroupId(project.getDal_group_id()); if (CollectionUtils.isEmpty(dbsets)) { return ServiceResult.fail("逻辑库配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<ConfigDataResponse> configCheckResponses = databaseSetService.getAllCheckData(user, project.getDal_group_id(), dbsets.get(0)); configCkeckResult = ConfigCheckBase.checkData(configCheckResponses); if (configCkeckResult.getCode() != ConfigCkeckResult.ERROR) { List<DataBaseInfo> list = dataBaseDao.getAllDbByAppId(appid); for (DataBaseInfo dataBaseInfo : list) { cr = databaseService.getCheckData(user, dataBaseInfo); if (cr.getCode() == ConfigCkeckResult.SUCCESS) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } configCkeckResult = ConfigCheckBase.checkData(cr.getItem()); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } } return ServiceResult.success(); } } catch (Exception e) { return ServiceResult.fail("ApiExtController.checkByAppid appid : " + appid + " " + StringUtil.getMessage(e)); } return ServiceResult.fail("物理库校验不通过, 明细请查看 http: } }
ApiExtController { @RequestMapping(value = "/checkAll") public ServiceResult<String> checkAll(@RequestParam("appid") String appid, @CurrentUser LoginUser user, HttpServletRequest request) { String baseurl = DasEnv.getBaseUrl(request); String addmsg = "明细请查看 http: try { if (null == appid) { return ServiceResult.fail("ApiExtController.checkByAppid appid " + addmsg); } Project project = projectDao.getProjectByAppId(appid); ConfigCkeckResult<List<ConfigDataResponse>> cr = projectService.getCheckData(user, project); if (cr.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("projectService.getCheckData appid " + addmsg); } List<ConfigDataResponse> configDataResponses = cr.getItem(); ConfigCkeckResult<ConfigCheckItem> configCkeckResult = ConfigCheckBase.checkData(configDataResponses); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("项目配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<DatabaseSet> dbsets = databaseSetDao.getAllDatabaseSetByGroupId(project.getDal_group_id()); if (CollectionUtils.isEmpty(dbsets)) { return ServiceResult.fail("逻辑库配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<ConfigDataResponse> configCheckResponses = databaseSetService.getAllCheckData(user, project.getDal_group_id(), dbsets.get(0)); configCkeckResult = ConfigCheckBase.checkData(configCheckResponses); if (configCkeckResult.getCode() != ConfigCkeckResult.ERROR) { List<DataBaseInfo> list = dataBaseDao.getAllDbByAppId(appid); for (DataBaseInfo dataBaseInfo : list) { cr = databaseService.getCheckData(user, dataBaseInfo); if (cr.getCode() == ConfigCkeckResult.SUCCESS) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } configCkeckResult = ConfigCheckBase.checkData(cr.getItem()); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } } return ServiceResult.success(); } } catch (Exception e) { return ServiceResult.fail("ApiExtController.checkByAppid appid : " + appid + " " + StringUtil.getMessage(e)); } return ServiceResult.fail("物理库校验不通过, 明细请查看 http: }  }
ApiExtController { @RequestMapping(value = "/checkAll") public ServiceResult<String> checkAll(@RequestParam("appid") String appid, @CurrentUser LoginUser user, HttpServletRequest request) { String baseurl = DasEnv.getBaseUrl(request); String addmsg = "明细请查看 http: try { if (null == appid) { return ServiceResult.fail("ApiExtController.checkByAppid appid " + addmsg); } Project project = projectDao.getProjectByAppId(appid); ConfigCkeckResult<List<ConfigDataResponse>> cr = projectService.getCheckData(user, project); if (cr.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("projectService.getCheckData appid " + addmsg); } List<ConfigDataResponse> configDataResponses = cr.getItem(); ConfigCkeckResult<ConfigCheckItem> configCkeckResult = ConfigCheckBase.checkData(configDataResponses); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("项目配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<DatabaseSet> dbsets = databaseSetDao.getAllDatabaseSetByGroupId(project.getDal_group_id()); if (CollectionUtils.isEmpty(dbsets)) { return ServiceResult.fail("逻辑库配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<ConfigDataResponse> configCheckResponses = databaseSetService.getAllCheckData(user, project.getDal_group_id(), dbsets.get(0)); configCkeckResult = ConfigCheckBase.checkData(configCheckResponses); if (configCkeckResult.getCode() != ConfigCkeckResult.ERROR) { List<DataBaseInfo> list = dataBaseDao.getAllDbByAppId(appid); for (DataBaseInfo dataBaseInfo : list) { cr = databaseService.getCheckData(user, dataBaseInfo); if (cr.getCode() == ConfigCkeckResult.SUCCESS) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } configCkeckResult = ConfigCheckBase.checkData(cr.getItem()); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } } return ServiceResult.success(); } } catch (Exception e) { return ServiceResult.fail("ApiExtController.checkByAppid appid : " + appid + " " + StringUtil.getMessage(e)); } return ServiceResult.fail("物理库校验不通过, 明细请查看 http: }  @RequestMapping(value = "/check") ServiceResult check(@RequestParam("appid") String appid); @RequestMapping(value = "/checkDblist") ServiceResult checkDblist(@RequestParam("appid") String appid, @CurrentUser LoginUser user); @RequestMapping(value = "/checkAll") ServiceResult<String> checkAll(@RequestParam("appid") String appid, @CurrentUser LoginUser user, HttpServletRequest request); @RequestMapping(value = "/appidExist") ServiceResult appidExist(@RequestParam(value = "appid", defaultValue = "0") String appid); }
ApiExtController { @RequestMapping(value = "/checkAll") public ServiceResult<String> checkAll(@RequestParam("appid") String appid, @CurrentUser LoginUser user, HttpServletRequest request) { String baseurl = DasEnv.getBaseUrl(request); String addmsg = "明细请查看 http: try { if (null == appid) { return ServiceResult.fail("ApiExtController.checkByAppid appid " + addmsg); } Project project = projectDao.getProjectByAppId(appid); ConfigCkeckResult<List<ConfigDataResponse>> cr = projectService.getCheckData(user, project); if (cr.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("projectService.getCheckData appid " + addmsg); } List<ConfigDataResponse> configDataResponses = cr.getItem(); ConfigCkeckResult<ConfigCheckItem> configCkeckResult = ConfigCheckBase.checkData(configDataResponses); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("项目配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<DatabaseSet> dbsets = databaseSetDao.getAllDatabaseSetByGroupId(project.getDal_group_id()); if (CollectionUtils.isEmpty(dbsets)) { return ServiceResult.fail("逻辑库配置校验不通过，" + configCkeckResult.getMsg() + addmsg); } List<ConfigDataResponse> configCheckResponses = databaseSetService.getAllCheckData(user, project.getDal_group_id(), dbsets.get(0)); configCkeckResult = ConfigCheckBase.checkData(configCheckResponses); if (configCkeckResult.getCode() != ConfigCkeckResult.ERROR) { List<DataBaseInfo> list = dataBaseDao.getAllDbByAppId(appid); for (DataBaseInfo dataBaseInfo : list) { cr = databaseService.getCheckData(user, dataBaseInfo); if (cr.getCode() == ConfigCkeckResult.SUCCESS) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } configCkeckResult = ConfigCheckBase.checkData(cr.getItem()); if (configCkeckResult.getCode() == ConfigCkeckResult.ERROR) { return ServiceResult.fail("物理库校验不通过，" + configCkeckResult.getMsg() + addmsg); } } return ServiceResult.success(); } } catch (Exception e) { return ServiceResult.fail("ApiExtController.checkByAppid appid : " + appid + " " + StringUtil.getMessage(e)); } return ServiceResult.fail("物理库校验不通过, 明细请查看 http: }  @RequestMapping(value = "/check") ServiceResult check(@RequestParam("appid") String appid); @RequestMapping(value = "/checkDblist") ServiceResult checkDblist(@RequestParam("appid") String appid, @CurrentUser LoginUser user); @RequestMapping(value = "/checkAll") ServiceResult<String> checkAll(@RequestParam("appid") String appid, @CurrentUser LoginUser user, HttpServletRequest request); @RequestMapping(value = "/appidExist") ServiceResult appidExist(@RequestParam(value = "appid", defaultValue = "0") String appid);  }