瀏覽代碼

APP顾问模块开发

anderx 7 年之前
父節點
當前提交
e9974201b7

+ 7 - 0
src/main/java/com/goafanti/app/bo/ExpertsListBo.java

@@ -19,6 +19,7 @@ public class ExpertsListBo {
 	private Integer commentCount;
 	private String favorableRate;
 	private  CommentDetailResult	commentDetailResult;
+	private Integer consultantType;
 	public String getUid() {
 		return uid;
 	}
@@ -115,6 +116,12 @@ public class ExpertsListBo {
 	public void setCommentDetailResult(CommentDetailResult commentDetailResult) {
 		this.commentDetailResult = commentDetailResult;
 	}
+	public Integer getConsultantType() {
+		return consultantType;
+	}
+	public void setConsultantType(Integer consultantType) {
+		this.consultantType = consultantType;
+	}
 	
 
 }

+ 3 - 2
src/main/java/com/goafanti/app/controller/AppOrderController.java

@@ -26,7 +26,7 @@ import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 
 @RestController
-@RequestMapping(value = "/open/order")
+@RequestMapping(value = "/app/order")
 public class AppOrderController extends CertifyApiController{
 	
 	@Resource
@@ -302,7 +302,8 @@ public class AppOrderController extends CertifyApiController{
 		if(StringUtils.isBlank(commentInput.getContent()) || commentInput.getContent().length()>512) {
 			result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","内容限制1-512字符"));return result;
 		}
-		int res=commentService.addNewComment(commentInput,ip);
+		
+			int res=commentService.addNewComment(commentInput,ip);
 		if(res ==-1) {
 			result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","提交失败"));return result;
 		}

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

@@ -602,7 +602,8 @@ public class AppUserController extends CertifyApiController {
 			result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","用户类型错误"));
 			return result;
 		}
-		result.setData(jtOrderService.appSearchOrderList(orderType, userType, pageNo, pageSize)); 
+		result.setData(jtOrderService.appSearchOrderList(orderType, userType, pageNo, pageSize));
+		
 		return result;
 	}
 	

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

@@ -109,6 +109,17 @@ public class OpenAppDiscoveryController extends BaseApiController {
 		res.setData(userIdentityService.appExpertsList(name,industry,sortType,pageNo,pageSize));
 		return res;
 	}
+	/**
+	 * 顾问列表
+	 */
+	@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.appConsultantList( name, sortType,  consultantType,  province, city,
+				  area,  pageNo,  pageSize));
+		return res;
+	}
 	
 	/**
 	 * 发现页面广告

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

@@ -76,6 +76,20 @@ public class OpenAppUserController extends BaseApiController {
 		return res;
 	}
 	
+	/**
+	 * 专家详情
+	 */
+	@RequestMapping(value = "/expertsDetail", method = RequestMethod.GET)
+	public Result expertsDetail(String id ) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"专家必须指定","专家"));
+			return res;
+		}
+		res.setData(userIdentityService.selectAppExpertsDetail( id));
+		return res;
+	}
+	
 	@RequestMapping(value = "/index", method = RequestMethod.GET)
 	public Result index(){
 		Result res = new Result();

+ 4 - 4
src/main/java/com/goafanti/comment/bo/CommentInput.java

@@ -1,10 +1,10 @@
 package com.goafanti.comment.bo;
 
 public class CommentInput {
-String commodityId;
-String content;
-Integer star;
-String orderNo;
+	private String commodityId;
+private String content;
+private Integer star;
+private String orderNo;
 public String getCommodityId() {
 	return commodityId;
 }

+ 3 - 3
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -668,17 +668,17 @@ public class PublicController extends BaseController {
 			return res;
 		}
 
-		if (!UserType.ORGANIZATION.getCode().equals(type) && !UserType.PERSONAL.getCode().equals(type)) {
+		/*if (!UserType.ORGANIZATION.getCode().equals(type) && !UserType.PERSONAL.getCode().equals(type)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "type"));
 			return res;
-		}
+		}*/
 
 		User user = userService.selectByNameAndType(username, null);
 		if (null == user) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户"));
 			return res;
 		}
-		if (null!=user.getMobile()&&user.getMobile()!=mobile) {
+		if (null!=user.getMobile()&&!user.getMobile().equals(mobile)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "手机号码"));
 			return res;
 		}

+ 3 - 0
src/main/java/com/goafanti/common/dao/UserIdentityMapper.java

@@ -1,5 +1,6 @@
 package com.goafanti.common.dao;
 
+import com.goafanti.app.bo.ExpertsListBo;
 import com.goafanti.app.bo.consultantListBo;
 import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.model.UserIdentityExample;
@@ -105,5 +106,7 @@ public interface UserIdentityMapper {
 	List<consultantListBo> getConsultantList(Integer size);
 	
 	List<UserIdentityBo>getExperts(Integer size);
+
+	ExpertsListBo selectAppExpertsDetail(@Param("id")String id, @Param("uid")String uid);
     
 }

+ 114 - 0
src/main/java/com/goafanti/common/mapper/JtOrderMapper.xml

@@ -513,5 +513,119 @@ count(0)
   <if test="orderType!=null ">
   and (jtod.commodity_type=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (jtod.commodity_type=1 or jtod.commodity_type=0)))
   </if>
