package com.product.administration.controller; import com.product.admin.service.PublicService; import com.product.admin.service.idel.IPublicService; import com.product.administration.config.CmnConst; import com.product.administration.config.SystemCode; import com.product.administration.service.EarlyWarningManagerService; import com.product.administration.service.EarlyWarningServer; import com.product.administration.service.EarlyWarningService; import com.product.administration.service.ide.IEarlyWarningManager; import com.product.common.lang.StringUtils; import com.product.core.config.CoreConst; import com.product.core.controller.support.AbstractBaseController; import com.product.core.entity.DataTableEntity; import com.product.core.entity.FieldSetEntity; import com.product.core.entity.RequestParameterEntity; import com.product.core.exception.BaseException; import com.product.core.spring.context.SpringMVCContextHolder; import com.product.module.sys.version.ApiVersion; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * 预警配置类 * * @author 86151 */ @RequestMapping("/api/early-warning") @RestController public class EarlyWarningManagerController extends AbstractBaseController { @Autowired EarlyWarningManagerService earlyWarningManagerService; @Autowired EarlyWarningService earlyWarningService; @Autowired EarlyWarningServer earlyWarningServer; /** * 预警配置列表 * * @param response * @param request * @return */ @RequestMapping(value = "/list-warning-config/{version}", method = RequestMethod.POST) @ApiVersion(1) public String listWarning(HttpServletResponse response, HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } //判断表名是否正常 if (!CmnConst.PRODUCT_SYS_EARLY_WARNING.equals(fse.getTableName())) { return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } DataTableEntity dt = earlyWarningManagerService.listWarning(fse.getInteger("pagesize"), fse.getInteger("cpage"), fse); return OK_List(dt); } catch (BaseException e) { e.printStackTrace(); return this.error(e.getCode(), e.getMessage()); } catch (Exception e) { e.printStackTrace(); return this.error(SystemCode.SYSTEM_EARLY_WARNING_LIST_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_LIST_FAIL.getText() + e.getMessage()); } } /** * 预警配置详情 * * @param response * @param request * @return */ @RequestMapping(value = "/find-warning-config/{version}", method = RequestMethod.POST) @ApiVersion(1) public String findWarning(HttpServletResponse response, HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } //判断表名是否正常 if (!CmnConst.PRODUCT_SYS_EARLY_WARNING.equals(fse.getTableName())) { return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } //判断uuid是否为空 if (StringUtils.isEmpty(fse.getUUID())) { return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); } return earlyWarningManagerService.findWarning(fse.getUUID()); } catch (BaseException e) { e.printStackTrace(); return this.error(e.getCode(), e.getMessage()); } catch (Exception e) { e.printStackTrace(); return this.error(SystemCode.SYSTEM_EARLY_WARNING_FIND_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_FIND_FAIL.getText() + e.getMessage()); } } /** * 预警配置新增 * * @param response * @param request * @return */ @RequestMapping(value = "/add-warning-config/{version}", method = RequestMethod.POST) @ApiVersion(1) public String addWarning(HttpServletResponse response, HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } //判断表名是否正常 if (!CmnConst.PRODUCT_SYS_EARLY_WARNING.equals(fse.getTableName())) { return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } IEarlyWarningManager service = (IEarlyWarningManager) getProxyInstance(earlyWarningManagerService); String uuid = service.addWarning(fse); return OK_Add(uuid); } catch (BaseException e) { e.printStackTrace(); return this.error(e.getCode(), e.getMessage()); } catch (Exception e) { e.printStackTrace(); return this.error(SystemCode.SYSTEM_EARLY_WARNING_ADD_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_ADD_FAIL.getText() + e.getMessage()); } } /** * 预警配置修改 * * @param response * @param request * @return */ @RequestMapping(value = "/update-warning-config/{version}", method = RequestMethod.POST) @ApiVersion(1) public String updateWarning(HttpServletResponse response, HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } //判断表名是否正常 if (!CmnConst.PRODUCT_SYS_EARLY_WARNING.equals(fse.getTableName())) { return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } //判断uuid是否为空 if (StringUtils.isEmpty(fse.getUUID())) { return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); } IEarlyWarningManager service = (IEarlyWarningManager) getProxyInstance(earlyWarningManagerService); boolean succ = service.updateWarning(fse); if (succ) { return OK(); } else { return error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText()); } } catch (BaseException e) { e.printStackTrace(); return this.error(e.getCode(), e.getMessage()); } catch (Exception e) { e.printStackTrace(); return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage()); } } /** * 预警配置删除 * * @param response * @param request * @return */ @RequestMapping(value = "/delete-warning-config/{version}", method = RequestMethod.POST) @ApiVersion(1) public String deleteWarning(HttpServletResponse response, HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } //判断表名是否正常 if (!CmnConst.PRODUCT_SYS_EARLY_WARNING.equals(fse.getTableName())) { return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } //判断uuid是否为空 if (StringUtils.isEmpty(fse.getUUID())) { return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); } IEarlyWarningManager service = (IEarlyWarningManager) getProxyInstance(earlyWarningManagerService); boolean succ = service.deleteWarning(fse.getUUID()); if (succ) { return OK(); } else { return error(SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getText()); } } catch (BaseException e) { e.printStackTrace(); return this.error(e.getCode(), e.getMessage()); } catch (Exception e) { e.printStackTrace(); return this.error(SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getText() + e.getMessage()); } } /** * 根据流程获取所有字段 * * @param response * @param request * @return */ @RequestMapping(value = "/get-field-by-flow-code/{version}", method = RequestMethod.POST) @ApiVersion(1) public String getFieldByFlowCode(HttpServletResponse response, HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } //判断表名是否正常 if (!CmnConst.PRODUCT_SYS_EARLY_WARNING.equals(fse.getTableName())) { return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } //判断uuid是否为空 if (StringUtils.isEmpty(fse.getString(CmnConst.TYPE_CODE))) { return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); } return earlyWarningManagerService.getFieldByFlowCode(fse.getString(CmnConst.TYPE_CODE)); } catch (BaseException e) { e.printStackTrace(); return this.error(e.getCode(), e.getMessage()); } catch (Exception e) { e.printStackTrace(); return this.error(SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getText() + e.getMessage()); } } /** * 发送预警消息 * * @return */ @RequestMapping(value = "/send-warning-info/{version}", method = RequestMethod.POST) @ApiVersion(1) public String sendWarningInfo(HttpServletResponse response, HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } //判断表名是否正常 if (!CmnConst.PRODUCT_SYS_EARLY_WARNING.equals(fse.getTableName())) { return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } // earlyWarningService.sendWarningInfo(); earlyWarningServer.warningTask(); return OK(); } catch (BaseException e) { e.printStackTrace(); return this.error(e.getCode(), e.getMessage()); } catch (Exception e) { e.printStackTrace(); return this.error(SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getText() + e.getMessage()); } } /** * 预警条件检测 * * @param response * @param request * @return */ @RequestMapping(value = "/condition-check/{version}", method = RequestMethod.POST) @ApiVersion(1) public String conditionCheck(HttpServletResponse response, HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } boolean succ = earlyWarningManagerService.conditionCheck(fse.getString(CmnConst.SOURCE_TABLE), fse.getString(CmnConst.CONDITON_CONFIG)); if (succ) { return OK(); } else { return this.error(SystemCode.SYSTEM_WARNING_CONFIG_CHECK_FAIL.getValue(), SystemCode.SYSTEM_WARNING_CONFIG_CHECK_FAIL.getText()); } } catch (BaseException e) { e.printStackTrace(); return this.error(e.getCode(), e.getMessage()); } catch (Exception e) { e.printStackTrace(); return this.error(SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_DELETE_FAIL.getText() + e.getMessage()); } } @Autowired PublicService publicService; /** * 预警反馈列表 * * @param request * @return */ @PostMapping("/list-warn-info/{version}") @ApiVersion(1) public String getListFeddBacl(HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { throw new BaseException(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } if (fse.getTableName() == null || !CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO.equals(fse.getTableName())) { throw new BaseException(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } // 判断分页参数是否正常 if (StringUtils.isEmpty(fse.getString(CmnConst.PAGESIZE)) || StringUtils.isEmpty(fse.getString(CmnConst.CPAGE))) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); } // return OK_List(publicService.listTable(fse)); return OK_List(earlyWarningManagerService.listWarnInfo(fse)); } catch (BaseException e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(e); return error(e); } catch (Exception e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(SystemCode.GET_WARN_FEEDBACK_LIST_FAIL.getValue(), SystemCode.GET_WARN_FEEDBACK_LIST_FAIL.getText() + "," + e.getMessage()); return error(SystemCode.GET_WARN_FEEDBACK_LIST_FAIL.getValue(), SystemCode.GET_WARN_FEEDBACK_LIST_FAIL.getText() + "," + e.getMessage()); } } /** * 查询预警反馈详情 * * @param request * @return */ @PostMapping("/find-warn-info/{version}") @ApiVersion(1) public String findFeedBack(HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } if (fse.getTableName() == null || !CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO.equals(fse.getTableName())) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } // 判断参数是否正常 if (StringUtils.isEmpty(fse.getUUID())) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); return error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); } return OK_List(earlyWarningManagerService.findWarnInfo(fse)); } catch (BaseException e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(e); return error(e); } catch (Exception e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getValue(), SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getText() + "," + e.getMessage()); return error(SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getValue(), SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getText() + "," + e.getMessage()); } } /** * 保存预警反馈 * * @param request * @return */ @PostMapping("/save-feed-back/{version}") @ApiVersion(1) public String saveFeedBack(HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } if (fse.getTableName() == null || !CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO_FEEDBACK.equals(fse.getTableName())) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } if(fse.getObject("createDate")==null) { fse.setValue("createDate", new Date()); } IPublicService publicService = (IPublicService) getProxyInstance(this.publicService); publicService.saveFieldSetEntity(fse); earlyWarningManagerService.sendWarnFeedBackMessage(fse); return OK_List(earlyWarningManagerService.getWarnFeedBack(fse.getString("parent_uuid"))); } catch (BaseException e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(e); return error(e); } catch (Exception e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getValue(), SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getText() + "," + e.getMessage()); return error(SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getValue(), SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getText() + "," + e.getMessage()); } } /** * 删除预警反馈详情 * * @param request * @return */ @PostMapping("/del-feed-back/{version}") @ApiVersion(1) public String delFeedBack(HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } if (fse.getTableName() == null || !CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO_FEEDBACK.equals(fse.getTableName())) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } // 判断参数是否正常 if (StringUtils.isEmpty(fse.getUUID())) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); return error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); } IPublicService publicService = (IPublicService) getProxyInstance(this.publicService); publicService.delete(fse); return OK(); } catch (BaseException e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(e); return error(e); } catch (Exception e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getValue(), SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getText() + "," + e.getMessage()); return error(SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getValue(), SystemCode.GET_WARN_FEEDBACK_DETAIL_FAIL.getText() + "," + e.getMessage()); } } /** * 批量修改预警时间 * * @param request * @return */ @PostMapping("/updateEarlyWarningTime/{version}") @ApiVersion(1) public String updateEarlyWarningTime(HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } if (fse.getTableName() == null) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } IEarlyWarningManager service = (IEarlyWarningManager) getProxyInstance(earlyWarningManagerService); boolean succ = service.updateEarlyWarningTime(fse); if(succ) { return OK(); }else{ return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText()); } } catch (BaseException e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(e); return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage()); } catch (Exception e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(e); return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage()); } } /** * 批量修改预警时间 * * @param request * @return */ @PostMapping("/transmit/{version}") @ApiVersion(1) public String transmit(HttpServletRequest request) { try { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } if (fse.getTableName() == null) { SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); } IEarlyWarningManager service = (IEarlyWarningManager) getProxyInstance(earlyWarningManagerService); service.transmit(fse); return OK(); } catch (BaseException e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(e); return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage()); } catch (Exception e) { e.printStackTrace(); SpringMVCContextHolder.getSystemLogger().error(e); return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage()); } } }