소스 검색

专家审核列表结果处理接口

tags/24080901
liuxinxin 1 년 전
부모
커밋
2c02b69b73
6개의 변경된 파일242개의 추가작업 그리고 37개의 파일을 삭제
  1. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
  2. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  3. +124
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java
  4. +36
    -35
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java
  5. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java
  6. +68
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java 파일 보기

@@ -22,4 +22,6 @@ public interface UserInfoHelper {

UserFullInfoDTO getUserFullInfo(Long userId);

String getUserName(Long userId);

}

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java 파일 보기

@@ -30,4 +30,11 @@ public class UserInfoHelperImpl implements UserInfoHelper {
UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
return userFullInfo;
}

@Override
public String getUserName(Long userId) {
UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
String realName = userFullInfo.getRealName();
return realName;
}
}

+ 124
- 2
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java 파일 보기

@@ -10,6 +10,7 @@ import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.constant.BoolDisplayEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum;
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum;
@@ -17,12 +18,17 @@ import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum;
import com.ningdatech.pmapi.expert.entity.ExpertMetaApply;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo;
import com.ningdatech.pmapi.expert.model.TagFieldInfo;
import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd;
import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd;
import com.ningdatech.pmapi.expert.model.cmd.MetaApplyListQuery;
import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO;
import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO;
import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery;
import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest;
import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO;
import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo;
import com.ningdatech.pmapi.expert.service.ExpertInfoService;
import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum;
@@ -36,6 +42,7 @@ import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
@@ -60,6 +67,10 @@ public class ExpertMetaApplyManage {
private final IExpertUserFullInfoService userFullInfoService;
private final DictionaryCache dictionaryCache;

private final ExpertInfoService expertInfoService;

private final UserInfoHelper userInfoHelper;


public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) {
Long expertAdminUserId = LoginUserUtil.getUserId();
@@ -94,10 +105,88 @@ public class ExpertMetaApplyManage {
return result;
}

public void metaApplyResult(MetaApplyResultRequest applyResultRequest) {
@Transactional(rollbackFor = Exception.class)
public void metaApplyResult(MetaApplyResultRequest req) {
Long applyId = req.getApplyId();
ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId);
Long userId = LoginUserUtil.getUserId();

// 校验专家管理员区域权限,是否可以审核当前专家申请
// permissionCheckHelper.operationPermissionsCheck(userId, expertMetaApply.getUserId());
String applyStatus = expertMetaApply.getApplyStatus();
if (!ExpertApplyStatusEnum.PENDING_REVIEW.getKey().equals(applyStatus)) {
throw BizException.wrap("apply is already processed");
}
ExpertApplyTypeEnum applyType = ExpertApplyTypeEnum.of(expertMetaApply.getApplyType());
boolean applyResult = req.getApplyResult();

}
switch (applyType) {
// 专家入库
case EXPERT_STORAGE: {
ExpertStorageDealCmd expertStorageDealCmd = buildExpertStorageDealCmd(req, expertMetaApply.getUserId(), expertMetaApply);
expertInfoService.expertStorageDeal(expertStorageDealCmd);
// 专家入库时,需要先审核专家入库,入库成功后,再履职意向审核,如果履职意向跟专家层级是同一层级的,就直接同意不需要审核
if (applyResult) {
Long expertUserId = expertMetaApply.getUserId();
// ExpertRegionInfo expertRegionInfo = expertUserInfoHelper.getExpertRegionInfo(expertUserId);
// Integer regionLevel = expertRegionInfo.getRegionLevel();
// String regionCode = expertRegionInfo.getRegionCode();

List<ExpertMetaApply> expertJoinApplyList = iMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class)
.eq(ExpertMetaApply::getUserId, expertUserId)
.eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey())
.eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey())
.eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()));
// .eq(ExpertMetaApply::getRegionLevel, regionLevel)
// .eq(ExpertMetaApply::getRegionCode, regionCode));
BizUtils.notEmpty(expertJoinApplyList, list -> list.forEach(r -> {
MetaApplyResultRequest resultRequest = new MetaApplyResultRequest();
resultRequest.setApplyId(r.getId());
resultRequest.setApplyResult(true);
resultRequest.setAuditOpinion("同意");
metaApplyResult(resultRequest);
}));
}
}
break;
// 专家出库
case EXPERT_DELIVERY:
// ExpertDeliveryDealCmd expertDeliveryDealCmd = buildExpertDeliveryDealCmd(req, expertMetaApply.getUserId());
// expertInfoService.expertDeliveryDeal(expertDeliveryDealCmd);
break;
// 长期请假
case LONG_TERM_LEAVE:
// leaveManage.leaveAuditCallback(req.getApplyResult(), applyId);
break;
// 专家信息审核
case EXPERT_INFO_MODIFY:
// ExpertInfoModifyApplyDealCmd applyDealCmd = buildExpertInfoModifyApplyDealCmd(req, expertMetaApply.getUserId(), applyId);
// expertInfoService.expertInfoModifyDeal(applyDealCmd);
break;
// 专家履职意向加入/离开
case EXPERT_INTENTION_JOIN:
case EXPERT_INTENTION_LEAVE:
// ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = buildExpertIntentionApplyDealCmd(req, expertMetaApply);
// expertInfoService.expertIntentionApplyDeal(expertIntentionApplyDealCmd);
break;
default:
break;
}

