From c2b94a6757c11590190dcd1b566da57072794703 Mon Sep 17 00:00:00 2001 From: zm <2369059705qq.com> Date: 星期三, 24 七月 2024 17:32:08 +0800 Subject: [PATCH] 项目立项优化 --- src/main/java/com/product/contract/controller/ProjectScheduleController.java | 76 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 76 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/product/contract/controller/ProjectScheduleController.java b/src/main/java/com/product/contract/controller/ProjectScheduleController.java new file mode 100644 index 0000000..ce1f4b9 --- /dev/null +++ b/src/main/java/com/product/contract/controller/ProjectScheduleController.java @@ -0,0 +1,76 @@ +package com.product.contract.controller; + +import com.product.contract.service.ProjectScheduleService; +import com.product.core.controller.support.AbstractBaseController; +import com.product.core.entity.FieldSetEntity; +import com.product.core.exception.BaseException; +import com.product.module.sys.version.ApiVersion; +import com.product.util.BaseUtil; +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 com.product.contract.config.CmnConst; +import com.product.contract.config.SystemCode; + +import javax.servlet.http.HttpServletRequest; + +/** + * 椤圭洰杩涘害 + * + */ +@RequestMapping("/api/project-schedule") +@RestController +public class ProjectScheduleController extends AbstractBaseController{ + + @Autowired + ProjectScheduleService projectScheduleService; + + + + /** + * 涓汉椤圭洰杩涘害 + * @param request + * @return + */ + @RequestMapping(value="/list/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String listProjectSchedule(HttpServletRequest request) { + try { + //鑾峰彇鍙傛暟 + FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_PROJECT_SCHEDULE); + return OK_List(projectScheduleService.getList()); + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(SystemCode.PROJECT_SCHEDULE_OPERATE_FAIL.getValue(), SystemCode.PROJECT_SCHEDULE_OPERATE_FAIL.getText() + e.getMessage()); + } + } + + /** + * 涓汉椤圭洰杩涘害淇濆瓨 + * @param request + * @return + */ + @RequestMapping(value="/save/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String save(HttpServletRequest request) { + try { + //鑾峰彇鍙傛暟 + FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_PROJECT_SCHEDULE); + boolean succ = projectScheduleService.save(fse.getSubDataTable(CmnConst.PRODUCT_PROJECT_SCHEDULE)); + if (succ) { + return OK(); + } + return error(SystemCode.PROJECT_SCHEDULE_SAVE_FAIL.getValue(), SystemCode.PROJECT_SCHEDULE_SAVE_FAIL.getText()); + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(SystemCode.PROJECT_SCHEDULE_OPERATE_FAIL.getValue(), SystemCode.PROJECT_SCHEDULE_OPERATE_FAIL.getText() + e.getMessage()); + } + } +} -- Gitblit v1.9.2