Browse Source

设置自动释放客户和业务

anderx 7 years ago
parent
commit
3226406ab2

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

@@ -360,17 +360,13 @@
 		t0.uid,
 		t0.aid,
 		t0.lock_time,
-		t1.last_follow_time,
-		t2.last_sign_time
+		t1.last_follow_time
 	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 
-		(select buyer_id,salesman_id,max(sign_time) as last_sign_time from t_order where salesman_id = #{aid} group by buyer_id)t2
-	on t0.uid = t2.buyer_id
-	where datediff(t1.last_follow_time,t0.lock_time)>30 or datediff(t2.last_sign_time,t0.lock_time)>270
+	where datediff(t1.last_follow_time,t0.lock_time)>30 or datediff(now(),t0.lock_time)>270
   </select>
   
   <select id="selectWaitReleaseBusiness"  resultType="com.goafanti.customer.bo.LockingReleaseBo">

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

@@ -15,8 +15,8 @@ import com.goafanti.common.model.User;
 import com.goafanti.customer.bo.LockingReleaseBo;
 import com.goafanti.customer.service.CustomerService;
 import com.goafanti.user.service.UserService;
-//@Component
-@Controller
+@Component
+//@Controller
 public class ReleaseUserTask {
 	@Resource
 	private CustomerService customerServiceImpl;
@@ -26,8 +26,8 @@ public class ReleaseUserTask {
 	/**
 	 * 每天凌晨一点释放客户和业务
 	 */
-	//@Scheduled(cron = "0 0 1 * * ?") 
-	@RequestMapping(value = "/releaseUser")
+	@Scheduled(cron = "0 0 1 * * ?") 
+//	@RequestMapping(value = "/releaseUser")
 	public void releaseUser(){
 		Date releaseTime = new Date();
 		List<User> userList = userServiceImpl.selectUserByRoleName("营销员");