|
|
@@ -1,54 +1,49 @@ |
|
|
|
package com.hz.pm.api.open.manage; |
|
|
|
|
|
|
|
import java.security.MessageDigest; |
|
|
|
import java.security.NoSuchAlgorithmException; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Sets; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.expert.entity.ExpertUserFullInfo; |
|
|
|
import com.hz.pm.api.expert.model.dto.DictionaryVO; |
|
|
|
import com.hz.pm.api.expert.service.IExpertUserFullInfoService; |
|
|
|
import com.hz.pm.api.meeting.entity.domain.Meeting; |
|
|
|
import com.hz.pm.api.meeting.entity.domain.MeetingExpert; |
|
|
|
import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge; |
|
|
|
import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; |
|
|
|
import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; |
|
|
|
import com.hz.pm.api.meeting.service.IMeetingExpertJudgeService; |
|
|
|
import com.hz.pm.api.meta.model.dto.DictionaryDTO; |
|
|
|
import com.hz.pm.api.open.model.po.PageExpertJudgePO; |
|
|
|
import com.hz.pm.api.open.model.po.ReqMeetingExpertSignPO; |
|
|
|
import com.hz.pm.api.open.model.vo.ExpertJudgeToMhVO; |
|
|
|
import com.hz.pm.api.user.model.entity.UserInfo; |
|
|
|
import com.hz.pm.api.user.security.model.UserFullInfoDTO; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Sets; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.meeting.entity.domain.Meeting; |
|
|
|
import com.hz.pm.api.meeting.entity.domain.MeetingExpert; |
|
|
|
import com.hz.pm.api.meeting.service.IMeetingExpertService; |
|
|
|
import com.hz.pm.api.meeting.service.IMeetingService; |
|
|
|
import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; |
|
|
|
import com.hz.pm.api.meta.helper.DictionaryCache; |
|
|
|
import com.hz.pm.api.meta.model.dto.DictionaryDTO; |
|
|
|
import com.hz.pm.api.meta.model.entity.ExpertDictionary; |
|
|
|
import com.hz.pm.api.meta.service.IExpertDictionaryService; |
|
|
|
import com.hz.pm.api.open.model.po.PageExpertJudgePO; |
|
|
|
import com.hz.pm.api.open.model.po.ReqMeetingExpertInfoPO; |
|
|
|
import com.hz.pm.api.open.model.po.ReqMeetingExpertSignPO; |
|
|
|
import com.hz.pm.api.open.model.vo.ExpertInfoVO; |
|
|
|
import com.hz.pm.api.open.model.vo.ExpertJudgeToMhVO; |
|
|
|
import com.hz.pm.api.open.model.vo.MeetingExpertToMhDTO; |
|
|
|
import com.hz.pm.api.open.util.OpenApiCheckSignUtil; |
|
|
|
import com.hz.pm.api.user.model.entity.UserInfo; |
|
|
|
import com.hz.pm.api.user.security.model.UserFullInfoDTO; |
|
|
|
import com.hz.pm.api.user.service.IUserInfoService; |
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author CMM |
|
|
@@ -59,9 +54,8 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class OpenApiMeetingExpertManage { |
|
|
|
|
|
|
|
@Value("${hz-pm.interfaceKey}") |
|
|
|
private String meetingExpertInfoKey; |
|
|
|
|
|
|
|
private final OpenApiCheckSignUtil openApiCheckSignUtil; |
|
|
|
private final IMeetingService meetingService; |
|
|
|
private final IMeetingExpertService meetingExpertService; |
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
@@ -74,7 +68,7 @@ public class OpenApiMeetingExpertManage { |
|
|
|
public List<MeetingExpertToMhDTO> infoList(ReqMeetingExpertInfoPO po) { |
|
|
|
String key = po.getKey(); |
|
|
|
// 校验传入的签名 |
|
|
|
checkSign(key); |
|
|
|
openApiCheckSignUtil.checkSign(key); |
|
|
|
// 获取已经抽取(指定)完成 确认参加会议并且未签到的专家信息 |
|
|
|
List<Meeting> meetingList = meetingService.list(Wrappers.lambdaQuery(Meeting.class) |
|
|
|
.eq(Meeting::getConfirmedRoster, Boolean.TRUE) |
|
|
@@ -175,49 +169,11 @@ public class OpenApiMeetingExpertManage { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
private void checkSign(String key) { |
|
|
|
if (StrUtil.isBlank(key)) { |
|
|
|
throw new BizException("签名错误"); |
|
|
|
} |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
sb.append("key=").append(meetingExpertInfoKey); |
|
|
|
// 使用SHA-256进行加密 |
|
|
|
String sign = null; |
|
|
|
try { |
|
|
|
MessageDigest md = MessageDigest.getInstance("SHA-256"); |
|
|
|
byte[] bytes = md.digest(sb.toString().getBytes()); |
|
|
|
sign = bytesToHexString(bytes); |
|
|
|
} catch (NoSuchAlgorithmException e) { |
|
|
|
log.error("签名校验错误:", e); |
|
|
|
} |
|
|
|
if (sign != null && sign.length() >= 8 && StrUtil.endWith(sign, key)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
throw new BizException("签名错误"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 将字节数组转换为十六进制字符串 |
|
|
|
* |
|
|
|
* @param bytes 字节数组 |
|
|
|
* @return 十六进制字符串 |
|
|
|
*/ |
|
|
|
private static String bytesToHexString(byte[] bytes) { |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
for (byte b : bytes) { |
|
|
|
String hex = Integer.toHexString(b & 0xFF); |
|
|
|
if (hex.length() == 1) { |
|
|
|
sb.append("0"); |
|
|
|
} |
|
|
|
sb.append(hex); |
|
|
|
} |
|
|
|
return sb.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
public String sign(ReqMeetingExpertSignPO po) { |
|
|
|
String key = po.getKey(); |
|
|
|
// 校验传入的签名 |
|
|
|
checkSign(key); |
|
|
|
openApiCheckSignUtil.checkSign(key); |
|
|
|
Long meetingId = po.getMeetingId(); |
|
|
|
Long userId = po.getUserId(); |
|
|
|
LocalDateTime signTime = po.getSignTime(); |
|
|
@@ -236,7 +192,7 @@ public class OpenApiMeetingExpertManage { |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<ExpertJudgeToMhVO> pageExpertJudges(PageExpertJudgePO po) { |
|
|
|
checkSign(po.getKey()); |
|
|
|
openApiCheckSignUtil.checkSign(po.getKey()); |
|
|
|
LambdaQueryWrapper<MeetingExpertJudge> query = Wrappers.lambdaQuery(MeetingExpertJudge.class) |
|
|
|
.eq(po.getMeetingId() != null, MeetingExpertJudge::getMeetingId, po.getMeetingId()) |
|
|
|
.orderByDesc(MeetingExpertJudge::getCreateOn); |
|
|
|