Browse Source

科德系统渠道模块开发

anderx 3 years ago
parent
commit
e4e88149cb

+ 3 - 0
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -147,6 +147,9 @@ public class AFTConstants {
 	/** 签单转交*/
 	public static final Integer	SIGN_USER_TRANSFER_TO_OTHER				= 4;
 
+	/** 渠道转交*/
+	public static final Integer	CHANNEL_USER_TRANSFER_TO_OTHER				= 5;
+
 
 
 	public static final String	PROJECT_TRANSFER_TO_OTHER				= "转交客户给制定人";

+ 16 - 13
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -112,11 +112,11 @@ public interface UserMapper {
 	OrgPartnerDetailBo findOrgPartnerDetail(String uid);
 
 	Long selectNumberByPrimaryKey(String userId);
-	
+
 	List<UserPartnerDetailBo> findUserPartner();
-	
+
 	User selectByMobieAndType(String mobile, Integer type);
-	
+
 	/**
 	 * 根据客户模糊搜索
 	 * @param name
@@ -130,15 +130,15 @@ public interface UserMapper {
 	 * @return
 	 */
 	int judgeCustomerByName(@Param("identifyName")String identifyName);
-	
+
 	/**
 	 * 查询单位客户详情
 	 * @param uid 用户ID
 	 * @return
 	 */
 	CustomerPersonalDetailBo findPersonalCustomerDetail(@Param("uid")String uid);
-	
-	
+
+
 	/**
 	 * 查询单位客户详情
 	 * @param uid 用户ID
@@ -188,7 +188,7 @@ public interface UserMapper {
 	 * @param mobile 手机号码
 	 * @param type 用户类型 0-个人 1-单位
 	 * @param source 来源 0-注册 1-录入
-	 * @return 
+	 * @return
 	 * @param nickname 昵称
 	 */
 	List<User> checkUser(@Param("id")String id,@Param("identifyName")String identifyName, @Param("mobile")String mobile,
@@ -211,9 +211,9 @@ public interface UserMapper {
 	 * @return
 	 */
 	User selectByNumber(@Param("easemobName")String easemobName);
-	
+
 	List<Admin> findAdminName(String aid);
-	
+
 	int updateEnteringAudit(@Param("id")String id,@Param("auditStatus")Integer auditStatus,@Param("auditOpinion")String auditOpinion);
 
 	int updateRefusedCustomer(@Param("id")String id,  @Param("nickname")String nickname, @Param("mobile")String mobile, @Param("societyTag")String societyTag);
@@ -232,9 +232,9 @@ public interface UserMapper {
 	List<CustomerSimpleBo> selectPrivateCustomerByName(@Param("name")String name,@Param("aid")String aid);
 
 	List<CustomerSimpleBo> selectSignedCustomerByName(@Param("name")String name,@Param("aid")String aid,@Param("type")Integer type);
-	
+
 	List<User> selectUserByRoleName(@Param("roleName1")String roleName1,@Param("roleName2")String roleName2);
-	
+
 	void updateReleaseLock(String time);
 
 	marketingESBo marketingStatistics(@Param("id")String id, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
@@ -260,7 +260,7 @@ public interface UserMapper {
 	int pushUserGuidance(@Param("id")String id, @Param("guidance")Integer guidance);
 
 	/**
-	 * 
+	 *
 	 * @param aid   归属人
 	 * @param level 等级
 	 * @param source 来源
@@ -299,4 +299,7 @@ public interface UserMapper {
 	List<CustomerListOut> selectPrivateOrganizationCustomerList(Map<String,Object> map);
 
 
-}
+
+
+
+}

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

@@ -21,4 +21,4 @@ public interface UserMidMapper {
     int updateByUid(UserMid um);
 
     void updateListByUid(@Param("aid") String aid,@Param("updateFollow") Integer updateFollow, @Param("list")List<String> list);
-}
+}

+ 40 - 4
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -44,6 +44,9 @@
     <result column="agreement_url" jdbcType="VARCHAR" property="agreementUrl" />
     <result column="new_user" jdbcType="INTEGER" property="newUser" />
     <result column="service_content" jdbcType="VARCHAR" property="serviceContent" />
+    <result column="sales_type" jdbcType="INTEGER" property="salesType" />
+    <result column="channel_id" jdbcType="VARCHAR" property="channelId" />
+    <result column="other" jdbcType="VARCHAR" property="other" />
   </resultMap>
   <sql id="Base_Column_List">
     order_no, order_type, creater, create_time, update_time, buyer_id, first_amount,
@@ -52,7 +55,8 @@
     finance_id, technician_id, sign_time, settlement_time, contract_picture_url, contract_no,
     contract_type, contacts, contact_mobile, legal_person, legal_person_tel, proof_count,
     proof_aid, proof_time, proof_status, order_dep, outsource, additional_order, primary_order,
-    old_salesman_id, back_status, agreement_url, new_user, service_content
+    old_salesman_id, back_status, agreement_url, new_user, service_content, sales_type,
+    channel_id, other
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -78,7 +82,8 @@
       proof_aid, proof_time, proof_status,
       order_dep, outsource, additional_order,
       primary_order, old_salesman_id, back_status,
-      agreement_url, new_user, service_content
+      agreement_url, new_user, service_content,
+      sales_type, channel_id, other
       )
     values (#{orderNo,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, #{creater,jdbcType=VARCHAR},
       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{buyerId,jdbcType=VARCHAR},
@@ -93,7 +98,8 @@
       #{proofAid,jdbcType=VARCHAR}, #{proofTime,jdbcType=TIMESTAMP}, #{proofStatus,jdbcType=INTEGER},
       #{orderDep,jdbcType=VARCHAR}, #{outsource,jdbcType=INTEGER}, #{additionalOrder,jdbcType=VARCHAR},
       #{primaryOrder,jdbcType=VARCHAR}, #{oldSalesmanId,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER},
-      #{agreementUrl,jdbcType=VARCHAR}, #{newUser,jdbcType=INTEGER}, #{serviceContent,jdbcType=VARCHAR}
+      #{agreementUrl,jdbcType=VARCHAR}, #{newUser,jdbcType=INTEGER}, #{serviceContent,jdbcType=VARCHAR},
+      #{salesType,jdbcType=INTEGER}, #{channelId,jdbcType=VARCHAR}, #{other,jdbcType=VARCHAR}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderNew">
@@ -225,6 +231,15 @@
       <if test="serviceContent != null">
         service_content,
       </if>
+      <if test="salesType != null">
+        sales_type,
+      </if>
+      <if test="channelId != null">
+        channel_id,
+      </if>
+      <if test="other != null">
+        other,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="orderNo != null">
@@ -353,6 +368,15 @@
       <if test="serviceContent != null">
         #{serviceContent,jdbcType=VARCHAR},
       </if>
+      <if test="salesType != null">
+        #{salesType,jdbcType=INTEGER},
+      </if>
+      <if test="channelId != null">
+        #{channelId,jdbcType=VARCHAR},
+      </if>
+      <if test="other != null">
+        #{other,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderNew">
@@ -481,6 +505,15 @@
       <if test="serviceContent != null">
         service_content = #{serviceContent,jdbcType=VARCHAR},
       </if>
+      <if test="salesType != null">
+        sales_type = #{salesType,jdbcType=INTEGER},
+      </if>
+      <if test="channelId != null">
+        channel_id = #{channelId,jdbcType=VARCHAR},
+      </if>
+      <if test="other != null">
+        other = #{other,jdbcType=VARCHAR},
+      </if>
     </set>
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
@@ -526,7 +559,10 @@
       back_status = #{backStatus,jdbcType=INTEGER},
       agreement_url = #{agreementUrl,jdbcType=VARCHAR},
       new_user = #{newUser,jdbcType=INTEGER},
-      service_content = #{serviceContent,jdbcType=VARCHAR}
+      service_content = #{serviceContent,jdbcType=VARCHAR},
+      sales_type = #{salesType,jdbcType=INTEGER},
+      channel_id = #{channelId,jdbcType=VARCHAR},
+      other = #{other,jdbcType=VARCHAR}
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
 

+ 70 - 0
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -2188,4 +2188,74 @@ inner join(
     <select id="getAllUser" resultType="com.goafanti.common.bo.OutUser">
 		select id,name ,province ,name_mobile nameMobile from user_now
 	</select>
+
+	<select id="channelUserList" resultType="com.goafanti.customer.bo.OutChannelListBo">
+		select
+		a.id id,a.aid,a.nickname name,b.name aName,dg1.name as province,dg2.name as city,
+		dg3.name as area,date_format(um.last_sign_time,'%Y-%m-%d %H:%i:%S') lastSignTime,
+		date_format(a.transfer_time,'%Y-%m-%d %H:%i:%S') as transferTime,
+		date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
+		date_format(um.last_follow_time,'%Y-%m-%d %H:%i:%S') lastFollowTime
+		from user a left join admin b on a.aid=b.id left join organization_identity d on a.id = d.uid
+		left join district_glossory dg1 on d.location_province = dg1.id
+		left join district_glossory dg2 on d.location_city = dg2.id
+		left join district_glossory dg3 on d.location_area = dg3.id
+		left join user_mid um on um.aid=a.aid and um.uid=a.id
+		where a.type= 1   and a.source in(1,2,3)
+		and a.share_type = 4
+		<if test=" name !=null ">
+		and a.nickname = #{name}
+		</if>
+		<if test=" aid !=null ">
+		and a.aid= #{aid}
+		</if>
+		<if test=" province !=null ">
+		and d.location_province= #{province}
+		</if>
+		<if test=" city !=null ">
+		and d.location_city= #{city}
+		</if>
+		<if test=" area !=null ">
+		and d.location_area= #{area}
+		</if>
+		<if test=" type !=null ">
+		and um.channel_type= #{type}
+		</if>
+		<if test=" startDate !=null  and endDate !=null ">
+		and a.transfer_time between #{startDate} and #{endDate}
+		</if>
+		order by  a.transfer_time,a.create_time desc
+		<if test="page_sql != null">
+			${page_sql}
+		</if>
+	</select>
+	<select id="channelUserCout" resultType="integer">
+		select
+		count(*)
+		from user a left join admin b on a.aid=b.id left join organization_identity d on a.id = d.uid
+		left join user_mid um on um.aid=a.aid and um.uid=a.id
+		where a.type= 1   and a.source in(1,2,3)
+		and a.share_type = 0
+		<if test=" name !=null ">
+			and a.nickname = #{name}
+		</if>
+		<if test=" aid !=null ">
+			and a.aid= #{aid}
+		</if>
+		<if test=" province !=null ">
+			and d.location_province= #{province}
+		</if>
+		<if test=" city !=null ">
+			and d.location_city= #{city}
+		</if>
+		<if test=" area !=null ">
+			and d.location_area= #{area}
+		</if>
+		<if test=" type !=null ">
+			and um.channel_type= #{type}
+		</if>
+		<if test=" startDate !=null  and endDate !=null ">
+			and a.transfer_time between #{startDate} and #{endDate}
+		</if>
+	</select>
 </mapper>

+ 32 - 15
src/main/java/com/goafanti/common/mapper/UserMidMapper.xml

@@ -12,13 +12,14 @@
     <result column="update_aid" jdbcType="VARCHAR" property="updateAid" />
     <result column="update_name" jdbcType="VARCHAR" property="updateName" />
     <result column="date_update_time" jdbcType="TIMESTAMP" property="dateUpdateTime" />
+    <result column="channel_type" jdbcType="INTEGER" property="channelType" />
   </resultMap>
   <sql id="Base_Column_List">
-    id, `uid`, aid, last_follow_time, last_sign_time, create_time, big_customer, update_aid, 
-    update_name, date_update_time
+    id, `uid`, aid, last_follow_time, last_sign_time, create_time, big_customer, update_aid,
+    update_name, date_update_time, channel_type
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from user_mid
     where id = #{id,jdbcType=INTEGER}
@@ -27,19 +28,22 @@
     delete from user_mid
     where id = #{id,jdbcType=INTEGER}
   </delete>
-  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.UserMid" useGeneratedKeys="true">
-    insert into user_mid (`uid`, aid, last_follow_time, 
-      last_sign_time, create_time, big_customer, 
-      update_aid, update_name, date_update_time
-      )
-    values (#{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{lastFollowTime,jdbcType=TIMESTAMP}, 
-      #{lastSignTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{bigCustomer,jdbcType=INTEGER}, 
-      #{updateAid,jdbcType=VARCHAR}, #{updateName,jdbcType=VARCHAR}, #{dateUpdateTime,jdbcType=TIMESTAMP}
-      )
+  <insert id="insert" parameterType="com.goafanti.common.model.UserMid">
+    insert into user_mid (id, `uid`, aid,
+      last_follow_time, last_sign_time, create_time,
+      big_customer, update_aid, update_name,
+      date_update_time, channel_type)
+    values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
+      #{lastFollowTime,jdbcType=TIMESTAMP}, #{lastSignTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
+      #{bigCustomer,jdbcType=INTEGER}, #{updateAid,jdbcType=VARCHAR}, #{updateName,jdbcType=VARCHAR},
+      #{dateUpdateTime,jdbcType=TIMESTAMP}, #{channelType,jdbcType=INTEGER})
   </insert>
-  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.UserMid" useGeneratedKeys="true">
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.UserMid">
     insert into user_mid
     <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
       <if test="uid != null">
         `uid`,
       </if>
@@ -67,8 +71,14 @@
       <if test="dateUpdateTime != null">
         date_update_time,
       </if>
+      <if test="channelType != null">
+        channel_type,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
       <if test="uid != null">
         #{uid,jdbcType=VARCHAR},
       </if>
@@ -96,6 +106,9 @@
       <if test="dateUpdateTime != null">
         #{dateUpdateTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="channelType != null">
+        #{channelType,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserMid">
@@ -128,6 +141,9 @@
       <if test="dateUpdateTime != null">
         date_update_time = #{dateUpdateTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="channelType != null">
+        channel_type = #{channelType,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -141,7 +157,8 @@
       big_customer = #{bigCustomer,jdbcType=INTEGER},
       update_aid = #{updateAid,jdbcType=VARCHAR},
       update_name = #{updateName,jdbcType=VARCHAR},
-      date_update_time = #{dateUpdateTime,jdbcType=TIMESTAMP}
+      date_update_time = #{dateUpdateTime,jdbcType=TIMESTAMP},
+      channel_type = #{channelType,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
   <update id="updateByUid" parameterType="com.goafanti.common.model.UserMid">
@@ -209,4 +226,4 @@
       #{item}
     </foreach>
   </update>
-</mapper>
+</mapper>

+ 39 - 0
src/main/java/com/goafanti/common/model/TOrderNew.java

@@ -219,6 +219,21 @@ public class TOrderNew implements Serializable {
      */
     private String serviceContent;
 
+    /**
+     * 销售类型 0=电话新开发,1=电话自带资源,2=网络,3=渠道,4=转介绍,5=其他,6=高新复购,7=其他复购
+     */
+    private Integer salesType;
+
+    /**
+     * 渠道客户编号
+     */
+    private String channelId;
+
+    /**
+     * 销售其他描述
+     */
+    private String other;
+
     private static final long serialVersionUID = 1L;
 
     public String getOrderNo() {
@@ -556,4 +571,28 @@ public class TOrderNew implements Serializable {
     public void setServiceContent(String serviceContent) {
         this.serviceContent = serviceContent;
     }
+
+    public Integer getSalesType() {
+        return salesType;
+    }
+
+    public void setSalesType(Integer salesType) {
+        this.salesType = salesType;
+    }
+
+    public String getChannelId() {
+        return channelId;
+    }
+
+    public void setChannelId(String channelId) {
+        this.channelId = channelId;
+    }
+
+    public String getOther() {
+        return other;
+    }
+
+    public void setOther(String other) {
+        this.other = other;
+    }
 }

+ 13 - 0
src/main/java/com/goafanti/common/model/UserMid.java

@@ -58,6 +58,11 @@ public class UserMid implements Serializable {
      */
     private Date dateUpdateTime;
 
+    /**
+     * 渠道类别 1=政府部门,2=民主党派3=园区,4=民间组织,5=其他战略合作单位
+     */
+    private Integer channelType;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -139,4 +144,12 @@ public class UserMid implements Serializable {
     public void setDateUpdateTime(Date dateUpdateTime) {
         this.dateUpdateTime = dateUpdateTime;
     }
+
+    public Integer getChannelType() {
+        return channelType;
+    }
+
+    public void setChannelType(Integer channelType) {
+        this.channelType = channelType;
+    }
 }

+ 55 - 0
src/main/java/com/goafanti/customer/bo/InputAddCustomer.java

@@ -1,19 +1,74 @@
 package com.goafanti.customer.bo;
 
+import com.goafanti.common.constant.ErrorConstants;
+
+import javax.validation.constraints.NotNull;
+
 public class InputAddCustomer {
+
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private String name;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private String contacts;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private String contactMobile;
+
     private Integer type;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private Integer province;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private Integer city;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private Integer area;
     private Integer source;
     private String societyTag;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private String position;
     private Integer industry;
     private String businessScope;
     private String intendedProject;
+    /**
+     * 简介
+     */
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String introduction;
+
+    /**
+     * 共享类型 0=私有 1=公共 2=签单 3=外联 4=渠道
+     */
+    private Integer   shareType;
+
+    /**
+     *  渠道类别:1=政府部门,2=民主党派3=园区,4=民间组织,5=其他战略合作单位
+     */
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private Integer   channelType;
+
+
+
+    public Integer getChannelType() {
+        return channelType;
+    }
+
+    public void setChannelType(Integer channelType) {
+        this.channelType = channelType;
+    }
+
+    public Integer getShareType() {
+        return shareType;
+    }
+
+    public void setShareType(Integer shareType) {
+        this.shareType = shareType;
+    }
+
+    public String getIntroduction() {
+        return introduction;
+    }
+
+    public void setIntroduction(String introduction) {
+        this.introduction = introduction;
+    }
 
     public String getIntendedProject() {
         return intendedProject;

+ 111 - 0
src/main/java/com/goafanti/customer/bo/InputChannelListBo.java

@@ -0,0 +1,111 @@
+package com.goafanti.customer.bo;
+
+public class InputChannelListBo {
+
+
+    /** 客户名称 **/
+    private String name;
+    /** 省 **/
+    private Integer province;
+
+    /** 市 **/
+    private Integer city;
+
+    /** 区 **/
+    private Integer area;
+
+    /** 跟进人 **/
+    private String aid;
+
+    /** 类别 **/
+    private Integer type;
+    /** 开始时间 **/
+    private String startDate;
+
+    /** 结束时间 **/
+    private String endDate;
+
+    private Integer pageSize;
+
+    private Integer pageNo;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getProvince() {
+        return province;
+    }
+
+    public void setProvince(Integer province) {
+        this.province = province;
+    }
+
+    public Integer getCity() {
+        return city;
+    }
+
+    public void setCity(Integer city) {
+        this.city = city;
+    }
+
+    public Integer getArea() {
+        return area;
+    }
+
+    public void setArea(Integer area) {
+        this.area = area;
+    }
+
+    public String getAid() {
+        return aid;
+    }
+
+    public void setAid(String aid) {
+        this.aid = aid;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(String startDate) {
+        this.startDate = startDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+}

+ 40 - 0
src/main/java/com/goafanti/customer/bo/InputChannelState.java

@@ -0,0 +1,40 @@
+package com.goafanti.customer.bo;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum InputChannelState {
+    name("name","名称"),
+    contacts("contacts","联系人"),
+    contactMobile("contactMobile","联系人电话"),
+    province("province","省"),
+    city("city","市"),
+    area("area","区"),
+    introduction("introduction","简介"),
+    position("position","职位"),
+    channelType("channelType","渠道分类");
+
+
+    private String code;
+    private String desc;
+
+     InputChannelState(String code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+
+    private static Map<String ,InputChannelState> status=new HashMap<String,InputChannelState>();
+
+    static {
+        for (InputChannelState value : InputChannelState.values()) {
+            status.put(value.code,value);
+        }
+    }
+
+    public static String getDesc(String code) {
+        for (InputChannelState value : InputChannelState.values()) {
+            if (value.code.equals(code))return value.desc;
+        }
+        return "**";
+    }
+}

+ 112 - 0
src/main/java/com/goafanti/customer/bo/OutChannelListBo.java

@@ -0,0 +1,112 @@
+package com.goafanti.customer.bo;
+
+public class OutChannelListBo {
+
+    private String id;
+    private String name;
+    /** 省 **/
+    private String province;
+
+    /** 市 **/
+    private String city;
+
+    /** 区 **/
+    private String area;
+
+    /** 类别 **/
+    private Integer type;
+
+    /**
+     * 创建时间
+     */
+    private String createTime;
+    /*客户转换时间*/
+    private String transferTime;
+    /*最后跟进时间*/
+    private String lastFollowTime;
+    /*剩余天数*/
+    private String RemainingDays;
+
+    public String getRemainingDays() {
+        return RemainingDays;
+    }
+
+    public void setRemainingDays(String remainingDays) {
+        RemainingDays = remainingDays;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setArea(String area) {
+        this.area = area;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getTransferTime() {
+        return transferTime;
+    }
+
+    public void setTransferTime(String transferTime) {
+        this.transferTime = transferTime;
+    }
+
+    public String getLastFollowTime() {
+        return lastFollowTime;
+    }
+
+    public void setLastFollowTime(String lastFollowTime) {
+        this.lastFollowTime = lastFollowTime;
+    }
+
+
+}

+ 150 - 117
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -17,9 +17,12 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.goafanti.common.enums.AchievementFields;
 import com.goafanti.customer.bo.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -59,7 +62,7 @@ public class AdminCustomerApiController extends BaseApiController{
 	private String	uploadPrivatePath	= null;
 	@Resource
 	private AdminService adminService;
-	
+
 	@Value(value = "${aesSecretKey}")
 	private String							secretKey	= null;
 
@@ -70,7 +73,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listPrivatePersonalCustomer(cli, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 公共个人客户列表 **/
 	@RequestMapping(value = "/listPublicPersonalCustomer" , method = RequestMethod.POST)
 	public Result listPublicPersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
@@ -86,7 +89,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listAllPersonalCustomer(cli, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 签单的个人客户 **/
 	@RequestMapping(value = "/listSignPersonalCustomer", method = RequestMethod.POST)
 	public Result listSignPersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
@@ -94,7 +97,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listSignPersonalCustomer(cli, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 管理个人客户查询 **/
 	@RequestMapping(value = "/listAllManagePersonalCustomer" , method = RequestMethod.POST)
 	public Result listAllManagePersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
@@ -105,7 +108,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listAllManagePersonalCustomer(cli, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 专家查询 **/
 	@RequestMapping(value = "/listExpertCustomer" , method = RequestMethod.POST)
 	public Result listExpertCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
@@ -113,7 +116,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listAllManagePersonalCustomer(cli, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 个人客户详情信息 **/
 	@RequestMapping(value = "/findPersonalCustomerDetail" ,method = RequestMethod.GET)
 	public Result findPersonalCustomerDetail(String uid){
@@ -121,10 +124,10 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findPersonalCustomerDetail(uid));
 		return res;
 	}
-	
+
 	/**
 	 *  私有单位客户列表
-	 *  私有客户列表 
+	 *  私有客户列表
 	 **/
 	@RequestMapping(value = "/listPrivateOrganizationCustomer" , method = RequestMethod.POST)
 	public Result listPrivateOrganizationCustomer(CustomerListIn cli ,Integer sort,Integer sortType,Integer pageNo, Integer pageSize){
@@ -133,9 +136,20 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listPrivateOrganizationCustomer(cli, sort, sortType, 0, pageNo, pageSize));
 		return res;
 	}
-	
 
-	
+	/**
+	 *  渠道客户列表
+	 *
+	 **/
+	@RequestMapping(value = "/channelUserList" , method = RequestMethod.GET)
+	public Result channelUserList(InputChannelListBo in ){
+		Result res = new Result();
+		res.setData(customerService.channelUserList(in));
+		return res;
+	}
+
+
+
 	/** 跟进管理列表
 	 *  跟进列表
 	 **/
@@ -145,14 +159,14 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listPrivateOrganizationCustomer(cli, sort, sortType, 1, pageNo, pageSize));
 		return res;
 	}
-	/** 
+	/**
 	 * 私有单位客户导出xls
-	 * @throws IOException 
+	 * @throws IOException
 	 */
 	@RequestMapping(value = "/privateUnitCustomerOutXls" , method = RequestMethod.GET)
 	public Result privateUnitCustomerOutXls(CustomerListIn cli ,Integer sort,Integer sortType,Integer pageNo, Integer pageSize,HttpServletResponse response) throws IOException{
 		Result res = new Result();
- 		
+
  		XSSFWorkbook wb = customerService.privateUnitCustomerOutXls(cli, sort, sortType, pageNo, pageSize);
  		 String fileName = "我的客户列表  " + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + ".xls";
 		 OutputStream out = null;
@@ -161,8 +175,8 @@ public class AdminCustomerApiController extends BaseApiController{
 		} catch (IOException e) {
 			e.printStackTrace();
 		}
-		 response.addHeader("Content-Disposition", "attachment;filename="  + new String(fileName.getBytes(),"iso-8859-1"));  
-         response.setContentType("application/octet-stream;charset=utf-8");  
+		 response.addHeader("Content-Disposition", "attachment;filename="  + new String(fileName.getBytes(),"iso-8859-1"));
+         response.setContentType("application/octet-stream;charset=utf-8");
 		try {
 			// 返回数据流
 			wb.write(out);
@@ -172,11 +186,11 @@ public class AdminCustomerApiController extends BaseApiController{
 			out.flush();
 			out.close();
 		}
-		
+
 		return res;
-		
+
 	}
-	
+
 	/** 公共单位客户列表 **/
 	@RequestMapping(value = "/listPublicOrganizationCustomer" , method = RequestMethod.POST)
 	public Result listPublicOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
@@ -192,7 +206,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listAllOrganizationCustomer(cli, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 管理单位客户查询 **/
 	@RequestMapping(value = "/listAllManageOrganizationCustomer" , method = RequestMethod.POST)
 	public Result listAllManageOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
@@ -200,7 +214,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listAllManageOrganizationCustomer(cli, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 签单的单位客户 **/
 	@RequestMapping(value = "/listSignOrganizationCustomer", method = RequestMethod.POST)
 	public Result listSignOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
@@ -208,8 +222,8 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listSignOrganizationCustomer(cli, pageNo, pageSize));
 		return res;
 	}
-	
-	
+
+
 	/** 签单客户转交 **/
 	@RequestMapping(value = "/customerHandOver", method = RequestMethod.POST)
 	public Result listSignPersonalCustomer(String userIds ,String receiveId){
@@ -218,7 +232,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		return res;
 	}
 
-	
+
 	/** 客户即时检索 **/
 	@RequestMapping(value = "/findCustomerByName",method = RequestMethod.GET)
 	public Result findCustomerByName(String name){
@@ -226,7 +240,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findCustomerByName(name));
 		return res;
 	}
-	
+
 	/** 客户即时检索(可签单客户) **/
 	@RequestMapping(value = "/getCustomerByName",method = RequestMethod.GET)
 	public Result getCustomerByName(String name,Integer type){
@@ -241,7 +255,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		if(type == 2) res.setData(customerService.getChannelCustomerByName(name));
 		return res;
 	}
-	
+
 	/** 客户查询 **/
 	@RequestMapping(value = "/getUserByName",method = RequestMethod.GET)
 	public Result getUserByName(String name){
@@ -254,7 +268,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(customerService.getUserByName(name));
 		return res;
 	}
-	
+
 	/** 客户查询 **/
 	@RequestMapping(value = "/getUserByNames",method = RequestMethod.GET)
 	public Result getUserByName(String name,Integer pageNo,Integer pageSize){
@@ -267,12 +281,12 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(customerService.getUserByNames(name,pageNo,pageSize));
 		return res;
 	}
-	
-	/** 添加客户基本信息  
-	 * @throws Exception 
+
+	/** 添加客户基本信息
+	 * @throws Exception
 	 * @throws NumberFormatException **/
 	@RequestMapping(value = "/addCustomer", method = RequestMethod.POST)
-	public Result addCustomer(InputAddCustomer in) throws Exception{
+	public Result addCustomer(InputAddCustomer in) {
 		Result res = new Result();
 		if(StringUtils.isBlank(in.getName()) || StringUtils.isBlank(in.getContacts())
 				|| StringUtils.isBlank(in.getContactMobile()) ||null==in.getProvince()||null==in.getCity()||null==in.getArea()
@@ -285,13 +299,31 @@ public class AdminCustomerApiController extends BaseApiController{
 			res.getError().add(buildError("","私有客户已达最大限制"));
 			return res;
 		}
+		//新增为私有客户
+		in.setShareType(0);
+		//将新增客户的空格去除
+		res.data(customerService.addCustomer(in));
+		return res;
+	}
+
+	@RequestMapping(value = "/addChannel", method = RequestMethod.POST)
+	public Result addChannel(@Validated InputAddCustomer in, BindingResult bindingResult) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					InputChannelState.getDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+		in.setType(1);
+		//新增为私有客户
+		in.setShareType(4);
 		//将新增客户的空格去除
 		res.data(customerService.addCustomer(in));
 		return res;
 	}
-	
-	
-	
+
+
+
 	/** 单位客户详情信息 **/
 	@RequestMapping(value = "/findOrganizationCustomerDetail", method = RequestMethod.GET)
 	public Result findOrganizationCustomerDetail(String uid){
@@ -299,7 +331,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findOrganizationCustomerDetail(uid));
 		return res;
 	}
-	
+
 	/** 修改单位客户信息 **/
 	@RequestMapping(value = "/updateOrganizationCustomer", method = RequestMethod.POST)
 	public Result updateOrganizationCustomer(CustomerOrganizationDetailBo bo){
@@ -307,11 +339,11 @@ public class AdminCustomerApiController extends BaseApiController{
 		if(StringUtils.isBlank(bo.getId()) || StringUtils.isBlank(bo.getUid())){
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
 			return res;
-		} 
+		}
 		customerService.updateOrganizationCustomer(bo);
 		return res;
 	}
-	
+
 	/** 修改个人客户信息 **/
 	@RequestMapping(value = "/updatePersonalCustomer", method = RequestMethod.POST)
 	public Result updatePersonalCustomer(CustomerPersonalDetailBo bo){
@@ -323,7 +355,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updatePersonalCustomer(bo);
 		return res;
 	}
-	
+
 	/** 查看跟进记录 **/
 	@RequestMapping(value = "/listFollowHistory", method = RequestMethod.GET)
 	public Result listFollowHistory(Integer pageNo, Integer pageSize,String uid,String businessProjectId,Integer type){
@@ -331,7 +363,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listFollowHistory(pageNo,pageSize,uid,businessProjectId,type));
 		return res;
 	}
-	
+
 	/** 指导已读 **/
 	@RequestMapping(value = "/pushGuidance", method = RequestMethod.POST)
 	public Result pushGuidance(String uid){
@@ -343,7 +375,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.pushGuidance(uid));
 		return res;
 	}
-	
+
 	/** 新增指导意见 **/
 	@RequestMapping(value = "/addGuidance", method = RequestMethod.POST)
 	public Result addGuidance(String followId,String guidance){
@@ -355,7 +387,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.addGuidance( followId, guidance));
 		return res;
 	}
-	
+
 	/** 查看客户账户信息 **/
 	@RequestMapping(value = "/findUserAccountDetail", method = RequestMethod.GET)
 	public Result findUserAcountDetail(String uid){
@@ -372,7 +404,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(bo);
 		return res;
 	}
-	
+
 	/** 修改客户账户信息 **/
 	@RequestMapping(value = "/updateUserAccount", method = RequestMethod.POST)
 	public Result updateUserAccount(User user){
@@ -388,7 +420,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findCustomerContacts(uid));
 		return res;
 	}
-	
+
 	/** 针对已作拜访的业务作跟进 **/
 	@RequestMapping(value = "/toAddFollowOnHistory", method = RequestMethod.GET)
 	public Result toAddFollowOnHistory(String uid){
@@ -407,7 +439,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(fbb);
 		return res;
 	}
-	
+
 	/** 针对已锁定的业务作跟进 **/
 	@RequestMapping(value = "/toAddFollowOnLock", method = RequestMethod.GET)
 	public Result toAddFollowOnLock(String uid){
@@ -426,9 +458,9 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(fbb);
 		return res;
 	}
-	
-	/** 添加拜访记录 
-	 * @throws ParseException 
+
+	/** 添加拜访记录
+	 * @throws ParseException
 	 * @throws Exception **/
 	@RequestMapping(value = "/addFollow", method = RequestMethod.POST)
 	public Result addFollow(String userBusinessList,String uid,String ocbId,String contactType,String result,String followTime)  throws BusinessException{
@@ -458,11 +490,11 @@ public class AdminCustomerApiController extends BaseApiController{
 		fbb.setContactType(contactType);
 		fbb.setResult(result);
 		fbb.setFollowTime(followTime);
-		fbb.setUserBusinessList(list);	
+		fbb.setUserBusinessList(list);
 		customerService.addFollow(fbb,null,1);
 		return res;
 	}
-	
+
 	/** 进入修改拜访记录 **/
 	@RequestMapping(value = "/toUpdateFollow", method = RequestMethod.GET)
 	public Result toUpdateFollow(String followId){
@@ -472,10 +504,10 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(fbb);
 		return res;
 	}
-	
-	/** 修改拜访记录 
-	 * @throws ParseException 
-	 * @throws BusinessException 
+
+	/** 修改拜访记录
+	 * @throws ParseException
+	 * @throws BusinessException
 	 */
 	@RequestMapping(value = "/updateFollow", method = RequestMethod.POST)
 	public Result updateFollow(String userBusinessList,String followId,String followTime,String uid,String contactType,String result) throws BusinessException{
@@ -504,12 +536,12 @@ public class AdminCustomerApiController extends BaseApiController{
 		fbb.setUid(uid);
 		fbb.setContactType(contactType);
 		fbb.setResult(result);
-		fbb.setUserBusinessList(list);	
+		fbb.setUserBusinessList(list);
 		fbb.setFollowId(followId);
 		customerService.updateFollow(fbb);
 		return res;
 	}
-	
+
 	/** 删除跟进记录 **/
 	@RequestMapping(value = "/deleteFollow", method = RequestMethod.GET)
 	public Result deleteFollow(String followId){
@@ -521,15 +553,15 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.deleteFollow(followId);
 		return res;
 	}
-	
-	/** 查询客户的所有联系人 **/ 
+
+	/** 查询客户的所有联系人 **/
 	@RequestMapping(value = "/findAllContacts", method = RequestMethod.GET)
 	public Result findAllContacts(String uid){
 		Result res = new Result();
 		res.setData(customerService.findAllContacts(uid));
 		return res;
 	}
-	
+
 	/** 修改企业联系人 **/
 	@RequestMapping(value = "/updateCustomerContacts", method = RequestMethod.POST)
 	public Result updateCustomerContacts(String contactList,String uid){
@@ -555,7 +587,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateCustomerContacts(ocbList,uid);
 		return res;
 	}
-	
+
 	/** 领取客户 **/
 	@RequestMapping(value = "/receiveCustomer", method = RequestMethod.GET)
 	public Result receiveCustomer(String uid,String oldAid){
@@ -568,7 +600,7 @@ public class AdminCustomerApiController extends BaseApiController{
 			res.getError().add(buildError("","私有客户已达最大限制"));
 			return res;
 		}
-		
+
 		if (customerService.checkBeforeChannel(uid)) {
 			res.getError().add(buildError("","渠道客户丢失后不可再领取"));
 			return res;
@@ -576,7 +608,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateByOperatorType(uid,null, oldAid,AFTConstants.USER_RECEIVE,null);
 		return res;
 	}
-	
+
 	/**
 	 * 上传excel文档
 	 * @param req
@@ -613,7 +645,7 @@ public class AdminCustomerApiController extends BaseApiController{
 				customerService.saveUploadData(boSet);
 			} catch (IOException e) {
 				e.printStackTrace();
-			}	
+			}
 		return res;
 	}
 	/**
@@ -645,7 +677,7 @@ public class AdminCustomerApiController extends BaseApiController{
 			}
 		return res;
 	}
-	
+
 	/** 转为公共客户 **/
 	@RequestMapping(value = "/transferToPublic", method = RequestMethod.GET)
 	public Result transferToPublic(String uid,String aid){
@@ -656,7 +688,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateByOperatorType(uid, aid,null, AFTConstants.USER_TRANSFER_TO_PUBLIC,null);
 		return res;
 	}
-	
+
 	/** 图片上传 **/
 	@RequestMapping(value = "/uploadCustomerImg", method = RequestMethod.POST)
 	public Result uploadCustomerImg(HttpServletRequest req,String sign){
@@ -664,9 +696,9 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(handleFile(res, "/customer_sys_file/", false, req, sign));
 		return res;
 	}
-	
+
 	/**
-	 * 
+	 *
 	 * @param startDate 开始日期
 	 * @param endDate 结束日期
 	 * @param timeSpan 时间差
@@ -696,14 +728,14 @@ public class AdminCustomerApiController extends BaseApiController{
 				sDate = DateUtils.getLastDayOfLastQuarter(date);
 			}else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
 				sDate = DateUtils.getLastDayOfLastYear(date);
-			}		
+			}
 		}
 		res.setData(customerService.customerStatistics(sDate,eDate,depNo,businessGlossoryId,pageNo,pageSize));
 		return res;
 	}
-	
+
 	/**
-	 * 
+	 *
 	 * @param startDate 开始日期
 	 * @param endDate 结束日期
 	 * @param timeSpan 时间差
@@ -712,7 +744,7 @@ public class AdminCustomerApiController extends BaseApiController{
 	 * @param pageNo 页码
 	 * @param pageSize 页数
 	 * @return
-	 * @throws ParseException 
+	 * @throws ParseException
 	 */
 	@RequestMapping(value = "/businessStatistic", method = RequestMethod.GET)
 	public Result businessStatistic(String startDate,String endDate,String timeSpan,String depNo,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
@@ -734,14 +766,14 @@ public class AdminCustomerApiController extends BaseApiController{
 				sDate = DateUtils.getLastDayOfLastQuarter(date);
 			}else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
 				sDate = DateUtils.getLastDayOfLastYear(date);
-			}		
+			}
 		}
 		res.setData(customerService.businessStatistic(sDate,eDate,depNo,businessGlossoryId,pageNo,pageSize));
 		return res;
 	}
-	
+
 	/**
-	 * 
+	 *
 	 * @param startDate 开始日期
 	 * @param endDate 结束日期
 	 * @param timeSpan 时间差
@@ -772,12 +804,12 @@ public class AdminCustomerApiController extends BaseApiController{
 				sDate = DateUtils.getLastDayOfLastQuarter(date);
 			}else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
 				sDate = DateUtils.getLastDayOfLastYear(date);
-			}		
+			}
 		}
 		res.setData(customerService.followStatistic(sDate, eDate, depNo, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 管理员列表 **/
 	@RequestMapping(value = "/listAdminByName",method = RequestMethod.GET)
 	public Result listAdminByName(String adminName){
@@ -806,7 +838,8 @@ public class AdminCustomerApiController extends BaseApiController{
 				if (operatorType==null) {
 					operatorType=AFTConstants.USER_TRANSFER_TO_OTHER;
 				}
-		if (operatorType !=AFTConstants.SIGN_USER_TRANSFER_TO_OTHER&& customerService.checkMax(aid)) {
+		if ((operatorType ==AFTConstants.USER_TRANSFER_TO_OTHER||operatorType ==AFTConstants.USER_RECEIVE)
+				&& customerService.checkMax(aid)) {
 			res.getError().add(buildError("","对方私有客户已达最大限制"));
 			return res;
 		}
@@ -818,9 +851,9 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateByOperatorType(uid,aid,oldAid,operatorType,data);
 		return res;
 	}
-	
+
 	/**
-	   *   客户转交记录 
+	   *   客户转交记录
 	 * @param uid 客户编号
 	 * @return
 	 */
@@ -834,7 +867,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(customerService.transferList( uid));
 		return res;
 	}
-	
+
 	/** 查询我的业务列表 **/
 	@RequestMapping(value = "/listBusiness", method = RequestMethod.POST)
 	public Result listBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
@@ -842,7 +875,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listBusiness(blo, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 查询所有的业务列表 **/
 	@RequestMapping(value = "/listAllBusiness", method = RequestMethod.POST)
 	public Result listAllBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
@@ -850,7 +883,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listAllBusiness(blo, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 业务管理列表 **/
 	@RequestMapping(value = "/listManageBusiness", method = RequestMethod.POST)
 	public Result listManageBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
@@ -858,7 +891,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listManageBusiness(blo, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 查询业务字典 **/
 	@RequestMapping(value = "/findBusinessGlossory",method = RequestMethod.GET)
 	public Result findBusinessGlossory(){
@@ -874,7 +907,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		if(StringUtils.isBlank(bfb.getBusinessProjectId()) || StringUtils.isBlank(bfb.getUid())){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
 			return res;
-		}		
+		}
 		if(customerService.judgeBusiness(bfb.getUid(), bfb.getBusinessProjectId())>0){
 			res.getError().add(new Error("该项业务已经被跟进"));
 			return res;
@@ -886,7 +919,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		}
 		return res;
 	}
-	
+
 	/** 进入新增意向服务 **/
 	@RequestMapping(value = "/toAddBusinessAndFollow", method = RequestMethod.GET)
 	public Result toAddBusinessAndFollow(){
@@ -899,7 +932,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(bo);
 		return res;
 	}
-	
+
 	/** 进入修改业务意向 **/
 	@RequestMapping(value = "/toUpdateBusiness", method = RequestMethod.GET)
 	public Result toUpdateBusiness(String businessId){
@@ -907,7 +940,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findBusinessDetail(businessId));
 		return res;
 	}
-	
+
 	/** 修改业务意向 **/
 	@RequestMapping(value = "/updateBusiness", method = RequestMethod.POST)
 	public Result updateBusiness(BussinessFollowBo bfb){
@@ -915,7 +948,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateBusiness(bfb);
 		return res;
 	}
-	
+
 	/** 进入跟进单个客户意向 **/
 	@RequestMapping(value = "/toAddFollowOneBusiness", method = RequestMethod.GET)
 	public Result toAddFollowOneBusiness(String businessId){
@@ -926,7 +959,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(bo);
 		return res;
 	}
-	
+
 	/** 跟进单个客户意向 **/
 	@RequestMapping(value = "/addFollowOneBusiness", method = RequestMethod.POST)
 	public Result addFollowOneBusiness(BussinessFollowBo bfb){
@@ -943,7 +976,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		}
 		return res;
 	}
-	
+
 	/** 进入修改某个客户一个业务的当次拜访 **/
 	@RequestMapping(value = "/toUpdateFollowOneBusiness", method = RequestMethod.GET)
 	public Result toUpdateFollowOneBusiness(String ufbId){
@@ -955,7 +988,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findFollowOneBusiness(ufbId));
 		return res;
 	}
-	
+
 	/** 修改某个客户一个业务的当次拜访 **/
 	@RequestMapping(value = "/updateFollowOneBusiness", method = RequestMethod.POST)
 	public Result updateFollowOneBusiness(BussinessFollowBo bfb){
@@ -967,7 +1000,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateFollowOneBusiness(bfb);
 		return res;
 	}
-	
+
 	/** 删除某个客户一个业务的当次拜访 **/
 	@RequestMapping(value = "/deleteFollowOneBusiness", method = RequestMethod.GET)
 	public Result deleteFollowOneBusiness(String ufbId){
@@ -979,7 +1012,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.deleteFollowOneBusiness(ufbId);
 		return res;
 	}
-	
+
 	/** 添加单个联系人 **/
 	@RequestMapping(value = "/addOneContact", method = RequestMethod.POST)
 	public Result addOneContact(OrganizationContactBook ocb){
@@ -995,7 +1028,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.addOneContact(ocb);
 		return res;
 	}
-	
+
 	/** 删除单个联系人 **/
 	@RequestMapping(value = "/deleteOneContact", method = RequestMethod.GET)
 	public Result deleteOneContact(String ocbId){
@@ -1007,7 +1040,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.deleteOneContact(ocbId);
 		return res;
 	}
-	
+
 	/** 修改主要联系人 **/
 	@RequestMapping(value = "/updateMainContact", method = RequestMethod.GET)
 	public Result updateMainContact(String ocbId,String uid){
@@ -1019,7 +1052,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateMainContact(ocbId,uid);
 		return res;
 	}
-	
+
 	/** 删除 业务 **/
 	@RequestMapping(value = "/deleteBusiness", method =RequestMethod.GET)
 	public Result deleteBusiness(String businessId){
@@ -1031,7 +1064,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.deleteBusiness(businessId);
 		return res;
 	}
-	
+
 	/** 停止业务 **/
 	@RequestMapping(value = "/stopBusiness", method = RequestMethod.GET)
 	public Result stopBusiness(String businessId){
@@ -1043,7 +1076,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updateBusinessToStop(businessId);
 		return res;
 	}
-	
+
 	/** 客户分配查询(本部门) **/
 	@RequestMapping(value = "/findAdminName" , method = RequestMethod.POST)
 	public Result findAdminName(){
@@ -1051,7 +1084,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findAdminName());
 		return res;
 	}
-	
+
 	/** 分配个人客户 **/
 	@RequestMapping(value = "/updatePersonalCustomerz", method = RequestMethod.POST)
 	public Result updatePersonalCustomerz(CustomerPersonalDetailBo bo){
@@ -1063,7 +1096,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		customerService.updatePersonalCustomerz(bo);
 		return res;
 	}
-	
+
 	/** 客户录入审核 **/
 	@RequestMapping(value = "/findEnteringAudit" , method = RequestMethod.POST)
 	public Result findEnteringAudit(CustomerListOut clo,Integer pageNo, Integer pageSize){
@@ -1071,7 +1104,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findEnteringAudit(clo, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 修改客户录入审核状态 **/
 	@RequestMapping(value = "/updateEnteringAudit", method = RequestMethod.POST)
 	public Result updateEnteringAudit(User bo){
@@ -1083,7 +1116,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(customerService.updateEnteringAudit(bo));
 		return res;
 	}
-	
+
 	/** 审核拒绝客户查询 **/
 	@RequestMapping(value = "/findEnteringAuditIsNo" , method = RequestMethod.POST)
 	public Result findEnteringAuditIsNo(CustomerListOut clo,Integer pageNo, Integer pageSize){
@@ -1091,7 +1124,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.findEnteringAuditIsNo(clo, pageNo, pageSize));
 		return res;
 	}
-	
+
 	/** 修改拒绝客户信息 **/
 	@RequestMapping(value = "/updateRefusedCustomer", method = RequestMethod.POST)
 	public Result updateRefusedCustomer(String id,String nickname,String mobile,String societyTag){
@@ -1123,8 +1156,8 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.selectLockedProject(uid));
 		return res;
 	}
-	
-	
+
+
 	/** 客户二次签项目业务 **/
 	@RequestMapping(value = "/againProjectTask", method = RequestMethod.GET)
 	public Result againProjectTask(String uid,String projectId,String aid){
@@ -1143,7 +1176,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		if(StringUtils.isBlank(id) || StringUtils.isBlank(aid)){
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
 			return res;
-		} 
+		}
 		res.data(customerService.updateInformationMaintainerr(id,aid));
 		return res;
 	}
@@ -1176,7 +1209,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(customerService.updateUserLevel(u));
 		return res;
 	}
-	
+
 	/** 释放客户 **/
 	@RequestMapping(value = "/pushReleaseUser", method = RequestMethod.GET)
 	public Result pushReleaseUser(String id){
@@ -1188,10 +1221,10 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(customerService.pushReleaseUser(id));
 		return res;
 	}
-	
+
 	/**
 	 * 企业项目申报材料上传
-	 * 
+	 *
 	 * @param req
 	 * @param uid
 	 * @return
@@ -1209,7 +1242,7 @@ public class AdminCustomerApiController extends BaseApiController{
 	}
 		/**
 	 *  企业项目申报材料预览授权
-	 * 
+	 *
 	 * @param id
 	 * @param sign
 	 * @return
@@ -1246,7 +1279,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(adminService.selectAdminCustomerStatistics( depId,  startTime, endTime,  pageSize,  pageNo));
 		return res;
 	}
-	
+
 	/**
 	 * 查看客户统计
 	 * @param depId 部门编号
@@ -1275,9 +1308,9 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(adminService.selectAdminCustomerList( aid,  startTime, endTime,  type, pageSize,  pageNo));
 		return res;
 	}
-	
+
 	/**
-	 * 
+	 *
 	 * @param inputId 	业务转移客户id(接收者)
 	 * @param uid		被转移的客户
 	 * @param pid		呗转移的业务
@@ -1307,7 +1340,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listChannelCustomer(in));
 		return res;
 	}
-	
+
 	/**
 	 *  渠道客户统计列表
 	 **/
@@ -1317,9 +1350,9 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.listChannelCounts(in));
 		return res;
 	}
-	
+
 	/**
-	 * 	渠道客户转交 
+	 * 	渠道客户转交
 	 * @param userIds 用户编号集
 	 * @param receiveId 接受者
 	 * @param remarks	备注
@@ -1343,11 +1376,11 @@ public class AdminCustomerApiController extends BaseApiController{
 			res.getError().add(buildError("","不允许二次回退"));
 			return res;
 		}
-		
+
 		res.setData(customerService.pushChannelDeliver( uids , receiveId,remarks,type));
 		return res;
 	}
-	
+
 	/** 修改客户名称 **/
 	@RequestMapping(value = "/updateUserName", method = RequestMethod.POST)
 	public Result updateUserName(String uid,String userName){
@@ -1359,7 +1392,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		if(customerService.checkUserName(userName)){
 			res.getError().add(buildError(ErrorConstants.CUSTOMER_ALREADY_EXIST,null,"["+userName+"]"));
 			return res;
-		} 
+		}
 		res.data(customerService.updateUserName(uid,userName));
 		return res;
 	}

+ 67 - 65
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -22,7 +22,7 @@ public interface CustomerService {
 	 * @param pageSize
 	 * @return
 	 */
-	
+
 	Pagination<CustomerListOut> listPrivatePersonalCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize);
 	/**
 	 * 公共个人客户列表查询
@@ -30,43 +30,43 @@ public interface CustomerService {
 	 * @return
 	 */
 	Pagination<CustomerListOut> listPublicPersonalCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize);
-	
-	
+
+
 	/**
 	 * 所有个人客户列表查询
 	 * @param pageSize
 	 * @return
 	 */
 	Pagination<CustomerListOut> listAllPersonalCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 管理个人客户查询(所属人同部门客户管理)
 	 * @param pageSize
 	 * @return
 	 */
 	Pagination<CustomerListOut> listAllManagePersonalCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 私有单位客户列表查询
 	 * @return
 	 */
 	Pagination<CustomerListOut> listPrivateOrganizationCustomer(CustomerListIn cli,Integer sort,Integer sortType,Integer power, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 公共单位客户列表查询
 	 * @param pageSize
 	 * @return
 	 */
 	Pagination<CustomerListOut> listPublicOrganizationCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize);
-	
-	
+
+
 	/**
 	 * 所有单位客户列表查询
 	 * @param pageSize
 	 * @return
 	 */
 	Pagination<CustomerListOut> listAllOrganizationCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 管理单位客户列表查询
 	 * @param pageSize
@@ -80,101 +80,101 @@ public interface CustomerService {
 	 * @return
 	 */
 	List<CustomerSimpleBo> findCustomerByName(String name);
-	
+
 	/**
 	 * 使用客户名检索私有客户
 	 * @param name
 	 * @return
 	 */
 	List<CustomerSimpleBo> getPrivateCustomerByName(String name);
-	
+
 	/**
 	 * 使用客户名称检索已签单客户
 	 * @param name
 	 * @return
 	 */
 	List<CustomerSimpleBo> getSignedCustomerByName(String name);
-	
-	
+
+
 	/**
 	 * 客户全查询
 	 * @param name
 	 * @return
 	 */
 	Object getUserByName(String name);
-	
+
 	/**
 	 * 判断是否存在某个单位客户
 	 * @param name
 	 * @return
 	 */
 	int judgeCustomerByName(String name);
-	
+
 	/**
 	 *
 	 * @return
 	 */
 	int addCustomer(InputAddCustomer in)  throws BusinessException;
-	
-	
+
+
 	/**
 	 * 查询单位客户详情
 	 * @param uid 用户ID
 	 * @return
 	 */
 	CustomerPersonalDetailBo findPersonalCustomerDetail(String uid);
-	
-	
+
+
 	/**
 	 * 查询单位客户详情
 	 * @param uid 用户ID
 	 * @return
 	 */
 	CustomerOrganizationDetailBo findOrganizationCustomerDetail(String uid);
-	
+
 	/**
 	 * 修改单位客户信息
 	 * @param bo
 	 * @return
 	 */
 	int updateOrganizationCustomer(CustomerOrganizationDetailBo bo);
-	
+
 	/**
 	 * 修改个人客户信息
 	 * @param bo
 	 * @return
 	 */
 	int updatePersonalCustomer(CustomerPersonalDetailBo bo);
-	
-	
-	
+
+
+
 	/**
 	 * 查看客户账户信息
 	 * @param uid 客户ID
 	 * @return
 	 */
 	User findUserAccountDetail(String uid);
-	
+
 	/**
 	 * 更新用户基本信息
 	 * @param user
 	 */
 	int updateUserAccount(User user);
-	
+
 	/**
 	 * 客户联系人列表
 	 * @param uid
 	 * @return
 	 */
 	List<OrganizationContactBook> findCustomerContacts(String uid);
-	
+
 	/**
 	 * 添加拜访记录
 	 * @param fbb
 	 * @param mainStatus 0辅助跟进 1主要跟进
 	 */
 	int addFollow(FollowBusinessBo fbb,String ufid,Integer mainStatus) throws BusinessException;
-	
+
 	/**
 	 * 查询拜访记录详情
 	 * @param followId
@@ -188,41 +188,41 @@ public interface CustomerService {
 	 * @return
 	 */
 	List<BusinessListBo> findBusinessByFollowId(String followId);
-	
+
 	/**
 	 * 修改拜访记录
 	 * @param fbb
 	 */
 	int updateFollow(FollowBusinessBo fbb)  throws BusinessException;
-	
+
 	/**
 	 * 查询客户的所有联系人
 	 * @param uid
 	 * @return
 	 */
 	Set<OrganizationContactBook> findAllContacts(String uid);
-	
+
 	/**
 	 * 更新客户联系人
 	 * @param ocbList
 	 * @return
 	 */
 	int updateCustomerContacts(List<OrganizationContactBook> ocbList,String uid);
-	
+
 	/**
 	 * 删除拜访记录
 	 * @param followId
 	 * @return
 	 */
 	int deleteFollow(String followId);
-	
+
 	/**
 	 * 检查客户业务
 	 * @param boSet
 	 * @param existRows
 	 */
 	void checkCustomer(Set<CustomerExcelBo> boSet,Set<Integer> existRows, Set<Integer> filterRows);
-	
+
 	/**
 	 * 保存上传数据
 	 * @param boSet
@@ -236,7 +236,7 @@ public interface CustomerService {
 	 * @return
 	 */
 	int updateByOperatorType(String uid,String aid,String oldAid,Integer operatorType,Integer data);
-	
+
 	/**
 	 * 客户统计
 	 * @param sDate
@@ -244,7 +244,7 @@ public interface CustomerService {
 	 * @return
 	 */
 	Pagination<StatisticBo> customerStatistics(Date sDate, Date eDate, String depNo, String businessGlossoryId, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 业务进度统计
 	 * @param sDate
@@ -252,7 +252,7 @@ public interface CustomerService {
 	 * @return
 	 */
 	Pagination<StatisticBo> businessStatistic(Date sDate, Date eDate, String depNo, String businessGlossoryId,Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 拜访统计
 	 * @param sDate
@@ -260,7 +260,7 @@ public interface CustomerService {
 	 * @return
 	 */
 	Pagination<StatisticBo> followStatistic(Date sDate, Date eDate, String depNo, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 查询我的业务列表
 	 * @param blo
@@ -273,22 +273,22 @@ public interface CustomerService {
 	 * @return
 	 */
 	Pagination<BusinessListBo> listAllBusiness(BusinessListBo blo, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 业务管理列表
 	 * @param blo
 	 * @return
 	 */
 	Pagination<BusinessListBo> listManageBusiness(BusinessListBo blo,Integer pageNo,Integer pageSize);
-	
+
 	/**
 	 *  意向字典
 	 * @return
 	 */
 	List<BusinessListBo> findBusinessGlossory();
-	
+
 	/**
-	 * 
+	 *
 	 * @param uid 客户ID
 	 * @param businessProjectId 业务项目的ID
 	 * @return
@@ -300,7 +300,7 @@ public interface CustomerService {
 	 * @param bfb
 	 */
 	void addBusinessAndFollow(BussinessFollowBo bfb)  throws ParseException ;
-	
+
 	/**
 	 * 查询业务列表
 	 * @param uid 客户ID
@@ -308,7 +308,7 @@ public interface CustomerService {
 	 * @return
 	 */
 	List<BusinessListBo> findBusinessByUAid(String uid,String aid);
-	
+
 	/**
 	 * 查询锁定的业务列表
 	 * @param uid
@@ -386,27 +386,27 @@ public interface CustomerService {
 	 * @return
 	 */
 	int deleteOneContact(String ocbId);
-	
+
 	List<Admin> findAdminName();
-	
+
 	int updatePersonalCustomerz(CustomerPersonalDetailBo bo);
-	
+
 	Pagination<CustomerListOut> findEnteringAudit(CustomerListOut clo, Integer pageNo, Integer pageSize);
-	
+
 	Pagination<CustomerListOut> findEnteringAuditIsNo(CustomerListOut clo, Integer pageNo, Integer pageSize);
-	
+
 	int updateEnteringAudit(User bo);
-	
+
 	/**
 	 * 修改为主要联系人
 	 * @param ocbId
 	 * @return
 	 */
 	int updateMainContact(String ocbId,String uid);
-	
+
 	/** 修改拒绝客户信息 **/
 	int updateRefusedCustomer(String id,String nickname, String mobile, String societyTag);
-	
+
 	/**
 	 * 签单的单位客户
 	 * @param cli
@@ -415,7 +415,7 @@ public interface CustomerService {
 	 * @return
 	 */
 	Pagination<CustomerListOut>  listSignOrganizationCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 签单的个人客户
 	 * @param cli
@@ -424,7 +424,7 @@ public interface CustomerService {
 	 * @return
 	 */
 	Pagination<CustomerListOut> listSignPersonalCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize);
-	
+
 	/**
 	 * 查询需要释放的客户
 	 * @param uid 客户Id
@@ -432,11 +432,11 @@ public interface CustomerService {
 	 * @return
 	 */
 	List<LockingReleaseBo> selectWaitReleaseCustomer(String uid, Integer type);
-	
+
 	List<LockingReleaseBo> selectWaitReleaseBusiness(String uid);
-	
+
 	void updateReleaseLock(Date releaseTime);
-	
+
 	/**
 	 * 查询客户的锁定业务
 	 * @param uid
@@ -445,7 +445,7 @@ public interface CustomerService {
 	List<LockingReleaseBo> selectLockedProject(String uid);
 	/**
 	 * 再次签订项目任务
-	 * @param aid 
+	 * @param aid
 	 * @return
 	 */
 	int updateAgainProjectTask(String uid, String projectId, String aid);
@@ -478,19 +478,19 @@ public interface CustomerService {
 	public  Float countIntegrity(CustomerOrganizationDetailBo bo);
 	XSSFWorkbook privateUnitCustomerOutXls(CustomerListIn cli ,Integer sort,Integer sortType,Integer pageNo, Integer pageSize);
 	int customerHandOver(String userIds, String receiveId);
-	
+
 	List<transferListBo> transferList(String uid);
 	int updatePrivateBusinessTransfer(String inputId, String uid, String pid);
 	int pushReleaseUser(String id);
 	/**
-	 * 
+	 *
 	 * @param id
 	 * @return
 	 */
 	List<userDaysBo> selectReleaseUserDays(String id);
 
 	List<userDaysBo> selectChannelUserDays(String id);
-	
+
 	int addGuidance(String followId, String guidance);
 	/**
 	 * 查看跟进记录列表
@@ -500,18 +500,18 @@ public interface CustomerService {
 	 */
 	Pagination<FollowListBo> listFollowHistory(Integer pageNo, Integer pageSize,String uid,String businessGlossoryId,Integer type);
 	int pushGuidance(String uid);
-	
+
 	boolean checkMax(String aid);
 	/**
-	 * 
+	 *
 	 * @param list 释放客户
 	 * @param type 0 未跟进  1未签单
-	 * @throws InterruptedException 
+	 * @throws InterruptedException
 	 */
 	void pushReleaseLog(List<LockingReleaseBo> list,Integer type) throws InterruptedException;
 	Object listChannelCustomer(InputListChannel in);
 	/**
-	 * 
+	 *
 	 * @param uids 用户集
 	 * @param receiveId 接受者
 	 * @param remarks	备注
@@ -539,4 +539,6 @@ public interface CustomerService {
 	boolean checkData(String uid, String aid);
 
     int updateUserDate(String uid,Integer province, Integer city, Integer area, String businessScope, String intendedProject);
+
+	Pagination<OutChannelListBo> channelUserList(InputChannelListBo in);
 }

+ 84 - 6
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -153,7 +153,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listPrivateOrganizationCustomer(CustomerListIn cli, Integer sort,
-			Integer sortType, Integer type, Integer pageNo, Integer pageSize) {
+			Integer sortType, Integer power, Integer pageNo, Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_ORGANIZATION);
 		cli.setAid(TokenManager.getAdminId());
 //		cli.setAid("1");
@@ -162,7 +162,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		params.put("sort", sort);
 		params.put("sortType", sortType);
 		List<String> alist = new ArrayList<>();
-		if (type == 0 || TokenManager.hasRole(AFTConstants.SALESMAN)) {
+		if (power == 0 || TokenManager.hasRole(AFTConstants.SALESMAN)) {
 			params.put("power", 0);
 		} else if (TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)) {
 			params.put("power", 1);
@@ -185,7 +185,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 				"selectPrivateOrganizationCustomerList", "selectPrivateOrganizationCustomerCount", params, pageNo,
 				pageSize);
 		List<CustomerListOut> tmpList = (List<CustomerListOut>) list.getList();
-		setCustomerList(tmpList, 0, type);
+		setCustomerList(tmpList, 0, power);
 		list.setList(tmpList);
 		return list;
 	}
@@ -315,7 +315,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		user.setNickname(in.getName());
 		user.setUsername(in.getName());
 		user.setStatus(AFTConstants.USER_STATUS_NORMAL);
-		user.setShareType(AFTConstants.NO);
+		user.setShareType(in.getShareType());
 		user.setAid(TokenManager.getAdminId());
 //		user.setAid("1");
 		user.setType(in.getType());
@@ -324,6 +324,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		user.setCreateTime(now);
 		user.setTransferTime(now);
 		user.setUpdateTime(now);
+		if(StringUtils.isNotBlank(in.getIntroduction()))user.setIntroduction(in.getIntroduction());
 		user.setMobile(in.getContactMobile());
 		user.setPassword(AFTConstants.INITIALPASSWORD);
 		user.setInformationMaintainer(TokenManager.getAdminId());
@@ -379,6 +380,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		un.setUid(user.getId());
 		un.setName(user.getNickname());
 		userNamesMapper.insertSelective(un);
+		UserMid um=new UserMid();
+		um.setAid(user.getAid());
+		um.setUid(uid);
+		um.setChannelType(in.getChannelType());
+		userMidMapper.insertSelective(um);
 		// 新增企业联系人
 		OrganizationContactBook cob = new OrganizationContactBook();
 		cob.setAid(TokenManager.getAdminId());
@@ -1170,14 +1176,16 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			organizationContactBookMapper.updateAdmin(uid,aid);
 			//转交
 		} else if (AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
-				|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER == operatorType) {
+				|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER .equals(operatorType)
+				|| AFTConstants.CHANNEL_USER_TRANSFER_TO_OTHER .equals(operatorType)) {
 			if (!isUs) {
 				user.setAid(aid);
 				if (data==1){
 					user.setInformationMaintainer(aid);
 				}
 				user.setSource(3);// 客户来源设置为转交
-				if (AFTConstants.USER_TRANSFER_TO_OTHER == operatorType) {
+				//私有和渠道有客户锁操作
+				if (AFTConstants.USER_TRANSFER_TO_OTHER == operatorType||AFTConstants.CHANNEL_USER_TRANSFER_TO_OTHER == operatorType) {
 					// 查询这个客户是否是登陆人的客户
 					if (userMapper.getAidAndUser(uid, TokenManager.getAdminId()) <= 0)
 						throw new BusinessException(new Error("请勿非法操作!", "请勿非法操作!"));
@@ -1687,6 +1695,12 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return userMapper.updateRefusedCustomer(id, nickname, mobile, societyTag);
 	}
 
+	/**
+	 * 计算私有客户剩余时间
+	 * @param tmpList
+	 * @param i
+	 * @param power
+	 */
 	private void setCustomerList(List<CustomerListOut> tmpList, int i, Integer power) {
 		Date now = new Date();
 		String s1, s2;
@@ -2367,4 +2381,68 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		oi.setIntendedProject(intendedProject);
 		return organizationIdentityMapper.updateServiceByUid(oi);
 	}
+
+	@Override
+	public Pagination<OutChannelListBo> channelUserList(InputChannelListBo in) {
+		Map<String, Object> params = new HashMap<>();
+		if (StringUtils.isNotBlank(in.getName()))params.put("name",in.getName());
+		if (StringUtils.isNotBlank(in.getAid())){
+			params.put("aid",in.getAid());
+		}else {
+			params.put("aid",TokenManager.getAdminId());
+		}
+		if (StringUtils.isNotBlank(in.getStartDate()))params.put("startDate",in.getStartDate());
+		if (StringUtils.isNotBlank(in.getEndDate()))params.put("endDate",in.getEndDate()+" 23:59:59");
+		if (null!=in.getProvince())params.put("province",in.getProvince());
+		if (null!=in.getArea())params.put("area",in.getArea());
+		if (null!=in.getCity())params.put("city",in.getCity());
+		if (null!=in.getType())params.put("type",in.getType());
+		Pagination<OutChannelListBo> p = (Pagination<OutChannelListBo>) findPage(
+				"channelUserList", "channelUserCout", params, in.getPageNo(),
+				in.getPageSize());
+		List<OutChannelListBo> list = (List<OutChannelListBo>) p.getList();
+		for (OutChannelListBo out : list) {
+			out.setRemainingDays(getRemainingDays(out));
+		}
+		return p;
+	}
+
+	/**
+	 * 根据您 初始时间、最后跟进时间当前时间计算剩余天数
+	 * @param out
+	 * @return
+	 */
+	private String getRemainingDays(OutChannelListBo out) {
+		Date now = new Date();
+		Long lastFollow=null,transfer=null,endLong = null;
+		Integer diff1 = 0;
+		// 如果最近跟进为空直接取转换时间
+		try {
+		if (StringUtils.isNotBlank(out.getLastFollowTime())) {
+				lastFollow = DateUtils.parseDate(out.getLastFollowTime(), AFTConstants.YYYYMMDDHHMMSS).getTime();
+			// 如果最近跟进小于转换取转换时间
+			if (StringUtils.isNotBlank(out.getTransferTime())) {
+				transfer = DateUtils.parseDate(out.getTransferTime(), AFTConstants.YYYYMMDDHHMMSS).getTime();
+			}else {
+				transfer=0L;
+			}
+			if (lastFollow > transfer) {
+				endLong = lastFollow;
+			} else {
+				endLong = transfer;
+			}
+		} else {
+			if (StringUtils.isNotBlank(out.getTransferTime())) {
+				endLong = DateUtils.parseDate(out.getTransferTime(), AFTConstants.YYYYMMDDHHMMSS).getTime();
+			} else {
+				return "0";
+			}
+		}
+		}catch (Exception e){
+
+			throw new BusinessException("转换异常");
+		}
+		diff1 = (int) ((endLong + AFTConstants.USER_FOLLOW_LIMIT_MS - now.getTime()) / (24 * 3600 * 1000));
+		return diff1.toString();
+	}
 }

+ 17 - 2
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -14,6 +14,7 @@ import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.model.*;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.*;
+import com.goafanti.order.enums.salesTypes;
 import com.goafanti.order.service.OrderAssistService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.formula.constant.ErrorConstant;
@@ -48,7 +49,7 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	 * @return
 	 */
 	@RequestMapping(value = "/createOrder",method = RequestMethod.POST)
-	public Result createOrder(String uid,Integer orderType){
+	public Result createOrder(String uid,Integer orderType,Integer salesType,String channelId,String other){
 		Result res = new Result();
 		if(StringUtils.isBlank(uid)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","客户编号"));
@@ -58,7 +59,21 @@ public class AdminNewOrderApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单类型"));
 			return res;
 		}
-		res.data(orderNewService.createServiceOrder(uid,orderType));
+		if (salesType==null){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","销售类型"));
+			return res;
+		}else{
+			if (salesType== salesTypes.qd.getCode()&&StringUtils.isBlank(channelId)){
+				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","销售类型为渠道,渠道客户"));
+				return res;
+			}
+			if (salesType== salesTypes.qt.getCode()&&StringUtils.isBlank(other)){
+				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","销售类型为其他,请描述"));
+				return res;
+			}
+		}
+
+		res.data(orderNewService.createServiceOrder(uid,orderType, salesType, channelId, other));
 		return res;
 	}
 	/**

+ 39 - 0
src/main/java/com/goafanti/order/enums/salesTypes.java

@@ -0,0 +1,39 @@
+package com.goafanti.order.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum salesTypes {
+
+    dhxkf(0,"电话新开发"),
+    dhzdzy(1,"电话自带资源"),
+    wl(2,"网络"),
+    qd(3,"渠道"),
+    zjs(4,"转介绍"),
+    qt(5,"其他"),
+    gxfg(6,"高新复购"),
+    qtfg(7,"其他复购");
+
+    private Integer code;
+    private String desc;
+
+    private salesTypes(Integer code,String desc){
+        this.code=code;
+        this.desc=desc;
+    }
+    private static Map<Integer ,salesTypes> map=new HashMap<>();
+
+    static {
+        for (salesTypes value : salesTypes.values()) {
+            map.put(value.code,value);
+        }
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}

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

@@ -22,7 +22,7 @@ public interface OrderNewService {
 	 * @param orderType
 	 * @return
 	 */
-	int createServiceOrder(String uid, Integer orderType);
+	int createServiceOrder(String uid, Integer orderType,Integer salesType,String channelId,String other);
 	/**
 	 * 创建项目
 	 * @param t

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

@@ -134,7 +134,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	Logger							logger	= LoggerFactory.getLogger(OrderNewServiceImpl.class);
 
 	@Override
-	public int createServiceOrder(String uid, Integer orderType) {
+	public int createServiceOrder(String uid, Integer orderType,Integer salesType,String channelId,String other) {
 		BigDecimal initial = new BigDecimal(0);
 		TOrderNew t=new TOrderNew();
         Date date = new Date();
@@ -156,6 +156,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		t.setCreateTime(date);
 		t.setUpdateTime(date);
 		t.setBuyerId(uid);
+		t.setSalesType(salesType);
+		if (channelId!=null)t.setChannelId(channelId);
+		if (other!=null )t.setOther(other);
 		User u=userMapper.selectByPrimaryKey(uid);
 		if(u.getShareType()!=null&&u.getShareType()==2){
 			t.setNewUser(1);