style(components): format CSS styles in Vue components

- Remove extra spaces in CSS property declarations
- Consolidate multi-line CSS rules into single lines
- Maintain consistent formatting across component styles
- Improve readability by removing unnecessary line breaks
- Ensure uniform styling structure in scoped CSS blocks
This commit is contained in:
2025-11-28 17:14:00 +08:00
parent bff057c99b
commit 02858146b3
48 changed files with 1746 additions and 3828 deletions

View File

@@ -40,9 +40,6 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import java.io.InputStream;
import java.util.Date;
/**
* 客户端账号控制器
*

View File

@@ -10,6 +10,13 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.web.service.IClientAccountService;
import com.ruoyi.web.security.JwtRsaKeyService;
import com.ruoyi.system.domain.ClientAccount;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import io.jsonwebtoken.Jwts;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@@ -25,26 +32,43 @@ public class VersionController extends BaseController {
@Autowired
private RedisTemplate<String, String> redisTemplate;
@Autowired
private IClientAccountService clientAccountService;
@Autowired
private JwtRsaKeyService jwtRsaKeyService;
private static final String VERSION_REDIS_KEY = "erp:client:version";
private static final String ASAR_URL_REDIS_KEY = "erp:client:asar_url";
private static final String JAR_URL_REDIS_KEY = "erp:client:jar_url";
private static final String UPDATE_NOTES_REDIS_KEY = "erp:client:update_notes";
private static final String VERSION_BETA_REDIS_KEY = "erp:client:version:beta";
private static final String ASAR_URL_BETA_REDIS_KEY = "erp:client:asar_url:beta";
private static final String JAR_URL_BETA_REDIS_KEY = "erp:client:jar_url:beta";
private static final String UPDATE_NOTES_BETA_REDIS_KEY = "erp:client:update_notes:beta";
/**
* 检查版本更新
*/
@GetMapping("/check")
public AjaxResult checkVersion(@RequestParam String currentVersion) {
String latestVersion = redisTemplate.opsForValue().get(VERSION_REDIS_KEY);
public AjaxResult checkVersion(@RequestParam String currentVersion, HttpServletRequest request) {
boolean isBeta = canUseBetaVersion(request);
String versionKey = isBeta ? VERSION_BETA_REDIS_KEY : VERSION_REDIS_KEY;
String asarKey = isBeta ? ASAR_URL_BETA_REDIS_KEY : ASAR_URL_REDIS_KEY;
String jarKey = isBeta ? JAR_URL_BETA_REDIS_KEY : JAR_URL_REDIS_KEY;
String notesKey = isBeta ? UPDATE_NOTES_BETA_REDIS_KEY : UPDATE_NOTES_REDIS_KEY;
String latestVersion = redisTemplate.opsForValue().get(versionKey);
boolean needUpdate = compareVersions(currentVersion, latestVersion) < 0;
Map<String, Object> data = new HashMap<>();
data.put("currentVersion", currentVersion);
data.put("latestVersion", latestVersion);
data.put("needUpdate", needUpdate);
data.put("asarUrl", redisTemplate.opsForValue().get(ASAR_URL_REDIS_KEY));
data.put("jarUrl", redisTemplate.opsForValue().get(JAR_URL_REDIS_KEY));
data.put("updateNotes", redisTemplate.opsForValue().get(UPDATE_NOTES_REDIS_KEY));
data.put("asarUrl", redisTemplate.opsForValue().get(asarKey));
data.put("jarUrl", redisTemplate.opsForValue().get(jarKey));
data.put("updateNotes", redisTemplate.opsForValue().get(notesKey));
return AjaxResult.success(data);
}
@@ -54,16 +78,22 @@ public class VersionController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:version:query')")
@GetMapping("/info")
public AjaxResult getVersionInfo() {
String currentVersion = redisTemplate.opsForValue().get(VERSION_REDIS_KEY);
if (StringUtils.isEmpty(currentVersion)) {
currentVersion = "2.0.0";
}
Map<String, Object> data = new HashMap<>();
data.put("currentVersion", currentVersion);
data.put("asarUrl", redisTemplate.opsForValue().get(ASAR_URL_REDIS_KEY));
data.put("jarUrl", redisTemplate.opsForValue().get(JAR_URL_REDIS_KEY));
data.put("updateNotes", redisTemplate.opsForValue().get(UPDATE_NOTES_REDIS_KEY));
Map<String, Object> release = new HashMap<>();
release.put("version", redisTemplate.opsForValue().get(VERSION_REDIS_KEY));
release.put("asarUrl", redisTemplate.opsForValue().get(ASAR_URL_REDIS_KEY));
release.put("jarUrl", redisTemplate.opsForValue().get(JAR_URL_REDIS_KEY));
release.put("updateNotes", redisTemplate.opsForValue().get(UPDATE_NOTES_REDIS_KEY));
Map<String, Object> beta = new HashMap<>();
beta.put("version", redisTemplate.opsForValue().get(VERSION_BETA_REDIS_KEY));
beta.put("asarUrl", redisTemplate.opsForValue().get(ASAR_URL_BETA_REDIS_KEY));
beta.put("jarUrl", redisTemplate.opsForValue().get(JAR_URL_BETA_REDIS_KEY));
beta.put("updateNotes", redisTemplate.opsForValue().get(UPDATE_NOTES_BETA_REDIS_KEY));
data.put("release", release);
data.put("beta", beta);
data.put("updateTime", System.currentTimeMillis());
return AjaxResult.success(data);
@@ -78,25 +108,52 @@ public class VersionController extends BaseController {
public AjaxResult updateVersionInfo(@RequestParam("version") String version,
@RequestParam(value = "asarUrl", required = false) String asarUrl,
@RequestParam(value = "jarUrl", required = false) String jarUrl,
@RequestParam("updateNotes") String updateNotes) {
redisTemplate.opsForValue().set(VERSION_REDIS_KEY, version);
@RequestParam("updateNotes") String updateNotes,
@RequestParam(value = "isBeta", defaultValue = "false") Boolean isBeta) {
String versionKey = isBeta ? VERSION_BETA_REDIS_KEY : VERSION_REDIS_KEY;
String asarKey = isBeta ? ASAR_URL_BETA_REDIS_KEY : ASAR_URL_REDIS_KEY;
String jarKey = isBeta ? JAR_URL_BETA_REDIS_KEY : JAR_URL_REDIS_KEY;
String notesKey = isBeta ? UPDATE_NOTES_BETA_REDIS_KEY : UPDATE_NOTES_REDIS_KEY;
redisTemplate.opsForValue().set(versionKey, version);
if (StringUtils.isNotEmpty(asarUrl)) {
redisTemplate.opsForValue().set(ASAR_URL_REDIS_KEY, asarUrl);
redisTemplate.opsForValue().set(asarKey, asarUrl);
}
if (StringUtils.isNotEmpty(jarUrl)) {
redisTemplate.opsForValue().set(JAR_URL_REDIS_KEY, jarUrl);
redisTemplate.opsForValue().set(jarKey, jarUrl);
}
redisTemplate.opsForValue().set(UPDATE_NOTES_REDIS_KEY, updateNotes);
redisTemplate.opsForValue().set(notesKey, updateNotes);
Map<String, Object> data = new HashMap<>();
data.put("version", version);
data.put("asarUrl", asarUrl);
data.put("jarUrl", jarUrl);
data.put("updateNotes", updateNotes);
data.put("isBeta", isBeta);
data.put("updateTime", System.currentTimeMillis());
return AjaxResult.success(data);
}
private boolean canUseBetaVersion(HttpServletRequest request) {
try {
String token = request.getHeader("Authorization");
if (StringUtils.isEmpty(token)) return false;
if (token.startsWith("Bearer ")) token = token.substring(7);
String username = (String) Jwts.parser()
.setSigningKey(jwtRsaKeyService.getPublicKey())
.parseClaimsJws(token).getBody().get("sub");
ClientAccount account = clientAccountService.selectClientAccountByUsername(username);
if (account == null) return false;
JSONObject perms = JSON.parseObject(account.getPermissions());
return perms != null && perms.getBooleanValue("beta_version");
} catch (Exception e) {
return false;
}
}
/**
* 比较版本号
* @param version1 版本1
@@ -107,8 +164,12 @@ public class VersionController extends BaseController {
if (StringUtils.isEmpty(version1) || StringUtils.isEmpty(version2)) {
return 0;
}
String[] v1Parts = version1.split("\\.");
String[] v2Parts = version2.split("\\.");
String v1 = version1.replace("-beta", "");
String v2 = version2.replace("-beta", "");
String[] v1Parts = v1.split("\\.");
String[] v2Parts = v2.split("\\.");
int maxLength = Math.max(v1Parts.length, v2Parts.length);

View File

@@ -176,7 +176,6 @@ public class ClientMonitorServiceImpl implements IClientMonitorService {
*/
@Override
public Map<String, Object> authenticateClient(String authKey, Map<String, Object> clientInfo) {
Map<String, Object> result = new HashMap<>();
try {
String accessToken = UUID.randomUUID().toString().replace("-", "");
String clientId = (String) clientInfo.get("clientId");
@@ -194,16 +193,18 @@ public class ClientMonitorServiceImpl implements IClientMonitorService {
clientMonitorMapper.updateClientOnlineStatus(clientId, "1");
}
Map<String, Object> result = new HashMap<>();
result.put("success", true);
result.put("accessToken", accessToken);
result.put("tokenType", "Bearer");
result.put("expiresIn", 7200);
result.put("clientId", clientId);
result.put("permissions", null);
return result;
} catch (Exception e) {
throw new RuntimeException("认证失败: " + e.getMessage());
logger.error("认证失败: {}", e.getMessage(), e);
throw new RuntimeException("认证失败", e);
}
return result;
}
private ClientInfo findClientByClientId(String clientId) {
@@ -225,17 +226,22 @@ public class ClientMonitorServiceImpl implements IClientMonitorService {
*/
@Override
public void recordErrorReport(Map<String, Object> errorData) {
ClientErrorReport errorReport = new ClientErrorReport();
errorReport.setClientId((String) errorData.get("clientId"));
errorReport.setErrorType((String) errorData.get("errorType"));
errorReport.setErrorMessage((String) errorData.get("errorMessage"));
errorReport.setStackTrace((String) errorData.get("stackTrace"));
errorReport.setErrorTime(DateUtils.getNowDate());
errorReport.setUsername((String) errorData.get("username"));
errorReport.setOsName((String) errorData.get("osName"));
errorReport.setOsVersion((String) errorData.get("osVersion"));
errorReport.setAppVersion((String) errorData.get("appVersion"));
clientMonitorMapper.insertClientError(errorReport);
try {
ClientErrorReport errorReport = new ClientErrorReport();
errorReport.setClientId((String) errorData.get("clientId"));
errorReport.setErrorType((String) errorData.get("errorType"));
errorReport.setErrorMessage((String) errorData.get("errorMessage"));
errorReport.setStackTrace((String) errorData.get("stackTrace"));
errorReport.setErrorTime(DateUtils.getNowDate());
errorReport.setUsername((String) errorData.get("username"));
errorReport.setOsName((String) errorData.get("osName"));
errorReport.setOsVersion((String) errorData.get("osVersion"));
errorReport.setAppVersion((String) errorData.get("appVersion"));
clientMonitorMapper.insertClientError(errorReport);
} catch (Exception e) {
logger.error("记录错误报告失败: {}", e.getMessage(), e);
throw new RuntimeException("记录错误报告失败", e);
}
}
/**
@@ -246,7 +252,8 @@ public class ClientMonitorServiceImpl implements IClientMonitorService {
try {
String clientId = (String) dataReport.get("clientId");
String dataType = normalizeDataType((String) dataReport.get("dataType"));
String status = (String) dataReport.get("status");
Object statusObj = dataReport.get("status");
String status = statusObj != null ? String.valueOf(statusObj) : "0";
int dataCount = parseInteger(dataReport.get("dataCount"), 1);
ClientDataReport existingReport = clientMonitorMapper.findRecentDataReport(clientId, dataType, status);
@@ -262,11 +269,15 @@ public class ClientMonitorServiceImpl implements IClientMonitorService {
report.setStatus(status);
clientMonitorMapper.insertDataReport(report);
}
if (clientId != null && !clientId.isEmpty()) {
clientMonitorMapper.updateClientOnlineStatus(clientId, "1");
try {
clientMonitorMapper.updateClientOnlineStatus(clientId, "1");
} catch (Exception ignored) {}
}
} catch (Exception e) {
logger.error("记录数据采集报告失败: {}", e.getMessage(), e);
throw new RuntimeException("记录数据采集报告失败", e);
}
}