| | |
| | | package com.product.administration.controller; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.product.admin.service.PublicService; |
| | | import com.product.admin.service.idel.IPublicService; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | 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 com.product.administration.config.CmnConst; |
| | | import com.product.administration.config.SystemCode; |
| | | import com.product.administration.service.EarlyWarningManagerService; |
| | |
| | | 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; |
| | | |
| | | |
| | | /** |
| | |
| | | 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 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()); |
| | | } |
| | | } |
| | | } |