Browse Source

修改定时任务

anderx 4 years ago
parent
commit
39126e1c5b

+ 9 - 0
src/main/java/com/goafanti/common/bo/userDaysBo.java

@@ -7,6 +7,7 @@ public class userDaysBo {
 	private String name;
 	private Integer recovery;
 	private Integer channel;
+	private Integer type;
 
 	
 	public String getUid() {
@@ -50,4 +51,12 @@ public class userDaysBo {
 		this.channel = channel;
 	}
 
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
 }

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

@@ -451,7 +451,7 @@
   </select>
   
   <select id="selectUserDays" 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 ,1 type
 	from
 		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
 	left join 
@@ -461,7 +461,18 @@
 	where u.channel=0
 	and  datediff(now(),t0.lock_time)> #{x}
 	UNION 
-	  select  t0.uid, t0.aid, u.nickname name ,u.channel 
+	select  t0.uid, t0.aid, u.nickname name ,u.channel ,0 type
+	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 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
 	from
 		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
 	left join 
@@ -474,7 +485,7 @@
   
     <select id="selectChannelUserDays" resultType="com.goafanti.common.bo.userDaysBo">
 	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='1' )t0
+	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

+ 23 - 3
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -72,9 +72,11 @@ public class ReleaseUserTask {
 				for (userDaysBo ub : userTmpList) {
 					String str=null;  
 					if (ub.getChannel() == 0) {
-						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时跟进或者限时签单!", "私有", ub.getName());
+						str = String.format("您的%s客户【%s】剩余天数不足十五天,请及时%s!",
+								"私有", 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()));
@@ -131,6 +133,7 @@ public class ReleaseUserTask {
 						userTmpList = customerService.selectWaitReleaseCustomer(u.getId(), 0);
 						// 获取270天释放
 						userTmpList2 = customerService.selectWaitReleaseCustomer(u.getId(), 1);
+						addUserNotice(userTmpList,userTmpList2);
 						//
 						customerService.pushReleaseLog(userTmpList, 0);
 						customerService.pushReleaseLog(userTmpList2, 1);
@@ -204,6 +207,23 @@ public class ReleaseUserTask {
 		LoggerUtils.debug(getClass(), "==============客户释放完成============");
 	}
 
+	private void addUserNotice(List<LockingReleaseBo> userTmpList, List<LockingReleaseBo> userTmpList2) {
+		List<Notice> nl=new ArrayList<Notice>();
+		for (LockingReleaseBo u : userTmpList) {
+			nl.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, u.getAid(),
+					NoticeStatus.CUSTOMER_LOSE30.getCode(), 
+					String.format("您的%s客户【%s】已经30天未跟进,已经自动释放!", "私有", u.getUserName()),
+					u.getUid()));
+		}
+		for (LockingReleaseBo u : userTmpList2) {
+			nl.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, u.getAid(),
+					NoticeStatus.CUSTOMER_LOSE270.getCode(), 
+					String.format("您的%s客户【%s】已经270天未签单,已经自动释放!", "私有", u.getUserName()),
+					u.getUid()));
+		}
+		if(!nl.isEmpty())noticeMapper.insertBatch(nl);
+	}
+
 	private void addChannelNotice(List<userDaysBo> hsList, List<userDaysBo> sfList) {
 		List<Notice> nl=new ArrayList<Notice>();
 		for (userDaysBo hs : hsList) {
@@ -219,7 +239,7 @@ public class ReleaseUserTask {
 					String.format("您的%s客户【%s】已经90天未跟进,已经自动释放!", "渠道", sf.getName()),
 					sf.getUid()));
 		}
-		noticeMapper.insertBatch(nl);
+		if(!nl.isEmpty())noticeMapper.insertBatch(nl);
 	}
 
 }

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

@@ -2053,22 +2053,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 							list3.add(utl);
 						}
 						userTransferLogMapper.insertList(list3);
-						// 处理通知
-						List<Notice> ln = new ArrayList<>();
-						for (LockingReleaseBo lrb : newList) {
-							String str = null;
-							Integer code = null;
-							if (type == 0) {
-								str = String.format("您的%s客户【%s】30天未跟进已释放!", "私有", lrb.getUserName());
-								code = NoticeStatus.CUSTOMER_LOSE30.getCode();
-							} else if (type == 1) {
-								str = String.format("您的%s客户【%s】270天未签单已释放!", "私有", lrb.getUserName());
-								code = NoticeStatus.CUSTOMER_LOSE270.getCode();
-							}
-							ln.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, lrb.getAid(), code, str,
-									lrb.getUid()));
-						}
-						noticeMapper.insertBatch(ln);
 					}
 				}
 				newList.clear();

+ 0 - 1
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -377,7 +377,6 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	@Override
 	public void pushReleaseUserChannel(List<userDaysBo> newCList,Integer type) {
 		userMapper.updateReleaseUserChannel(newCList,type);
-		//通知
 		
 	}
 	

+ 8 - 8
src/main/resources/props/config_local.properties

@@ -1,13 +1,13 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #本地
-jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-jdbc.username=root
-jdbc.password=123456
-#测试
-#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #jdbc.username=root
-#jdbc.password=aftdev
+#jdbc.password=123456
+#测试
+jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.username=root
+jdbc.password=aftdev
 #\u68c0\u6d4b\u6570\u636e\u5e93\u94fe\u63a5\u662f\u5426\u6709\u6548\uff0c\u5fc5\u987b\u914d\u7f6e
 jdbc.validationQuery=SELECT 'x'
 #\u521d\u59cb\u8fde\u63a5\u6570
@@ -64,12 +64,12 @@ user_remind_days=15
 portal.host=//sf.jishutao.com/portal/2.0.6
 avatar.upload.host=//sb.jishutao.com/upload
 #连接开�
-#static.host=//172.16.0.253/1.1.70
+#static.host=//172.16.0.253/1.1.71
 #avatar.host=//172.16.0.253
 
 avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.1.70
+static.host=//static.jishutao.com/1.1.71
 
 upload.path=F:/data/public/upload
 upload.private.path=F:/data/private/upload