|
|
@@ -1,14 +1,19 @@ |
|
|
|
package com.hz.pm.api.expert.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.hz.pm.api.common.model.constant.BizConst; |
|
|
|
import com.hz.pm.api.common.model.entity.KeyValDTO; |
|
|
|
import com.hz.pm.api.common.util.BizUtils; |
|
|
|
import com.hz.pm.api.expert.assembler.ExpertInfoCmdAssembler; |
|
|
|
import com.hz.pm.api.expert.entity.ExpertUserFullInfo; |
|
|
|
import com.hz.pm.api.expert.helper.ExpertManageHelper; |
|
|
|
import com.hz.pm.api.expert.model.*; |
|
|
|
import com.hz.pm.api.expert.model.ExpertBasicInfo; |
|
|
|
import com.hz.pm.api.expert.model.ExpertEduInfo; |
|
|
|
import com.hz.pm.api.expert.model.ExpertJobInfo; |
|
|
|
import com.hz.pm.api.expert.model.ExpertProfessionalInfo; |
|
|
|
import com.hz.pm.api.expert.model.cmd.ExpertFullInfoSaveCmd; |
|
|
|
import com.hz.pm.api.expert.model.dto.DictionaryVO; |
|
|
|
import com.hz.pm.api.expert.model.req.ExpertRegistrationRequest; |
|
|
@@ -18,6 +23,9 @@ import com.hz.pm.api.expert.model.vo.ExpertPortraitVO; |
|
|
|
import com.hz.pm.api.expert.service.ExpertInfoService; |
|
|
|
import com.hz.pm.api.expert.service.IExpertUserFullInfoService; |
|
|
|
import com.hz.pm.api.external.MhExpertQrCodeGenClient; |
|
|
|
import com.hz.pm.api.external.MhFileClient; |
|
|
|
import com.hz.pm.api.external.model.dto.MhFileInfoDTO; |
|
|
|
import com.hz.pm.api.external.model.vo.MhFileInfoVO; |
|
|
|
import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge; |
|
|
|
import com.hz.pm.api.meeting.entity.dto.ExpertInvitedRecordDTO; |
|
|
|
import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; |
|
|
@@ -36,9 +44,9 @@ import com.hz.pm.api.sys.model.entity.Role; |
|
|
|
import com.hz.pm.api.sys.model.entity.UserRole; |
|
|
|
import com.hz.pm.api.sys.service.IRoleService; |
|
|
|
import com.hz.pm.api.sys.service.IUserRoleService; |
|
|
|
import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; |
|
|
|
import com.hz.pm.api.user.entity.UserInfo; |
|
|
|
import com.hz.pm.api.user.model.enumeration.RoleEnum; |
|
|
|
import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; |
|
|
|
import com.hz.pm.api.user.service.IUserInfoService; |
|
|
|
import com.hz.pm.api.user.util.LoginUserUtil; |
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
@@ -52,10 +60,14 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.time.*; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalTime; |
|
|
|
import java.time.Month; |
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.function.BiFunction; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -81,6 +93,7 @@ public class ExpertManage { |
|
|
|
private final IExpertDictionaryService expertDictionaryService; |
|
|
|
private final DictionaryCache dictionaryCache; |
|
|
|
private final MhExpertQrCodeGenClient expertQrCodeGenClient; |
|
|
|
private final MhFileClient mhFileClient; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${expert-registration.verify-code.check:true}") |
|
|
@@ -123,7 +136,7 @@ public class ExpertManage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public ExpertDetailVO getExpertDetail(Long userId) { |
|
|
|
public ExpertDetailVO getExpertDetail(Long userId, boolean getFileDetail) { |
|
|
|
ExpertUserFullInfo eui = expertUserFullInfoService.getByUserId(userId); |
|
|
|
if (eui == null) { |
|
|
|
throw BizException.wrap("专家信息不存在"); |
|
|
@@ -138,9 +151,73 @@ public class ExpertManage { |
|
|
|
String expertQrCode = expertQrCodeGenClient.genExpertQrCode(eui.getMhExpertId()); |
|
|
|
expertDetail.setExpertQrCodeBase64(expertQrCode); |
|
|
|
expertDetail.setIsTechExpert(isTechExpert); |
|
|
|
if (getFileDetail) { |
|
|
|
processExpertFiles(expertDetail); |
|
|
|
} |
|
|
|
return expertDetail; |
|
|
|
} |
|
|
|
|
|
|
|
private void processExpertFiles(ExpertDetailVO expertDetail) { |
|
|
|
List<String> fileIdList = new ArrayList<>(); |
|
|
|
BizUtils.notBlank(expertDetail.getIdCardFile(), fileIdList::add); |
|
|
|
BizUtils.notBlank(expertDetail.getAvatarFile(), fileIdList::add); |
|
|
|
BizUtils.notBlank(expertDetail.getRecommendFile(), fileIdList::add); |
|
|
|
BizUtils.notBlank(expertDetail.getDegreeCertFile(), fileIdList::add); |
|
|
|
BizUtils.notBlank(expertDetail.getGraduationCertFile(), fileIdList::add); |
|
|
|
BizUtils.notBlank(expertDetail.getSocialInsureFile(), fileIdList::add); |
|
|
|
BizUtils.notBlank(expertDetail.getItaicCredentials(), fileIdList::add); |
|
|
|
BizUtils.notBlank(expertDetail.getMajorCredentials(), fileIdList::add); |
|
|
|
String fileIds = String.join(",", fileIdList); |
|
|
|
List<MhFileInfoDTO> fileInfoList = mhFileClient.listFileInfo(fileIds); |
|
|
|
if (CollUtil.isEmpty(fileInfoList)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
Map<String, MhFileInfoDTO> fileMap = CollUtils.listToMap(fileInfoList, MhFileInfoDTO::getFileId); |
|
|
|
|
|
|
|
BiFunction<String, Map<String, MhFileInfoDTO>, List<MhFileInfoVO>> function = (str, map) -> { |
|
|
|
return Arrays.stream(str.split(",")).map(w -> { |
|
|
|
MhFileInfoDTO fileInfoDto = map.get(w); |
|
|
|
return BeanUtil.copyProperties(fileInfoDto, MhFileInfoVO.class); |
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList()); |
|
|
|
}; |
|
|
|
|
|
|
|
BizUtils.notBlank(expertDetail.getIdCardFile(), w -> { |
|
|
|
List<MhFileInfoVO> files = function.apply(w, fileMap); |
|
|
|
expertDetail.setIdCardFileDetail(files); |
|
|
|
}); |
|
|
|
BizUtils.notBlank(expertDetail.getAvatarFile(), w -> { |
|
|
|
List<MhFileInfoVO> files = function.apply(w, fileMap); |
|
|
|
if (!files.isEmpty()) { |
|
|
|
expertDetail.setAvatarFileDetail(files.get(0)); |
|
|
|
} |
|
|
|
}); |
|
|
|
BizUtils.notBlank(expertDetail.getRecommendFile(), w -> { |
|
|
|
List<MhFileInfoVO> files = function.apply(w, fileMap); |
|
|
|
expertDetail.setRecommendFileDetail(files); |
|
|
|
}); |
|
|
|
BizUtils.notBlank(expertDetail.getDegreeCertFile(), w -> { |
|
|
|
List<MhFileInfoVO> files = function.apply(w, fileMap); |
|
|
|
expertDetail.setDegreeCertFileDetail(files); |
|
|
|
}); |
|
|
|
BizUtils.notBlank(expertDetail.getGraduationCertFile(), w -> { |
|
|
|
List<MhFileInfoVO> files = function.apply(w, fileMap); |
|
|
|
expertDetail.setGraduationCertFileDetail(files); |
|
|
|
}); |
|
|
|
BizUtils.notBlank(expertDetail.getSocialInsureFile(), w -> { |
|
|
|
List<MhFileInfoVO> files = function.apply(w, fileMap); |
|
|
|
expertDetail.setSocialInsureFileDetail(files); |
|
|
|
}); |
|
|
|
BizUtils.notBlank(expertDetail.getItaicCredentials(), w -> { |
|
|
|
List<MhFileInfoVO> files = function.apply(w, fileMap); |
|
|
|
expertDetail.setItaicCredentialsDetail(files); |
|
|
|
}); |
|
|
|
BizUtils.notBlank(expertDetail.getMajorCredentials(), w -> { |
|
|
|
List<MhFileInfoVO> files = function.apply(w, fileMap); |
|
|
|
expertDetail.setMajorCredentialsDetail(files); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public Long generateOrGetUserId(ExpertBasicInfo basicInfo, Long operatorId) { |
|
|
|
String phoneNo = basicInfo.getPhoneNo(); |
|
|
|
UserInfo userInfo = userInfoService.getUserInfoByPhoneNo(phoneNo); |
|
|
|