@@ -114,15 +114,15 @@ public class PortalController extends MyValidController { | |||
@ApiOperation(value = "已登录情况下,通过Token获取用户信息") | |||
@PostMapping(value = "/findAccountInfoByToken") | |||
public ApiResponse<FindAccountInfoByTokenResponse> findAccountInfoByToken(@Valid @RequestBody FindAccountInfoByTokenRequest dto) throws ManagerException { | |||
public ApiResponse<FindAccountInfoByTokenResponse> findAccountInfoByToken(@Valid @RequestBody FindAccountInfoByTokenDTO dto) throws ManagerException { | |||
FindAccountInfoByTokenResponse res = portalManager.findAccountInfoByToken(dto); | |||
return ApiResponse.of(res).setMessage("操作成功"); | |||
} | |||
@ApiOperation(value = "实名认证") | |||
@PostMapping(value = "/realNameAuthentication") | |||
public ApiResponse<AuthResponse> realNameAuthentication(@Valid @RequestBody AuthRequest req) throws ManagerException { | |||
AuthResponse res = portalManager.auth(req); | |||
public ApiResponse<AuthResponse> realNameAuthentication(@Valid @RequestBody AuthDTO dto) throws ManagerException { | |||
AuthResponse res = portalManager.auth(dto); | |||
return ApiResponse.of(res).setMessage("操作成功"); | |||
} | |||
@@ -0,0 +1,62 @@ | |||
package cn.com.taiji.iaw.dto.portal; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.common.pub.BeanTools; | |||
import cn.com.taiji.common.pub.StringTools; | |||
import cn.com.taiji.core.entity.dict.basic.Gender; | |||
import cn.com.taiji.core.entity.dict.basic.IdType; | |||
import cn.com.taiji.core.entity.dict.basic.SourceType; | |||
import cn.com.taiji.core.model.comm.protocol.ias.portal.AuthRequest; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.time.LocalDate; | |||
import java.time.format.DateTimeFormatter; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class AuthDTO extends BaseModel { | |||
@NotBlank(message = "来源不能为空") | |||
private String loginSource; | |||
@NotBlank(message = "Token不能为空") | |||
private String accessToken; | |||
private String openId;// 实名认证对应的openId | |||
@NotBlank(message = "证件号码不能为空") | |||
private String idNum;// 会员证件号 | |||
@NotNull(message = "证件类型不能为空") | |||
private Integer idType;// 会员证件类型; | |||
@NotBlank(message = "会员姓名不能为空") | |||
private String userName;// 会员名称 | |||
@NotNull(message = "性别不能为空") | |||
private Gender gender;// 性别 | |||
@NotBlank(message = "证件正面照地址不能为空") | |||
private String userIdImgUrl;// 会员证件照地址-信息 | |||
@NotBlank(message = "证件正面照内容不能为空") | |||
private String userIdImgBase64;// 会员证件照地址-信息 | |||
@NotBlank(message = "证件背面照地址不能为空") | |||
private String userIdBackImgUrl;// 会员证件照地址-国徽 | |||
@NotBlank(message = "证件背面照内容不能为空") | |||
private String userIdBackImgBase64;// 会员证件照地址-国徽 | |||
private String startDate;// 有效期开始日期; | |||
private String expireDate;// 有效期截止日期; | |||
@NotBlank(message = "地址不能为空") | |||
private String address;// 地址; | |||
public AuthRequest toRequest() throws ManagerException { | |||
AuthRequest request = new AuthRequest(); | |||
BeanTools.copyProperties(this, request); | |||
request.setIdType(IdType.findByCode(this.idType)); | |||
if (StringTools.hasText(startDate)) | |||
request.setStartDate(LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | |||
if (StringTools.hasText(expireDate)) | |||
request.setExpireDate(LocalDate.parse(expireDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | |||
if (SourceType.findByCode(loginSource) == null) throw new ManagerException("未知的登录来源方"); | |||
request.setLoginSource(SourceType.findByCode(loginSource)); | |||
return request; | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
package cn.com.taiji.iaw.dto.portal; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.core.entity.dict.basic.SourceType; | |||
import cn.com.taiji.core.model.comm.protocol.ias.portal.FindAccountInfoByTokenRequest; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
import javax.validation.constraints.NotBlank; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class FindAccountInfoByTokenDTO extends BaseModel { | |||
@NotBlank(message = "Token不能为空") | |||
private String accessToken; | |||
@NotBlank(message = "来源不能为空") | |||
private String loginSource; | |||
public FindAccountInfoByTokenRequest toRequest() throws ManagerException { | |||
FindAccountInfoByTokenRequest request = new FindAccountInfoByTokenRequest(); | |||
if (SourceType.findByCode(loginSource) == null) throw new ManagerException("未知的登录来源方"); | |||
request.setLoginSource(SourceType.findByCode(loginSource)); | |||
return request; | |||
} | |||
} |
@@ -33,9 +33,9 @@ public interface PortalManager { | |||
ChangeMobileByCodeResponse changeMobileByCode(ChangeMobileByCodeDTO dto) throws ManagerException; | |||
FindAccountInfoByTokenResponse findAccountInfoByToken(FindAccountInfoByTokenRequest dto) throws ManagerException; | |||
FindAccountInfoByTokenResponse findAccountInfoByToken(FindAccountInfoByTokenDTO dto) throws ManagerException; | |||
AuthResponse auth(AuthRequest req) throws ManagerException; | |||
AuthResponse auth(AuthDTO req) throws ManagerException; | |||
AtsGetWeChatOpenIdResponse getWxOpenId(AtsGetWeChatOpenIdRequest req) throws ManagerException; | |||
} |
@@ -67,13 +67,13 @@ public class PortalManagerImpl extends AbstractCommManager implements PortalMana | |||
} | |||
@Override | |||
public FindAccountInfoByTokenResponse findAccountInfoByToken(FindAccountInfoByTokenRequest dto) throws ManagerException { | |||
return jsonPostRepeat(dto); | |||
public FindAccountInfoByTokenResponse findAccountInfoByToken(FindAccountInfoByTokenDTO dto) throws ManagerException { | |||
return jsonPostRepeat(dto.toRequest()); | |||
} | |||
@Override | |||
public AuthResponse auth(AuthRequest req) throws ManagerException { | |||
return jsonPostRepeat(req); | |||
public AuthResponse auth(AuthDTO req) throws ManagerException { | |||
return jsonPostRepeat(req.toRequest()); | |||
} | |||
@Override |