|
@@ -92,18 +92,13 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- LambdaQueryWrapper<RtkAccount> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(RtkAccount::getStatus,0,1);
|
|
|
- wrapper.eq(RtkAccount::getUseStatus,0);
|
|
|
- wrapper.orderByAsc(RtkAccount::getUpdateTime);
|
|
|
- wrapper.orderByAsc(RtkAccount::getId);
|
|
|
- List<RtkAccount> list = this.list(wrapper);
|
|
|
+ List<RtkAccount> list = this.getByNotUseList();
|
|
|
if(list == null || list.isEmpty()){
|
|
|
//账号库存不足,钉钉通知
|
|
|
dingdingService.sendDingDingMsg(0);
|
|
|
throw new BusinessException(ResultCode.RTK_ACCOUNT_NOT_EXIT);
|
|
|
}
|
|
|
- dingdingService.modelThreshold(list.size() -1,this.getCanUseCount());
|
|
|
+ dingdingService.modelThreshold(list.size() -1,this.getByCanUseList().size());
|
|
|
|
|
|
RtkAccount rtkAccount = null;
|
|
|
RtkUseLog rtkUseLog = rtkUseLogService.getByRtkSn(rtkSnCode);
|
|
@@ -122,16 +117,10 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
|
|
|
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) {
|
|
|
RtkAccount dbRtkAccount = this.getById(accountId);
|
|
|
- if(dbRtkAccount == null || dbRtkAccount.getStatus() == 3 || dbRtkAccount.getUseStatus() == 1){
|
|
|
+ if(dbRtkAccount == null || dbRtkAccount.getUseStatus() == 1){
|
|
|
return false;
|
|
|
}
|
|
|
if(dbRtkAccount.getFailureTime() != null && dbRtkAccount.getFailureTime().getTime() <= new Date().getTime() ){
|
|
@@ -232,14 +221,6 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
|
|
|
return this.getOne(wrapper);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<RtkAccount> getByNotFailure() {
|
|
|
- LambdaQueryWrapper<RtkAccount> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.ne(RtkAccount::getStatus,3);
|
|
|
- wrapper.isNotNull(RtkAccount::getFailureTime);
|
|
|
- wrapper.le(RtkAccount::getFailureTime,new Date());
|
|
|
- return this.list(wrapper);
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public Integer insExcelList(List<HashMap<Integer, String>> excelRowList) {
|
|
@@ -348,8 +329,7 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
|
|
|
continue;
|
|
|
}
|
|
|
RtkAccount rtkAccount = this.getByUserName(userName);
|
|
|
- if(rtkAccount ==null){
|
|
|
- errorIndex.add(index -3);
|
|
|
+ if(rtkAccount == null){
|
|
|
continue;
|
|
|
}
|
|
|
Date failureTime = null;
|
|
@@ -374,7 +354,21 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
|
|
|
}
|
|
|
|
|
|
private Integer updateFailureTime(List<RtkAccountInParam> params) {
|
|
|
-
|
|
|
+ for (RtkAccountInParam param : params) {
|
|
|
+ LambdaUpdateWrapper<RtkAccount> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(RtkAccount::getUserName,param.getUserName());
|
|
|
+ wrapper.set(RtkAccount::getFailureTime,param.getFailureTime());
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
return params.size();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<RtkAccount> getByNotUseList() {
|
|
|
+ return this.getBaseMapper().getByNotUseList();
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public List<RtkAccount> getByCanUseList() {
|
|
|
+ return this.getBaseMapper().getByCanUseList();
|
|
|
+ }
|
|
|
}
|