@@ -2,11 +2,15 @@ package cn.com.taiji.core.entity.user; | |||
import cn.com.taiji.core.entity.AbstractStringPropertyUUIDEntity; | |||
import cn.com.taiji.core.entity.dict.basic.*; | |||
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 lombok.Getter; | |||
import lombok.Setter; | |||
import javax.persistence.*; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.time.LocalDateTime; | |||
/** | |||
@@ -38,22 +42,9 @@ public class AccountInfo extends AbstractStringPropertyUUIDEntity { | |||
private LocalDateTime createTime;// 创建时间 | |||
@Column(name = "UPDATE_TIME") | |||
private LocalDateTime updateTime;// 更新时间 | |||
@Column(name = "ID_NUM") | |||
private String idNum;// 用户-证件号码 | |||
@Enumerated(EnumType.STRING) | |||
@Column(name = "ID_TYPE") | |||
private IdType idType;// 用户-证件类型 | |||
@Enumerated(EnumType.STRING) | |||
@Column(name = "USER_TYPE") | |||
private UserType userType;// 会员类型:原来是USER_TYPE 1、个人会员 2、企业会员 | |||
@Enumerated(EnumType.STRING) | |||
@Column(name = "LOGIN_SOURCE") | |||
private SourceType loginSource;// 登录方来源 | |||
@Column(name = "USER_NAME") | |||
private String userName;// 用户姓名/企业名称 | |||
@Enumerated(EnumType.STRING) | |||
@Column(name = "GENDER") | |||
private Gender gender;// 性别 | |||
@Column(name = "NICK_NAME") | |||
private String nickName;// 昵称 | |||
@Column(name = "REGISTRATION_ID") | |||
@@ -70,6 +61,31 @@ public class AccountInfo extends AbstractStringPropertyUUIDEntity { | |||
private String zfbOpenId;// 支付宝openid | |||
@Column(name = "ZFB_USER_ID") | |||
private String zfbUserId;// 支付宝userid | |||
// 实名认证信息 | |||
@Column(name = "ID_NUM") | |||
private String idNum;// 用户-证件号码 | |||
@Enumerated(EnumType.STRING) | |||
@Column(name = "ID_TYPE") | |||
private IdType idType;// 用户-证件类型 | |||
@Column(name = "USER_NAME") | |||
private String userName;// 用户姓名/企业名称 | |||
@Enumerated(EnumType.STRING) | |||
@Column(name = "GENDER") | |||
private Gender gender;// 性别 | |||
@Column(name = "USER_ID_IMG_URL") | |||
private String userIdImgUrl;// 会员证件照地址-信息 | |||
@Column(name = "USER_ID_IMG_BASE64") | |||
private String userIdImgBase64;// 会员证件照地址-信息 | |||
@Column(name = "USER_ID_BACK_IMG_URL") | |||
private String userIdBackImgUrl;// 会员证件照地址-国徽 | |||
@Column(name = "USER_ID_BACK_IMG_BASE64") | |||
private String userIdBackImgBase64;// 会员证件照地址-国徽 | |||
@Column(name = "START_TIME") | |||
private LocalDateTime startTime;// 有效期; | |||
@Column(name = "EXPIRE_TIME") | |||
private LocalDateTime expireTime;// 有效期截止日期; | |||
@Column(name = "ADDRESS") | |||
private String address;// 地址; | |||
public AccountInfo() { | |||
} |
@@ -0,0 +1,55 @@ | |||
package cn.com.taiji.core.model.comm.protocol.ias.portal; | |||
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.entity.dict.basic.UserType; | |||
import cn.com.taiji.core.model.comm.protocol.valid.ErrorMsgBuilder; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.time.LocalDateTime; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class AuthRequest extends AbstractPortalRequest<AuthResponse> { | |||
@NotNull(message = "来源不能为空") | |||
private SourceType loginSource; | |||
@NotBlank(message = "Token不能为空") | |||
private String accessToken; | |||
private String openId;// 实名认证对应的openId | |||
@NotBlank(message = "证件号码不能为空") | |||
private String idNum;// 会员证件号 | |||
@NotNull(message = "证件类型不能为空") | |||
private IdType 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;// 会员证件照地址-国徽 | |||
@NotNull(message = "证件有效期开始时间") | |||
private LocalDateTime startTime;// 有效期; | |||
private LocalDateTime expireTime;// 有效期截止日期; | |||
@NotBlank(message = "地址不能为空") | |||
private String address;// 地址; | |||
public AuthRequest() { | |||
super(PortalServiceCmd.AUTH); | |||
} | |||
@Override | |||
public void validate(ErrorMsgBuilder builder) { | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
package cn.com.taiji.core.model.comm.protocol.ias.portal; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class AuthResponse extends AbstractPortalResponse { | |||
} |
@@ -21,10 +21,10 @@ public class ChangeMobileByCodeRequest extends AbstractPortalRequest<ChangeMobil | |||
@Pattern(regexp = RegexConstant.SMS_CODE, message = "请传入正确格式的短信验证码") | |||
@NotBlank(message = "短信验证码不能为空") | |||
private String newMobileCode; | |||
@NotNull(message = "Token不能为空") | |||
private String accessToken; | |||
@NotNull(message = "来源不能为空") | |||
private SourceType loginSource; | |||
@NotBlank(message = "Token不能为空") | |||
private String accessToken; | |||
public ChangeMobileByCodeRequest() { | |||
super(PortalServiceCmd.CHANGEMOBILEBYCODE); |
@@ -8,16 +8,17 @@ import cn.com.taiji.core.model.comm.protocol.ias.IasServiceType; | |||
public enum PortalServiceCmd implements SignServiceCommand { | |||
LOGIN("密码登录", LoginRequest.class), | |||
REGISTER("用户注册", RegisterRequest.class), | |||
REGISTERCHECK("重复注册校验", RegisterCheckRequest.class), | |||
ACCESSTOKENCHECK("token验证", AccessTokenCheckRequest.class), | |||
CHANGEMOBILEBYCODE("修改手机号", ChangeMobileByCodeRequest.class), | |||
CHANGEPASSWORD("修改密码", ChangePasswordRequest.class), | |||
CHANGEPASSWORDBYCODE("忘记密码", ChangePasswordByCodeRequest.class), | |||
FINDACCOUNTINFOBYTOKEN("获取用户信息", FindAccountInfoByTokenRequest.class), | |||
AUTH("实名认证", AuthRequest.class), | |||
/** | |||
* 如下接口同时给渠道提供 | |||
*/ | |||
REGISTER("用户注册", RegisterRequest.class), | |||
SENDCODE("发送登录短信验证码", SendCodeRequest.class),// | |||
LOGINBYCODE("手机验证码登录", LoginByCodeRequest.class),// | |||
LOGINCONFIRM("登录确认", LoginConfirmRequest.class), |
@@ -59,8 +59,7 @@ public class PortalController extends MyValidController { | |||
@ApiOperation(value = "验证码登录") | |||
@PostMapping(value = "/loginByCode") | |||
public ApiResponse<LoginByCodeResponse> loginByCode(@Valid @RequestBody LoginByCodeDTO dto, | |||
HttpServletRequest request) throws ManagerException { | |||
public ApiResponse<LoginByCodeResponse> loginByCode(@Valid @RequestBody LoginByCodeDTO dto, HttpServletRequest request) throws ManagerException { | |||
LoginByCodeResponse res = portalManager.loginByCode(dto); | |||
logger.info("request url:{},port:{}", request.getRequestURL(), request.getRemotePort()); | |||
return ApiResponse.of(res).setMessage("操作成功"); | |||
@@ -118,15 +117,10 @@ public class PortalController extends MyValidController { | |||
return ApiResponse.of(res).setMessage("操作成功"); | |||
} | |||
// | |||
// @ApiOperation(value = "实名认证") | |||
// @PostMapping(value = "/realNameAuthentication") | |||
// public ApiResponse<RealNameAuthenticationResponse> | |||
// realNameAuthentication(@Valid @RequestBody RealNameAuthenticationRequest req) throws ManagerException { | |||
// RealNameAuthenticationResponse res = portalManager.realNameAuthentication(req); | |||
// 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); | |||
return ApiResponse.of(res).setMessage("操作成功"); | |||
} | |||
} |
@@ -32,4 +32,6 @@ public interface PortalManager { | |||
ChangeMobileByCodeResponse changeMobileByCode(ChangeMobileByCodeDTO dto) throws ManagerException; | |||
FindAccountInfoByTokenResponse findAccountInfoByToken(FindAccountInfoByTokenRequest dto) throws ManagerException; | |||
AuthResponse auth(AuthRequest req) throws ManagerException; | |||
} |
@@ -1,7 +1,6 @@ | |||
package cn.com.taiji.iaw.manager.portal; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.core.manager.tools.encryption.SM4Util; | |||
import cn.com.taiji.core.model.comm.protocol.ias.portal.*; | |||
import cn.com.taiji.iaw.dto.portal.*; | |||
import cn.com.taiji.iaw.manager.AbstractCommManager; | |||
@@ -55,7 +54,7 @@ public class PortalManagerImpl extends AbstractCommManager implements PortalMana | |||
return jsonPostRepeat(dto.toRequest()); | |||
} | |||
@Override | |||
@Override | |||
public ChangePasswordByCodeResponse changePasswordByCode(ChangePasswordByCodeDTO dto) throws ManagerException { | |||
return jsonPostRepeat(dto.toRequest()); | |||
} | |||
@@ -70,20 +69,8 @@ public class PortalManagerImpl extends AbstractCommManager implements PortalMana | |||
return jsonPostRepeat(dto); | |||
} | |||
// @Override | |||
// public RealNameAuthenticationResponse realNameAuthentication(RealNameAuthenticationRequest req) throws ManagerException { | |||
// return jsonPostRepeat(req); | |||
// } | |||
public static void main(String[] args) { | |||
String s = "e0f77b2f0f60a8306e06e8aaa0adf32b"; | |||
String s1 = "18600598974"; | |||
try { | |||
System.out.println(SM4Util.decrypt(s)); | |||
System.out.println(SM4Util.encrypt(s1)); | |||
} catch (Exception e) { | |||
throw new RuntimeException(e); | |||
} | |||
@Override | |||
public AuthResponse auth(AuthRequest req) throws ManagerException { | |||
return jsonPostRepeat(req); | |||
} | |||
} |
@@ -87,133 +87,4 @@ public class AccountInfoController extends MyValidController { | |||
accountInfoManager.resetPassword(dto); | |||
return ApiResponse.success().setMessage("重置密码成功"); | |||
} | |||
// @ApiOperation(value = "客户批量注册(全量信息)") | |||
// @PostMapping(value = "/registerfullbatch") | |||
// public ApiResponse<AccountRegisterFullBatchResponse> | |||
// registerfullbatch(@RequestBody @Valid AccountRegisterFullBatchRequest request) | |||
// throws FormatException, ManagerException { | |||
// AccountRegisterFullBatchResponse response = null; | |||
// logger.info("------- 客户-批量注册 START -------"); | |||
// logger.info("接收的request:{}", request.toJson()); | |||
// //入参校验 | |||
// request.valid(); | |||
// try { | |||
// response = accountManager.registerFullBatch(request); | |||
// | |||
// logger.info("返回的response:{}", response.toJson()); | |||
// } catch (Exception e) { | |||
// logger.error("", e); | |||
// if (e instanceof ManagerException) { | |||
// throw e; | |||
// } else if (e instanceof IOException) { | |||
// throw new ManagerException("调用中台的接口失败"); | |||
// } | |||
// throw new ManagerException("批量注册失败!"); | |||
// } finally { | |||
// logger.info("------- 客户-批量注册 END -------"); | |||
// } | |||
// | |||
// return ApiResponse.of(response); | |||
// } | |||
// | |||
// @ApiOperation(value = "企业用户批量注册(全量信息)") | |||
// @PostMapping(value = "/enterpriseregisterfullbatch") | |||
// public ApiResponse<AccountRegisterFullBatchResponse> | |||
// enterpriseregisterfullbatch(@RequestBody @Valid AccountRegisterFullBatchRequest request) | |||
// throws FormatException, ManagerException { | |||
// AccountRegisterFullBatchResponse response = null; | |||
// logger.info("------- 企业用户-批量注册 START -------"); | |||
// logger.info("接收的request:{}", request.toJson()); | |||
// //入参校验 | |||
// request.valid(); | |||
// try { | |||
// response = accountManager.enterpriseRegisterFullBatch(request); | |||
// logger.info("返回的response:{}", response.toJson()); | |||
// } catch (Exception e) { | |||
// logger.error("", e); | |||
// if (e instanceof ServiceHandleException) { | |||
// throw e; | |||
// } else if (e instanceof IOException) { | |||
// throw new ManagerException("调用中台的接口失败"); | |||
// } | |||
// throw new ManagerException("批量注册失败!"); | |||
// } finally { | |||
// logger.info("------- 企业用户-批量注册 END -------"); | |||
// } | |||
// return ApiResponse.of(response); | |||
// } | |||
// | |||
// @ApiOperation(value = "用户修改手机号") | |||
// @PostMapping(value = "/editmobile") | |||
// public ApiResponse<AccountEditResponse> | |||
// editmobile(@RequestBody @Valid AccountEditMobileRequest request) | |||
// throws FormatException, ManagerException { | |||
// AccountEditResponse response = null; | |||
// | |||
// logger.info("------- 客户账号信息编辑 START -------"); | |||
// logger.info("接收到的request:{}", request.toJson()); | |||
// //入参校验 | |||
// request.valid(); | |||
// try { | |||
// //1、判断客户账户是否存在 | |||
// AccountInfo accountInfo = accountInfoRepo.findByAccount(request.getOldMobile()); | |||
// if (accountInfo == null) { | |||
// throw new ManagerException("原手机号对应用户不存在"); | |||
// } | |||
// AccountInfo byMobile = accountInfoRepo.findByAccount(request.getNewMobile()); | |||
// if (byMobile != null) { | |||
// throw new ManagerException("想要修改的新手机号已经注册有用户"); | |||
// } | |||
// //2、确认身份证件是否一致 | |||
// if (!accountInfo.getIdNum().equals(request.getIdNum())) { | |||
// throw new ManagerException("原手机号对应用户的证件号码与输入的证件号码不一致"); | |||
// } | |||
// //3、调用统一会员平台修改用户手机号 | |||
//// Map<String, String> map = Maps.newHashMap(); | |||
//// map.put("openId", accountInfo.getOpenId()); | |||
//// map.put("appId", "52030131"); | |||
//// map.put("mobile", request.getNewMobile()); | |||
//// map.put("verificationCode", request.getCode()); | |||
// ChangeMobileRequest changeMobileRequest = new ChangeMobileRequest(); | |||
// changeMobileRequest.setOpenId(accountInfo.getOpenId()); | |||
// changeMobileRequest.setAppId("52030131"); | |||
// changeMobileRequest.setMobile(request.getNewMobile()); | |||
// changeMobileRequest.setVerificationCode(request.getCode()); | |||
//// //map转json字符串 | |||
//// IfztRequest req = new IfztRequest(IfCodeFinals.USER_APILOGINUSER_MODIFYMOBILENOTOKEN, JSONObject.toJSONString(map)); | |||
//// JsonResponse resp = ifztClient.jsonApi(req); | |||
// abstractCommManager.jsonPostRepeat(changeMobileRequest, HashMap.class, IfCodeFinals.USER_APILOGINUSER_MODIFYMOBILENOTOKEN, null); | |||
//// if (resp.getStatusCode() != 0) { | |||
//// throw new ManagerException(resp.getErrorMsg()); | |||
//// } | |||
// //4.修改用户本身 | |||
// accountInfo.setMobile(request.getNewMobile()); | |||
// accountInfo.setAccount(request.getNewMobile()); | |||
// accountInfoRepo.save(accountInfo); | |||
// //5.如果有员工修改员工 | |||
// Staff staff = staffRepo.findByStaffId(request.getOldMobile()); | |||
// if (staff != null) { | |||
// staff.setStaffId(request.getNewMobile()); | |||
// staff.setMobile(request.getNewMobile()); | |||
// staffRepo.save(staff); | |||
// } | |||
// logger.info("返回的response:{}", response.toJson()); | |||
// } catch (Exception e) { | |||
// logger.error("", e); | |||
// | |||
// if (e instanceof ServiceHandleException) { | |||
// throw e; | |||
// } | |||
// | |||
// throw new ManagerException("客户账号信息编辑失败!"); | |||
// } finally { | |||
// logger.info("------- 客户账号信息编辑 END -------"); | |||
// | |||
// } | |||
// | |||
// return ApiResponse.of(response); | |||
// } | |||
} |
@@ -18,8 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import javax.validation.Valid; | |||
import java.io.IOException; | |||
import java.net.URISyntaxException; | |||
import java.util.List; | |||
@Api(tags = {"USER-员工管理:STAFF"}) |
@@ -1,28 +1,24 @@ | |||
package cn.com.taiji.userw.dto.system; | |||
import cn.com.taiji.common.pub.StringTools; | |||
import cn.com.taiji.common.valid.ViolationValidator; | |||
import cn.com.taiji.core.dto.AbstractBizRequestDTO; | |||
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.UserType; | |||
import cn.hutool.core.lang.PatternPool; | |||
import cn.hutool.core.util.IdcardUtil; | |||
import cn.hutool.core.util.ReUtil; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.time.LocalDateTime; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class AccountInfoAuthRequestDTO extends AbstractBizRequestDTO { | |||
@NotBlank(message = "openId不能为空") | |||
private String authenticationOpenId;// 实名认证对应的openId | |||
private UserType userType;// 会员类型 | |||
private String opneId;// 实名认证对应的openId | |||
@NotBlank(message = "证件号码不能为空") | |||
private String idNum;// 会员证件号 | |||
@NotNull(message = "证件类型不能为空") | |||
@@ -31,22 +27,22 @@ public class AccountInfoAuthRequestDTO extends AbstractBizRequestDTO { | |||
private String userName;// | |||
@NotNull(message = "性别不能为空") | |||
private Gender gender;// 性别 | |||
private String userIdImgUrl;// 会员证件照地址 | |||
private String userIdImgBase64;// 会员证件照地址 | |||
@NotBlank(message = "证件正面照地址不能为空") | |||
private String userIdImgUrl;// 会员证件照地址-信息 | |||
@NotBlank(message = "证件正面照内容不能为空") | |||
private String userIdImgBase64;// 会员证件照地址-信息 | |||
@NotBlank(message = "证件背面照地址不能为空") | |||
private String userIdBackImgUrl;// 会员证件照地址-国徽 | |||
@NotBlank(message = "证件背面照内容不能为空") | |||
private String userIdBackImgBase64;// 会员证件照地址-国徽 | |||
@NotNull(message = "证件有效期开始时间") | |||
private LocalDateTime startTime;// 有效期; | |||
private LocalDateTime expireTime;// 有效期截止日期; | |||
@NotBlank(message = "地址不能为空") | |||
private String address;// 地址; | |||
private String agentIdNum;// 默认经办人证件号;企业必填 | |||
private IdType agentIdType;// 默认经办人证件类型;企业必填 | |||
private String agentName;// 默认经办人名称;企业必填 | |||
private String agentMobile;// 默认经办人手机号;企业必填 | |||
private String appId;// 创建来源应用id; | |||
private String department;// 部门;企业必填 | |||
public void validate(ViolationValidator validator) { | |||
if (IdType.SFZ == this.idType) | |||
validator.validField("idNum", !IdcardUtil.isValidCard(this.idNum), "请输入正确的证件号"); | |||
if (IdType.SFZ == this.agentIdType) | |||
validator.validField("agentIdNum", !IdcardUtil.isValidCard(this.agentIdNum), "请输入正确的经办人证件号"); | |||
if (StringTools.hasText(this.agentMobile)) | |||
validator.validField("agentMobile", !ReUtil.isMatch(PatternPool.MOBILE, this.agentMobile), "请输入正确的经办人手机号"); | |||
} | |||
} |
@@ -17,7 +17,7 @@ public interface AccountInfoManager { | |||
AccountInfoVo edit(AccountInfoEditRequestDTO dto) throws ManagerException; | |||
void realNameAuthentication(AccountInfoAuthRequestDTO dto); | |||
void realNameAuthentication(AccountInfoAuthRequestDTO dto) throws ManagerException; | |||
void resetPassword(AccountInfoResetPwdRequestDTO dto) throws ManagerException; | |||
@@ -11,13 +11,13 @@ import cn.com.taiji.core.entity.user.Staff; | |||
import cn.com.taiji.core.entity.user.UserRole; | |||
import cn.com.taiji.core.manager.cache.RedisKeyGenerator; | |||
import cn.com.taiji.core.model.comm.protocol.ias.message.HltSendShortRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ias.portal.AuthRequest; | |||
import cn.com.taiji.core.repo.jpa.user.AccountInfoRepo; | |||
import cn.com.taiji.core.repo.jpa.user.AccountUserRoleRepo; | |||
import cn.com.taiji.core.repo.jpa.user.StaffRepo; | |||
import cn.com.taiji.core.repo.jpa.user.UserRoleRepo; | |||
import cn.com.taiji.userw.dto.system.*; | |||
import cn.com.taiji.userw.manager.AbstractCommManager; | |||
import cn.com.taiji.userw.model.FormatException; | |||
import cn.com.taiji.userw.model.system.AccountInfoVo; | |||
import cn.com.taiji.userw.model.system.UserRoleVo; | |||
import cn.com.taiji.userw.repo.jpa.request.system.AccountInfoPageRequest; | |||
@@ -46,18 +46,6 @@ public class AccountInfoManagerImpl extends AbstractCommManager implements Accou | |||
@Autowired | |||
private StaffRepo staffRepo; | |||
// @Autowired | |||
// private UserAccountRecordRepo userAccountRecordRepo; | |||
// @Value("${minio.downloadUrl}") | |||
// private String minioDownloadUrl; | |||
// @Value("${ifzt.loginNoPasswordLoginCode}") | |||
// private String loginNoPasswordLoginCode;//无感登录的确认码 | |||
// | |||
// | |||
// @Autowired | |||
// private AbstractCommManager abstractCommManager; | |||
@Override | |||
public GetMiniProgramRoleResponseDTO getMiniProgramRole(GetMiniProgramRoleRequestDTO dto) throws ManagerException { | |||
AccountInfo accountInfo = accountInfoRepo.findById(dto.getId()).orElse(null); | |||
@@ -105,7 +93,6 @@ public class AccountInfoManagerImpl extends AbstractCommManager implements Accou | |||
return new GetMiniProgramRoleResponseDTO().setRoleList(userRoleVoList); | |||
} | |||
@Override | |||
public void setMiniProgramRole(SetMiniProgramRoleRequestDTO dto) throws ManagerException { | |||
AccountInfo accountInfo = accountInfoRepo.findById(dto.getId()).orElse(null); | |||
@@ -170,10 +157,8 @@ public class AccountInfoManagerImpl extends AbstractCommManager implements Accou | |||
//清空该账号,在小程序端中所有角色 | |||
accountUserRoleRepo.deleteAll(deleteRoleList); | |||
} | |||
} | |||
@Override | |||
public AccountInfoVo query(AccountInfoQueryRequestDTO dto) throws ManagerException { | |||
AccountInfo accountInfo = accountInfoRepo.findById(dto.getId()).orElse(null); | |||
@@ -200,24 +185,12 @@ public class AccountInfoManagerImpl extends AbstractCommManager implements Accou | |||
} | |||
@Override | |||
public void realNameAuthentication(AccountInfoAuthRequestDTO dto) { | |||
public void realNameAuthentication(AccountInfoAuthRequestDTO dto) throws ManagerException { | |||
dto.validate(); | |||
AccountInfo byOpenId = accountInfoRepo.findByOpenId(dto.getAuthenticationOpenId()); | |||
if (byOpenId != null) { | |||
byOpenId.setIdType(dto.getIdType()); | |||
byOpenId.setIdNum(dto.getIdNum()); | |||
byOpenId.setUserName(dto.getUserName()); | |||
byOpenId.setUserType(dto.getUserType()); | |||
byOpenId.setGender(dto.getGender()); | |||
byOpenId.setUpdateTime(LocalDateTime.now()); | |||
accountInfoRepo.save(byOpenId); | |||
//同步修改员工的姓名 | |||
Staff staff = staffRepo.findByStaffId(byOpenId.getMobile()); | |||
if (staff != null) { | |||
staff.setStaffName(dto.getUserName()); | |||
staffRepo.save(staff); | |||
} | |||
} | |||
AuthRequest authRequest = new AuthRequest(); | |||
authRequest.setLoginSource(SourceType.findByCode(dto.getLoginSource())); | |||
copyProperties(dto, authRequest); | |||
jsonPostRepeat(authRequest); | |||
} | |||
@Override | |||
@@ -248,135 +221,6 @@ public class AccountInfoManagerImpl extends AbstractCommManager implements Accou | |||
return password.toString(); | |||
} | |||
// @Override | |||
// public AccountRegisterFullBatchResponse registerFullBatch(AccountRegisterFullBatchRequest request) { | |||
// //线程池异步处理 | |||
// threadPoolTools.execute(() -> { | |||
// File tempFile = null; | |||
// try { | |||
// tempFile = getFileByUrl(request.getExcelFileUrl()); | |||
// } catch (ManagerException e) { | |||
// logger.error(e.getMessage()); | |||
//// throw new ManagerException("获取文件失败!"); | |||
// } | |||
// | |||
// //获取文件流 | |||
// InputStream fileInputStream = null; | |||
// try { | |||
// fileInputStream = new FileInputStream(tempFile); | |||
// } catch (FileNotFoundException e) { | |||
// logger.error("获取文件失败!"); | |||
//// throw new ManagerException("获取文件失败!"); | |||
// } | |||
// | |||
// try { | |||
// //读表,进行批量注册 | |||
// EasyExcel.read(fileInputStream, | |||
// AccountRegisterData.class, | |||
// new AccountRegisterFullBatchListener( | |||
// accountInfoRepo, | |||
// appId, | |||
// IfCodeFinals.registerFullIfCode, | |||
// IfCodeFinals.loginNoPasswordIfCode, | |||
// loginNoPasswordLoginCode, | |||
// abstractCommManager)) | |||
// .sheet() | |||
// .headRowNumber(2) | |||
// .doRead(); | |||
// } catch (Exception e) { | |||
// logger.error(e.getMessage()); | |||
//// throw new ManagerException(e.getMessage()); | |||
// } | |||
// | |||
// | |||
// //删除临时文件 | |||
// FileUtil.del(tempFile); | |||
// }); | |||
// return new AccountRegisterFullBatchResponse(); | |||
// } | |||
// | |||
// @Override | |||
// public AccountRegisterFullBatchResponse enterpriseRegisterFullBatch(AccountRegisterFullBatchRequest request) throws ServiceHandleException { | |||
// //线程池异步处理 | |||
// threadPoolTools.execute(() -> { | |||
// File tempFile = null; | |||
// try { | |||
// tempFile = getFileByUrl(request.getExcelFileUrl()); | |||
// } catch (ManagerException e) { | |||
// logger.error(e.getMessage()); | |||
//// throw new ManagerException("获取文件失败!"); | |||
// } | |||
// | |||
// //获取文件流 | |||
// InputStream fileInputStream = null; | |||
// try { | |||
// fileInputStream = new FileInputStream(tempFile); | |||
// } catch (FileNotFoundException e) { | |||
// logger.error("获取文件失败!"); | |||
//// throw new ManagerException("获取文件失败!"); | |||
// } | |||
// | |||
// try { | |||
// //读表,进行批量注册 | |||
// EasyExcel.read(fileInputStream, | |||
// AccountEnterpriseRegisterData.class, | |||
// new AccountEnterpriseRegisterFullBatchListener( | |||
// accountInfoRepo, | |||
// appId, | |||
// IfCodeFinals.registerFullIfCode, | |||
// IfCodeFinals.loginNoPasswordIfCode, | |||
// loginNoPasswordLoginCode, | |||
// abstractCommManager)) | |||
// .sheet() | |||
// .headRowNumber(2) | |||
// .doRead(); | |||
// } catch (Exception e) { | |||
// logger.error(e.getMessage()); | |||
//// throw new ManagerException(e.getMessage()); | |||
// } | |||
// | |||
// | |||
// //删除临时文件 | |||
// FileUtil.del(tempFile); | |||
// }); | |||
// return new AccountRegisterFullBatchResponse(); | |||
// } | |||
// | |||
// | |||
// /*** | |||
// * 将excel的下载url的链接流转为excel文件 | |||
// */ | |||
// private File getFileByUrl(String excelUrl) throws ManagerException { | |||
// String[] split = excelUrl.split("/"); | |||
// String urlStr = ""; | |||
// String fileName = ""; | |||
// for (int i = 0; i < split.length; i++) { | |||
// if (i == 0) { | |||
// urlStr += minioDownloadUrl + "/" + split[i]; //补充下载IP地址和端口号前缀 | |||
// } else if (i == split.length - 1) { //最后以为获取文件名 | |||
// urlStr += "/" + URLEncoder.encode(split[i]).replace("+", "%20"); | |||
// String[] s = split[i].split("_", 0); | |||
// fileName = s.length == 1 ? s[0] : s[1]; | |||
// } else { | |||
// urlStr += "/" + split[i]; | |||
// | |||
// } | |||
// } | |||
// | |||
// File tempFile = null; | |||
// //try-with-resources,自动关闭流 | |||
// try (InputStream in = new URL(urlStr).openConnection().getInputStream()) { | |||
// tempFile = FileUtil.createTempFile(null); | |||
// FileUtils.copyInputStreamToFile(in, tempFile); | |||
// } catch (Exception e) { | |||
// logger.error("读取失败:" + e.getMessage()); | |||
// throw new ManagerException("通过url获取下载文件失败!"); | |||
// } | |||
// | |||
// return tempFile; | |||
// } | |||
// | |||
// | |||
@Override | |||
public AccountInfoVo updateMobile(AccountInfoUpdateMobileRequestDTO dto) throws ManagerException { | |||
SourceType sourceType = SourceType.findByCode(dto.getLoginSource()); |
@@ -5,10 +5,7 @@ import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.taiji.core.entity.basic.QtkAgency; | |||
import cn.com.taiji.core.entity.basic.QtkServiceHall; | |||
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.entity.dict.basic.UserType; | |||
import cn.com.taiji.core.entity.dict.user.RbacSource; | |||
import cn.com.taiji.core.entity.dict.user.StaffChangeType; | |||
import cn.com.taiji.core.entity.dict.user.StaffStatus; | |||
@@ -43,14 +40,16 @@ import org.springframework.stereotype.Service; | |||
import org.springframework.util.StringUtils; | |||
import java.io.InputStream; | |||
import java.security.SecureRandom; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
import java.util.*; | |||
import java.util.function.Function; | |||
import java.util.ArrayList; | |||
import java.util.HashSet; | |||
import java.util.List; | |||
import java.util.Set; | |||
import java.util.stream.Collectors; | |||
import static cn.com.taiji.core.manager.tools.SystemFinals.*; | |||
import static cn.com.taiji.core.manager.tools.SystemFinals.commonStaffId; | |||
import static cn.com.taiji.core.manager.tools.SystemFinals.staffIdentityTypeId; | |||
@Service | |||
public class StaffManagerImpl extends RedisCacheManager implements StaffManager { | |||
@@ -77,29 +76,6 @@ public class StaffManagerImpl extends RedisCacheManager implements StaffManager | |||
@Autowired | |||
private MinioUtil minioUtil; | |||
// @Value("${app.appId}") | |||
// private String appId; | |||
// | |||
// @Autowired | |||
// private AccessTokenUtil accessTokenUtil; | |||
// @Value("${minio.downloadUrl}") | |||
// private String minioDownloadUrl; | |||
// @Value("${ifzt.loginNoPasswordLoginCode}") | |||
// private String loginNoPasswordLoginCode;//无感登录的确认码 | |||
// | |||
// | |||
// @Autowired | |||
// private PortalManager portalManager; | |||
// @Value("${uploadUrl}") | |||
// private String fileUploadUrl; | |||
// | |||
// @Autowired | |||
// private AbstractCommManager abstractCommManager; | |||
// | |||
// @Autowired | |||
// private SystemTypeAndSourceUtil systemTypeAndRbacSourceUtil ; | |||
@Override | |||
public Pagination page(StaffPageRequestDTO dto) throws ManagerException { | |||
if (dto.getIdentityType() != null && dto.getIdentityType().trim().isEmpty() && !dictTypeUtil.checkLegalById(staffIdentityTypeId, dto.getIdentityType())) |
@@ -19,6 +19,8 @@ public class PortalServiceHandler extends AbstractIasServiceHandler<PortalServic | |||
@Autowired | |||
private LogoutManager logoutManager; | |||
@Autowired | |||
private AuthManager authManager; | |||
@Autowired | |||
private LoginConfirmManager loginConfirmManager; | |||
@Autowired | |||
private AccessTokenCheckManager accessTokenCheckManager; | |||
@@ -53,6 +55,8 @@ public class PortalServiceHandler extends AbstractIasServiceHandler<PortalServic | |||
return loginManager.serviceHandle((LoginRequest) request); | |||
case LOGOUT: | |||
return logoutManager.serviceHandle((LogoutRequest) request); | |||
case AUTH: | |||
return authManager.serviceHandle((AuthRequest) request); | |||
case LOGINCONFIRM: | |||
return loginConfirmManager.serviceHandle((LoginConfirmRequest) request); | |||
case ACCESSTOKENCHECK: |
@@ -0,0 +1,51 @@ | |||
package cn.com.taiji.ias.manager.portal; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.core.entity.dict.basic.SourceType; | |||
import cn.com.taiji.core.entity.user.AccountInfo; | |||
import cn.com.taiji.core.entity.user.Staff; | |||
import cn.com.taiji.core.model.comm.protocol.ias.portal.AuthRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ias.portal.AuthResponse; | |||
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; | |||
import cn.com.taiji.core.repo.jpa.user.AccountInfoRepo; | |||
import cn.com.taiji.core.repo.jpa.user.StaffRepo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.time.LocalDateTime; | |||
@Service | |||
public class AuthManager extends AbstractLoginManager { | |||
@Autowired | |||
private AccountInfoRepo accountInfoRepo; | |||
@Autowired | |||
private StaffRepo staffRepo; | |||
public AuthResponse serviceHandle(AuthRequest request) throws ServiceHandleException { | |||
String openId = request.getLoginSource() == SourceType.WEB || request.getLoginSource() == SourceType.SERVICE_HALL ? request.getOpenId() : findOpenIdByToken(request.getAccessToken()); | |||
AccountInfo byOpenId = accountInfoRepo.findByOpenId(openId); | |||
if (byOpenId == null) throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该用户不存在"); | |||
byOpenId.setIdType(request.getIdType()); | |||
byOpenId.setIdNum(request.getIdNum()); | |||
byOpenId.setUserName(request.getUserName()); | |||
byOpenId.setGender(request.getGender()); | |||
byOpenId.setUserIdImgUrl(request.getUserIdImgUrl()); | |||
byOpenId.setUserIdImgBase64(request.getUserIdImgBase64()); | |||
byOpenId.setUserIdBackImgUrl(request.getUserIdBackImgUrl()); | |||
byOpenId.setUserIdBackImgBase64(request.getUserIdBackImgBase64()); | |||
byOpenId.setStartTime(request.getStartTime()); | |||
byOpenId.setExpireTime(request.getExpireTime()); | |||
byOpenId.setAddress(request.getAddress()); | |||
byOpenId.setUpdateTime(LocalDateTime.now()); | |||
//同步修改员工的姓名 | |||
Staff staff = findAndValidStaff(openId, request.getLoginSource()); | |||
if (staff != null) { | |||
staff.setStaffName(request.getUserName()); | |||
staffRepo.save(staff); | |||
} | |||
accountInfoRepo.save(byOpenId); | |||
AuthResponse response = new AuthResponse(); | |||
response.setInfo("实名认证成功"); | |||
return response; | |||
} | |||
} |