浪潮上架修改

master
liuqingkun 5 months ago
parent 0f08fa4ef4
commit c8d055d5d5
  1. 361
      ant-design-vue-jeecg/src/views/user/Login.vue
  2. 164
      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,36 +1,40 @@
<template>
<div class="main">
<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="账号密码登录">
<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 key="tab2" tab="手机号登录">
<login-phone ref="plogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-phone>
</a-tab-pane>
<!-- <a-tab-pane key="tab2" tab="手机号登录">-->
<!-- <login-phone ref="plogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-phone>-->
<!-- </a-tab-pane>-->
</a-tabs>
<!--20221019 cfm del-->
<!-- <a-form-model-item>-->
<!-- <a-checkbox @change="handleRememberMeChange" default-checked>自动登录</a-checkbox>-->
<!-- <router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">-->
<!-- 忘记密码-->
<!-- </router-link>-->
<!-- <router-link :to="{ name: 'register'}" class="forge-password" style="float: right;margin-right: 10px" >-->
<!-- 注册账户-->
<!-- </router-link>-->
<!-- </a-form-model-item>-->
<!--20221019 cfm del-->
<!-- <a-form-model-item>-->
<!-- <a-checkbox @change="handleRememberMeChange" default-checked>自动登录</a-checkbox>-->
<!-- <router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">-->
<!-- 忘记密码-->
<!-- </router-link>-->
<!-- <router-link :to="{ name: 'register'}" class="forge-password" style="float: right;margin-right: 10px" >-->
<!-- 注册账户-->
<!-- </router-link>-->
<!-- </a-form-model-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-form-item>
</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>
<!--20221019 cfm del <third-login ref="thirdLogin"></third-login>-->
<!--20221019 cfm del <third-login ref="thirdLogin"></third-login>-->
</div>
</template>
@ -45,170 +49,221 @@ import { timeFix } from '@/utils/util'
import LoginAccount from './LoginAccount'
import LoginPhone from './LoginPhone'
import { getAction, postAction } from '@api/manage'
export default {
components: {
LoginSelectTenant,
TwoStepCaptcha,
ThirdLogin,
LoginAccount,
LoginPhone
},
data () {
return {
customActiveKey: 'tab1',
rememberMe: true,
loginBtn: false,
requiredTwoStepCaptcha: false,
stepCaptchaVisible: false,
encryptedString:{
key:"",
iv:"",
},
components: {
LoginSelectTenant,
TwoStepCaptcha,
ThirdLogin,
LoginAccount,
LoginPhone
},
data() {
return {
customActiveKey: 'tab1',
rememberMe: true,
loginBtn: false,
requiredTwoStepCaptcha: false,
stepCaptchaVisible: false,
encryptedString: {
key: '',
iv: ''
}
}
},
created() {
Vue.ls.remove(ACCESS_TOKEN)
this.getRouterData()
this.rememberMe = true
// URLcode
this.checkCodeAndLogin()
},
methods: {
handleTabClick(key) {
this.customActiveKey = key
},
created() {
Vue.ls.remove(ACCESS_TOKEN)
this.getRouterData();
this.rememberMe = true
handleRememberMeChange(e) {
this.rememberMe = e.target.checked
},
methods:{
handleTabClick(key){
this.customActiveKey = key
},
handleRememberMeChange(e){
this.rememberMe = e.target.checked
},
/**跳转到登录页面的参数-账号获取*/
getRouterData(){
this.$nextTick(() => {
let temp = this.$route.params.username || this.$route.query.username || ''
if (temp) {
this.$refs.alogin.acceptUsername(temp)
}
})
},
//
handleSubmit () {
this.loginBtn = true;
if (this.customActiveKey === 'tab1') {
// 使
this.$refs.alogin.handleLogin(this.rememberMe)
} else {
//
this.$refs.plogin.handleLogin(this.rememberMe)
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
}
},
//
validateFail(){
this.loginBtn = false;
},
//
requestSuccess(loginResult){
this.$refs.loginSelect.show(loginResult)
},
//
requestFailed (err) {
let description = ((err.response || {}).data || {}).message || err.message || "请求出现错误,请稍后再试"
this.$notification[ 'error' ]({
message: '登录失败',
description: description,
duration: 4,
});
//
if(this.customActiveKey === 'tab1' && description.indexOf('密码错误')>0){
this.$refs.alogin.handleChangeCheckCode()
}
// 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()
}
this.loginBtn = false;
},
loginSelectOk(){
this.loginSuccess()
},
//
loginSuccess () {
this.$router.push({ path: "/dashboard/analysis" }).catch(()=>{
console.log('登录跳转首页出错,这个错误从哪里来的')
})
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`,
});
},
stepCaptchaSuccess () {
this.loginSuccess()
},
stepCaptchaCancel () {
this.Logout().then(() => {
this.loginBtn = false
this.stepCaptchaVisible = false
})
},
//
getEncrypte(){
var encryptedString = Vue.ls.get(ENCRYPTED_STRING);
if(encryptedString == null){
getEncryptedString().then((data) => {
this.encryptedString = data
});
}else{
this.encryptedString = encryptedString;
}).catch(error => {
this.loading = false
this.errorMsg = error.message || '自动登录失败,请手动登录'
console.error('Auto login failed:', error)
})
},
/**跳转到登录页面的参数-账号获取*/
getRouterData() {
this.$nextTick(() => {
let temp = this.$route.params.username || this.$route.query.username || ''
if (temp) {
this.$refs.alogin.acceptUsername(temp)
}
})
},
//
handleSubmit() {
this.loginBtn = true
if (this.customActiveKey === 'tab1') {
// 使
this.$refs.alogin.handleLogin(this.rememberMe)
} else {
//
this.$refs.plogin.handleLogin(this.rememberMe)
}
},
//
validateFail() {
this.loginBtn = false
},
//
requestSuccess(loginResult) {
this.$refs.loginSelect.show(loginResult)
},
//
requestFailed(err) {
let description = ((err.response || {}).data || {}).message || err.message || '请求出现错误,请稍后再试'
this.$notification['error']({
message: '登录失败',
description: description,
duration: 4
})
//
if (this.customActiveKey === 'tab1' && description.indexOf('密码错误') > 0) {
this.$refs.alogin.handleChangeCheckCode()
}
this.loginBtn = false
},
loginSelectOk() {
this.loginSuccess()
},
//
loginSuccess() {
this.$router.push({ path: '/dashboard/analysis' }).catch(() => {
console.log('登录跳转首页出错,这个错误从哪里来的')
})
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`
})
},
stepCaptchaSuccess() {
this.loginSuccess()
},
stepCaptchaCancel() {
this.Logout().then(() => {
this.loginBtn = false
this.stepCaptchaVisible = false
})
},
//
getEncrypte() {
var encryptedString = Vue.ls.get(ENCRYPTED_STRING)
if (encryptedString == null) {
getEncryptedString().then((data) => {
this.encryptedString = data
})
} else {
this.encryptedString = encryptedString
}
}
}
}
</script>
<style lang="less" scoped>
.user-layout-login {
label {
font-size: 14px;
}
.user-layout-login {
label {
font-size: 14px;
}
.getCaptcha {
display: block;
width: 100%;
height: 40px;
}
display: block;
width: 100%;
height: 40px;
}
.forge-password {
font-size: 14px;
}
font-size: 14px;
}
button.login-button {
padding: 0 15px;
font-size: 16px;
height: 40px;
width: 100%;
}
button.login-button {
padding: 0 15px;
font-size: 16px;
height: 40px;
width: 100%;
}
.user-login-other {
text-align: left;
margin-top: 24px;
line-height: 22px;
text-align: left;
margin-top: 24px;
line-height: 22px;
.item-icon {
font-size: 24px;
color: rgba(0,0,0,.2);
margin-left: 16px;
vertical-align: middle;
cursor: pointer;
transition: color .3s;
font-size: 24px;
color: rgba(0, 0, 0, .2);
margin-left: 16px;
vertical-align: middle;
cursor: pointer;
transition: color .3s;
&:hover {
color: #1890ff;
}
color: #1890ff;
}
}
.register {
float: right;
}
float: right;
}
}
}
</style>
<style>
.valid-error .ant-select-selection__placeholder{
color: #f5222d;
}
.valid-error .ant-select-selection__placeholder {
color: #f5222d;
}
</style>

