UserIdentityApiController.java 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.goafanti.user.controller;
  2. import javax.annotation.Resource;
  3. import org.apache.commons.lang3.StringUtils;
  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.app.bo.ExpertsListBo;
  8. import com.goafanti.comment.bo.CommentResult;
  9. import com.goafanti.comment.service.CommentService;
  10. import com.goafanti.common.bo.Result;
  11. import com.goafanti.common.constant.ErrorConstants;
  12. import com.goafanti.common.controller.CertifyApiController;
  13. import com.goafanti.common.enums.UserType;
  14. import com.goafanti.common.model.UserInterest;
  15. import com.goafanti.core.shiro.token.TokenManager;
  16. import com.goafanti.user.service.UserIdentityService;
  17. import com.goafanti.user.service.UserInterestService;
  18. @RestController
  19. @RequestMapping(value = "/api/portal/identity")
  20. public class UserIdentityApiController extends CertifyApiController {
  21. @Resource
  22. private UserIdentityService userIdentityService;
  23. @Resource
  24. private CommentService commentService;
  25. /**
  26. * 顾问列表
  27. */
  28. @RequestMapping(value = "/consultantList", method = RequestMethod.GET)
  29. public Result consultantList(String name,Integer sortType, Integer consultantType, Integer province,Integer city,
  30. Integer area, Integer pageNo, Integer pageSize) {
  31. Result res = new Result();
  32. res.setData(userIdentityService.consultantList( name, sortType, consultantType, province, city,
  33. area, pageNo, pageSize));
  34. return res;
  35. }
  36. /**
  37. * 顾问详情
  38. * @param id
  39. * @return
  40. */
  41. @RequestMapping(value = "/consultantDetail", method = RequestMethod.GET)
  42. public Result consultantDetail(String id ) {
  43. Result res = new Result();
  44. if (StringUtils.isBlank(id)) {
  45. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"顾问必须指定","顾问"));
  46. return res;
  47. }
  48. res.setData(userIdentityService.selectExpertsDetail( id));
  49. return res;
  50. }
  51. /**
  52. * 顾问评价
  53. */
  54. @RequestMapping(value = "/expertsComment", method = RequestMethod.GET)
  55. public Result expertsComment(String id ,Integer pageNo,Integer pageSize) {
  56. Result res = new Result();
  57. if (StringUtils.isBlank(id)) {
  58. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"顾问必须指定","顾问"));
  59. return res;
  60. }
  61. CommentResult commentResult=new CommentResult();
  62. ExpertsListBo e=userIdentityService.selectExpertsDetail( id);
  63. commentResult.setNegativeCommentCount(e.getInferior());
  64. commentResult.setOrdinaryCommentCount(e.getGeneral());
  65. commentResult.setPositiveCommentCount(e.getFavorable());
  66. commentResult.setTotalCommentCount(e.getCommentCount());
  67. commentResult.setComments(commentService.selectExpertsComment(id, pageNo, pageSize));
  68. res.setData(commentResult);
  69. return res;
  70. }
  71. }