|
|
@@ -7,7 +7,6 @@ import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.dao.*;
|
|
|
import com.goafanti.common.enums.NoticeStatus;
|
|
|
import com.goafanti.common.enums.NoticeTypes;
|
|
|
-import com.goafanti.common.model.AdminUserCount;
|
|
|
import com.goafanti.common.model.Notice;
|
|
|
import com.goafanti.common.model.User;
|
|
|
import com.goafanti.common.model.UserTransferLog;
|
|
|
@@ -18,8 +17,8 @@ import com.goafanti.customer.bo.LockingReleaseBo;
|
|
|
import com.goafanti.customer.service.CustomerService;
|
|
|
import com.goafanti.user.service.UserService;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
|
@@ -30,8 +29,8 @@ import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
-@Component
|
|
|
-//@RestController
|
|
|
+//@Component
|
|
|
+@RestController
|
|
|
public class ReleaseUserTask {
|
|
|
@Resource
|
|
|
private CustomerService customerService;
|
|
|
@@ -64,8 +63,8 @@ public class ReleaseUserTask {
|
|
|
*
|
|
|
*/
|
|
|
// @Scheduled(cron = "0 22 16 * * ?")
|
|
|
-// @RequestMapping("/open/test")
|
|
|
- @Scheduled(cron = "0 0 1 * * ?")
|
|
|
+ @RequestMapping("/open/test")
|
|
|
+// @Scheduled(cron = "0 0 1 * * ?")
|
|
|
public void startTask() {
|
|
|
try {
|
|
|
List<User> userList = userService.selectUserByRoleName("营销员", "营销经理");
|
|
|
@@ -307,32 +306,12 @@ public class ReleaseUserTask {
|
|
|
}
|
|
|
}
|
|
|
//签单客户要单独处理,没有锁,直接释放
|
|
|
- List<LockingReleaseBo> newList = new ArrayList<LockingReleaseBo>();
|
|
|
- if (!lockSignList.isEmpty()) {
|
|
|
- for (int i = 0; i < lockSignList.size(); i++) {
|
|
|
- newList.add(lockSignList.get(i));
|
|
|
- if (pointsDataLimit == newList.size() || i == lockUserList.size() - 1) {
|
|
|
- customerService.updateUserShareType(newList);
|
|
|
- newList.clear();
|
|
|
- Thread.sleep(2000);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ pushSignUser(lockSignList);
|
|
|
//处理私有客户
|
|
|
- if (!lockUserList.isEmpty()) {
|
|
|
- for (int i = 0; i < lockUserList.size(); i++) {
|
|
|
- newList.add(lockUserList.get(i));
|
|
|
- if (pointsDataLimit == newList.size() || i == lockUserList.size() - 1) {
|
|
|
- customerService.updatePendingReleaseLock(newList);
|
|
|
- newList.clear();
|
|
|
- Thread.sleep(2000);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ pushPrivateUser(lockUserList);
|
|
|
//处理每个人重复的天数
|
|
|
- pushSalesmanCount(lockUserList);
|
|
|
+ pushSalesmanPrivateCount(lockUserList);
|
|
|
+ pushSalesmanSignCount(lockSignList);
|
|
|
pushChannel(releaseTime, userList);
|
|
|
//客户释放
|
|
|
List<LockingReleaseBo> lockList = customerService.selectPendinglockUserList();
|
|
|
@@ -351,23 +330,52 @@ public class ReleaseUserTask {
|
|
|
LoggerUtils.debug(getClass(), "==============客户释放完成============");
|
|
|
}
|
|
|
|
|
|
+ private void pushSalesmanSignCount(List<LockingReleaseBo> lockUserList) {
|
|
|
+ }
|
|
|
|
|
|
+ private void pushSalesmanPrivateCount(List<LockingReleaseBo> list) {
|
|
|
+ for (LockingReleaseBo e : list) {
|
|
|
+ String sartTime= e.getLockTime();
|
|
|
+ String endTime=e.getLockTime()+" 23:59:59";
|
|
|
+ adminUserCountMapper.updateByaidAndDate(e.getAid(), sartTime, endTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ private void pushPrivateUser(List<LockingReleaseBo> lockUserList) throws InterruptedException {
|
|
|
+ List<LockingReleaseBo> newList=new ArrayList<LockingReleaseBo>();
|
|
|
+ if (!lockUserList.isEmpty()) {
|
|
|
+ for (int i = 0; i < lockUserList.size(); i++) {
|
|
|
+ newList.add(lockUserList.get(i));
|
|
|
+ if (pointsDataLimit == newList.size() || i == lockUserList.size() - 1) {
|
|
|
+ customerService.updatePendingReleaseLock(newList);
|
|
|
+ newList.clear();
|
|
|
+ Thread.sleep(2000);
|
|
|
+ }
|
|
|
|
|
|
- private void pushSalesmanCount(List<LockingReleaseBo> aidList) {
|
|
|
- for (LockingReleaseBo e : aidList) {
|
|
|
- String dates= e.getLockTime();
|
|
|
- AdminUserCount adminUserCount = customerService.getAdminUserCount(e.getAid(), dates);
|
|
|
- if (adminUserCount!=null&&adminUserCount.getPrivateCount()>0){
|
|
|
- AdminUserCount newAdminUserCount = new AdminUserCount();
|
|
|
- newAdminUserCount.setId(adminUserCount.getId());
|
|
|
- newAdminUserCount.setPrivateCount(adminUserCount.getPrivateCount()-1);
|
|
|
- adminUserCountMapper.updateByPrimaryKeySelective(newAdminUserCount);
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void pushSignUser(List<LockingReleaseBo> lockSignList) throws InterruptedException {
|
|
|
+ List<LockingReleaseBo> newList = new ArrayList<LockingReleaseBo>();
|
|
|
+ if (!lockSignList.isEmpty()) {
|
|
|
+ for (int i = 0; i < lockSignList.size(); i++) {
|
|
|
+ newList.add(lockSignList.get(i));
|
|
|
+ if (pointsDataLimit == newList.size() || i == lockSignList.size() - 1) {
|
|
|
+ customerService.updateUserShareType(newList);
|
|
|
+ newList.clear();
|
|
|
+ Thread.sleep(2000);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private void pushSalesmanCount(List<LockingReleaseBo> aidList) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 处理外联
|
|
|
*/
|