+  order by x.createTime desc
+  	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  <select id="appSearchJtOrderList" resultType="com.goafanti.order.bo.JtOrderResultDetail">
+   select x.* from 
+  (select jto.order_no as orderNo,
+ jtod.commodity_type as commodityType,
+  jto.order_time as createTime,
+  jto.order_amount as orderAmount,
+  jtod.commodity_quantity as commodityQuantity, 
+  jtod.commodity_name as commodityName,
+  jto.seller_id as sellerId,
+  jto.buyer_id as buyerId,
+  seller.identify_name as sellerName,
+  buyer.identify_name as buyerName,
+  seller.mobile as sellerMobile,
+  jtod.commodity_id as commodityId,
+  buyer.mobile as buyerMobile from jt_order jto
+  left join jt_order_detail jtod on jtod.order_no=jto.order_no
+  left join user seller on seller.id = jto.seller_id
+  left join user buyer on  buyer.id=jto.buyer_id 
+  where 1=1 
+  <if test="sellerId!=null">
+  and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
+  </if>
+  <if test="buyerId!=null">
+  and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
+  </if>
+  UNION all
+  select jco.order_no as orderNo ,
+  (case when jco.consult_type = 0 then 6 when jco.consult_type = 1 then 5 end) as commodityType,
+ 	jco.order_time as createTime,
+  jco.order_amount as orderAmount,
+  1 as commodityQuantity, 
+  (case when jco.consult_type = 0 then '专家咨询' when jco.consult_type = 1 then '顾问咨询' end) as commodityName,
+  jco.seller_id as sellerId,
+  jco.buyer_id as buyerId,
+  seller.identify_name as sellerName,
+  buyer.identify_name as buyerName,
+  seller.mobile as sellerMobile,
+  jco.seller_id as commodityId,
+  buyer.mobile as buyerMobile 
+  from jt_consult_order jco
+  left join user seller on seller.id = jco.seller_id
+  left join user buyer on  buyer.id=jco.buyer_id
+  where 1=1
+  <if test="sellerId!=null">
+  and jco.seller_id=#{sellerId,jdbcType=VARCHAR}
+  </if>
+  <if test="buyerId!=null">
+  and jco.buyer_id=#{buyerId,jdbcType=VARCHAR}
+  </if>
+   ) x 
+  where 1=1
+  <if test="orderType!=null ">
+  and (x.commodityType=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (x.commodityType=1 or x.commodityType=0)))
+  </if>
+  </select>
+  <select id="appSearchJtOrderListCount" resultType="java.lang.Integer">
+  select count(x.commodityType) from 
+  (select jto.order_no as orderNo,
+ jtod.commodity_type as commodityType,
+  jto.order_time as createTime,
+  jto.order_amount as orderAmount,
+  jtod.commodity_quantity as commodityQuantity, 
+  jtod.commodity_name as commodityName,
+  jto.seller_id as sellerId,
+  jto.buyer_id as buyerId,
+  seller.identify_name as sellerName,
+  buyer.identify_name as buyerName,
+  seller.mobile as sellerMobile,
+  jtod.commodity_id as commodityId,
+  buyer.mobile as buyerMobile from jt_order jto
+  left join jt_order_detail jtod on jtod.order_no=jto.order_no
+  left join user seller on seller.id = jto.seller_id
+  left join user buyer on  buyer.id=jto.buyer_id 
+  where 1=1 
+   <if test="sellerId!=null">
+  and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
+  </if>
+  <if test="buyerId!=null">
+  and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
+  </if>
+  UNION all
+  select jco.order_no as orderNo ,
+  (case when jco.consult_type = 0 then 6 when jco.consult_type = 1 then 5 end) as commodityType,
+ 	jco.order_time as createTime,
+  jco.order_amount as orderAmount,
+  1 as commodityQuantity, 
+  (case when jco.consult_type = 0 then '专家咨询' when jco.consult_type = 1 then '顾问咨询' end) as commodityName,
+  jco.seller_id as sellerId,
+  jco.buyer_id as buyerId,
+  seller.identify_name as sellerName,
+  buyer.identify_name as buyerName,
+  seller.mobile as sellerMobile,
+  jco.seller_id as commodityId,
+  buyer.mobile as buyerMobile 
+  from jt_consult_order jco
+  left join user seller on seller.id = jco.seller_id
+  left join user buyer on  buyer.id=jco.buyer_id
+  where 1=1
+  <if test="sellerId!=null">
+  and jco.seller_id=#{sellerId,jdbcType=VARCHAR}
+  </if>
+  <if test="buyerId!=null">
+  and jco.buyer_id=#{buyerId,jdbcType=VARCHAR}
+  </if>
+   ) x 
+  where 1=1
+   <if test="orderType!=null ">
+  and (x.commodityType=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (x.commodityType=1 or x.commodityType=0)))
+  </if>
   </select>
 </mapper>

