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());
|
}
|
}
|
}
|