ExpertPublishController.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package com.goafanti.user.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.BaseApiController;
  9. import com.goafanti.common.model.ExpertPublish;
  10. import com.goafanti.common.utils.StringUtils;
  11. import com.goafanti.user.service.ExpertPublishPageService;
  12. import com.goafanti.user.service.ExpertPublishService;
  13. import com.goafanti.user.service.UserService;
  14. @RestController
  15. @RequestMapping(value = "/api/admin/expert")
  16. public class ExpertPublishController extends BaseApiController {
  17. @Resource
  18. private ExpertPublishService expertPublishService;
  19. /**
  20. * 成果发布
  21. */
  22. @RequestMapping(value = "/addExpertPublish", method = RequestMethod.POST)
  23. private Result addExpertPublish(ExpertPublish e) {
  24. Result res = new Result();
  25. if (StringUtils.isBlank(e.getExpertId())) {
  26. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专家", "专家"));
  27. return res;
  28. }
  29. res.setData(expertPublishService.insertExpertPublish(e));
  30. return res;
  31. }
  32. /**
  33. * 撤销发布
  34. */
  35. @RequestMapping(value = "/deletePublish", method = RequestMethod.GET)
  36. private Result deletePublish(String id) {
  37. Result res = new Result();
  38. res.setData(expertPublishService.deletePublish(id));
  39. return res;
  40. }
  41. /**
  42. * 修改发布
  43. */
  44. @RequestMapping(value = "/updatePublish", method = RequestMethod.GET)
  45. private Result updatePublish(ExpertPublish e) {
  46. Result res = new Result();
  47. res.setData(expertPublishService.updatePublish(e));
  48. return res;
  49. }
  50. /**
  51. * 发布列表
  52. */
  53. @RequestMapping(value = "/listPublish", method = RequestMethod.GET)
  54. private Result listPublish(String name,String publishPlatform,Integer publishClient,String publishPage,
  55. Integer ifTop, Integer pageNo, Integer pageSize) {
  56. Result res = new Result();
  57. if (null==pageNo) {
  58. pageNo=1;
  59. }
  60. if (null==pageSize) {
  61. pageSize=10;
  62. }
  63. res.setData(expertPublishService.listPublish( name, publishPlatform, publishClient, publishPage,
  64. ifTop, pageNo, pageSize));
  65. return res;
  66. }
  67. /**
  68. * 获取专家页面位置
  69. */
  70. @RequestMapping(value="/getPublishPage",method = RequestMethod.GET)
  71. private Result getPublishPage(){
  72. Result res=new Result();
  73. return res.data(ExpertPublishPageService.getBranchInformation());
  74. }
  75. }