天融信用户设置默认随机邮箱
parent
f77121c19a
commit
f2861c2712
|
@ -32,10 +32,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -115,13 +112,10 @@ public class TrxServiceImpl implements TrxService {
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
GeneralResult<Map<String, Object>> login = new GeneralResult<>();
|
GeneralResult<Map<String, Object>> login = new GeneralResult<>();
|
||||||
try {
|
try {
|
||||||
String requestData = "{ \"cookie\": \"" + trxAuthModel.getClientHello() + "\", \"Authen\": [ { \"loginName\": \"" + trxAuthModel.getLoginName() +
|
|
||||||
"\", \"passwd\": \"" + trxAuthModel.getPasswd() + "\" }, { \"certMd5\": \"" + trxAuthModel.getServerHello() + "\", \"value\": \"\", \"hashType\": \"\" }, " +
|
|
||||||
"{ \"passcode\": \"\" }, { \"df_code\": \"\" }, { \"client_ip\": \"" + trxAuthModel.getClientIp() + "\" } ] }";
|
|
||||||
HttpRequest httpRequest = HttpRequest.post(url)
|
HttpRequest httpRequest = HttpRequest.post(url)
|
||||||
.header("isToken", "false")
|
.header("isToken", "false")
|
||||||
.body(requestData);
|
.body(JSONObject.toJSONString(paramsMap));
|
||||||
log.info("调用天融信用户登录接口, 请求方法" + httpRequest.getMethod() + ",参数:" + requestData);
|
log.info("调用天融信用户登录接口, 请求信息:" + JSONObject.toJSONString(httpRequest));
|
||||||
HttpResponse response = httpRequest.execute();
|
HttpResponse response = httpRequest.execute();
|
||||||
result = JSONObject.parseObject(response.body());
|
result = JSONObject.parseObject(response.body());
|
||||||
if (!"0".equals(result.getString("result"))) {
|
if (!"0".equals(result.getString("result"))) {
|
||||||
|
@ -156,6 +150,14 @@ public class TrxServiceImpl implements TrxService {
|
||||||
params.put("userId", userId);
|
params.put("userId", userId);
|
||||||
//请求运控系统获取用户信息
|
//请求运控系统获取用户信息
|
||||||
YkUserModel ykUser = JSONArray.parseArray(ykUtils.call(YkInf.queryAllUser, params, String.class), YkUserModel.class).get(0);
|
YkUserModel ykUser = JSONArray.parseArray(ykUtils.call(YkInf.queryAllUser, params, String.class), YkUserModel.class).get(0);
|
||||||
|
// 处理邮箱
|
||||||
|
Random random = new Random();
|
||||||
|
// 生成指定长度的随机数字字符串
|
||||||
|
StringBuilder emailStr = new StringBuilder(9);
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
emailStr.append(random.nextInt(10)); // 生成 0 到 9 之间的随机数字
|
||||||
|
}
|
||||||
|
String email = emailStr.toString() + "@163.com";
|
||||||
if (ObjectUtils.isEmpty(user)) {
|
if (ObjectUtils.isEmpty(user)) {
|
||||||
log.info("开始新增天融信登录用户,userId: " + userId);
|
log.info("开始新增天融信登录用户,userId: " + userId);
|
||||||
// 新增 以userId作为account 并添加注释
|
// 新增 以userId作为account 并添加注释
|
||||||
|
@ -169,7 +171,7 @@ public class TrxServiceImpl implements TrxService {
|
||||||
userBean.setAccount(ykUser.getLoginName());
|
userBean.setAccount(ykUser.getLoginName());
|
||||||
userBean.setName(ykUser.getUserName());
|
userBean.setName(ykUser.getUserName());
|
||||||
userBean.setMobile(ykUser.getMobile());
|
userBean.setMobile(ykUser.getMobile());
|
||||||
userBean.setEmail(ykUser.getEmail());
|
userBean.setEmail(ykUser.getEmail() == null ? email : ykUser.getEmail());
|
||||||
userBean.setUserId(userId);
|
userBean.setUserId(userId);
|
||||||
RequestContext context = new RequestContext();
|
RequestContext context = new RequestContext();
|
||||||
context.setTarget(1L);
|
context.setTarget(1L);
|
||||||
|
@ -197,7 +199,7 @@ public class TrxServiceImpl implements TrxService {
|
||||||
userBean.setAccount(ykUser.getLoginName());
|
userBean.setAccount(ykUser.getLoginName());
|
||||||
userBean.setName(ykUser.getUserName());
|
userBean.setName(ykUser.getUserName());
|
||||||
userBean.setMobile(ykUser.getMobile());
|
userBean.setMobile(ykUser.getMobile());
|
||||||
userBean.setEmail(ykUser.getEmail());
|
userBean.setEmail(ykUser.getEmail() == null ? email : ykUser.getEmail());
|
||||||
RequestContext context = new RequestContext();
|
RequestContext context = new RequestContext();
|
||||||
context.setTarget(1L);
|
context.setTarget(1L);
|
||||||
context.setCatalog(RequestContext.Catalog.Manager);
|
context.setCatalog(RequestContext.Catalog.Manager);
|
||||||
|
|
Loading…
Reference in New Issue