浪潮上架修改

master
liuqingkun 5 months ago
parent 0f08fa4ef4
commit c8d055d5d5
  1. 105
      ant-design-vue-jeecg/src/views/user/Login.vue
  2. 166
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/inspur/controller/InspurUserController.java
  3. 2
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/inspur/domain/InspurRegisterParams.java
  4. 4
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/inspur/domain/InspurResp.java
  5. 3
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/inspur/service/InspurService.java
  6. 90
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/inspur/service/impl/InspurServiceImpl.java
  7. 8
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/inspur/util/ConstantInspur.java

@ -1,14 +1,16 @@
<template> <template>
<div class="main"> <div class="main">
<a-form-model class="user-layout-login" @keyup.enter.native="handleSubmit"> <a-form-model class="user-layout-login" @keyup.enter.native="handleSubmit">
<a-tabs :activeKey="customActiveKey" :tabBarStyle="{ textAlign: 'center', borderBottom: 'unset' }" @change="handleTabClick"> <a-tabs :activeKey="customActiveKey" :tabBarStyle="{ textAlign: 'center', borderBottom: 'unset' }"
@change="handleTabClick">
<a-tab-pane key="tab1" tab="账号密码登录"> <a-tab-pane key="tab1" tab="账号密码登录">
<login-account ref="alogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-account> <login-account ref="alogin" @validateFail="validateFail" @success="requestSuccess"
@fail="requestFailed"></login-account>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="tab2" tab="手机号登录"> <!-- <a-tab-pane key="tab2" tab="手机号登录">-->
<login-phone ref="plogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-phone> <!-- <login-phone ref="plogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-phone>-->
</a-tab-pane> <!-- </a-tab-pane>-->
</a-tabs> </a-tabs>
<!--20221019 cfm del--> <!--20221019 cfm del-->
<!-- <a-form-model-item>--> <!-- <a-form-model-item>-->
@ -22,13 +24,15 @@
<!-- </a-form-model-item>--> <!-- </a-form-model-item>-->
<a-form-item> <a-form-item>
<a-button size="large" type="primary" htmlType="submit" class="login-button" :loading="loginBtn" @click.stop.prevent="handleSubmit" :disabled="loginBtn">确定 <a-button size="large" type="primary" htmlType="submit" class="login-button" :loading="loginBtn"
@click.stop.prevent="handleSubmit" :disabled="loginBtn">确定
</a-button> </a-button>
</a-form-item> </a-form-item>
</a-form-model> </a-form-model>
<two-step-captcha v-if="requiredTwoStepCaptcha" :visible="stepCaptchaVisible" @success="stepCaptchaSuccess" @cancel="stepCaptchaCancel"></two-step-captcha> <two-step-captcha v-if="requiredTwoStepCaptcha" :visible="stepCaptchaVisible" @success="stepCaptchaSuccess"
@cancel="stepCaptchaCancel"></two-step-captcha>
<login-select-tenant ref="loginSelect" @success="loginSelectOk"></login-select-tenant> <login-select-tenant ref="loginSelect" @success="loginSelectOk"></login-select-tenant>
<!--20221019 cfm del <third-login ref="thirdLogin"></third-login>--> <!--20221019 cfm del <third-login ref="thirdLogin"></third-login>-->
</div> </div>
@ -45,6 +49,7 @@ import { timeFix } from '@/utils/util'
import LoginAccount from './LoginAccount' import LoginAccount from './LoginAccount'
import LoginPhone from './LoginPhone' import LoginPhone from './LoginPhone'
import { getAction, postAction } from '@api/manage'
export default { export default {
components: { components: {
@ -62,15 +67,17 @@ export default {
requiredTwoStepCaptcha: false, requiredTwoStepCaptcha: false,
stepCaptchaVisible: false, stepCaptchaVisible: false,
encryptedString: { encryptedString: {
key:"", key: '',
iv:"", iv: ''
}, }
} }
}, },
created() { created() {
Vue.ls.remove(ACCESS_TOKEN) Vue.ls.remove(ACCESS_TOKEN)
this.getRouterData(); this.getRouterData()
this.rememberMe = true this.rememberMe = true
// URLcode
this.checkCodeAndLogin()
}, },
methods: { methods: {
handleTabClick(key) { handleTabClick(key) {
@ -79,6 +86,55 @@ export default {
handleRememberMeChange(e) { handleRememberMeChange(e) {
this.rememberMe = e.target.checked this.rememberMe = e.target.checked
}, },
getQueryParam(name) {
// URL?
const queryString = window.location.search.substring(1)
//
const paramPairs = queryString.split('&')
for (let i = 0; i < paramPairs.length; i++) {
const pair = paramPairs[i].split('=')
//
const paramName = decodeURIComponent(pair[0])
const paramValue = pair[1] ? decodeURIComponent(pair[1]) : ''
if (paramName === name) {
return paramValue
}
}
// null
return null
},
/**
* 检查URL中的code参数并尝试自动登录
*/
checkCodeAndLogin() {
// URLcode
const code = this.getQueryParam('code')
if (code) {
//
this.handleCodeLogin(code)
}
},
/**
* 使用code调用登录接口
*/
handleCodeLogin(code) {
this.autoLoginMsg = '检测到授权码,正在自动登录...'
this.loading = true
getAction(`/inspur/login?code=${code}`).then((res) => {
if (res.success) {
this.$emit('success', res.result)
this.loginSuccess()
}
}).catch(error => {
this.loading = false
this.errorMsg = error.message || '自动登录失败,请手动登录'
console.error('Auto login failed:', error)
})
},
/**跳转到登录页面的参数-账号获取*/ /**跳转到登录页面的参数-账号获取*/
getRouterData() { getRouterData() {
this.$nextTick(() => { this.$nextTick(() => {
@ -91,7 +147,7 @@ export default {
// //
handleSubmit() { handleSubmit() {
this.loginBtn = true; this.loginBtn = true
if (this.customActiveKey === 'tab1') { if (this.customActiveKey === 'tab1') {
// 使 // 使
this.$refs.alogin.handleLogin(this.rememberMe) this.$refs.alogin.handleLogin(this.rememberMe)
@ -102,7 +158,7 @@ export default {
}, },
// //
validateFail() { validateFail() {
this.loginBtn = false; this.loginBtn = false
}, },
// //
requestSuccess(loginResult) { requestSuccess(loginResult) {
@ -110,30 +166,30 @@ export default {
}, },
// //
requestFailed(err) { requestFailed(err) {
let description = ((err.response || {}).data || {}).message || err.message || "请求出现错误,请稍后再试" let description = ((err.response || {}).data || {}).message || err.message || '请求出现错误,请稍后再试'
this.$notification['error']({ this.$notification['error']({
message: '登录失败', message: '登录失败',
description: description, description: description,
duration: 4, duration: 4
}); })
// //
if (this.customActiveKey === 'tab1' && description.indexOf('密码错误') > 0) { if (this.customActiveKey === 'tab1' && description.indexOf('密码错误') > 0) {
this.$refs.alogin.handleChangeCheckCode() this.$refs.alogin.handleChangeCheckCode()
} }
this.loginBtn = false; this.loginBtn = false
}, },
loginSelectOk() { loginSelectOk() {
this.loginSuccess() this.loginSuccess()
}, },
// //
loginSuccess() { loginSuccess() {
this.$router.push({ path: "/dashboard/analysis" }).catch(()=>{ this.$router.push({ path: '/dashboard/analysis' }).catch(() => {
console.log('登录跳转首页出错,这个错误从哪里来的') console.log('登录跳转首页出错,这个错误从哪里来的')
}) })
this.$notification.success({ this.$notification.success({
message: '欢迎', message: '欢迎',
description: `${timeFix()},欢迎回来`, description: `${timeFix()},欢迎回来`
}); })
}, },
stepCaptchaSuccess() { stepCaptchaSuccess() {
@ -147,18 +203,16 @@ export default {
}, },
// //
getEncrypte() { getEncrypte() {
var encryptedString = Vue.ls.get(ENCRYPTED_STRING); var encryptedString = Vue.ls.get(ENCRYPTED_STRING)
if (encryptedString == null) { if (encryptedString == null) {
getEncryptedString().then((data) => { getEncryptedString().then((data) => {
this.encryptedString = data this.encryptedString = data
}); })
} else { } else {
this.encryptedString = encryptedString; this.encryptedString = encryptedString
} }
} }
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -166,6 +220,7 @@ export default {
label { label {
font-size: 14px; font-size: 14px;
} }
.getCaptcha { .getCaptcha {
display: block; display: block;
width: 100%; width: 100%;

@ -1,20 +1,36 @@
package org.jeecg.modules.inspur.controller; package org.jeecg.modules.inspur.controller;
import cn.hutool.json.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.inspur.domain.InspurRegisterParams; import org.jeecg.modules.inspur.domain.InspurRegisterParams;
import org.jeecg.modules.inspur.domain.InspurResp; import org.jeecg.modules.inspur.domain.InspurResp;
import org.jeecg.modules.inspur.entity.InspurUser;
import org.jeecg.modules.inspur.service.InspurService; import org.jeecg.modules.inspur.service.InspurService;
import org.jeecg.modules.inspur.util.ConstantInspur; import org.jeecg.modules.inspur.util.ConstantInspur;
import org.jeecg.modules.inspur.util.UniqueIdGenerator;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysTenant;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysDictService;
import org.jeecg.modules.system.service.ISysTenantService;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map; import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/** /**
* @author 84018 * @author 84018
@ -26,29 +42,141 @@ import java.util.Map;
public class InspurUserController { public class InspurUserController {
private final InspurService inspurService; private final InspurService inspurService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private ISysDepartService sysDepartService;
@Autowired
private ISysTenantService sysTenantService;
@Autowired
private ISysDictService sysDictService;
@RequestMapping("/register") @PostMapping("/register")
public ResponseEntity register(@RequestBody InspurRegisterParams registerParams) { public ResponseEntity register(@RequestBody InspurRegisterParams registerParams) {
String code = registerParams.getCode(); if (!ConstantInspur.APP_ID.equals(registerParams.getAppKey())) {
String token = null; InspurResp resp = InspurResp.builder()
String traceId = null; .code(ConstantInspur.SUCCESS_CODE_ERR)
if (code != null && !code.isEmpty()) { .msg("开通失败:AppId错误")
Map<String, Object> map = inspurService.appAuthCheck(code); .data(null)
token = (String) map.get("token"); .build();
traceId = (String) map.get("traceId"); new ResponseEntity(resp, HttpStatus.OK);
} }
InspurUser inspurUser = inspurService.getUserInfoByToken(token);
SysUser user = new SysUser(); if (!ConstantInspur.APP_SECRET.equals(registerParams.getAppSecret())) {
user.setUsername("admin"); InspurResp resp = InspurResp.builder()
user.setPassword("123456"); .code(ConstantInspur.SUCCESS_CODE_ERR)
.msg("开通失败:AppSecret错误")
.data(null)
.build();
new ResponseEntity(resp, HttpStatus.OK);
}
String traceId = UniqueIdGenerator.generate16DigitId();
JSONObject resultJson = inspurService.addAccount(registerParams);
InspurResp resp = InspurResp.builder() InspurResp resp = InspurResp.builder()
.code(ConstantInspur.SUCCESS_CODE_INT) .code(ConstantInspur.SUCCESS_CODE_INT)
.msg("成功") .msg("成功")
.data(user) .data(resultJson)
.traceId(traceId) .traceId(traceId)
.build(); .build();
return new ResponseEntity(resp, HttpStatus.OK); return new ResponseEntity(resp, HttpStatus.OK);
} }
@GetMapping("/login")
public Result<com.alibaba.fastjson.JSONObject> login(@RequestParam String code) {
Result<com.alibaba.fastjson.JSONObject> result = new Result<com.alibaba.fastjson.JSONObject>();
// String token = null;
// if (code != null && !code.isEmpty()) {
// Map<String, Object> map = inspurService.appAuthCheck(code);
// token = (String) map.get("token");
// }
// if (StringUtils.isEmpty(token)) {
// result.error500("登录失败,code无效");
// return result;
// }
//
// InspurUser inspurUser = inspurService.getUserInfoByToken(token);
// if (ObjectUtils.isEmpty(inspurUser)) {
// result.error500("登录失败,用户信息为空");
// return result;
// }
//
// LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(SysUser::getUsername, inspurUser.getLoginLoginname());
// SysUser sysUser = sysUserService.getOne(queryWrapper);
// result = sysUserService.checkUserIsEffective(sysUser);
// if (!result.isSuccess()) {
// return result;
// }
SysUser sysUser = sysUserService.getUserByName("admin");
//用户登录信息
userInfo(sysUser, result);
LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(sysUser, loginUser);
return result;
}
/**
* 用户信息
*
* @param sysUser
* @param result
* @return
*/
private Result<com.alibaba.fastjson.JSONObject> userInfo(SysUser sysUser, Result<com.alibaba.fastjson.JSONObject> result) {
String username = sysUser.getUsername();
String syspassword = sysUser.getPassword();
// 获取用户部门信息
com.alibaba.fastjson.JSONObject obj = new com.alibaba.fastjson.JSONObject(new LinkedHashMap<>());
// 生成token
String token = JwtUtil.sign(username, syspassword);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
obj.put("token", token);
String tenantIds = sysUser.getRelTenantIds();
if (oConvertUtils.isNotEmpty(tenantIds)) {
List<Integer> tenantIdList = new ArrayList<>();
for (String id : tenantIds.split(SymbolConstant.COMMA)) {
tenantIdList.add(Integer.valueOf(id));
}
List<SysTenant> tenantList = sysTenantService.queryEffectiveTenant(tenantIdList);
if (tenantList.size() == 0) {
result.error500("与该用户关联的租户均已被冻结,无法登录!");
return result;
} else {
obj.put("tenantList", tenantList);
}
}
// 20210802 for:获取用户租户信息
obj.put("userInfo", sysUser);
List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
obj.put("departs", departs);
if (departs == null || departs.size() == 0) {
obj.put("multi_depart", 0);
} else if (departs.size() == 1) {
sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
obj.put("multi_depart", 1);
} else {
SysUser sysUserById = sysUserService.getById(sysUser.getId());
if (oConvertUtils.isEmpty(sysUserById.getOrgCode())) {
sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
}
// 如果用戶为选择部门,数据库为存在上一次登录部门,则取一条存进去
obj.put("multi_depart", 2);
}
obj.put("sysAllDictItems", sysDictService.queryAllDictItems());
result.setResult(obj);
result.success("登录成功");
return result;
}
} }

@ -43,7 +43,7 @@ public class InspurRegisterParams {
/** /**
* 应用秘钥 * 应用秘钥
*/ */
private int appSecret; private String appSecret;
/** /**
* 随机码 由算网平台生成用于校验访问合法性 * 随机码 由算网平台生成用于校验访问合法性

@ -1,10 +1,10 @@
package org.jeecg.modules.inspur.domain; package org.jeecg.modules.inspur.domain;
import cn.hutool.json.JSONObject;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.jeecg.modules.system.entity.SysUser;
/** /**
* @author 84018 * @author 84018
@ -32,5 +32,5 @@ public class InspurResp {
/** /**
* 校验通过返回数据 * 校验通过返回数据
*/ */
private SysUser data; private JSONObject data;
} }

@ -1,6 +1,7 @@
package org.jeecg.modules.inspur.service; package org.jeecg.modules.inspur.service;
import cn.hutool.json.JSONObject;
import org.jeecg.modules.inspur.domain.InspurRegisterParams; import org.jeecg.modules.inspur.domain.InspurRegisterParams;
import org.jeecg.modules.inspur.entity.InspurUser; import org.jeecg.modules.inspur.entity.InspurUser;
@ -20,7 +21,7 @@ public interface InspurService {
* @param params 平台的账号信息 * @param params 平台的账号信息
* @return * @return
*/ */
String addAccount(InspurRegisterParams params); JSONObject addAccount(InspurRegisterParams params);
/** /**
* 获取平台token * 获取平台token

@ -1,16 +1,27 @@
package org.jeecg.modules.inspur.service.impl; package org.jeecg.modules.inspur.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.crypto.digest.Digester; import cn.hutool.crypto.digest.Digester;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.PasswordUtil;
import org.jeecg.modules.inspur.domain.InspurRegisterParams; import org.jeecg.modules.inspur.domain.InspurRegisterParams;
import org.jeecg.modules.inspur.entity.InspurTenant; import org.jeecg.modules.inspur.entity.InspurTenant;
import org.jeecg.modules.inspur.entity.InspurUser; import org.jeecg.modules.inspur.entity.InspurUser;
import org.jeecg.modules.inspur.service.InspurService; import org.jeecg.modules.inspur.service.InspurService;
import org.jeecg.modules.inspur.util.ConstantInspur; import org.jeecg.modules.inspur.util.ConstantInspur;
import org.jeecg.modules.inspur.util.UniqueIdGenerator; import org.jeecg.modules.inspur.util.UniqueIdGenerator;
import org.jeecg.modules.system.entity.SysTenant;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysUserRole;
import org.jeecg.modules.system.service.ISysTenantService;
import org.jeecg.modules.system.service.ISysUserRoleService;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
@ -23,13 +34,83 @@ import java.util.Map;
* @date 2025-05-30 14:40 * @date 2025-05-30 14:40
*/ */
@Slf4j @Slf4j
@RequiredArgsConstructor
@Service @Service
public class InspurServiceImpl implements InspurService { public class InspurServiceImpl implements InspurService {
final private ISysUserService sysUserService;
final private ISysTenantService sysTenantService;
final private ISysUserRoleService userRoleService;
@Override @Override
public String addAccount(InspurRegisterParams params) { public JSONObject addAccount(InspurRegisterParams params) {
System.out.println("添加用户接口。 请求参数:" + JSONUtil.toJsonStr(params)); JSONObject resultJson = new JSONObject();
// 先检查用户是否存在
SysUser userCheck = sysUserService.getOne(Wrappers.lambdaQuery(SysUser.class).eq(SysUser::getUsername, params.getPltAccountLogin()));
// 若用户已存在且未被冻结,则直接返回该用户
if (userCheck != null && !CommonConstant.USER_FREEZE.equals(userCheck.getStatus())) {
resultJson.put("account", userCheck.getUsername());
resultJson.put("token", userCheck.getPassword());
resultJson.put("tenantId", userCheck.getRelTenantIds());
resultJson.put("tenantInfo", params.getEnterpriseName());
return resultJson;
}
// 若用户不存在,则创建该用户
if (userCheck == null) {
SysTenant tenant = new SysTenant();
tenant.setName(params.getEnterpriseName());
tenant.setCreateBy("inspur");
tenant.setCreateTime(DateTime.now());
sysTenantService.save(tenant);
SysUser sysUser = new SysUser();
sysUser.setUsername(params.getPltAccountLogin());
String pwd = PasswordUtil.encrypt(params.getPltAccountLogin(), ConstantInspur.DEFAULT_PWD, sysUser.getSalt());
sysUser.setPassword(params.getPltAccountLogin());
sysUser.setCreateBy("inspur");
sysUser.setCreateTime(DateTime.now());
sysUser.setUpdateBy("inspur");
sysUser.setUpdateTime(DateTime.now());
sysUser.setPurchaseDuration(params.getPurchaseDuration());
sysUser.setPurchaseUnit(params.getPurchaseUnit());
sysUser.setRelTenantIds(tenant.getId().toString());
sysUser.setStatus(CommonConstant.USER_UNFREEZE);
sysUser.setDelFlag(CommonConstant.DEL_FLAG_0);
sysUserService.save(sysUser);
SysUserRole userRole = new SysUserRole();
userRole.setRoleId(ConstantInspur.ROLE_ID_ADMIN);
userRole.setUserId(sysUser.getId());
userRoleService.save(userRole);
resultJson.put("account", sysUser.getUsername());
resultJson.put("token", sysUser.getPassword());
resultJson.put("tenantId", sysUser.getRelTenantIds());
resultJson.put("tenantInfo", params.getEnterpriseName());
return resultJson;
}
// 若用户被冻结, 更新用户状态及有效期
if (userCheck != null && CommonConstant.USER_FREEZE.equals(userCheck.getStatus())) {
userCheck.setUpdateBy("inspur");
userCheck.setUpdateTime(DateTime.now());
userCheck.setPurchaseUnit(params.getPurchaseUnit());
userCheck.setStatus(CommonConstant.USER_UNFREEZE);
sysUserService.updateById(userCheck);
resultJson.put("account", userCheck.getUsername());
resultJson.put("token", userCheck.getPassword());
resultJson.put("tenantId", userCheck.getRelTenantIds());
resultJson.put("tenantInfo", params.getEnterpriseName());
return resultJson;
}
return null; return null;
} }
@ -47,16 +128,17 @@ public class InspurServiceImpl implements InspurService {
JSONObject resultJson = JSONUtil.parseObj(resultStr); JSONObject resultJson = JSONUtil.parseObj(resultStr);
Map<String, Object> resultMap = new HashMap<>();
if (ConstantInspur.SUCCESS_CODE.equals(resultJson.getStr("code"))) { if (ConstantInspur.SUCCESS_CODE.equals(resultJson.getStr("code"))) {
String resultData = resultJson.getStr("data"); String resultData = resultJson.getStr("data");
String resultTraceId = resultJson.getStr("traceId"); String resultTraceId = resultJson.getStr("traceId");
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("token", resultData); resultMap.put("token", resultData);
resultMap.put("traceId", resultTraceId); resultMap.put("traceId", resultTraceId);
return resultMap; return resultMap;
} else { } else {
throw new RuntimeException(resultJson.getStr("msg")); log.error("身份校验接口返回:" + resultJson.toStringPretty());
} }
return resultMap;
} }
@Override @Override

@ -15,9 +15,13 @@ public class ConstantInspur {
public static String API_URL_GET_USER_INFO = API_HOST + ":8083/cpn/api/extral/applicationCode/getUserInfoByToken"; public static String API_URL_GET_USER_INFO = API_HOST + ":8083/cpn/api/extral/applicationCode/getUserInfoByToken";
public static String API_URL_HEARTBEAT = API_HOST + ":8083/cpn/api/extra/v1/application/heartbeat"; public static String API_URL_HEARTBEAT = API_HOST + ":8083/cpn/api/extra/v1/application/heartbeat";
public static String APP_ID = "1124336947783794688"; public static String APP_ID = "1148589323117920256";
public static String APP_SECRET = "T0UoMjYwNTIwMjUxMTE0NDMxNTQdlI"; public static String APP_SECRET = "usUCMDEwODIwMjUwOTI1MDAwMjAFZ0";
public static String SUCCESS_CODE = "20000"; public static String SUCCESS_CODE = "20000";
public static Integer SUCCESS_CODE_INT = 20000; public static Integer SUCCESS_CODE_INT = 20000;
public static Integer SUCCESS_CODE_ERR = 50000;
public static String DEFAULT_PWD = "123456";
public static String ROLE_ID_ADMIN = "f6817f48af4fb3af11b9e8bf182f618b";
} }

Loading…
Cancel
Save