|
@@ -1,6 +1,5 @@
|
|
|
package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.qmth.distributed.print.business.entity.TBSyncTask;
|
|
|
import com.qmth.distributed.print.business.service.CloudUserPushService;
|
|
|
import com.qmth.distributed.print.business.service.CloudUserPushStatusService;
|
|
@@ -9,9 +8,7 @@ import com.qmth.teachcloud.common.bean.params.UserPushParam;
|
|
|
import com.qmth.teachcloud.common.bean.result.PushResult;
|
|
|
import com.qmth.teachcloud.common.contant.SpringContextHolder;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
-import com.qmth.teachcloud.common.entity.SysRole;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
-import com.qmth.teachcloud.common.entity.SysUserRole;
|
|
|
import com.qmth.teachcloud.common.enums.RoleTypeEnum;
|
|
|
import com.qmth.teachcloud.common.enums.TaskResultEnum;
|
|
|
import com.qmth.teachcloud.common.enums.TaskStatusEnum;
|
|
@@ -54,23 +51,23 @@ public class CloudUserPushServiceImpl implements CloudUserPushService {
|
|
|
public void pushCloudUser(Long userId, SysUser requestUser) throws IllegalAccessException {
|
|
|
List<Long> userIdList = new ArrayList<>();
|
|
|
userIdList.add(userId);
|
|
|
- this.pushCloudUser(userIdList,requestUser);
|
|
|
+ this.pushCloudUser(userIdList, requestUser);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void pushCloudUser(List<Long> userIdList, SysUser requestUser) throws IllegalAccessException {
|
|
|
Long schoolId = requestUser.getSchoolId();
|
|
|
userIdList = userIdList.stream().distinct().collect(Collectors.toList());
|
|
|
- if (userIdList.size() > 0){
|
|
|
+ if (userIdList.size() > 0) {
|
|
|
List<SysUser> sysUserList = sysUserService.listByIds(userIdList);
|
|
|
// 构建用户推送map
|
|
|
Map<Long, List<UserPushParam>> userPushMap = this.buildUserPushMap(sysUserList, schoolId);
|
|
|
|
|
|
// 初始化推送任务
|
|
|
- tbSyncTaskService.initUserPushTasks(userPushMap,requestUser);
|
|
|
+ tbSyncTaskService.initUserPushTasks(userPushMap, requestUser);
|
|
|
// 执行推送异步任务
|
|
|
CloudUserPushService cloudUserPushService = SpringContextHolder.getBean(CloudUserPushService.class);
|
|
|
- cloudUserPushService.asyncPushUser(userPushMap,requestUser);
|
|
|
+ cloudUserPushService.asyncPushUser(userPushMap, requestUser);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -105,6 +102,8 @@ public class CloudUserPushServiceImpl implements CloudUserPushService {
|
|
|
case SUBJECT_HEADER:
|
|
|
leaderPush = bind ? UserPushResultEnum.BIND_SUCCESS : UserPushResultEnum.UNBIND_SUCCESS;
|
|
|
break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
} else {
|
|
|
// 推送失败
|
|
@@ -119,6 +118,8 @@ public class CloudUserPushServiceImpl implements CloudUserPushService {
|
|
|
leaderPush = bind ? UserPushResultEnum.BIND_FAILED : UserPushResultEnum.UNBIND_FAILED;
|
|
|
syncExceptionCell = "【" + RoleTypeEnum.MARKER_LEADER.getDesc() + leaderPush.getDesc() + "】" + errorMessage + "\n";
|
|
|
break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
if (SystemConstant.strNotNull(syncExceptionCell)) {
|
|
@@ -129,7 +130,7 @@ public class CloudUserPushServiceImpl implements CloudUserPushService {
|
|
|
syncException = syncException + e.getMessage();
|
|
|
} finally {
|
|
|
// 更新或新增云阅卷用户推送表状态
|
|
|
- cloudUserPushStatusService.updateUserPushRecord(userId,markerPush,leaderPush,syncStatus,requestUser);
|
|
|
+ cloudUserPushStatusService.updateUserPushRecord(userId, markerPush, leaderPush, syncStatus, requestUser);
|
|
|
// 更新't_b_sync_task'表
|
|
|
if (SystemConstant.strNotNull(syncException)) {
|
|
|
tbSyncTask.setResult(TaskResultEnum.ERROR);
|
|
@@ -146,8 +147,9 @@ public class CloudUserPushServiceImpl implements CloudUserPushService {
|
|
|
|
|
|
/**
|
|
|
* 构建用户推送map
|
|
|
+ *
|
|
|
* @param sysUserList 用户集合
|
|
|
- * @param schoolId 学校id
|
|
|
+ * @param schoolId 学校id
|
|
|
* @return k -> userId v-> List<UserPushParam> 有且只有两条记录
|
|
|
*/
|
|
|
private Map<Long, List<UserPushParam>> buildUserPushMap(List<SysUser> sysUserList, Long schoolId) {
|
|
@@ -162,7 +164,7 @@ public class CloudUserPushServiceImpl implements CloudUserPushService {
|
|
|
|
|
|
// 用户推送相关信息
|
|
|
boolean enable = sysUser.getEnable();
|
|
|
- SyncStatusEnum syncStatus = cloudUserPushStatusService.findRecordByUserId(userId,schoolId).getSyncStatus();
|
|
|
+ SyncStatusEnum syncStatus = cloudUserPushStatusService.findRecordByUserId(userId, schoolId).getSyncStatus();
|
|
|
boolean isMarker = sysUserService.includeSysRole(userId, RoleTypeEnum.MARKER);
|
|
|
boolean isLeader = sysUserService.includeSysRole(userId, RoleTypeEnum.MARKER_LEADER);
|
|
|
|