+ 87 - 3
src/main/java/com/goafanti/common/mapper/UserIdentityMapper.xml

@@ -1219,14 +1219,14 @@ from
 		b.seller_id as uid, sum( case when a.star &gt; 3 then 1 else 0 end ) as a,
 		sum( case when a.star = 3 then 1 else 0 end ) as b,
 		sum( case when a.star &lt; 3 then 1 else 0 end ) as c, count(*) as d
-		from jt_commodity_comment a left join jt_order b on
+		from jt_commodity_comment a left join jt_consult_order b on
 		a.order_no = b.order_no group by b.seller_id
 		) x on u.id = x.uid 
 	left join( select count(*) as count, to_uid from user_interest group by to_uid) a 
 	on u.id = a.to_uid left join( select to_uid from user_interest where from_uid =#{uid,jdbcType=VARCHAR} ) b
 	on u.id = b.to_uid 
 	where u.status = 0 and u.source = 1 
-	and ui.expert = 1
+	and ui.expert = 1 and ui.expert_audit=2
 	<if test="industry != null">
 	 and ui.industry= #{industry,jdbcType=VARCHAR}
 	</if>
@@ -1246,7 +1246,7 @@ from
   <select id="selectCustomerAuditCount" resultType="java.lang.Integer">
 	 	select count(0)from
 	`user` u left join user_identity ui on ui.uid = u.id 
-	  where u.status = 0 and u.source = 1 and ui.expert = 1
+	  where u.status = 0 and u.source = 1 and ui.expert = 1 and ui.expert_audit=2
 	  <if test="industry != null">
 		and ui.industry= #{industry,jdbcType=VARCHAR}
 	</if>
@@ -1254,4 +1254,88 @@ from
 	and u.nickname like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
 	</if>
 </select>
+<select id="selectAppExpertsDetail" resultType="com.goafanti.app.bo.ExpertsListBo">
+select a.id as uid,a.nickname as username,a.head_portrait_url as personPortraitUrl,b.consultant_type as consultantType,
+		b.industry,b.work_unit as workUnit,b.professional_title as professionalTitle,a.introduction,
+		ifnull(c.count,0) as countInterest,b.expert,ifnull(x.a,0) as favorable,ifnull(x.b,0) as general,
+		ifnull(x.c,0) as inferior,ifnull(x.d,0) as commentCount,ifnull( cast(x.a*100 / x.d as decimal(18, 2)), 100 ) as favorableRate,
+		if(isnull(d.to_uid),0,1) as interested
+		from `user` a left join user_identity b on a.id=b.uid left join (select b.seller_id as uid,
+			sum(case when a.star &gt; 3 then 1 else 0 end) as a,
+			sum(case when a.star=3 then 1 else 0 end) as b,
+			sum(case when a.star &lt; 3 then 1 else 0 end) as c,count(*) as d
+			from jt_commodity_comment a 
+			left join jt_consult_order b on a.order_no=b.order_no
+			group by b.seller_id)x on a.id=x.uid
+		left join (select count(*) as count,to_uid from  user_interest group by to_uid)c on a.id=c.to_uid
+left join (select to_uid from  user_interest where from_uid='1')d on a.id=d.to_uid
+where a.id=#{id,jdbcType=VARCHAR}
+</select>
+<select id="appConsultantList" resultType="com.goafanti.app.bo.ExpertsListBo">
+	select u.id as uid, u.nickname as username, u.head_portrait_url as personPortraitUrl,ui.consultant_type as consultantType,
+	u.introduction, ui.industry, ui.work_unit as workUnit, ui.professional_title as professionalTitle,
+	ifnull( a.count, 0 ) as countInterest, if( isnull(b.to_uid), 0, 1 ) as interested,ui.expert,
+	ifnull( x.a, 0 ) as favorable, ifnull( x.b, 0 ) as general, ifnull( x.c, 0 ) as inferior,
+	ifnull( x.d, 0 ) as commentCount, ifnull( cast(x.a*100 / x.d as decimal(18, 2)), 100 ) as favorableRate
+from
+	`user` u left join user_identity ui on ui.uid = u.id 
+	left join(select b.seller_id as uid,
+			sum(case when a.star &gt; 3 then 1 else 0 end) as a,
+			sum(case when a.star=3 then 1 else 0 end) as b,
+			sum(case when a.star &lt; 3 then 1 else 0 end) as c,count(*) as d
+			from jt_commodity_comment a 
+			left join jt_consult_order b on a.order_no=b.order_no
+			group by b.seller_id)x on u.id=x.uid
+	left join( select count(*) as count, to_uid from user_interest group by to_uid) a 
+	on u.id = a.to_uid left join( select to_uid from user_interest where from_uid ='1' ) b
+	on u.id = b.to_uid 
+	where u.status = 0 and u.source = 1 
+	and ui.expert = 2 and ui.expert_audit=2
+	<if test="consultantType != null">
+	and ui.consultant_type=#{consultantType,jdbcType=INTEGER}
+	</if>
+	<if test="province != null">
+	and ui.province= #{consultantType,jdbcType=INTEGER}
+	</if>
+	<if test="city != null">
+	and ui.city=#{consultantType,jdbcType=INTEGER}
+	</if>
+	<if test="area != null">
+	and ui.area=#{consultantType,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+	and u.nickname like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
+	</if>
+	<if test="sortType == 0">
+	order by u.create_time desc
+	</if> 
+	<if test="sortType == 1">
+	order by favorableRate desc
+	</if>
+	<if test="page_sql!=null">
+        ${page_sql}
+    </if>
+</select>
+<select id="appConsultantCount" resultType="java.lang.Integer">
+	select count(*)
+from
+	`user` u left join user_identity ui on ui.uid = u.id 
+	where u.status = 0 and u.source = 1 
+	and ui.expert = 2 and ui.expert_audit=2
+	<if test="consultantType != null">
+	and ui.consultant_type=#{consultantType,jdbcType=INTEGER}
+	</if>
+	<if test="province != null">
+	and ui.province= #{consultantType,jdbcType=INTEGER}
+	</if>
+	<if test="city != null">
+	and ui.city=#{consultantType,jdbcType=INTEGER}
+	</if>
+	<if test="area != null">
+	and ui.area=#{consultantType,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+	and u.nickname like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
+	</if>
+</select>
 </mapper>

+ 0 - 1
src/main/java/com/goafanti/order/service/JtOrderService.java

@@ -13,5 +13,4 @@ public interface JtOrderService {
 	Pagination<JtOrderResultDetail>searchOrderList(Integer orderType,String orderNo,String startCreateDate,String endCreateDate,String sellerName,String buyerName,String commodityName,Integer userType,Integer pageNo,Integer pageSize);
 
 	Pagination<JtOrderResultDetail> appSearchOrderList(Integer orderType, Integer userType, Integer pageNo, Integer pageSize);
-
 }

+ 4 - 1
src/main/java/com/goafanti/order/service/impl/JtOrderServiceImpl.java

@@ -207,7 +207,7 @@ public class JtOrderServiceImpl extends BaseMybatisDao<JtOrderMapper> implements
 			params.put("sellerId", TokenManager.getUserId());
 		}
 		if(orderType!=null && ((orderType>=0 && orderType<=6)|| orderType==10))params.put("orderType", orderType);
