Browse Source

新增导入时间为转换时间

anderx 1 year ago
parent
commit
ebfa3b53e3

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

@@ -1540,6 +1540,7 @@
         left join admin d on a.clue_aid=d.id
         where a.clue_status =1
         <include refid="selectUserClueListSql"/>
+        order by a.clue_transfer_time
         <if test="page_sql !=null">
             ${page_sql}
         </if>

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

@@ -17,10 +17,9 @@ import com.goafanti.common.utils.StringUtils;
 import com.goafanti.customer.bo.LockingReleaseBo;
 import com.goafanti.customer.service.CustomerService;
 import com.goafanti.user.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
@@ -31,16 +30,16 @@ import java.util.List;
 import java.util.UUID;
 
 
-//@Component
-@RestController
+@Component
+//@RestController
 public class ReleaseUserTask {
 	@Resource
 	private CustomerService customerService;
 	@Resource
 	private UserService userService;
-	@Autowired
+	@Resource
 	private NoticeMapper	noticeMapper;
-	@Autowired
+	@Resource
 	private AsyncUtils	asyncUtils;
 	@Value(value = "${dev.name}")
 	private String devName=null;
@@ -63,8 +62,8 @@ public class ReleaseUserTask {
 	 * 客户释放
 	 *
 	 */
-//	@Scheduled(cron = "0 10 17  * * ?")
-	@RequestMapping("/open/test")
+	@Scheduled(cron = "0 48 11  * * ?")
+//	@RequestMapping("/open/test")
 //	@Scheduled(cron = "0 0 1  * * ?")
 	public void startTask() {
 		try {
@@ -92,13 +91,21 @@ public class ReleaseUserTask {
 		for (User admin : userList) {
 			List<User> users = userMapper.selectClueUserByClueType(admin.getId());
 			for (User u : users) {
-				LocalDateTime clueTime = u.getClueTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
+				String aid=null;
+				LocalDateTime clueTime = null;
+				//已分配的通知人与时间不同,
+				if (u.getClueProcess()==1){
+					aid=u.getAid();
+					clueTime=u.getClueTransferTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
+				}else{
+					aid=admin.getId();
+					clueTime=u.getClueTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
+				}
 				LocalDateTime endTime = clueTime.plusDays(15);
 				long between= ChronoUnit.DAYS.between(now, endTime);
 				if (between<1){
 					releaseUserList.add(u);
-					String aid=admin.getId();
-					if (u.getClueProcess()==1)aid=u.getAid();
+
 					logList.add(new UserTransferLog(u.getId(), "1",null, 27, "",date));
 					ln.add(new Notice(UUID.randomUUID().toString(),date, 0, aid,
 							NoticeStatus.CLUE_USER_RELEASE.getCode(),

+ 9 - 2
src/main/java/com/goafanti/customer/service/impl/UserClueServiceImpl.java

@@ -63,9 +63,15 @@ public class UserClueServiceImpl extends BaseMybatisDao<UserMapper> implements U
     private Pagination<OutUserClueList> pushReleaseUser(Pagination<OutUserClueList> page) {
         List<OutUserClueList> list = (List<OutUserClueList>) page.getList();
         LocalDateTime now=LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
+        LocalDateTime clueTime = null;
         for (OutUserClueList e : list) {
-            LocalDateTime clueTime = e.getClueTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
-            clueTime = clueTime.plusDays(15).withHour(0).withMinute(0).withSecond(0);
+            if (e.getClueTransferTime()!=null){
+                clueTime = e.getClueTransferTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
+                clueTime = clueTime.plusDays(15).withHour(0).withMinute(0).withSecond(0);
+            }else {
+                clueTime = e.getClueTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
+                clueTime = clueTime.plusDays(15).withHour(0).withMinute(0).withSecond(0);
+            }
             long between = ChronoUnit.DAYS.between(now,clueTime);
             e.setDays((int) between);
         }
@@ -106,6 +112,7 @@ public class UserClueServiceImpl extends BaseMybatisDao<UserMapper> implements U
         user.setClueProcess(0);
         user.setClueStatus(1);
         user.setClueTime(now);
+        user.setClueTransferTime(now);
         passwordUtil.encryptPassword(user);
         String aname = adminMapper.queryById(TokenManager.getAdminId()).getName();
         UserMid um=new UserMid();