Browse Source

增加专家文件详情

tags/24080901
WendyYang 11 months ago
parent
commit
eb96d7bbc9
4 changed files with 133 additions and 7 deletions
  1. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java
  2. +81
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java
  3. +18
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertDetailVO.java
  4. +32
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/external/model/vo/MhFileInfoVO.java

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java View File

@@ -69,13 +69,13 @@ public class ExpertController {
@GetMapping("/detail")
@ApiOperation("专家获取专家详细信息")
public ExpertDetailVO getExpertDetail() {
return expertManage.getExpertDetail(LoginUserUtil.getUserId());
return expertManage.getExpertDetail(LoginUserUtil.getUserId(), true);
}

@GetMapping("/admin/detail")
@ApiOperation("专家管理员获取专家详细信息")
public ExpertDetailVO getExpertDetail(@RequestParam(value = "expertUserId") @NotNull Long userId) {
return expertManage.getExpertDetail(userId);
return expertManage.getExpertDetail(userId, true);
}

@PostMapping("/expert-library/list")


+ 81
- 4
hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java View File

@@ -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);


+ 18
- 1
hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertDetailVO.java View File

@@ -3,6 +3,7 @@ package com.hz.pm.api.expert.model.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.hz.pm.api.expert.model.dto.DictionaryVO;
import com.hz.pm.api.external.model.vo.MhFileInfoVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@@ -46,15 +47,19 @@ public class ExpertDetailVO {
@ApiModelProperty(value = "专家姓名")
private String expertName;

@ApiModelProperty(value = "头像文件路径")
@ApiModelProperty(value = "头像")
private String avatarFile;

private MhFileInfoVO avatarFileDetail;

@ApiModelProperty(value = "身份证号")
private String idCard;

@ApiModelProperty(value = "身份证文件路径")
private String idCardFile;

private List<MhFileInfoVO> idCardFileDetail;

@ApiModelProperty(value = "办公电话")
private String officePhone;

@@ -109,9 +114,13 @@ public class ExpertDetailVO {
@ApiModelProperty(value = "毕业证书文件路径")
private String graduationCertFile;

private List<MhFileInfoVO> graduationCertFileDetail;

@ApiModelProperty(value = "学位证书文件路径")
private String degreeCertFile;

private List<MhFileInfoVO> degreeCertFileDetail;


@ApiModelProperty(value = "开始工作时间")
private LocalDate startWorkAt;
@@ -153,18 +162,26 @@ public class ExpertDetailVO {
@ApiModelProperty(value = "专业技术资格")
private String majorCredentials;

private List<MhFileInfoVO> majorCredentialsDetail;

@ApiModelProperty(value = "信创技术资格")
private String itaicCredentials;

private List<MhFileInfoVO> itaicCredentialsDetail;

@ApiModelProperty(value = "其他附件")
private String otherFile;

@ApiModelProperty(value = "专家推荐表文件路径")
private String recommendFile;

private List<MhFileInfoVO> recommendFileDetail;

@ApiModelProperty(value = "社保记录文件路径")
private String socialInsureFile;

private List<MhFileInfoVO> socialInsureFileDetail;

@ApiModelProperty(value = "职务")
private String duties;



+ 32
- 0
hz-pm-api/src/main/java/com/hz/pm/api/external/model/vo/MhFileInfoVO.java View File

@@ -0,0 +1,32 @@
package com.hz.pm.api.external.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
* MhFileInfoVO
* </p>
*
* @author WendyYang
* @since 10:48 2023/12/29
*/
@Data
public class MhFileInfoVO {

@ApiModelProperty("文件ID")
private String fileId;

@ApiModelProperty("文件名")
private String fileName;

@ApiModelProperty("文件后缀")
private String fileSuffix;

@ApiModelProperty("文件大小")
private Integer byteSize;

@ApiModelProperty("文件类型")
private String fileTypeEnum;

}

Loading…
Cancel
Save