Browse Source

修改签单客户签单

anderx 1 year ago
parent
commit
288772cf64

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

@@ -248,4 +248,5 @@ public interface UserMapper {
     List<CustomerSimpleBo> getRestrictCustomerByName(@Param("name") String name, @Param("aid") String aid);
 
     int getCountRestrictProject(@Param("uid") String uid, @Param("aid") String aid);
+
 }

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

@@ -379,7 +379,7 @@
   <select id="selectWaitReleaseCustomer" resultType="com.goafanti.customer.bo.LockingReleaseBo">
 	select
 		t0.id, t0.uid, t0.aid, DATE_FORMAT(t0.lock_time , '%Y-%m-%d') lockTime,u.new_channel newChannel,
-		t1.last_follow_time lastFollowTime,u.nickname userName ,um.channel_type channelType
+		t1.last_follow_time lastFollowTime,u.nickname userName ,um.channel_type channelType,u.share_type shareType
 	from
 		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
 	left join
@@ -442,25 +442,17 @@
   </select>
 
   <select id="selectUserDays" resultType="com.goafanti.common.bo.userDaysBo">
-    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
-		(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
-	left join user u on t0.uid=u.id
-	where u.channel=0 and u.new_channel=0
-	and datediff(now(),if(t0.lock_time &lt; t1.last_follow_time,t1.last_follow_time,t0.lock_time)) &gt; 15
+      SELECT u.id uid,u.aid,u.nickname name, u.channel ,u.share_type type,u.new_channel newChannel
+      from `user` u left join user_mid um on u.id =um.uid
+      where u.share_type in(0,2) and  u.channel=0 and u.new_channel=0
+        and u.aid =#{aid}
+        and datediff(now(),if (um.last_follow_time >u.transfer_time,um.last_follow_time,u.transfer_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
-		(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
-	left join user u on t0.uid=u.id
-	where u.channel=1
-	and  datediff(now(),t0.lock_time)> #{y}
+      SELECT u.id uid,u.aid,u.nickname name, u.channel ,u.share_type type,u.new_channel newChannel
+      from `user` u left join user_mid um on u.id =um.uid
+	where  u.share_type in(0,2) and  u.channel=1
+    and u.aid =#{aid}
+	and  datediff(now(),u.transfer_time)> #{y}
   </select>
 
     <select id="selectChannelUserDays" resultType="com.goafanti.common.bo.userDaysBo">

+ 0 - 1
src/main/java/com/goafanti/common/model/Admin.java

@@ -3,7 +3,6 @@ package com.goafanti.common.model;
 import com.goafanti.common.constant.AFTConstants;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
-
 import java.util.Date;
 
 /**

+ 8 - 7
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -185,6 +185,7 @@ public class ReleaseUserTask {
 	private void pushUserDays(List<User> userList ) throws InterruptedException {
 		LoggerUtils.debug(getClass(), "==============客户提醒开始============");
 		List<Notice> ln = new ArrayList<>();
+		List<userDaysBo> userChannelList = new ArrayList<userDaysBo>();
 		for (User u : userList) {
 			if (StringUtils.isNotBlank(u.getId())) {
 				List<userDaysBo> userTmpList  = customerService.selectReleaseUserDays(u.getId());
@@ -192,9 +193,10 @@ public class ReleaseUserTask {
 					String str=null;
 					if (ub.getChannel() == 0) {
 						String shareType="";
-						if(ub.getNewChannel()==0)shareType="私有";
+						if(ub.getNewChannel()==0&&ub.getType()==0)shareType="私有";
+						else if(ub.getNewChannel()==0&&ub.getType()==2)shareType="签单";
 						else if(ub.getNewChannel()==1)shareType="渠道";
-						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时%s!", shareType, ub.getName(),ub.getType()==0?"跟进":"签单");
+						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时%s!", shareType, ub.getName(),"跟进");
 					}else {
 						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时签单!", "外联", ub.getName());
 					}
@@ -202,10 +204,8 @@ public class ReleaseUserTask {
 							NoticeStatus.CUSTOMER_LOSE_REMINDER.getCode(), str,ub.getUid()));
 				}
 			}
-		}
-		//查询15天未跟进,私有跟释放前15天重复,去除
-		List<userDaysBo> userChannelList = new ArrayList<userDaysBo>();
-		for (User u : userList) {
+
+			//查询15天未跟进,私有跟释放前15天重复,去除
 			if (StringUtils.isNotBlank(u.getId())) {
 				userChannelList = customerService.selectChannelNotFollow(u.getId());
 			}
@@ -365,7 +365,8 @@ public class ReleaseUserTask {
 		if (!userTmpList.isEmpty()) {
 			for (LockingReleaseBo u : userTmpList) {
 				String shareType="";
-				if(u.getNewChannel()==0)shareType="私有";
+				if(u.getNewChannel()==0&&u.getShareType()==0)shareType="私有";
+				else if(u.getNewChannel()==0&&u.getShareType()==2)shareType="签单";
 				else if(u.getNewChannel()==1)shareType="渠道";
 				nl.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, u.getAid(),
 						NoticeStatus.CUSTOMER_LOSE30.getCode(),

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

@@ -15,6 +15,15 @@ public class LockingReleaseBo {
 	private Integer mySign;
 	private Integer newChannel;
 	private Integer channelType;
+	private Integer shareType;
+
+	public Integer getShareType() {
+		return shareType;
+	}
+
+	public void setShareType(Integer shareType) {
+		this.shareType = shareType;
+	}
 
 	public Integer getChannelType() {
 		return channelType;

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

@@ -590,4 +590,5 @@ public interface CustomerService {
     Object importExcel(MultipartFile file);
 
 	Object getRestrictCustomerByName(String name);
+
 }

+ 3 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -2242,6 +2242,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		List<LockingReleaseBo> list = new ArrayList<>();
 		List<LockingReleaseBo> lockingReleaseBos = userLockReleaseMapper.selectWaitReleaseCustomer(uid);
 		for (LockingReleaseBo bo : lockingReleaseBos) {
+			// 渠道为空或者不其他的需要处理
 			if (bo.getChannelType()==null||bo.getChannelType()!=1){
 				list.add(bo);
 			}
@@ -3109,6 +3110,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return userMapper.getRestrictCustomerByName(name,TokenManager.getAdminId());
 	}
 
+
+
 	private Object pushUserName(List<InputExcelUser> list) {
 		List<InputExcelUser> res=new ArrayList<>();
 		List<InputExcelUser> list2=new ArrayList<>();