ScDemandApiController.java 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package com.goafanti.sc.controller;
  2. import javax.annotation.Resource;
  3. import org.springframework.web.bind.annotation.RequestMapping;
  4. import org.springframework.web.bind.annotation.RequestMethod;
  5. import org.springframework.web.bind.annotation.RestController;
  6. import com.goafanti.common.bo.Result;
  7. import com.goafanti.common.constant.ErrorConstants;
  8. import com.goafanti.common.controller.CertifyApiController;
  9. import com.goafanti.common.utils.StringUtils;
  10. import com.goafanti.sc.bo.inputDemands;
  11. import com.goafanti.sc.service.ScAchievementService;
  12. import com.goafanti.sc.service.ScDemandService;
  13. @RestController
  14. @RequestMapping(value = "/open/api")
  15. public class ScDemandApiController extends CertifyApiController {
  16. @Resource
  17. private ScAchievementService scachievementService;
  18. @Resource
  19. private ScDemandService ScDemandService;
  20. /**
  21. * 新增需求
  22. */
  23. @RequestMapping(value = "/addDemand", method = RequestMethod.POST)
  24. private Result addDemand(inputDemands a ) {
  25. Result res = new Result();
  26. res.setData(ScDemandService.addDemands(a));
  27. return res;
  28. }
  29. /**
  30. * 需求列表
  31. */
  32. @RequestMapping(value = "/demandList", method = RequestMethod.GET)
  33. private Result demandList(String reserveButtUnit,String type,String name,String orgName,Integer pageSize,Integer pageNo) {
  34. Result res = new Result();
  35. res.setData(ScDemandService.DemandList(reserveButtUnit,type,name,orgName,pageSize,pageNo));
  36. return res;
  37. }
  38. /**
  39. * 删除需求
  40. */
  41. @RequestMapping(value = "/delectDemand", method = RequestMethod.GET)
  42. private Result delectDemand(String id){
  43. Result res = new Result();
  44. if (StringUtils.isBlank(id)) {
  45. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果", "成果ID"));
  46. return res;
  47. }
  48. res.setData(ScDemandService.delectDemand(id));
  49. return res;
  50. }
  51. /**
  52. * 修改成果
  53. */
  54. @RequestMapping(value = "/updateDemand", method = RequestMethod.POST)
  55. private Result updateDemand(inputDemands a){
  56. Result res = new Result();
  57. res.setData(ScDemandService.updateDemand(a));
  58. return res;
  59. }
  60. /**
  61. * 需求详情
  62. */
  63. @RequestMapping(value = "/demandDetails", method = RequestMethod.GET)
  64. private Result demandDetails(String id){
  65. Result res = new Result();
  66. if (StringUtils.isBlank(id)) {
  67. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果", "成果ID"));
  68. return res;
  69. }
  70. res.setData(ScDemandService.demandDetails(id));
  71. return res;
  72. }
  73. }