Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

tags/24080901
PoffyZhang 1 yıl önce
ebeveyn
işleme
61f4918b8c
13 değiştirilmiş dosya ile 174 ekleme ve 52 silme
  1. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  2. +8
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java
  3. +67
    -45
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java
  4. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java
  5. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRegistrationRequest.java
  6. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java
  7. +6
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java
  8. +13
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java
  9. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java
  10. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java
  11. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java
  12. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java
  13. +2
    -0
      pmapi/src/main/resources/security/auth-dev.yml

+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java Dosyayı Görüntüle

@@ -13,6 +13,7 @@ import com.ningdatech.pmapi.sys.mapper.RoleMapper;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.model.entity.UserRole;
import com.ningdatech.pmapi.sys.service.IUserRoleService;
import com.ningdatech.pmapi.user.constant.UserAvailableEnum;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
@@ -118,6 +119,11 @@ public class UserInfoHelperImpl implements UserInfoHelper {
userFullInfo.setUsername(userInfo.getRealName());
userFullInfo.setMobile(userInfo.getMobile());
userFullInfo.setAccountId(userInfo.getAccountId());

String available = userInfo.getAvailable();
if (StringUtils.isNotBlank(available)) {
userFullInfo.setAvailable(UserAvailableEnum.valueOf(available));
}
return userFullInfo;
}



+ 8
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java Dosyayı Görüntüle

@@ -6,6 +6,7 @@ import com.ningdatech.pmapi.expert.manage.ExpertAdminManage;
import com.ningdatech.pmapi.expert.manage.ExpertManage;
import com.ningdatech.pmapi.expert.model.ExpertAdminExpertManageQuery;
import com.ningdatech.pmapi.expert.model.req.AdminExpertBasicInfoModifyRequest;
import com.ningdatech.pmapi.expert.model.req.ExpertRegistrationRequest;
import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest;
import com.ningdatech.pmapi.expert.model.req.GetZzdInfoRequest;
import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO;
@@ -37,8 +38,14 @@ public class ExpertController {
private final ExpertManage expertManage;
private final ExpertAdminManage expertAdminManage;

@PostMapping("/registration")
@ApiOperation("社会专家报名")
public void expertRegistration(@Valid @RequestBody ExpertRegistrationRequest request) {
expertManage.expertRegistration(request);
}

@PostMapping("/basic-info-submit")
@ApiOperation("填写基本信息接口(专家报名使用))")
@ApiOperation("专家管理员新增专家)")
public void expertBasicInfoSubmit(@Valid @RequestBody ExpertUserBasicInfoSubmitRequest request) {
expertManage.expertBasicInfoSubmit(request);
}


+ 67
- 45
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java Dosyayı Görüntüle

@@ -17,13 +17,15 @@ import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd;
import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd;
import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO;
import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO;
import com.ningdatech.pmapi.expert.model.req.ExpertRegistrationRequest;
import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest;
import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest;
import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO;
import com.ningdatech.pmapi.expert.service.ExpertInfoService;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum;
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo;
import com.ningdatech.pmapi.sms.constant.VerificationCodeType;
import com.ningdatech.pmapi.sms.helper.VerifyCodeCheckHelper;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.model.entity.UserRole;
import com.ningdatech.pmapi.sys.service.IRoleService;
@@ -63,59 +65,20 @@ public class ExpertManage {
private final ExpertMetaApplyManage expertMetaApplyManage;
private final IUserRoleService iUserRoleService;
private final IRoleService iRoleService;
private final VerifyCodeCheckHelper verifyCodeCheckHelper;


/**
* 填写基本信息,只有专家自己可用
* 专家管理员新增专家
*
* @param req /
*/
@Transactional(rollbackFor = Exception.class)
public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest req) {
// 用户id
ExpertBasicInfo basicInfo = req.getBasicInfo();
Long userId = generateOrGetUserId(basicInfo);

// 校验区域编码合法性 校验履职意向编码合法性
ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo();
expertManageHelper.expertRegionInfoCheck(expertRegionInfo);
List<ExpertRegionInfo> expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions();
for (ExpertRegionInfo expertIntentionWorkRegion : expertIntentionWorkRegions) {
expertManageHelper.expertRegionInfoCheck(expertIntentionWorkRegion);
}
ExpertEduInfo eduInfo = req.getEduInfo();
ExpertJobInfo jobInfo = req.getJobInfo();
ExpertProfessionalInfo professionalInfo = req.getProfessionalInfo();
// 校验标签字段
expertManageHelper.tagFieldCheck(professionalInfo, basicInfo);
// 校验字典字段
expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo);
// 判断专家提交状态,判断是否可以进行此操作
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId);

boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo)
|| (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus())
&& !ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep()));
if (submitBasicInfoStatusEnable) {
// 新建 保存
ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler
.buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo);
expertInfoService.saveExpertInfo(expertFullInfoSaveCmd);
}

ExpertRecommendInfo recommendInfo = req.getRecommendInfo();
// 推荐证明材料
List<DictionaryFieldInfo> recommendedWay = recommendInfo.getRecommendedWay();
// 推荐方式
List<FileBasicInfo> recommendProofFile = recommendInfo.getRecommendationProofFile();
Long applyId = expertRecommendProofSubmit(recommendedWay, recommendProofFile, userId);

// 批量通过专家管理员审核
MetaApplyResultRequest applyResult = new MetaApplyResultRequest();
applyResult.setApplyId(applyId);
applyResult.setAuditOpinion("同意");
applyResult.setApplyResult(true);
expertMetaApplyManage.metaApplyResult(applyResult);
Long userId = assemblerAndGenerateExpert(req);
// 批量通过专家入库审核/专家履职意向审核
expertMetaApplyManage.autoPassExpertApply(userId);

// 增加用户专家角色
Role expertRole = iRoleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name()));
@@ -202,4 +165,63 @@ public class ExpertManage {
}
return userInfo.getId();
}

/**
* 社会专家报名 需要校验手机号
*
* @param request
*/
@Transactional(rollbackFor = Exception.class)
public void expertRegistration(ExpertRegistrationRequest request) {
String verificationCode = request.getVerificationCode();
String phoneNo = request.getBasicInfo().getPhoneNo();
//校验 专家验证码
if (false) {
verifyCodeCheckHelper.verification(VerificationCodeType.EXPERT_REGISTER, phoneNo, verificationCode);
}
assemblerAndGenerateExpert(request);
}


@Transactional(rollbackFor = Exception.class)
public Long assemblerAndGenerateExpert(ExpertUserBasicInfoSubmitRequest req) {
ExpertBasicInfo basicInfo = req.getBasicInfo();
Long userId = generateOrGetUserId(basicInfo);

// 校验区域编码合法性 校验履职意向编码合法性
ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo();
expertManageHelper.expertRegionInfoCheck(expertRegionInfo);
List<ExpertRegionInfo> expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions();
for (ExpertRegionInfo expertIntentionWorkRegion : expertIntentionWorkRegions) {
expertManageHelper.expertRegionInfoCheck(expertIntentionWorkRegion);
}
ExpertEduInfo eduInfo = req.getEduInfo();
ExpertJobInfo jobInfo = req.getJobInfo();
ExpertProfessionalInfo professionalInfo = req.getProfessionalInfo();
// 校验标签字段
expertManageHelper.tagFieldCheck(professionalInfo, basicInfo);
// 校验字典字段
expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo);
// 判断专家提交状态,判断是否可以进行此操作
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId);

boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo)
|| (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus())
&& !ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep()));
if (submitBasicInfoStatusEnable) {
// 新建 保存
ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler
.buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo);
expertInfoService.saveExpertInfo(expertFullInfoSaveCmd);
}

ExpertRecommendInfo recommendInfo = req.getRecommendInfo();
// 推荐证明材料
List<DictionaryFieldInfo> recommendedWay = recommendInfo.getRecommendedWay();
// 推荐方式
List<FileBasicInfo> recommendProofFile = recommendInfo.getRecommendationProofFile();
expertRecommendProofSubmit(recommendedWay, recommendProofFile, userId);
return userId;
}

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java Dosyayı Görüntüle

@@ -590,4 +590,25 @@ public class ExpertMetaApplyManage {
expertIntentionApplyDealCmd.setExpertRegionLevel(expertMetaApply.getRegionLevel());
return expertIntentionApplyDealCmd;
}

/**
* 专家管理员 新增专家使用使用
* @param expertUserId
*/
@Transactional(rollbackFor = Exception.class)
public void autoPassExpertApply(Long expertUserId) {
List<ExpertMetaApply> expertIntentionJoinApplyList = iMetaApplyService.list(Wrappers
.lambdaQuery(ExpertMetaApply.class)
.eq(ExpertMetaApply::getUserId, expertUserId)
.in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_STORAGE.getKey())
.eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()));

for (ExpertMetaApply expertMetaApply : expertIntentionJoinApplyList) {
MetaApplyResultRequest applyResult = new MetaApplyResultRequest();
applyResult.setApplyId(expertMetaApply.getId());
applyResult.setAuditOpinion("同意");
applyResult.setApplyResult(true);
metaApplyResult(applyResult);
}
}
}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRegistrationRequest.java Dosyayı Görüntüle

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.expert.model.req;

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

import javax.validation.constraints.NotBlank;

/**
* @author liuxinxin
* @date 2022/7/25 下午2:21
*/
@Data
@ApiModel(value = "ExpertUserBasicInfoSubmitRequest", description = "社会专家报名接口")
public class ExpertRegistrationRequest extends ExpertUserBasicInfoSubmitRequest {

@NotBlank(message = "手机验证码不能为空")
@ApiModelProperty("手机验证码")
private String verificationCode;

}

+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java Dosyayı Görüntüle

@@ -20,9 +20,14 @@ import java.util.stream.Stream;
public enum VerificationCodeType {

/**
* 用户注册
* 用户登陆
*/
LOGIN("用户登录", 1, 5, 10);
LOGIN("用户登录", 1, 5, 10),

/**
* 社会专家注册
*/
EXPERT_REGISTER("社会专家注册", 1, 5, 10);

@ApiModelProperty(value = "描述")
private String desc;


+ 6
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java Dosyayı Görüntüle

@@ -13,7 +13,12 @@ public interface VoiceSmsTemplateConst {
/**
* 短信登陆验证码
*/
String SMS_LOGIN_TEMPLATE = "验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。";
String SMS_COMMON_TEMPLATE = "验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。";

/**
* 社会专家报名
*/
String EXPERT_REGISTER = "专家报名验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。";

/**
* 专家电话通知语音模版


+ 13
- 3
pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java Dosyayı Görüntüle

@@ -66,16 +66,26 @@ public class SmsManage {
// 创建短信内容
SendSmsCmd sendSmsCmd = new SendSmsCmd();
switch (verificationCodeTypeEnum) {
case LOGIN:
case LOGIN: {
SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext();
sendSmsContext.setReceiveNumber(request.getMobile());
sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.SMS_LOGIN_TEMPLATE, code, verificationCodeTypeEnum.getExpireTime()));
sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.SMS_COMMON_TEMPLATE, code, verificationCodeTypeEnum.getExpireTime()));
sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext));
sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.ZJS_ELECTRONIC_EXPERT_LIB);
break;
}
break;
case EXPERT_REGISTER: {
SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext();
sendSmsContext.setReceiveNumber(request.getMobile());
sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.EXPERT_REGISTER, code, verificationCodeTypeEnum.getExpireTime()));
sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext));
sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.ZJS_ELECTRONIC_EXPERT_LIB);
}
break;
default:
throw new IllegalArgumentException("非法的短信发送类型");
}

// 发送 短信
yxtClient.submitSmsTask(sendSmsCmd);
log.info("send verificationCode mobile = {},code = {}", request.getMobile(), code);


+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java Dosyayı Görüntüle

@@ -2,8 +2,10 @@ package com.ningdatech.pmapi.user.security.auth.agent;


import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.user.constant.UserAvailableEnum;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
@@ -32,6 +34,10 @@ public class AgentLoginUserDetailService implements UserDetailsService {
if (Objects.isNull(userFullInfoDTO)) {
throw new UsernameNotFoundException(String.format("%s user not exist", username));
}
if (UserAvailableEnum.DISABLE.equals(userFullInfoDTO.getAvailable())) {
throw new CommonLoginException("该账号已被禁用");
}

UserInfoDetails userInfoDetails = new UserInfoDetails();
userInfoDetails.setUserId(userFullInfoDTO.getUserId());
userInfoDetails.setUsername(userFullInfoDTO.getUsername());


+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java Dosyayı Görüntüle

@@ -1,9 +1,11 @@
package com.ningdatech.pmapi.user.security.auth.common;


import com.ningdatech.pmapi.user.constant.UserAvailableEnum;
import com.ningdatech.pmapi.user.manage.UserInfoManage;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
@@ -30,6 +32,9 @@ public class CommonLoginUserDetailService implements UserDetailsService {
if (Objects.isNull(userFullInfoDTO)) {
throw new UsernameNotFoundException(String.format("%s user not exist", username));
}
if (UserAvailableEnum.DISABLE.equals(userFullInfoDTO.getAvailable())) {
throw new CommonLoginException("该账号已被禁用");
}
UserInfoDetails userInfoDetails = new UserInfoDetails();
userInfoDetails.setUserId(userFullInfoDTO.getUserId());
userInfoDetails.setUsername(userFullInfoDTO.getUsername());


+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java Dosyayı Görüntüle

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.user.security.auth.credential;


import com.ningdatech.pmapi.user.constant.LoginTypeEnum;
import com.ningdatech.pmapi.user.constant.UserAvailableEnum;
import com.ningdatech.pmapi.user.convert.UserInfoConvertor;
import com.ningdatech.pmapi.user.manage.UserInfoManage;
import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant;
@@ -60,6 +61,10 @@ public class CredentialLoginUserDetailService implements UserDetailsService {
throw new UsernameNotFoundException(String.format("%s user not exist", username));
}
}

if (UserAvailableEnum.DISABLE.equals(userFullInfo.getAvailable())) {
throw new CommonLoginException("该账号已被禁用");
}
return UserInfoConvertor.toUserInfoDetails(userFullInfo);
}
}

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java Dosyayı Görüntüle

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.user.security.auth.model;

import cn.hutool.core.collection.CollUtil;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.user.constant.UserAvailableEnum;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import lombok.Data;

@@ -74,6 +75,12 @@ public class UserFullInfoDTO {
private Long accountId;

/**
* 用户是否可用
*/
private UserAvailableEnum available;


/**
* 取最高的权限
*
* @return


+ 2
- 0
pmapi/src/main/resources/security/auth-dev.yml Dosyayı Görüntüle

@@ -25,6 +25,7 @@ security:
- /wflow/**
- /sys/**
- /api/v1/verification/**
- /api/v1/expert/registration
ignore-csrf-urls:
- /api/v1/user/auth/**
- /v2/api-docs
@@ -42,6 +43,7 @@ security:
- /wflow/**
- /sys/**
- /api/v1/verification/**
- /api/v1/expert/registration
role-map:
"engineer":
"project_manager":


Yükleniyor…
İptal
Kaydet