OpenAppHomeController.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package com.goafanti.app.controller;
  2. import javax.annotation.Resource;
  3. import javax.servlet.http.HttpServletRequest;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RequestMethod;
  6. import org.springframework.web.bind.annotation.ResponseBody;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import com.goafanti.app.service.AppHomePageService;
  9. import com.goafanti.business.service.JtBusinessService;
  10. import com.goafanti.comment.bo.CommentResult;
  11. import com.goafanti.comment.service.CommentService;
  12. import com.goafanti.common.bo.Result;
  13. import com.goafanti.common.constant.AFTConstants;
  14. import com.goafanti.common.constant.ErrorConstants;
  15. import com.goafanti.common.controller.BaseApiController;
  16. import com.goafanti.common.utils.StringUtils;
  17. @RestController
  18. @RequestMapping(path = "/open/app/home")
  19. public class OpenAppHomeController extends BaseApiController{
  20. @Resource
  21. private AppHomePageService appHomePageService;
  22. @Resource
  23. private JtBusinessService jtBusinessService;
  24. @Resource
  25. private CommentService commentService;
  26. /**App首页轮播图、导航、知产*/
  27. @RequestMapping(value = "/getHomePageData", method = RequestMethod.GET)
  28. public Result getHomePageData(HttpServletRequest request){
  29. Result res = new Result();
  30. res.setData(appHomePageService.getAppHomePage(request));
  31. return res;
  32. }
  33. /**技淘推荐*/
  34. @RequestMapping(value = "/getHomeRecommended", method = RequestMethod.GET)
  35. public Result getHomeRecommended(Integer type){
  36. Result res = new Result();
  37. if (null==type||type>3||type<0) {
  38. res.getError().add(buildError( "类型错误", "类型错误"));
  39. return res;
  40. }
  41. res.setData(appHomePageService.getHomeRecommended(type));
  42. return res;
  43. }
  44. /**
  45. * 项目列表
  46. * @param topId
  47. * @param secondId
  48. * @param name
  49. * @param pageSize
  50. * @param pageNo
  51. * @param privateProject
  52. * @param auditStatus
  53. * @param module
  54. * @param isHot
  55. * @param orderType
  56. * @param orderSort
  57. * @param ownerId
  58. * @return
  59. */
  60. @RequestMapping(value="/projectList", method=RequestMethod.GET)
  61. public Result getProjectList(String topId,String secondId,String name,Integer pageSize,Integer pageNo,Integer privateProject,Integer auditStatus,Integer module,Integer isHot,Integer orderType,Integer orderSort,String ownerId) {
  62. Result result=new Result();
  63. result.setData(jtBusinessService.getProjects(topId,secondId,name,pageSize,pageNo,privateProject,auditStatus,module,isHot,orderType,orderSort,ownerId));
  64. return result;
  65. }
  66. /**
  67. * 项目详情
  68. * @param id
  69. * @return
  70. */
  71. @RequestMapping(value="/projectdDtail",method=RequestMethod.GET)
  72. public Result projectdDtail(String id){
  73. Result result =new Result();
  74. if (StringUtils.isBlank(id)) {
  75. result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"商品ID","商品ID"));
  76. return result;
  77. }
  78. result.setData(jtBusinessService.getBusinessProjectDetail(id));
  79. return result;
  80. }
  81. /**
  82. * 项目评价
  83. * @param id
  84. * @return
  85. */
  86. @RequestMapping(value = "/projectdComment", method = RequestMethod.GET)
  87. public Result listComment(String id,Integer pageNo,Integer pageSize) {
  88. Result result=new Result();
  89. if(StringUtils.isBlank(id)) {
  90. result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"商品ID","商品ID"));
  91. }
  92. CommentResult commentResult=new CommentResult();
  93. commentResult.setPositiveCommentCount(commentService.getCommentCount(0, id));
  94. commentResult.setOrdinaryCommentCount(commentService.getCommentCount(1, id));
  95. commentResult.setNegativeCommentCount(commentService.getCommentCount(2, id));
  96. commentResult.setComments(commentService.searchComment(id, pageNo, pageSize));
  97. result.setData(commentResult);
  98. return result;
  99. }
  100. }