|
@@ -482,9 +482,15 @@ public class GigSignCertReceiver extends BaseRabbiMqHandler<String> {
|
|
List<SysUserSub> userSubList = sysUserSubService.list(Wrappers.<SysUserSub>lambdaQuery()
|
|
List<SysUserSub> userSubList = sysUserSubService.list(Wrappers.<SysUserSub>lambdaQuery()
|
|
.eq(SysUserSub::getDeptId, dept.getDeptId())
|
|
.eq(SysUserSub::getDeptId, dept.getDeptId())
|
|
.eq(SysUserSub::getUserId, user.getUserId())
|
|
.eq(SysUserSub::getUserId, user.getUserId())
|
|
- .eq(SysUserSub::getCallbackStatus, GigCallBackStatus.IN_PROGRESS)
|
|
|
|
|
|
+// .eq(SysUserSub::getCallbackStatus, GigCallBackStatus.IN_PROGRESS)
|
|
.eq(SysUserSub::getGigType, gigType));
|
|
.eq(SysUserSub::getGigType, gigType));
|
|
- if (CollUtil.isEmpty(userSubList)) {
|
|
|
|
|
|
+
|
|
|
|
+ // 过滤掉
|
|
|
|
+ List<SysUserSub> filterSubList = userSubList.stream()
|
|
|
|
+ .filter(sub -> !GigCallBackStatus.IN_PROGRESS.equals(sub.getCallbackStatus())
|
|
|
|
+ || ZhengQiZhiXingCertStatus.CERT.getCode() == sub.getCertStatus())
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ if (CollUtil.isEmpty(filterSubList)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -511,7 +517,7 @@ public class GigSignCertReceiver extends BaseRabbiMqHandler<String> {
|
|
Map<String, Map<String, String>> resultMap = new HashMap<>(1);
|
|
Map<String, Map<String, String>> resultMap = new HashMap<>(1);
|
|
Map<String, String> subMap = new HashMap<>(1);
|
|
Map<String, String> subMap = new HashMap<>(1);
|
|
subMap.put("certStatus", certStatus);
|
|
subMap.put("certStatus", certStatus);
|
|
- resultMap.put(userSubList.get(0).getSubjectLocation().name(), subMap);
|
|
|
|
|
|
+ resultMap.put(filterSubList.get(0).getSubjectLocation().name(), subMap);
|
|
String key = CacheConstants.USER_SIGN_CERT_RESPONSE_KEY + user.getUserId();
|
|
String key = CacheConstants.USER_SIGN_CERT_RESPONSE_KEY + user.getUserId();
|
|
log.info("缓存认证结果到redis:{}", JSONUtil.toJsonStr(resultMap));
|
|
log.info("缓存认证结果到redis:{}", JSONUtil.toJsonStr(resultMap));
|
|
redisTemplate.opsForValue().set(key, JSONUtil.toJsonStr(resultMap), 1, TimeUnit.MINUTES);
|
|
redisTemplate.opsForValue().set(key, JSONUtil.toJsonStr(resultMap), 1, TimeUnit.MINUTES);
|
|
@@ -703,61 +709,25 @@ public class GigSignCertReceiver extends BaseRabbiMqHandler<String> {
|
|
}
|
|
}
|
|
|
|
|
|
JSONArray gigTypeArray = JSONUtil.parseArray(gigTypeJson);
|
|
JSONArray gigTypeArray = JSONUtil.parseArray(gigTypeJson);
|
|
|
|
+ if (CollUtil.isEmpty(gigTypeArray)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
// 根据选择的渠道,分别更新并查询认证状态
|
|
// 根据选择的渠道,分别更新并查询认证状态
|
|
Map<String, Map<String, String>> certResultMap = new LinkedHashMap<>(3);
|
|
Map<String, Map<String, String>> certResultMap = new LinkedHashMap<>(3);
|
|
- gigTypeArray.forEach(o -> certResultMap.put(String.valueOf(o),
|
|
|
|
- this.oladingChannelHandler(user, dept, subjectResult, Enum.valueOf(SubjectLocation.class, String.valueOf(o)))));
|
|
|
|
|
|
+
|
|
|
|
+ String subjectLocationStr = String.valueOf(gigTypeArray.get(0));
|
|
|
|
+ certResultMap.put(subjectLocationStr,
|
|
|
|
+ this.oladingChannelHandler(user, dept, subjectResult, Enum.valueOf(SubjectLocation.class, subjectLocationStr)));
|
|
|
|
|
|
// 结果放到redis
|
|
// 结果放到redis
|
|
Map<String, Map<String, String>> resultMap = new HashMap<>(3);
|
|
Map<String, Map<String, String>> resultMap = new HashMap<>(3);
|
|
- if (gigTypeArray.size() > 1) {
|
|
|
|
- // 同时发起的情况,且是前一个渠道(按照redis存的渠道顺序发送)的状态已返回,则刷新状态到redis
|
|
|
|
- List<SubjectLocation> subjectLocationList = gigTypeArray.stream()
|
|
|
|
- .map(o -> Enum.valueOf(SubjectLocation.class, String.valueOf(o)))
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
- List<SysUserSub> subList = sysUserSubService.list(Wrappers.<SysUserSub>lambdaQuery()
|
|
|
|
- .eq(SysUserSub::getUserId, user.getUserId())
|
|
|
|
- .eq(SysUserSub::getDeptId, dept.getDeptId())
|
|
|
|
- .in(SysUserSub::getSubjectLocation, subjectLocationList));
|
|
|
|
- Map<String, Map<String, String>> dbResultMap = subList.stream()
|
|
|
|
- .collect(Collectors.toMap(sysUserSub -> sysUserSub.getSubjectLocation().name(),
|
|
|
|
- sysUserSub -> MapUtil.builder("certStatus",
|
|
|
|
- OladingCertStatus.resolve(String.valueOf(sysUserSub.getCertStatus())).name()).build()));
|
|
|
|
- resultMap.putAll(dbResultMap);
|
|
|
|
- } else {
|
|
|
|
- // 只有一个渠道的情况
|
|
|
|
- resultMap.putAll(certResultMap);
|
|
|
|
- }
|
|
|
|
|
|
+ // 只有一个渠道的情况
|
|
|
|
+ resultMap.putAll(certResultMap);
|
|
String key = CacheConstants.USER_SIGN_CERT_RESPONSE_KEY + user.getUserId();
|
|
String key = CacheConstants.USER_SIGN_CERT_RESPONSE_KEY + user.getUserId();
|
|
log.info("缓存认证结果到redis:{}", JSONUtil.toJsonStr(resultMap));
|
|
log.info("缓存认证结果到redis:{}", JSONUtil.toJsonStr(resultMap));
|
|
redisTemplate.opsForValue().set(key, JSONUtil.toJsonStr(resultMap), 1, TimeUnit.MINUTES);
|
|
redisTemplate.opsForValue().set(key, JSONUtil.toJsonStr(resultMap), 1, TimeUnit.MINUTES);
|
|
|
|
|
|
- // 处理同时发起时阿拉丁多个渠道的情况(补发)
|
|
|
|
-// if (gigTypeArray.size() > 1) {
|
|
|
|
-// String firstChannel = String.valueOf(gigTypeArray.get(0));
|
|
|
|
-// // 查询阿拉丁第一个渠道的认证状态
|
|
|
|
-// Map<String, String> certStatusMap = resultMap.get(firstChannel);
|
|
|
|
-// // 查询阿拉钉第一个未签约的渠道
|
|
|
|
-// String toSendChannel = "";
|
|
|
|
-// for (Map.Entry<String, Map<String, String>> entry : resultMap.entrySet()) {
|
|
|
|
-// if (OladingCertStatus.UN_SIGNED.name().equals(entry.getValue().get("certStatus"))) {
|
|
|
|
-// toSendChannel = entry.getKey();
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// // 校验需要补发的渠道,是否为第一个
|
|
|
|
-// if (StrUtil.isNotBlank(toSendChannel) && !StrUtil.equals(firstChannel, toSendChannel)) {
|
|
|
|
-// // 如果阿拉丁第一个渠道是已认证的,则补发下一个阿拉丁的渠道(由于阿拉钉同一人不同渠道的回调只有一次,所以这里出现多个渠道需要依次补发)
|
|
|
|
-// if (CollUtil.isNotEmpty(certStatusMap) && OladingCertStatus.CERT.name().equals(certStatusMap.get("certStatus"))) {
|
|
|
|
-// log.info("=============================补发阿拉钉另一渠道MQ:{}==================================", toSendChannel);
|
|
|
|
-// UserSignCertDTO reCertDTO = new UserSignCertDTO();
|
|
|
|
-// reCertDTO.setUserId(user.getUserId());
|
|
|
|
-// reCertDTO.setGigTypeList(Collections.singletonList(Enum.valueOf(GigTypeEnum.class, toSendChannel)));
|
|
|
|
-// sysUserSignCertService.batchChannelCert(reCertDTO);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -780,10 +750,15 @@ public class GigSignCertReceiver extends BaseRabbiMqHandler<String> {
|
|
SysUserSub userSub = sysUserSubService.getOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
SysUserSub userSub = sysUserSubService.getOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
.eq(SysUserSub::getDeptId, dept.getDeptId())
|
|
.eq(SysUserSub::getDeptId, dept.getDeptId())
|
|
.eq(SysUserSub::getUserId, user.getUserId())
|
|
.eq(SysUserSub::getUserId, user.getUserId())
|
|
- .eq(SysUserSub::getCallbackStatus, GigCallBackStatus.IN_PROGRESS)
|
|
|
|
|
|
+// .eq(SysUserSub::getCallbackStatus, GigCallBackStatus.IN_PROGRESS)
|
|
.eq(SysUserSub::getGigType, subjectLocation.getGigType())
|
|
.eq(SysUserSub::getGigType, subjectLocation.getGigType())
|
|
.eq(SysUserSub::getSubjectLocation, subjectLocation));
|
|
.eq(SysUserSub::getSubjectLocation, subjectLocation));
|
|
- if (userSub == null) {
|
|
|
|
|
|
+ if (userSub == null || !GigCallBackStatus.IN_PROGRESS.equals(userSub.getCallbackStatus())) {
|
|
|
|
+ return certStatusMap;
|
|
|
|
+ }
|
|
|
|
+ if (OladingCertStatus.CERT.getCode().equals(String.valueOf(userSub.getCertStatus()))) {
|
|
|
|
+ log.info("已认证,直接返回");
|
|
|
|
+ certStatusMap.put("certStatus", OladingCertStatus.CERT.name());
|
|
return certStatusMap;
|
|
return certStatusMap;
|
|
}
|
|
}
|
|
|
|
|