Przeglądaj źródła

定时任务修改

anderx 4 lat temu
rodzic
commit
0d561719f3

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

@@ -458,9 +458,18 @@
 		(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 1=1
-	and (datediff(now(),if(t0.lock_time < t1.last_follow_time,t1.last_follow_time,t1.t0.lock_time))> #{x} 
-		or datediff(now(),t0.lock_time)> #{y})
+	where u.channel=0
+	and  datediff(now(),t0.lock_time)> #{x}
+	UNION 
+	  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 
+		(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>
   
     <select id="selectChannelUserDays" resultType="com.goafanti.common.bo.userDaysBo">
@@ -480,7 +489,7 @@
 		(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 1=1
+	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} 
   </select>
   

+ 12 - 13
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -69,29 +69,28 @@ public class ReleaseUserTask {
 		for (User u : userList) {
 			if (StringUtils.isNotBlank(u.getId())) {
 				userTmpList = customerService.selectReleaseUserDays(u.getId());
-			}
-			for (userDaysBo ub : userTmpList) {
-				String str=null;  
-				if (ub.getChannel() == 0) {
-					str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时跟进或者限时签单!", "私有", ub.getName());
-				}else {
-					str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时跟进或者限时签单!", "渠道", ub.getName());
+				for (userDaysBo ub : userTmpList) {
+					String str=null;  
+					if (ub.getChannel() == 0) {
+						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时跟进或者限时签单!", "私有", ub.getName());
+					}else {
+						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()));
 				}
-				ln.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, ub.getAid(),
-						NoticeStatus.CUSTOMER_LOSE_REMINDER.getCode(), str,ub.getUid()));
 			}
 		}
-		//查询15天未跟进
+		//查询15天未跟进,私有跟释放前15天重复,去除
 		List<userDaysBo> userChannelList = new ArrayList<userDaysBo>();
 		for (User u : userList) {
 			if (StringUtils.isNotBlank(u.getId())) {
+				
 				userChannelList = customerService.selectChannelNotFollow(u.getId());
 			}
 			for (userDaysBo ub : userChannelList) {
 				String str=null;  
-				if (ub.getChannel() == 0) {
-					str = String.format("您的%s客户【%s】已经十五天未跟进,请及时跟进或者限时签单!", "私有", ub.getName());
-				}else {
+				if (ub.getChannel() == 1) {
 					str = String.format("您的%s客户【%s】已经十五天未跟进,请及时跟进或者限时签单!", "渠道", ub.getName());
 				}
 				ln.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, ub.getAid(),

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

@@ -1989,7 +1989,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 
 	@Override
 	public List<userDaysBo> selectReleaseUserDays(String id) {
-		Integer x = 30, y = 270;
+		Integer x = 270, y = 90;
 		x = x - USER_REMIND_DAYS;
 		y = y - USER_REMIND_DAYS;
 		List<userDaysBo> list = userLockReleaseMapper.selectUserDays(id, x, y);