Long expertUserId = expertMetaApply.getUserId();
String auditOpinion = req.getAuditOpinion();
// 发送审核结果短信
// sendApplyResultNotify(applyType, applyResult, auditOpinion, expertUserId);
// 更新申请结果
expertMetaApply.setApproverUserId(userId);
String adminUserName = userInfoHelper.getUserName(userId);
expertMetaApply.setApprover(adminUserName);
expertMetaApply.setAuditOpinion(auditOpinion);
expertMetaApply.setApplyStatus(applyResult ? ExpertApplyStatusEnum.PASSED.getKey() : ExpertApplyStatusEnum.REFUSED.getKey());
expertMetaApply.setReviewTime(LocalDateTime.now());
expertMetaApply.setUpdateOn(LocalDateTime.now());
iMetaApplyService.saveOrUpdate(expertMetaApply);
}

public MetaApplyResultVo metaApplyResult(Long applyId) {
ExpertMetaApply metaApply = iMetaApplyService.getById(applyId);
@@ -383,5 +472,38 @@ public class ExpertMetaApplyManage {
return expertMetaApplyListQuery;
}

private ExpertStorageDealCmd buildExpertStorageDealCmd(
MetaApplyResultRequest applyResultRequest, Long expertUserId, ExpertMetaApply expertMetaApply) {
MetaApplyResultRequest.StorageApplyResultExtraInfo extraInfo = applyResultRequest.getStorageApplyResultExtraInfo();
ExpertStorageDealCmd expertStorageDealCmd = new ExpertStorageDealCmd();
Boolean applyResult = applyResultRequest.getApplyResult();
expertStorageDealCmd.setApplyResult(applyResult);

if (Objects.nonNull(extraInfo)) {
List<DictionaryFieldInfo> expertType = extraInfo.getExpertType();
if (CollectionUtils.isNotEmpty(expertType)) {
expertStorageDealCmd.setExpertType(extraInfo.getExpertType().stream().map(r -> {
ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO();
expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName());
expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode());
return expertDictionaryDTO;
}).collect(Collectors.toList()));
}
List<TagFieldInfo> other = extraInfo.getOther();
if (CollectionUtils.isNotEmpty(other)) {
expertStorageDealCmd.setOther(extraInfo.getOther().stream().map(r -> {
ExpertTagDTO expertTagDTO = new ExpertTagDTO();
expertTagDTO.setExpertInfoField(r.getTagFieldName());
expertTagDTO.setTagCode(r.getTagCode());
return expertTagDTO;
}).collect(Collectors.toList()));
}
expertStorageDealCmd.setRemark(extraInfo.getRemark());
}
expertStorageDealCmd.setExpertUserId(expertUserId);
expertStorageDealCmd.setJoinRegionCode(expertMetaApply.getRegionCode());
expertStorageDealCmd.setJoinRegionLevel(expertMetaApply.getRegionLevel());
return expertStorageDealCmd;
}

}

+ 36
- 35
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java 파일 보기

@@ -1,35 +1,36 @@
//package com.ningdatech.pmapi.expert.model.cmd;
//
//import com.ningdatech.emapi.expert.entity.dto.ExpertDictionaryDTO;
//import com.ningdatech.emapi.expert.entity.dto.ExpertTagDTO;
//import lombok.Data;
//
//import java.util.List;
//
///**
// * @author liuxinxin
// * @date 2022/7/26 下午5:40
// */
//@Data
//public class ExpertStorageDealCmd {
//
// private Long expertUserId;
//
// private Boolean applyResult;
//
// private String joinRegionCode;
//
// private Integer joinRegionLevel;
//
// /**
// * 专家类型(内外围)
// */
// private List<ExpertDictionaryDTO> expertType;
//
// /**
// * 其他标签(标签code)
// */
// private List<ExpertTagDTO> other;
//
// private String remark;
//}
package com.ningdatech.pmapi.expert.model.cmd;


import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO;
import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO;
import lombok.Data;

import java.util.List;

/**
* @author liuxinxin
* @date 2022/7/26 下午5:40
*/
@Data
public class ExpertStorageDealCmd {

private Long expertUserId;

private Boolean applyResult;

private String joinRegionCode;

private Integer joinRegionLevel;

/**
* 专家类型(内外围)
*/
private List<ExpertDictionaryDTO> expertType;

/**
* 其他标签(标签code)
*/
private List<ExpertTagDTO> other;

private String remark;
}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java 파일 보기

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.expert.service;

import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd;
import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd;
import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd;
import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO;

/**
@@ -27,4 +28,8 @@ public interface ExpertInfoService {
* @return
*/
ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId);


void expertStorageDeal(ExpertStorageDealCmd cmd);
}


+ 68
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java 파일 보기

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.expert.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.constant.BoolDisplayEnum;
import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler;
@@ -15,8 +16,10 @@ import com.ningdatech.pmapi.expert.entity.ExpertMetaApply;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd;
import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd;
import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd;
import com.ningdatech.pmapi.expert.model.dto.*;
import com.ningdatech.pmapi.expert.service.*;
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum;
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary;
import com.ningdatech.pmapi.meta.model.entity.ExpertTag;
import com.ningdatech.pmapi.meta.service.IExpertDictionaryService;
@@ -28,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -304,4 +308,68 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
}


/**
* 专家入库审核
*
* @param cmd
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void expertStorageDeal(ExpertStorageDealCmd cmd) {
boolean applyResult = cmd.getApplyResult();
Long expertUserId = cmd.getExpertUserId();
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId);

if (applyResult) {
// 修改专家状态为可用
expertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.AVAILABLE.getKey());
expertUserFullInfo.setRemark(cmd.getRemark());
expertUserFullInfo.setRegionCode(cmd.getJoinRegionCode());
expertUserFullInfo.setRegionLevel(cmd.getJoinRegionLevel());

// 保存所有专家标签字段
List<ExpertTag> saveExpertTagList = buildSaveExpertTagList(expertUserId, cmd.getOther());
iExpertTagService.saveBatch(saveExpertTagList);
// 保存所有专家字典字段
List<ExpertDictionaryDTO> expertType = cmd.getExpertType();
if (CollectionUtils.isNotEmpty(expertType)) {
expertType = expertType.stream().peek(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())).collect(Collectors.toList());
List<ExpertDictionary> saveExpertDictionaryList = buildSaveExpertDictionaryList(expertUserId, expertType);
iExpertDictionaryService.saveBatch(saveExpertDictionaryList);
}

// 修改履职意向申请状态
LambdaUpdateWrapper<ExpertMetaApply> set = Wrappers.lambdaUpdate(ExpertMetaApply.class).eq(ExpertMetaApply::getUserId, expertUserId)
.eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey())
.eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey())
.eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name())
.set(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name());
iExpertMetaApplyService.update(set);

} else {
expertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.INFORMATION_TO_BE_SUBMITTED.getKey());
}
if (applyResult) {
// 补充专家 专家角色 TODO
// SysRole sysRole = roleService.getOne(Wrappers.lambdaQuery(SysRole.class)
// .eq(SysRole::getCode, SysRoleEnum.EXPERT.getKey()));
// if (Objects.nonNull(sysRole)) {
// Long roleId = sysRole.getRoleId();
// LambdaQueryWrapper<SysUsersRoles> eq = Wrappers.lambdaQuery(SysUsersRoles.class)
// .eq(SysUsersRoles::getUserId, expertUserFullInfo.getUserId())
// .eq(SysUsersRoles::getRoleId, sysRole.getRoleId());
// SysUsersRoles one = userRoleService.getOne(eq);
// if (Objects.isNull(one)) {
// SysUsersRoles sysUsersRolesSaveRecord = new SysUsersRoles();
// sysUsersRolesSaveRecord.setUserId(expertUserFullInfo.getUserId());
// sysUsersRolesSaveRecord.setRoleId(roleId);
// userRoleService.saveAndReloadRoleListForToken(Collections.singletonList(sysUsersRolesSaveRecord), false);
// }
// }
}
iExpertUserFullInfoService.saveOrUpdate(expertUserFullInfo);
}



}

불러오는 중...
취소
저장