Browse Source

解决冲突

limin 7 years ago
parent
commit
9a50bf4b4e

+ 131 - 0
src/main/java/com/goafanti/common/mapper/UserIdentityMapper.xml

@@ -1209,6 +1209,137 @@ order by
 		left join user_interest ui on ui.to_uid=u.id
 		where t.expert=1 and ui.from_uid=#{uid,jdbcType=VARCHAR}
 </select>
+<select id="selectCustomerAuditList" resultType="com.goafanti.app.bo.ExpertsListBo">
+	select u.id as uid, u.nickname as username, u.head_portrait_url as personPortraitUrl,
+	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 =#{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_audit=2
+	<if test="industry != null">
+	 and ui.industry= #{industry,jdbcType=VARCHAR}
+	</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="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 and ui.expert_audit=2
+	  <if test="industry != null">
+		and ui.industry= #{industry,jdbcType=VARCHAR}
+	</if>
+	<if test="name != null">
+	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>
 
 <!-- 获得专家顾问审核列表数据  -->
 <select id="getExpertAuditList" resultMap="BaseResultMap">

+ 10 - 0
src/main/java/com/goafanti/demand/bo/DemandListBo.java

@@ -30,6 +30,8 @@ public class DemandListBo extends InputDemand{
 	private BigDecimal fundForCrowd;
 	private String firstPic;
 
+	private Integer interested;
+	
 	public String getFirstPic() {
 		return firstPic;
 	}
@@ -149,6 +151,14 @@ public class DemandListBo extends InputDemand{
 			setFirstPic(pictureUrl.split(",")[0]);
 		}
 	}
+
+	public Integer getInterested() {
+		return interested;
+	}
+
+	public void setInterested(Integer interested) {
+		this.interested = interested;
+	}
 	
 
 	

+ 11 - 0
src/main/java/com/goafanti/user/bo/InputUserIdentity.java

@@ -137,6 +137,17 @@ public class InputUserIdentity {
 	@Max(value = 3, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	private Integer consultantType;
 	
+	@Size(min = 0, max = 128, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String consultantCertificateUrl;
+	
+	public String getConsultantCertificateUrl() {
+		return consultantCertificateUrl;
+	}
+
+	public void setConsultantCertificateUrl(String consultantCertificateUrl) {
+		this.consultantCertificateUrl = consultantCertificateUrl;
+	}
+	
 	public Integer getConsultantType() {
 		return consultantType;
 	}

+ 33 - 4
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.alibaba.druid.sql.parser.Token;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
@@ -480,16 +481,22 @@ public class UserApiController extends BaseApiController {
 //			userIdentity.setType(UserType.PERSONAL.getCode());
 			userIdentity.setAuthentication(UserAuthentication.AUTHENTICATION.getCode());
 		}
-		if (res.getError().isEmpty()) {
+	 if (res.getError().isEmpty()) {
 			UserIdentity ui = new UserIdentity();
 			User user = new User();
-			userIdentity.setExpert(1);//直接变为专家
 			BeanUtils.copyProperties(userIdentity, ui);
 			BeanUtils.copyProperties(userIdentity, user);
-			ui.setExpertAudit(2);//直接审核通过
 			UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
-			if (null == u) {
+			if (null == u&&userIdentity.getAuthenticationType()==0) {
+				ui.setId(UUID.randomUUID().toString());
+				ui.setExpert(1);//直接变为专家
+				ui.setExpertAudit(1);//提交审核
+				ui.setUid(TokenManager.getUserId());
+				userIdentityService.insert(ui);
+			}else if (null == u&&userIdentity.getAuthenticationType()==1) {
 				ui.setId(UUID.randomUUID().toString());
+				ui.setExpert(2);//直接变为专家
+				ui.setExpertAudit(1);//提交审核
 				ui.setUid(TokenManager.getUserId());
 				userIdentityService.insert(ui);
 			} else {
@@ -498,6 +505,7 @@ public class UserApiController extends BaseApiController {
 			}
 			user.setId(TokenManager.getUserId());
 			userService.updateByPrimaryKeySelective(user);
+			
 		}
 		res.setData(userIdentity);
 		return res;
@@ -923,4 +931,25 @@ public class UserApiController extends BaseApiController {
 		res.setData(userIdentityService.getUserIdentityByUid(uid));
 		return res;
 	}
+	
+	/**
+	 *	顾问专家审核列表 
+	 * @return
+	 */
+	@RequestMapping(value = "/customerAuditList", method = RequestMethod.GET)
+	public Result customerAuditList(String name,String type,String identity, Integer pageNo,Integer pageSize) {
+		Result res = new Result();
+		res.setData(userIdentityService.selectCustomerAuditList(name,type,identity,pageNo,pageSize));
+		return res;
+	}
+	/**
+	 *	顾问专家审核 
+	 * @return
+	 */
+	@RequestMapping(value = "/customerAudit", method = RequestMethod.GET)
+	public Result customerAudit(String id) {
+		Result res = new Result();
+		//res.setData(userIdentityService.selectCustomerAuditList(name,type,identity,pageNo,pageSize));
+		return res;
+	}
 }

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

@@ -11,6 +11,7 @@ import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.portal.bo.UserSubscriberListBo;
 import com.goafanti.user.bo.Advertisings;
 import com.goafanti.user.bo.AuditorUserIdentityDetailBo;
+import com.goafanti.user.bo.CustomerAuditListBo;
 import com.goafanti.user.bo.InputUserIdentity;
 import com.goafanti.user.bo.MyInterestedBo;
 import com.goafanti.user.bo.UserIdentityBo;
@@ -75,5 +76,14 @@ public interface UserIdentityService {
 	Pagination<MyInterestedBo> getExpertAuditList(InputUserIdentity identity,Integer pageNo, Integer pageSize);
 	
 	UserIdentity getUserIdentityByUid(String uid);
+	
+	Pagination<CustomerAuditListBo> selectCustomerAuditList(String name, String type, String identity, 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);
 
 }

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

@@ -15,10 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.stereotype.Service;
 
-
-
-
-
 import com.goafanti.app.bo.consultantListBo;
 import com.goafanti.common.bo.ReletivelyIndustry;
 import com.goafanti.common.bo.Result;
@@ -46,6 +42,7 @@ import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.portal.bo.UserSubscriberListBo;
 import com.goafanti.user.bo.Advertisings;
 import com.goafanti.user.bo.AuditorUserIdentityDetailBo;
+import com.goafanti.user.bo.CustomerAuditListBo;
 import com.goafanti.user.bo.InputUserIdentity;
 import com.goafanti.user.bo.MyInterestedBo;
 import com.goafanti.user.bo.UserIdentityBo;
@@ -522,5 +519,54 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 		return u;
 	}
 	
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<CustomerAuditListBo> selectCustomerAuditList(String name, String type, String identity,
+			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(type))params.put("type", type);
+		if(StringUtils.isNotBlank(identity))params.put("identity", identity);
+		return (Pagination<CustomerAuditListBo>) findPage("selectCustomerAuditList", "selectCustomerAuditCount", params, pageNo, pageSize);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	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", industry);
+		 if(null!=sortType)params.put("sortType", sortType);
+		 if(StringUtils.isNotBlank(TokenManager.getUserId()))params.put("uid", TokenManager.getUserId());
+		 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);
+	}
+	
+
 
 }