Pārlūkot izejas kodu

ias 实名认证、获取用户信息传customerId

master
chenchaod pirms 1 mēnesi
vecāks
revīzija
5514c5dad2

+ 1
- 0
gly-base-core/src/main/java/cn/com/taiji/core/model/comm/protocol/ias/portal/FindAccountInfoByTokenResponse.java Parādīt failu

@@ -24,5 +24,6 @@ public class FindAccountInfoByTokenResponse extends AbstractPortalResponse {
private String userName;// 用户姓名/企业名称
private Gender gender;// 性别
private String nickName;// 昵称
private String customerId;//最近一次ETC用户

}

+ 7
- 5
zhywpt-service-ias/src/main/java/cn/com/taiji/ias/manager/agencyConfig/AgencyConfigManager.java Parādīt failu

@@ -52,11 +52,13 @@ public class AgencyConfigManager extends RedisCacheManager {
return config.getSignChange();
} else if (configType.equals(AgencyConfigType.QT_SIGN)) {
return config.getQtSign();
} else if (configType.equals(AgencyConfigType.CHANNEL_SIGN_URL)) {
return config.getChannelSignUrl();
} else if (configType.equals(AgencyConfigType.CHANNEL_SIGN_APP_ID)) {
return config.getChannelSignAppId();
} else if (configType.equals(AgencyConfigType.QT_USER_SIGN)) {
}
// else if (configType.equals(AgencyConfigType.CHANNEL_SIGN_URL)) {
// return config.getChannelSignUrl();
// } else if (configType.equals(AgencyConfigType.CHANNEL_SIGN_APP_ID)) {
// return config.getChannelSignAppId();
// }
else if (configType.equals(AgencyConfigType.QT_USER_SIGN)) {
return config.getQtUserSign();
}
return false;

+ 7
- 0
zhywpt-service-ias/src/main/java/cn/com/taiji/ias/manager/portal/AuthManager.java Parādīt failu

@@ -5,6 +5,8 @@ import cn.com.taiji.core.entity.dict.basic.SourceType;
import cn.com.taiji.core.entity.log.IasInterfaceLog;
import cn.com.taiji.core.entity.user.AccountInfo;
import cn.com.taiji.core.entity.user.Staff;
import cn.com.taiji.core.manager.cache.LoginCacheFinals;
import cn.com.taiji.core.manager.cache.RedisKeyGenerator;
import cn.com.taiji.core.manager.comm.LogManager;
import cn.com.taiji.core.model.comm.protocol.ias.portal.AuthRequest;
import cn.com.taiji.core.model.comm.protocol.ias.portal.AuthResponse;
@@ -16,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;

@Service
public class AuthManager extends AbstractLoginManager implements LogManager<AuthRequest, AuthResponse, IasInterfaceLog> {
@@ -60,6 +63,10 @@ public class AuthManager extends AbstractLoginManager implements LogManager<Auth
staffRepo.save(staff);
}
accountInfoRepo.save(byOpenId);
if (SourceType.ALI.equals(request.getLoginSource()) || SourceType.WECHAT.equals(request.getLoginSource())) {
//更新缓存
redisManager.set(RedisKeyGenerator.getLoginAccountInfoKey(request.getAccessToken()), accountInfo.toJson(), LoginCacheFinals.LOGIN_TOKEN_EXPIRED, TimeUnit.MINUTES);
}
AuthResponse response = new AuthResponse();
response.setInfo("实名认证成功");
return onSuccess(request, response, IasInterfaceLog.class, System.currentTimeMillis() - begin);

+ 19
- 0
zhywpt-service-ias/src/main/java/cn/com/taiji/ias/manager/portal/FindAccountInfoByTokenManager.java Parādīt failu

@@ -1,6 +1,7 @@
package cn.com.taiji.ias.manager.portal;

import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.core.entity.basic.QtkCustomerInfo;
import cn.com.taiji.core.entity.dict.basic.SourceType;
import cn.com.taiji.core.entity.log.IasInterfaceLog;
import cn.com.taiji.core.entity.user.AccountInfo;
@@ -8,11 +9,14 @@ import cn.com.taiji.core.manager.comm.LogManager;
import cn.com.taiji.core.model.comm.protocol.ias.portal.FindAccountInfoByTokenRequest;
import cn.com.taiji.core.model.comm.protocol.ias.portal.FindAccountInfoByTokenResponse;
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError;
import cn.com.taiji.core.repo.jpa.basic.QtkCustomerInfoRepo;
import cn.com.taiji.core.repo.jpa.log.IasInterfaceLogRepo;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 通过token换取用户信息
* 小程序是ETC用户的用户信息,APP和WEB不能使用此功能
@@ -22,6 +26,9 @@ public class FindAccountInfoByTokenManager extends AbstractLoginManager implemen
@Autowired
private IasInterfaceLogRepo logRepo;

@Autowired
private QtkCustomerInfoRepo customerInfoRepo;

public FindAccountInfoByTokenResponse serviceHandle(FindAccountInfoByTokenRequest request) throws ServiceHandleException {
try {
long begin = System.currentTimeMillis();
@@ -30,6 +37,18 @@ public class FindAccountInfoByTokenManager extends AbstractLoginManager implemen
AccountInfo accountInfo = findAccountInfoByToken(request.getAccessToken());
FindAccountInfoByTokenResponse response = new FindAccountInfoByTokenResponse();
copyProperties(accountInfo, response);
if (!hasText(response.getCustomerId())) {
List<QtkCustomerInfo> customerInfoList = Lists.newArrayList();
// 个人
QtkCustomerInfo personal = customerInfoRepo.findByCustomerIdTypeAndCustomerIdNum(accountInfo.getIdType(), accountInfo.getIdNum());
if (personal != null)
customerInfoList.add(personal);
// 企业-经办人
List<QtkCustomerInfo> units = customerInfoRepo.listByAgentInfo(accountInfo.getIdType(), accountInfo.getIdNum());
if (!isEmpty(units))
customerInfoList.addAll(units);
if (!isEmpty(customerInfoList)) response.setCustomerId(customerInfoList.get(0).getCustomerId());
}
return onSuccess(request, response, IasInterfaceLog.class, System.currentTimeMillis() - begin);
} catch (ServiceHandleException e) {
throw exception(request, IasInterfaceLog.class, e.getMessage());

Notiek ielāde…
Atcelt
Saglabāt