Merge pull request '优化团长审核' (#9) from czk into main

Reviewed-on: #9
main
czk 2024-05-03 10:44:41 +08:00
commit b7d41cba0e
6 changed files with 71 additions and 66 deletions

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@ package com.mall.auth.controller;
import com.mall.auth.domain.IdCardCheckLifeVo; import com.mall.auth.domain.IdCardCheckLifeVo;
import com.mall.auth.domain.IdCardValidateVo; import com.mall.auth.domain.IdCardValidateVo;
import com.mall.auth.domain.request.IdCardRequest; import com.mall.auth.domain.request.IdCardRequest;
import com.mall.auth.feign.UserServiceFeign;
import com.mall.auth.service.AuthService; import com.mall.auth.service.AuthService;
import com.mall.auth.utils.IdentityAuthenticationUtils; import com.mall.auth.utils.IdentityAuthenticationUtils;
import com.mall.common.domain.UserInfo; import com.mall.common.domain.UserInfo;
@ -15,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.concurrent.CompletableFuture;
/** /**
* @Author: lzh * @Author: lzh
* @CreateTime: 2024-04-22 17:00 * @CreateTime: 2024-04-22 17:00
@ -109,4 +112,7 @@ public class AuthController {
return authService.authentication(idCardRequest); return authService.authentication(idCardRequest);
} }
@Autowired
private UserServiceFeign userServiceFeign;
} }

View File

@ -1,6 +1,5 @@
package com.mall.auth.feign; package com.mall.auth.feign;
import com.mall.auth.domain.request.IdCardRequest;
import com.mall.common.domain.UserInfo; import com.mall.common.domain.UserInfo;
import com.mall.common.result.Result; import com.mall.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
@ -25,4 +24,6 @@ public interface UserServiceFeign {
@PostMapping("authentication") @PostMapping("authentication")
Result authentication(@RequestBody UserInfo userInfo); Result authentication(@RequestBody UserInfo userInfo);
} }

View File

@ -78,7 +78,7 @@ public class AuthServiceImpl implements AuthService {
map.put(JwtConstants.USER_KEY,data.getId()); map.put(JwtConstants.USER_KEY,data.getId());
String token = JwtUtils.createToken(map); String token = JwtUtils.createToken(map);
String refreshToken = JwtUtils.createToken(map); String refreshToken = JwtUtils.createToken(map);
redisCache.setCacheObject(TokenConstants.TOKEN+token,data,TokenConstants.EXPIRATION, TimeUnit.HOURS); redisCache.setCacheObject(TokenConstants.TOKEN+token,data,TokenConstants.EXPIRATION, TimeUnit.MINUTES);
redisCache.setCacheObject(TokenConstants.REFRESH_TOKEN+refreshToken,data,TokenConstants.REFRESH_TIME,TimeUnit.HOURS); redisCache.setCacheObject(TokenConstants.REFRESH_TOKEN+refreshToken,data,TokenConstants.REFRESH_TIME,TimeUnit.HOURS);
JwtResponse jwtResponse = new JwtResponse(); JwtResponse jwtResponse = new JwtResponse();
jwtResponse.setToken(token); jwtResponse.setToken(token);
@ -231,22 +231,16 @@ public class AuthServiceImpl implements AuthService {
//提交申请 //提交申请
if(idCardValidateVo.getCode()==200 ) { if(idCardValidateVo.getCode()==200 ) {
UserInfo userInfo = userInfo().getData(); UserInfo userInfo = userInfo().getData();
CompletableFuture<Result> f3 = CompletableFuture.supplyAsync(() -> { CompletableFuture.runAsync(() -> {
userInfo.setIdentityFront(idCardRequest.getFaceImage()); userInfo.setIdentityFront(idCardRequest.getFaceImage());
userInfo.setIdentityReverse(idCardRequest.getBackImage()); userInfo.setIdentityReverse(idCardRequest.getBackImage());
userInfo.setIdentityAuthentication(idCardRequest.getImage()); userInfo.setIdentityAuthentication(idCardRequest.getImage());
userInfo.setCheckState(0); userInfo.setCheckState(0);
return userServiceFeign.authentication(userInfo); userServiceFeign.authentication(userInfo);
}, threadPoolConfig.getThreadPoolExecutor()); }, threadPoolConfig.getThreadPoolExecutor());
try {
f3.get();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
return Result.success(); return Result.success();
} }
return Result.error(500,"信息有误,冲洗提交"); return Result.error(500,"信息有误,重新提交");
} }
} }

View File

@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date; import java.util.Date;
@ -16,6 +13,7 @@ import java.util.Date;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ToString
@TableName("user_info") @TableName("user_info")
public class UserInfo { public class UserInfo {