wanghui 8 years ago
parent
commit
c091860106

+ 16 - 54
src/main/java/com/goafanti/common/dao/CustomerMapper.java

@@ -1,82 +1,44 @@
 package com.goafanti.common.dao;
 
 
-import com.goafanti.common.model.Customer;
-import com.goafanti.common.model.CustomerExample;
 import java.util.List;
+
 import org.apache.ibatis.annotations.Param;
 
+import com.goafanti.common.model.Customer;
+
 public interface CustomerMapper {
 
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
-	 */
-	long countByExample(CustomerExample example);
 
 	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
-	 */
-	int deleteByExample(CustomerExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
+	 * 删除客户信息
 	 */
 	int deleteCustomerByPrimaryKey(String id);
 
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
-	 */
-	int insert(Customer record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
-	 */
-	int insertSelective(Customer record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
-	 */
-	List<Customer> selectByExample(CustomerExample example);
 
 	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
+	 * 查询客户详情
 	 */
-	Customer selectByPrimaryKey(String id);
+	Customer selectCustomerByPrimaryKey(String id);
 
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
-	 */
-	int updateByExampleSelective(@Param("record") Customer record, @Param("example") CustomerExample example);
 
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
-	 */
-	int updateByExample(@Param("record") Customer record, @Param("example") CustomerExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
-	 */
-	int updateByPrimaryKeySelective(Customer record);
 
 	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Wed Oct 11 15:40:31 CST 2017
+	 * 修改客户信息
 	 */
-	int updateByPrimaryKey(Customer record);
+	int updateCustomerByPrimaryKey(String id);
 
 	/**
 	 * 新增
 	 */
 	int insertCustomer(Customer cus);
+	
+	/**
+	 * 
+	 * @param ladderId 上层领导ID
+	 * @return 所有包含上层领导ID的 客户记录
+	 */
+	List<Customer> selectByLadderId(@Param("ladderId")String ladderId);
 
+	void updateByPrimaryKeySelective(Customer customer);
 }

+ 18 - 155
src/main/java/com/goafanti/common/mapper/CustomerMapper.xml

@@ -2,11 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.goafanti.common.dao.CustomerMapper">
   <resultMap id="BaseResultMap" type="com.goafanti.common.model.Customer">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Oct 11 15:40:31 CST 2017.
-    -->
     <id column="id" jdbcType="VARCHAR" property="id" />
     <result column="aid" jdbcType="VARCHAR" property="aid" />
     <result column="customer_typ" jdbcType="VARCHAR" property="customerTyp" />
@@ -52,40 +47,6 @@
       </foreach>
     </where>
   </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Oct 11 15:40:31 CST 2017.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
@@ -95,36 +56,25 @@
     id, aid, customer_typ, share_typ, agent_id, company_intention, create_time, follow_situation, 
     customer_statue, paid
   </sql>
-  <select id="selectByExample" parameterType="com.goafanti.common.model.CustomerExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Oct 11 15:40:31 CST 2017.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from customer
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Oct 11 15:40:31 CST 2017.
-    -->
+   <select id="selectCustomerByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerBo">
     select 
-    <include refid="Base_Column_List" />
-    from customer
+    a.customer_typ as customerTyp,
+     a.share_typ as shareTyp,
+    a.company_intention as companyIntention,
+    a.create_time as createTime,
+    a.follow_situation as followSituation,
+    a.customer_statue as customerStatue,
+    b.name,b.sex,b.mobile,b.tel_num as telNum,b.email,b.qq,b.wechat,b.depatrment,b.remarks,
+    b.customer_position as customerPosition,
+    c.company_name as companyName,
+    c.location_province as locationProvince,
+    c.company_industry as companyIndustry,
+    c.adress -->
+    from customer a 
+    left join customer_user_info b on  a.id=b.cid
+    left join customer_organization_info c on a.id=c.cid
     where id = #{id,jdbcType=VARCHAR}
-  </select>
+  </select> 
   <delete id="deleteCustomerByPrimaryKey" parameterType="java.lang.String">
     <!--
       WARNING - @mbg.generated
@@ -243,76 +193,7 @@
       <include refid="Example_Where_Clause" />
     </if>
   </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Oct 11 15:40:31 CST 2017.
-    -->
-    update customer
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=VARCHAR},
-      </if>
-      <if test="record.aid != null">
-        aid = #{record.aid,jdbcType=VARCHAR},
-      </if>
-      <if test="record.customerTyp != null">
-        customer_typ = #{record.customerTyp,jdbcType=VARCHAR},
-      </if>
-      <if test="record.shareTyp != null">
-        share_typ = #{record.shareTyp,jdbcType=INTEGER},
-      </if>
-      <if test="record.agentId != null">
-        agent_id = #{record.agentId,jdbcType=VARCHAR},
-      </if>
-      <if test="record.companyIntention != null">
-        company_intention = #{record.companyIntention,jdbcType=VARCHAR},
-      </if>
-      <if test="record.createTime != null">
-        create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.followSituation != null">
-        follow_situation = #{record.followSituation,jdbcType=VARCHAR},
-      </if>
-      <if test="record.customerStatue != null">
-        customer_statue = #{record.customerStatue,jdbcType=VARCHAR},
-      </if>
-      <if test="record.paid != null">
-        paid = #{record.paid,jdbcType=VARCHAR},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Oct 11 15:40:31 CST 2017.
-    -->
-    update customer
-    set id = #{record.id,jdbcType=VARCHAR},
-      aid = #{record.aid,jdbcType=VARCHAR},
-      customer_typ = #{record.customerTyp,jdbcType=VARCHAR},
-      share_typ = #{record.shareTyp,jdbcType=INTEGER},
-      agent_id = #{record.agentId,jdbcType=VARCHAR},
-      company_intention = #{record.companyIntention,jdbcType=VARCHAR},
-      create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      follow_situation = #{record.followSituation,jdbcType=VARCHAR},
-      customer_statue = #{record.customerStatue,jdbcType=VARCHAR},
-      paid = #{record.paid,jdbcType=VARCHAR}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Customer">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Oct 11 15:40:31 CST 2017.
-    -->
+  <update id="updateCustomerByPrimaryKey" parameterType="com.goafanti.common.model.Customer">
     update customer
     <set>
       <if test="aid != null">
@@ -345,22 +226,4 @@
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Customer">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Oct 11 15:40:31 CST 2017.
-    -->
-    update customer
-    set aid = #{aid,jdbcType=VARCHAR},
-      customer_typ = #{customerTyp,jdbcType=VARCHAR},
-      share_typ = #{shareTyp,jdbcType=INTEGER},
-      agent_id = #{agentId,jdbcType=VARCHAR},
-      company_intention = #{companyIntention,jdbcType=VARCHAR},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      follow_situation = #{followSituation,jdbcType=VARCHAR},
-      customer_statue = #{customerStatue,jdbcType=VARCHAR},
-      paid = #{paid,jdbcType=VARCHAR}
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
 </mapper>

+ 265 - 0
src/main/java/com/goafanti/customer/bo/CustomerBo.java

@@ -0,0 +1,265 @@
+package com.goafanti.customer.bo;
+
+import java.util.Date;
+
+public class CustomerBo {
+	/**
+	 * 客户类型(1-个人用户,2-公司用户)
+	 */
+	private String customerTyp;
+	/**
+	 * id
+	 */
+	private String id;
+	/**
+	 * cid
+	 */
+	private String cid;
+	/**
+	 * 分享类型(1-个人用户,2-公共用户)
+	 */
+	private Integer shareTyp;
+	/**
+	 * 公司意向
+	 */
+	private String companyIntention;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createTime;
+	/**
+	 * 跟进进度(0-已发项目介绍资料,1-已约面谈,2-已发合同计划书,3-已报价,4-已发合同,5-已签合同,6-面谈中,7-已面签)
+	 */
+	private String followSituation;
+
+
+	/**
+	 * 客户状态(0-新客户,1-意向客户,2-重点客户,3-面谈客户,4-签单客户,5-被拒绝客户)
+	 */
+	private String customerStatue;
+	/**
+	 * 个人客户姓名
+	 */
+	private String name;
+	/**
+	 * 性别(0-男,1-女)
+	 */
+	private char sex;
+	/**
+	 * 座机号码
+	 */
+	private String mobile;
+	/**
+	 * 手机号
+	 */
+	private String telNum;
+	/**
+	 * 电子邮件
+	 */
+	private String email;
+	/**
+	 * qq
+	 */
+	private String qq;
+	/**
+	 * 微信
+	 */
+	private String wechat;
+	/**
+	 * 部门
+	 */
+	private String depatrment;
+	/**
+	 * 职位
+	 */
+	private String customerPosition;
+	/**
+	 * 备注
+	 */
+	private String remarks;
+	/**
+	 *公司名称
+	 */
+	private String companyName;
+	/**
+	 * 归属省份
+	 */
+	private String locationProvince;
+	/**
+	 * 行业
+	 */
+	private String companyIndustry;
+	/**
+	 * 归属城市
+	 */
+	private String locationCity;
+	/**
+	 * 归属地区
+	 */
+	private String locationArea;
+	/**
+	 * 详细地址
+	 */
+	private String adress;
+	
+	
+	public String getCustomerTyp() {
+		return customerTyp;
+	}
+	public void setCustomerTyp(String customerTyp) {
+		this.customerTyp = customerTyp;
+	}
+	public Integer getShareTyp() {
+		return shareTyp;
+	}
+	public void setShareTyp(Integer shareTyp) {
+		this.shareTyp = shareTyp;
+	}
+	public String getCompanyIntention() {
+		return companyIntention;
+	}
+	public void setCompanyIntention(String companyIntention) {
+		this.companyIntention = companyIntention;
+	}
+	public Date getCreateTime() {
+		return createTime;
+	}
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+	public String getFollowSituation() {
+		return followSituation;
+	}
+	public void setFollowSituation(String followSituation) {
+		this.followSituation = followSituation;
+	}
+	public String getCustomerStatue() {
+		return customerStatue;
+	}
+	public void setCustomerStatue(String customerStatue) {
+		this.customerStatue = customerStatue;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public char getSex() {
+		return sex;
+	}
+	public void setSex(char sex) {
+		this.sex = sex;
+	}
+	public String getMobile() {
+		return mobile;
+	}
+	public void setMobile(String mobile) {
+		this.mobile = mobile;
+	}
+	public String getTelNum() {
+		return telNum;
+	}
+	public void setTelNum(String telNum) {
+		this.telNum = telNum;
+	}
+	public String getEmail() {
+		return email;
+	}
+	public void setEmail(String email) {
+		this.email = email;
+	}
+	public String getQq() {
+		return qq;
+	}
+	public void setQq(String qq) {
+		this.qq = qq;
+	}
+	public String getWechat() {
+		return wechat;
+	}
+	public void setWechat(String wechat) {
+		this.wechat = wechat;
+	}
+	public String getDepatrment() {
+		return depatrment;
+	}
+	public void setDepatrment(String depatrment) {
+		this.depatrment = depatrment;
+	}
+	public String getCustomerPosition() {
+		return customerPosition;
+	}
+	public void setCustomerPosition(String customerPosition) {
+		this.customerPosition = customerPosition;
+	}
+	public String getRemarks() {
+		return remarks;
+	}
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+	public String getCompanyName() {
+		return companyName;
+	}
+	public void setCompanyName(String companyName) {
+		this.companyName = companyName;
+	}
+	public String getLocationProvince() {
+		return locationProvince;
+	}
+	public void setLocationProvince(String locationProvince) {
+		this.locationProvince = locationProvince;
+	}
+	public String getCompanyIndustry() {
+		return companyIndustry;
+	}
+	public void setCompanyIndustry(String companyIndustry) {
+		this.companyIndustry = companyIndustry;
+	}
+	public String getLocationCity() {
+		return locationCity;
+	}
+	public void setLocationCity(String locationCity) {
+		this.locationCity = locationCity;
+	}
+	public String getLocationArea() {
+		return locationArea;
+	}
+	public void setLocationArea(String locationArea) {
+		this.locationArea = locationArea;
+	}
+	public String getAdress() {
+		return adress;
+	}
+	public void setAdress(String adress) {
+		this.adress = adress;
+	}
+	
+	public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	
+	public String getCid() {
+		return cid;
+	}
+	public void setCid(String cid) {
+		this.cid = cid;
+	}
+	@Override
+	public String toString() {
+		return "CustomerBo [customerTyp=" + customerTyp + ", shareTyp=" + shareTyp + ", companyIntention="
+				+ companyIntention + ", createTime=" + createTime + ", followSituation=" + followSituation
+				+ ", customerStatue=" + customerStatue + ", name=" + name + ", sex=" + sex + ", mobile=" + mobile
+				+ ", telNum=" + telNum + ", email=" + email + ", qq=" + qq + ", wechat=" + wechat + ", depatrment="
+				+ depatrment + ", customerPosition=" + customerPosition + ", remarks=" + remarks + ", companyName="
+				+ companyName + ", locationProvince=" + locationProvince + ", companyIndustry=" + companyIndustry
+				+ ", locationCity=" + locationCity + ", locationArea=" + locationArea + ", adress=" + adress + "]";
+	}
+	
+	
+}

+ 92 - 0
src/main/java/com/goafanti/customer/bo/CustomerIn.java

@@ -0,0 +1,92 @@
+package com.goafanti.customer.bo;
+
+public class CustomerIn {
+	/** 客户名 **/
+	private String customerName;
+	
+	/** 共享类型  **/
+	private String shareTyp; 
+	
+	/** 联系人姓名 **/
+	private String contactName;
+	
+	/** 联系人号码  **/
+	private String contactTel;
+	
+	/** 客户状态  **/
+	private String customerStatus;
+	
+	/** 意向服务 **/
+	private String companyIntention;
+	
+	/** 跟进进度 **/
+	private String followSituation;
+	
+	/** 跟单人 **/
+	private String adminName;
+
+	public String getCustomerName() {
+		return customerName;
+	}
+
+	public void setCustomerName(String customerName) {
+		this.customerName = customerName;
+	}
+
+	public String getShareTyp() {
+		return shareTyp;
+	}
+
+	public void setShareTyp(String shareTyp) {
+		this.shareTyp = shareTyp;
+	}
+
+	public String getContactName() {
+		return contactName;
+	}
+
+	public void setContactName(String contactName) {
+		this.contactName = contactName;
+	}
+
+	public String getContactTel() {
+		return contactTel;
+	}
+
+	public void setContactTel(String contactTel) {
+		this.contactTel = contactTel;
+	}
+
+	public String getCustomerStatus() {
+		return customerStatus;
+	}
+
+	public void setCustomerStatus(String customerStatus) {
+		this.customerStatus = customerStatus;
+	}
+
+	public String getCompanyIntention() {
+		return companyIntention;
+	}
+
+	public void setCompanyIntention(String companyIntention) {
+		this.companyIntention = companyIntention;
+	}
+
+	public String getFollowSituation() {
+		return followSituation;
+	}
+
+	public void setFollowSituation(String followSituation) {
+		this.followSituation = followSituation;
+	}
+
+	public String getAdminName() {
+		return adminName;
+	}
+
+	public void setAdminName(String adminName) {
+		this.adminName = adminName;
+	}
+	
+}

+ 68 - 1
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -1,21 +1,31 @@
 package com.goafanti.customer.controller;
 
 import java.text.ParseException;
+import java.util.List;
 import java.util.UUID;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.Subject;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.goafanti.customer.bo.CustomerBo;
+import com.goafanti.customer.bo.CustomerIn;
 import com.goafanti.customer.service.CustomerOrganizationService;
 import com.goafanti.customer.service.CustomerService;
 import com.goafanti.customer.service.CustomerUserService;
+import com.goafanti.admin.service.AdminService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.Customer;
 import com.goafanti.common.model.CustomerOrganizationInfo;
 import com.goafanti.common.model.CustomerUserInfo;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 
 @RestController
@@ -28,6 +38,8 @@ public class AdminCustomerApiController extends CertifyApiController {
 	private CustomerUserService customerUserService;
 	@Resource
 	private CustomerOrganizationService customerOrganizationService;
+	@Resource
+	private AdminService adminService;
 
 	/**
 	 * 新增客户
@@ -68,8 +80,63 @@ public class AdminCustomerApiController extends CertifyApiController {
 	@RequestMapping(value = "/deleteCustomer", method = RequestMethod.POST)
 	public Result deleteCustomer(String id) throws ParseException {
 		Result res=new Result();
-		
+		customerService.deleteCustomer(id);
+		customerUserService.deleteCustomerUserByCid(id);
+		customerOrganizationService.deleteCustomerOrganizationByCid(id);
+		return res;
+	}
+	
+	/**
+	 * 详情查询接口
+	 * 
+	 * @return
+	 * @throws ParseException
+	 */
+	@RequestMapping(value = "/detail", method = RequestMethod.POST)
+	public Result selectCustomerDetail(String id) throws ParseException {
+		Result res=new Result();
+		res.setData(customerService.selectCustomerByPrimaryKey(id));
+		return res;
+	}
+	
+	/**
+	 * 修改客户信息
+	 * 
+	 * @return
+	 * @throws ParseException
+	 */
+	@RequestMapping(value = "/updCustomer", method = RequestMethod.POST)
+	public void updCustomerDetail(String id) throws ParseException {
+		customerService.updCustomerByByPrimaryKey(id);
+		customerUserService.updCustomerUserByByPrimaryKey(id);
+		customerOrganizationService.updCustomerOrganizationByByPrimaryKey(id);
+	}
+	
+	/**
+	 * 查询操作员信息
+	 * 
+	 * @return
+	 * @throws ParseException
+	 */
+	@RequestMapping(value = "/findAdmin", method = RequestMethod.POST)
+	public Result selectAllAdmin() throws ParseException {
+		Result res = new Result();
+		List<Admin> selectAllAdmin = adminService.selectAllAdmin();
+		res.setData(selectAllAdmin);
 		return res;
 	}
 
+	/**
+	 * 查看私有客户
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping(value = "/listPrivateCustomer", method = RequestMethod.POST)
+	public Result listPrivateCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNumber){
+		Result  res = new Result();
+		String currentUserId = TokenManager.getUserId();
+		Pagination<CustomerBo> boList = customerService.getPrivateCustomer(cin, pageSize, pageNumber);
+		res.setData(boList);
+		return res;
+	}
 }

+ 29 - 2
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -1,7 +1,9 @@
 package com.goafanti.customer.service;
 
-
 import com.goafanti.common.model.Customer;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.customer.bo.CustomerBo;
+import com.goafanti.customer.bo.CustomerIn;
 
 public interface CustomerService {
 
@@ -9,6 +11,31 @@ public interface CustomerService {
 	
 	void deleteCustomer(String id);
 	
-	//查询用户的管理层ID
+	CustomerBo selectCustomerByPrimaryKey (String id);
+	
+	void updCustomerByByPrimaryKey(String id);
+	/**
+	 * 查询用户的管理层ID
+	 * @param userId
+	 * @return
+	 */
 	String findLadderIds(String userId);
+	
+	/**
+	 * 修改用户的管理层ID
+	 * @param ladderId
+	 */
+	void updateLadderIds(String ladderId);
+	
+	/**
+	 *  获取私有客户
+	 * @return
+	 */
+	Pagination<CustomerBo> getPrivateCustomer(CustomerIn cin,Integer pageSize, Integer pageNumber);
+	
+	/**
+	 *  获取公共客户
+	 * @return
+	 */
+	Pagination<CustomerBo> getPublicCustomer(CustomerIn cin,Integer pageSize, Integer pageNumber);
 }

+ 54 - 1
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -1,9 +1,15 @@
 package com.goafanti.customer.service.impl;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.customer.bo.CustomerBo;
+import com.goafanti.customer.bo.CustomerIn;
 import com.goafanti.customer.service.CustomerService;
 import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.CustomerMapper;
@@ -27,6 +33,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 	public void deleteCustomer(String id) {
 		customerMapper.deleteCustomerByPrimaryKey(id);
 	}
+	@Override
+	public CustomerBo selectCustomerByPrimaryKey(String id) {
+		customerMapper.selectCustomerByPrimaryKey(id);
+		return null;
+	}
 	
 	@Override
 	public String findLadderIds(String adminId) {
@@ -39,5 +50,47 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 		if(!result.equals("")) result = result.substring(0, result.length()-1);
 		return result;
 	}
-	
+
+	@Override
+	public void updateLadderIds(String ladderId) {
+		List<Customer> customers = customerMapper.selectByLadderId(ladderId);
+		if(customers.size()>0){
+			String newPaid = "";
+			for(Customer c:customers){
+				newPaid = findLadderIds(c.getId());
+				c.setPaid(newPaid);
+				customerMapper.updateByPrimaryKeySelective(c);
+			}
+		}
+	}
+
+	@Override
+	public Pagination<CustomerBo> getPrivateCustomer(CustomerIn cin, Integer pageSize, Integer pageNumber) {
+		Map<String,Object> params = disposeParams(cin);
+		if(pageSize == null || pageSize < 0) pageSize = 10;
+		if(pageNumber == null || pageNumber <0 ) pageNumber = 1;
+		Pagination<CustomerBo> list = (Pagination<CustomerBo>)findPage("selectCustomer","selectCustomerCount",params, pageNumber, pageSize);
+		return list;
+	}
+
+	@Override
+	public Pagination<CustomerBo> getPublicCustomer(CustomerIn cin, Integer pageSize, Integer pageNumber) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void updCustomerByByPrimaryKey(String id) {
+		customerMapper.updateCustomerByPrimaryKey(id);
+	}
+	private Map<String,Object> disposeParams(CustomerIn cin){
+		Map<String,Object> params = new HashMap<String,Object>();
+		if(StringUtils.isNotBlank(cin.getAdminName())) params.put("adminName", cin.getAdminName());
+		if(StringUtils.isNotBlank(cin.getCompanyIntention())) params.put("companyIntention", cin.getCompanyIntention());
+		if(StringUtils.isNotBlank(cin.getContactName())) params.put("contactName", cin.getContactName());
+		if(StringUtils.isNotBlank(cin.getCustomerStatus())) params.put("customerStauts", cin.getCustomerStatus());
+		if(StringUtils.isNotBlank(cin.getFollowSituation())) params.put("followSituation", cin.getFollowSituation());
+		if(StringUtils.isNotBlank(cin.getShareTyp())) params.put("shareTyp", cin.getShareTyp());
+		return params;
+	}
 }