OpenDemandCollectionApiController.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package com.goafanti.demandCollection.controller;
  2. import javax.annotation.Resource;
  3. import javax.servlet.http.HttpServletResponse;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RequestMethod;
  6. import org.springframework.web.bind.annotation.RestController;
  7. import com.goafanti.common.bo.Result;
  8. import com.goafanti.common.controller.CertifyApiController;
  9. import com.goafanti.common.model.DemandCollection;
  10. import com.goafanti.demandCollection.bo.InputDemandCollection;
  11. import com.goafanti.demandCollection.service.DemandCollectionService;
  12. @RestController
  13. @RequestMapping(value = "/open")
  14. public class OpenDemandCollectionApiController extends CertifyApiController {
  15. @Resource
  16. private DemandCollectionService demandCollectionService;
  17. /**
  18. * 新增需求收集
  19. * @param d
  20. * @return
  21. */
  22. @RequestMapping(value="/addDemandCollection",method = RequestMethod.POST)
  23. public Result addDemandCollection(DemandCollection d){
  24. Result res =new Result();
  25. if (d.getDwmc()==null) {
  26. res.getError().add(buildError("名称必须指定","名称必须指定"));
  27. return res;
  28. }
  29. res.data(demandCollectionService.addDemandCollection(d));
  30. return res;
  31. }
  32. /**
  33. * 需求收集列表
  34. * @param d
  35. * @return
  36. */
  37. @RequestMapping(value="/demandCollectionList",method = RequestMethod.GET)
  38. public Result demandCollectionList(InputDemandCollection i){
  39. Result res =new Result();
  40. res.data(demandCollectionService.demandCollectionList(i));
  41. return res;
  42. }
  43. /**
  44. * 导出变更列表
  45. *
  46. * @param response
  47. * @return
  48. */
  49. @RequestMapping(value = "/exportDemandCollectionList" , method = RequestMethod.GET)
  50. public Result exportDemandCollectionList(HttpServletResponse response,InputDemandCollection i) {
  51. Result res=new Result();
  52. try {
  53. demandCollectionService.exportDemandCollectionList( response, i);
  54. } catch (Exception e) {
  55. res.getError().add(buildError("格式不正确"));
  56. e.printStackTrace();
  57. return res;
  58. }
  59. res.data(1);
  60. return res;
  61. }
  62. }