Browse Source

定时任务修改

anderx 3 years ago
parent
commit
7d6bd4f980

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

@@ -56,9 +56,10 @@ public class ReleaseUserTask {
 	@Scheduled(cron = "0 0 1  * * ?")
 	public void startTask() {
 		try {
-			pushUserDays();
+			List<User> userList = userService.selectUserByRoleName("营销员", "营销经理");
+			pushUserDays(userList);
 			Thread.sleep(2000);
-			updateUser();
+			updateUser(userList);
 			Thread.sleep(2000);
 		} catch (InterruptedException e) {
 			e.printStackTrace();
@@ -66,16 +67,12 @@ public class ReleaseUserTask {
 
 	}
 
-//	@ResponseBody
-//	@RequestMapping(value = "/open/remindUser", method = RequestMethod.GET)
-	private void pushUserDays() throws InterruptedException {
+	private void pushUserDays(List<User> userList ) throws InterruptedException {
 		LoggerUtils.debug(getClass(), "==============客户提醒开始============");
-		List<User> userList = userService.selectUserByRoleName("营销员", "营销经理");
-		List<userDaysBo> userTmpList = null;
 		List<Notice> ln = new ArrayList<>();
 		for (User u : userList) {
 			if (StringUtils.isNotBlank(u.getId())) {
-				userTmpList = customerService.selectReleaseUserDays(u.getId());
+				List<userDaysBo> userTmpList  = customerService.selectReleaseUserDays(u.getId());
 				for (userDaysBo ub : userTmpList) {
 					String str=null;
 					if (ub.getChannel() == 0) {
@@ -113,20 +110,16 @@ public class ReleaseUserTask {
 	/**
 	 * 将客户和业务转为待释放
 	 */
-//	@RequestMapping(value = "/open/updateUser", method = RequestMethod.GET)
-	public void updateUser() {
+	public void updateUser(List<User> userList ) {
 		LoggerUtils.debug(getClass(), "==============客户释放开始============");
 		Date releaseTime = new Date();
 		try {
-			List<User> userList = userService.selectUserByRoleName("营销员", "营销经理");
 			List<LockingReleaseBo> lockUserList = new ArrayList<LockingReleaseBo>();
 			if (userList != null && !userList.isEmpty()) {
 				for (User u : userList) {
-					List<LockingReleaseBo> userTmpList = new ArrayList<LockingReleaseBo>();
-
 					if (StringUtils.isNotBlank(u.getId())) {
 						// 获取30天释放
-						userTmpList = customerService.selectWaitReleaseCustomer(u.getId());
+						List<LockingReleaseBo>  userTmpList = customerService.selectWaitReleaseCustomer(u.getId());
 						customerService.pushReleaseLog(userTmpList, 0);
 						addUserNotice(userTmpList);
 						if (userTmpList != null && !userTmpList.isEmpty())

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

@@ -2262,6 +2262,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 					newList.clear();
 					Thread.sleep(2000);
 				}
+
 			}
 
 		}