-		Pagination<JtOrderResultDetail>p = (Pagination<JtOrderResultDetail>) findPage("searchJtOrderList", "searchJtOrderListCount", params, pageNo, pageSize);
+		Pagination<JtOrderResultDetail>p = (Pagination<JtOrderResultDetail>) findPage("appSearchJtOrderList", "appSearchJtOrderListCount", params, pageNo, pageSize);
 		List<JtOrderResultDetail> l=(List<JtOrderResultDetail>) p.getList();
 				for (JtOrderResultDetail j : l) {
 					if (null!=j.getCommodityType()) {
@@ -225,6 +225,9 @@ public class JtOrderServiceImpl extends BaseMybatisDao<JtOrderMapper> implements
 				}
 		return p;
 	}
+
+
+
 	
 
 }

+ 1 - 0
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -144,6 +144,7 @@ public class UserRegisterController extends BaseController {
 			us.setUpdateTime(now.getTime());
 			us.setPassword(passwordUtil.getEncryptPwd(us));
 			us.setLvl(0);
+			us.setType(0);
 			us.setNickname(user.getUsername());
 			us.setSource(AFTConstants.USER_SOURCE_REGISTER);
 			us.setStatus(AFTConstants.USER_STATUS_NORMAL);

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

@@ -1,6 +1,8 @@
 package com.goafanti.user.service;
 
 import java.util.List;
+
+import com.goafanti.app.bo.ExpertsListBo;
 import com.goafanti.app.bo.consultantListBo;
 import com.goafanti.common.bo.ReletivelyIndustry;
 import com.goafanti.common.bo.Result;
@@ -73,6 +75,11 @@ public interface UserIdentityService {
 
 	Pagination<CustomerAuditListBo> selectCustomerAuditList(String name, String type, String identity, Integer pageNo, Integer pageSize);
 
-	Pagination<UserIdentityBo> appExpertsList(String name, String industry, Integer sortType,Integer pageNo, Integer pageSize);
+	Pagination<ExpertsListBo> appExpertsList(String name, String industry, Integer sortType,Integer pageNo, Integer pageSize);
+
+	ExpertsListBo selectAppExpertsDetail(String id);
+
+	Pagination<ExpertsListBo> appConsultantList(String name, Integer sortType, Integer consultantType, Integer province, Integer city,
+			Integer area, Integer pageNo, Integer pageSize);
 
 }

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

@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.stereotype.Service;
 
+import com.goafanti.app.bo.ExpertsListBo;
 import com.goafanti.app.bo.consultantListBo;
 import com.goafanti.common.bo.ReletivelyIndustry;
 import com.goafanti.common.bo.Result;
@@ -510,15 +511,37 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<UserIdentityBo> appExpertsList(String name, String industry,Integer sortType, Integer pageNo, Integer pageSize) {
+	public Pagination<ExpertsListBo> appExpertsList(String name, String industry,Integer sortType, Integer pageNo, Integer pageSize) {
 		if(pageNo==null || pageNo<1)pageNo=1;
 		if(pageSize==null ||pageSize<1)pageSize=10; 
 		 Map<String, Object> params=new HashMap<String,Object>();
 		 if(StringUtils.isNotBlank(name))params.put("name", name);
-		 if(StringUtils.isNotBlank(industry))params.put("industry", name);
+		 if(StringUtils.isNotBlank(industry))params.put("industry", industry);
 		 if(null!=sortType)params.put("sortType", sortType);
 		 if(StringUtils.isNotBlank(TokenManager.getUserId()))params.put("uid", TokenManager.getUserId());
-		 return (Pagination<UserIdentityBo>) findPage("selectCustomerAuditList", "selectCustomerAuditCount", params, pageNo, pageSize);
+		 return (Pagination<ExpertsListBo>) findPage("selectCustomerAuditList", "selectCustomerAuditCount", params, pageNo, pageSize);
+	}
+
+	@Override
+	public ExpertsListBo selectAppExpertsDetail(String id) {
+		return userIdentityMapper.selectAppExpertsDetail(id,TokenManager.getUserId());
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<ExpertsListBo> appConsultantList(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; 
+		 Map<String, Object> params=new HashMap<String,Object>();
+		 if(StringUtils.isNotBlank(name))params.put("name", name);
+		 if(null!=province)params.put("province", province);
+		 if(null!=city)params.put("city", city);
+		 if(null!=area)params.put("area", area);
+		 if(null!=consultantType)params.put("consultantType", consultantType);
+		 if(null!=sortType)params.put("sortType", sortType);
+		 if(StringUtils.isNotBlank(TokenManager.getUserId()))params.put("uid", TokenManager.getUserId());
+		 return (Pagination<ExpertsListBo>) findPage("appConsultantList", "appConsultantCount", params, pageNo, pageSize);
 	}