forked from dyf/fys-Multi-tenant
Compare commits
13 Commits
035b24fedd
...
jingquan
| Author | SHA1 | Date | |
|---|---|---|---|
| ca11ef0e35 | |||
| ef2dc6a6f6 | |||
| dff37b245a | |||
| d7c4d22de3 | |||
| 6a058318f2 | |||
| f2d74b8f17 | |||
| af42a2199c | |||
| aaf142ca67 | |||
| c0dfe36b59 | |||
| c480bda112 | |||
| 8c636d0484 | |||
| 0c474ae1f3 | |||
| b85664900e |
64
fys-admin/src/main/java/com/fuyuanshen/Text.java
Normal file
64
fys-admin/src/main/java/com/fuyuanshen/Text.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package com.fuyuanshen;
|
||||||
|
|
||||||
|
import com.fuyuanshen.equipment.utils.AlibabaTTSUtil;
|
||||||
|
import com.fuyuanshen.equipment.utils.AudioProcessUtil;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: 默苍璃
|
||||||
|
* @date: 2025-12-1518:51
|
||||||
|
*/
|
||||||
|
public class Text {
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
String text = "简述人生观的主要内容。\n" +
|
||||||
|
"人生观的主要内容包括以下三个方面:\n" +
|
||||||
|
"1.人生目的:回答“人为什么活着”的根本问题。它规定了人生的方向,是人生观的核心。\n" +
|
||||||
|
"2.人生态度:回答“人应该怎样活着”的问题。它是指人们通过生活实践形成的对人生问题的一种稳定的心理倾向和基本意图。\n" +
|
||||||
|
"3.人生价值:回答“什么样的人生才有意义”的问题。它是指人的生命及其实践活动对于社会和个人所具有的作用和意义。\n" +
|
||||||
|
"人生目的、人生态度和人生价值相互联系、相辅相成,共同构成一个有机整体。\n" +
|
||||||
|
"人生目的是人生观的核心,它决定人生态度和人生价值的方向;人生态度影响人生目的的实现和人生价值的创造;人生价值是衡量人生观正确与否的尺度。";
|
||||||
|
|
||||||
|
AlibabaTTSUtil alibabaTTSUtil = new AlibabaTTSUtil();
|
||||||
|
AudioProcessUtil audioProcessUtil = new AudioProcessUtil();
|
||||||
|
|
||||||
|
byte[] rawPcmData = alibabaTTSUtil.generateStandardPcmData(text);
|
||||||
|
|
||||||
|
// 使用AudioProcessUtil转换成带头44字节 PCM
|
||||||
|
byte[] pcmData = audioProcessUtil.rawPcmToStandardWav(rawPcmData);
|
||||||
|
|
||||||
|
// String savedPath = audioProcessUtil.saveWavToFile(pcmData, "test_output.wav");
|
||||||
|
// if (savedPath != null) {
|
||||||
|
// log.info("测试文件已保存: {}", savedPath);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 保存WAV文件到本地
|
||||||
|
String savedPath = saveByteArrayToFile(pcmData, "人生观.wav");
|
||||||
|
if (savedPath != null) {
|
||||||
|
System.out.println("WAV文件已保存: " + savedPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static String saveByteArrayToFile(byte[] data, String filename) throws IOException {
|
||||||
|
// 确定保存路径(可以是临时目录或指定目录)
|
||||||
|
String directory = System.getProperty("java.io.tmpdir"); // 使用系统临时目录
|
||||||
|
File dir = new File(directory);
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建完整文件路径
|
||||||
|
File file = new File(dir, filename);
|
||||||
|
|
||||||
|
// 写入文件
|
||||||
|
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||||
|
fos.write(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return file.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -64,4 +64,5 @@ public class AppVideoController extends BaseController {
|
|||||||
public R<String> extract(@RequestParam("file") MultipartFile file) throws Exception {
|
public R<String> extract(@RequestParam("file") MultipartFile file) throws Exception {
|
||||||
return R.ok("Success",audioProcessService.extract(file));
|
return R.ok("Success",audioProcessService.extract(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -227,7 +227,7 @@ public class AppDeviceShareService {
|
|||||||
appDeviceShare.setPermission(bo.getPermission());
|
appDeviceShare.setPermission(bo.getPermission());
|
||||||
appDeviceShare.setCreateBy(userId);
|
appDeviceShare.setCreateBy(userId);
|
||||||
return appDeviceShareMapper.insert(appDeviceShare);
|
return appDeviceShareMapper.insert(appDeviceShare);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int remove(Long[] ids) {
|
public int remove(Long[] ids) {
|
||||||
|
|||||||
@ -10,22 +10,43 @@ import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
|
|||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class MqttConfiguration {
|
public class MqttConfiguration {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MqttPropertiesConfig mqttPropertiesConfig;
|
private MqttPropertiesConfig mqttPropertiesConfig;
|
||||||
/** 创建连接工厂 **/
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建连接工厂
|
||||||
|
**/
|
||||||
@Bean
|
@Bean
|
||||||
public MqttPahoClientFactory mqttPahoClientFactory(){
|
public MqttPahoClientFactory mqttPahoClientFactory() {
|
||||||
DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
|
DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
|
||||||
MqttConnectOptions options = new MqttConnectOptions();
|
MqttConnectOptions options = new MqttConnectOptions();
|
||||||
options.setCleanSession(true); //设置新会话
|
options.setCleanSession(true); // 设置新会话
|
||||||
options.setUserName(mqttPropertiesConfig.getUsername());
|
|
||||||
options.setPassword(mqttPropertiesConfig.getPassword().toCharArray());
|
// 修复用户名为null时的空指针异常
|
||||||
options.setServerURIs(new String[]{mqttPropertiesConfig.getUrl()});
|
String username = mqttPropertiesConfig.getUsername();
|
||||||
|
if (username != null) {
|
||||||
|
options.setUserName(username);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修复密码为null时的空指针异常
|
||||||
|
String password = mqttPropertiesConfig.getPassword();
|
||||||
|
if (password != null) {
|
||||||
|
options.setPassword(password.toCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修复URL为null时的空指针异常
|
||||||
|
String url = mqttPropertiesConfig.getUrl();
|
||||||
|
if (url != null) {
|
||||||
|
options.setServerURIs(new String[]{url});
|
||||||
|
}
|
||||||
|
|
||||||
options.setAutomaticReconnect(true); // 启用自动重连
|
options.setAutomaticReconnect(true); // 启用自动重连
|
||||||
options.setConnectionTimeout(10); // 设置连接超时时间
|
options.setConnectionTimeout(10); // 设置连接超时时间
|
||||||
options.setKeepAliveInterval(60); // 设置心跳间隔
|
options.setKeepAliveInterval(60); // 设置心跳间隔
|
||||||
factory.setConnectionOptions(options);
|
factory.setConnectionOptions(options);
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -39,8 +39,14 @@ public class MqttInboundConfiguration {
|
|||||||
public MessageProducer messageProducer(){
|
public MessageProducer messageProducer(){
|
||||||
// 生成一个不重复的随机数
|
// 生成一个不重复的随机数
|
||||||
String clientId = mqttPropertiesConfig.getSubClientId() + "_" + UUID.fastUUID();
|
String clientId = mqttPropertiesConfig.getSubClientId() + "_" + UUID.fastUUID();
|
||||||
|
// 修复URL为null时的空指针异常
|
||||||
|
String url = mqttPropertiesConfig.getUrl();
|
||||||
|
if (url == null) {
|
||||||
|
throw new IllegalStateException("MQTT服务器URL未配置");
|
||||||
|
}
|
||||||
|
|
||||||
MqttPahoMessageDrivenChannelAdapter mqttPahoMessageDrivenChannelAdapter = new MqttPahoMessageDrivenChannelAdapter(
|
MqttPahoMessageDrivenChannelAdapter mqttPahoMessageDrivenChannelAdapter = new MqttPahoMessageDrivenChannelAdapter(
|
||||||
mqttPropertiesConfig.getUrl(),
|
url,
|
||||||
clientId,
|
clientId,
|
||||||
mqttPahoClientFactory,
|
mqttPahoClientFactory,
|
||||||
mqttPropertiesConfig.getSubTopic().split(",")
|
mqttPropertiesConfig.getSubTopic().split(",")
|
||||||
|
|||||||
@ -15,11 +15,14 @@ import org.springframework.messaging.MessageHandler;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MqttOutboundConfiguration {
|
public class MqttOutboundConfiguration {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MqttPropertiesConfig mqttPropertiesConfig;
|
private MqttPropertiesConfig mqttPropertiesConfig;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MqttPahoClientFactory mqttPahoClientFactory;
|
private MqttPahoClientFactory mqttPahoClientFactory;
|
||||||
|
|
||||||
|
|
||||||
// 消息通道
|
// 消息通道
|
||||||
@Bean
|
@Bean
|
||||||
public MessageChannel mqttOutboundChannel(){
|
public MessageChannel mqttOutboundChannel(){
|
||||||
@ -32,8 +35,14 @@ public class MqttOutboundConfiguration {
|
|||||||
@ServiceActivator(inputChannel = "mqttOutboundChannel") // 指定处理器针对哪个通道的消息进行处理
|
@ServiceActivator(inputChannel = "mqttOutboundChannel") // 指定处理器针对哪个通道的消息进行处理
|
||||||
public MessageHandler mqttOutboundMessageHandler(){
|
public MessageHandler mqttOutboundMessageHandler(){
|
||||||
String clientId = mqttPropertiesConfig.getPubClientId() + "_" + UUID.fastUUID();
|
String clientId = mqttPropertiesConfig.getPubClientId() + "_" + UUID.fastUUID();
|
||||||
|
// 修复URL为null时的空指针异常
|
||||||
|
String url = mqttPropertiesConfig.getUrl();
|
||||||
|
if (url == null) {
|
||||||
|
throw new IllegalStateException("MQTT服务器URL未配置");
|
||||||
|
}
|
||||||
|
|
||||||
MqttPahoMessageHandler mqttPahoMessageHandler = new MqttPahoMessageHandler(
|
MqttPahoMessageHandler mqttPahoMessageHandler = new MqttPahoMessageHandler(
|
||||||
mqttPropertiesConfig.getUrl(),
|
url,
|
||||||
clientId,
|
clientId,
|
||||||
mqttPahoClientFactory
|
mqttPahoClientFactory
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.fuyuanshen.global.mqtt.constants;
|
package com.fuyuanshen.global.mqtt.constants;
|
||||||
|
|
||||||
public class DeviceRedisKeyConstants {
|
public class DeviceRedisKeyConstants {
|
||||||
|
|
||||||
public static final String DEVICE_KEY_PREFIX = "device:";
|
public static final String DEVICE_KEY_PREFIX = "device:";
|
||||||
// 设备上报状态
|
// 设备上报状态
|
||||||
public static final String DEVICE_STATUS_KEY_PREFIX = ":status";
|
public static final String DEVICE_STATUS_KEY_PREFIX = ":status";
|
||||||
@ -52,4 +53,5 @@ public class DeviceRedisKeyConstants {
|
|||||||
* 告警信息
|
* 告警信息
|
||||||
*/
|
*/
|
||||||
public static final String DEVICE_ALARM_MESSAGE_KEY_PREFIX = ":alarmMessage";
|
public static final String DEVICE_ALARM_MESSAGE_KEY_PREFIX = ":alarmMessage";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,6 @@ public class LightingCommandTypeConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String SEND_MESSAGE = "Light_6";
|
public static final String SEND_MESSAGE = "Light_6";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报警模式
|
* 报警模式
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -57,12 +57,12 @@ public class BjqAlarmRule implements MqttMessageRule {
|
|||||||
if (StringUtils.isNotBlank(convertValue)) {
|
if (StringUtils.isNotBlank(convertValue)) {
|
||||||
// 将设备状态信息存储到Redis中
|
// 将设备状态信息存储到Redis中
|
||||||
String deviceRedisKey = GlobalConstants.GLOBAL_REDIS_KEY + DeviceRedisKeyConstants.DEVICE_KEY_PREFIX + context.getDeviceImei() + DEVICE_ALARM_KEY_PREFIX;
|
String deviceRedisKey = GlobalConstants.GLOBAL_REDIS_KEY + DeviceRedisKeyConstants.DEVICE_KEY_PREFIX + context.getDeviceImei() + DEVICE_ALARM_KEY_PREFIX;
|
||||||
String sendMessageIng = GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + context.getDeviceImei() + ":messageSending";
|
String sendMessageIng = GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + context.getDeviceImei() + ":messageSending";
|
||||||
if ("1".equals(convertValue)) {
|
if ("1".equals(convertValue)) {
|
||||||
RedisUtils.setCacheObject(sendMessageIng, "1", Duration.ofDays(1));
|
RedisUtils.setCacheObject(sendMessageIng, "1", Duration.ofDays(1));
|
||||||
// 存储到Redis
|
// 存储到Redis
|
||||||
RedisUtils.setCacheObject(deviceRedisKey, "1");
|
RedisUtils.setCacheObject(deviceRedisKey, "1");
|
||||||
}else if ("0".equals(convertValue)){
|
} else if ("0".equals(convertValue)) {
|
||||||
RedisUtils.deleteObject(sendMessageIng);
|
RedisUtils.deleteObject(sendMessageIng);
|
||||||
RedisUtils.deleteObject(deviceRedisKey);
|
RedisUtils.deleteObject(deviceRedisKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,5 +71,4 @@ public class BjqLaserModeSettingsRule implements MqttMessageRule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,7 @@ public class BjqModeRule implements MqttMessageRule {
|
|||||||
return LightingCommandTypeConstants.LIGHT_MODE;
|
return LightingCommandTypeConstants.LIGHT_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(MqttRuleContext context) {
|
public void execute(MqttRuleContext context) {
|
||||||
String functionAccess = FUNCTION_ACCESS_KEY + context.getDeviceImei();
|
String functionAccess = FUNCTION_ACCESS_KEY + context.getDeviceImei();
|
||||||
|
|||||||
@ -1,32 +1,18 @@
|
|||||||
package com.fuyuanshen.global.mqtt.rule.bjq;
|
package com.fuyuanshen.global.mqtt.rule.bjq;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.fuyuanshen.common.core.constant.GlobalConstants;
|
|
||||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
|
||||||
import com.fuyuanshen.common.json.utils.JsonUtils;
|
|
||||||
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
||||||
import com.fuyuanshen.equipment.utils.map.GetAddressFromLatUtil;
|
|
||||||
import com.fuyuanshen.equipment.utils.map.LngLonUtil;
|
|
||||||
import com.fuyuanshen.global.mqtt.base.MqttMessageRule;
|
import com.fuyuanshen.global.mqtt.base.MqttMessageRule;
|
||||||
import com.fuyuanshen.global.mqtt.base.MqttRuleContext;
|
import com.fuyuanshen.global.mqtt.base.MqttRuleContext;
|
||||||
import com.fuyuanshen.global.mqtt.config.MqttGateway;
|
import com.fuyuanshen.global.mqtt.config.MqttGateway;
|
||||||
import com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants;
|
|
||||||
import com.fuyuanshen.global.mqtt.constants.LightingCommandTypeConstants;
|
import com.fuyuanshen.global.mqtt.constants.LightingCommandTypeConstants;
|
||||||
import com.fuyuanshen.global.mqtt.constants.MqttConstants;
|
|
||||||
import com.fuyuanshen.global.mqtt.listener.domain.FunctionAccessStatus;
|
import com.fuyuanshen.global.mqtt.listener.domain.FunctionAccessStatus;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
import static com.fuyuanshen.common.core.constant.GlobalConstants.FUNCTION_ACCESS_KEY;
|
import static com.fuyuanshen.common.core.constant.GlobalConstants.FUNCTION_ACCESS_KEY;
|
||||||
import static com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定位数据命令处理
|
* 定位数据命令处理
|
||||||
@ -55,4 +41,5 @@ public class BjqPersonnelInfoDataRule implements MqttMessageRule {
|
|||||||
RedisUtils.setCacheObject(functionAccess, FunctionAccessStatus.FAILED.getCode(), Duration.ofSeconds(30));
|
RedisUtils.setCacheObject(functionAccess, FunctionAccessStatus.FAILED.getCode(), Duration.ofSeconds(30));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,11 +27,12 @@ public class MqttMessageConsumer {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceMapper deviceMapper;
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
// 创建两个线程池:一个用于消息获取,一个用于业务处理
|
// 创建两个线程池:一个用于消息获取,一个用于业务处理
|
||||||
private ExecutorService messageConsumerPool = Executors.newFixedThreadPool(3);
|
private ExecutorService messageConsumerPool = Executors.newFixedThreadPool(3);
|
||||||
private ExecutorService messageProcessorPool = Executors.newFixedThreadPool(10);
|
private ExecutorService messageProcessorPool = Executors.newFixedThreadPool(10);
|
||||||
|
|
||||||
|
|
||||||
// 初始化方法,启动消息监听
|
// 初始化方法,启动消息监听
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void start() {
|
public void start() {
|
||||||
@ -130,4 +131,5 @@ public class MqttMessageConsumer {
|
|||||||
log.error("业务处理线程 {} 处理消息时发生错误: {}", threadName, message, e);
|
log.error("业务处理线程 {} 处理消息时发生错误: {}", threadName, message, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,8 @@ public class OnlineStatusTask {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceMapper deviceMapper;
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
|
|
||||||
// 使用cron表达式,每分钟的第0秒执行
|
// 使用cron表达式,每分钟的第0秒执行
|
||||||
@Scheduled(cron = "0 */3 * * * ?")
|
@Scheduled(cron = "0 */3 * * * ?")
|
||||||
public void cronTask() {
|
public void cronTask() {
|
||||||
@ -37,4 +39,5 @@ public class OnlineStatusTask {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,4 +157,4 @@ public class CaptchaController {
|
|||||||
return captchaVo;
|
return captchaVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -98,6 +98,7 @@ public class DeviceControlCenterController extends BaseController {
|
|||||||
return R.ok(appDeviceService.getDeviceInfo(deviceMac));
|
return R.ok(appDeviceService.getDeviceInfo(deviceMac));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指令下发记录
|
* 指令下发记录
|
||||||
*/
|
*/
|
||||||
@ -106,6 +107,7 @@ public class DeviceControlCenterController extends BaseController {
|
|||||||
return appDeviceService.getInstructionRecord(dto, pageQuery);
|
return appDeviceService.getInstructionRecord(dto, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -59,6 +59,7 @@ public class DeviceFenceAccessRecordController extends BaseController {
|
|||||||
ExcelUtil.exportExcel(list, "围栏进出记录", DeviceFenceAccessRecordVo.class, response);
|
ExcelUtil.exportExcel(list, "围栏进出记录", DeviceFenceAccessRecordVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取围栏进出记录详细信息
|
* 获取围栏进出记录详细信息
|
||||||
*
|
*
|
||||||
|
|||||||
@ -103,6 +103,7 @@ public class DeviceGeoFenceController extends BaseController {
|
|||||||
return toAjax(deviceGeoFenceService.updateByBo(bo));
|
return toAjax(deviceGeoFenceService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除电子围栏
|
* 删除电子围栏
|
||||||
*
|
*
|
||||||
@ -130,6 +131,7 @@ public class DeviceGeoFenceController extends BaseController {
|
|||||||
return ResponseEntity.ok(response);
|
return ResponseEntity.ok(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加电子围栏终端
|
* 添加电子围栏终端
|
||||||
*
|
*
|
||||||
|
|||||||
@ -739,6 +739,7 @@ public class DeviceXinghanBizService {
|
|||||||
device.setCreateByName(loginUser.getNickname());
|
device.setCreateByName(loginUser.getNickname());
|
||||||
device.setTypeName(deviceTypes.getTypeName());
|
device.setTypeName(deviceTypes.getTypeName());
|
||||||
device.setDeviceType(deviceTypes.getId());
|
device.setDeviceType(deviceTypes.getId());
|
||||||
|
device.setDevicePic(deviceTypes.getDevicePic());
|
||||||
if (device.getDeviceImei() != null) {
|
if (device.getDeviceImei() != null) {
|
||||||
device.setPubTopic("A/" + device.getDeviceImei());
|
device.setPubTopic("A/" + device.getDeviceImei());
|
||||||
device.setSubTopic("B/" + device.getDeviceImei());
|
device.setSubTopic("B/" + device.getDeviceImei());
|
||||||
|
|||||||
@ -77,4 +77,9 @@ public interface SystemConstants {
|
|||||||
*/
|
*/
|
||||||
String ROOT_DEPT_ANCESTORS = "0";
|
String ROOT_DEPT_ANCESTORS = "0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单ID
|
||||||
|
*/
|
||||||
|
public static final Long RESTRICTED_MENU_ID = 102L;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,8 +39,8 @@ public class EncryptUtilsTest {
|
|||||||
loginBody.setClientId("e5cd7e4891bf95d1d19206ce24a7b32e");
|
loginBody.setClientId("e5cd7e4891bf95d1d19206ce24a7b32e");
|
||||||
loginBody.setGrantType("password");
|
loginBody.setGrantType("password");
|
||||||
loginBody.setTenantId("894078");
|
loginBody.setTenantId("894078");
|
||||||
loginBody.setCode("0");
|
loginBody.setCode("15");
|
||||||
loginBody.setUuid("1d6615668c7f410da77c4e002c601073");
|
loginBody.setUuid("28ecf3d396ce4e6db8eb414992235fad");
|
||||||
// loginBody.setUsername("admin");
|
// loginBody.setUsername("admin");
|
||||||
// loginBody.setPassword("admin123");
|
// loginBody.setPassword("admin123");
|
||||||
loginBody.setUsername("dyf");
|
loginBody.setUsername("dyf");
|
||||||
|
|||||||
@ -74,6 +74,7 @@ public class ExcelUtil {
|
|||||||
return listener.getExcelResult();
|
return listener.getExcelResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
*
|
*
|
||||||
@ -92,6 +93,7 @@ public class ExcelUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
*
|
*
|
||||||
@ -174,6 +176,7 @@ public class ExcelUtil {
|
|||||||
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, OutputStream os, List<DropDownOptions> options) {
|
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, OutputStream os, List<DropDownOptions> options) {
|
||||||
exportExcel(list, sheetName, clazz, false, os, options);
|
exportExcel(list, sheetName, clazz, false, os, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
@ -187,13 +190,13 @@ public class ExcelUtil {
|
|||||||
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, boolean merge,
|
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, boolean merge,
|
||||||
OutputStream os, List<DropDownOptions> options) {
|
OutputStream os, List<DropDownOptions> options) {
|
||||||
ExcelWriterSheetBuilder builder = FastExcel.write(os, clazz)
|
ExcelWriterSheetBuilder builder = FastExcel.write(os, clazz)
|
||||||
.autoCloseStream(false)
|
.autoCloseStream(false)
|
||||||
// 自动适配
|
// 自动适配
|
||||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||||
// 大数值自动转换 防止失真
|
// 大数值自动转换 防止失真
|
||||||
.registerConverter(new ExcelBigNumberConvert())
|
.registerConverter(new ExcelBigNumberConvert())
|
||||||
.registerWriteHandler(new DataWriteHandler(clazz))
|
.registerWriteHandler(new DataWriteHandler(clazz))
|
||||||
.sheet(sheetName);
|
.sheet(sheetName);
|
||||||
if (merge) {
|
if (merge) {
|
||||||
// 合并处理器
|
// 合并处理器
|
||||||
builder.registerWriteHandler(new CellMergeStrategy(list, true));
|
builder.registerWriteHandler(new CellMergeStrategy(list, true));
|
||||||
@ -203,6 +206,7 @@ public class ExcelUtil {
|
|||||||
builder.doWrite(list);
|
builder.doWrite(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单表多数据模板导出 模板格式为 {.属性}
|
* 单表多数据模板导出 模板格式为 {.属性}
|
||||||
*
|
*
|
||||||
@ -238,12 +242,12 @@ public class ExcelUtil {
|
|||||||
public static <T> void exportTemplate(List<T> data, String templatePath, OutputStream os) {
|
public static <T> void exportTemplate(List<T> data, String templatePath, OutputStream os) {
|
||||||
ClassPathResource templateResource = new ClassPathResource(templatePath);
|
ClassPathResource templateResource = new ClassPathResource(templatePath);
|
||||||
ExcelWriter excelWriter = FastExcel.write(os)
|
ExcelWriter excelWriter = FastExcel.write(os)
|
||||||
.withTemplate(templateResource.getStream())
|
.withTemplate(templateResource.getStream())
|
||||||
.autoCloseStream(false)
|
.autoCloseStream(false)
|
||||||
// 大数值自动转换 防止失真
|
// 大数值自动转换 防止失真
|
||||||
.registerConverter(new ExcelBigNumberConvert())
|
.registerConverter(new ExcelBigNumberConvert())
|
||||||
.registerWriteHandler(new DataWriteHandler(data.get(0).getClass()))
|
.registerWriteHandler(new DataWriteHandler(data.get(0).getClass()))
|
||||||
.build();
|
.build();
|
||||||
WriteSheet writeSheet = FastExcel.writerSheet().build();
|
WriteSheet writeSheet = FastExcel.writerSheet().build();
|
||||||
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
||||||
// 单表多数据导出 模板格式为 {.属性}
|
// 单表多数据导出 模板格式为 {.属性}
|
||||||
@ -311,11 +315,11 @@ public class ExcelUtil {
|
|||||||
public static void exportTemplateMultiList(Map<String, Object> data, String templatePath, OutputStream os) {
|
public static void exportTemplateMultiList(Map<String, Object> data, String templatePath, OutputStream os) {
|
||||||
ClassPathResource templateResource = new ClassPathResource(templatePath);
|
ClassPathResource templateResource = new ClassPathResource(templatePath);
|
||||||
ExcelWriter excelWriter = FastExcel.write(os)
|
ExcelWriter excelWriter = FastExcel.write(os)
|
||||||
.withTemplate(templateResource.getStream())
|
.withTemplate(templateResource.getStream())
|
||||||
.autoCloseStream(false)
|
.autoCloseStream(false)
|
||||||
// 大数值自动转换 防止失真
|
// 大数值自动转换 防止失真
|
||||||
.registerConverter(new ExcelBigNumberConvert())
|
.registerConverter(new ExcelBigNumberConvert())
|
||||||
.build();
|
.build();
|
||||||
WriteSheet writeSheet = FastExcel.writerSheet().build();
|
WriteSheet writeSheet = FastExcel.writerSheet().build();
|
||||||
for (Map.Entry<String, Object> map : data.entrySet()) {
|
for (Map.Entry<String, Object> map : data.entrySet()) {
|
||||||
// 设置列表后续还有数据
|
// 设置列表后续还有数据
|
||||||
@ -342,11 +346,11 @@ public class ExcelUtil {
|
|||||||
public static void exportTemplateMultiSheet(List<Map<String, Object>> data, String templatePath, OutputStream os) {
|
public static void exportTemplateMultiSheet(List<Map<String, Object>> data, String templatePath, OutputStream os) {
|
||||||
ClassPathResource templateResource = new ClassPathResource(templatePath);
|
ClassPathResource templateResource = new ClassPathResource(templatePath);
|
||||||
ExcelWriter excelWriter = FastExcel.write(os)
|
ExcelWriter excelWriter = FastExcel.write(os)
|
||||||
.withTemplate(templateResource.getStream())
|
.withTemplate(templateResource.getStream())
|
||||||
.autoCloseStream(false)
|
.autoCloseStream(false)
|
||||||
// 大数值自动转换 防止失真
|
// 大数值自动转换 防止失真
|
||||||
.registerConverter(new ExcelBigNumberConvert())
|
.registerConverter(new ExcelBigNumberConvert())
|
||||||
.build();
|
.build();
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
WriteSheet writeSheet = FastExcel.writerSheet(i).build();
|
WriteSheet writeSheet = FastExcel.writerSheet(i).build();
|
||||||
for (Map.Entry<String, Object> map : data.get(i).entrySet()) {
|
for (Map.Entry<String, Object> map : data.get(i).entrySet()) {
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.fuyuanshen.common.core.domain.R;
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
import com.fuyuanshen.common.core.domain.model.LoginUser;
|
import com.fuyuanshen.common.core.domain.model.LoginUser;
|
||||||
import com.fuyuanshen.common.core.utils.file.FileUtil;
|
import com.fuyuanshen.common.core.utils.file.FileUtil;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||||
import com.fuyuanshen.common.web.core.BaseController;
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
|
|||||||
@ -41,6 +41,7 @@ public class DeviceRepairRecordsController extends BaseController {
|
|||||||
|
|
||||||
private final IDeviceRepairRecordsService deviceRepairRecordsService;
|
private final IDeviceRepairRecordsService deviceRepairRecordsService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备维修记录列表
|
* 查询设备维修记录列表
|
||||||
*/
|
*/
|
||||||
@ -52,6 +53,7 @@ public class DeviceRepairRecordsController extends BaseController {
|
|||||||
return deviceRepairRecordsService.queryPageList(criteria, page);
|
return deviceRepairRecordsService.queryPageList(criteria, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出设备维修记录列表
|
* 导出设备维修记录列表
|
||||||
*/
|
*/
|
||||||
@ -63,6 +65,7 @@ public class DeviceRepairRecordsController extends BaseController {
|
|||||||
ExcelUtil.exportExcel(list, "设备维修记录", DeviceRepairRecordsVo.class, response);
|
ExcelUtil.exportExcel(list, "设备维修记录", DeviceRepairRecordsVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备维修记录详细信息
|
* 获取设备维修记录详细信息
|
||||||
*
|
*
|
||||||
@ -75,6 +78,7 @@ public class DeviceRepairRecordsController extends BaseController {
|
|||||||
return R.ok(deviceRepairRecordsService.queryById(recordId));
|
return R.ok(deviceRepairRecordsService.queryById(recordId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增设备维修记录
|
* 新增设备维修记录
|
||||||
*/
|
*/
|
||||||
@ -86,6 +90,7 @@ public class DeviceRepairRecordsController extends BaseController {
|
|||||||
return toAjax(deviceRepairRecordsService.insertByBo(bo));
|
return toAjax(deviceRepairRecordsService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设备维修记录
|
* 修改设备维修记录
|
||||||
*/
|
*/
|
||||||
@ -109,4 +114,5 @@ public class DeviceRepairRecordsController extends BaseController {
|
|||||||
@PathVariable Long[] recordIds) {
|
@PathVariable Long[] recordIds) {
|
||||||
return toAjax(deviceRepairRecordsService.deleteWithValidByIds(List.of(recordIds), true));
|
return toAjax(deviceRepairRecordsService.deleteWithValidByIds(List.of(recordIds), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,7 +51,7 @@ public class DeviceTypeController {
|
|||||||
// @Log("新增设备类型")
|
// @Log("新增设备类型")
|
||||||
@Operation(summary = "新增设备类型")
|
@Operation(summary = "新增设备类型")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public R<Void> createDeviceType(@Validated @RequestBody DeviceType resources) {
|
public R<Void> createDeviceType(@Validated @ModelAttribute DeviceTypeForm resources) throws IOException {
|
||||||
deviceTypeService.create(resources);
|
deviceTypeService.create(resources);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
@ -59,7 +60,7 @@ public class DeviceTypeController {
|
|||||||
// @Log("修改设备类型")
|
// @Log("修改设备类型")
|
||||||
@Operation(summary = "修改设备类型")
|
@Operation(summary = "修改设备类型")
|
||||||
@PutMapping(value = "/update")
|
@PutMapping(value = "/update")
|
||||||
public R<Void> updateDeviceType(@Validated @RequestBody DeviceTypeForm resources) {
|
public R<Void> updateDeviceType(@Validated @ModelAttribute DeviceTypeForm resources) throws IOException {
|
||||||
deviceTypeService.update(resources);
|
deviceTypeService.update(resources);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
@ -79,7 +80,6 @@ public class DeviceTypeController {
|
|||||||
public R<DeviceType> getCommunicationMode(@Parameter(name = "设备类型ID", required = true) Long id) {
|
public R<DeviceType> getCommunicationMode(@Parameter(name = "设备类型ID", required = true) Long id) {
|
||||||
DeviceType communicationMode = deviceTypeService.getCommunicationMode(id);
|
DeviceType communicationMode = deviceTypeService.getCommunicationMode(id);
|
||||||
return R.ok(communicationMode);
|
return R.ok(communicationMode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class TrackServiceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询轨迹服务列表
|
* 查询轨迹服务列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:trackService:list")
|
// @SaCheckPermission("equipment:trackService:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<TrackServiceVo> list(TrackServiceBo bo, PageQuery pageQuery) {
|
public TableDataInfo<TrackServiceVo> list(TrackServiceBo bo, PageQuery pageQuery) {
|
||||||
return trackServiceService.queryPageList(bo, pageQuery);
|
return trackServiceService.queryPageList(bo, pageQuery);
|
||||||
@ -53,7 +53,7 @@ public class TrackServiceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 轨迹服务列表
|
* 轨迹服务列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:trackService:export")
|
// @SaCheckPermission("equipment:trackService:export")
|
||||||
@Log(title = "轨迹服务", businessType = BusinessType.EXPORT)
|
@Log(title = "轨迹服务", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(TrackServiceBo bo, HttpServletResponse response) {
|
public void export(TrackServiceBo bo, HttpServletResponse response) {
|
||||||
@ -75,7 +75,7 @@ public class TrackServiceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 新增轨迹服务
|
* 新增轨迹服务
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:trackService:add")
|
// @SaCheckPermission("equipment:trackService:add")
|
||||||
@Log(title = "轨迹服务", businessType = BusinessType.INSERT)
|
@Log(title = "轨迹服务", businessType = BusinessType.INSERT)
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TrackServiceBo bo) {
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody TrackServiceBo bo) {
|
||||||
@ -85,7 +85,7 @@ public class TrackServiceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 修改轨迹服务
|
* 修改轨迹服务
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:trackService:edit")
|
// @SaCheckPermission("equipment:trackService:edit")
|
||||||
@Log(title = "轨迹服务", businessType = BusinessType.UPDATE)
|
@Log(title = "轨迹服务", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping(value = "/update")
|
@PostMapping(value = "/update")
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TrackServiceBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TrackServiceBo bo) {
|
||||||
@ -97,7 +97,7 @@ public class TrackServiceController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param ids 主键串
|
* @param ids 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:trackService:remove")
|
// @SaCheckPermission("equipment:trackService:remove")
|
||||||
@Log(title = "轨迹服务", businessType = BusinessType.DELETE)
|
@Log(title = "轨迹服务", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
|||||||
@ -85,5 +85,8 @@ public class DeviceType extends TenantEntity {
|
|||||||
@Schema(title = "型号字典用于PC页面跳转")
|
@Schema(title = "型号字典用于PC页面跳转")
|
||||||
private String pcModelDictionary;
|
private String pcModelDictionary;
|
||||||
|
|
||||||
|
@Schema(title = "设备图片")
|
||||||
|
private String devicePic;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.fuyuanshen.equipment.domain.form;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 设备类型
|
* @Description: 设备类型
|
||||||
@ -48,5 +49,10 @@ public class DeviceTypeForm {
|
|||||||
*/
|
*/
|
||||||
@Schema(title = "型号字典用于PC页面跳转")
|
@Schema(title = "型号字典用于PC页面跳转")
|
||||||
private String pcModelDictionary;
|
private String pcModelDictionary;
|
||||||
|
@Schema(title = "设备图片")
|
||||||
|
private String devicePic;
|
||||||
|
|
||||||
|
@Schema(title = "设备图片")
|
||||||
|
private MultipartFile file;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.fuyuanshen.equipment.domain.vo;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
@ -60,6 +61,13 @@ public class DeviceFenceAccessRecordVo implements Serializable {
|
|||||||
@ExcelProperty(value = "设备名称")
|
@ExcelProperty(value = "设备名称")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "事件时间")
|
||||||
|
@ColumnWidth(120)
|
||||||
|
private String eventTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
*/
|
*/
|
||||||
@ -76,27 +84,21 @@ public class DeviceFenceAccessRecordVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 纬度
|
* 纬度
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "纬度")
|
// @ExcelProperty(value = "纬度")
|
||||||
private Double latitude;
|
private Double latitude;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 经度
|
* 经度
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "经度")
|
// @ExcelProperty(value = "经度")
|
||||||
private Double longitude;
|
private Double longitude;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定位精度
|
* 定位精度
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "定位精度")
|
// @ExcelProperty(value = "定位精度")
|
||||||
private Long accuracy;
|
private Long accuracy;
|
||||||
|
|
||||||
/**
|
|
||||||
* 事件时间
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "事件时间")
|
|
||||||
private Date eventTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件地址
|
* 事件地址
|
||||||
*/
|
*/
|
||||||
@ -106,8 +108,7 @@ public class DeviceFenceAccessRecordVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 记录创建时间
|
* 记录创建时间
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "记录创建时间")
|
// @ExcelProperty(value = "记录创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
package com.fuyuanshen.equipment.domain.vo;
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
import java.util.Date;
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||||
import com.fuyuanshen.equipment.domain.DeviceRepairRecords;
|
import com.fuyuanshen.equipment.domain.DeviceRepairRecords;
|
||||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
|
||||||
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
|
||||||
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -34,31 +32,39 @@ public class DeviceRepairRecordsVo extends TenantEntity implements Serializable
|
|||||||
/**
|
/**
|
||||||
* 维修记录ID
|
* 维修记录ID
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "维修记录ID")
|
// @ExcelProperty(value = "维修记录ID")
|
||||||
private Long recordId;
|
private Long recordId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备ID
|
* 设备ID
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "设备ID")
|
// @ExcelProperty(value = "设备ID")
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修时间
|
* 维修时间
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "维修时间")
|
@ExcelProperty(value = "维修时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ColumnWidth(value = 20)
|
||||||
private Date repairTime;
|
private Date repairTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修部位
|
* 损坏部位
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "维修部位")
|
@ExcelProperty(value = "损坏部位")
|
||||||
private String repairPart;
|
private String repairPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修原因
|
* 损坏原因
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "维修原因")
|
@ExcelProperty(value = "损坏原因")
|
||||||
private String repairReason;
|
private String repairReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,12 +72,8 @@ public class DeviceRepairRecordsVo extends TenantEntity implements Serializable
|
|||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "维修人员")
|
@ExcelProperty(value = "维修人员")
|
||||||
private String repairPerson;
|
private String repairPerson;
|
||||||
/**
|
|
||||||
* 维修人员
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "设备名称")
|
|
||||||
private String deviceName;
|
|
||||||
|
|
||||||
private List<DeviceRepairImagesVo> images;
|
private List<DeviceRepairImagesVo> images;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -12,6 +12,7 @@ import com.fuyuanshen.equipment.domain.DeviceType;
|
|||||||
import com.fuyuanshen.equipment.domain.dto.DeviceExcelImportDTO;
|
import com.fuyuanshen.equipment.domain.dto.DeviceExcelImportDTO;
|
||||||
import com.fuyuanshen.equipment.domain.dto.ImportResult;
|
import com.fuyuanshen.equipment.domain.dto.ImportResult;
|
||||||
import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
||||||
|
import com.fuyuanshen.equipment.domain.form.DeviceTypeForm;
|
||||||
import com.fuyuanshen.equipment.handler.ImageWriteHandler;
|
import com.fuyuanshen.equipment.handler.ImageWriteHandler;
|
||||||
import com.fuyuanshen.system.domain.vo.SysOssVo;
|
import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -437,8 +438,10 @@ public class UploadDeviceDataListener implements ReadListener<DeviceExcelImportD
|
|||||||
newDeviceType.setAppModelDictionary(originalDto.getAppModelDictionary());
|
newDeviceType.setAppModelDictionary(originalDto.getAppModelDictionary());
|
||||||
newDeviceType.setPcModelDictionary(originalDto.getPcModelDictionary());
|
newDeviceType.setPcModelDictionary(originalDto.getPcModelDictionary());
|
||||||
|
|
||||||
|
DeviceTypeForm deviceTypeForm = new DeviceTypeForm();
|
||||||
|
BeanUtil.copyProperties(newDeviceType, deviceTypeForm, true);
|
||||||
// 创建新的设备类型
|
// 创建新的设备类型
|
||||||
params.getDeviceTypeService().create(newDeviceType);
|
params.getDeviceTypeService().create(deviceTypeForm);
|
||||||
|
|
||||||
// 重新查询确保获取到正确的ID
|
// 重新查询确保获取到正确的ID
|
||||||
deviceType = params.getDeviceTypeService().queryByName(device.getTypeName());
|
deviceType = params.getDeviceTypeService().queryByName(device.getTypeName());
|
||||||
|
|||||||
@ -28,17 +28,19 @@ public interface DeviceFenceAccessRecordMapper extends BaseMapperPlus<DeviceFenc
|
|||||||
*/
|
*/
|
||||||
Page<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(Page<DeviceFenceAccessRecord> page, @Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper);
|
Page<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(Page<DeviceFenceAccessRecord> page, @Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper);
|
||||||
|
|
||||||
List<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(@Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper,@Param("fenceName") String fenceName);
|
List<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(@Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper, @Param("fenceName") String fenceName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询围栏进出记录列表(纯XML形式)
|
* 分页查询围栏进出记录列表(纯XML形式)
|
||||||
*
|
*
|
||||||
* @param page 分页参数
|
* @param page 分页参数
|
||||||
* @param bo 查询条件
|
* @param bo 查询条件
|
||||||
* @return 围栏进出记录分页列表
|
* @return 围栏进出记录分页列表
|
||||||
*/
|
*/
|
||||||
Page<DeviceFenceAccessRecordVo> selectVoPageByXml(Page<DeviceFenceAccessRecord> page, @Param("bo") DeviceFenceAccessRecordBo bo);
|
Page<DeviceFenceAccessRecordVo> selectVoPageByXml(Page<DeviceFenceAccessRecord> page, @Param("bo") DeviceFenceAccessRecordBo bo);
|
||||||
|
|
||||||
|
List<DeviceFenceAccessRecordVo> selectVoPageByXml(@Param("bo") DeviceFenceAccessRecordBo bo);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备最新的围栏记录
|
* 查询设备最新的围栏记录
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.fuyuanshen.equipment.domain.DeviceType;
|
|||||||
import com.fuyuanshen.equipment.domain.form.DeviceTypeForm;
|
import com.fuyuanshen.equipment.domain.form.DeviceTypeForm;
|
||||||
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,14 +64,14 @@ public interface DeviceTypeService extends IService<DeviceType> {
|
|||||||
*
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void create(DeviceType resources);
|
void create(DeviceTypeForm resources) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设备类型
|
* 修改设备类型
|
||||||
*
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void update(DeviceTypeForm resources);
|
void update(DeviceTypeForm resources) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选删除
|
* 多选删除
|
||||||
|
|||||||
@ -32,8 +32,8 @@ public interface IDeviceRepairRecordsService extends IService<DeviceRepairRecord
|
|||||||
/**
|
/**
|
||||||
* 分页查询设备维修记录列表
|
* 分页查询设备维修记录列表
|
||||||
*
|
*
|
||||||
* @param bo 查询条件
|
* @param criteria 查询条件
|
||||||
* @param pageQuery 分页参数
|
* @param page 分页参数
|
||||||
* @return 设备维修记录分页列表
|
* @return 设备维修记录分页列表
|
||||||
*/
|
*/
|
||||||
TableDataInfo<DeviceRepairRecordsVo> queryPageList(DeviceRepairRecordsQueryCriteria criteria, Page<DeviceRepairRecords> page);
|
TableDataInfo<DeviceRepairRecordsVo> queryPageList(DeviceRepairRecordsQueryCriteria criteria, Page<DeviceRepairRecords> page);
|
||||||
@ -41,7 +41,7 @@ public interface IDeviceRepairRecordsService extends IService<DeviceRepairRecord
|
|||||||
/**
|
/**
|
||||||
* 查询符合条件的设备维修记录列表
|
* 查询符合条件的设备维修记录列表
|
||||||
*
|
*
|
||||||
* @param bo 查询条件
|
* @param criteria 查询条件
|
||||||
* @return 设备维修记录列表
|
* @return 设备维修记录列表
|
||||||
*/
|
*/
|
||||||
List<DeviceRepairRecordsVo> queryList(DeviceRepairRecordsQueryCriteria criteria);
|
List<DeviceRepairRecordsVo> queryList(DeviceRepairRecordsQueryCriteria criteria);
|
||||||
@ -70,4 +70,5 @@ public interface IDeviceRepairRecordsService extends IService<DeviceRepairRecord
|
|||||||
* @return 是否删除成功
|
* @return 是否删除成功
|
||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public class DeviceFenceAccessRecordServiceImpl implements IDeviceFenceAccessRec
|
|||||||
|
|
||||||
private final DeviceFenceAccessRecordMapper baseMapper;
|
private final DeviceFenceAccessRecordMapper baseMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询围栏进出记录
|
* 查询围栏进出记录
|
||||||
*
|
*
|
||||||
@ -68,8 +69,8 @@ public class DeviceFenceAccessRecordServiceImpl implements IDeviceFenceAccessRec
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceFenceAccessRecordVo> queryList(DeviceFenceAccessRecordBo bo) {
|
public List<DeviceFenceAccessRecordVo> queryList(DeviceFenceAccessRecordBo bo) {
|
||||||
LambdaQueryWrapper<DeviceFenceAccessRecord> lqw = buildQueryWrapper(bo);
|
// LambdaQueryWrapper<DeviceFenceAccessRecord> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoPageWithFenceAndDeviceName(lqw, bo.getFenceName());
|
return baseMapper.selectVoPageByXml(bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -275,6 +275,7 @@ public class DeviceGeoFenceServiceImpl extends ServiceImpl<DeviceGeoFenceMapper
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean addFenceTerminal(FenceTerminalBo bo) {
|
public Boolean addFenceTerminal(FenceTerminalBo bo) {
|
||||||
// 新增围栏与终端关联信息
|
// 新增围栏与终端关联信息
|
||||||
|
|||||||
@ -52,6 +52,7 @@ public class DeviceRepairRecordsServiceImpl extends ServiceImpl<DeviceRepairReco
|
|||||||
private final ISysOssService ossService;
|
private final ISysOssService ossService;
|
||||||
private final FileHashUtil fileHashUtil;
|
private final FileHashUtil fileHashUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备维修记录
|
* 查询设备维修记录
|
||||||
*
|
*
|
||||||
@ -76,6 +77,7 @@ public class DeviceRepairRecordsServiceImpl extends ServiceImpl<DeviceRepairReco
|
|||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询设备维修记录列表
|
* 分页查询设备维修记录列表
|
||||||
*
|
*
|
||||||
@ -98,6 +100,7 @@ public class DeviceRepairRecordsServiceImpl extends ServiceImpl<DeviceRepairReco
|
|||||||
return new TableDataInfo<DeviceRepairRecordsVo>(deviceRepairRecordsIPage.getRecords(), deviceRepairRecordsIPage.getTotal());
|
return new TableDataInfo<DeviceRepairRecordsVo>(deviceRepairRecordsIPage.getRecords(), deviceRepairRecordsIPage.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询符合条件的设备维修记录列表
|
* 查询符合条件的设备维修记录列表
|
||||||
*
|
*
|
||||||
|
|||||||
@ -19,12 +19,16 @@ import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
|||||||
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
|
||||||
import com.fuyuanshen.equipment.service.DeviceTypeService;
|
import com.fuyuanshen.equipment.service.DeviceTypeService;
|
||||||
|
import com.fuyuanshen.equipment.utils.FileHashUtil;
|
||||||
|
import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||||
import com.fuyuanshen.system.domain.vo.SysRoleVo;
|
import com.fuyuanshen.system.domain.vo.SysRoleVo;
|
||||||
|
import com.fuyuanshen.system.service.ISysOssService;
|
||||||
import com.fuyuanshen.system.service.ISysRoleService;
|
import com.fuyuanshen.system.service.ISysRoleService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -46,6 +50,8 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
|||||||
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
|
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
|
||||||
|
|
||||||
private final ISysRoleService roleService;
|
private final ISysRoleService roleService;
|
||||||
|
private final ISysOssService ossService;
|
||||||
|
private final FileHashUtil fileHashUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,24 +187,38 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(DeviceType resources) {
|
public void create(DeviceTypeForm resources) throws IOException {
|
||||||
|
|
||||||
// 校验设备类型名称
|
// 校验设备类型名称
|
||||||
List<DeviceType> typeName = deviceTypeMapper.selectList(new QueryWrapper<DeviceType>().eq("type_name", resources.getTypeName()));
|
List<DeviceType> typeName = deviceTypeMapper.selectList(new QueryWrapper<DeviceType>().eq("type_name", resources.getTypeName()));
|
||||||
if (CollectionUtil.isNotEmpty(typeName)) {
|
if (CollectionUtil.isNotEmpty(typeName)) {
|
||||||
throw new RuntimeException("设备类型名称已存在,无法新增!!!");
|
throw new RuntimeException("设备类型名称已存在,无法新增!!!");
|
||||||
}
|
}
|
||||||
|
// 保存图片并获取URL
|
||||||
|
if (resources.getFile() != null) {
|
||||||
|
String fileHash = fileHashUtil.hash(resources.getFile());
|
||||||
|
SysOssVo upload = ossService.updateHash(resources.getFile(), fileHash);
|
||||||
|
// 强制将HTTP替换为HTTPS
|
||||||
|
if (upload.getUrl() != null && upload.getUrl().startsWith("http://")) {
|
||||||
|
upload.setUrl(upload.getUrl().replaceFirst("^http://", "https://"));
|
||||||
|
}
|
||||||
|
// 设置图片路径
|
||||||
|
resources.setDevicePic(upload.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceType deviceType = new DeviceType();
|
||||||
|
BeanUtil.copyProperties(resources, deviceType, true);
|
||||||
|
|
||||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
resources.setCustomerId(loginUser.getUserId());
|
deviceType.setCustomerId(loginUser.getUserId());
|
||||||
resources.setOwnerCustomerId(loginUser.getUserId());
|
deviceType.setOwnerCustomerId(loginUser.getUserId());
|
||||||
resources.setOriginalOwnerId(loginUser.getUserId());
|
deviceType.setOriginalOwnerId(loginUser.getUserId());
|
||||||
resources.setCreateByName(loginUser.getNickname());
|
deviceType.setCreateByName(loginUser.getNickname());
|
||||||
deviceTypeMapper.insert(resources);
|
deviceTypeMapper.insert(deviceType);
|
||||||
|
|
||||||
// 自动授权给自己
|
// 自动授权给自己
|
||||||
DeviceTypeGrants deviceTypeGrants = new DeviceTypeGrants();
|
DeviceTypeGrants deviceTypeGrants = new DeviceTypeGrants();
|
||||||
deviceTypeGrants.setDeviceTypeId(resources.getId());
|
deviceTypeGrants.setDeviceTypeId(deviceType.getId());
|
||||||
deviceTypeGrants.setCustomerId(loginUser.getUserId());
|
deviceTypeGrants.setCustomerId(loginUser.getUserId());
|
||||||
deviceTypeGrants.setGrantorCustomerId(loginUser.getUserId());
|
deviceTypeGrants.setGrantorCustomerId(loginUser.getUserId());
|
||||||
deviceTypeGrants.setGrantedAt(new Date());
|
deviceTypeGrants.setGrantedAt(new Date());
|
||||||
@ -213,7 +233,7 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(DeviceTypeForm resources) {
|
public void update(DeviceTypeForm resources) throws IOException {
|
||||||
DeviceTypeGrants deviceTypeGrants = deviceTypeGrantsMapper.selectById(resources.getId());
|
DeviceTypeGrants deviceTypeGrants = deviceTypeGrantsMapper.selectById(resources.getId());
|
||||||
if (deviceTypeGrants == null) {
|
if (deviceTypeGrants == null) {
|
||||||
throw new RuntimeException("设备类型不存在");
|
throw new RuntimeException("设备类型不存在");
|
||||||
@ -224,22 +244,13 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
|||||||
throw new RuntimeException("设备类型不存在");
|
throw new RuntimeException("设备类型不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!deviceType.getTypeName().equals(resources.getTypeName())) {
|
if (!deviceType.getTypeName().equals(resources.getTypeName())) {
|
||||||
int count = deviceMapper.countByDeviceTypeId(deviceType.getId());
|
int count = deviceMapper.countByDeviceTypeId(deviceType.getId());
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new RuntimeException("该设备类型下已有绑定设备,无法修改设备类型名称!!!");
|
throw new RuntimeException("该设备类型下已有设备,无法修改设备类型名称!!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>()
|
|
||||||
// .eq("device_type", deviceTypeGrants.getDeviceTypeId()));
|
|
||||||
// if (CollectionUtil.isNotEmpty(devices)) {
|
|
||||||
// throw new RuntimeException("该设备类型已绑定设备,无法修改!!!");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 校验设备类型名称
|
// 校验设备类型名称
|
||||||
DeviceType dt = deviceTypeMapper.selectOne(new QueryWrapper<DeviceType>().eq("type_name", resources.getTypeName()));
|
DeviceType dt = deviceTypeMapper.selectOne(new QueryWrapper<DeviceType>().eq("type_name", resources.getTypeName()));
|
||||||
if (dt != null && !dt.getId().equals(deviceType.getId())) {
|
if (dt != null && !dt.getId().equals(deviceType.getId())) {
|
||||||
@ -253,6 +264,17 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
|||||||
throw new RuntimeException("无权修改该设备类型");
|
throw new RuntimeException("无权修改该设备类型");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 保存图片并获取URL
|
||||||
|
if (resources.getFile() != null) {
|
||||||
|
String fileHash = fileHashUtil.hash(resources.getFile());
|
||||||
|
SysOssVo upload = ossService.updateHash(resources.getFile(), fileHash);
|
||||||
|
// 强制将HTTP替换为HTTPS
|
||||||
|
if (upload.getUrl() != null && upload.getUrl().startsWith("http://")) {
|
||||||
|
upload.setUrl(upload.getUrl().replaceFirst("^http://", "https://"));
|
||||||
|
}
|
||||||
|
// 设置图片路径
|
||||||
|
resources.setDevicePic(upload.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
BeanUtil.copyProperties(resources, deviceType);
|
BeanUtil.copyProperties(resources, deviceType);
|
||||||
deviceTypeMapper.updateById(deviceType);
|
deviceTypeMapper.updateById(deviceType);
|
||||||
|
|||||||
@ -30,27 +30,45 @@ import static cn.dev33.satoken.SaManager.log;
|
|||||||
@Component
|
@Component
|
||||||
public class AlibabaTTSUtil {
|
public class AlibabaTTSUtil {
|
||||||
// ========== 常量配置 ==========
|
// ========== 常量配置 ==========
|
||||||
/** 阿里云TTS服务基础URL */
|
/**
|
||||||
|
* 阿里云TTS服务基础URL
|
||||||
|
*/
|
||||||
private static final String BASE_URL = "https://nls-gateway-cn-shanghai.aliyuncs.com/stream/v1/tts";
|
private static final String BASE_URL = "https://nls-gateway-cn-shanghai.aliyuncs.com/stream/v1/tts";
|
||||||
/** 音频内容类型标识 */
|
/**
|
||||||
|
* 音频内容类型标识
|
||||||
|
*/
|
||||||
private static final String CONTENT_TYPE_AUDIO = "audio/mpeg";
|
private static final String CONTENT_TYPE_AUDIO = "audio/mpeg";
|
||||||
|
|
||||||
// ========== 默认参数值 ==========
|
// ========== 默认参数值 ==========
|
||||||
/** 默认发音人 - 小云 */
|
/**
|
||||||
|
* 默认发音人 - 小云
|
||||||
|
*/
|
||||||
private static final String DEFAULT_VOICE = "xiaoyun";
|
private static final String DEFAULT_VOICE = "xiaoyun";
|
||||||
/** 默认音量 50% */
|
/**
|
||||||
|
* 默认音量 50%
|
||||||
|
*/
|
||||||
private static final int DEFAULT_VOLUME = 50;
|
private static final int DEFAULT_VOLUME = 50;
|
||||||
/** 默认语速 0(正常) */
|
/**
|
||||||
|
* 默认语速 0(正常)
|
||||||
|
*/
|
||||||
private static final int DEFAULT_SPEECH_RATE = 1;
|
private static final int DEFAULT_SPEECH_RATE = 1;
|
||||||
/** 默认语调 0(正常) */
|
/**
|
||||||
|
* 默认语调 0(正常)
|
||||||
|
*/
|
||||||
private static final int DEFAULT_PITCH_RATE = 0;
|
private static final int DEFAULT_PITCH_RATE = 0;
|
||||||
/** 默认音频格式 pcm */
|
/**
|
||||||
|
* 默认音频格式 pcm
|
||||||
|
*/
|
||||||
private static final String DEFAULT_FORMAT = "pcm";
|
private static final String DEFAULT_FORMAT = "pcm";
|
||||||
/** 默认采样率 16000Hz */
|
/**
|
||||||
|
* 默认采样率 16000Hz
|
||||||
|
*/
|
||||||
private static final int DEFAULT_SAMPLE_RATE = 16000;
|
private static final int DEFAULT_SAMPLE_RATE = 16000;
|
||||||
|
|
||||||
// ========== Token管理配置 ==========
|
// ========== Token管理配置 ==========
|
||||||
/** Token刷新缓冲时间(提前5分钟刷新,单位:毫秒) */
|
/**
|
||||||
|
* Token刷新缓冲时间(提前5分钟刷新,单位:毫秒)
|
||||||
|
*/
|
||||||
private static final long TOKEN_REFRESH_BUFFER = 5 * 60 * 1000L;
|
private static final long TOKEN_REFRESH_BUFFER = 5 * 60 * 1000L;
|
||||||
|
|
||||||
// ========== 配置参数(从配置文件读取) ==========
|
// ========== 配置参数(从配置文件读取) ==========
|
||||||
@ -70,7 +88,8 @@ public class AlibabaTTSUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成语音文件 - 简化版(使用默认参数)
|
* 生成语音文件 - 简化版(使用默认参数)
|
||||||
* @param text 要转换的文本内容
|
*
|
||||||
|
* @param text 要转换的文本内容
|
||||||
* @param audioSaveFile 音频文件保存路径
|
* @param audioSaveFile 音频文件保存路径
|
||||||
* @return true-成功 false-失败
|
* @return true-成功 false-失败
|
||||||
*/
|
*/
|
||||||
@ -80,11 +99,12 @@ public class AlibabaTTSUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成语音文件 - 标准版
|
* 生成语音文件 - 标准版
|
||||||
* @param text 要转换的文本内容
|
*
|
||||||
|
* @param text 要转换的文本内容
|
||||||
* @param audioSaveFile 音频文件保存路径
|
* @param audioSaveFile 音频文件保存路径
|
||||||
* @param format 音频格式(如:mp3, wav等)
|
* @param format 音频格式(如:mp3, wav等)
|
||||||
* @param sampleRate 采样率(如:16000, 22050, 44100等)
|
* @param sampleRate 采样率(如:16000, 22050, 44100等)
|
||||||
* @param voice 发音人(如:xiaoyun, xiaoqian等)
|
* @param voice 发音人(如:xiaoyun, xiaoqian等)
|
||||||
* @return true-成功 false-失败
|
* @return true-成功 false-失败
|
||||||
*/
|
*/
|
||||||
public boolean generateSpeech(String text, String audioSaveFile, String format,
|
public boolean generateSpeech(String text, String audioSaveFile, String format,
|
||||||
@ -95,14 +115,15 @@ public class AlibabaTTSUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成语音文件 - 完整版(支持所有参数调节)
|
* 生成语音文件 - 完整版(支持所有参数调节)
|
||||||
* @param text 要转换的文本内容
|
*
|
||||||
|
* @param text 要转换的文本内容
|
||||||
* @param audioSaveFile 音频文件保存路径
|
* @param audioSaveFile 音频文件保存路径
|
||||||
* @param format 音频格式
|
* @param format 音频格式
|
||||||
* @param sampleRate 采样率
|
* @param sampleRate 采样率
|
||||||
* @param voice 发音人
|
* @param voice 发音人
|
||||||
* @param volume 音量(0-100)
|
* @param volume 音量(0-100)
|
||||||
* @param speechRate 语速(-500~500)
|
* @param speechRate 语速(-500~500)
|
||||||
* @param pitchRate 语调(-500~500)
|
* @param pitchRate 语调(-500~500)
|
||||||
* @return true-成功 false-失败
|
* @return true-成功 false-失败
|
||||||
*/
|
*/
|
||||||
public boolean generateSpeech(String text, String audioSaveFile, String format,
|
public boolean generateSpeech(String text, String audioSaveFile, String format,
|
||||||
@ -158,6 +179,7 @@ public class AlibabaTTSUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取有效的访问令牌(优先从缓存获取,缓存不存在则重新生成)
|
* 获取有效的访问令牌(优先从缓存获取,缓存不存在则重新生成)
|
||||||
|
*
|
||||||
* @return 访问令牌,获取失败返回null
|
* @return 访问令牌,获取失败返回null
|
||||||
*/
|
*/
|
||||||
private String getValidAccessToken() {
|
private String getValidAccessToken() {
|
||||||
@ -181,6 +203,7 @@ public class AlibabaTTSUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新访问令牌(调用阿里云API获取新令牌并缓存)
|
* 刷新访问令牌(调用阿里云API获取新令牌并缓存)
|
||||||
|
*
|
||||||
* @return 新的访问令牌,获取失败返回null
|
* @return 新的访问令牌,获取失败返回null
|
||||||
*/
|
*/
|
||||||
private String refreshAccessToken() {
|
private String refreshAccessToken() {
|
||||||
@ -202,6 +225,7 @@ public class AlibabaTTSUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数验证
|
* 参数验证
|
||||||
|
*
|
||||||
* @throws IllegalArgumentException 参数不合法时抛出异常
|
* @throws IllegalArgumentException 参数不合法时抛出异常
|
||||||
*/
|
*/
|
||||||
private void validateParameters(String text, String audioSaveFile, String format, int sampleRate) {
|
private void validateParameters(String text, String audioSaveFile, String format, int sampleRate) {
|
||||||
@ -248,10 +272,10 @@ public class AlibabaTTSUtil {
|
|||||||
"&text=" + encodedText +
|
"&text=" + encodedText +
|
||||||
"&format=" + format +
|
"&format=" + format +
|
||||||
"&sample_rate=" + sampleRate;
|
"&sample_rate=" + sampleRate;
|
||||||
//"&voice=" + actualVoice +
|
//"&voice=" + actualVoice +
|
||||||
//"&volume=" + Math.max(0, Math.min(100, volume)) + // 音量范围限制
|
//"&volume=" + Math.max(0, Math.min(100, volume)) + // 音量范围限制
|
||||||
//"&speech_rate=" + Math.max(-500, Math.min(500, speechRate)) + // 语速范围限制
|
//"&speech_rate=" + Math.max(-500, Math.min(500, speechRate)) + // 语速范围限制
|
||||||
//"&pitch_rate=" + Math.max(-500, Math.min(500, pitchRate)); // 语调范围限制
|
//"&pitch_rate=" + Math.max(-500, Math.min(500, pitchRate)); // 语调范围限制
|
||||||
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new RuntimeException("UTF-8编码不支持", e);
|
throw new RuntimeException("UTF-8编码不支持", e);
|
||||||
|
|||||||
@ -48,8 +48,8 @@
|
|||||||
r.event_time, r.event_address,
|
r.event_time, r.event_address,
|
||||||
r.create_time
|
r.create_time
|
||||||
FROM device_fence_access_record r
|
FROM device_fence_access_record r
|
||||||
LEFT JOIN device_geo_fence f ON r.fence_id = f.id
|
INNER JOIN device_geo_fence f ON r.fence_id = f.id
|
||||||
LEFT JOIN device d ON r.device_id = d.id
|
INNER JOIN device d ON r.device_id = d.id
|
||||||
<where>
|
<where>
|
||||||
<if test="bo.fenceId != null">
|
<if test="bo.fenceId != null">
|
||||||
AND r.fence_id = #{bo.fenceId}
|
AND r.fence_id = #{bo.fenceId}
|
||||||
|
|||||||
@ -13,8 +13,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
a.content,
|
a.content,
|
||||||
a.create_time AS createTime
|
a.create_time AS createTime
|
||||||
FROM
|
FROM
|
||||||
device_log a left join device b on a.device_id = b.id
|
device_log a inner join device b on a.device_id = b.id
|
||||||
left join device_type c on b.device_type = c.id
|
inner join device_type c on b.device_type = c.id
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
<if test="bo.deviceType != null">
|
<if test="bo.deviceType != null">
|
||||||
AND c.id = #{bo.deviceType}
|
AND c.id = #{bo.deviceType}
|
||||||
|
|||||||
@ -36,6 +36,7 @@ public class SysMenuController extends BaseController {
|
|||||||
|
|
||||||
private final ISysMenuService menuService;
|
private final ISysMenuService menuService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取路由信息
|
* 获取路由信息
|
||||||
*
|
*
|
||||||
@ -47,6 +48,7 @@ public class SysMenuController extends BaseController {
|
|||||||
return R.ok(menuService.buildMenus(menus));
|
return R.ok(menuService.buildMenus(menus));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取菜单列表
|
* 获取菜单列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单 业务层处理
|
* 菜单 业务层处理
|
||||||
@ -141,10 +142,17 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
menus = baseMapper.selectMenuTreeAll();
|
menus = baseMapper.selectMenuTreeAll();
|
||||||
} else {
|
} else {
|
||||||
menus = baseMapper.selectMenuTreeByUserId(userId);
|
menus = baseMapper.selectMenuTreeByUserId(userId);
|
||||||
|
// 如果不是超级管理员且不是租户管理员,则过滤掉受限制的菜单
|
||||||
|
// if (!LoginHelper.isAdmin()) {
|
||||||
|
menus = menus.stream()
|
||||||
|
.filter(menu -> !SystemConstants.RESTRICTED_MENU_ID.equals(menu.getMenuId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
return getChildPerms(menus, 0);
|
return getChildPerms(menus, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询菜单树信息
|
* 根据角色ID查询菜单树信息
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user