OpenAppHomeController.java 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. package com.goafanti.app.controller;
  2. import java.util.HashMap;
  3. import java.util.Map;
  4. import javax.annotation.Resource;
  5. import javax.servlet.http.HttpServletRequest;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RequestMethod;
  8. import org.springframework.web.bind.annotation.ResponseBody;
  9. import org.springframework.web.bind.annotation.RestController;
  10. import com.goafanti.achievement.service.AchievementService;
  11. import com.goafanti.banners.service.BannersService;
  12. import com.goafanti.business.service.JtBusinessService;
  13. import com.goafanti.business.service.JtTagService;
  14. import com.goafanti.comment.bo.CommentResult;
  15. import com.goafanti.comment.service.CommentService;
  16. import com.goafanti.common.bo.Result;
  17. import com.goafanti.common.constant.ErrorConstants;
  18. import com.goafanti.common.controller.BaseApiController;
  19. import com.goafanti.common.service.GlobalSearchService;
  20. import com.goafanti.common.utils.StringUtils;
  21. import com.goafanti.demand.service.DemandService;
  22. @RestController
  23. @RequestMapping(path = "/open/app/home")
  24. public class OpenAppHomeController extends BaseApiController{
  25. @Resource
  26. private JtBusinessService jtBusinessService;
  27. @Resource
  28. private CommentService commentService;
  29. @Resource
  30. private JtTagService jtTagService;
  31. @Resource
  32. private BannersService bannersService;
  33. @Resource
  34. private AchievementService achievementService;
  35. @Resource
  36. private DemandService demandService;
  37. @Resource
  38. private GlobalSearchService globalSearchService;
  39. /**技淘推荐*//*
  40. @RequestMapping(value = "/getHomeRecommended", method = RequestMethod.GET)
  41. public Result getHomeRecommended(Integer type){
  42. Result res = new Result();
  43. if (null==type||type>3||type<0) {
  44. res.getError().add(buildError( "类型错误", "类型错误"));
  45. return res;
  46. }
  47. res.setData(appHomePageService.getHomeRecommended(type));
  48. return res;
  49. }*/
  50. /**
  51. * 项目列表
  52. * @param topId
  53. * @param secondId
  54. * @param name
  55. * @param pageSize
  56. * @param pageNo
  57. * @param privateProject
  58. * @param auditStatus
  59. * @param module
  60. * @param isHot
  61. * @param orderType
  62. * @param orderSort
  63. * @param ownerId
  64. * @return
  65. */
  66. @RequestMapping(value="/projectList", method=RequestMethod.GET)
  67. public Result getProjectList(String tag,String topId,String secondId,String name,Integer pageSize,Integer pageNo,Integer privateProject,Integer auditStatus,Integer module,Integer isHot,Integer orderType,Integer orderSort,String ownerId) {
  68. Result result=new Result();
  69. result.setData(jtBusinessService.getProjects(tag,topId,secondId,name,pageSize,pageNo,privateProject,auditStatus,module,isHot,orderType,orderSort,ownerId));
  70. return result;
  71. }
  72. /**
  73. * 项目详情
  74. * @param id
  75. * @return
  76. */
  77. @RequestMapping(value="/projectDetail",method=RequestMethod.GET)
  78. public Result projectDetail(String id){
  79. Result result =new Result();
  80. if (StringUtils.isBlank(id)) {
  81. result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"商品ID","商品ID"));
  82. return result;
  83. }
  84. result.setData(jtBusinessService.getBusinessProjectDetail(id));
  85. return result;
  86. }
  87. /**
  88. * 项目评价
  89. * @param id
  90. * @return
  91. */
  92. @RequestMapping(value = "/projectComment", method = RequestMethod.GET)
  93. public Result listComment(String id,Integer pageNo,Integer pageSize) {
  94. Result result=new Result();
  95. if(StringUtils.isBlank(id)) {
  96. result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"商品ID","商品ID"));
  97. }
  98. CommentResult commentResult=new CommentResult();
  99. commentResult.setPositiveCommentCount(commentService.getCommentCount(0, id));
  100. commentResult.setOrdinaryCommentCount(commentService.getCommentCount(1, id));
  101. commentResult.setNegativeCommentCount(commentService.getCommentCount(2, id));
  102. commentResult.setComments(commentService.searchComment(id, pageNo, pageSize));
  103. result.setData(commentResult);
  104. return result;
  105. }
  106. /**
  107. * 赚钱更多分类
  108. * @return
  109. */
  110. @RequestMapping(value = "/categoryList" , method = RequestMethod.GET)
  111. public Result categoryList() {
  112. Result result=new Result();
  113. result.setData(jtBusinessService.makeMoneyCategoryList());
  114. return result;
  115. }
  116. /**
  117. * 知识产权更多分类
  118. * @return
  119. */
  120. @RequestMapping(value = "/getCategoryList" , method = RequestMethod.GET)
  121. public Result getCategoryList(Integer module) {
  122. Result result=new Result();
  123. result.setData(jtBusinessService.getCategoryBoList(module));
  124. return result;
  125. }
  126. /**
  127. * 赚钱首页推荐运用
  128. * @return
  129. */
  130. @RequestMapping(value = "/recommendedApplication" , method = RequestMethod.GET)
  131. public Result recommendedApplication(String apiUrl,Integer pageNo,Integer pageSize) {
  132. Result result=new Result();
  133. if (null==pageNo)pageNo=1;
  134. if (null==pageSize)pageSize=3;
  135. Map<String, Object> map=new HashMap<>();
  136. //1 赚钱数据 2首页数据
  137. map.put("recommended", jtBusinessService.recommendedApplication(null,pageNo,pageSize));
  138. map.put("tag", jtTagService.selectListJtTag(null, 1, 99));
  139. map.put("homeImg", bannersService.findBannersList( apiUrl,1, 1, 1));
  140. result.setData(map);
  141. return result;
  142. }
  143. /**
  144. * 首页数据
  145. * @return
  146. */
  147. @RequestMapping(value = "/getHomeData" , method = RequestMethod.GET)
  148. public Result getHomeData(String apiUrl,Integer pageNo,Integer pageSize) {
  149. Result result=new Result();
  150. if (null==pageNo)pageNo=1;
  151. if (null==pageSize)pageSize=3;
  152. Map<String, Object> map=new HashMap<>();
  153. //1 赚钱数据 2首页数据
  154. map.put("recommended", jtBusinessService.recommendedApplication(null,pageNo,pageSize));
  155. map.put("homeImg", bannersService.findBannersList( apiUrl,1, 3, 1));
  156. result.setData(map);
  157. return result;
  158. }
  159. /**
  160. * 交易首页
  161. * @return
  162. */
  163. @RequestMapping(value = "/getTransactionData" , method = RequestMethod.GET)
  164. public Result getTransactionData(String apiUrl,Integer pageNo,Integer pageSize,HttpServletRequest request) {
  165. Result result=new Result();
  166. if (null==pageNo)pageNo=1;
  167. if (null==pageSize)pageSize=3;
  168. Map<String, Object> map=new HashMap<>();
  169. String url = com.goafanti.common.utils.StringUtils.getDomainByHttpRequest(request);
  170. map.put("homeImg", bannersService.findBannersList( apiUrl,1, 1, 1));
  171. // map.put("achievement", achievementService.getHotAchievements(3, url,"app_achievement_trading_index"));
  172. // map.put("demand", demandService.getHotDemand(3, url, "app_demand_trading_index",0));
  173. map.put("achievement", achievementService.getHotAchievements(3, url,"web_index"));
  174. map.put("demand", demandService.getHotDemand(3, url, "web_index",0));
  175. result.setData(map);
  176. return result;
  177. }
  178. /**
  179. * 全局搜索
  180. */
  181. @RequestMapping(value = "/AchievementsDemandSearch", method = RequestMethod.GET)
  182. @ResponseBody
  183. public Result AchievementsDemandSearch(String name,Integer pageSize,Integer pageNo) {
  184. Result res = new Result();
  185. res.setData(globalSearchService.AchievementsDemandSearchList(name,pageNo,pageSize));
  186. return res;
  187. }
  188. }