Merge remote-tracking branch 'origin/develop' into develop
						commit
						5c720b68b7
					
				| 
						 | 
					@ -80,16 +80,20 @@ public class ManagerServiceImpl implements ManagerService {
 | 
				
			||||||
        User user = userRepository.query(context.getTarget());
 | 
					        User user = userRepository.query(context.getTarget());
 | 
				
			||||||
        List<Long> qxAppModuleIds = new ArrayList<>();
 | 
					        List<Long> qxAppModuleIds = new ArrayList<>();
 | 
				
			||||||
        if (null != user.getUserId()) {
 | 
					        if (null != user.getUserId()) {
 | 
				
			||||||
            // 天融信用户获取权限系统菜单权限
 | 
					            try {
 | 
				
			||||||
            log.info("开始获取天融信登录用户所拥有权限系统列表");
 | 
					                // 天融信用户获取权限系统菜单权限
 | 
				
			||||||
            List<AppModule> appModules = trxServiceImpl.queryQxCategoryList(trxToken, user.getUserId());
 | 
					                log.info("开始获取天融信登录用户所拥有权限系统列表");
 | 
				
			||||||
            if (CollectionUtils.isEmpty(appModules)) {
 | 
					                List<AppModule> appModules = trxServiceImpl.queryQxCategoryList(trxToken, user.getUserId());
 | 
				
			||||||
                log.error("获取天融信登录用户所拥有权限系统列表失败");
 | 
					                if (CollectionUtils.isEmpty(appModules)) {
 | 
				
			||||||
                return new GeneralResult<>(false, "获取权限系统菜单信息失败");
 | 
					                    log.error("获取天融信登录用户所拥有权限系统列表失败");
 | 
				
			||||||
            }
 | 
					                    return new GeneralResult<>(false, "获取权限系统菜单信息失败");
 | 
				
			||||||
            for (AppModule appModule : appModules) {
 | 
					                }
 | 
				
			||||||
                long id = Long.parseLong(appModule.getId());
 | 
					                for (AppModule appModule : appModules) {
 | 
				
			||||||
                qxAppModuleIds.add(id);
 | 
					                    long id = Long.parseLong(appModule.getId());
 | 
				
			||||||
 | 
					                    qxAppModuleIds.add(id);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            } catch (Exception e) {
 | 
				
			||||||
 | 
					                log.error("获取天融信登录用户所拥有权限系统列表失败:", e);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,56 +58,19 @@ public class TrxServiceImpl implements TrxService {
 | 
				
			||||||
        paramsMap.put("isToken", false);
 | 
					        paramsMap.put("isToken", false);
 | 
				
			||||||
        paramsMap.put("ngx_cookie", ngxCookie);
 | 
					        paramsMap.put("ngx_cookie", ngxCookie);
 | 
				
			||||||
        JSONObject result = new JSONObject();
 | 
					        JSONObject result = new JSONObject();
 | 
				
			||||||
//        try {
 | 
					        try {
 | 
				
			||||||
//            log.info("调用天融信获取随机字符串接口, url:" + url + ", 参数:" + JSONObject.toJSONString(paramsMap));
 | 
					            log.info("调用天融信获取随机字符串接口, url:" + url + ", 参数:" + JSONObject.toJSONString(paramsMap));
 | 
				
			||||||
//            result = JSONObject.parseObject(HttpUtil.get(url, paramsMap, 10000));
 | 
					            result = JSONObject.parseObject(HttpUtil.get(url, paramsMap, 10000));
 | 
				
			||||||
//            if ("-1".equals(result.getString("result"))) {
 | 
					            if ("-1".equals(result.getString("result"))) {
 | 
				
			||||||
//                return new GeneralResult(false, "获取随机数失败" + result.getString("errmsg"));
 | 
					                return new GeneralResult(false, "获取随机数失败" + result.getString("errmsg"));
 | 
				
			||||||
//            }
 | 
					            }
 | 
				
			||||||
//        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
//            log.error("调用天融信获取随机字符串失败", e);
 | 
					            log.error("调用天融信获取随机字符串失败", e);
 | 
				
			||||||
//            return new GeneralResult(false, "获取随机数失败" + e.getMessage());
 | 
					            return new GeneralResult(false, "获取随机数失败" + e.getMessage());
 | 
				
			||||||
//        }
 | 
					        }
 | 
				
			||||||
//        return new GeneralResult(true, result.getString("result"), "获取随机数成功");
 | 
					        return new GeneralResult(true, result.getString("result"), "获取随机数成功");
 | 
				
			||||||
        return new GeneralResult(true, "randomstr", "获取随机数成功");
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 获取天融信用户信息
 | 
					 | 
				
			||||||
//    @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;
 | 
					 | 
				
			||||||
//        GeneralResult<Map<String, Object>> login;
 | 
					 | 
				
			||||||
//        try {
 | 
					 | 
				
			||||||
//            log.info("调用天融信登录接口, url:" + url + ", 参数:" + JSONObject.toJSONString(paramsMap));
 | 
					 | 
				
			||||||
//            result = JSONObject.parseObject(HttpUtil.post(url, paramsMap, 10000));
 | 
					 | 
				
			||||||
//            if (!"0".equals(result.getString("result"))) {
 | 
					 | 
				
			||||||
//                return new GeneralResult(false, "用户登录天融信失败" + result.getString("errmsg"));
 | 
					 | 
				
			||||||
//            }
 | 
					 | 
				
			||||||
//            String trxToken = result.getString("token");
 | 
					 | 
				
			||||||
//            String userId = result.getString("userId");
 | 
					 | 
				
			||||||
//            // 处理ukey登录用户
 | 
					 | 
				
			||||||
//            log.info("开始uKey登录用户入库");
 | 
					 | 
				
			||||||
//            saveUserByTrx(userId);
 | 
					 | 
				
			||||||
//            log.info("uKey登录用户入库结束");
 | 
					 | 
				
			||||||
//            // 登录
 | 
					 | 
				
			||||||
//            log.info("开始uKey登录用户登录云管平台");
 | 
					 | 
				
			||||||
//            User user = userRepository.getByUserId(userId);
 | 
					 | 
				
			||||||
//            Encryptor encryptor = new AESEncryptor();
 | 
					 | 
				
			||||||
//            String password = encryptor.encrypt(userId + "CMP", null);
 | 
					 | 
				
			||||||
//            login = userServiceImpl.login(user.getAccount(), password, null, null, true);
 | 
					 | 
				
			||||||
//            login.getData().put("trxToken", trxToken);
 | 
					 | 
				
			||||||
//            log.info("uKey登录用户登录云管平台结束");
 | 
					 | 
				
			||||||
//        } catch (Exception e) {
 | 
					 | 
				
			||||||
//            log.error("用户登录失败:", e);
 | 
					 | 
				
			||||||
//            return new GeneralResult(false, "用户登录失败" + e.getMessage());
 | 
					 | 
				
			||||||
//        }
 | 
					 | 
				
			||||||
//        return new GeneralResult(true, login, "用户登录成功");
 | 
					 | 
				
			||||||
//    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public GeneralResult getAuthToken(TrxAuthModel trxAuthModel) {
 | 
					    public GeneralResult getAuthToken(TrxAuthModel trxAuthModel) {
 | 
				
			||||||
| 
						 | 
					@ -120,10 +83,7 @@ public class TrxServiceImpl implements TrxService {
 | 
				
			||||||
        GeneralResult<Map<String, Object>> login = new GeneralResult<>();
 | 
					        GeneralResult<Map<String, Object>> login = new GeneralResult<>();
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            log.info("调用天融信登录接口, url:" + url + ", 参数:" + JSONObject.toJSONString(paramsMap));
 | 
					            log.info("调用天融信登录接口, url:" + url + ", 参数:" + JSONObject.toJSONString(paramsMap));
 | 
				
			||||||
//            result = JSONObject.parseObject(HttpUtil.post(url, paramsMap, 10000));
 | 
					            result = JSONObject.parseObject(HttpUtil.post(url, paramsMap, 10000));
 | 
				
			||||||
            result.put("result", 0);
 | 
					 | 
				
			||||||
            result.put("token", "trxTokenStr");
 | 
					 | 
				
			||||||
            result.put("userId", "100001");
 | 
					 | 
				
			||||||
            if (!"0".equals(result.getString("result"))) {
 | 
					            if (!"0".equals(result.getString("result"))) {
 | 
				
			||||||
                return new GeneralResult(false, "用户登录天融信失败" + result.getString("errmsg"));
 | 
					                return new GeneralResult(false, "用户登录天融信失败" + result.getString("errmsg"));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -155,12 +115,7 @@ public class TrxServiceImpl implements TrxService {
 | 
				
			||||||
        JSONObject params = new JSONObject();
 | 
					        JSONObject params = new JSONObject();
 | 
				
			||||||
        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);
 | 
				
			||||||
        YkUserModel ykUser = new YkUserModel();
 | 
					 | 
				
			||||||
        ykUser.setLoginName("trx01");
 | 
					 | 
				
			||||||
        ykUser.setUserName("trx01");
 | 
					 | 
				
			||||||
        ykUser.setMobile("15238853513");
 | 
					 | 
				
			||||||
        ykUser.setEmail("188834343@qq.com");
 | 
					 | 
				
			||||||
        if (ObjectUtils.isEmpty(user)) {
 | 
					        if (ObjectUtils.isEmpty(user)) {
 | 
				
			||||||
            log.info("开始新增天融信登录用户,userId: " + userId);
 | 
					            log.info("开始新增天融信登录用户,userId: " + userId);
 | 
				
			||||||
            // 新增  以userId作为account 并添加注释
 | 
					            // 新增  以userId作为account 并添加注释
 | 
				
			||||||
| 
						 | 
					@ -211,69 +166,17 @@ public class TrxServiceImpl implements TrxService {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//    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是否有效
 | 
					    //确认天融信token是否有效
 | 
				
			||||||
    public GeneralResult getTokenOnline(String trxToken) {
 | 
					    public GeneralResult getTokenOnline(String trxToken) {
 | 
				
			||||||
        String url = trxUrl + "/tokenOnline";
 | 
					        try {
 | 
				
			||||||
        JSONObject result = JSONObject.parseObject(HttpUtil.post(url, trxToken));
 | 
					            String url = trxUrl + "/tokenOnline";
 | 
				
			||||||
        if (!"0".equals(result.getString("result"))) {
 | 
					            JSONObject result = JSONObject.parseObject(HttpUtil.post(url, trxToken, 10000));
 | 
				
			||||||
            return new GeneralResult(false, "当前token无效" + result.getString("errmsg"));
 | 
					            if (!"0".equals(result.getString("result"))) {
 | 
				
			||||||
 | 
					                return new GeneralResult(false, "当前token无效" + result.getString("errmsg"));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 | 
					            log.error("获取天融信token状态失败:", e);
 | 
				
			||||||
 | 
					            return new GeneralResult(false, "获取天融信token状态失败" + e.getMessage());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return new GeneralResult(true, "当前token有效");
 | 
					        return new GeneralResult(true, "当前token有效");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,7 @@ package com.bocloud.sms.service.utils;
 | 
				
			||||||
import cn.hutool.http.HttpUtil;
 | 
					import cn.hutool.http.HttpUtil;
 | 
				
			||||||
import com.alibaba.fastjson.JSONObject;
 | 
					import com.alibaba.fastjson.JSONObject;
 | 
				
			||||||
import com.bocloud.sms.model.QxReqVo;
 | 
					import com.bocloud.sms.model.QxReqVo;
 | 
				
			||||||
 | 
					import com.megatron.common.model.GeneralResult;
 | 
				
			||||||
import org.slf4j.Logger;
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
import org.slf4j.LoggerFactory;
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Value;
 | 
					import org.springframework.beans.factory.annotation.Value;
 | 
				
			||||||
| 
						 | 
					@ -27,13 +28,17 @@ public class QxUtils {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public String call(String url, QxReqVo qxReqVo){
 | 
					    public String call(String url, QxReqVo qxReqVo){
 | 
				
			||||||
        String str = JSONObject.toJSONString(qxReqVo);
 | 
					        try {
 | 
				
			||||||
        logger.info("call method[{}] req params[{}]",url,str);
 | 
					            String str = JSONObject.toJSONString(qxReqVo);
 | 
				
			||||||
        JSONObject result = JSONObject.parseObject(HttpUtil.post(url,str));
 | 
					            logger.info("call method[{}] req params[{}]",url,str);
 | 
				
			||||||
        if (!"200".equals(result.getString("status"))) {
 | 
					            JSONObject result = JSONObject.parseObject(HttpUtil.post(url,str, 10000));
 | 
				
			||||||
            throw new IllegalArgumentException("调用权限系统接口异常" + result.getString("msg"));
 | 
					            if (!"200".equals(result.getString("status"))) {
 | 
				
			||||||
 | 
					                throw new IllegalArgumentException("调用权限系统接口异常" + result.getString("msg"));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return result.getString("data");
 | 
				
			||||||
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 | 
					            logger.error("获取天融信token状态失败:", e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        return null;
 | 
				
			||||||
        return result.getString("data");
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ public class YkUtils {
 | 
				
			||||||
        String str = JSONObject.toJSONString(reqVo);
 | 
					        String str = JSONObject.toJSONString(reqVo);
 | 
				
			||||||
        logger.info("call yk url [{}]" , url);
 | 
					        logger.info("call yk url [{}]" , url);
 | 
				
			||||||
        logger.info("call yk method[{}] req params[{}]",reqVo.getMethod(),str);
 | 
					        logger.info("call yk method[{}] req params[{}]",reqVo.getMethod(),str);
 | 
				
			||||||
        String resultStr = HttpUtil.post(url, str);
 | 
					        String resultStr = HttpUtil.post(url, str, 10000);
 | 
				
			||||||
        //logger.info("call method[{}] resp params[{}]",reqVo.getMethod(),resultStr);
 | 
					        //logger.info("call method[{}] resp params[{}]",reqVo.getMethod(),resultStr);
 | 
				
			||||||
        JSONObject result = JSONObject.parseObject(resultStr);
 | 
					        JSONObject result = JSONObject.parseObject(resultStr);
 | 
				
			||||||
        logger.info("call yk result [{}]" , result.toString());
 | 
					        logger.info("call yk result [{}]" , result.toString());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue