Browse Source

用户代登陆fix

master
niohe·erbao 1 year ago
parent
commit
840faa5f9b
2 changed files with 11 additions and 7 deletions
  1. +5
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java
  2. +6
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java

+ 5
- 5
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java View File

@@ -60,13 +60,12 @@ public class ExpertManage {
* *
* @param request * @param request
*/ */
@Transactional(rollbackFor = Exception.class)
public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest request) { public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest request) {
// 用户id // 用户id
// Long userId = LoginUserUtil.getUserId();
ExpertBasicInfo basicInfo = request.getBasicInfo(); ExpertBasicInfo basicInfo = request.getBasicInfo();
Long userId = generateOrGetUserId(basicInfo); Long userId = generateOrGetUserId(basicInfo);



// 校验区域编码合法性 校验履职意向编码合法性 // 校验区域编码合法性 校验履职意向编码合法性
ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo(); ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo();
expertManageHelper.expertRegionInfoCheck(expertRegionInfo); expertManageHelper.expertRegionInfoCheck(expertRegionInfo);
@@ -99,13 +98,13 @@ public class ExpertManage {
List<DictionaryFieldInfo> recommendedWay = recommendInfo.getRecommendedWay(); List<DictionaryFieldInfo> recommendedWay = recommendInfo.getRecommendedWay();
// 推荐方式 // 推荐方式
List<FileBasicInfo> recommendProofFile = recommendInfo.getRecommendationProofFile(); List<FileBasicInfo> recommendProofFile = recommendInfo.getRecommendationProofFile();
expertRecommendProofSubmit(recommendedWay, recommendProofFile);
expertRecommendProofSubmit(recommendedWay, recommendProofFile, userId);
} }




public void expertRecommendProofSubmit(List<DictionaryFieldInfo> recommendedWay, List<FileBasicInfo> recommendProofFile) {
@Transactional(rollbackFor = Exception.class)
public void expertRecommendProofSubmit(List<DictionaryFieldInfo> recommendedWay, List<FileBasicInfo> recommendProofFile, Long expertUserId) {
// 用户id // 用户id
Long expertUserId = LoginUserUtil.getUserId();
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId);
// 判断专家状态,是否可以进行证明材料提交 // 判断专家状态,是否可以进行证明材料提交
if (Objects.isNull(expertUserFullInfo) if (Objects.isNull(expertUserFullInfo)
@@ -158,6 +157,7 @@ public class ExpertManage {
.realName(basicInfo.getName()) .realName(basicInfo.getName())
// .employeeCode(dingEmployeeInfo.getEmployeeCode()) // .employeeCode(dingEmployeeInfo.getEmployeeCode())
.available(UserAvailableEnum.DISABLE.name()) .available(UserAvailableEnum.DISABLE.name())
.mobile(phoneNo)
.createBy(LoginUserUtil.getUserId()) .createBy(LoginUserUtil.getUserId())
.updateBy(LoginUserUtil.getUserId()) .updateBy(LoginUserUtil.getUserId())
.createOn(LocalDateTime.now()) .createOn(LocalDateTime.now())


+ 6
- 2
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java View File

@@ -4,8 +4,9 @@ import com.ningdatech.basic.util.NdJsonUtil;
import com.ningdatech.basic.util.StrPool; import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.user.security.auth.handler.DefaultExpiredSessionStrategy;
import com.ningdatech.pmapi.user.security.auth.agent.AgentAuthSecurityConfig;
import com.ningdatech.pmapi.user.security.auth.credential.CredentialAuthSecurityConfig; import com.ningdatech.pmapi.user.security.auth.credential.CredentialAuthSecurityConfig;
import com.ningdatech.pmapi.user.security.auth.handler.DefaultExpiredSessionStrategy;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@@ -31,13 +32,16 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
private final CredentialAuthSecurityConfig credentialAuthSecurityConfig; private final CredentialAuthSecurityConfig credentialAuthSecurityConfig;
private final LogoutSuccessHandler logoutSuccessHandler; private final LogoutSuccessHandler logoutSuccessHandler;
private final DefaultExpiredSessionStrategy defaultExpiredSessionStrategy; private final DefaultExpiredSessionStrategy defaultExpiredSessionStrategy;
private final AgentAuthSecurityConfig agentAuthSecurityConfig;


public WebSecurityConfig(AuthProperties authProperties, public WebSecurityConfig(AuthProperties authProperties,
CredentialAuthSecurityConfig credentialAuthSecurityConfig, CredentialAuthSecurityConfig credentialAuthSecurityConfig,
AgentAuthSecurityConfig agentAuthSecurityConfig,
@Qualifier(value = "defaultLogoutSuccessHandler") LogoutSuccessHandler logoutSuccessHandler, @Qualifier(value = "defaultLogoutSuccessHandler") LogoutSuccessHandler logoutSuccessHandler,
DefaultExpiredSessionStrategy defaultExpiredSessionStrategy) { DefaultExpiredSessionStrategy defaultExpiredSessionStrategy) {
this.authProperties = authProperties; this.authProperties = authProperties;
this.credentialAuthSecurityConfig = credentialAuthSecurityConfig; this.credentialAuthSecurityConfig = credentialAuthSecurityConfig;
this.agentAuthSecurityConfig = agentAuthSecurityConfig;
this.logoutSuccessHandler = logoutSuccessHandler; this.logoutSuccessHandler = logoutSuccessHandler;
this.defaultExpiredSessionStrategy = defaultExpiredSessionStrategy; this.defaultExpiredSessionStrategy = defaultExpiredSessionStrategy;
} }
@@ -47,7 +51,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
assemblerPreAuthUrls(http); assemblerPreAuthUrls(http);
http.formLogin() http.formLogin()
.loginPage(authProperties.getAuthRequireUrl()) .loginPage(authProperties.getAuthRequireUrl())
.and().apply(credentialAuthSecurityConfig)
.and().apply(credentialAuthSecurityConfig).and().apply(agentAuthSecurityConfig)
.and() .and()
.authorizeRequests().antMatchers(authProperties.getIgnoreAuthUrlsArray()).permitAll().anyRequest() .authorizeRequests().antMatchers(authProperties.getIgnoreAuthUrlsArray()).permitAll().anyRequest()
.authenticated().and() .authenticated().and()


Loading…
Cancel
Save