@ -1,20 +1,36 @@
package org.jeecg.modules.inspur.controller;
import cn.hutool.json.JSONObject;
import lombok.RequiredArgsConstructor;
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.InspurResp;
import org.jeecg.modules.inspur.entity.InspurUser;
import org.jeecg.modules.inspur.service.InspurService;
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.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.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/**
* @author 84018
@ -26,29 +42,141 @@ import java.util.Map;
public class InspurUserController {
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) {
String code = registerParams.getCode();
String token = null;
String traceId = null;
if (code != null && !code.isEmpty()) {
Map<String, Object> map = inspurService.appAuthCheck(code);
token = (String) map.get("token");
traceId = (String) map.get("traceId");
if (!ConstantInspur.APP_ID.equals(registerParams.getAppKey())) {
InspurResp resp = InspurResp.builder()
.code(ConstantInspur.SUCCESS_CODE_ERR)
.msg("开通失败:AppId错误")
.data(null)
.build();
new ResponseEntity(resp, HttpStatus.OK);
}
InspurUser inspurUser = inspurService.getUserInfoByToken(token);
SysUser user = new SysUser();
user.setUsername("admin");
user.setPassword("123456");
if (!ConstantInspur.APP_SECRET.equals(registerParams.getAppSecret())) {
InspurResp resp = InspurResp.builder()
.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()
.code(ConstantInspur.SUCCESS_CODE_INT)
.msg("成功")
.data(user)
.data(resultJson)
.traceId(traceId)
.build();
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;
import cn.hutool.json.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jeecg.modules.system.entity.SysUser;
/**
* @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;
import cn.hutool.json.JSONObject;
import org.jeecg.modules.inspur.domain.InspurRegisterParams;
import org.jeecg.modules.inspur.entity.InspurUser;
@ -20,7 +21,7 @@ public interface InspurService {
* @param params 平台的账号信息
* @return
*/
String addAccount(InspurRegisterParams params);
JSONObject addAccount(InspurRegisterParams params);
/**
* 获取平台token

@ -1,16 +1,27 @@
package org.jeecg.modules.inspur.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.crypto.digest.Digester;
import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
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.entity.InspurTenant;
import org.jeecg.modules.inspur.entity.InspurUser;
import org.jeecg.modules.inspur.service.InspurService;
import org.jeecg.modules.inspur.util.ConstantInspur;
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 java.util.HashMap;
@ -23,13 +34,83 @@ import java.util.Map;
* @date 2025-05-30 14:40
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class InspurServiceImpl implements InspurService {
final private ISysUserService sysUserService;
final private ISysTenantService sysTenantService;
final private ISysUserRoleService userRoleService;
@Override
public String addAccount(InspurRegisterParams params) {
System.out.println("添加用户接口。 请求参数:" + JSONUtil.toJsonStr(params));
public JSONObject addAccount(InspurRegisterParams 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;
}
@ -47,16 +128,17 @@ public class InspurServiceImpl implements InspurService {
JSONObject resultJson = JSONUtil.parseObj(resultStr);
Map<String, Object> resultMap = new HashMap<>();
if (ConstantInspur.SUCCESS_CODE.equals(resultJson.getStr("code"))) {
String resultData = resultJson.getStr("data");
String resultTraceId = resultJson.getStr("traceId");
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("token", resultData);
resultMap.put("traceId", resultTraceId);
return resultMap;
} else {
throw new RuntimeException(resultJson.getStr("msg"));
log.error("身份校验接口返回:" + resultJson.toStringPretty());
}
return resultMap;
}
@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_HEARTBEAT = API_HOST + ":8083/cpn/api/extra/v1/application/heartbeat";
public static String APP_ID = "1124336947783794688";
public static String APP_SECRET = "T0UoMjYwNTIwMjUxMTE0NDMxNTQdlI";
public static String APP_ID = "1148589323117920256";
public static String APP_SECRET = "usUCMDEwODIwMjUwOTI1MDAwMjAFZ0";
public static String SUCCESS_CODE = "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