package com.goafanti.user.controller; import javax.annotation.Resource; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.goafanti.app.bo.ExpertsListBo; import com.goafanti.comment.bo.CommentResult; import com.goafanti.comment.service.CommentService; import com.goafanti.common.bo.Result; import com.goafanti.common.constant.ErrorConstants; import com.goafanti.common.controller.CertifyApiController; import com.goafanti.common.enums.UserType; import com.goafanti.common.model.UserInterest; import com.goafanti.core.shiro.token.TokenManager; import com.goafanti.user.service.UserIdentityService; import com.goafanti.user.service.UserInterestService; @RestController @RequestMapping(value = "/api/portal/identity") public class UserIdentityApiController extends CertifyApiController { @Resource private UserIdentityService userIdentityService; @Resource private CommentService commentService; /** * 顾问列表 */ @RequestMapping(value = "/consultantList", method = RequestMethod.GET) public Result consultantList(String name,Integer sortType, Integer consultantType, Integer province,Integer city, Integer area, Integer pageNo, Integer pageSize) { Result res = new Result(); res.setData(userIdentityService.consultantList( name, sortType, consultantType, province, city, area, pageNo, pageSize)); return res; } /** * 顾问详情 * @param id * @return */ @RequestMapping(value = "/consultantDetail", method = RequestMethod.GET) public Result consultantDetail(String id ) { Result res = new Result(); if (StringUtils.isBlank(id)) { res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"顾问必须指定","顾问")); return res; } res.setData(userIdentityService.selectExpertsDetail( id)); return res; } /** * 顾问评价 */ @RequestMapping(value = "/expertsComment", method = RequestMethod.GET) public Result expertsComment(String id ,Integer pageNo,Integer pageSize) { Result res = new Result(); if (StringUtils.isBlank(id)) { res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"顾问必须指定","顾问")); return res; } CommentResult commentResult=new CommentResult(); ExpertsListBo e=userIdentityService.selectExpertsDetail( id); commentResult.setNegativeCommentCount(e.getInferior()); commentResult.setOrdinaryCommentCount(e.getGeneral()); commentResult.setPositiveCommentCount(e.getFavorable()); commentResult.setTotalCommentCount(e.getCommentCount()); commentResult.setComments(commentService.selectExpertsComment(id, pageNo, pageSize)); res.setData(commentResult); return res; } }