From 44f2a0a32c096bdb05d4cc0ac162cdc1eb14c3ed Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期四, 10 八月 2023 13:14:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java | 48 ++-------------
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java | 28 +++++----
ard-work/src/main/java/com/ruoyi/storage/minio/utils/MinioService.java | 12 ++-
ard-work/src/main/java/com/ruoyi/media/service/impl/WebrtcService.java | 10 ++-
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java | 17 ++---
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java | 3
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java | 10 ++-
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java | 13 ----
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 14 +++-
10 files changed, 63 insertions(+), 93 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java
index d10da3b..c4be437 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java
@@ -71,10 +71,12 @@
@PreDestroy
public void destroyMediaMtx() {
- log.info("閿�姣乵ediaMtx");
- if (CmdUtils.isProcessRunning(processName)) {
- // 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
- CmdUtils.stopProcess(processName);
+ if (mediamtxEnabled) {
+ log.info("閿�姣乵ediaMtx");
+ if (CmdUtils.isProcessRunning(processName)) {
+ // 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
+ CmdUtils.stopProcess(processName);
+ }
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/WebrtcService.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/WebrtcService.java
index 28c0053..e8b45ba 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/WebrtcService.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/WebrtcService.java
@@ -55,10 +55,12 @@
@PreDestroy
public void destroyMediaMtx() {
- log.info("閿�姣亀ebrtc-streamer");
- if (CmdUtils.isProcessRunning(processName)) {
- // 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
- CmdUtils.stopProcess(processName);
+ if (webrtcEnabled) {
+ log.info("閿�姣亀ebrtc-streamer");
+ if (CmdUtils.isProcessRunning(processName)) {
+ // 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
+ CmdUtils.stopProcess(processName);
+ }
}
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MinioService.java b/ard-work/src/main/java/com/ruoyi/storage/minio/utils/MinioService.java
similarity index 87%
rename from ard-work/src/main/java/com/ruoyi/media/service/impl/MinioService.java
rename to ard-work/src/main/java/com/ruoyi/storage/minio/utils/MinioService.java
index 3c41b6c..2e095bc 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MinioService.java
+++ b/ard-work/src/main/java/com/ruoyi/storage/minio/utils/MinioService.java
@@ -1,4 +1,4 @@
-package com.ruoyi.media.service.impl;
+package com.ruoyi.storage.minio.utils;
import com.ruoyi.utils.tools.CmdUtils;
import com.sun.jna.Platform;
@@ -61,10 +61,12 @@
@PreDestroy
public void destroyMediaMtx() {
- log.info("閿�姣乵inio");
- if (CmdUtils.isProcessRunning(processName)) {
- // 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
- CmdUtils.stopProcess(processName);
+ if (minioEnabled) {
+ log.info("閿�姣乵inio");
+ if (CmdUtils.isProcessRunning(processName)) {
+ // 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
+ CmdUtils.stopProcess(processName);
+ }
}
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index eb3fa5c..a57558f 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -591,8 +591,12 @@
@Override
public Results getCarGPSTrack(Map<String,String> map,String syURL, ArdSyUser ardSyUser){
String carId = map.get("carId");
- String startTime = map.get("startTime").replace(" ", "").replace("-", "").replace(":", "");
- String endTime = map.get("endTime").replace(" ", "").replace("-", "").replace(":", "");
+ //String startTime = map.get("startTime").replace(" ", "").replace("-", "").replace(":", "");
+ //String endTime = map.get("endTime").replace(" ", "").replace("-", "").replace(":", "");
+ String time = map.get("time");
+ time = time.replace("-", "");
+ String startTime = time + "000000";
+ String endTime = time +"235959";
String maxSpeed = map.get("maxSpeed");
//31鐢ㄦ埛鍚嶅瘑鐮�
String username31 = ardSyUser.getUserId();
@@ -639,8 +643,10 @@
String[] sgnTypes = {"杩戝厜鐏俊鍙�","杩滃厜鐏俊鍙�","鍙宠浆鍚戠伅淇″彿","宸﹁浆鍚戠伅淇″彿","鍒跺姩淇″彿","鍊掓。淇″彿","闆剧伅淇″彿","绀哄粨鐏�","鍠囧彮淇″彿","绌鸿皟鐘舵��",
"绌烘尅淇″彿","缂撻�熷櫒宸ヤ綔","ABS 宸ヤ綔","鍔犵儹鍣ㄥ伐浣�","绂诲悎鍣ㄧ姸鎬�","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀",
"淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀"};
- Integer sttsHex = Integer.parseInt(stts, 16);
- String sttsBin = Integer.toBinaryString(sttsHex);
+ //Integer sttsHex = Integer.parseInt(stts, 16);
+ Long sttsHex = Long.parseLong(stts, 16);
+ //String sttsBin = Integer.toBinaryString(sttsHex);
+ String sttsBin = Long.toBinaryString(sttsHex);
if(sttsBin.length() < 32){
while(sttsBin.length() < 32){
sttsBin = "0" + sttsBin;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
index 780665c..b3053e5 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -24,14 +24,13 @@
/**
* 鐧诲綍楠岃瘉
- *
+ *
* @author ruoyi
*/
@RestController
@Api(tags = "鐧诲綍楠岃瘉鎺ュ彛")
@Anonymous
-public class SysLoginController
-{
+public class SysLoginController {
@Autowired
private SysLoginService loginService;
@@ -43,32 +42,36 @@
/**
* 鐧诲綍鏂规硶
- *
+ *
* @param loginBody 鐧诲綍淇℃伅
* @return 缁撴灉
*/
@PostMapping("/login")
@ApiOperation(value = "鐧诲綍")
- public AjaxResult login(@RequestBody LoginBody loginBody)
- {
+ public AjaxResult login(@RequestBody LoginBody loginBody) {
AjaxResult ajax = AjaxResult.success();
// 鐢熸垚浠ょ墝
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
- loginBody.getUuid(),loginBody.getApp());
+ loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 鑾峰彇鐢ㄦ埛淇℃伅
- *
+ *
* @return 鐢ㄦ埛淇℃伅
*/
@GetMapping("getInfo")
@ApiOperation(value = "鑾峰彇鐢ㄦ埛淇℃伅")
- public AjaxResult getInfo()
- {
+ public AjaxResult getInfo() {
SysUser user = SecurityUtils.getLoginUser().getUser();
+ // 璧嬪�艰瀺浜憈oken鍒扮敤鎴蜂俊鎭�
+ String rongCloudToken = SecurityUtils.getLoginUser().getRongCloudToken();
+ if (rongCloudToken != null) {
+ user.setRongCloudToken(rongCloudToken);
+ }
+
// 瑙掕壊闆嗗悎
Set<String> roles = permissionService.getRolePermission(user);
// 鏉冮檺闆嗗悎
@@ -82,12 +85,11 @@
/**
* 鑾峰彇璺敱淇℃伅
- *
+ *
* @return 璺敱淇℃伅
*/
@GetMapping("getRouters")
- public AjaxResult getRouters()
- {
+ public AjaxResult getRouters() {
String userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return AjaxResult.success(menuService.buildMenus(menus));
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java
index 3d6e809..b9e58c6 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java
@@ -27,19 +27,6 @@
*/
private String uuid;
- /**
- * 鏄惁APP鐢ㄦ埛
- */
- private Boolean isApp;
-
-
- public Boolean getApp() {
- return isApp;
- }
-
- public void setApp(Boolean app) {
- isApp = app;
- }
public String getUsername()
{
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
index c2a07d4..63da276 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
@@ -30,7 +30,10 @@
* 鐢ㄦ埛鍞竴鏍囪瘑
*/
private String token;
-
+ /**
+ * 铻嶄簯token
+ */
+ private String rongCloudToken;
/**
* 鐧诲綍鏃堕棿
*/
@@ -71,17 +74,13 @@
*/
private SysUser user;
- /**
- * 鏄惁app鐢ㄦ埛
- */
- private Boolean isApp;
- public Boolean getIsApp() {
- return isApp;
+ public String getRongCloudToken() {
+ return rongCloudToken;
}
- public void setIsApp(Boolean isApp) {
- this.isApp = isApp;
+ public void setRongCloudToken(String rongCloudToken) {
+ this.rongCloudToken = rongCloudToken;
}
public String getUserId()
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
index cd67a89..f3fa8aa 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -50,6 +50,7 @@
@Autowired
private ISysConfigService configService;
+
@Resource
RongCloudService rongCloudService;
@@ -63,6 +64,8 @@
* @return 缁撴灉
*/
public String login(String username, String password, String code, String uuid) {
+
+
boolean captchaEnabled = configService.selectCaptchaEnabled();
// 楠岃瘉鐮佸紑鍏�
if (captchaEnabled) {
@@ -89,47 +92,10 @@
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
recordLoginInfo(loginUser.getUserId());
+
+ getRongCloudToken(loginUser);
// 鐢熸垚token
String token = tokenService.createToken(loginUser);
- //鑾峰彇铻嶄簯token
- getRongCloudToken(loginUser);
- return token;
- }
- public String login(String username, String password, String code, String uuid,Boolean isApp) {
- boolean captchaEnabled = configService.selectCaptchaEnabled();
- // 楠岃瘉鐮佸紑鍏�
- if (captchaEnabled) {
- validateCaptcha(username, code, uuid);
- }
- // 鐢ㄦ埛楠岃瘉
- Authentication authentication = null;
- try {
- UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
- AuthenticationContextHolder.setContext(authenticationToken);
- // 璇ユ柟娉曚細鍘昏皟鐢║serDetailsServiceImpl.loadUserByUsername
- authentication = authenticationManager.authenticate(authenticationToken);
- } catch (Exception e) {
- if (e instanceof BadCredentialsException) {
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
- throw new UserPasswordNotMatchException();
- } else {
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
- throw new ServiceException(e.getMessage());
- }
- } finally {
- AuthenticationContextHolder.clearContext();
- }
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
- LoginUser loginUser = (LoginUser) authentication.getPrincipal();
- recordLoginInfo(loginUser.getUserId());
- // 鐢熸垚token
- if(StringUtils.isNotNull(isApp))
- {
- loginUser.setIsApp(isApp);
- }
- String token = tokenService.createToken(loginUser);
- //鑾峰彇铻嶄簯token
- getRongCloudToken(loginUser);
return token;
}
/**
@@ -171,15 +137,17 @@
*
* @param loginUser 鐧诲綍鐢ㄦ埛
*/
- public void getRongCloudToken(LoginUser loginUser) {
+ public String getRongCloudToken(LoginUser loginUser) {
try {
String userId = loginUser.getUserId();
String nickName = loginUser.getUser().getNickName();
String token = rongCloudService.getToken(userId, nickName);
+ loginUser.setRongCloudToken(token);
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
sysUser.setRongCloudToken(token);
userService.updateUserProfile(sysUser);
+ return token;
} catch (Exception ex) {
throw ex;
}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
index 6183d67..710b5d3 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
@@ -142,7 +142,8 @@
public void refreshToken(LoginUser loginUser)
{
loginUser.setLoginTime(System.currentTimeMillis());
- if(StringUtils.isNull(loginUser.getIsApp()))
+ String appUserType = loginUser.getUser().getAppUserType();
+ if(StringUtils.isNull(appUserType))
{
loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
// 鏍规嵁uuid灏唋oginUser缂撳瓨
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 0081723..aa41612 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.alarm.config.domain.ArdAlarmTypeConfig;
import com.ruoyi.alarm.config.mapper.ArdAlarmTypeConfigMapper;
import com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DictUtils;
--
Gitblit v1.9.3