Browse Source

科德系统渠道模块开发

anderx 3 years ago
parent
commit
2fb96ce53f

+ 11 - 2
src/main/java/com/goafanti/common/bo/userDaysBo.java

@@ -8,8 +8,17 @@ public class userDaysBo {
 	private Integer recovery;
 	private Integer channel;
 	private Integer type;
+	//共享类型 0=私有 1=公共 2=签单 3=外联 4=渠道
+	private Integer newChannel;
+
+	public Integer getNewChannel() {
+		return newChannel;
+	}
+
+	public void setNewChannel(Integer newChannel) {
+		this.newChannel = newChannel;
+	}
 
-	
 	public String getUid() {
 		return uid;
 	}
@@ -34,7 +43,7 @@ public class userDaysBo {
 		this.name = name;
 	}
 
-	
+
 	public Integer getRecovery() {
 		return recovery;
 	}

+ 168 - 222
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -31,272 +31,218 @@ import com.goafanti.report.bo.marketingESBo;
 import com.goafanti.report.bo.userDataListBo;
 
 public interface UserMapper {
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	long countByExample(UserExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	int deleteByExample(UserExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	int deleteByPrimaryKey(String id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	int insert(User record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	int insertSelective(User record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	List<User> selectByExample(UserExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	User selectByPrimaryKey(String id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	int updateByExample(@Param("record") User record, @Param("example") UserExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	int updateByPrimaryKeySelective(User record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user
-	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
-	 */
-	int updateByPrimaryKey(User record);
-
-	UserPageHomeBo selectUserPageHomeBoByUserId(String uid);
-
-	UserDownLoadBo selectUserDownLoadBoByUserId(String id);
-
-	//List<OrgListBo> selectUserByAid(String aid);
-
-	String findUserByNameAndMobile(@Param("name") String name, @Param("mobile") String mobile);
-
-	String findOrgByNameAndMobile(@Param("name") String name, @Param("mobile") String mobile);
-
-	UserPartnerDetailBo findUserPartnerDetail(String uid);
-
-	OrgPartnerDetailBo findOrgPartnerDetail(String uid);
-
-	Long selectNumberByPrimaryKey(String userId);
-
-	List<UserPartnerDetailBo> findUserPartner();
-
-	User selectByMobieAndType(String mobile, Integer type);
-
-	/**
-	 * 根据客户模糊搜索
-	 * @param name
-	 * @return
-	 */
-	List<CustomerSimpleBo> findCustomerByName(@Param("identifyName")String identifyName);
-
-	/**
-	 * 判断客户是否存在
-	 * @param name
-	 * @return
-	 */
-	int judgeCustomerByName(@Param("identifyName")String identifyName);
-
-	/**
-	 * 查询单位客户详情
-	 * @param uid 用户ID
-	 * @return
-	 */
-	CustomerPersonalDetailBo findPersonalCustomerDetail(@Param("uid")String uid);
-
-
-	/**
-	 * 查询单位客户详情
-	 * @param uid 用户ID
-	 * @return
-	 */
-	CustomerOrganizationDetailBo findOrganizationCustomerDetail(@Param("uid")String uid);
-
-	/**
-	 * 查看客户账户信息
-	 * @param uid
-	 * @return
-	 */
-	User findUserAccountDetail(@Param("uid")String uid);
+    int deleteByPrimaryKey(String id);
 
-	/**
-	 * 查看客户联系人列表
-	 * @param uid
-	 * @return
-	 */
-	List<OrganizationContactBook> findCustomerContacts(@Param("uid")String uid,@Param("aid")String aid);
+    int insert(User record);
 
-	/**
-	 * 查询拜访详情
-	 * @param followId
-	 * @return
-	 */
-	FollowBusinessBo findFollowById(String followId);
+    int insertSelective(User record);
 
-	/**
-	 * 查询单次拜访推进的客户业
-	 * @param followId
-	 * @return
-	 */
-	List<BusinessListBo> findBusinessByFollowId(String followId);
+    User selectByPrimaryKey(String id);
+
+    int updateByPrimaryKeySelective(User record);
 
-	/**
-	 * 查询客户已有联系人
-	 * @param uid
-	 * @return
-	 */
-	List<OrganizationContactBook> findAllContacts(String uid);
+    int updateByPrimaryKey(User record);
 
-	/**
-	 * 查询用户
-	 * @param id
-	 * @param identifyName 认证用户
-	 * @param mobile 手机号码
-	 * @param type 用户类型 0-个人 1-单位
-	 * @param source 来源 0-注册 1-录入
-	 * @return
-	 * @param nickname 昵称
-	 */
-	List<User> checkUser(@Param("id")String id,@Param("identifyName")String identifyName, @Param("mobile")String mobile,
-			@Param("type")Integer type,@Param("source") Integer source,@Param("nickname") String nickname);
+    UserPageHomeBo selectUserPageHomeBoByUserId(String uid);
 
+    UserDownLoadBo selectUserDownLoadBoByUserId(String id);
 
-	List<UserInterestBo> userInterest(String uid);
+    //List<OrgListBo> selectUserByAid(String aid);
 
+    String findUserByNameAndMobile(@Param("name") String name, @Param("mobile") String mobile);
 
-	/**
-	 * 查询用户基本信息
-	 * @param id
-	 * @return
-	 */
-	UserBasicInfo selectBaseInfo(@Param("id")String id);
+    String findOrgByNameAndMobile(@Param("name") String name, @Param("mobile") String mobile);
 
-	/**
-	 * 根据用户编号
-	 * @param easemobName
-	 * @return
-	 */
-	User selectByNumber(@Param("easemobName")String easemobName);
+    UserPartnerDetailBo findUserPartnerDetail(String uid);
 
-	List<Admin> findAdminName(String aid);
+    OrgPartnerDetailBo findOrgPartnerDetail(String uid);
 
-	int updateEnteringAudit(@Param("id")String id,@Param("auditStatus")Integer auditStatus,@Param("auditOpinion")String auditOpinion);
+    Long selectNumberByPrimaryKey(String userId);
 
-	int updateRefusedCustomer(@Param("id")String id,  @Param("nickname")String nickname, @Param("mobile")String mobile, @Param("societyTag")String societyTag);
+    List<UserPartnerDetailBo> findUserPartner();
 
-	/**
-	 * 查看客户锁定的业务
-	 * @param uid 客户ID
-	 * @param aid 管理员ID
-	 * @param businessProjectId 业务项目的ID
-	 * @param type 锁定类型  0-客户  1-业务
-	 * @param status 锁定状态 0-锁定 1-待释放 2-已释放
-	 * @return
-	 */
-	List<LockingReleaseBo> selectLockedProject(@Param("uid")String uid,@Param("aid")String aid,@Param("businessProjectId")String businessProjectId, @Param("type")Integer type,@Param("status")Integer status);
+    User selectByMobieAndType(String mobile, Integer type);
 
-	List<CustomerSimpleBo> selectPrivateCustomerByName(@Param("name")String name,@Param("aid")String aid);
+    /**
+     * 根据客户模糊搜索
+     * @param name
+     * @return
+     */
+    List<CustomerSimpleBo> findCustomerByName(@Param("identifyName")String identifyName);
 
-	List<CustomerSimpleBo> selectSignedCustomerByName(@Param("name")String name,@Param("aid")String aid,@Param("type")Integer type);
+    /**
+     * 判断客户是否存在
+     * @param name
+     * @return
+     */
+    int judgeCustomerByName(@Param("identifyName")String identifyName);
 
-	List<User> selectUserByRoleName(@Param("roleName1")String roleName1,@Param("roleName2")String roleName2);
+    /**
+     * 查询单位客户详情
+     * @param uid 用户ID
+     * @return
+     */
+    CustomerPersonalDetailBo findPersonalCustomerDetail(@Param("uid")String uid);
 
-	void updateReleaseLock(String time);
 
-	marketingESBo marketingStatistics(@Param("id")String id, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
+    /**
+     * 查询单位客户详情
+     * @param uid 用户ID
+     * @return
+     */
+    CustomerOrganizationDetailBo findOrganizationCustomerDetail(@Param("uid")String uid);
 
-	marketingESBo marketingDepStatistics(@Param("depId")String depId, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
+    /**
+     * 查看客户账户信息
+     * @param uid
+     * @return
+     */
+    User findUserAccountDetail(@Param("uid")String uid);
 
-	CountMarketingStatisticsBo countmarketingDepStatistics(@Param("depId")String depId, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
+    /**
+     * 查看客户联系人列表
+     * @param uid
+     * @return
+     */
+    List<OrganizationContactBook> findCustomerContacts(@Param("uid")String uid,@Param("aid")String aid);
 
-	int checkCustomerInformation(String uid);
+    /**
+     * 查询拜访详情
+     * @param followId
+     * @return
+     */
+    FollowBusinessBo findFollowById(String followId);
 
-	void updateDimissionTransfer(@Param("aid")String aid, @Param("transferId")String transferId);
+    /**
+     * 查询单次拜访推进的客户业
+     * @param followId
+     * @return
+     */
+    List<BusinessListBo> findBusinessByFollowId(String followId);
 
-	List<userDataListBo> userDataStatistics(@Param("depId")String depId);
+    /**
+     * 查询客户已有联系人
+     * @param uid
+     * @return
+     */
+    List<OrganizationContactBook> findAllContacts(String uid);
 
-	userDataListBo userDataStatisticsCount(@Param("depId")String depId);
+    /**
+     * 查询用户
+     * @param id
+     * @param identifyName 认证用户
+     * @param mobile 手机号码
+     * @param type 用户类型 0-个人 1-单位
+     * @param source 来源 0-注册 1-录入
+     * @return
+     * @param nickname 昵称
+     */
+    List<User> checkUser(@Param("id")String id,@Param("identifyName")String identifyName, @Param("mobile")String mobile,
+                         @Param("type")Integer type,@Param("source") Integer source,@Param("nickname") String nickname);
 
-	int UserReceiveCount( @Param("aid")String aid);
 
-	int getAidAndUser(@Param("uid")String uid,@Param("aid") String aid);
+    List<UserInterestBo> userInterest(String uid);
 
-	 List<CustomerListOut> privateUnitCustomerList(@Param("params")Map<String, Object> params);
 
-	int pushUserGuidance(@Param("id")String id, @Param("guidance")Integer guidance);
+    /**
+     * 查询用户基本信息
+     * @param id
+     * @return
+     */
+    UserBasicInfo selectBaseInfo(@Param("id")String id);
 
-	/**
-	 *
-	 * @param aid   归属人
-	 * @param level 等级
-	 * @param source 来源
-	 * @param transferTime 转换时间
-	 * @param shareType 私有标示
-	 * @param list  用户id列表
-	 */
-	void updateList(@Param("aid")String aid,@Param("level")Integer level, @Param("source")Integer source,
-			@Param("transferTime")Date transferTime,@Param("shareType")Integer shareType,@Param("list")List<String> list,
-	@Param("data")Integer data);
+    /**
+     * 根据用户编号
+     * @param easemobName
+     * @return
+     */
+    User selectByNumber(@Param("easemobName")String easemobName);
 
-	int checkUserMax(String aid);
+    List<Admin> findAdminName(String aid);
 
-	int checkLock(@Param("uid")String uid);
+    int updateEnteringAudit(@Param("id")String id,@Param("auditStatus")Integer auditStatus,@Param("auditOpinion")String auditOpinion);
 
-	void updateShareType(@Param("uid")String uid,@Param("aid")String aid);
+    int updateRefusedCustomer(@Param("id")String id,  @Param("nickname")String nickname, @Param("mobile")String mobile, @Param("societyTag")String societyTag);
 
+    /**
+     * 查看客户锁定的业务
+     * @param uid 客户ID
+     * @param aid 管理员ID
+     * @param businessProjectId 业务项目的ID
+     * @param type 锁定类型  0-客户  1-业务
+     * @param status 锁定状态 0-锁定 1-待释放 2-已释放
+     * @return
+     */
+    List<LockingReleaseBo> selectLockedProject(@Param("uid")String uid,@Param("aid")String aid,@Param("businessProjectId")String businessProjectId, @Param("type")Integer type,@Param("status")Integer status);
 
-	String checkRoleMax(String aid);
+    List<CustomerSimpleBo> selectPrivateCustomerByName(@Param("name")String name,@Param("aid")String aid);
 
-	void insertBatch(List<InputUserChannel> list);
+    List<CustomerSimpleBo> selectSignedCustomerByName(@Param("name")String name,@Param("aid")String aid,@Param("type")Integer type);
 
-	User selectByName(String userName);
+    List<User> selectUserByRoleName(@Param("roleName1")String roleName1,@Param("roleName2")String roleName2);
 
-	int updatechannelCustomerDeliver(@Param("list")List<String> list, @Param("aid")String aid);
+    void updateReleaseLock(String time);
 
-	void updateReleaseUserChannel(@Param("list")List<userDaysBo> newCList, @Param("type")Integer type);
+    marketingESBo marketingStatistics(@Param("id")String id, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
 
-	String checkBeforeChannel(String uid);
+    marketingESBo marketingDepStatistics(@Param("depId")String depId, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
 
-	List<CustomerSimpleBo> getUserByName(String name);
+    CountMarketingStatisticsBo countmarketingDepStatistics(@Param("depId")String depId, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
 
-	List<OutUser> getAllUser();
+    int checkCustomerInformation(String uid);
 
+    void updateDimissionTransfer(@Param("aid")String aid, @Param("transferId")String transferId);
 
-	List<CustomerListOut> selectPrivateOrganizationCustomerList(Map<String,Object> map);
+    List<userDataListBo> userDataStatistics(@Param("depId")String depId);
+
+    userDataListBo userDataStatisticsCount(@Param("depId")String depId);
+
+    int UserReceiveCount( @Param("aid")String aid);
+
+    int getAidAndUser(@Param("uid")String uid,@Param("aid") String aid);
+
+    List<CustomerListOut> privateUnitCustomerList(@Param("params")Map<String, Object> params);
+
+    int pushUserGuidance(@Param("id")String id, @Param("guidance")Integer guidance);
+
+    /**
+     *
+     * @param aid   归属人
+     * @param level 等级
+     * @param source 来源
+     * @param transferTime 转换时间
+     * @param shareType 私有标示
+     * @param list  用户id列表
+     */
+    void updateList(@Param("aid")String aid,@Param("level")Integer level, @Param("source")Integer source,
+                    @Param("transferTime")Date transferTime,@Param("shareType")Integer shareType,@Param("list")List<String> list,
+                    @Param("data")Integer data);
+
+    int checkUserMax(String aid);
+
+    int checkLock(@Param("uid")String uid);
+
+    void updateShareType(@Param("uid")String uid,@Param("aid")String aid);
+
+
+    String checkRoleMax(String aid);
+
+    void insertBatch(List<InputUserChannel> list);
+
+    User selectByName(String userName);
+
+    int updatechannelCustomerDeliver(@Param("list")List<String> list, @Param("aid")String aid);
+
+    void updateReleaseUserChannel(@Param("list")List<userDaysBo> newCList, @Param("type")Integer type);
+
+    String checkBeforeChannel(String uid);
+
+    List<CustomerSimpleBo> getUserByName(String name);
+
+    List<OutUser> getAllUser();
+
+
+    List<CustomerListOut> selectPrivateOrganizationCustomerList(Map<String,Object> map);
 
 
 

+ 63 - 63
src/main/java/com/goafanti/common/mapper/UserLockReleaseMapper.xml

@@ -118,7 +118,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Mon May 07 09:56:32 CST 2018.
     -->
-    select 
+    select
     <include refid="Base_Column_List" />
     from user_lock_release
     where id = #{id,jdbcType=VARCHAR}
@@ -149,12 +149,12 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Mon May 07 09:56:32 CST 2018.
     -->
-    insert into user_lock_release (id, type, uid, 
-      aid, business_project_id, status, 
+    insert into user_lock_release (id, type, uid,
+      aid, business_project_id, status,
       lock_time, release_time, order_no
       )
-    values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, 
-      #{aid,jdbcType=VARCHAR}, #{businessProjectId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
+    values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR},
+      #{aid,jdbcType=VARCHAR}, #{businessProjectId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
       #{lockTime,jdbcType=DATE}, #{releaseTime,jdbcType=DATE}, #{orderNo,jdbcType=VARCHAR}
       )
   </insert>
@@ -353,21 +353,21 @@
   <update id="updateUserLock">
   	update user_lock_release set status = #{newStatus} where uid = #{uid} and aid = #{aid} and type = 0 and status = #{oldStatus}
   </update>
-  
+
   <update id="updateUsersLock">
-  	update user_lock_release set status = #{newStatus} 
+  	update user_lock_release set status = #{newStatus}
   	where aid = #{aid} and type = 0 and status = #{oldStatus}
   	and uid in
   	<foreach item="item" collection="uList" separator="," open="(" close=")" index="">
        #{item}
      </foreach>
   </update>
-  
+
   <update id="updateUserTypeLock">
   	update user_lock_release set status = #{newStatus} , release_time= #{date}
   	where uid = #{uid} and aid = #{aid} and type = 0 and type = #{type}
   </update>
-  
+
   <update id="updateUserTypeLockList">
   	update user_lock_release set status = #{newStatus} , release_time= #{date}
   	where aid = #{aid} and type = 0 and type = #{type} and uid in
@@ -375,16 +375,16 @@
        #{item}
     </foreach>
   </update>
-  
+
   <select id="selectWaitReleaseCustomer" resultType="com.goafanti.customer.bo.LockingReleaseBo">
-	select 
-		t0.id, t0.uid, t0.aid, t0.lock_time lockTime,
+	select
+		t0.id, t0.uid, t0.aid, t0.lock_time lockTime,u.new_channel newChannel,
 		t1.last_follow_time lastFollowTime,u.nickname userName
 	from
 		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
-	left join 
+	left join
 		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-	on t0.uid = t1.uid 
+	on t0.uid = t1.uid
 	left join user u on t0.uid=u.id
 	where u.channel=0
 	<if test="type==0">
@@ -394,7 +394,7 @@
 	 and datediff(now(),t0.lock_time)>270
 	</if>
   </select>
-  
+
   <select id="selectWaitReleaseBusiness"  resultType="com.goafanti.customer.bo.LockingReleaseBo">
 	select
 		t0.id,
@@ -404,21 +404,21 @@
 		t1.last_follow_time
 	from
 		(select id,uid,aid,lock_time from user_lock_release t0 where aid = #{aid} and type = 1 and status = 0)t0
-	left join 
+	left join
 		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-	on t0.uid = t1.uid 
+	on t0.uid = t1.uid
 	where datediff(t1.last_follow_time,lock_time)>360 or datediff(now(),t0.lock_time)>900
   </select>
-  
-  
+
+
   <update id="updatePendingReleaseLock" parameterType="java.lang.String">
   	update user_lock_release set status = 1 where id in (${lockIds})
   </update>
-  
+
   <select id="selectPendinglockUserList" resultType="com.goafanti.customer.bo.LockingReleaseBo">
   	select id,uid,type  from user_lock_release where status=1
   </select>
-  
+
   <update id="updateProject" parameterType="java.lang.String">
   	update user_lock_release set status = 2,release_time=now()
   	where uid= #{uid,jdbcType=VARCHAR}
@@ -426,120 +426,120 @@
 	and business_project_id= #{businessProjectId,jdbcType=VARCHAR}
   </update>
   <select id="checkTask" resultType="com.goafanti.customer.bo.LockingReleaseBo">
-  	select 
-		 id, type, uid, aid, business_project_id as  businessProjectId, status 
+  	select
+		 id, type, uid, aid, business_project_id as  businessProjectId, status
 	 from user_lock_release where type =1
 	and status=0
 	and uid=#{buyerId,jdbcType=VARCHAR}
 	and business_project_id=#{commodityId,jdbcType=VARCHAR}
   </select>
   <update id="updatePrivateBusinessTransfer">
- 	update user_lock_release set aid=#{inputId} where uid= #{uid} and business_project_id= #{pid} and aid= #{aid}; 
+ 	update user_lock_release set aid=#{inputId} where uid= #{uid} and business_project_id= #{pid} and aid= #{aid};
   </update>
-  
+
   <select id="checkUserProject" resultType="com.goafanti.customer.bo.LockingReleaseBo">
-  	select 
-		 id, type, uid, aid, business_project_id as  businessProjectId, status 
+  	select
+		 id, type, uid, aid, business_project_id as  businessProjectId, status
 	 from user_lock_release where type =1
 	and status=0
 	and uid=#{uid,jdbcType=VARCHAR}
 	and aid=#{aid,jdbcType=VARCHAR}
 	and business_project_id=#{pid,jdbcType=VARCHAR}
   </select>
-  
+
   <select id="selectUserDays" resultType="com.goafanti.common.bo.userDaysBo">
-  select  t0.uid, t0.aid, u.nickname name ,u.channel ,1 type
+  select  t0.uid, t0.aid, u.nickname name ,u.channel ,1 type,u.new_channel newChannel
 	from
 		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
-	left join 
+	left join
 		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-	on t0.uid = t1.uid 
+	on t0.uid = t1.uid
 	left join user u on t0.uid=u.id
 	where u.channel=0
 	and  datediff(now(),t0.lock_time)> #{x}
-	UNION 
-	select  t0.uid, t0.aid, u.nickname name ,u.channel ,0 type
+	UNION
+	select  t0.uid, t0.aid, u.nickname name ,u.channel ,0 type,u.new_channel newChannel
 	from
 		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
-	left join 
+	left join
 		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-	on t0.uid = t1.uid 
+	on t0.uid = t1.uid
 	left join user u on t0.uid=u.id
 	where u.channel=0
-	and datediff(now(),if(t0.lock_time &lt; t1.last_follow_time,t1.last_follow_time,t1.t0.lock_time)) &gt; 15 
-	UNION 
-	  select  t0.uid, t0.aid, u.nickname name ,u.channel ,0 type
+	and datediff(now(),if(t0.lock_time &lt; t1.last_follow_time,t1.last_follow_time,t0.lock_time)) &gt; 15
+	UNION
+	  select  t0.uid, t0.aid, u.nickname name ,u.channel ,0 type,u.new_channel newChannel
 	from
 		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
-	left join 
+	left join
 		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-	on t0.uid = t1.uid 
+	on t0.uid = t1.uid
 	left join user u on t0.uid=u.id
 	where u.channel=1
 	and  datediff(now(),t0.lock_time)> #{y}
   </select>
-  
+
     <select id="selectChannelUserDays" resultType="com.goafanti.common.bo.userDaysBo">
-	select  t0.uid, t0.aid, u.nickname name,c.recovery 
+	select  t0.uid, t0.aid, u.nickname name,c.recovery
 	from (select id,uid,aid,lock_time from user_lock_release where type = 0 and status = 0  and aid=#{aid} )t0
 	left join user  u on t0.uid=u.id
 	left join user_channel c on u.id=c.uid
 	where u.channel =1 and c.status &lt; 3
 	and datediff(now(),t0.lock_time) &gt; #{days}
   </select>
-  
+
   <select id="selectChannelNotFollow" resultType="com.goafanti.common.bo.userDaysBo">
-  	   select  t0.uid, t0.aid, u.nickname name ,u.channel 
+  	   select  t0.uid, t0.aid, u.nickname name ,u.channel
 	from
 		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
-	left join 
+	left join
 		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-	on t0.uid = t1.uid 
+	on t0.uid = t1.uid
 	left join user u on t0.uid=u.id
 	where 1=1 and u.channel=1
-	and datediff(now(),if(t0.lock_time &lt; t1.last_follow_time,t1.last_follow_time,t1.t0.lock_time)) &gt; #{days} 
+	and datediff(now(),if(t0.lock_time &lt; t1.last_follow_time,t1.last_follow_time,t0.lock_time)) &gt; #{days}
   </select>
-  
+
   <insert id="insertList" >
-      insert into user_lock_release (id, type, uid, 
-      aid, business_project_id, status, 
+      insert into user_lock_release (id, type, uid,
+      aid, business_project_id, status,
       lock_time, release_time, order_no
       )
     values
     <foreach item="item" collection="list" separator="," index="">
-       	(#{item.id,jdbcType=VARCHAR}, #{item.type,jdbcType=INTEGER}, #{item.uid,jdbcType=VARCHAR}, 
-      #{item.aid,jdbcType=VARCHAR}, #{item.businessProjectId,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER}, 
+       	(#{item.id,jdbcType=VARCHAR}, #{item.type,jdbcType=INTEGER}, #{item.uid,jdbcType=VARCHAR},
+      #{item.aid,jdbcType=VARCHAR}, #{item.businessProjectId,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER},
       #{item.lockTime,jdbcType=DATE}, #{item.releaseTime,jdbcType=DATE}, #{item.orderNo,jdbcType=VARCHAR})
      </foreach>
   </insert>
-  
+
   <select id="checkLock" resultType="java.lang.Integer">
-   	select count(*) from user_lock_release 
+   	select count(*) from user_lock_release
 	where aid= #{aid} and uid= #{uid} and business_project_id = #{pid}
   </select>
-  
+
   <update id="updateReleaseList" >
-  update user_lock_release 
+  update user_lock_release
   	set release_time =now(),status =2
-  	where id  in 
+  	where id  in
   	<foreach item="item" collection="list" separator="," open="(" close=")" index="">
        #{item}
      </foreach>
   </update>
   <select id="selectByUidGetCount" resultType="java.lang.Integer">
-  select count(*) from user_lock_release 
-  	where `type` =1 and status=0 and aid = #{aid} and uid= #{uid} 
+  select count(*) from user_lock_release
+  	where `type` =1 and status=0 and aid = #{aid} and uid= #{uid}
   </select>
   <update id="updateReleaseUser">
   update t_order_new a ,user b ,user_business  c
 	set b.share_type =1,b.transfer_time =now(),b.sign_bills=0,
 	c.customer_status =6,c.follow_situation =8
-	where a.order_no = #{orderNo} and a.buyer_id =b.id  
+	where a.order_no = #{orderNo} and a.buyer_id =b.id
 	and a.buyer_id =c.uid and a.salesman_id =c.aid and c.follow_situation =5
   </update>
-  
+
   <update id="updateByAidAndUid">
-  	update user_lock_release 
+  	update user_lock_release
 	set status =2,release_time =now()
 	where aid= #{aid} and uid= #{uid} and `type` =0
   </update>
@@ -567,4 +567,4 @@ VALUES
      </foreach>
 	)
   </update>
-</mapper>
+</mapper>

File diff suppressed because it is too large
+ 758 - 998
src/main/java/com/goafanti/common/mapper/UserMapper.xml


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

@@ -2202,7 +2202,12 @@ inner join(
 		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=" shareType !=null ">
+			and a.share_type = #{shareType}
+		</if>
+		<if test=" newChannel !=null ">
+			and a.new_channel = #{newChannel}
+		</if>
 		<if test=" name !=null ">
 		and a.nickname = #{name}
 		</if>
@@ -2235,7 +2240,12 @@ inner join(
 		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=" shareType !=null ">
+		and a.share_type = #{shareType}
+		</if>
+		<if test=" newChannel !=null ">
+			and a.new_channel = #{newChannel}
+		</if>
 		<if test=" name !=null ">
 			and a.nickname = #{name}
 		</if>

File diff suppressed because it is too large
+ 538 - 757
src/main/java/com/goafanti/common/model/User.java


+ 14 - 9
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -51,8 +51,8 @@ public class ReleaseUserTask {
 	 *
 	 * @throws InterruptedException
 	 */
-//	@Scheduled(cron = "0 55 11  * * ?")
-	@Scheduled(cron = "0 0 1  * * ?")
+	@Scheduled(cron = "0 41 11  * * ?")
+//	@Scheduled(cron = "0 0 1  * * ?")
 	public void startTask() {
 		try {
 			pushUserDays();
@@ -78,11 +78,13 @@ public class ReleaseUserTask {
 				for (userDaysBo ub : userTmpList) {
 					String str=null;
 					if (ub.getChannel() == 0) {
-						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时%s!",
-								"私有", ub.getName(),ub.getType()==0?"跟进":"签单");
+						String shareType="";
+						if(ub.getNewChannel()==0)shareType="私有";
+						else if(ub.getNewChannel()==1)shareType="渠道";
 
+						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时%s!", shareType, ub.getName(),ub.getType()==0?"跟进":"签单");
 					}else {
-						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时签单!", "渠道", ub.getName());
+						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时签单!", "外联", ub.getName());
 					}
 					ln.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, ub.getAid(),
 							NoticeStatus.CUSTOMER_LOSE_REMINDER.getCode(), str,ub.getUid()));
@@ -98,7 +100,7 @@ public class ReleaseUserTask {
 			for (userDaysBo ub : userChannelList) {
 				String str=null;
 				if (ub.getChannel() == 1) {
-					str = String.format("您的%s客户【%s】已经十五天未跟进,请及时跟进或者限时签单!", "渠道", ub.getName());
+					str = String.format("您的%s客户【%s】已经十五天未跟进,请及时跟进或者限时签单!", "外联", ub.getName());
 				}
 				ln.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, ub.getAid(),
 						NoticeStatus.CUSTOMER_PRIVATE_REMINDER.getCode(), str,ub.getUid()));
@@ -234,9 +236,12 @@ public class ReleaseUserTask {
 		List<Notice> nl=new ArrayList<Notice>();
 		if (!userTmpList.isEmpty()) {
 			for (LockingReleaseBo u : userTmpList) {
+				String shareType="";
+				if(u.getNewChannel()==0)shareType="私有";
+				else if(u.getNewChannel()==1)shareType="渠道";
 				nl.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, u.getAid(),
 						NoticeStatus.CUSTOMER_LOSE30.getCode(),
-						String.format("您的%s客户【%s】已经30天未跟进,已经自动释放!", "私有", u.getUserName()),
+						String.format("您的%s客户【%s】已经30天未跟进,已经自动释放!", shareType, u.getUserName()),
 						u.getUid()));
 			}
 		}
@@ -260,14 +265,14 @@ public class ReleaseUserTask {
 		for (userDaysBo hs : hsList) {
 			nl.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, hs.getAid(),
 					NoticeStatus.CUSTOMER_CHENNEL_RECOVERY.getCode(),
-					String.format("您的%s客户【%s】已经90天未跟进,已经自动回收!", "渠道", hs.getName()),
+					String.format("您的%s客户【%s】已经90天未跟进,已经自动回收!", "外联", hs.getName()),
 					hs.getUid()));
 		}
 
 		for (userDaysBo sf : sfList) {
 			nl.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, sf.getAid(),
 					NoticeStatus.CUSTOMER_CHENNEL_LOSE.getCode(),
-					String.format("您的%s客户【%s】已经90天未跟进,已经自动释放!", "渠道", sf.getName()),
+					String.format("您的%s客户【%s】已经90天未跟进,已经自动释放!", "外联", sf.getName()),
 					sf.getUid()));
 		}
 		if(!nl.isEmpty())addNoticeBatch(nl);

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

@@ -27,6 +27,8 @@ public class InputAddCustomer {
     private Integer industry;
     private String businessScope;
     private String intendedProject;
+
+    private Integer newChannel;
     /**
      * 简介
      */
@@ -45,6 +47,13 @@ public class InputAddCustomer {
     private Integer   channelType;
 
 
+    public Integer getNewChannel() {
+        return newChannel;
+    }
+
+    public void setNewChannel(Integer newChannel) {
+        this.newChannel = newChannel;
+    }
 
     public Integer getChannelType() {
         return channelType;

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

@@ -24,11 +24,36 @@ public class InputChannelListBo {
 
     /** 结束时间 **/
     private String endDate;
+    /**
+     * 新渠道
+     */
+    private Integer newChannel;
+
+    /**
+     * 共享类型 0=私有 1=公共 2=签单 3=外联 4=渠道
+     */
+    private Integer shareType;
 
     private Integer pageSize;
 
     private Integer pageNo;
 
+    public Integer getShareType() {
+        return shareType;
+    }
+
+    public void setShareType(Integer shareType) {
+        this.shareType = shareType;
+    }
+
+    public Integer getNewChannel() {
+        return newChannel;
+    }
+
+    public void setNewChannel(Integer newChannel) {
+        this.newChannel = newChannel;
+    }
+
     public String getName() {
         return name;
     }

+ 10 - 1
src/main/java/com/goafanti/customer/bo/LockingReleaseBo.java

@@ -13,7 +13,16 @@ public class LockingReleaseBo {
 	private String lastSignTime;
 	private String userName;
 	private Integer mySign;
-	
+	private Integer newChannel;
+
+	public Integer getNewChannel() {
+		return newChannel;
+	}
+
+	public void setNewChannel(Integer newChannel) {
+		this.newChannel = newChannel;
+	}
+
 	public String getId() {
 		return id;
 	}

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

@@ -144,6 +144,24 @@ public class AdminCustomerApiController extends BaseApiController{
 	@RequestMapping(value = "/channelUserList" , method = RequestMethod.GET)
 	public Result channelUserList(InputChannelListBo in ){
 		Result res = new Result();
+		in.setNewChannel(1);
+		if (StringUtils.isBlank(in.getAid())){
+			in.setAid(TokenManager.getAdminId());
+		}
+		res.setData(customerService.channelUserList(in));
+		return res;
+	}
+
+	/**
+	 *  渠道客户列表
+	 *
+	 **/
+	@RequestMapping(value = "/publicChannelUserList" , method = RequestMethod.GET)
+	public Result publicChannelUserList(InputChannelListBo in ){
+		Result res = new Result();
+		in.setNewChannel(1);
+		//获取公共
+		in.setShareType(1);
 		res.setData(customerService.channelUserList(in));
 		return res;
 	}
@@ -316,7 +334,8 @@ public class AdminCustomerApiController extends BaseApiController{
 		}
 		in.setType(1);
 		//新增为私有客户
-		in.setShareType(4);
+		in.setShareType(0);
+		in.setNewChannel(1);
 		//将新增客户的空格去除
 		res.data(customerService.addCustomer(in));
 		return res;

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

@@ -475,7 +475,7 @@ public interface CustomerService {
 	void updatePendingReleaseLock(List<LockingReleaseBo> newList);
 	List<LockingReleaseBo> selectPendinglockUserList();
 	int updateUserLevel(User u);
-	public  Float countIntegrity(CustomerOrganizationDetailBo bo);
+	public  Double countIntegrity(CustomerOrganizationDetailBo bo);
 	XSSFWorkbook privateUnitCustomerOutXls(CustomerListIn cli ,Integer sort,Integer sortType,Integer pageNo, Integer pageSize);
 	int customerHandOver(String userIds, String receiveId);
 

+ 22 - 12
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -328,9 +328,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		user.setMobile(in.getContactMobile());
 		user.setPassword(AFTConstants.INITIALPASSWORD);
 		user.setInformationMaintainer(TokenManager.getAdminId());
-		float f = 0;
+		double f = 0;
 		user.setIntegrity(f);
 //		user.setInformationMaintainer("1");
+		if(in.getNewChannel()!=null)user.setNewChannel(in.getNewChannel());
+		user.setChannel(0);
 		passwordUtil.encryptPassword(user);
 		if (in.getType() == UserType.PERSONAL.getCode()) {
 			if (userMapper.checkUser("", "", in.getContactMobile(), in.getType(), null, null).size() > 0)
@@ -534,7 +536,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		userDataLogMapper.insertSelective(new UserDataLog(uid,str.toString()));
 	}
 
-	public Float countIntegrity(CustomerOrganizationDetailBo bo) {
+	public Double countIntegrity(CustomerOrganizationDetailBo bo) {
 		// 完整资料总数
 		int max = 10;
 		int number = 0;
@@ -558,8 +560,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			number += 1;
 		if (bo.getCreditRating() != null)
 			number += 1;
-		float f = (float) number / max;
-		return f;
+		Double d = (double) number / max;
+		return d;
 	}
 
 	@Override
@@ -2386,23 +2388,31 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	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());
+		if (null==in.getShareType()){
+			params.put("shareType",0);
+		}else{
+			params.put("shareType",in.getShareType());
+		}
+		if (null == in.getNewChannel()){
+			params.put("newChannel",1);
+		}else {
+			params.put("newChannel",in.getNewChannel());
+		}
 		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));
+		//只有私有客户才需要剩余时间
+		if (in.getShareType()==null || in.getShareType()!=1){
+			List<OutChannelListBo> list = (List<OutChannelListBo>) p.getList();
+			for (OutChannelListBo out : list) {
+				out.setRemainingDays(getRemainingDays(out));
+			}
 		}
 		return p;
 	}

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

@@ -67,8 +67,9 @@ public class AdminNewOrderApiController extends CertifyApiController {
 				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,"","销售类型为其他,请描述"));
+			if ((salesType== salesTypes.qt.getCode()||salesType== salesTypes.zjs.getCode())
+					&&StringUtils.isBlank(other)){
+				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","销售类型为转介绍或者其他,请简单描述"));
 				return res;
 			}
 		}