package com.product.administration.controller; import com.product.administration.config.CmnConst; import com.product.administration.config.SystemCode; import com.product.administration.service.ReplyOpinionService; import com.product.common.lang.StringUtils; import com.product.core.config.CoreConst; import com.product.core.controller.support.AbstractBaseController; 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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; /** * Copyright LX * @Title: ReplyOpinionController * @Project: product-server * @date: 2021年04月15日 18:03 * @author: ZhouJie * @Description: 协同办公意见回复 */ @RequestMapping("/api/reply") @RestController public class ReplyOpinionController extends AbstractBaseController { @Autowired ReplyOpinionService replyOpinionService; /** * @Date: 2020-04-15 18:16 * @Author: ZhouJie * @Description: 新增意见回复 */ @RequestMapping(value = "/add-reply/{version}", method = RequestMethod.POST) public String addReplyOpinion(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_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); } //判断表名是否正常 if (!CmnConst.PRODUCT_OA_COOPERATE_FLOW_REPLY.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()); } String uuid = replyOpinionService.addReplyOpinion(fse); if (!StringUtils.isEmpty(uuid)) { return OK_Add(uuid); } SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_SAVE_COOPERATE_REPLY_FAIL.getValue(), SystemCode.SYSTEM_SAVE_COOPERATE_REPLY_FAIL.getText()); return error(SystemCode.SYSTEM_SAVE_COOPERATE_REPLY_FAIL.getValue(), SystemCode.SYSTEM_SAVE_COOPERATE_REPLY_FAIL.getText()); }catch(BaseException e) { SpringMVCContextHolder.getSystemLogger().error(e); return this.error(e); }catch (Exception e) { SpringMVCContextHolder.getSystemLogger().error(e); return this.error(SystemCode.SYSTEM_SAVE_COOPERATE_REPLY_FAIL.getValue(), SystemCode.SYSTEM_SAVE_COOPERATE_REPLY_FAIL.getText()); } } }