Commit 334e2545 authored by 赵啸非's avatar 赵啸非

修改设备管理 外部登录

parent bd28ffb1
...@@ -24,15 +24,14 @@ const instance = axios.create({ ...@@ -24,15 +24,14 @@ const instance = axios.create({
instance.interceptors.request.use(config => { instance.interceptors.request.use(config => {
//config.data = Qs.stringify(config.data, {arrayFormat: 'repeat', allowDots: true}); //config.data = Qs.stringify(config.data, {arrayFormat: 'repeat', allowDots: true});
config.data = Qs.stringify(config.data, {arrayFormat: 'indices', allowDots: true}); config.data = Qs.stringify(config.data, {arrayFormat: 'indices', allowDots: true});
//brackets //brackets
// 也可以在这里给请求添加token之类的字段 // 也可以在这里给请求添加token之类的字段
// config.headers['Content-Type'] = 'application/json;charset=UTF-8' //config.headers['Content-Type'] = 'application/json;charset=UTF-8'
// config.headers.timestamp = Math.floor(new Date().getTime() / 1000) // config.headers.timestamp = Math.floor(new Date().getTime() / 1000)
// config.headers.token = sessionStorage.getItem('token') || '' //this.$store.state.userData.token sessionStorage.getItem('token')
config.headers.Authorization = sessionStorage.getItem('token')|| ''
//console.log("request config",config); //console.log("request config",config);
......
...@@ -8,10 +8,22 @@ ...@@ -8,10 +8,22 @@
export default { export default {
name: 'authentication', name: 'authentication',
created () { created () {
sessionStorage.setItem("token",this.getUrlKey("token"));
// console.log("location url "+location.href)
console.log("token:"+this.getUrlKey("token"))
var url=window.location.href; //获取当前页面的url
if(url.indexOf("?")!=-1){ //判断是否存在参数
url = url.replace(/(\?|#)[^'"]*/, ''); //去除参数
window.history.pushState({},0,url);
}
this.login(); this.login();
}, },
methods: { methods: {
login() { login() {
// console.log(this.redirect)
// this.$router.replace({
// path: this.redirect,
// });
this.$post('/login/index').then(this.loginSuccess).catch(this.loginFail) this.$post('/login/index').then(this.loginSuccess).catch(this.loginFail)
}, },
loginSuccess({data}) { loginSuccess({data}) {
...@@ -28,7 +40,13 @@ export default { ...@@ -28,7 +40,13 @@ export default {
redirect: this.redirect, redirect: this.redirect,
} }
}); });
} },
getUrlKey (name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
}
}, },
computed: { computed: {
isLogin() { isLogin() {
......
...@@ -45,11 +45,13 @@ this.refreshCode() ...@@ -45,11 +45,13 @@ this.refreshCode()
this.$post('/login/login', this.form).then(this.loginSuccess).catch(this.loginFail) this.$post('/login/login', this.form).then(this.loginSuccess).catch(this.loginFail)
}, },
loginSuccess({data}) { loginSuccess({data}) {
this.$store.commit('setUserData', data); this.$store.commit('setUserData', data);
this.$router.replace({ this.$router.replace({
path: this.redirect, path: this.redirect,
}); });
sessionStorage.setItem("token",data.token);
//成功 创建websocket连接 process.env.VUE_WEBSOCKET_BASE_API + //成功 创建websocket连接 process.env.VUE_WEBSOCKET_BASE_API +
console.log("process",process.env) console.log("process",process.env)
createSocket("ws://"+process.env.VUE_APP_BASE_API +"/ws?accessToken="+data.id) createSocket("ws://"+process.env.VUE_APP_BASE_API +"/ws?accessToken="+data.id)
......
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
<version>3.9.1</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId> <artifactId>spring-data-redis</artifactId>
......
...@@ -16,7 +16,6 @@ import org.springframework.context.annotation.ImportResource; ...@@ -16,7 +16,6 @@ import org.springframework.context.annotation.ImportResource;
@ImportResource(locations = {"classpath:config/spring-config.xml"}) @ImportResource(locations = {"classpath:config/spring-config.xml"})
public class ManagerApplication extends BaseWebApplication { public class ManagerApplication extends BaseWebApplication {
@Bean @Bean
public ICacheService cacheService() { public ICacheService cacheService() {
return new LocalCacheServiceImpl(); return new LocalCacheServiceImpl();
......
package com.mortals.xhx.base.framework.config;
import com.mortals.framework.springcloud.config.web.BaseWebMvcConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author: zxfei
* @date: 2021/8/13 0:24
* @description:
**/
@Configuration
public class AccountConfig {
@Bean
public BaseWebMvcConfigurer getBaseWebMvc(){
return new BaseWebMvcConfigurer(false,null);
}
}
package com.mortals.xhx.base.framework.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author: zxfei
* @date: 2022/2/15 13:16
* @description:
**/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowCredentials(true)
.allowedOrigins("*")
.allowedMethods(new String[] { "GET", "POST","PUT","DELETE"})
.allowedHeaders("*")
.exposedHeaders("*");
}
}
package com.mortals.xhx.base.framework.config;
import com.mortals.framework.util.DateUtils;
import com.p6spy.engine.spy.appender.MessageFormattingStrategy;
import lombok.extern.apachecommons.CommonsLog;
import org.apache.commons.lang3.StringUtils;
/**
* 自定义 p6spy sql输出格式
*
* @author: zxfei
* @date: 2022/4/19 9:01
*/
@CommonsLog
public class P6spySqlFormatConfig implements MessageFormattingStrategy {
@Override
public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String url) {
return StringUtils.isNotBlank(sql) ? DateUtils.getCurrStrDateTime()
+ " | 耗时 " + elapsed + " ms | SQL:" + StringUtils.LF + sql.replaceAll("[\\s]+", StringUtils.SPACE) + ";" : "";
}
}
package com.mortals.xhx.base.framework.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.EntityUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.interceptor.BaseInterceptor;
import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.daemon.task.CustomerInfo;
import io.jsonwebtoken.Claims;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.Set;
/**
* 用户权限验证,基于token
*
* @author: zxfei
* @date: 2022/4/24 11:04
*/
@Slf4j
//@Component
public class AuthUserInterceptor extends BaseInterceptor {
@Autowired
private InterceptorConfig config;
@Autowired
private IAuthTokenService authTokenService;
@Autowired
private UserService userService;
@Autowired
private ResourceService resourceService;
@Override
public int getOrder() {
return Integer.MAX_VALUE - 1;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
JSONObject ret = new JSONObject();
try {
String uri = request.getServletPath();
//校验配置的请求路径是否需要检查权限
if (config.needCheckAuth(uri)) {
//需要校验权限
try {
// String token = request.getParameter("token");
String token = authTokenService.getToken(request);
if (StringUtils.isEmpty(token)) {
throw new AppException("token为空!");
}
Claims claims = authTokenService.parseToken(token);
Map objMap = claims.get("userInfo", Map.class);
CustomerInfo userInfo =new CustomerInfo();
EntityUtil.mapToEntity(objMap,userInfo);
if (ObjectUtils.isEmpty(userInfo)) {
throw new AppException("未获取用户");
}
UserQuery userQuery = new UserQuery();
userQuery.setCustomerId(userInfo.getId());
userQuery.setLoginName(userInfo.getAccount());
UserEntity userEntity = userService.selectOne(userQuery);
if (ObjectUtils.isEmpty(userEntity)) {
throw new AppException("请求用户为空!");
}
boolean auth = this.checkAuth(userEntity, uri);
if (!auth) {
//不存在时候 如果是管理员也不做拦截
if (ObjectUtils.isEmpty(userEntity)) {
ret.put("code", -1);
ret.put("msg", "用户未登录或登录失效,请重新登录");
ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false;
} else if (userEntity.isAdmin()) {
return super.preHandle(request, response, handler);
} else {
ret.put("code", -1);
ret.put("msg", "用户无该操作权限!");
ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false;
}
}
} catch (Exception e) {
log.error("解析jwt token异常!", e);
ret.put("code", -1);
ret.put("msg", e.getMessage());
ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false;
}
}
} catch (Exception e) {
logger.error("权限校验拦截请求处理异常-->" + e.getMessage());
writeJsonResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "用户权限校验异常");
return false;
}
return super.preHandle(request, response, handler);
}
private boolean checkAuth(UserEntity userEntity, String requestUrl) throws Exception {
//查询用户路径
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
if (urls.contains(requestUrl)) return true;
return false;
}
}
package com.mortals.xhx.base.login.web; package com.mortals.xhx.base.login.web;
import java.util.Calendar; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.bean.BeanUtil;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.util.*;
import com.mortals.xhx.base.system.menu.model.MenuEntity; import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.menu.service.MenuService; import com.mortals.xhx.base.system.menu.service.MenuService;
import com.mortals.xhx.base.system.resource.service.ResourceService; import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.base.system.user.web.UserForm; import com.mortals.xhx.base.system.user.web.UserForm;
import com.mortals.xhx.base.system.valid.service.ValidCodeService; import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.base.system.site.service.SiteService; import com.mortals.xhx.base.system.site.service.SiteService;
import com.mortals.xhx.daemon.task.CustomerInfo;
import io.jsonwebtoken.Claims;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -31,11 +36,6 @@ import com.mortals.framework.model.CookieInfo; ...@@ -31,11 +36,6 @@ import com.mortals.framework.model.CookieInfo;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ITokenService; import com.mortals.framework.service.ITokenService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.MD5Util;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonController; import com.mortals.framework.web.BaseCRUDJsonController;
@RestController @RestController
...@@ -56,11 +56,13 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor ...@@ -56,11 +56,13 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
private ICacheService cacheService; private ICacheService cacheService;
@Autowired @Autowired
private SiteService siteService; private SiteService siteService;
@Autowired
private IAuthTokenService authTokenService;
private static Log logger = LogFactory.getLog(LoginController.class); private static Log logger = LogFactory.getLog(LoginController.class);
@RequestMapping("login") @RequestMapping("login")
public String login(HttpServletRequest request, HttpServletResponse response, LoginForm loginForm) throws Exception { public String login(LoginForm loginForm) throws Exception {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName(); String loginName = loginForm.getLoginName();
...@@ -101,6 +103,7 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor ...@@ -101,6 +103,7 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
data.put("barList", outlookBarList); data.put("barList", outlookBarList);
data.put("id", userEntity.getId()); data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType()); data.put("userType", userEntity.getUserType());
data.put("token","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ5dWxpbnR4IiwiZXhwIjoxNjUxMTEzNDUyLCJhdWQiOiJhcGkiLCJuYmYiOjE2NTA5NDA2NTIsImlhdCI6MTY1MDk0MDY1MiwidXNlckluZm8iOnsiaWQiOjEsInVzZXJfbmFtZSI6Ilx1NGY1OVx1Njc5NyIsImFjY291bnQiOiJhZG1pbiIsInBhc3N3b3JkIjoic2NzbWlsZSIsInVwZGF0ZV90aW1lIjoiMjAyMi0wNC0yMCAxNjozNjo1MyIsInBvc2l0aW9uX2lkIjoxLCJwb3NpdGlvbl9uYW1lIjoiXHU4ZDg1XHU3ZWE3XHU3YmExXHU3NDA2XHU1NDU4IiwiYXV0aCI6WyJzeXNfdXNlclwvbGlzdGRhdGEiLCJzeXNfcG9zaXRpb25cL2xpc3RkYXRhIl19fQ.VLKPJJM5J_OMCks419vrb3q_ED2498isfkV0Vy5YvHw");
this.generateBlackCookie(request, response, loginName, urls); this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data); ret.put(KEY_RESULT_DATA, data);
...@@ -141,6 +144,7 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor ...@@ -141,6 +144,7 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
if (currUserName == null || currUserName.trim().length() == 0) { if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员"; currUserName = "管理员";
} }
saveCurrUser(request, response, user);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("currUserName", currUserName); data.put("currUserName", currUserName);
data.put("barList", outlookBarList); data.put("barList", outlookBarList);
...@@ -305,4 +309,127 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor ...@@ -305,4 +309,127 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
} }
} }
@Override
protected IUser getCurUser() {
String token = authTokenService.getToken(request);
if (StringUtils.isNotEmpty(token)) {
try {
Claims claims = authTokenService.parseToken(token);
Map objMap = claims.get("userInfo", Map.class);
CustomerInfo userInfo =new CustomerInfo();
BeanUtil.fillBeanWithMap(objMap,userInfo,true);
if (!ObjectUtils.isEmpty(userInfo)
&& !ObjectUtils.isEmpty(userInfo.getId())
&& !ObjectUtils.isEmpty(userInfo.getAccount())) {
UserQuery userQuery = new UserQuery();
userQuery.setCustomerId(userInfo.getId());
userQuery.setLoginName(userInfo.getAccount());
UserEntity userEntity = userService.selectOne(userQuery);
if (!ObjectUtils.isEmpty(userEntity)) {
return new IUser() {
@Override
public Long getId() {
return userEntity.getId();
}
@Override
public Long getDeptId() {
return null;
}
@Override
public String getDeptName() {
return null;
}
@Override
public Long getCustomerId() {
return userEntity.getCustomerId();
}
@Override
public Long getSiteId() {
return userEntity.getSiteId();
}
@Override
public Long getCustomerJoinId() {
return null;
}
@Override
public String getCustomerNum() {
return null;
}
@Override
public String getLoginName() {
return userEntity.getLoginName();
}
@Override
public String getRealName() {
return userEntity.getRealName();
}
@Override
public boolean isAdmin() {
return userEntity.getId() == 1L;
}
@Override
public boolean isSystemUser() {
return userEntity.isSystemUser();
}
@Override
public boolean isManager() {
return userEntity.isManager();
}
@Override
public Integer getUserType() {
return userEntity.getUserType();
}
@Override
public String getToken() {
return null;
}
@Override
public Long getLoginTime() {
return userEntity.getLoginTime();
}
@Override
public Long getExpireTime() {
return userEntity.getExpireTime();
}
@Override
public void setExpireTime(Long expireTime) {
}
@Override
public String getMenuUrl() {
return userEntity.getMenuUrl();
}
};
}
}
} catch (Exception e) {
log.error("解析jwt token异常!", e);
return null;
}
}
return super.getCurUser();
}
} }
...@@ -151,7 +151,11 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par ...@@ -151,7 +151,11 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
@Override @Override
public String getParamValue(String key) { public String getParamValue(String key) {
IParam param = wrapParamObject(cacheService.hget(getCacheName(), key)); String hget = cacheService.hget(getCacheName(), key);
if (StringUtils.isEmpty(hget))return "";
IParam param = wrapParamObject(hget);
// IParam param = getExtCache(key); // IParam param = getExtCache(key);
if (param != null) { if (param != null) {
return StringUtils.trim(param.getParamValue()); return StringUtils.trim(param.getParamValue());
...@@ -193,7 +197,7 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par ...@@ -193,7 +197,7 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
@Override @Override
public int getParamIntValue(String key) { public int getParamIntValue(String key) {
ParamEntity extCache = getExtCache(key); ParamEntity extCache = getExtCache(key);
IParam param = (IParam) extCache; IParam param = extCache;
try { try {
if (param == null) { if (param == null) {
return 0; return 0;
......
...@@ -3,6 +3,8 @@ package com.mortals.xhx.base.system.user.model; ...@@ -3,6 +3,8 @@ package com.mortals.xhx.base.system.user.model;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* *
* Description:User * Description:User
...@@ -10,5 +12,28 @@ import lombok.Data; ...@@ -10,5 +12,28 @@ import lombok.Data;
*/ */
@Data @Data
public class UserEntityExt extends BaseEntityLong { public class UserEntityExt extends BaseEntityLong {
/**
* 站点名称
*/
private String siteName; private String siteName;
/**
* 唯一标识
*/
private String token;
/**
* 菜单栏
*/
private String menuUrl;
/**
* 登录时间
*/
private Long loginTime;
/**
* 过期时间
*/
private Long expireTime;
} }
\ No newline at end of file
...@@ -77,9 +77,9 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -77,9 +77,9 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
@Override @Override
protected void updateBefore(UserEntity entity, Context context) throws AppException { protected void updateBefore(UserEntity entity, Context context) throws AppException {
if (entity.getId().longValue() == SysConstains.ADMIN_ID && !context.getUser().isAdmin()) { // if (entity.getId().longValue() == SysConstains.ADMIN_ID && !context.getUser().isAdmin()) {
throw new AppException("你没有权限执行该操作"); // throw new AppException("你没有权限执行该操作");
} // }
this.doHandlerUser(entity); this.doHandlerUser(entity);
} }
......
package com.mortals.xhx.busiz.rsp; package com.mortals.xhx.busiz.rsp;
import com.mortals.xhx.common.code.YesNoEnum;
import lombok.Data; import lombok.Data;
/** /**
...@@ -21,10 +20,4 @@ public class ApiResp<T> { ...@@ -21,10 +20,4 @@ public class ApiResp<T> {
*/ */
private T data; private T data;
public boolean isSuccess() {
if (YesNoEnum.YES.getValue() == code) {
return true;
}
return false;
}
} }
...@@ -22,4 +22,10 @@ public class ParamKey { ...@@ -22,4 +22,10 @@ public class ParamKey {
*/ */
public static String SYS_PARAM_LOG_TIME = "log_time"; public static String SYS_PARAM_LOG_TIME = "log_time";
/**
* 系统参数:系统日志保存时间(单位:秒,默认值:60秒)
*/
public static String SYS_PARAM_USER_URL = "user_url";
} }
package com.mortals.xhx.daemon.applicationservice; package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.springcloud.config.web.BaseWebMvcConfigurer; import com.mortals.framework.springcloud.service.IApplicationStartedService;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
/** /**
* 应用级服务,在应用启动后、停止过程中调用 * 应用级服务,在应用启动后、停止过程中调用
* 应用已经完成启动完成,才调用该服务 * 应用已经完成启动完成,才调用该服务
......
package com.mortals.xhx.daemon.task;
import lombok.Data;
/**
* @author: zxfei
* @date: 2022/4/26 10:51
* @description:
**/
@Data
public class CustomerInfo {
private Long id;
private String user_name;
private String account;
private String password;
private String mobile;
}
...@@ -41,10 +41,10 @@ public class DeviceStatTaskImpl implements ITaskExcuteService { ...@@ -41,10 +41,10 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
log.info("设备状态统计,开始执行"); log.debug("设备状态统计,开始执行");
doDeviceUpOrDown(); doDeviceUpOrDown();
doDeviceLogDel(); doDeviceLogDel();
log.info("设备状态统计,结束执行"); log.debug("设备状态统计,结束执行");
} }
/** /**
......
package com.mortals.xhx.daemon.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.HttpUtil;
import com.mortals.xhx.base.framework.ws.message.SendToAllRequest;
import com.mortals.xhx.base.framework.ws.util.WebSocketUtil;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.role.model.RoleUserQuery;
import com.mortals.xhx.base.system.role.service.RoleUserService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.DeviceOnlineStatusEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.device.model.DeviceLogEntity;
import com.mortals.xhx.module.device.model.DeviceLogQuery;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceService;
import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*;
import static com.alibaba.druid.sql.ast.SQLPartitionValue.Operator.List;
/**
* 用户同步
*
* @author: zxfei
* @date: 2022/3/9 15:19
*/
@Slf4j
@Service("UserSyncTask")
public class UserSyncTaskImpl implements ITaskExcuteService {
@Autowired
private UserService userService;
@Autowired
private RoleUserService roleUserService;
@Override
public void excuteTask(ITask task) throws AppException {
log.debug("用户同步,开始执行");
syncUser();
log.debug("用户同步,结束执行");
}
/**
* 用户同步
*/
private void syncUser() {
String url = GlobalSysInfo.getParamValue(ParamKey.SYS_PARAM_USER_URL, "http://125.64.74.247:8076/doors/inter/user/userList");
Map<String, String> headers = new HashMap<>();
try {
String resp = HttpUtil.doGet(url, headers);
ApiResp<List<CustomerInfo>> apiResp = JSON.parseObject(resp, new TypeReference<ApiResp<List<CustomerInfo>>>() {
});
if(apiResp.getCode()==0){
apiResp.getData().stream().forEach(user->{
//查询用户是否存在
UserQuery userQuery = new UserQuery();
userQuery.setCustomerId(user.getId());
userQuery.setLoginName(user.getAccount());
UserEntity userEntity = userService.selectOne(userQuery);
if(!ObjectUtils.isEmpty(userEntity)){
userEntity.setCustomerId(user.getId());
userEntity.setLoginName(user.getAccount());
userEntity.setRealName(user.getUser_name());
userEntity.setMobile(user.getMobile());
userEntity.setLoginPwd(user.getPassword());
userEntity.setUpdateUserId(1L);
userEntity.setUpdateTime(new Date());
userService.update(userEntity);
}else {
//新增用户
userEntity = userService.createUser(null, user.getId(), "", user.getAccount(), user.getPassword(), user.getUser_name(), user.getMobile());
//添加默认访问权限
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(userEntity.getId());
roleUserQuery.setRoleIdList(Arrays.asList(new Long[]{1L}));
roleUserService.doDistributionRole(roleUserQuery);
}
});
}
log.debug("user resp:{}", JSON.toJSONString(apiResp));
} catch (Exception e) {
log.error("用户同步异常,结束执行", e);
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.device.web; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.device.web;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DeviceOnlineStatusEnum; import com.mortals.xhx.common.code.DeviceOnlineStatusEnum;
import com.mortals.xhx.common.code.DeviceTypeEnum; import com.mortals.xhx.common.code.DeviceTypeEnum;
...@@ -12,8 +13,10 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -12,8 +13,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonMappingController; import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery; import com.mortals.xhx.module.device.model.DeviceQuery;
...@@ -23,29 +26,31 @@ import com.mortals.framework.util.StringUtils; ...@@ -23,29 +26,31 @@ import com.mortals.framework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
/** /**
* * 设备
* 设备 *
* * @author zxfei
* @author zxfei * @date 2022-03-09
* @date 2022-03-09 */
*/
@RestController @RestController
@RequestMapping("device") @RequestMapping("device")
public class DeviceController extends BaseCRUDJsonMappingController<DeviceService,DeviceForm,DeviceEntity,Long> { public class DeviceController extends BaseCRUDJsonMappingController<DeviceService, DeviceForm, DeviceEntity, Long> {
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired @Autowired
private FirmService firmService; private FirmService firmService;
public DeviceController(){ public DeviceController() {
super.setFormClass(DeviceForm.class); super.setFormClass(DeviceForm.class);
super.setModuleDesc( "设备"); super.setModuleDesc("设备");
} }
@Override @Override
...@@ -55,16 +60,15 @@ public class DeviceController extends BaseCRUDJsonMappingController<DeviceServic ...@@ -55,16 +60,15 @@ public class DeviceController extends BaseCRUDJsonMappingController<DeviceServic
add(new OrderCol("createTime", OrderCol.DESCENDING)); add(new OrderCol("createTime", OrderCol.DESCENDING));
} }
}); });
super.doListBefore(request, response, form, model, context); super.doListBefore(request, response, form, model, context);
} }
@Override @Override
protected void init(HttpServletRequest request, HttpServletResponse response, DeviceForm form, Map<String, Object> model, Context context) { protected void init(HttpServletRequest request, HttpServletResponse response, DeviceForm form, Map<String, Object> model, Context context) {
this.addDict(model, "deviceType", paramService.getParamBySecondOrganize("Device","deviceType")); this.addDict(model, "deviceType", paramService.getParamBySecondOrganize("Device", "deviceType"));
this.addDict(model, "deviceOnlineStatus", paramService.getParamBySecondOrganize("Device","deviceOnlineStatus")); this.addDict(model, "deviceOnlineStatus", paramService.getParamBySecondOrganize("Device", "deviceOnlineStatus"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Device","status")); this.addDict(model, "status", paramService.getParamBySecondOrganize("Device", "status"));
this.addDict(model, "deviceFirmId", firmService.find(new FirmQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getFirmName()))); this.addDict(model, "deviceFirmId", firmService.find(new FirmQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getFirmName())));
Map<Boolean, Long> collect = this.service.find(new DeviceQuery()).stream().collect(Collectors.partitioningBy(item -> (item.getDeviceOnlineStatus() == DeviceOnlineStatusEnum.在线.getValue()), Collectors.counting())); Map<Boolean, Long> collect = this.service.find(new DeviceQuery()).stream().collect(Collectors.partitioningBy(item -> (item.getDeviceOnlineStatus() == DeviceOnlineStatusEnum.在线.getValue()), Collectors.counting()));
...@@ -73,4 +77,5 @@ public class DeviceController extends BaseCRUDJsonMappingController<DeviceServic ...@@ -73,4 +77,5 @@ public class DeviceController extends BaseCRUDJsonMappingController<DeviceServic
super.init(request, response, form, model, context); super.init(request, response, form, model, context);
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.device.web; package com.mortals.xhx.module.device.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.EntityUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.daemon.task.CustomerInfo;
import com.mortals.xhx.module.device.model.DeviceLogEntity;
import com.mortals.xhx.module.device.service.DeviceLogService;
import io.jsonwebtoken.Claims;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonMappingController; import java.util.ArrayList;
import com.mortals.xhx.module.device.model.DeviceLogEntity; import java.util.Map;
import com.mortals.xhx.module.device.model.DeviceLogQuery;
import com.mortals.xhx.module.device.service.DeviceLogService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/** /**
* * 设备日志
* 设备日志 *
* * @author zxfei
* @author zxfei * @date 2022-03-09
* @date 2022-03-09 */
*/
@RestController @RestController
@RequestMapping("device/log") @RequestMapping("device/log")
public class DeviceLogController extends BaseCRUDJsonMappingController<DeviceLogService,DeviceLogForm,DeviceLogEntity,Long> { public class DeviceLogController extends BaseCRUDJsonMappingController<DeviceLogService, DeviceLogForm, DeviceLogEntity, Long> {
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private UserService userService;
public DeviceLogController(){
public DeviceLogController() {
super.setFormClass(DeviceLogForm.class); super.setFormClass(DeviceLogForm.class);
super.setModuleDesc( "设备日志"); super.setModuleDesc("设备日志");
} }
@Override @Override
protected void init(HttpServletRequest request, HttpServletResponse response, DeviceLogForm form, Map<String, Object> model, Context context) { protected void init(HttpServletRequest request, HttpServletResponse response, DeviceLogForm form, Map<String, Object> model, Context context) {
this.addDict(model, "logType", paramService.getParamBySecondOrganize("DeviceLog","logType")); this.addDict(model, "logType", paramService.getParamBySecondOrganize("DeviceLog", "logType"));
super.init(request, response, form, model, context); super.init(request, response, form, model, context);
} }
...@@ -57,4 +66,130 @@ public class DeviceLogController extends BaseCRUDJsonMappingController<DeviceLog ...@@ -57,4 +66,130 @@ public class DeviceLogController extends BaseCRUDJsonMappingController<DeviceLog
}); });
super.doListBefore(request, response, form, model, context); super.doListBefore(request, response, form, model, context);
} }
/*
@Override
protected IUser getCurUser() {
//String token = request.getParameter("token");
String token = authTokenService.getToken(request);
if (StringUtils.isNotEmpty(token)) {
try {
Claims claims = authTokenService.parseToken(token);
Map objMap = claims.get("userInfo", Map.class);
CustomerInfo userInfo =new CustomerInfo();
EntityUtil.mapToEntity(objMap,userInfo);
if (!ObjectUtils.isEmpty(userInfo)
&& !ObjectUtils.isEmpty(userInfo.getId())
&& !ObjectUtils.isEmpty(userInfo.getAccount())) {
UserQuery userQuery = new UserQuery();
userQuery.setCustomerId(userInfo.getId());
userQuery.setLoginName(userInfo.getAccount());
UserEntity userEntity = userService.selectOne(userQuery);
if (!ObjectUtils.isEmpty(userEntity)) {
return new IUser() {
@Override
public Long getId() {
return userEntity.getId();
}
@Override
public Long getDeptId() {
return null;
}
@Override
public String getDeptName() {
return null;
}
@Override
public Long getCustomerId() {
return userEntity.getCustomerId();
}
@Override
public Long getSiteId() {
return userEntity.getSiteId();
}
@Override
public Long getCustomerJoinId() {
return null;
}
@Override
public String getCustomerNum() {
return null;
}
@Override
public String getLoginName() {
return userEntity.getLoginName();
}
@Override
public String getRealName() {
return userEntity.getRealName();
}
@Override
public boolean isAdmin() {
return userEntity.getId() == 1L;
}
@Override
public boolean isSystemUser() {
return userEntity.isSystemUser();
}
@Override
public boolean isManager() {
return userEntity.isManager();
}
@Override
public Integer getUserType() {
return userEntity.getUserType();
}
@Override
public String getToken() {
return null;
}
@Override
public Long getLoginTime() {
return userEntity.getLoginTime();
}
@Override
public Long getExpireTime() {
return userEntity.getExpireTime();
}
@Override
public void setExpireTime(Long expireTime) {
}
@Override
public String getMenuUrl() {
return userEntity.getMenuUrl();
}
};
}
}
} catch (Exception e) {
log.error("解析jwt token异常!", e);
return null;
}
}
return super.getCurUser();
}*/
} }
\ No newline at end of file
...@@ -31,9 +31,13 @@ spring: ...@@ -31,9 +31,13 @@ spring:
min-idle: 0 min-idle: 0
max-active: 100 max-active: 100
max-wait: 1000 max-wait: 1000
dao:
exceptiontranslation:
enabled: false
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.p6spy.engine.spy.P6SpyDriver
#driver-class-name: com.mysql.cj.jdbc.Driver
url: @profiles.datasource.uri@ url: @profiles.datasource.uri@
username: @profiles.datasource.username@ username: @profiles.datasource.username@
password: @profiles.datasource.password@ password: @profiles.datasource.password@
...@@ -55,3 +59,12 @@ cookie: ...@@ -55,3 +59,12 @@ cookie:
port: 11010 port: 11010
upload: upload:
path: @profiles.filepath@ path: @profiles.filepath@
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: oePmAwAkC6ehBm2aAEbP_Q5yy9fQ
# 令牌有效期(默认60分钟)
expireTime: 60
# 令牌前缀
prefix:
\ No newline at end of file
module.log=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
# 自定义日志打印
logMessageFormat=com.mortals.xhx.base.framework.config.P6spySqlFormatConfig
#customLogMessageFormat=%(currentTime) | SQL耗时: %(executionTime) ms | 连接信息: %(category)-%(connectionId) | 执行语句: %(sql)
# 使用控制台记录sql
appender=com.p6spy.engine.spy.appender.Slf4JLogger
#appender=com.p6spy.engine.spy.appender.FileLogger
## 配置记录Log例外
#excludecategories=info,debug,result,batc,resultset
#excludecategories=info,debug
# 设置使用p6spy driver来做代理
deregisterdrivers=true
# 日期格式
dateformat=yyyy-MM-dd HH:mm:ss
# 实际驱动
driverlist=com.mysql.cj.jdbc.Driver
# 是否开启慢SQL记录
outagedetection=true
# 慢SQL记录标准 秒
outagedetectioninterval=2
filter=true
exclude=mortals_xhx_task,mortals_xhx_param,mortals_xhx_device_log
\ No newline at end of file
package com.mortals.httpclient;
import io.jsonwebtoken.Header;
import io.jsonwebtoken.Jwt;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import java.util.Base64;
/**
* @author: zxfei
* @date: 2022/4/26 15:10
* @description:
**/
public class Test {
public static void main(String[] args) throws Exception {
String body="eyJpc3MiOiJ5dWxpbnR4IiwiZXhwIjoxNjUxMTEzNDUyLCJhdWQiOiJhcGkiLCJuYmYiOjE2NTA5NDA2NTIsImlhdCI6MTY1MDk0MDY1MiwidXNlckluZm8iOnsiaWQiOjEsInVzZXJfbmFtZSI6Ilx1NGY1OVx1Njc5NyIsImFjY291bnQiOiJhZG1pbiIsInBhc3N3b3JkIjoic2NzbWlsZSIsInVwZGF0ZV90aW1lIjoiMjAyMi0wNC0yMCAxNjozNjo1MyIsInBvc2l0aW9uX2lkIjoxLCJwb3NpdGlvbl9uYW1lIjoiXHU4ZDg1XHU3ZWE3XHU3YmExXHU3NDA2XHU1NDU4IiwiYXV0aCI6WyJzeXNfdXNlclwvbGlzdGRhdGEiLCJzeXNfcG9zaXRpb25cL2xpc3RkYXRhIl19fQ";
byte[] base64decodedBytes = Base64.getDecoder().decode(body);
System.out.println("原始字符串: " + new String(base64decodedBytes, "utf-8"));
// String s = new String(Base64.decode(body), "utf-8");
String secret="oePmAwAkC6ehBm2aAEbP_Q5yy9fQ";
String token = Jwts.builder()
.setHeaderParam("typ","JWT")
.setPayload("1")
.signWith(SignatureAlgorithm.HS256, secret)
.compact();
System.out.println(token);
String token1="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.MQ.DA4669tqW3vEwUX2fFnhEE7CqkOMTZBuDXRqYrnVkPc";
Jwt body1 = Jwts.parser().setSigningKey( Base64.getEncoder().encodeToString(secret.getBytes())).parse(token1);
System.out.println(body1.getBody());
}
}
###设备日志列表 ###设备日志列表
POST {{baseUrl}}/device/log/list POST {{baseUrl}}/device/log/list
Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ5dWxpbnR4IiwiZXhwIjoxNjUxMTEzNDUyLCJhdWQiOiJhcGkiLCJuYmYiOjE2NTA5NDA2NTIsImlhdCI6MTY1MDk0MDY1MiwidXNlckluZm8iOnsiaWQiOjEsInVzZXJfbmFtZSI6Ilx1NGY1OVx1Njc5NyIsImFjY291bnQiOiJhZG1pbiIsInBhc3N3b3JkIjoic2NzbWlsZSIsInVwZGF0ZV90aW1lIjoiMjAyMi0wNC0yMCAxNjozNjo1MyIsInBvc2l0aW9uX2lkIjoxLCJwb3NpdGlvbl9uYW1lIjoiXHU4ZDg1XHU3ZWE3XHU3YmExXHU3NDA2XHU1NDU4IiwiYXV0aCI6WyJzeXNfdXNlclwvbGlzdGRhdGEiLCJzeXNfcG9zaXRpb25cL2xpc3RkYXRhIl19fQ.VLKPJJM5J_OMCks419vrb3q_ED2498isfkV0Vy5YvHw
Content-Type: application/json Content-Type: application/json
{ {
...@@ -9,6 +10,15 @@ Content-Type: application/json ...@@ -9,6 +10,15 @@ Content-Type: application/json
} }
###设备日志列表
POST {{baseUrl}}/device/log/list
Content-Type: application/json
{
"page":1,
"size":10
}
###设备日志更新与保存 ###设备日志更新与保存
POST {{baseUrl}}/device/log/save POST {{baseUrl}}/device/log/save
Content-Type: application/json Content-Type: application/json
...@@ -18,7 +28,7 @@ Content-Type: application/json ...@@ -18,7 +28,7 @@ Content-Type: application/json
"deviceNum":"hue3l8", "deviceNum":"hue3l8",
"deviceName":"ozje94", "deviceName":"ozje94",
"logType":944, "logType":944,
"content":"p8zog0", "content":"p8zog0"
} }
> {% > {%
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>com.mortals</groupId> <groupId>com.mortals</groupId>
<artifactId>mortals-common</artifactId> <artifactId>mortals-common</artifactId>
<version>1.1.4-SNAPSHOT</version> <version>1.1.5-SNAPSHOT</version>
</parent> </parent>
<groupId>com.mortals.xhx</groupId> <groupId>com.mortals.xhx</groupId>
<artifactId>device-platform</artifactId> <artifactId>device-platform</artifactId>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<profiles.active>develop</profiles.active> <profiles.active>develop</profiles.active>
<profiles.server.port>18211</profiles.server.port> <profiles.server.port>18211</profiles.server.port>
<profiles.datasource.uri> <profiles.datasource.uri>
<![CDATA[jdbc:mysql://localhost:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri> <![CDATA[jdbc:p6spy:mysql://localhost:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username> <profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>12345678</profiles.datasource.password> <profiles.datasource.password>12345678</profiles.datasource.password>
<profiles.redis.uri>127.0.0.1</profiles.redis.uri> <profiles.redis.uri>127.0.0.1</profiles.redis.uri>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<profiles.active>test</profiles.active> <profiles.active>test</profiles.active>
<profiles.server.port>18221</profiles.server.port> <profiles.server.port>18221</profiles.server.port>
<profiles.datasource.uri> <profiles.datasource.uri>
<![CDATA[jdbc:mysql://192.168.0.98:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri> <![CDATA[jdbc:p6spy:mysql://192.168.0.98:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username> <profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>nacos@2020</profiles.datasource.password> <profiles.datasource.password>nacos@2020</profiles.datasource.password>
<profiles.redis.uri>192.168.0.252</profiles.redis.uri> <profiles.redis.uri>192.168.0.252</profiles.redis.uri>
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<profiles.active>product</profiles.active> <profiles.active>product</profiles.active>
<profiles.server.port>18221</profiles.server.port> <profiles.server.port>18221</profiles.server.port>
<profiles.datasource.uri> <profiles.datasource.uri>
<![CDATA[jdbc:mysql://192.168.0.26:8183/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri> <![CDATA[jdbc:p6spy:mysql://192.168.0.26:8183/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username> <profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>ghzw@2022</profiles.datasource.password> <profiles.datasource.password>ghzw@2022</profiles.datasource.password>
<profiles.redis.uri>192.168.0.26</profiles.redis.uri> <profiles.redis.uri>192.168.0.26</profiles.redis.uri>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment