Browse Source

客户管理整体规划

Michael 8 years ago
parent
commit
700d10aec7

+ 4 - 1
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -6,6 +6,7 @@ import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
 import com.goafanti.app.bo.UserBasicInfo;
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.UserBusiness;
@@ -200,5 +201,7 @@ public interface UserMapper {
 	 * @param easemobName
 	 * @return
 	 */
-	User selectByNumber(@Param("easemobName")String easemobName);
+	User selectByNumber(@Param("easemobName")String easemobName);
+	
+	List<Admin> findAdminName(String aid);
 }

+ 15 - 54
src/main/java/com/goafanti/common/mapper/UserIdentityMapper.xml

@@ -44,7 +44,6 @@
     <result column="education" jdbcType="VARCHAR" property="education" />
     <result column="major_category" jdbcType="VARCHAR" property="majorCategory" />
     <result column="qualification" jdbcType="VARCHAR" property="qualification" />
-    <result column="investment" jdbcType="INTEGER" property="investment" />
     <result column="graduate_school" jdbcType="VARCHAR" property="graduateSchool" />
     <result column="consultant" jdbcType="INTEGER" property="consultant" />
     <result column="consultation_price" jdbcType="DECIMAL" property="consultationPrice" />
@@ -128,7 +127,6 @@
     amount_money, audit_status, process, wrong_count, payment_date, expert, celebrity, 
     international, fixed_tel, qq, postal_address, postcode, review_instructions, industry, 
     contacts, email, professional_title, work_unit, education, major_category, qualification, 
-    investment, graduate_school, consultant, consultation_price
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.UserIdentityExample" resultMap="BaseResultMap">
     <!--
@@ -193,13 +191,13 @@
       contact_mobile, bank_name, bank_account, 
       bank_card_number, amount_money, audit_status, 
       process, wrong_count, payment_date, 
-      expert, celebrity, international, 
+      expert, international, 
       fixed_tel, qq, postal_address, 
       postcode, review_instructions, industry, 
       contacts, email, professional_title, 
       work_unit, education, major_category, 
-      qualification, investment, graduate_school, 
-      consultant, consultation_price)
+      qualification, graduate_school, 
+      consultation_price)
     values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, 
       #{sex,jdbcType=VARCHAR}, #{dateOfBirthYear,jdbcType=VARCHAR}, #{dateOfBirthMonth,jdbcType=VARCHAR}, 
       #{idNumber,jdbcType=VARCHAR}, #{positiveIdUrl,jdbcType=VARCHAR}, #{oppositeIdUrl,jdbcType=VARCHAR}, 
@@ -207,13 +205,13 @@
       #{contactMobile,jdbcType=VARCHAR}, #{bankName,jdbcType=VARCHAR}, #{bankAccount,jdbcType=VARCHAR}, 
       #{bankCardNumber,jdbcType=VARCHAR}, #{amountMoney,jdbcType=DECIMAL}, #{auditStatus,jdbcType=INTEGER}, 
       #{process,jdbcType=INTEGER}, #{wrongCount,jdbcType=INTEGER}, #{paymentDate,jdbcType=TIMESTAMP}, 
-      #{expert,jdbcType=INTEGER}, #{celebrity,jdbcType=INTEGER}, #{international,jdbcType=INTEGER}, 
+      #{expert,jdbcType=INTEGER}, #{international,jdbcType=INTEGER}, 
       #{fixedTel,jdbcType=VARCHAR}, #{qq,jdbcType=VARCHAR}, #{postalAddress,jdbcType=VARCHAR}, 
       #{postcode,jdbcType=VARCHAR}, #{reviewInstructions,jdbcType=VARCHAR}, #{industry,jdbcType=INTEGER}, 
       #{contacts,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{professionalTitle,jdbcType=VARCHAR}, 
       #{workUnit,jdbcType=VARCHAR}, #{education,jdbcType=VARCHAR}, #{majorCategory,jdbcType=VARCHAR}, 
-      #{qualification,jdbcType=VARCHAR}, #{investment,jdbcType=INTEGER}, #{graduateSchool,jdbcType=VARCHAR}, 
-      #{consultant,jdbcType=INTEGER}, #{consultationPrice,jdbcType=DECIMAL})
+      #{qualification,jdbcType=VARCHAR}, #{graduateSchool,jdbcType=VARCHAR}, 
+      #{consultationPrice,jdbcType=DECIMAL})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.UserIdentity">
     <!--
@@ -289,9 +287,6 @@
       <if test="expert != null">
         expert,
       </if>
-      <if test="celebrity != null">
-        celebrity,
-      </if>
       <if test="international != null">
         international,
       </if>
@@ -334,15 +329,9 @@
       <if test="qualification != null">
         qualification,
       </if>
-      <if test="investment != null">
-        investment,
-      </if>
       <if test="graduateSchool != null">
         graduate_school,
       </if>
-      <if test="consultant != null">
-        consultant,
-      </if>
       <if test="consultationPrice != null">
         consultation_price,
       </if>
@@ -414,9 +403,6 @@
       <if test="expert != null">
         #{expert,jdbcType=INTEGER},
       </if>
-      <if test="celebrity != null">
-        #{celebrity,jdbcType=INTEGER},
-      </if>
       <if test="international != null">
         #{international,jdbcType=INTEGER},
       </if>
@@ -459,15 +445,9 @@
       <if test="qualification != null">
         #{qualification,jdbcType=VARCHAR},
       </if>
-      <if test="investment != null">
-        #{investment,jdbcType=INTEGER},
-      </if>
       <if test="graduateSchool != null">
         #{graduateSchool,jdbcType=VARCHAR},
       </if>
-      <if test="consultant != null">
-        #{consultant,jdbcType=INTEGER},
-      </if>
       <if test="consultationPrice != null">
         #{consultationPrice,jdbcType=DECIMAL},
       </if>
@@ -558,9 +538,6 @@
       <if test="record.expert != null">
         expert = #{record.expert,jdbcType=INTEGER},
       </if>
-      <if test="record.celebrity != null">
-        celebrity = #{record.celebrity,jdbcType=INTEGER},
-      </if>
       <if test="record.international != null">
         international = #{record.international,jdbcType=INTEGER},
       </if>
@@ -603,15 +580,9 @@
       <if test="record.qualification != null">
         qualification = #{record.qualification,jdbcType=VARCHAR},
       </if>
-      <if test="record.investment != null">
-        investment = #{record.investment,jdbcType=INTEGER},
-      </if>
       <if test="record.graduateSchool != null">
         graduate_school = #{record.graduateSchool,jdbcType=VARCHAR},
       </if>
-      <if test="record.consultant != null">
-        consultant = #{record.consultant,jdbcType=INTEGER},
-      </if>
       <if test="record.consultationPrice != null">
         consultation_price = #{record.consultationPrice,jdbcType=DECIMAL},
       </if>
@@ -649,7 +620,6 @@
       wrong_count = #{record.wrongCount,jdbcType=INTEGER},
       payment_date = #{record.paymentDate,jdbcType=TIMESTAMP},
       expert = #{record.expert,jdbcType=INTEGER},
-      celebrity = #{record.celebrity,jdbcType=INTEGER},
       international = #{record.international,jdbcType=INTEGER},
       fixed_tel = #{record.fixedTel,jdbcType=VARCHAR},
       qq = #{record.qq,jdbcType=VARCHAR},
@@ -664,9 +634,7 @@
       education = #{record.education,jdbcType=VARCHAR},
       major_category = #{record.majorCategory,jdbcType=VARCHAR},
       qualification = #{record.qualification,jdbcType=VARCHAR},
-      investment = #{record.investment,jdbcType=INTEGER},
       graduate_school = #{record.graduateSchool,jdbcType=VARCHAR},
-      consultant = #{record.consultant,jdbcType=INTEGER},
       consultation_price = #{record.consultationPrice,jdbcType=DECIMAL}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -743,9 +711,6 @@
       <if test="expert != null">
         expert = #{expert,jdbcType=INTEGER},
       </if>
-      <if test="celebrity != null">
-        celebrity = #{celebrity,jdbcType=INTEGER},
-      </if>
       <if test="international != null">
         international = #{international,jdbcType=INTEGER},
       </if>
@@ -788,18 +753,18 @@
       <if test="qualification != null">
         qualification = #{qualification,jdbcType=VARCHAR},
       </if>
-      <if test="investment != null">
-        investment = #{investment,jdbcType=INTEGER},
-      </if>
       <if test="graduateSchool != null">
         graduate_school = #{graduateSchool,jdbcType=VARCHAR},
       </if>
-      <if test="consultant != null">
-        consultant = #{consultant,jdbcType=INTEGER},
-      </if>
       <if test="consultationPrice != null">
         consultation_price = #{consultationPrice,jdbcType=DECIMAL},
       </if>
+      <if test="expertAudit != null">
+        expert_audit = #{expertAudit,jdbcType=DECIMAL},
+      </if>
+      <if test="releaseStatus != null">
+        release_status = #{releaseStatus,jdbcType=DECIMAL},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -831,7 +796,6 @@
       wrong_count = #{wrongCount,jdbcType=INTEGER},
       payment_date = #{paymentDate,jdbcType=TIMESTAMP},
       expert = #{expert,jdbcType=INTEGER},
-      celebrity = #{celebrity,jdbcType=INTEGER},
       international = #{international,jdbcType=INTEGER},
       fixed_tel = #{fixedTel,jdbcType=VARCHAR},
       qq = #{qq,jdbcType=VARCHAR},
@@ -846,9 +810,7 @@
       education = #{education,jdbcType=VARCHAR},
       major_category = #{majorCategory,jdbcType=VARCHAR},
       qualification = #{qualification,jdbcType=VARCHAR},
-      investment = #{investment,jdbcType=INTEGER},
       graduate_school = #{graduateSchool,jdbcType=VARCHAR},
-      consultant = #{consultant,jdbcType=INTEGER},
       consultation_price = #{consultationPrice,jdbcType=DECIMAL}
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -894,8 +856,7 @@
   		ui.amount_money as amountMoney,
   		ui.audit_status as auditStatus, 
   		ui.payment_date as paymentDate, 
-  		ui.expert, 
-  		ui.celebrity
+  		ui.expert
   	from user u 
   	LEFT JOIN user_identity ui on u.id = ui.uid
   	where u.id = #{uid,jdbcType=VARCHAR}
@@ -1098,7 +1059,7 @@
   
   <select id="findConsultantListByPage" resultType="com.goafanti.app.bo.consultantListBo">
 	 select t.uid as id,t.username as username ,u.head_portrait_url as headPortraitUrl,u.introduction ,
