处理单点登录
parent
30651c1200
commit
441ea98cd6
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.auth0.jwt.interfaces.Claim;
|
||||
import com.bocloud.sms.interfaces.TenantService;
|
||||
import com.bocloud.sms.interfaces.UserService;
|
||||
import com.bocloud.sms.service.TrxServiceImpl;
|
||||
import com.megatron.common.model.GeneralResult;
|
||||
import com.megatron.common.model.RequestContext;
|
||||
import com.megatron.common.utils.Common;
|
||||
|
@ -12,12 +13,10 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -32,6 +31,8 @@ public class TokenController {
|
|||
private final StringRedisTemplate redisTemplate;
|
||||
private final TenantService tenantService;
|
||||
private final UserService userService;
|
||||
@Autowired
|
||||
private TrxServiceImpl trxServiceImpl;
|
||||
|
||||
public TokenController(StringRedisTemplate redisTemplate, TenantService tenantService, UserService userService) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
|
@ -47,7 +48,14 @@ public class TokenController {
|
|||
*/
|
||||
@GetMapping("/v1/token")
|
||||
@Operation(summary = "单点登录验证token")
|
||||
public GeneralResult<String> checkToken(HttpServletRequest request) {
|
||||
public GeneralResult<String> checkToken(HttpServletRequest request,
|
||||
@RequestParam(value = "trxToken", required = false) String trxToken) {
|
||||
if (null != trxToken) {
|
||||
GeneralResult tokenOnline = trxServiceImpl.getTokenOnline(trxToken);
|
||||
if (!tokenOnline.isSuccess()) {
|
||||
return tokenOnline;
|
||||
}
|
||||
}
|
||||
String token = request.getHeader(Common.TOKEN);
|
||||
if (!StringUtils.hasText(token)) {
|
||||
token = request.getParameter(Common.TOKEN);
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.bocloud.sms.booter.controller;
|
||||
|
||||
import com.bocloud.sms.interfaces.TrxService;
|
||||
import com.bocloud.sms.model.TrxAuthModel;
|
||||
import com.megatron.common.model.GeneralResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/v1/trx")
|
||||
@Tag(name = "系统升级")
|
||||
@Slf4j
|
||||
public class TrxController {
|
||||
|
||||
@Autowired
|
||||
private TrxService trxService;
|
||||
|
||||
/**
|
||||
* 单点登录验证token
|
||||
*
|
||||
* @param ngxCookie
|
||||
* @return randomstr
|
||||
*/
|
||||
@GetMapping("/randomstr")
|
||||
@Operation(summary = "获取Randomstr")
|
||||
public GeneralResult<String> getRandomstr(@RequestParam(value = "ngxCookie") String ngxCookie) {
|
||||
GeneralResult generalResult = trxService.getRandomstr(ngxCookie);
|
||||
return generalResult;
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
@Operation(summary = "用户登录")
|
||||
public GeneralResult<String> getAuthToken(@RequestBody TrxAuthModel trxAuthModel,
|
||||
HttpServletRequest request) {
|
||||
trxAuthModel.setClientIp(request.getRemoteAddr());
|
||||
GeneralResult generalResult = trxService.getAuthToken(trxAuthModel);
|
||||
return generalResult;
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
@Operation(summary = "天融信用户登出")
|
||||
public GeneralResult<String> logout(@RequestBody TrxAuthModel trxAuthModel,
|
||||
HttpServletRequest request) {
|
||||
trxAuthModel.setClientIp(request.getRemoteAddr());
|
||||
GeneralResult generalResult = trxService.logout(trxAuthModel);
|
||||
return generalResult;
|
||||
}
|
||||
}
|
|
@ -395,12 +395,14 @@ public class UserController {
|
|||
*/
|
||||
@Operation(summary = "获取登录用户权限")
|
||||
@GetMapping("/permissions")
|
||||
public GeneralResult loginPermission(@Value(Common.REQ_CONTEXT) RequestContext requestContext) {
|
||||
public GeneralResult loginPermission(@Value(Common.REQ_CONTEXT) RequestContext requestContext,
|
||||
@RequestParam(value = "trxToken", required = false) String trxToken) {
|
||||
switch (requestContext.getCatalog()) {
|
||||
case Tenant:
|
||||
return tenantService.listPermissions(requestContext);
|
||||
case Manager:
|
||||
return managerService.listPermissions(requestContext);
|
||||
// 处理天融信登录用户,传递token参数 trxToken可以为null
|
||||
return managerService.listPermissions(requestContext, trxToken);
|
||||
case User:
|
||||
return userPermissionService.listPermissions(requestContext);
|
||||
default:
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.bocloud.sms.booter.scheduler;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bocloud.sms.entity.AppEntity;
|
||||
import com.bocloud.sms.enums.YkInf;
|
||||
import com.bocloud.sms.service.utils.YkUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 从运控获取应用列表
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class YunKongGetAppSchedule {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
@Autowired
|
||||
private YkUtils ykUtils;
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
|
||||
@Scheduled(cron = "${yk.getAppListCron:0 0/30 * * * ?}")
|
||||
public void syncAppList() {
|
||||
logger.info("同步应用列表");
|
||||
try{
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("type", "user");
|
||||
params.put("page", "0");
|
||||
params.put("limit", "1000");
|
||||
|
||||
JSONObject obj = ykUtils.call(YkInf.getAppList,params,JSONObject.class);
|
||||
List<AppEntity> appList = JSONArray.parseArray(obj.getString("list"),AppEntity.class);
|
||||
redisTemplate.opsForValue().set("SYS_APP_LIST", JSONObject.toJSONString(appList));
|
||||
}catch (Exception e){
|
||||
logger.error("同步应用列表异常",e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,6 @@ public interface ManagerService {
|
|||
* @param requestContext
|
||||
* @return
|
||||
*/
|
||||
GeneralResult<List<PermissionBean>> listPermissions(RequestContext requestContext);
|
||||
GeneralResult<List<PermissionBean>> listPermissions(RequestContext requestContext, String trxToken);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.bocloud.sms.interfaces;
|
||||
|
||||
import com.bocloud.sms.model.TrxAuthModel;
|
||||
import com.megatron.common.model.GeneralResult;
|
||||
|
||||
public interface TrxService {
|
||||
GeneralResult getRandomstr(String ngxCookie);
|
||||
|
||||
GeneralResult getAuthToken(TrxAuthModel trxAuthModel);
|
||||
|
||||
GeneralResult logout(TrxAuthModel trxAuthModel);
|
||||
}
|
|
@ -8,6 +8,7 @@ import com.bocloud.sms.entity.Plugin;
|
|||
import com.bocloud.sms.entity.User;
|
||||
import com.bocloud.sms.interfaces.ManagerService;
|
||||
import com.bocloud.sms.interfaces.PluginService;
|
||||
import com.bocloud.sms.model.AppModule;
|
||||
import com.bocloud.sms.model.PermissionBean;
|
||||
import com.bocloud.sms.model.single.RoleResponseModel;
|
||||
import com.bocloud.sms.repository.PermissionRepository;
|
||||
|
@ -26,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
@ -59,6 +61,8 @@ public class ManagerServiceImpl implements ManagerService {
|
|||
private StringRedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
@Autowired
|
||||
private TrxServiceImpl trxServiceImpl;
|
||||
|
||||
private String getRedisKey(long userId) {
|
||||
return "single_user_roles_"+ userId;
|
||||
|
@ -71,9 +75,34 @@ public class ManagerServiceImpl implements ManagerService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public GeneralResult<List<PermissionBean>> listPermissions(RequestContext context) {
|
||||
// 查询所有权限(菜单,按钮,api)
|
||||
public GeneralResult<List<PermissionBean>> listPermissions(RequestContext context, String trxToken) {
|
||||
// 处里天融信用户登录
|
||||
User user = userRepository.query(context.getTarget());
|
||||
List<Long> qxAppModuleIds = new ArrayList<>();
|
||||
if (null != user.getUserId()) {
|
||||
// 天融信用户获取权限系统菜单权限
|
||||
log.info("开始获取天融信登录用户所拥有权限系统列表");
|
||||
List<AppModule> appModules = trxServiceImpl.queryQxCategoryList(trxToken, user.getUserId());
|
||||
if (CollectionUtils.isEmpty(appModules)) {
|
||||
log.error("获取天融信登录用户所拥有权限系统列表失败");
|
||||
return new GeneralResult<>(false, "获取权限系统菜单信息失败");
|
||||
}
|
||||
for (AppModule appModule : appModules) {
|
||||
long id = Long.parseLong(appModule.getId());
|
||||
qxAppModuleIds.add(id);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询所拥有权限(菜单,按钮,api)
|
||||
List<Permission> permissions = permissionRepository.getPermissions(context.getTarget());
|
||||
|
||||
// 如果为天融信登录用户,那么在云管过滤出天融信登录用户所拥有权限系统权限
|
||||
if (!CollectionUtils.isEmpty(qxAppModuleIds)) {
|
||||
permissions = permissions.stream()
|
||||
.filter(permission -> qxAppModuleIds.contains(permission.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 查询所有权限
|
||||
Map<Long, Permission> allPermissions = permissionRepository.list(false).stream()
|
||||
.collect(Collectors.toMap(Permission::getId, Function.identity()));
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
package com.bocloud.sms.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bocloud.sms.entity.AppEntity;
|
||||
import com.bocloud.sms.entity.Role;
|
||||
import com.bocloud.sms.entity.User;
|
||||
import com.bocloud.sms.enums.YkInf;
|
||||
import com.bocloud.sms.interfaces.TrxService;
|
||||
import com.bocloud.sms.model.*;
|
||||
import com.bocloud.sms.repository.RoleRepository;
|
||||
import com.bocloud.sms.repository.UserRepository;
|
||||
import com.bocloud.sms.service.utils.QxUtils;
|
||||
import com.bocloud.sms.service.utils.YkUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.megatron.common.encrypt.AESEncryptor;
|
||||
import com.megatron.common.encrypt.Encryptor;
|
||||
import com.megatron.common.model.GeneralResult;
|
||||
import com.megatron.common.model.RequestContext;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TrxServiceImpl implements TrxService {
|
||||
@Value("${trx.address:https://109.64.24.225}")
|
||||
private String trxUrl;
|
||||
@Autowired
|
||||
private UserServiceImpl userServiceImpl;
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
@Autowired
|
||||
private YkUtils ykUtils;
|
||||
@Autowired
|
||||
private QxUtils qxUtils;
|
||||
@Autowired
|
||||
private RoleRepository roleRepository;
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
// 获取天融信随机字符串
|
||||
@Override
|
||||
public GeneralResult getRandomstr(String ngxCookie) {
|
||||
String url = trxUrl + "/getRandomStr";
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("isToken", false);
|
||||
paramsMap.put("ngx_cookie", ngxCookie);
|
||||
JSONObject result = JSONObject.parseObject(HttpUtil.get(url, paramsMap));
|
||||
if ("-1".equals(result.getString("result"))) {
|
||||
return new GeneralResult(false, "获取随机数失败" + result.getString("errmsg"));
|
||||
}
|
||||
return new GeneralResult(true, result.getString("result"), "获取随机数成功");
|
||||
}
|
||||
|
||||
// 获取天融信用户信息
|
||||
@Override
|
||||
public GeneralResult getAuthToken(TrxAuthModel trxAuthModel) {
|
||||
String url = trxUrl + "/userAuthen";
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("cookie", trxAuthModel.getClientHello());
|
||||
paramsMap.put("certMd5", trxAuthModel.getServerHello());
|
||||
paramsMap.put("client_ip", trxAuthModel.getClientIp());
|
||||
JSONObject result = JSONObject.parseObject(HttpUtil.post(url, paramsMap));
|
||||
if (!"0".equals(result.getString("result"))) {
|
||||
return new GeneralResult(false, "用户登录失败" + result.getString("errmsg"));
|
||||
}
|
||||
String trxToken = result.getString("token");
|
||||
String userId = result.getString("userId");
|
||||
// 处理ukey登录用户
|
||||
saveUserByTrx(userId);
|
||||
// 登录
|
||||
User user = userRepository.getByUserId(userId);
|
||||
Encryptor encryptor = new AESEncryptor();
|
||||
String password = encryptor.encrypt(userId + "CMP", null);
|
||||
GeneralResult<Map<String, Object>> login = userServiceImpl.login(user.getAccount(), password, null, null, true);
|
||||
login.getData().put("trxToken", trxToken);
|
||||
return new GeneralResult(true, login, "用户登录成功");
|
||||
}
|
||||
|
||||
private void saveUserByTrx(String userId) {
|
||||
User user = userRepository.getByUserId(userId);
|
||||
// 根据userId获取运控系统用户信息
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("userId", userId);
|
||||
//请求运控系统获取用户信息
|
||||
YkUserModel ykUser = JSONArray.parseArray(ykUtils.call(YkInf.queryAllUser, params, String.class), YkUserModel.class).get(0);
|
||||
if (ObjectUtils.isEmpty(user)) {
|
||||
log.info("开始新增天融信登录用户,userId: " + userId);
|
||||
// 新增 以userId作为account 并添加注释
|
||||
UserBean userBean = new UserBean();
|
||||
userBean.setPassword(userId + "CMP");
|
||||
userBean.setSex(true);
|
||||
userBean.setIsManager(true);
|
||||
userBean.setUserId(userId);
|
||||
userBean.setRemark("天融信登录添加用户");
|
||||
// 设置运控用户信息
|
||||
userBean.setAccount(ykUser.getLoginName());
|
||||
userBean.setName(ykUser.getUserName());
|
||||
userBean.setMobile(ykUser.getMobile());
|
||||
userBean.setEmail(ykUser.getEmail());
|
||||
userBean.setUserId(userId);
|
||||
RequestContext context = new RequestContext();
|
||||
context.setTarget(1L);
|
||||
context.setCatalog(RequestContext.Catalog.Manager);
|
||||
userServiceImpl.create(userBean, context);
|
||||
/**
|
||||
* 云管授权当前用户全部角色
|
||||
* 1,获取云管角色列表
|
||||
* 2,授权
|
||||
* */
|
||||
User userByUserId = userRepository.getByUserId(userId);
|
||||
List<Long> roleIds = roleRepository.list().stream().map(Role::getId).collect(Collectors.toList());
|
||||
userServiceImpl.accredit(userByUserId.getId(), roleIds, context);
|
||||
log.info("完成新增天融信登录用户,userId: " + userId);
|
||||
} else {
|
||||
// 修改
|
||||
log.info("开始修改天融信登录用户,userId: " + userId);
|
||||
UserBean userBean = new UserBean();
|
||||
userBean.setId(user.getId());
|
||||
userBean.setSex(true);
|
||||
userBean.setIsManager(true);
|
||||
userBean.setUserId(userId);
|
||||
userBean.setRemark("天融信登录添加用户");
|
||||
// 设置运控用户信息
|
||||
userBean.setAccount(ykUser.getLoginName());
|
||||
userBean.setName(ykUser.getUserName());
|
||||
userBean.setMobile(ykUser.getMobile());
|
||||
userBean.setEmail(ykUser.getEmail());
|
||||
RequestContext context = new RequestContext();
|
||||
context.setTarget(1L);
|
||||
context.setCatalog(RequestContext.Catalog.Manager);
|
||||
userServiceImpl.modify(user.getId(), userBean, context);
|
||||
log.info("完成修改天融信登录用户,userId: " + userId);
|
||||
}
|
||||
}
|
||||
|
||||
//确认天融信token是否有效
|
||||
public GeneralResult getTokenOnline(String trxToken) {
|
||||
String url = trxUrl + "/tokenOnline";
|
||||
JSONObject result = JSONObject.parseObject(HttpUtil.post(url, trxToken));
|
||||
if (!"0".equals(result.getString("result"))) {
|
||||
return new GeneralResult(false, "当前token无效" + result.getString("errmsg"));
|
||||
}
|
||||
return new GeneralResult(true, "当前token有效");
|
||||
}
|
||||
|
||||
|
||||
// 登出天融信 (下线)
|
||||
@Override
|
||||
public GeneralResult logout(TrxAuthModel trxAuthModel) {
|
||||
String url = trxUrl + "/offlineToken";
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("token", trxAuthModel.getTrxToken());
|
||||
paramsMap.put("client_ip", trxAuthModel.getClientIp());
|
||||
JSONObject result = JSONObject.parseObject(HttpUtil.post(url, paramsMap));
|
||||
if (!"0".equals(result.getString("result"))) {
|
||||
return new GeneralResult(false, "下线失败" + result.getString("msg"));
|
||||
}
|
||||
return new GeneralResult(true, "下线成功");
|
||||
}
|
||||
|
||||
// 获取运控系统应用列表
|
||||
public List<AppEntity> queryAppList(String userToken, String userId) {
|
||||
// 获取运控系统应用列表
|
||||
String sysAppList = redisTemplate.opsForValue().get("SYS_APP_LIST");
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<List<AppEntity>>() {}.getType();
|
||||
List<AppEntity> appList = gson.fromJson(sysAppList, listType);
|
||||
|
||||
List<AppPerm> permList = JSONArray.parseArray(qxUtils.queryApp(userToken, userId), AppPerm.class);
|
||||
|
||||
if (CollectionUtil.isEmpty(permList)) return appList;
|
||||
|
||||
List<String> appIds = new ArrayList<>(permList.size());
|
||||
|
||||
permList.stream().forEach(appPerm -> appIds.add(appPerm.getId()));
|
||||
|
||||
appList.stream().forEach(app -> {
|
||||
if (appIds.contains(app.getAppId())) {
|
||||
app.setEnable(false);
|
||||
}
|
||||
});
|
||||
|
||||
return appList;
|
||||
}
|
||||
|
||||
// 获取天融信用户在权限系统的门户应用的菜单
|
||||
public List<AppModule> queryQxCategoryList(String userToken ,String userId) {
|
||||
List<AppModule> appModules = JSONArray.parseArray(qxUtils.queryAppModules(userToken, userId), AppModule.class);
|
||||
return appModules;
|
||||
}
|
||||
|
||||
}
|
|
@ -437,7 +437,9 @@ public class UserServiceImpl implements UserService {
|
|||
Assert.isNull(existUser, "该账号已存在");
|
||||
User existEmailUser = userRepository.getByEmail(user.getEmail());
|
||||
Assert.isNull(existEmailUser, "该邮箱已被注册");
|
||||
String password = encryptor.encrypt(new AESEncryptor().decrypt(user.getPassword().trim(), null), salt);
|
||||
// trx用户登录添加时密码处理
|
||||
String password = encryptor.encrypt(userBean.getUserId() == null ? new AESEncryptor().decrypt(user.getPassword().trim(), null) : userBean.getPassword(), salt);
|
||||
// String password = encryptor.encrypt(new AESEncryptor().decrypt(user.getPassword().trim(), null), salt);
|
||||
user.setPassword(password);
|
||||
// 关键信息去空
|
||||
user.setAccount(user.getAccount().trim());
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.bocloud.sms.service.utils;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bocloud.sms.model.QxReqVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class QxUtils {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
@Value("${qx.queryAppUrl}")
|
||||
private String queryAppUrl;
|
||||
@Value("${qx.queryAppModulesUrl}")
|
||||
private String queryAppModulesUrl;
|
||||
|
||||
public String queryApp(String userToken, String userId){
|
||||
QxReqVo qxReqVo = new QxReqVo(userToken, userId,"portal","portal","","");
|
||||
return call(queryAppUrl,qxReqVo);
|
||||
}
|
||||
|
||||
public String queryAppModules(String userToken, String userId){
|
||||
QxReqVo qxReqVo = new QxReqVo(userToken, userId,"portal","portal","","");
|
||||
return call(queryAppUrl,qxReqVo);
|
||||
}
|
||||
|
||||
public String call(String url, QxReqVo qxReqVo){
|
||||
String str = JSONObject.toJSONString(qxReqVo);
|
||||
logger.info("call method[{}] req params[{}]",url,str);
|
||||
JSONObject result = JSONObject.parseObject(HttpUtil.post(url,str));
|
||||
if (!"200".equals(result.getString("status"))) {
|
||||
throw new IllegalArgumentException("调用权限系统接口异常" + result.getString("msg"));
|
||||
}
|
||||
|
||||
return result.getString("data");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.bocloud.sms.service.utils;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bocloud.sms.enums.YkInf;
|
||||
import com.bocloud.sms.model.YkReqVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class YkUtils {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
//参考application.yml配置文件
|
||||
@Value("${yk.url}")
|
||||
private String url;
|
||||
|
||||
@Value("${yk.reqUserId}")
|
||||
private String reqUserId;
|
||||
|
||||
@Value("${yk.systemId}")
|
||||
private String systemId;
|
||||
|
||||
|
||||
public <T> T call(YkInf inf, JSONObject params, Class expectCls){
|
||||
YkReqVo reqVo = new YkReqVo(reqUserId,systemId,inf.getUrl(),params);
|
||||
String str = JSONObject.toJSONString(reqVo);
|
||||
logger.info("call yk url [{}]" , url);
|
||||
logger.info("call yk method[{}] req params[{}]",reqVo.getMethod(),str);
|
||||
String resultStr = HttpUtil.post(url, str);
|
||||
//logger.info("call method[{}] resp params[{}]",reqVo.getMethod(),resultStr);
|
||||
JSONObject result = JSONObject.parseObject(resultStr);
|
||||
logger.info("call yk result [{}]" , result.toString());
|
||||
|
||||
if (result.getInteger("returnCode") != 1) {
|
||||
throw new IllegalArgumentException("调用运控接口异常" + result.getString("msg"));
|
||||
}
|
||||
if(JSONObject.class.equals(expectCls)){
|
||||
return (T)result.getJSONObject("data");
|
||||
}else{
|
||||
return (T)result.getString("data");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,716 @@
|
|||
package com.bocloud.sms.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
public class AppEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 应用信息
|
||||
*/
|
||||
private String appInfo;
|
||||
|
||||
/**
|
||||
* 部署位置
|
||||
*/
|
||||
private String sysPlace;
|
||||
|
||||
/**
|
||||
* 软件类型
|
||||
*/
|
||||
private String appType;
|
||||
|
||||
/**
|
||||
* 应用级别
|
||||
*/
|
||||
private String appLevel;
|
||||
|
||||
/**
|
||||
* 型号系统
|
||||
*/
|
||||
private String modelSystem;
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
private String resourceType;
|
||||
|
||||
/**
|
||||
* 应用机构
|
||||
*/
|
||||
private String appDepartment;
|
||||
|
||||
/***
|
||||
* 行业中心code
|
||||
*/
|
||||
private String bussinessCenter;
|
||||
|
||||
/**
|
||||
* 行业中心中文名
|
||||
*/
|
||||
|
||||
private String bussinessCenterName;
|
||||
|
||||
/**
|
||||
* 是否编辑标识
|
||||
*/
|
||||
|
||||
private int editState;
|
||||
|
||||
/***
|
||||
* 应用在运维系统账号
|
||||
*/
|
||||
private String ywAccount;
|
||||
|
||||
/***
|
||||
* 应用在运维系统用户id
|
||||
*/
|
||||
private String ywUserId;
|
||||
|
||||
/***
|
||||
* 应用在运维系统apikey
|
||||
*/
|
||||
private String ywApikey;
|
||||
|
||||
/***
|
||||
* 应用在运维系统appkey
|
||||
*/
|
||||
private String ywAppkey;
|
||||
|
||||
/**
|
||||
* 软件研发单位
|
||||
*/
|
||||
private String softwareOperations;
|
||||
|
||||
/**
|
||||
* 应用上线时间
|
||||
*/
|
||||
private String softwarePublishTime;
|
||||
|
||||
/**
|
||||
* 访问地址
|
||||
*/
|
||||
private String appAddress;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 是否为集群
|
||||
*/
|
||||
private String cluster;
|
||||
|
||||
/**
|
||||
* 应用编码
|
||||
*/
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 应用版本
|
||||
*/
|
||||
private String softwareVersion;
|
||||
|
||||
/**
|
||||
* 应用描述
|
||||
*/
|
||||
private String softwareDesc;
|
||||
|
||||
/**
|
||||
* 应用密级
|
||||
*/
|
||||
private String appSecrecyLevel;
|
||||
|
||||
/**
|
||||
* 应用
|
||||
*/
|
||||
private String appIcon;
|
||||
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String area;
|
||||
|
||||
/**
|
||||
* 是否可用
|
||||
*/
|
||||
private int useFlag;
|
||||
|
||||
/**
|
||||
* 专业
|
||||
*/
|
||||
private String profession;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUid;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新人Id
|
||||
*/
|
||||
private Long updateUid;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 发布区域
|
||||
*/
|
||||
private String publishArea;
|
||||
|
||||
/**
|
||||
* 参与人
|
||||
*/
|
||||
private String participantIds;
|
||||
|
||||
/**
|
||||
* 所属任务
|
||||
*/
|
||||
private String belongTask;
|
||||
|
||||
/***
|
||||
* 应用平台
|
||||
*/
|
||||
private String appPlatform;
|
||||
|
||||
/***
|
||||
* 应用方向
|
||||
*/
|
||||
private String appDirection;
|
||||
|
||||
/***
|
||||
* 应用专题
|
||||
*/
|
||||
private String appTheme;
|
||||
|
||||
/***
|
||||
* 对象类型
|
||||
*/
|
||||
|
||||
private String objectType;
|
||||
|
||||
/**
|
||||
* 数据id
|
||||
*/
|
||||
private String dataId;
|
||||
|
||||
/**
|
||||
* 应用管理员
|
||||
*/
|
||||
//private String appManager;
|
||||
|
||||
/**
|
||||
* 应用管理员
|
||||
*/
|
||||
private String approveLeader;
|
||||
|
||||
/**
|
||||
* 应用管理员的联系电话
|
||||
*/
|
||||
private String linkNum;
|
||||
|
||||
/**
|
||||
* 应用管理员
|
||||
*/
|
||||
private String approveManager;
|
||||
|
||||
/***
|
||||
* 应用上线表单id
|
||||
*/
|
||||
private String recordId;
|
||||
|
||||
/**
|
||||
* 应用状态
|
||||
*/
|
||||
private int appState;
|
||||
|
||||
/**
|
||||
* 资源需求
|
||||
*/
|
||||
private String resourceSetting;
|
||||
|
||||
/**
|
||||
* 软件承制单位
|
||||
*/
|
||||
private String assumeDept;
|
||||
|
||||
/**
|
||||
* 软件承制单位联系人
|
||||
*/
|
||||
private String assumeLinkman;
|
||||
|
||||
/**
|
||||
* 软件承制单位联系人
|
||||
*/
|
||||
private String linkmanNum;
|
||||
|
||||
|
||||
private String authorize;
|
||||
|
||||
private boolean enable = false;
|
||||
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
public String getAppInfo() {
|
||||
return appInfo;
|
||||
}
|
||||
|
||||
public void setAppInfo(String appInfo) {
|
||||
this.appInfo = appInfo;
|
||||
}
|
||||
|
||||
public String getSysPlace() {
|
||||
return sysPlace;
|
||||
}
|
||||
|
||||
public void setSysPlace(String sysPlace) {
|
||||
this.sysPlace = sysPlace;
|
||||
}
|
||||
|
||||
public String getAppType() {
|
||||
return appType;
|
||||
}
|
||||
|
||||
public void setAppType(String appType) {
|
||||
this.appType = appType;
|
||||
}
|
||||
|
||||
public String getAppLevel() {
|
||||
return appLevel;
|
||||
}
|
||||
|
||||
public void setAppLevel(String appLevel) {
|
||||
this.appLevel = appLevel;
|
||||
}
|
||||
|
||||
public String getModelSystem() {
|
||||
return modelSystem;
|
||||
}
|
||||
|
||||
public void setModelSystem(String modelSystem) {
|
||||
this.modelSystem = modelSystem;
|
||||
}
|
||||
|
||||
public String getResourceType() {
|
||||
return resourceType;
|
||||
}
|
||||
|
||||
public void setResourceType(String resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
public String getAppDepartment() {
|
||||
return appDepartment;
|
||||
}
|
||||
|
||||
public void setAppDepartment(String appDepartment) {
|
||||
this.appDepartment = appDepartment;
|
||||
}
|
||||
|
||||
public String getBussinessCenter() {
|
||||
return bussinessCenter;
|
||||
}
|
||||
|
||||
public void setBussinessCenter(String bussinessCenter) {
|
||||
this.bussinessCenter = bussinessCenter;
|
||||
}
|
||||
|
||||
public String getBussinessCenterName() {
|
||||
return bussinessCenterName;
|
||||
}
|
||||
|
||||
public void setBussinessCenterName(String bussinessCenterName) {
|
||||
this.bussinessCenterName = bussinessCenterName;
|
||||
}
|
||||
|
||||
public int getEditState() {
|
||||
return editState;
|
||||
}
|
||||
|
||||
public void setEditState(int editState) {
|
||||
this.editState = editState;
|
||||
}
|
||||
|
||||
public String getYwAccount() {
|
||||
return ywAccount;
|
||||
}
|
||||
|
||||
public void setYwAccount(String ywAccount) {
|
||||
this.ywAccount = ywAccount;
|
||||
}
|
||||
|
||||
public String getYwUserId() {
|
||||
return ywUserId;
|
||||
}
|
||||
|
||||
public void setYwUserId(String ywUserId) {
|
||||
this.ywUserId = ywUserId;
|
||||
}
|
||||
|
||||
public String getYwApikey() {
|
||||
return ywApikey;
|
||||
}
|
||||
|
||||
public void setYwApikey(String ywApikey) {
|
||||
this.ywApikey = ywApikey;
|
||||
}
|
||||
|
||||
public String getYwAppkey() {
|
||||
return ywAppkey;
|
||||
}
|
||||
|
||||
public void setYwAppkey(String ywAppkey) {
|
||||
this.ywAppkey = ywAppkey;
|
||||
}
|
||||
|
||||
public String getSoftwareOperations() {
|
||||
return softwareOperations;
|
||||
}
|
||||
|
||||
public void setSoftwareOperations(String softwareOperations) {
|
||||
this.softwareOperations = softwareOperations;
|
||||
}
|
||||
|
||||
public String getSoftwarePublishTime() {
|
||||
return softwarePublishTime;
|
||||
}
|
||||
|
||||
public void setSoftwarePublishTime(String softwarePublishTime) {
|
||||
this.softwarePublishTime = softwarePublishTime;
|
||||
}
|
||||
|
||||
public String getAppAddress() {
|
||||
return appAddress;
|
||||
}
|
||||
|
||||
public void setAppAddress(String appAddress) {
|
||||
this.appAddress = appAddress;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public void setCluster(String cluster) {
|
||||
this.cluster = cluster;
|
||||
}
|
||||
|
||||
public String getAppCode() {
|
||||
return appCode;
|
||||
}
|
||||
|
||||
public void setAppCode(String appCode) {
|
||||
this.appCode = appCode;
|
||||
}
|
||||
|
||||
public String getSoftwareVersion() {
|
||||
return softwareVersion;
|
||||
}
|
||||
|
||||
public void setSoftwareVersion(String softwareVersion) {
|
||||
this.softwareVersion = softwareVersion;
|
||||
}
|
||||
|
||||
public String getSoftwareDesc() {
|
||||
return softwareDesc;
|
||||
}
|
||||
|
||||
public void setSoftwareDesc(String softwareDesc) {
|
||||
this.softwareDesc = softwareDesc;
|
||||
}
|
||||
|
||||
public String getAppSecrecyLevel() {
|
||||
return appSecrecyLevel;
|
||||
}
|
||||
|
||||
public void setAppSecrecyLevel(String appSecrecyLevel) {
|
||||
this.appSecrecyLevel = appSecrecyLevel;
|
||||
}
|
||||
|
||||
public String getAppIcon() {
|
||||
return appIcon;
|
||||
}
|
||||
|
||||
public void setAppIcon(String appIcon) {
|
||||
this.appIcon = appIcon;
|
||||
}
|
||||
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(String area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public int getUseFlag() {
|
||||
return useFlag;
|
||||
}
|
||||
|
||||
public void setUseFlag(int useFlag) {
|
||||
this.useFlag = useFlag;
|
||||
}
|
||||
|
||||
public String getProfession() {
|
||||
return profession;
|
||||
}
|
||||
|
||||
public void setProfession(String profession) {
|
||||
this.profession = profession;
|
||||
}
|
||||
|
||||
public Long getCreateUid() {
|
||||
return createUid;
|
||||
}
|
||||
|
||||
public void setCreateUid(Long createUid) {
|
||||
this.createUid = createUid;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Long getUpdateUid() {
|
||||
return updateUid;
|
||||
}
|
||||
|
||||
public void setUpdateUid(Long updateUid) {
|
||||
this.updateUid = updateUid;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getPublishArea() {
|
||||
return publishArea;
|
||||
}
|
||||
|
||||
public void setPublishArea(String publishArea) {
|
||||
this.publishArea = publishArea;
|
||||
}
|
||||
|
||||
public String getParticipantIds() {
|
||||
return participantIds;
|
||||
}
|
||||
|
||||
public void setParticipantIds(String participantIds) {
|
||||
this.participantIds = participantIds;
|
||||
}
|
||||
|
||||
public String getBelongTask() {
|
||||
return belongTask;
|
||||
}
|
||||
|
||||
public void setBelongTask(String belongTask) {
|
||||
this.belongTask = belongTask;
|
||||
}
|
||||
|
||||
public String getAppPlatform() {
|
||||
return appPlatform;
|
||||
}
|
||||
|
||||
public void setAppPlatform(String appPlatform) {
|
||||
this.appPlatform = appPlatform;
|
||||
}
|
||||
|
||||
public String getAppDirection() {
|
||||
return appDirection;
|
||||
}
|
||||
|
||||
public void setAppDirection(String appDirection) {
|
||||
this.appDirection = appDirection;
|
||||
}
|
||||
|
||||
public String getAppTheme() {
|
||||
return appTheme;
|
||||
}
|
||||
|
||||
public void setAppTheme(String appTheme) {
|
||||
this.appTheme = appTheme;
|
||||
}
|
||||
|
||||
public String getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public void setObjectType(String objectType) {
|
||||
this.objectType = objectType;
|
||||
}
|
||||
|
||||
public String getDataId() {
|
||||
return dataId;
|
||||
}
|
||||
|
||||
public void setDataId(String dataId) {
|
||||
this.dataId = dataId;
|
||||
}
|
||||
|
||||
public String getApproveLeader() {
|
||||
return approveLeader;
|
||||
}
|
||||
|
||||
public void setApproveLeader(String approveLeader) {
|
||||
this.approveLeader = approveLeader;
|
||||
}
|
||||
|
||||
public String getLinkNum() {
|
||||
return linkNum;
|
||||
}
|
||||
|
||||
public void setLinkNum(String linkNum) {
|
||||
this.linkNum = linkNum;
|
||||
}
|
||||
|
||||
public String getApproveManager() {
|
||||
return approveManager;
|
||||
}
|
||||
|
||||
public void setApproveManager(String approveManager) {
|
||||
this.approveManager = approveManager;
|
||||
}
|
||||
|
||||
public String getRecordId() {
|
||||
return recordId;
|
||||
}
|
||||
|
||||
public void setRecordId(String recordId) {
|
||||
this.recordId = recordId;
|
||||
}
|
||||
|
||||
public int getAppState() {
|
||||
return appState;
|
||||
}
|
||||
|
||||
public void setAppState(int appState) {
|
||||
this.appState = appState;
|
||||
}
|
||||
|
||||
public String getResourceSetting() {
|
||||
return resourceSetting;
|
||||
}
|
||||
|
||||
public void setResourceSetting(String resourceSetting) {
|
||||
this.resourceSetting = resourceSetting;
|
||||
}
|
||||
|
||||
public String getAssumeDept() {
|
||||
return assumeDept;
|
||||
}
|
||||
|
||||
public void setAssumeDept(String assumeDept) {
|
||||
this.assumeDept = assumeDept;
|
||||
}
|
||||
|
||||
public String getAssumeLinkman() {
|
||||
return assumeLinkman;
|
||||
}
|
||||
|
||||
public void setAssumeLinkman(String assumeLinkman) {
|
||||
this.assumeLinkman = assumeLinkman;
|
||||
}
|
||||
|
||||
public String getLinkmanNum() {
|
||||
return linkmanNum;
|
||||
}
|
||||
|
||||
public void setLinkmanNum(String linkmanNum) {
|
||||
this.linkmanNum = linkmanNum;
|
||||
}
|
||||
|
||||
public String getAuthorize() {
|
||||
return authorize;
|
||||
}
|
||||
|
||||
public void setAuthorize(String authorize) {
|
||||
this.authorize = authorize;
|
||||
}
|
||||
|
||||
public boolean isEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public enum AppStateType{
|
||||
REGISTER(0,"注册"),
|
||||
ONLINE(1,"上线"),
|
||||
OFFLINE(2,"下线");
|
||||
//编号
|
||||
private Integer code;
|
||||
//名称
|
||||
private String name;
|
||||
|
||||
AppStateType(Integer code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bocloud.sms.enums;
|
||||
|
||||
public enum YkInf {
|
||||
//查询用户信息
|
||||
queryAllUser("/system/user/queryAllUser"),
|
||||
//获取应用列表
|
||||
getAppList("/system/sysapp/getAppList"),
|
||||
//获取运维工单接口
|
||||
getTaskList("/activiti/rwMainTask/getTaskList"),
|
||||
|
||||
getTaskByUser("/system/task/countTaskByUser");
|
||||
|
||||
private String url;
|
||||
|
||||
YkInf(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bocloud.sms.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppModule {
|
||||
private String name;
|
||||
private String id;
|
||||
private String pid;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.bocloud.sms.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppPerm {
|
||||
private String name;
|
||||
private String id;
|
||||
private String pid;
|
||||
private String pname;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bocloud.sms.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QxCategoryModel {
|
||||
private String id;
|
||||
private String pid;
|
||||
private String name;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.bocloud.sms.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QxReqVo {
|
||||
private String userToken;
|
||||
private String userId;
|
||||
private String appId;
|
||||
private String appName;
|
||||
private String pmsFlag;
|
||||
private String areaId;
|
||||
|
||||
public QxReqVo(String userToken, String userId, String appId, String appName, String pmsFlag, String areaId) {
|
||||
this.userToken = userToken;
|
||||
this.userId = userId;
|
||||
this.appId = appId;
|
||||
this.appName = appName;
|
||||
this.pmsFlag = pmsFlag;
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public QxReqVo() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.bocloud.sms.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TrxAuthModel {
|
||||
private String clientHello;
|
||||
private String serverHello;
|
||||
private String trxToken;
|
||||
private String clientIp;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.bocloud.sms.model;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class YkReqVo {
|
||||
private String reqUserId;
|
||||
private String systemId;
|
||||
private String method;
|
||||
private JSONObject params;
|
||||
|
||||
public YkReqVo(String reqUserId, String systemId, String method, JSONObject params) {
|
||||
this.reqUserId = reqUserId;
|
||||
this.systemId = systemId;
|
||||
this.method = method;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public YkReqVo() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.bocloud.sms.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class YkUserModel {
|
||||
private String loginName;
|
||||
private String userName;
|
||||
private String gender;
|
||||
private String mobile;
|
||||
private String ip;
|
||||
private String orgId;
|
||||
private String email;
|
||||
}
|
|
@ -134,6 +134,14 @@ public class UserRepository extends JdbcGenericDao<User, Long> {
|
|||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
|
||||
public User getByUserId(String userId) {
|
||||
String sql =
|
||||
"select u.*, t.account tenant_account,t.name tenant_name, t.discount discount from users u left join tenant t on u.tenant_id = t.id where u.is_deleted = 0 and u.user_id = :userId ";
|
||||
Map<String, Object> params = MapTools.simpleMap("user_id", userId);
|
||||
List<User> list = this.list(User.class, sql, params);
|
||||
// Assert.isTrue(list.size() <= 1, "该天融信用户已存在");
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
/**
|
||||
* 分页查询用户
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue