|
|
@@ -7,15 +7,23 @@ import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
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.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; |
|
|
|
|
|
|
@@ -49,7 +57,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
@Slf4j |
|
|
|
@Component |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class OpenApiMeetingExpertInfoManage { |
|
|
|
public class OpenApiMeetingExpertManage { |
|
|
|
|
|
|
|
@Value("${hz-pm.interfaceKey}") |
|
|
|
private String meetingExpertInfoKey; |
|
|
@@ -61,17 +69,17 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
private final IExpertDictionaryService iExpertDictionaryService; |
|
|
|
private final DictionaryCache dictionaryCache; |
|
|
|
private final IExpertUserFullInfoService expertUserFullInfoService; |
|
|
|
private final IMeetingExpertJudgeService meetingExpertJudgeService; |
|
|
|
|
|
|
|
public List<MeetingExpertToMhDTO> infoList(ReqMeetingExpertInfoPO po) { |
|
|
|
String key = po.getKey(); |
|
|
|
// 校验传入的签名 |
|
|
|
if (!checkSign(key)){ |
|
|
|
throw new BizException("签名错误!"); |
|
|
|
} |
|
|
|
checkSign(key); |
|
|
|
// 获取已经抽取(指定)完成 确认参加会议并且未签到的专家信息 |
|
|
|
List<Meeting> meetingList = meetingService.list(Wrappers.lambdaQuery(Meeting.class) |
|
|
|
.eq(Meeting::getConfirmedRoster, Boolean.TRUE) |
|
|
|
.ne(Meeting::getStatus, MeetingStatusEnum.CANCEL.getCode())); |
|
|
|
if(CollUtil.isEmpty(meetingList)){ |
|
|
|
if (CollUtil.isEmpty(meetingList)) { |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
List<MeetingExpertToMhDTO> result = Lists.newArrayList(); |
|
|
@@ -97,7 +105,7 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
List<Long> userIdList = new ArrayList<>(userIds); |
|
|
|
List<ExpertUserFullInfo> expertUserFullInfos = expertUserFullInfoService.listByUserIds(userIdList); |
|
|
|
Map<Long, ExpertUserFullInfo> userFullInfoMap = MapUtil.newHashMap(); |
|
|
|
if(CollUtil.isNotEmpty(expertUserFullInfos)){ |
|
|
|
if (CollUtil.isNotEmpty(expertUserFullInfos)) { |
|
|
|
userFullInfoMap = expertUserFullInfos.stream().collect(Collectors.toMap(ExpertUserFullInfo::getUserId, v -> v)); |
|
|
|
} |
|
|
|
Set<String> employeeSet = Sets.newHashSet(); |
|
|
@@ -108,15 +116,15 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
Map<Long, UserFullInfoDTO> infoMap = userFullInfos.stream().collect(Collectors.toMap(UserFullInfoDTO::getUserId, v -> v)); |
|
|
|
|
|
|
|
List<ExpertDictionary> expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) |
|
|
|
.eq(ExpertDictionary::getExpertInfoField, ExpertDictTypeEnum.EXPERT_TYPE.getKey()) |
|
|
|
.in(ExpertDictionary::getUserId, userIdSet)); |
|
|
|
.eq(ExpertDictionary::getExpertInfoField, ExpertDictTypeEnum.EXPERT_TYPE.getKey()) |
|
|
|
.in(ExpertDictionary::getUserId, userIdSet)); |
|
|
|
Map<Long, List<ExpertDictionary>> dictMap = expertDictionaryList.stream().collect(Collectors.groupingBy(ExpertDictionary::getUserId)); |
|
|
|
|
|
|
|
for (Map.Entry<Long, List<MeetingExpert>> entry : meetingExpertMap.entrySet()) { |
|
|
|
MeetingExpertToMhDTO vo = new MeetingExpertToMhDTO(); |
|
|
|
Long meetingId = entry.getKey(); |
|
|
|
Meeting meeting = meetingMap.get(meetingId); |
|
|
|
if (Objects.nonNull(meeting)){ |
|
|
|
if (Objects.nonNull(meeting)) { |
|
|
|
vo.setMeetingId(meeting.getId()); |
|
|
|
vo.setStartTime(meeting.getStartTime()); |
|
|
|
vo.setEndTime(meeting.getEndTime()); |
|
|
@@ -126,10 +134,10 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
vo.setContact(meeting.getContact()); |
|
|
|
} |
|
|
|
List<MeetingExpert> meetingExperts = entry.getValue(); |
|
|
|
if (CollUtil.isNotEmpty(meetingExperts)){ |
|
|
|
if (CollUtil.isNotEmpty(meetingExperts)) { |
|
|
|
// 获取未签到的专家信息 |
|
|
|
List<MeetingExpert> expertUserList = meetingExperts.stream().filter(m -> Boolean.FALSE.equals(m.getSignStatus())).collect(Collectors.toList()); |
|
|
|
if (CollUtil.isNotEmpty(expertUserList)){ |
|
|
|
if (CollUtil.isNotEmpty(expertUserList)) { |
|
|
|
Map<Long, ExpertUserFullInfo> finalUserFullInfoMap = userFullInfoMap; |
|
|
|
List<ExpertInfoVO> expertInfoVOList = expertUserList.stream().map(m -> { |
|
|
|
ExpertInfoVO expertInfoVO = new ExpertInfoVO(); |
|
|
@@ -137,16 +145,16 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
expertInfoVO.setName(m.getExpertName()); |
|
|
|
expertInfoVO.setPhoneNo(m.getMobile()); |
|
|
|
UserFullInfoDTO userFullInfoDTO = infoMap.get(m.getExpertId()); |
|
|
|
if (Objects.nonNull(userFullInfoDTO)){ |
|
|
|
if (Objects.nonNull(userFullInfoDTO)) { |
|
|
|
expertInfoVO.setMhUnitId(userFullInfoDTO.getMhUnitId()); |
|
|
|
expertInfoVO.setMhUnitName(userFullInfoDTO.getMhUnitName()); |
|
|
|
} |
|
|
|
ExpertUserFullInfo expertUserFullInfo = finalUserFullInfoMap.get(m.getExpertId()); |
|
|
|
if (Objects.nonNull(expertUserFullInfo)){ |
|
|
|
if (Objects.nonNull(expertUserFullInfo)) { |
|
|
|
expertInfoVO.setExpertId(expertUserFullInfo.getId()); |
|
|
|
} |
|
|
|
List<ExpertDictionary> dictionaries = dictMap.get(m.getExpertId()); |
|
|
|
if (CollUtil.isNotEmpty(dictionaries)){ |
|
|
|
if (CollUtil.isNotEmpty(dictionaries)) { |
|
|
|
List<DictionaryVO> dictionaryFieldInfos = dictionaries.stream().map(r -> { |
|
|
|
DictionaryVO dictionary = new DictionaryVO(); |
|
|
|
dictionary.setDictionaryType(r.getExpertInfoField()); |
|
|
@@ -167,7 +175,10 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
private Boolean checkSign(String key) { |
|
|
|
private void checkSign(String key) { |
|
|
|
if (StrUtil.isBlank(key)) { |
|
|
|
throw new BizException("签名错误"); |
|
|
|
} |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
sb.append("key=").append(meetingExpertInfoKey); |
|
|
|
// 使用SHA-256进行加密 |
|
|
@@ -177,13 +188,12 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
byte[] bytes = md.digest(sb.toString().getBytes()); |
|
|
|
sign = bytesToHexString(bytes); |
|
|
|
} catch (NoSuchAlgorithmException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("签名校验错误:", e); |
|
|
|
} |
|
|
|
if (sign == null || sign.length() <= 8) { |
|
|
|
return false; |
|
|
|
if (sign != null && sign.length() <= 8 && StrUtil.startWith(sign, key)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
String signStr = sign.substring(sign.length() - 8); |
|
|
|
return signStr.equals(key); |
|
|
|
throw new BizException("签名错误"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -207,9 +217,7 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
public String sign(ReqMeetingExpertSignPO po) { |
|
|
|
String key = po.getKey(); |
|
|
|
// 校验传入的签名 |
|
|
|
if (!checkSign(key)){ |
|
|
|
throw new BizException("签名错误!"); |
|
|
|
} |
|
|
|
checkSign(key); |
|
|
|
Long meetingId = po.getMeetingId(); |
|
|
|
Long userId = po.getUserId(); |
|
|
|
LocalDateTime signTime = po.getSignTime(); |
|
|
@@ -217,7 +225,7 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
// 获取会议专家信息 |
|
|
|
MeetingExpert meetingExpert = meetingExpertService.getByMeetingIdAndExpertId(meetingId, userId); |
|
|
|
// 更新专家签到信息 |
|
|
|
if (Objects.nonNull(meetingExpert)){ |
|
|
|
if (Objects.nonNull(meetingExpert)) { |
|
|
|
meetingExpert.setSignStatus(true); |
|
|
|
meetingExpert.setSignTime(signTime); |
|
|
|
meetingExpert.setSignAddress(signAddress); |
|
|
@@ -226,4 +234,49 @@ public class OpenApiMeetingExpertInfoManage { |
|
|
|
} |
|
|
|
return "fail"; |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<ExpertJudgeToMhVO> pageExpertJudges(PageExpertJudgePO po) { |
|
|
|
checkSign(po.getKey()); |
|
|
|
LambdaQueryWrapper<MeetingExpertJudge> query = Wrappers.lambdaQuery(MeetingExpertJudge.class) |
|
|
|
.eq(po.getMeetingId() != null, MeetingExpertJudge::getMeetingId, po.getMeetingId()) |
|
|
|
.orderByDesc(MeetingExpertJudge::getCreateOn); |
|
|
|
Map<Long, ExpertUserFullInfo> expertUserMap = new HashMap<>(); |
|
|
|
if (StrUtil.isNotBlank(po.getMhExpertId())) { |
|
|
|
ExpertUserFullInfo expertUser = expertUserFullInfoService.getByMhExpertId(po.getMhExpertId()); |
|
|
|
if (expertUser == null) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
query.eq(MeetingExpertJudge::getExpertId, expertUser.getUserId()); |
|
|
|
expertUserMap.put(expertUser.getUserId(), expertUser); |
|
|
|
} |
|
|
|
Page<MeetingExpertJudge> page = meetingExpertJudgeService.page(po.page(), query); |
|
|
|
if (page.getTotal() == 0) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(po.getMhExpertId())) { |
|
|
|
List<Long> expertIds = CollUtils.fieldList(page.getRecords(), MeetingExpertJudge::getExpertId); |
|
|
|
List<ExpertUserFullInfo> expertUsers = expertUserFullInfoService.listByUserIds(expertIds); |
|
|
|
for (ExpertUserFullInfo expertUser : expertUsers) { |
|
|
|
expertUserMap.put(expertUser.getUserId(), expertUser); |
|
|
|
} |
|
|
|
} |
|
|
|
List<ExpertJudgeToMhVO> data = page.getRecords().stream().map(w -> { |
|
|
|
ExpertUserFullInfo expertUser = expertUserMap.get(w.getExpertId()); |
|
|
|
return ExpertJudgeToMhVO.builder() |
|
|
|
.mhExpertId(expertUser.getMhExpertId()) |
|
|
|
.meetingId(w.getMeetingId()) |
|
|
|
.userId(w.getExpertId()) |
|
|
|
.attended(w.getAttended()) |
|
|
|
.performance(w.getPerformance()) |
|
|
|
.advised(w.getAdvised()) |
|
|
|
.leaveEarly(w.getLeaveEarly()) |
|
|
|
.brokeRule(w.getBrokeRule()) |
|
|
|
.brokeRuleContent(w.getBrokeRuleContent()) |
|
|
|
.createOn(w.getCreateOn()) |
|
|
|
.score(w.getScore()) |
|
|
|
.build(); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(data, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
} |