-	  t.consultant,t.celebrity,ifnull(x.n,0) as reservationCount
+	  t.consultant,ifnull(x.n,0) as reservationCount
 	  from user_identity t
 	  left join `user` u on t.uid=u.id
 	  left join ( select y.x  as n, y.seller_id
@@ -1122,7 +1083,7 @@
   <select id="selectconsultantByUid" parameterType="java.lang.String" resultType="com.goafanti.app.bo.consultantListBo">
   	 	select 
   		t.uid as id ,t.username as username ,t.consultant,u.head_portrait_url as headPortraitUrl,
-  		u.introduction,ifnull(o.x,0) as reservationCount,j.easemob_name as easemobName,t.celebrity
+  		u.introduction,ifnull(o.x,0) as reservationCount,j.easemob_name as easemobName
   	from  user_identity t 
   	left join user u on t.uid =u.id
   	 left join jpush_easemob_account j on t.uid=j.uid

+ 15 - 2
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -35,6 +35,9 @@
 		<if test="aid != null and aid !=''">
 			and a.aid = #{aid,jdbcType=VARCHAR}
 		</if>
+		<if test="expertAudit != null and expertAudit !=''">
+			and b.expert_audit = #{expertAudit,jdbcType=VARCHAR}
+		</if>
 		<if test="name != null and name != ''">
 			and a.identify_name like concat('%',#{name},'%')
 		</if>
@@ -344,9 +347,11 @@
 			b.id,
 			b.contacts,
 			b.contact_mobile as contactMobile,
-			b.audit_status as auditStatus
+			b.audit_status as auditStatus,
+			a.aid as aid,d.name as adminName
 		from 
 			user a inner join organization_identity b on a.id = b.uid
+			left join admin d on d.id = a.aid
 		where 
 			a.id = #{uid,jdbcType=VARCHAR}
 	</select>
@@ -388,10 +393,12 @@
 			b.graduate_school as graduateSchool,
 			b.consultation_price as consultationPrice,
 			b.expert_audit as expertAudit,
-			b.release_status as releaseStatus
+			b.release_status as releaseStatus,
+			a.aid as aid,d.name as adminName
 		from
 			user a inner join user_identity b on
 			a.id = b.uid	
+			left join admin d on d.id = a.aid
 		where
 			a.id = #{uid,jdbcType=VARCHAR}
 	</select>
@@ -1089,4 +1096,10 @@
      		and b.audit_status = #{auditStatus,jdbcType=INTEGER}
     	</if>
 	</select>
+	
+	<select id="findAdminName" resultType="com.goafanti.customer.bo.CustomerListOut">
+		select d.name as adminName,d.id as aid
+		from admin d left join department_management dm on dm.id = d.department_id
+		where d.department_id=(select department_id from admin where id=#{aid,jdbcType=INTEGER})
+	</select>
 </mapper>

+ 20 - 0
src/main/java/com/goafanti/common/model/UserIdentity.java

@@ -210,6 +210,26 @@ public class UserIdentity {
 	 * @mbg.generated  Fri Dec 29 09:20:50 CST 2017
 	 */
 	private BigDecimal consultationPrice;
+	
+	private Integer expertAudit;
+	
+	private Integer releaseStatus;
+
+	public Integer getExpertAudit() {
+		return expertAudit;
+	}
+
+	public void setExpertAudit(Integer expertAudit) {
+		this.expertAudit = expertAudit;
+	}
+
+	public Integer getReleaseStatus() {
+		return releaseStatus;
+	}
+
+	public void setReleaseStatus(Integer releaseStatus) {
+		this.releaseStatus = releaseStatus;
+	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column user_identity.id

+ 11 - 0
src/main/java/com/goafanti/customer/bo/CustomerListIn.java

@@ -77,6 +77,17 @@ public class CustomerListIn {
 	/** 是否为咨询师 **/
 	private String consultant;
 	
+	/** 专家审核状态 **/
+	private Integer expertAudit ;
+
+	public Integer getExpertAudit() {
+		return expertAudit;
+	}
+
+	public void setExpertAudit(Integer expertAudit) {
+		this.expertAudit = expertAudit;
+	}
+
 	public String getType() {
 		return type;
 	}

+ 21 - 0
src/main/java/com/goafanti/customer/bo/CustomerPersonalDetailBo.java

@@ -9,6 +9,27 @@ public class CustomerPersonalDetailBo extends UserIdentity{
 	private String introduction;
 	private Integer businessAudit;
 	private Integer expertAudit;
+	private Integer releaseStatus;
+	private String aid;
+	private String adminName;
+	public String getAdminName() {
+		return adminName;
+	}
+	public void setAdminName(String adminName) {
+		this.adminName = adminName;
+	}
+	public String getAid() {
+		return aid;
+	}
+	public void setAid(String aid) {
+		this.aid = aid;
+	}
+	public Integer getReleaseStatus() {
+		return releaseStatus;
+	}
+	public void setReleaseStatus(Integer releaseStatus) {
+		this.releaseStatus = releaseStatus;
+	}
 	public Integer getExpertAudit() {
 		return expertAudit;
 	}

+ 20 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -812,4 +812,24 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateBusinessToStop(businessId);
 		return res;
 	}
+	
+	/** 客户分配查询(本部门) **/
+	@RequestMapping(value = "/findAdminName" , method = RequestMethod.POST)
+	public Result findAdminName(){
+		Result res = new Result();
+		res.setData(customerService.findAdminName());
+		return res;
+	}
+	
+	/** 分配个人客户 **/
+	@RequestMapping(value = "/updatePersonalCustomerz", method = RequestMethod.POST)
+	public Result updatePersonalCustomerz(CustomerPersonalDetailBo bo){
+		Result res = new Result();
+		if(StringUtils.isBlank(bo.getUid()) || StringUtils.isBlank(bo.getId())){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
+			return res;
+		}
+		customerService.updatePersonalCustomerz(bo);
+		return res;
+	}
 }

+ 5 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -6,6 +6,7 @@ import java.util.List;
 import java.util.Set;
 
 import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.UserBusiness;
@@ -384,4 +385,8 @@ public interface CustomerService {
 	 * @return
 	 */
 	int deleteOneContact(String ocbId);
+	
+	List<Admin> findAdminName();
+	
+	int updatePersonalCustomerz(CustomerPersonalDetailBo bo);
 }

+ 32 - 2
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -36,6 +36,7 @@ import com.goafanti.common.enums.MemberStatus;
 import com.goafanti.common.enums.UserLevel;
 import com.goafanti.common.enums.UserType;
 import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.common.model.User;
@@ -96,7 +97,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	@Override
 	public Pagination<CustomerListOut> listPublicPersonalCustomer(CustomerListIn cli, Integer pageNo,Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_PERSONAL);
-		cli.setAid(TokenManager.getAdminId());
+		/*cli.setAid(TokenManager.getAdminId());*/
 		cli.setShareType(String.valueOf(AFTConstants.USER_SHARE_PUBLIC));
 		Map<String,Object> params = disposeParams(cli);
 		@SuppressWarnings("unchecked")
@@ -108,6 +109,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	public Pagination<CustomerListOut> listAllPersonalCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_PERSONAL);
 		Map<String,Object> params = disposeParams(cli);
+		if(null!=cli.getExpertAudit())params.put("expertAudit", cli.getExpertAudit());
 		@SuppressWarnings("unchecked")
 		Pagination<CustomerListOut> list = (Pagination<CustomerListOut>) findPage("selectPersonalCustomerList","selectPersonalCustomerCount",params,pageNo,pageSize);
 		return list;
@@ -136,7 +138,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	@Override
 	public Pagination<CustomerListOut> listPublicOrganizationCustomer(CustomerListIn cli, Integer pageNo,Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_ORGANIZATION);
-		cli.setAid(TokenManager.getAdminId());
+		/*cli.setAid(TokenManager.getAdminId());*/
 		cli.setShareType(String.valueOf(AFTConstants.USER_SHARE_PUBLIC));
 		Map<String,Object> params = disposeParams(cli);
 		@SuppressWarnings("unchecked")
@@ -937,5 +939,33 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	public int deleteOneContact(String ocbId) {
 		return organizationContactBookMapper.deleteByPrimaryKey(ocbId);
 	}
+
+	@Override
+	public List<Admin> findAdminName() {
+		String aid=TokenManager.getAdminId();
+		return userMapper.findAdminName(aid);
+	}
 	
+	@Override
+	public int updatePersonalCustomerz(CustomerPersonalDetailBo bo) {
+		UserIdentity ui = new UserIdentity();
+		User user = new User();
+		try {
+			BeanUtilsExt.copyProperties(ui, bo);
+			user.setId(bo.getUid());
+			user.setSocietyTag(bo.getSocietyTag());
+			user.setHeadPortraitUrl(bo.getHeadPortraitUrl());
+			user.setIntroduction(bo.getIntroduction());
+			user.setUpdateTime(new Date());
+			user.setBusinessAudit(bo.getBusinessAudit());
+			if(!StringUtils.isBlank(bo.getAid())){
+				user.setAid(bo.getAid());
+				user.setShareType(0);
+			}
+		} catch (InvocationTargetException | IllegalAccessException e) {
+			e.printStackTrace();
+		}
+		userMapper.updateByPrimaryKeySelective(user);
+		return 1;
+	}
 }