lyhzzz 11 месяцев назад
Родитель
Сommit
d4e958b3f8

+ 1 - 0
src/main/java/com/fdkankan/manage/service/IRtkAccountService.java

@@ -33,6 +33,7 @@ public interface IRtkAccountService extends IService<RtkAccount> {
     RtkAccount getByUserName(String userName);
     RtkAccount getByUserName(String userName);
 
 
     List<RtkAccount> getByNotFailure();
     List<RtkAccount> getByNotFailure();
+    Long getCanUseCount();
 
 
     Integer insExcelList(List<HashMap<Integer, String>> excelRowList);
     Integer insExcelList(List<HashMap<Integer, String>> excelRowList);
 }
 }

+ 10 - 2
src/main/java/com/fdkankan/manage/service/impl/RtkAccountServiceImpl.java

@@ -82,6 +82,7 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
         if(redisUtil.hasKey(redisKey)){
         if(redisUtil.hasKey(redisKey)){
             String jsonStr = redisUtil.get(redisKey);
             String jsonStr = redisUtil.get(redisKey);
             RtkAccount rtkAccount = JSONObject.parseObject(jsonStr, RtkAccount.class);
             RtkAccount rtkAccount = JSONObject.parseObject(jsonStr, RtkAccount.class);
+            log.info("rtkAccount:{}",jsonStr);
             Boolean flag = checkAccountFailureTime(rtkAccount.getId());
             Boolean flag = checkAccountFailureTime(rtkAccount.getId());
             if(flag){
             if(flag){
                 redisUtil.expire(redisKey,time);
                 redisUtil.expire(redisKey,time);
@@ -102,13 +103,13 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
             dingdingService.sendDingDingMsg(0);
             dingdingService.sendDingDingMsg(0);
             throw new BusinessException(ResultCode.RTK_ACCOUNT_NOT_EXIT);
             throw new BusinessException(ResultCode.RTK_ACCOUNT_NOT_EXIT);
         }
         }
-        dingdingService.modelThreshold(list.size() -1,this.count());
+        dingdingService.modelThreshold(list.size() -1,this.getCanUseCount());
 
 
         RtkAccount rtkAccount = null;
         RtkAccount rtkAccount = null;
         RtkUseLog rtkUseLog = rtkUseLogService.getByRtkSn(rtkSnCode);
         RtkUseLog rtkUseLog = rtkUseLogService.getByRtkSn(rtkSnCode);
         if(rtkUseLog != null && rtkUseLog.getRtkAccountId() != null){
         if(rtkUseLog != null && rtkUseLog.getRtkAccountId() != null){
             RtkAccount rtkAccount2 = this.getById(rtkUseLog.getRtkAccountId());
             RtkAccount rtkAccount2 = this.getById(rtkUseLog.getRtkAccountId());
-            if(rtkAccount2 != null && rtkAccount2.getStatus() == 1){
+            if(rtkAccount2 != null && rtkAccount2.getStatus() == 1 && rtkAccount2.getUseStatus() == 0){
                 rtkAccount = rtkAccount2;
                 rtkAccount = rtkAccount2;
             }
             }
         }
         }
@@ -121,6 +122,13 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
         return rtkAccount;
         return rtkAccount;
     }
     }
 
 
+    @Override
+    public Long getCanUseCount() {
+        LambdaQueryWrapper<RtkAccount> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RtkAccount::getUseStatus,0);
+        return this.count(wrapper);
+    }
+
     private Boolean checkAccountFailureTime(Integer accountId) {
     private Boolean checkAccountFailureTime(Integer accountId) {
         RtkAccount dbRtkAccount = this.getById(accountId);
         RtkAccount dbRtkAccount = this.getById(accountId);
         if(dbRtkAccount == null || dbRtkAccount.getStatus() == 3 || dbRtkAccount.getUseStatus() == 1){
         if(dbRtkAccount == null || dbRtkAccount.getStatus() == 3 || dbRtkAccount.getUseStatus() == 1){

+ 2 - 1
src/main/java/com/fdkankan/manage/task/TaskService.java

@@ -92,13 +92,14 @@ public class TaskService {
     public void checkAccountDb() {
     public void checkAccountDb() {
         LambdaQueryWrapper<RtkAccount> wrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<RtkAccount> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(RtkAccount::getStatus,0,1);
         wrapper.in(RtkAccount::getStatus,0,1);
+        wrapper.eq(RtkAccount::getUseStatus,0);
         wrapper.orderByAsc(RtkAccount::getUpdateTime);
         wrapper.orderByAsc(RtkAccount::getUpdateTime);
         List<RtkAccount> list = rtkAccountService.list(wrapper);
         List<RtkAccount> list = rtkAccountService.list(wrapper);
         if(list == null || list.isEmpty()){
         if(list == null || list.isEmpty()){
             dingdingService.sendDingDingMsg(0);
             dingdingService.sendDingDingMsg(0);
             return;
             return;
         }
         }
-        dingdingService.modelThreshold(list.size(),rtkAccountService.count());
+        dingdingService.modelThreshold(list.size(),rtkAccountService.getCanUseCount());
     }
     }