Parcourir la source

PC网页顾问列表、详情接口开发

anderx il y a 7 ans
Parent
commit
42dfc9c924

+ 1 - 1
src/main/java/com/goafanti/app/controller/OpenAppDiscoveryController.java

@@ -116,7 +116,7 @@ public class OpenAppDiscoveryController extends BaseApiController {
 	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.appConsultantList( name, sortType,  consultantType,  province, city,
+		res.setData(userIdentityService.consultantList( name, sortType,  consultantType,  province, city,
 				  area,  pageNo,  pageSize));
 		return res;
 	}

+ 4 - 4
src/main/java/com/goafanti/app/controller/OpenAppUserController.java

@@ -88,10 +88,10 @@ public class OpenAppUserController extends BaseApiController {
 	public Result expertsDetail(String id ) {
 		Result res = new Result();
 		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"专家必须指定","专家"));
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"id必须指定","id"));
 			return res;
 		}
-		res.setData(userIdentityService.selectAppExpertsDetail( id));
+		res.setData(userIdentityService.selectExpertsDetail( id));
 		return res;
 	}
 	
@@ -102,11 +102,11 @@ public class OpenAppUserController extends BaseApiController {
 	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,"专家必须指定","专家"));
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"id必须指定","id"));
 			return res;
 		}
 		CommentResult commentResult=new CommentResult();
-		ExpertsListBo e=userIdentityService.selectAppExpertsDetail( id);
+		ExpertsListBo e=userIdentityService.selectExpertsDetail( id);
 		commentResult.setNegativeCommentCount(e.getInferior());
 		commentResult.setOrdinaryCommentCount(e.getGeneral());
 		commentResult.setPositiveCommentCount(e.getFavorable());

+ 78 - 0
src/main/java/com/goafanti/user/controller/UserIdentityApiController.java

@@ -0,0 +1,78 @@
+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 = "/open/api/user/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;
+	}
+
+
+}

+ 2 - 2
src/main/java/com/goafanti/user/service/UserIdentityService.java

@@ -82,9 +82,9 @@ public interface UserIdentityService {
 
 	Pagination<ExpertsListBo> appExpertsList(String name, String industry, Integer sortType,Integer pageNo, Integer pageSize);
 
-	ExpertsListBo selectAppExpertsDetail(String id);
+	ExpertsListBo selectExpertsDetail(String id);
 
-	Pagination<ExpertsListBo> appConsultantList(String name, Integer sortType, Integer consultantType, Integer province, Integer city,
+	Pagination<ExpertsListBo> consultantList(String name, Integer sortType, Integer consultantType, Integer province, Integer city,
 			Integer area, Integer pageNo, Integer pageSize);
 	/**
 	 * 更改用户认证(顾问/专家)审核状态

+ 2 - 2
src/main/java/com/goafanti/user/service/impl/UserIdentityServiceImpl.java

@@ -551,7 +551,7 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 	}
 
 	@Override
-	public ExpertsListBo selectAppExpertsDetail(String id) {
+	public ExpertsListBo selectExpertsDetail(String id) {
 		ExpertsListBo expertsListBo=userIdentityMapper.selectAppExpertsDetail(id,TokenManager.getUserId());
 		expertsListBo.setCommentDetailResult(userIdentityMapper.expertsCommentByUid(id));
 		return expertsListBo;
@@ -559,7 +559,7 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<ExpertsListBo> appConsultantList(String name, Integer sortType, Integer consultantType,
+	public Pagination<ExpertsListBo> consultantList(String name, Integer sortType, Integer consultantType,
 			Integer province, Integer city, Integer area, Integer pageNo, Integer pageSize) {
 		if(pageNo==null || pageNo<1)pageNo=1;
 		if(pageSize==null ||pageSize<1)pageSize=10;