Browse Source
# Conflicts: # dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/SDKDeviceService.java # dk-modules/sample/src/main/java/org/dromara/sample/wayline/controller/WaylineJobController.java # dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/WaylineJobServiceImpl.javapull/6/head
161 changed files with 8348 additions and 92 deletions
@ -0,0 +1,10 @@ |
|||||
|
package org.dromara.system.api; |
||||
|
|
||||
|
import org.dromara.system.api.domain.bo.RemoteNoticeBo; |
||||
|
import org.dromara.system.api.domain.vo.RemotePostVo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface RemoteNoticeService { |
||||
|
int saveNotice(RemoteNoticeBo bo); |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package org.dromara.system.api; |
||||
|
|
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.system.api.domain.vo.RemoteClientVo; |
||||
|
|
||||
|
/** |
||||
|
* 客户端服务 |
||||
|
* |
||||
|
* @author Michelle.Chung |
||||
|
*/ |
||||
|
public interface RemoteSubmailConfigService { |
||||
|
|
||||
|
/** |
||||
|
* 根据客户端id获取客户端详情 |
||||
|
* |
||||
|
* @return 客户端对象 |
||||
|
*/ |
||||
|
R<String> remoteCmdSend(String code, String multiParam ); |
||||
|
|
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
package org.dromara.system.api.domain.bo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 操作日志记录表 oper_log |
||||
|
* |
||||
|
* @author Lion Li |
||||
|
*/ |
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class RemoteNoticeBo implements Serializable { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private Long noticeId; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 公告标题 |
||||
|
*/ |
||||
|
private String noticeTitle; |
||||
|
|
||||
|
/** |
||||
|
* 公告类型(1通知 2公告) |
||||
|
*/ |
||||
|
private String noticeType; |
||||
|
|
||||
|
/** |
||||
|
* 公告内容 |
||||
|
*/ |
||||
|
private String noticeContent; |
||||
|
|
||||
|
/** |
||||
|
* 公告状态(0正常 1关闭) |
||||
|
*/ |
||||
|
private String status; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
private Integer isRead; |
||||
|
/** |
||||
|
* 创建部门 |
||||
|
*/ |
||||
|
|
||||
|
private Long createDept; |
||||
|
|
||||
|
/** |
||||
|
* 创建者 |
||||
|
*/ |
||||
|
|
||||
|
private Long createBy; |
||||
|
private String deviceSn; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createTime; |
||||
|
|
||||
|
private String param; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package org.dromara.common.sdk.cloudapi.device; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonCreator; |
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import org.dromara.common.sdk.exception.CloudSDKException; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* @author sean |
||||
|
* @version 1.7 |
||||
|
* @date 2023/5/26 |
||||
|
*/ |
||||
|
@Schema(description = "DeviceTypeVideoEnum", enumAsRef = true) |
||||
|
public enum DeviceTypeVideoEnum { |
||||
|
|
||||
|
ZERO(0), |
||||
|
SEVEN(7); |
||||
|
|
||||
|
; |
||||
|
|
||||
|
private final int videoType; |
||||
|
|
||||
|
DeviceTypeVideoEnum(int videoType) { |
||||
|
this.videoType = videoType; |
||||
|
} |
||||
|
|
||||
|
@JsonValue |
||||
|
public int getVideoType() { |
||||
|
return videoType; |
||||
|
} |
||||
|
|
||||
|
@JsonCreator |
||||
|
public static DeviceTypeVideoEnum find(int videoType) { |
||||
|
return Arrays.stream(values()).filter(typeEnum -> typeEnum.videoType == videoType).findAny() |
||||
|
.orElseThrow(() -> new CloudSDKException(DeviceTypeVideoEnum.class, videoType)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,80 @@ |
|||||
|
package org.dromara.common.sdk.cloudapi.device; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonCreator; |
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import org.dromara.common.core.utils.StringUtils; |
||||
|
import org.dromara.common.sdk.exception.CloudSDKException; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* @author sean |
||||
|
* @version 1.7 |
||||
|
* @date 2023/5/19 |
||||
|
*/ |
||||
|
@Schema(description = "device model key.", format = "domain-type-subType", enumAsRef = true, example = "0-89-0") |
||||
|
public enum DeviceVideoEnum { |
||||
|
|
||||
|
|
||||
|
DOCK(DeviceTypeEnum.DOCK_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.SEVEN), |
||||
|
|
||||
|
DJIDock2(DeviceTypeEnum.DOCK_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.SEVEN), |
||||
|
|
||||
|
DOCK3(DeviceTypeEnum.DOCK_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.SEVEN), |
||||
|
Matrice30(DeviceTypeEnum.M30_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.ZERO), |
||||
|
|
||||
|
Matrice30T(DeviceTypeEnum.M30T_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.ZERO), |
||||
|
M3D(DeviceTypeEnum.M3D_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.ZERO), |
||||
|
|
||||
|
M3TD(DeviceTypeEnum.M3TD_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.ZERO), |
||||
|
|
||||
|
M4D(DeviceTypeEnum.M4D_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.ZERO), |
||||
|
|
||||
|
M4TD(DeviceTypeEnum.M4TD_CAMERA, DeviceSubTypeEnum.ZERO, DeviceTypeVideoEnum.ZERO), |
||||
|
|
||||
|
; |
||||
|
|
||||
|
|
||||
|
@Schema(enumAsRef = true) |
||||
|
private final DeviceTypeEnum type; |
||||
|
|
||||
|
@Schema(enumAsRef = true) |
||||
|
private final DeviceSubTypeEnum subType; |
||||
|
|
||||
|
@Schema(enumAsRef = true) |
||||
|
private final DeviceTypeVideoEnum videoType; |
||||
|
|
||||
|
DeviceVideoEnum(DeviceTypeEnum type, DeviceSubTypeEnum subType, DeviceTypeVideoEnum videoType) { |
||||
|
this.type = type; |
||||
|
this.subType = subType; |
||||
|
this.videoType = videoType; |
||||
|
} |
||||
|
|
||||
|
public DeviceTypeEnum getType() { |
||||
|
return type; |
||||
|
} |
||||
|
|
||||
|
public DeviceSubTypeEnum getSubType() { |
||||
|
return subType; |
||||
|
} |
||||
|
|
||||
|
public DeviceTypeVideoEnum getVideoType() { |
||||
|
return videoType; |
||||
|
} |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getDevice() { |
||||
|
return String.format("%s-%s-%s", type.getType(), subType.getSubType(),videoType.getVideoType()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@JsonCreator |
||||
|
public static DeviceVideoEnum find(String key) { |
||||
|
String finalKey = key.replaceAll(" ",""); |
||||
|
return Arrays.stream(values()).filter(device -> device.toString().equals(finalKey)) |
||||
|
.findAny().orElseThrow(() -> new CloudSDKException(DeviceEnum.class, finalKey)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<groupId>org.dromara</groupId> |
||||
|
<artifactId>dk-common</artifactId> |
||||
|
<version>${revision}</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>common-rocketmq</artifactId> |
||||
|
|
||||
|
<description> |
||||
|
common-rocketmq 配置中心 |
||||
|
</description> |
||||
|
|
||||
|
<dependencies> |
||||
|
<!--rocketmq消息队列--> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.rocketmq</groupId> |
||||
|
<artifactId>rocketmq-client</artifactId> |
||||
|
<version> 4.9.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!--RocketMQ--> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.rocketmq</groupId> |
||||
|
<artifactId>rocketmq-spring-boot-starter</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.dromara</groupId> |
||||
|
<artifactId>common-core</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.dromara</groupId> |
||||
|
<artifactId>common-nacos</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
</dependencies> |
||||
|
|
||||
|
|
||||
|
</project> |
@ -0,0 +1,58 @@ |
|||||
|
package org.dromara.common.rocketmq.config; |
||||
|
|
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.rocketmq.client.exception.MQClientException; |
||||
|
import org.apache.rocketmq.client.producer.DefaultMQProducer; |
||||
|
import org.dromara.common.rocketmq.model.ProducerMode; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.boot.autoconfigure.AutoConfiguration; |
||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* mq搭建地址连接 |
||||
|
* 生产者初者连接信息 具体看nacos配置 |
||||
|
*/ |
||||
|
@AutoConfiguration |
||||
|
@Slf4j |
||||
|
@EnableConfigurationProperties(ProducerMode.class) |
||||
|
public class ProducerConfig { |
||||
|
|
||||
|
/** |
||||
|
* 远程调用连接信息 |
||||
|
*/ |
||||
|
public static DefaultMQProducer producer; |
||||
|
|
||||
|
/** |
||||
|
* 连接客户端信息配置 具体看nacos配置 |
||||
|
*/ |
||||
|
@Autowired |
||||
|
private ProducerMode producerMode; |
||||
|
|
||||
|
@Bean |
||||
|
public DefaultMQProducer getRocketMQProducer() { |
||||
|
producer = new DefaultMQProducer(producerMode.getGroupName()); |
||||
|
producer.setNamesrvAddr(producerMode.getNameServer()); |
||||
|
//如果需要同一个jvm中不同的producer往不同的mq集群发送消息,需要设置不同的instanceName
|
||||
|
if(producerMode.getMaxMessageSize()!=null){ |
||||
|
producer.setMaxMessageSize(producerMode.getMaxMessageSize()); |
||||
|
} |
||||
|
if(producerMode.getSendMsgTimeout()!=null){ |
||||
|
producer.setSendMsgTimeout(producerMode.getSendMsgTimeout()); |
||||
|
} |
||||
|
//如果发送消息失败,设置重试次数,默认为2次
|
||||
|
if(producerMode.getRetryTimesWhenSendFailed()!=null){ |
||||
|
producer.setRetryTimesWhenSendFailed(producerMode.getRetryTimesWhenSendFailed()); |
||||
|
} |
||||
|
producer.setVipChannelEnabled(false); |
||||
|
try { |
||||
|
producer.start(); |
||||
|
log.info("生产者初始化成功:{}",producer.toString()); |
||||
|
} catch (MQClientException e) { |
||||
|
log.error("生产者初始化失败:{}",e.getMessage()); |
||||
|
} |
||||
|
return producer; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package org.dromara.common.rocketmq.model; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.cloud.context.config.annotation.RefreshScope; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
/** |
||||
|
* 生产者初始化 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ConfigurationProperties(prefix = "rocketmq.producer") |
||||
|
public class ProducerMode { |
||||
|
|
||||
|
private String groupName; |
||||
|
|
||||
|
private String nameServer; |
||||
|
|
||||
|
private Integer maxMessageSize; |
||||
|
|
||||
|
private Integer sendMsgTimeout; |
||||
|
|
||||
|
private Integer retryTimesWhenSendFailed; |
||||
|
} |
@ -0,0 +1,189 @@ |
|||||
|
package org.dromara.common.rocketmq.producer; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.rocketmq.client.exception.MQBrokerException; |
||||
|
import org.apache.rocketmq.client.exception.MQClientException; |
||||
|
import org.apache.rocketmq.client.producer.SendCallback; |
||||
|
import org.apache.rocketmq.client.producer.SendResult; |
||||
|
import org.apache.rocketmq.common.message.Message; |
||||
|
import org.apache.rocketmq.remoting.common.RemotingHelper; |
||||
|
import org.apache.rocketmq.remoting.exception.RemotingException; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.io.UnsupportedEncodingException; |
||||
|
import java.text.DateFormat; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import static org.dromara.common.rocketmq.config.ProducerConfig.producer; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 消息发送 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
public class MessageProducerUtil { |
||||
|
|
||||
|
/** |
||||
|
* 同步发送消息 |
||||
|
* @param topic 主题 |
||||
|
* @param tag 标签 |
||||
|
* @param key 自定义的key,根据业务来定 |
||||
|
* @param value 消息的内容 |
||||
|
* 通过调用 send() 方法发送消息,阻塞等待服务器响应。 |
||||
|
*/ |
||||
|
public static SendResult sendSynchronizeMessage(String topic, String tag, String key, String value){ |
||||
|
String body = "topic:【"+topic+"】, tag:【"+tag+"】, key:【"+key+"】, value:【"+value+"】"; |
||||
|
try { |
||||
|
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET)); |
||||
|
System.out.println("生产者发送消息:"+ JSON.toJSONString(value)); |
||||
|
SendResult result = producer.send(msg); |
||||
|
return result; |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
log.error("消息初始化失败!body:{}",body); |
||||
|
|
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 单向发送消息 |
||||
|
* @param topic 主题 |
||||
|
* @param tag 标签 |
||||
|
* @param key 自定义的key,根据业务来定 |
||||
|
* @param value 消息的内容 |
||||
|
* 单向发送:通过调用 sendOneway() 方法发送消息,不关心发送结果,适用于对可靠性要求不高的场景。 |
||||
|
*/ |
||||
|
public static void sendOnewayMessage(String topic, String tag, String key, String value){ |
||||
|
String body = "topic:【"+topic+"】, tag:【"+tag+"】, key:【"+key+"】, value:【"+value+"】"; |
||||
|
try { |
||||
|
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET)); |
||||
|
System.out.println("生产者发送消息:"+ JSON.toJSONString(value)); |
||||
|
producer.sendOneway(msg); |
||||
|
} catch (UnsupportedEncodingException e) { |
||||
|
log.error("消息初始化失败!body:{}",body); |
||||
|
|
||||
|
} catch (MQClientException | InterruptedException | RemotingException e) { |
||||
|
log.error("消息发送失败! body:{}",body); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 批量发送消息 |
||||
|
* @param messages 消息列表 |
||||
|
* 批量发送:通过调用 send() 方法并传入多条消息,实现批量发送消息。 |
||||
|
*/ |
||||
|
// public static SendResult sendBatchMessage(List<Message> messages){
|
||||
|
// String body = messages.toString();
|
||||
|
// try {
|
||||
|
// System.out.println("生产者发送消息:"+ messages);
|
||||
|
// // 发送批量消息
|
||||
|
// SendResult sendResult = producer.send(messages);
|
||||
|
// return sendResult;
|
||||
|
// } catch (MQClientException | InterruptedException | RemotingException e) {
|
||||
|
// log.error("消息发送失败! body:{}",body);
|
||||
|
// } catch (MQBrokerException e) {
|
||||
|
// throw new RuntimeException(e);
|
||||
|
// }
|
||||
|
// return null;
|
||||
|
// }
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 发送有序的消息 |
||||
|
* @param messagesList Message集合 |
||||
|
* @param messageQueueNumber 消息队列数量,根据实际情况设定 |
||||
|
* 顺序发送: messageQueueNumber 表示消息的业务标识,可以根据具体需求进行设置来保证消息按顺序发送。 |
||||
|
*/ |
||||
|
// public static SendResult sendOrderlyMessage(List<Message> messagesList, Integer messageQueueNumber) {
|
||||
|
// SendResult result = null;
|
||||
|
// for (Message message : messagesList) {
|
||||
|
// try {
|
||||
|
// result = producer.send(message, (list, msg, arg) -> {
|
||||
|
// Integer queueNumber = (Integer) arg;
|
||||
|
// //int queueIndex = queueNumber % list.size();
|
||||
|
// return list.get(queueNumber);
|
||||
|
// }, messageQueueNumber);//根据编号取模,选择消息队列
|
||||
|
// } catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) {
|
||||
|
// log.error("发送有序消息失败");
|
||||
|
// return result;
|
||||
|
// }
|
||||
|
// }
|
||||
|
// return result;
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* 发送延迟消息 |
||||
|
* @param topic 主题 |
||||
|
* @param tag 标签 |
||||
|
* @param key 自定义的key,根据业务来定 |
||||
|
* @param value 消息的内容 |
||||
|
* 延迟发送:通过设置延迟级别来实现延迟发送消息。 |
||||
|
*/ |
||||
|
public static SendResult sendDelayMessage(String topic, String tag, String key, String value) |
||||
|
{ |
||||
|
SendResult result = null; |
||||
|
try |
||||
|
{ |
||||
|
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET)); |
||||
|
//设置消息延迟级别,我这里设置5,对应就是延时一分钟
|
||||
|
// "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h"
|
||||
|
msg.setDelayTimeLevel(4); |
||||
|
// 发送消息到一个Broker
|
||||
|
result = producer.send(msg); |
||||
|
// 通过sendResult返回消息是否成功送达
|
||||
|
log.info("发送延迟消息结果:======sendResult:{}", result); |
||||
|
DateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||
|
log.info("发送时间:{}", format.format(new Date())); |
||||
|
return result; |
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
e.printStackTrace(); |
||||
|
log.error("延迟消息队列推送消息异常:{},推送内容:{}", e.getMessage(), result); |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
/** |
||||
|
* 发送异步的消息 |
||||
|
* @param topic 主题 |
||||
|
* @param tag 标签 |
||||
|
* @param key 自定义的key,根据业务来定 |
||||
|
* @param value 消息的内容 |
||||
|
* 通过调用 send() 方法,并传入一个 SendCallback 对象,在发送消息的同时可以继续处理其他逻辑,消息发送结果通过回调函数通知。 |
||||
|
*/ |
||||
|
public static SendResult sendAsyncProducerMessage(String topic, String tag, String key, String value){ |
||||
|
|
||||
|
try { |
||||
|
//创建一个消息实例,指定主题、标签和消息体。
|
||||
|
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET)); |
||||
|
System.out.println("生产者发送消息:"+ JSON.toJSONString(value)); |
||||
|
producer.send(msg,new SendCallback() { |
||||
|
// 异步回调的处理
|
||||
|
@Override |
||||
|
public void onSuccess(SendResult sendResult) { |
||||
|
System.out.printf("%-10d 异步发送消息成功 %s %n", msg, sendResult.getMsgId()); |
||||
|
} |
||||
|
@Override |
||||
|
public void onException(Throwable e) { |
||||
|
System.out.printf("%-10d 异步发送消息失败 %s %n", msg, e); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
}); |
||||
|
} catch (MQClientException e) { |
||||
|
e.printStackTrace(); |
||||
|
} catch (RemotingException e) { |
||||
|
e.printStackTrace(); |
||||
|
} catch (InterruptedException e) { |
||||
|
e.printStackTrace(); |
||||
|
} catch (UnsupportedEncodingException e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1 @@ |
|||||
|
org.dromara.common.rocketmq.config.ProducerConfig |
@ -0,0 +1,34 @@ |
|||||
|
package org.dromara.business.domain; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @auther yq |
||||
|
* @data 2025/2/26 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("business_task_label") |
||||
|
public class BusinessTaskLabel implements Serializable { |
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
@TableId(value = "id", type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
private Long taskId; |
||||
|
|
||||
|
private String labelCn; |
||||
|
private String labelEn; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
package org.dromara.business.domain.vo; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
import org.dromara.business.domain.BusinessTask; |
||||
|
import org.dromara.business.domain.BusinessTaskLabel; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @auther yq |
||||
|
* @data 2025/2/26 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ExcelIgnoreUnannotated |
||||
|
@AutoMapper(target = BusinessTaskLabel.class) |
||||
|
public class BusinessTaskLabelVo implements Serializable { |
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
private Long id; |
||||
|
|
||||
|
private Long taskId; |
||||
|
|
||||
|
private String labelCn; |
||||
|
private String labelEn; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package org.dromara.business.mapper; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.dromara.business.domain.BusinessTask; |
||||
|
import org.dromara.business.domain.BusinessTaskLabel; |
||||
|
import org.dromara.business.domain.bo.BusinessTaskBo; |
||||
|
import org.dromara.business.domain.vo.BusinessTaskLabelVo; |
||||
|
import org.dromara.business.domain.vo.BusinessTaskVo; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 工单预约Mapper接口 |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-02-26 |
||||
|
*/ |
||||
|
public interface BusinessTaskLabelMapper extends BaseMapperPlus<BusinessTaskLabel, BusinessTaskLabelVo> { |
||||
|
List<BusinessTaskLabelVo> selectTaskLabelList(@Param("taskId") Long taskId); |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="org.dromara.business.mapper.BusinessTaskLabelMapper"> |
||||
|
|
||||
|
|
||||
|
<select id="selectTaskLabelList" resultType="org.dromara.business.domain.vo.BusinessTaskLabelVo"> |
||||
|
select * from business_task_label where task_id=#{taskId} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,68 @@ |
|||||
|
package org.dromara.sample.common.util; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.nio.charset.StandardCharsets; |
||||
|
import java.security.MessageDigest; |
||||
|
|
||||
|
/** |
||||
|
* Md5加密方法 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
*/ |
||||
|
public class Md5Utils |
||||
|
{ |
||||
|
private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); |
||||
|
|
||||
|
private static byte[] md5(String s) |
||||
|
{ |
||||
|
MessageDigest algorithm; |
||||
|
try |
||||
|
{ |
||||
|
algorithm = MessageDigest.getInstance("MD5"); |
||||
|
algorithm.reset(); |
||||
|
algorithm.update(s.getBytes("UTF-8")); |
||||
|
byte[] messageDigest = algorithm.digest(); |
||||
|
return messageDigest; |
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
log.error("MD5 Error...", e); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
private static final String toHex(byte hash[]) |
||||
|
{ |
||||
|
if (hash == null) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
StringBuffer buf = new StringBuffer(hash.length * 2); |
||||
|
int i; |
||||
|
|
||||
|
for (i = 0; i < hash.length; i++) |
||||
|
{ |
||||
|
if ((hash[i] & 0xff) < 0x10) |
||||
|
{ |
||||
|
buf.append("0"); |
||||
|
} |
||||
|
buf.append(Long.toString(hash[i] & 0xff, 16)); |
||||
|
} |
||||
|
return buf.toString(); |
||||
|
} |
||||
|
|
||||
|
public static String hash(String s) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); |
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
log.error("not supported charset...{}", e); |
||||
|
return s; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package org.dromara.sample.feign; |
||||
|
|
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@FeignClient(name = "gateway",path = "system") |
||||
|
public interface RemoteSystemFeign { |
||||
|
|
||||
|
@GetMapping("/config/selectStreamType") |
||||
|
public List<String> selectStreamType(@RequestParam String deviceSn); |
||||
|
} |
@ -0,0 +1,87 @@ |
|||||
|
package org.dromara.sample.manage.controller; |
||||
|
|
||||
|
import com.alibaba.nacos.common.utils.CollectionUtils; |
||||
|
import com.fasterxml.jackson.databind.JsonNode; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.dromara.common.satoken.utils.LoginHelper; |
||||
|
import org.dromara.common.sdk.common.HttpResultResponse; |
||||
|
import org.dromara.common.sdk.common.PaginationData; |
||||
|
import org.dromara.common.sdk.exception.CloudSDKErrorEnum; |
||||
|
import org.dromara.common.sdk.mqtt.property.PropertySetReplyResultEnum; |
||||
|
import org.dromara.sample.manage.model.dto.CallBackDTO; |
||||
|
import org.dromara.sample.manage.model.dto.DeviceDTO; |
||||
|
import org.dromara.sample.manage.model.dto.DeviceFirmwareUpgradeDTO; |
||||
|
import org.dromara.sample.manage.model.dto.EventsDTO; |
||||
|
import org.dromara.sample.manage.model.entity.WarningRecordEntity; |
||||
|
import org.dromara.sample.manage.service.IDeviceService; |
||||
|
import org.dromara.sample.manage.service.IEngineRecordService; |
||||
|
import org.dromara.sample.manage.service.IWarningRecordService; |
||||
|
import org.dromara.system.api.model.LoginUser; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Optional; |
||||
|
|
||||
|
/** |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/15 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@Slf4j |
||||
|
@RequestMapping("${url.manage.prefix}${url.manage.version}/engineRecord") |
||||
|
@Tag(name = "无人机设备模块") |
||||
|
public class EngineRecordController { |
||||
|
|
||||
|
@Autowired |
||||
|
private IEngineRecordService engineRecordService; |
||||
|
@Autowired |
||||
|
private IWarningRecordService warningRecordService; |
||||
|
|
||||
|
/** |
||||
|
* 启动星罗引擎。 |
||||
|
* Get the topology list of all online devices in one workspace. |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/startEngine") |
||||
|
@Operation(summary = "启动星罗引擎。", description = "启动星罗引擎") |
||||
|
public HttpResultResponse<Map<String,Object>> startEngine(@RequestBody Map<String,Object> objectMap) { |
||||
|
return HttpResultResponse.success(engineRecordService.startEngine(objectMap)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/closeEngine") |
||||
|
@Operation(summary = "关闭星罗引擎。", description = "关闭星罗引擎") |
||||
|
public HttpResultResponse closeEngine(@RequestBody Map<String,Object> objectMap) { |
||||
|
engineRecordService.closeEngine(objectMap); |
||||
|
return HttpResultResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/some") |
||||
|
@Operation(summary = "存储推流的预警(对外接口)。", description = "存储推流的预警(对外接口)。") |
||||
|
public void some(@RequestBody CallBackDTO callBackVo){ |
||||
|
WarningRecordEntity warningRecord = new WarningRecordEntity(); |
||||
|
List<WarningRecordEntity> list = new ArrayList<>(); |
||||
|
if (CollectionUtils.isNotEmpty(callBackVo.getEvents())){ |
||||
|
for (EventsDTO eventsVo :callBackVo.getEvents()){ |
||||
|
warningRecord.setTaskId(callBackVo.getTaskId()); |
||||
|
warningRecord.setAlgoId(eventsVo.getAlgoId()); |
||||
|
warningRecord.setEventId(eventsVo.getEventId()); |
||||
|
warningRecord.setExtraType(eventsVo.getExtraType()); |
||||
|
warningRecord.setPicUrl(eventsVo.getPicUrl()); |
||||
|
warningRecord.setTimestamp(eventsVo.getTimestamp()); |
||||
|
list.add(warningRecord); |
||||
|
} |
||||
|
warningRecordService.saveBatch(list); |
||||
|
System.out.println(callBackVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package org.dromara.sample.manage.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.dromara.sample.manage.model.entity.DeviceStreamEntity; |
||||
|
import org.dromara.sample.manage.model.entity.PlayTextEntity; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @date 2021/11/10 |
||||
|
* @version 0.1 |
||||
|
*/ |
||||
|
public interface IDeviceStreamMapper extends BaseMapper<DeviceStreamEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package org.dromara.sample.manage.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.dromara.sample.manage.model.entity.DeviceEntity; |
||||
|
import org.dromara.sample.manage.model.entity.EngineRecordEntity; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @date 2021/11/10 |
||||
|
* @version 0.1 |
||||
|
*/ |
||||
|
public interface IEngineRecordMapper extends BaseMapper<EngineRecordEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package org.dromara.sample.manage.mapper; |
||||
|
|
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.dromara.sample.manage.model.entity.WarningRecordEntity; |
||||
|
|
||||
|
/** |
||||
|
* 设备对象-》用于存储设备Mapper接口 |
||||
|
* |
||||
|
* @author wuyuan |
||||
|
* @date 2022-10-25 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface WarningRecordMapper extends BaseMapper<WarningRecordEntity> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,30 @@ |
|||||
|
package org.dromara.sample.manage.model.dto; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 设备对象-》用于存储设备对象 iot_device |
||||
|
* |
||||
|
* @author wuyuan |
||||
|
* @date 2022-10-25 |
||||
|
*/ |
||||
|
@TableName("iot_device") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@Accessors(chain = true) |
||||
|
public class CallBackDTO implements Serializable { |
||||
|
//任务 id
|
||||
|
private String taskId; |
||||
|
|
||||
|
//检测事件列表
|
||||
|
private List<EventsDTO> events; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package org.dromara.sample.manage.model.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* The entity class of the device |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class Engine implements Serializable { |
||||
|
|
||||
|
|
||||
|
|
||||
|
private String task_id; |
||||
|
|
||||
|
private String mission_batch; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package org.dromara.sample.manage.model.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* The entity class of the device |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class EngineResponse implements Serializable { |
||||
|
|
||||
|
private Long code; |
||||
|
|
||||
|
private String message; |
||||
|
|
||||
|
private Engine data; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package org.dromara.sample.manage.model.dto; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 设备对象-》用于存储设备对象 iot_device |
||||
|
* |
||||
|
* @author wuyuan |
||||
|
* @date 2022-10-25 |
||||
|
*/ |
||||
|
@TableName("iot_device") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@Accessors(chain = true) |
||||
|
public class EventsDTO implements Serializable { |
||||
|
//算法 id")
|
||||
|
private Integer algoId; |
||||
|
|
||||
|
//算法类型字符串")
|
||||
|
private String extraType; |
||||
|
|
||||
|
|
||||
|
//分配的事件 id")
|
||||
|
private String eventId; |
||||
|
|
||||
|
|
||||
|
//保存后图片的 url")
|
||||
|
private String picUrl; |
||||
|
|
||||
|
|
||||
|
//事件时间戳,单位:毫秒")
|
||||
|
private Integer timestamp; |
||||
|
|
||||
|
//检测事件列表")
|
||||
|
private List<ObjectsDTO> objects; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package org.dromara.sample.manage.model.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* The entity class of the device |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class ExtraType implements Serializable { |
||||
|
|
||||
|
private Long id; |
||||
|
|
||||
|
private String sence; |
||||
|
|
||||
|
private String type; |
||||
|
|
||||
|
private String extra_type; |
||||
|
|
||||
|
private String model; |
||||
|
|
||||
|
private String user; |
||||
|
|
||||
|
private int difficult; |
||||
|
|
||||
|
private int if_open; |
||||
|
|
||||
|
private int sence_id; |
||||
|
|
||||
|
private Double conf; |
||||
|
|
||||
|
private int aiConfig; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package org.dromara.sample.manage.model.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* The entity class of the device |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class ExtraTypeResponse implements Serializable { |
||||
|
|
||||
|
private Long code; |
||||
|
|
||||
|
private String message; |
||||
|
|
||||
|
private List<ExtraType> data; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
package org.dromara.sample.manage.model.dto; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 设备对象-》用于存储设备对象 iot_device |
||||
|
* |
||||
|
* @author wuyuan |
||||
|
* @date 2022-10-25 |
||||
|
*/ |
||||
|
@TableName("iot_device") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@Accessors(chain = true) |
||||
|
public class ObjectsDTO implements Serializable { |
||||
|
//画面运动方向角度,-180度 到 180度")
|
||||
|
private String anglePx; |
||||
|
|
||||
|
//属性截图,base64编码")
|
||||
|
private String attrImage; |
||||
|
|
||||
|
//属性名称,车牌,人脸,或其他")
|
||||
|
private String attrName; |
||||
|
|
||||
|
//属性文字")
|
||||
|
private String attrText; |
||||
|
|
||||
|
//类别唯一ID")
|
||||
|
private String classId; |
||||
|
|
||||
|
//画面像素速度,单位(像素/秒)")
|
||||
|
private Integer speedPx; |
||||
|
|
||||
|
//追踪ID")
|
||||
|
private String trackId; |
||||
|
|
||||
|
//目标中心X")
|
||||
|
private Integer x; |
||||
|
|
||||
|
//目标中心Y")
|
||||
|
private Integer y; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package org.dromara.sample.manage.model.dto; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/23 |
||||
|
*/ |
||||
|
@Data |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
public class StreamTypeDTO { |
||||
|
private String jobId; |
||||
|
|
||||
|
private String jobName; |
||||
|
|
||||
|
private String labelCn; |
||||
|
|
||||
|
|
||||
|
private String labelEn; |
||||
|
|
||||
|
private Long deptId; |
||||
|
|
||||
|
private String deptName; |
||||
|
|
||||
|
private String deviceSn; |
||||
|
|
||||
|
private String lat; |
||||
|
|
||||
|
private String lng; |
||||
|
|
||||
|
private String images; |
||||
|
|
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package org.dromara.sample.manage.model.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* The entity class of the device |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
@TableName(value = "manage_device_stream") |
||||
|
public class DeviceStreamEntity implements Serializable { |
||||
|
|
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Integer id; |
||||
|
|
||||
|
@TableField(value = "rtmp_url") |
||||
|
private String rtmpUrl; |
||||
|
|
||||
|
@TableField(value = "stream_type") |
||||
|
private String streamType; |
||||
|
|
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private Date createTime; |
||||
|
|
||||
|
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
|
private Date updateTime; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package org.dromara.sample.manage.model.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* The entity class of the EngineRecord |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
@TableName(value = "engine_record") |
||||
|
public class EngineRecordEntity implements Serializable { |
||||
|
|
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Integer id; |
||||
|
|
||||
|
@TableField(value = "device_sn") |
||||
|
private String deviceSn; |
||||
|
|
||||
|
@TableField(value = "extra_type") |
||||
|
private String extraType; |
||||
|
|
||||
|
@TableField(value = "task_id") |
||||
|
private String taskId; |
||||
|
|
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private Date createTime; |
||||
|
|
||||
|
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
|
private Date updateTime; |
||||
|
|
||||
|
@TableField(value = "push_url") |
||||
|
private String pushUrl; |
||||
|
|
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
package org.dromara.sample.manage.model.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 设备对象-》用于存储设备对象 iot_device |
||||
|
* |
||||
|
* @author wuyuan |
||||
|
* @date 2022-10-25 |
||||
|
*/ |
||||
|
@TableName("warning_record") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@Accessors(chain = true) |
||||
|
public class WarningRecordEntity implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private String id; |
||||
|
|
||||
|
@TableField(value = "task_id") |
||||
|
private String taskId; |
||||
|
|
||||
|
@TableField(value = "algo_id") |
||||
|
//算法 id")
|
||||
|
private Integer algoId; |
||||
|
|
||||
|
@TableField(value = "extra_type") |
||||
|
//算法类型字符串")
|
||||
|
private String extraType; |
||||
|
|
||||
|
@TableField(value = "event_id") |
||||
|
//分配的事件 id")
|
||||
|
private String eventId; |
||||
|
|
||||
|
@TableField(value = "pic_url") |
||||
|
//保存后图片的 url")
|
||||
|
private String picUrl; |
||||
|
|
||||
|
@TableField(value = "timestamp") |
||||
|
//事件时间戳,单位:毫秒")
|
||||
|
private Integer timestamp; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
package org.dromara.sample.manage.service; |
||||
|
|
||||
|
import org.dromara.common.sdk.common.HttpResultResponse; |
||||
|
import org.dromara.common.sdk.common.PaginationData; |
||||
|
import org.dromara.sample.manage.model.entity.PlayTextEntity; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author sean.zhou |
||||
|
* @date 2021/11/10 |
||||
|
* @version 0.1 |
||||
|
*/ |
||||
|
public interface IDeviceStreamService { |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
package org.dromara.sample.manage.service; |
||||
|
|
||||
|
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
|
import com.fasterxml.jackson.databind.JsonNode; |
||||
|
import org.dromara.common.sdk.cloudapi.device.ControlSourceEnum; |
||||
|
import org.dromara.common.sdk.cloudapi.device.DeviceOsdHost; |
||||
|
import org.dromara.common.sdk.cloudapi.device.DockModeCodeEnum; |
||||
|
import org.dromara.common.sdk.cloudapi.device.DroneModeCodeEnum; |
||||
|
import org.dromara.common.sdk.common.HttpResultResponse; |
||||
|
import org.dromara.common.sdk.common.PaginationData; |
||||
|
import org.dromara.common.sdk.config.version.GatewayManager; |
||||
|
import org.dromara.common.websocket.dto.BizCodeEnum; |
||||
|
import org.dromara.sample.manage.model.dto.DeviceDTO; |
||||
|
import org.dromara.sample.manage.model.dto.DeviceFirmwareUpgradeDTO; |
||||
|
import org.dromara.sample.manage.model.dto.TopologyDeviceDTO; |
||||
|
import org.dromara.sample.manage.model.param.DeviceQueryParam; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Optional; |
||||
|
|
||||
|
/** |
||||
|
* @author sean.zhou |
||||
|
* @date 2021/11/10 |
||||
|
* @version 0.1 |
||||
|
*/ |
||||
|
public interface IEngineRecordService { |
||||
|
|
||||
|
Map<String,Object> startEngine(Map<String,Object> objectMap); |
||||
|
|
||||
|
void closeEngine(Map<String,Object> objectMap); |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package org.dromara.sample.manage.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import org.dromara.sample.manage.model.entity.WarningRecordEntity; |
||||
|
|
||||
|
/** |
||||
|
* 设备对象-》用于存储设备Service接口 |
||||
|
* |
||||
|
* @author wuyuan |
||||
|
* @date 2022-10-25 |
||||
|
*/ |
||||
|
public interface IWarningRecordService extends IService<WarningRecordEntity>{ |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package org.dromara.sample.manage.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.convert.Convert; |
||||
|
import cn.hutool.crypto.SecureUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.collections.CollectionUtils; |
||||
|
import org.apache.dubbo.config.annotation.DubboReference; |
||||
|
import org.dromara.common.sdk.common.HttpResultResponse; |
||||
|
import org.dromara.common.sdk.common.Pagination; |
||||
|
import org.dromara.common.sdk.common.PaginationData; |
||||
|
import org.dromara.common.sdk.mqtt.CommonTopicRequest; |
||||
|
import org.dromara.common.sdk.mqtt.MqttGatewayPublish; |
||||
|
import org.dromara.sample.feign.RemoteSystemFeign; |
||||
|
import org.dromara.sample.manage.mapper.IPlayTextMapper; |
||||
|
import org.dromara.sample.manage.model.dto.StreamTypeDTO; |
||||
|
import org.dromara.sample.manage.model.entity.PlayTextEntity; |
||||
|
import org.dromara.sample.manage.service.IDeviceStreamService; |
||||
|
import org.dromara.sample.manage.service.IPlayTextService; |
||||
|
import org.dromara.system.api.RemoteConfigService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Objects; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/10 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Slf4j |
||||
|
@Transactional |
||||
|
public class DeviceStreamServiceImpl implements IDeviceStreamService { |
||||
|
|
||||
|
} |
@ -0,0 +1,246 @@ |
|||||
|
package org.dromara.sample.manage.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
|
import com.fasterxml.jackson.databind.JsonMappingException; |
||||
|
import com.fasterxml.jackson.databind.JsonNode; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
import io.seata.common.util.StringUtils; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.http.client.methods.CloseableHttpResponse; |
||||
|
import org.apache.http.client.methods.HttpGet; |
||||
|
import org.apache.http.client.methods.HttpPost; |
||||
|
import org.apache.http.client.utils.URIBuilder; |
||||
|
import org.apache.http.entity.StringEntity; |
||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||
|
import org.apache.http.impl.client.HttpClients; |
||||
|
import org.apache.http.util.EntityUtils; |
||||
|
import org.dromara.common.sdk.cloudapi.device.*; |
||||
|
import org.dromara.common.sdk.cloudapi.firmware.*; |
||||
|
import org.dromara.common.sdk.cloudapi.firmware.api.AbstractFirmwareService; |
||||
|
import org.dromara.common.sdk.cloudapi.property.api.AbstractPropertyService; |
||||
|
import org.dromara.common.sdk.cloudapi.tsa.DeviceIconUrl; |
||||
|
import org.dromara.common.sdk.cloudapi.tsa.TopologyDeviceModel; |
||||
|
import org.dromara.common.sdk.common.*; |
||||
|
import org.dromara.common.sdk.config.version.GatewayManager; |
||||
|
import org.dromara.common.sdk.exception.CloudSDKException; |
||||
|
import org.dromara.common.sdk.mqtt.IMqttTopicService; |
||||
|
import org.dromara.common.sdk.mqtt.MqttGatewayPublish; |
||||
|
import org.dromara.common.sdk.mqtt.events.EventsSubscribe; |
||||
|
import org.dromara.common.sdk.mqtt.osd.OsdSubscribe; |
||||
|
import org.dromara.common.sdk.mqtt.property.PropertySetReplyResultEnum; |
||||
|
import org.dromara.common.sdk.mqtt.property.PropertySetSubscribe; |
||||
|
import org.dromara.common.sdk.mqtt.requests.RequestsSubscribe; |
||||
|
import org.dromara.common.sdk.mqtt.services.ServicesReplyData; |
||||
|
import org.dromara.common.sdk.mqtt.services.ServicesSubscribe; |
||||
|
import org.dromara.common.sdk.mqtt.services.TopicServicesResponse; |
||||
|
import org.dromara.common.sdk.mqtt.state.StateSubscribe; |
||||
|
import org.dromara.common.sdk.mqtt.status.StatusSubscribe; |
||||
|
import org.dromara.common.websocket.dto.BizCodeEnum; |
||||
|
import org.dromara.sample.common.error.CommonErrorEnum; |
||||
|
import org.dromara.sample.common.util.Md5Utils; |
||||
|
import org.dromara.sample.component.mqtt.model.EventsReceiver; |
||||
|
import org.dromara.sample.control.model.enums.DroneAuthorityEnum; |
||||
|
import org.dromara.sample.manage.mapper.IDeviceMapper; |
||||
|
import org.dromara.sample.manage.mapper.IDeviceProMapper; |
||||
|
import org.dromara.sample.manage.mapper.IEngineRecordMapper; |
||||
|
import org.dromara.sample.manage.model.dto.*; |
||||
|
import org.dromara.sample.manage.model.entity.DeviceEntity; |
||||
|
import org.dromara.sample.manage.model.entity.DeviceProEntity; |
||||
|
import org.dromara.sample.manage.model.entity.EngineRecordEntity; |
||||
|
import org.dromara.sample.manage.model.enums.DeviceFirmwareStatusEnum; |
||||
|
import org.dromara.sample.manage.model.enums.PropertySetFieldEnum; |
||||
|
import org.dromara.sample.manage.model.enums.UserTypeEnum; |
||||
|
import org.dromara.sample.manage.model.param.DeviceQueryParam; |
||||
|
import org.dromara.sample.manage.model.receiver.BasicDeviceProperty; |
||||
|
import org.dromara.sample.manage.service.*; |
||||
|
import org.dromara.sample.websocket.service.IWebSocketMessageService; |
||||
|
import org.json.JSONObject; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.net.URI; |
||||
|
import java.net.URISyntaxException; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import static org.apache.commons.compress.utils.ArchiveUtils.sanitize; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @author sean.zhou |
||||
|
* @version 0.1 |
||||
|
* @date 2021/11/10 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Slf4j |
||||
|
@Transactional |
||||
|
public class EngineRecordServiceImpl implements IEngineRecordService { |
||||
|
@Resource |
||||
|
IEngineRecordMapper mapper; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public Map<String, Object> startEngine(Map<String, Object> objectMap){ |
||||
|
EngineRecordEntity record = new EngineRecordEntity(); |
||||
|
//获取token
|
||||
|
//设置请求Header和Body(如JSON)
|
||||
|
String md5 = Md5Utils.hash("xuzhou_ai"); |
||||
|
JSONObject jsonObj = new JSONObject(); |
||||
|
jsonObj.put("username", sanitize("xuzhou_ai")); // sanitize函数见下文
|
||||
|
jsonObj.put("password", sanitize(md5)); |
||||
|
String responseBody = PostRequest(jsonObj, "http://60.204.247.65:8100/Third/Login"); |
||||
|
JSONObject jsonObject = new JSONObject(responseBody); |
||||
|
// 逐层获取 data -> token
|
||||
|
JSONObject data = jsonObject.getJSONObject("data"); |
||||
|
String token = data.getString("token"); |
||||
|
String sceneResponseBody = null; |
||||
|
String algorithmResponseBody = null; |
||||
|
//查询用户开通的场景
|
||||
|
if (StringUtils.isNotEmpty(token)){ |
||||
|
try { |
||||
|
URI uri = new URIBuilder("http://60.204.247.65:8100/V2/AI/WX/User/Scene") |
||||
|
.build(); |
||||
|
sceneResponseBody = GetRequest(uri, token); |
||||
|
} catch (URISyntaxException e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
JSONObject jsonObject1 = new JSONObject(sceneResponseBody); |
||||
|
// 逐层获取 data -> token
|
||||
|
JSONObject data1 = jsonObject.getJSONObject("data"); |
||||
|
String scene = data1.getString("scene"); |
||||
|
|
||||
|
//查询场景算法
|
||||
|
List<String> extra_type_list = new ArrayList<>(); |
||||
|
try { |
||||
|
URI uri = new URIBuilder("http://60.204.247.65:8100/V2/AI/WX/User/ExtraType/Get") |
||||
|
.addParameter("scene",scene) |
||||
|
.addParameter("if_open","1") |
||||
|
.build(); |
||||
|
algorithmResponseBody = GetRequest(uri, token); |
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
ExtraTypeResponse response = mapper.readValue(algorithmResponseBody,ExtraTypeResponse.class); |
||||
|
List<ExtraType> list = response.getData(); |
||||
|
for (ExtraType extraType : list) { |
||||
|
extra_type_list.add(extraType.getExtra_type()); |
||||
|
break; |
||||
|
} |
||||
|
} catch (URISyntaxException | JsonProcessingException e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
|
||||
|
JSONObject jsonObj2 = new JSONObject(); |
||||
|
jsonObj2.put("scene", scene); // sanitize函数见下文
|
||||
|
jsonObj2.put("callback_url", objectMap.get("callback_url")); |
||||
|
jsonObj2.put("input_url", objectMap.get("input_url")); |
||||
|
jsonObj2.put("push_url", objectMap.get("push_url")); |
||||
|
jsonObj2.put("play_url", objectMap.get("play_url")); |
||||
|
String responseBody2 = PostRequest(jsonObj2, "http://60.204.247.65:8100/Third/Engine/Start"); |
||||
|
ObjectMapper mapper1 = new ObjectMapper(); |
||||
|
EngineResponse response = null; |
||||
|
try { |
||||
|
response = mapper1.readValue(responseBody2, EngineResponse.class); |
||||
|
} catch (JsonProcessingException e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
objectMap.put("task_id",response.getData().getTask_id()); |
||||
|
record.setPushUrl(objectMap.get("push_url").toString()); |
||||
|
record.setDeviceSn(objectMap.get("device_sn").toString()); |
||||
|
record.setTaskId(response.getData().getTask_id()); |
||||
|
record.setExtraType(String.join(",", extra_type_list)); |
||||
|
} |
||||
|
Map<String, Object> map = new HashMap(); |
||||
|
map.put("callback_url", objectMap.get("callback_url")); |
||||
|
map.put("input_url", objectMap.get("input_url")); |
||||
|
map.put("push_url", objectMap.get("push_url")); |
||||
|
map.put("play_url", objectMap.get("play_url")); |
||||
|
map.put("task_id", objectMap.get("task_id")); |
||||
|
//添加启动引擎记录
|
||||
|
mapper.insert(record); |
||||
|
return map; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void closeEngine(Map<String, Object> objectMap) { |
||||
|
JSONObject jsonObj2 = new JSONObject(); |
||||
|
EngineRecordEntity record = mapper.selectOne(new LambdaQueryWrapper<EngineRecordEntity>().eq(EngineRecordEntity::getDeviceSn, objectMap.get("device_sn"))); |
||||
|
if (record == null){ |
||||
|
throw new RuntimeException("关闭引擎失败!"); |
||||
|
} |
||||
|
jsonObj2.put("task_id", record.getTaskId()); // sanitize函数见下文
|
||||
|
String responseBody2 = PostRequest(jsonObj2, "http://60.204.247.65:8100/Third/Engine/Stop"); |
||||
|
JSONObject json = new JSONObject(responseBody2); |
||||
|
// 方式2:安全获取(先判空再转换)
|
||||
|
Object dataObj = json.get("data"); |
||||
|
if(dataObj != null && dataObj instanceof Integer) { |
||||
|
int data = (Integer) dataObj; |
||||
|
if (data ==1){ |
||||
|
mapper.delete(new LambdaQueryWrapper<EngineRecordEntity>().eq(EngineRecordEntity::getDeviceSn, objectMap.get("device_sn"))); |
||||
|
}else { |
||||
|
throw new RuntimeException("关闭引擎失败!"); |
||||
|
} |
||||
|
} else { |
||||
|
throw new RuntimeException("关闭引擎失败!"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public String PostRequest( JSONObject jsonObj, String url |
||||
|
) { |
||||
|
try (CloseableHttpClient httpClient = HttpClients.createDefault()) { |
||||
|
// 1. 创建POST请求对象
|
||||
|
HttpPost post = new HttpPost(url); |
||||
|
StringEntity requestEntity = new StringEntity(jsonObj.toString(), "UTF-8"); |
||||
|
requestEntity.setContentType("application/json"); |
||||
|
post.setEntity(requestEntity); |
||||
|
post.setHeader("Accept", "application/json"); |
||||
|
// 3. 执行请求并获取响应
|
||||
|
try (CloseableHttpResponse response = httpClient.execute(post)) { |
||||
|
String responseBody = EntityUtils.toString(response.getEntity()); |
||||
|
if (response.getStatusLine().getStatusCode() == 200) { |
||||
|
return responseBody; |
||||
|
} else { |
||||
|
throw new RuntimeException("第三方接口调用失败!"); |
||||
|
} |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return null; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String GetRequest(URI uri, String token |
||||
|
) { |
||||
|
try (CloseableHttpClient httpClient = HttpClients.createDefault()) { |
||||
|
// URI uri = new URIBuilder("https://api.example.com/data")
|
||||
|
// .addParameter("param1", "value1")
|
||||
|
// .addParameter("param2", "value2")
|
||||
|
// .build();
|
||||
|
HttpGet httpGet = new HttpGet(uri); |
||||
|
httpGet.setHeader("token",token); |
||||
|
try (CloseableHttpResponse response = httpClient.execute(httpGet)) { |
||||
|
// 处理响应
|
||||
|
String responseBody = EntityUtils.toString(response.getEntity()); |
||||
|
if (response.getStatusLine().getStatusCode() == 200){ |
||||
|
return responseBody; |
||||
|
}else { |
||||
|
throw new RuntimeException("第三方接口调用失败!"); |
||||
|
} |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return null; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package org.dromara.sample.manage.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.dromara.sample.manage.mapper.WarningRecordMapper; |
||||
|
import org.dromara.sample.manage.model.entity.WarningRecordEntity; |
||||
|
import org.dromara.sample.manage.service.IWarningRecordService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 设备对象-》用于存储设备Service业务层处理 |
||||
|
* |
||||
|
* @author wuyuan |
||||
|
* @date 2022-10-25 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Slf4j |
||||
|
public class WarningRecordServiceImpl extends ServiceImpl<WarningRecordMapper, WarningRecordEntity> implements IWarningRecordService { |
||||
|
|
||||
|
} |
@ -0,0 +1,79 @@ |
|||||
|
package org.dromara.sample.rocketmq; |
||||
|
|
||||
|
import org.apache.rocketmq.common.message.MessageExt; |
||||
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
||||
|
import org.apache.rocketmq.spring.core.RocketMQListener; |
||||
|
import org.dromara.common.sdk.cloudapi.device.VideoId; |
||||
|
import org.dromara.common.sdk.cloudapi.livestream.LensChangeVideoTypeEnum; |
||||
|
import org.dromara.common.sdk.cloudapi.livestream.UrlTypeEnum; |
||||
|
import org.dromara.common.sdk.cloudapi.livestream.VideoQualityEnum; |
||||
|
import org.dromara.common.sdk.cloudapi.wayline.FlighttaskProgress; |
||||
|
import org.dromara.common.sdk.common.HttpResultResponse; |
||||
|
import org.dromara.sample.component.mqtt.model.EventsReceiver; |
||||
|
import org.dromara.sample.manage.model.dto.DeviceDTO; |
||||
|
import org.dromara.sample.manage.model.dto.LiveDTO; |
||||
|
import org.dromara.sample.manage.model.dto.LiveTypeDTO; |
||||
|
import org.dromara.sample.manage.model.entity.DeviceEntity; |
||||
|
import org.dromara.sample.manage.service.IDeviceRedisService; |
||||
|
import org.dromara.sample.manage.service.IDeviceService; |
||||
|
import org.dromara.sample.manage.service.ILiveStreamService; |
||||
|
import org.dromara.sample.manage.service.IPlayTextService; |
||||
|
import org.dromara.sample.wayline.model.dto.WaylineJobDTO; |
||||
|
import org.dromara.sample.wayline.service.IWaylineJobService; |
||||
|
import org.dromara.sample.wayline.service.IWaylineRedisService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
import java.util.Optional; |
||||
|
|
||||
|
/** |
||||
|
* @auther wuyuan |
||||
|
* @data 2025/5/12 |
||||
|
*/ |
||||
|
@RocketMQMessageListener(consumerGroup = "videoStart",topic = "videoStartConsum") |
||||
|
@Component |
||||
|
public class RocketMqConsum implements RocketMQListener<MessageExt> { |
||||
|
|
||||
|
@Autowired |
||||
|
private ILiveStreamService liveStreamService; |
||||
|
|
||||
|
@Autowired |
||||
|
private IPlayTextService playTextService; |
||||
|
|
||||
|
@Autowired |
||||
|
private IWaylineRedisService waylineRedisService; |
||||
|
|
||||
|
@Autowired |
||||
|
private IDeviceService deviceService; |
||||
|
|
||||
|
@Autowired |
||||
|
private IWaylineJobService waylineJobService; |
||||
|
|
||||
|
@Autowired |
||||
|
private IDeviceRedisService deviceRedisService; |
||||
|
|
||||
|
@Override |
||||
|
public void onMessage(MessageExt message) { |
||||
|
String videoIds = new String(message.getBody()); |
||||
|
VideoId videoId = new VideoId(videoIds); |
||||
|
LiveTypeDTO liveTypeDTO = new LiveTypeDTO(); |
||||
|
liveTypeDTO.setUrlType(UrlTypeEnum.WHIP); |
||||
|
liveTypeDTO.setVideoType(LensChangeVideoTypeEnum.WIDE); |
||||
|
liveTypeDTO.setVideoQuality(VideoQualityEnum.ULTRA_HD); |
||||
|
liveTypeDTO.setVideoId(videoId); |
||||
|
DeviceEntity deviceBySn = deviceService.getDeviceByChildSn(videoId.getDroneSn()); |
||||
|
Optional<EventsReceiver<FlighttaskProgress>> runningWaylineJob = waylineRedisService.getRunningWaylineJob(deviceBySn.getDeviceSn()); |
||||
|
Map<String,Object> reqMap = new HashMap<>(); |
||||
|
if(runningWaylineJob.isPresent()) { |
||||
|
String jobId = runningWaylineJob.get().getOutput().getExt().getFlightId(); |
||||
|
Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobInternalId(jobId); |
||||
|
reqMap.put("jobId",waylineJobDTO.get().getJobId()); |
||||
|
reqMap.put("jobName",waylineJobDTO.get().getJobName()); |
||||
|
reqMap.put("deviceSn",videoId.getDroneSn()); |
||||
|
playTextService.streamType(reqMap); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,79 @@ |
|||||
|
package org.dromara.system.config; |
||||
|
|
||||
|
import io.minio.MinioClient; |
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
/** |
||||
|
* Minio 配置信息 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@ConfigurationProperties(prefix = "osstianyi") |
||||
|
public class OssTianyiConfig |
||||
|
{ |
||||
|
|
||||
|
private String endPoint; |
||||
|
private String accessKey; |
||||
|
private String secretKey; |
||||
|
private String bucketName; |
||||
|
|
||||
|
public String getEndPoint() { |
||||
|
return endPoint; |
||||
|
} |
||||
|
|
||||
|
public void setEndPoint(String endPoint) { |
||||
|
this.endPoint = endPoint; |
||||
|
} |
||||
|
|
||||
|
public String getAccessKey() |
||||
|
{ |
||||
|
return accessKey; |
||||
|
} |
||||
|
|
||||
|
public void setAccessKey(String accessKey) |
||||
|
{ |
||||
|
this.accessKey = accessKey; |
||||
|
} |
||||
|
|
||||
|
public String getSecretKey() |
||||
|
{ |
||||
|
return secretKey; |
||||
|
} |
||||
|
|
||||
|
public void setSecretKey(String secretKey) |
||||
|
{ |
||||
|
this.secretKey = secretKey; |
||||
|
} |
||||
|
|
||||
|
public String getBucketName() |
||||
|
{ |
||||
|
return bucketName; |
||||
|
} |
||||
|
|
||||
|
public void setBucketName(String bucketName) |
||||
|
{ |
||||
|
this.bucketName = bucketName; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return "OssTianyiConfig{" + |
||||
|
"endPoint='" + endPoint + '\'' + |
||||
|
", accessKey='" + accessKey + '\'' + |
||||
|
", secretKey='" + secretKey + '\'' + |
||||
|
", bucketName='" + bucketName + '\'' + |
||||
|
'}'; |
||||
|
} |
||||
|
|
||||
|
@Bean |
||||
|
public MinioClient getMinioClient() |
||||
|
{ |
||||
|
// System.out.println("OssTianyiConfig");
|
||||
|
// System.out.println("OssTianyiConfig" + endPoint);
|
||||
|
System.out.println(toString()); |
||||
|
return MinioClient.builder().endpoint(endPoint).credentials(accessKey, secretKey).build(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,113 @@ |
|||||
|
package org.dromara.system.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.system.domain.vo.DjiApiVo; |
||||
|
import org.dromara.system.domain.bo.DjiApiBo; |
||||
|
import org.dromara.system.service.IDjiApiService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 大疆开发 |
||||
|
* 前端访问路由地址为:/djidev/djiApi |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-14 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/djiApi") |
||||
|
public class DjiApiController extends BaseController { |
||||
|
|
||||
|
private final IDjiApiService djiApiService; |
||||
|
|
||||
|
/** |
||||
|
* 查询大疆开发列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApi:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<DjiApiVo> list(DjiApiBo bo, PageQuery pageQuery) { |
||||
|
return djiApiService.queryPageList(bo, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出大疆开发列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApi:export") |
||||
|
@Log(title = "大疆开发", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(DjiApiBo bo, HttpServletResponse response) { |
||||
|
List<DjiApiVo> list = djiApiService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "大疆开发", DjiApiVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取大疆开发详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApi:query") |
||||
|
@GetMapping("/{id}") |
||||
|
public R<DjiApiVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable Long id) { |
||||
|
return R.ok(djiApiService.queryById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增大疆开发 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApi:add") |
||||
|
@Log(title = "大疆开发", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DjiApiBo bo) { |
||||
|
//跟新版本次数
|
||||
|
if(null == bo.getVersionCount()){ |
||||
|
DjiApiBo bo1 = new DjiApiBo(); |
||||
|
bo1.setDjiApiType(bo.getDjiApiType()); |
||||
|
List<DjiApiVo> djiApiVos = djiApiService.queryList(bo1); |
||||
|
bo.setVersionCount(djiApiVos.size() +1); |
||||
|
} |
||||
|
return toAjax(djiApiService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改大疆开发 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApi:edit") |
||||
|
@Log(title = "大疆开发", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DjiApiBo bo) { |
||||
|
return toAjax(djiApiService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除大疆开发 |
||||
|
* |
||||
|
* @param ids 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApi:remove") |
||||
|
@Log(title = "大疆开发", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] ids) { |
||||
|
return toAjax(djiApiService.deleteWithValidByIds(List.of(ids), true)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,131 @@ |
|||||
|
package org.dromara.system.controller; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.dromara.common.excel.core.ExcelResult; |
||||
|
import org.dromara.system.domain.vo.SysUserImportVo; |
||||
|
import org.dromara.system.listener.DjiApiErrorImportListener; |
||||
|
import org.dromara.system.listener.SysUserImportListener; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.system.domain.vo.DjiApiErrorVo; |
||||
|
import org.dromara.system.domain.bo.DjiApiErrorBo; |
||||
|
import org.dromara.system.service.IDjiApiErrorService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
/** |
||||
|
* 大疆开发-错误码 |
||||
|
* 前端访问路由地址为:/djidev/djiApiError |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-14 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/djiApiError") |
||||
|
public class DjiApiErrorController extends BaseController { |
||||
|
|
||||
|
private final IDjiApiErrorService djiApiErrorService; |
||||
|
|
||||
|
/** |
||||
|
* 查询大疆开发-错误码列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApiError:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<DjiApiErrorVo> list(DjiApiErrorBo bo, PageQuery pageQuery) { |
||||
|
return djiApiErrorService.queryPageList(bo, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出大疆开发-错误码列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApiError:export") |
||||
|
@Log(title = "大疆开发-错误码", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(DjiApiErrorBo bo, HttpServletResponse response) { |
||||
|
List<DjiApiErrorVo> list = djiApiErrorService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "大疆开发-错误码", DjiApiErrorVo.class, response); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Log(title = "大疆开发-错误码管理", businessType = BusinessType.IMPORT) |
||||
|
@SaCheckPermission("djidev:djiApiError:import") |
||||
|
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
||||
|
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { |
||||
|
ExcelResult<DjiApiErrorVo> result = ExcelUtil.importExcel(file.getInputStream(), DjiApiErrorVo.class, new DjiApiErrorImportListener(updateSupport)); |
||||
|
return R.ok(result.getAnalysis()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取导入模板 |
||||
|
*/ |
||||
|
@PostMapping("/importTemplate") |
||||
|
public void importTemplate(HttpServletResponse response) { |
||||
|
ExcelUtil.exportExcel(new ArrayList<>(), "大疆开发-错误码数据", DjiApiErrorVo.class, response); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取大疆开发-错误码详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApiError:query") |
||||
|
@GetMapping("/{id}") |
||||
|
public R<DjiApiErrorVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable Long id) { |
||||
|
return R.ok(djiApiErrorService.queryById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增大疆开发-错误码 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApiError:add") |
||||
|
@Log(title = "大疆开发-错误码", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DjiApiErrorBo bo) { |
||||
|
return toAjax(djiApiErrorService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改大疆开发-错误码 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApiError:edit") |
||||
|
@Log(title = "大疆开发-错误码", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DjiApiErrorBo bo) { |
||||
|
return toAjax(djiApiErrorService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除大疆开发-错误码 |
||||
|
* |
||||
|
* @param ids 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("djidev:djiApiError:remove") |
||||
|
@Log(title = "大疆开发-错误码", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] ids) { |
||||
|
return toAjax(djiApiErrorService.deleteWithValidByIds(List.of(ids), true)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
package org.dromara.system.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.system.domain.vo.SysSubmailConfigUserVo; |
||||
|
import org.dromara.system.domain.bo.SysSubmailConfigUserBo; |
||||
|
import org.dromara.system.service.ISysSubmailConfigUserService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 赛邮服务配置用户 |
||||
|
* 前端访问路由地址为:/system/sysSubmailConfigUser |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-11 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/sysSubmailConfigUser") |
||||
|
public class SysSubmailConfigUserController extends BaseController { |
||||
|
|
||||
|
private final ISysSubmailConfigUserService sysSubmailConfigUserService; |
||||
|
|
||||
|
/** |
||||
|
* 查询赛邮服务配置用户列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfigUser:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<SysSubmailConfigUserVo> list(SysSubmailConfigUserBo bo, PageQuery pageQuery) { |
||||
|
return sysSubmailConfigUserService.queryPageList(bo, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出赛邮服务配置用户列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfigUser:export") |
||||
|
@Log(title = "赛邮服务配置用户", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(SysSubmailConfigUserBo bo, HttpServletResponse response) { |
||||
|
List<SysSubmailConfigUserVo> list = sysSubmailConfigUserService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "赛邮服务配置用户", SysSubmailConfigUserVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取赛邮服务配置用户详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfigUser:query") |
||||
|
@GetMapping("/{id}") |
||||
|
public R<SysSubmailConfigUserVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable Long id) { |
||||
|
return R.ok(sysSubmailConfigUserService.queryById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增赛邮服务配置用户 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfigUser:add") |
||||
|
@Log(title = "赛邮服务配置用户", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysSubmailConfigUserBo bo) { |
||||
|
return toAjax(sysSubmailConfigUserService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改赛邮服务配置用户 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfigUser:edit") |
||||
|
@Log(title = "赛邮服务配置用户", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysSubmailConfigUserBo bo) { |
||||
|
return toAjax(sysSubmailConfigUserService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除赛邮服务配置用户 |
||||
|
* |
||||
|
* @param ids 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfigUser:remove") |
||||
|
@Log(title = "赛邮服务配置用户", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] ids) { |
||||
|
return toAjax(sysSubmailConfigUserService.deleteWithValidByIds(List.of(ids), true)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package org.dromara.system.controller.ossTianyi; |
||||
|
|
||||
|
|
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.system.domain.SysUploadFile; |
||||
|
import org.dromara.system.utils.OssTianyiClientUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
|
||||
|
/** |
||||
|
* 系统上传文件Controller |
||||
|
* |
||||
|
* @author tom |
||||
|
* @date 2024-12-21 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/ossTianyi") |
||||
|
public class OssTianyiController extends BaseController |
||||
|
{ |
||||
|
|
||||
|
@Autowired |
||||
|
private OssTianyiClientUtils ossTianyiClientUtils; |
||||
|
|
||||
|
/** |
||||
|
* 查询系统上传文件列表 (实际是上传接口) |
||||
|
*/ |
||||
|
@SaCheckPermission("file:sysUploadFile:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo list(SysUploadFile sysUploadFile) |
||||
|
{ |
||||
|
String localFilePath = "D:\\123pan\\page.html"; |
||||
|
try{ |
||||
|
ossTianyiClientUtils.uploadFileTest("page.html","dev/temp",localFilePath); |
||||
|
}catch (Exception e){ |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/upload") |
||||
|
public R<HashMap<String, Object>> upload(@RequestPart("file") MultipartFile file) { |
||||
|
try { |
||||
|
ossTianyiClientUtils.uploadFile( "dev/temp/"+file.getName(), file); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,125 @@ |
|||||
|
package org.dromara.system.controller.site; |
||||
|
|
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.apache.dubbo.config.annotation.DubboReference; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.service.DictService; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.resource.api.RemoteMessageService; |
||||
|
import org.dromara.system.domain.bo.SysNoticeBo; |
||||
|
import org.dromara.system.domain.vo.SysNoticeVo; |
||||
|
import org.dromara.system.service.ISysNoticeService; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* 公告 信息操作处理 |
||||
|
* |
||||
|
* @author Lion Li |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/site") |
||||
|
public class SiteController extends BaseController { |
||||
|
|
||||
|
private final ISysNoticeService noticeService; |
||||
|
private final DictService dictService; |
||||
|
|
||||
|
@DubboReference |
||||
|
private final RemoteMessageService remoteMessageService; |
||||
|
|
||||
|
|
||||
|
|
||||
|
//每周提供一次二维场地全貌图及工地视频。 以周为单位处理数据
|
||||
|
//site/img/2005/xxxxxxx.png
|
||||
|
//site/video/2025/
|
||||
|
|
||||
|
//todo 二维瓦片上传
|
||||
|
|
||||
|
|
||||
|
//todo 二维瓦片批量上传 (按照周)
|
||||
|
|
||||
|
|
||||
|
//todo 二维瓦片批量下载 (按照周)
|
||||
|
|
||||
|
//todo 二维瓦片访问 #按照 http://localhost:3308/tile/{z}/{x}/{y}.png 模式访问
|
||||
|
|
||||
|
|
||||
|
//todo 工地视频上传
|
||||
|
|
||||
|
//todo 工地视频下载
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取通知公告列表 |
||||
|
*/ |
||||
|
// @SaCheckPermission("system:notice:list")
|
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<SysNoticeVo> list(SysNoticeBo notice, PageQuery pageQuery) { |
||||
|
return noticeService.selectPageNoticeList(notice, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据通知公告编号获取详细信息 |
||||
|
* |
||||
|
* @param noticeId 公告ID |
||||
|
*/ |
||||
|
// @SaCheckPermission("system:notice:query")
|
||||
|
@GetMapping(value = "/{noticeId}") |
||||
|
public R<SysNoticeVo> getInfo(@PathVariable Long noticeId) { |
||||
|
return R.ok(noticeService.selectNoticeById(noticeId)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增通知公告 |
||||
|
*/ |
||||
|
// @SaCheckPermission("system:notice:add")
|
||||
|
@Log(title = "通知公告", businessType = BusinessType.INSERT) |
||||
|
@PostMapping |
||||
|
public R<Void> add(@Validated @RequestBody SysNoticeBo notice) { |
||||
|
int rows = noticeService.insertNotice(notice); |
||||
|
if (rows <= 0) { |
||||
|
return R.fail(); |
||||
|
} |
||||
|
String type = dictService.getDictLabel("sys_notice_type", notice.getNoticeType()); |
||||
|
remoteMessageService.publishAll("[" + type + "] " + notice.getNoticeTitle()); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改通知公告 |
||||
|
*/ |
||||
|
// @SaCheckPermission("system:notice:edit")
|
||||
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping |
||||
|
public R<Void> edit(@Validated @RequestBody SysNoticeBo notice) { |
||||
|
return toAjax(noticeService.updateNotice(notice)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除通知公告 |
||||
|
* |
||||
|
* @param noticeIds 公告ID串 |
||||
|
*/ |
||||
|
// @SaCheckPermission("system:notice:remove")
|
||||
|
@Log(title = "通知公告", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{noticeIds}") |
||||
|
public R<Void> remove(@PathVariable Long[] noticeIds) { |
||||
|
return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,239 @@ |
|||||
|
package org.dromara.system.controller.site; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.dromara.common.core.service.DictService; |
||||
|
import org.dromara.common.dict.utils.DictUtils; |
||||
|
import org.dromara.system.api.RemoteDictService; |
||||
|
import org.dromara.system.api.domain.vo.RemoteDictDataVo; |
||||
|
import org.dromara.system.domain.SiteWeek; |
||||
|
import org.dromara.system.domain.bo.SiteWeekOssBo; |
||||
|
import org.dromara.system.domain.vo.SiteWeekOssVo; |
||||
|
import org.dromara.system.domain.vo.SysDictDataVo; |
||||
|
import org.dromara.system.service.ISiteWeekOssService; |
||||
|
import org.dromara.system.service.ISysDictDataService; |
||||
|
import org.dromara.system.utils.OssTianyiClientUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.system.domain.vo.SiteWeekVo; |
||||
|
import org.dromara.system.domain.bo.SiteWeekBo; |
||||
|
import org.dromara.system.service.ISiteWeekService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.system.utils.WeekNoUtil; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 工地日期周 |
||||
|
* 前端访问路由地址为:/system/siteWeek |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-10 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/siteWeek") |
||||
|
public class SiteWeekController extends BaseController { |
||||
|
|
||||
|
private final ISiteWeekService siteWeekService; |
||||
|
|
||||
|
// @Autowired
|
||||
|
// private ISysDictDataService sysDictDataService;
|
||||
|
// RemoteDictService
|
||||
|
|
||||
|
private final DictService dictService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ISiteWeekOssService siteWeekOssService; |
||||
|
|
||||
|
@Autowired |
||||
|
private OssTianyiClientUtils ossTianyiClientUtils; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 查询工地日期周列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeek:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<SiteWeekVo> list(SiteWeekBo bo, PageQuery pageQuery) { |
||||
|
return siteWeekService.queryPageList(bo, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出工地日期周列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeek:export") |
||||
|
@Log(title = "工地日期周", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(SiteWeekBo bo, HttpServletResponse response) { |
||||
|
List<SiteWeekVo> list = siteWeekService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "工地日期周", SiteWeekVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取工地日期周详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeek:query") |
||||
|
@GetMapping("/{id}") |
||||
|
public R<SiteWeekVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable Long id) { |
||||
|
return R.ok(siteWeekService.queryById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增工地日期周 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeek:add") |
||||
|
@Log(title = "工地日期周", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SiteWeekBo bo) { |
||||
|
return toAjax(siteWeekService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
@SaCheckPermission("system:siteWeek:add") |
||||
|
@Log(title = "工地日期周", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping("/autoAdd") |
||||
|
public R<SiteWeekVo> autoAdd(@Validated(AddGroup.class) @RequestBody SiteWeekBo bo) { |
||||
|
R<SiteWeekVo> siteWeekVo = autoAddSiteWeek(); |
||||
|
return siteWeekVo; |
||||
|
} |
||||
|
|
||||
|
private R<SiteWeekVo> autoAddSiteWeek() { |
||||
|
//新增时基于最新日期处理weekNo
|
||||
|
//先查找当前周是否已存在数据库, 有》返回已有数据, 无》新建数据再返回
|
||||
|
Date currentDate = new Date(); |
||||
|
|
||||
|
int weekNoByDate = WeekNoUtil.getWeekNoByDate(currentDate); |
||||
|
|
||||
|
SiteWeekBo siteWeekBo = new SiteWeekBo(); |
||||
|
siteWeekBo.setWeekNo((long) weekNoByDate); |
||||
|
|
||||
|
|
||||
|
List<SiteWeekVo> siteWeekVoList = siteWeekService.queryList(siteWeekBo); |
||||
|
SiteWeekVo siteWeekVo = null; |
||||
|
if (siteWeekVoList.size() > 0) { |
||||
|
return R.fail("当前周已存在,无法新增"); |
||||
|
|
||||
|
}else{ |
||||
|
String dateStr = WeekNoUtil.generateDateStr(currentDate); |
||||
|
String dateFormatStr = DateUtil.format(currentDate, "yyyy-MM-dd"); |
||||
|
siteWeekBo.setName(dateStr); |
||||
|
siteWeekBo.setNameTime(dateFormatStr); |
||||
|
|
||||
|
|
||||
|
//扩展默认字典配置 默认(tile/tileZip/img/video)
|
||||
|
// List<SysDictDataVo> siteOssDirList = DictUtils.getDictCache("site_oss_dir");
|
||||
|
/** |
||||
|
* 这里用dictService直接查,是因为 RemoteDictDataVo 转 SysDictDataVo 报错,折中做法,(简单说就是 RemoteDictDataVo vo = siteOssDirList.get(0)就报错) |
||||
|
* 报错如下 |
||||
|
* class org.dromara.system.domain.vo.SysDictDataVo cannot be cast to class org.dromara.system.api.domain.vo.RemoteDictDataVo |
||||
|
* (org.dromara.system.domain.vo.SysDictDataVo and org.dromara.system.api.domain.vo.RemoteDictDataVo are in unnamed module of |
||||
|
* loader 'app') |
||||
|
*/ |
||||
|
Map<String, String> siteOssDirMap = dictService.getAllDictMapByDictType("site_oss_dir"); |
||||
|
|
||||
|
siteWeekBo.setDirTile(siteOssDirMap.getOrDefault("二维地图","tile")); |
||||
|
siteWeekBo.setDirTileZip(siteOssDirMap.getOrDefault("二维地图压缩包","tileZip")); |
||||
|
siteWeekBo.setDirImg(siteOssDirMap.getOrDefault("图片","img")); |
||||
|
siteWeekBo.setDirVideo(siteOssDirMap.getOrDefault("视频","video")); |
||||
|
|
||||
|
/* |
||||
|
for (int i = 0; i < siteOssDirList.size(); i++) { |
||||
|
switch (siteOssDirList.get(i).getDictLabel()){ |
||||
|
case "二维地图": |
||||
|
siteWeekBo.setDirTile(siteOssDirList.get(i).getDictValue()); |
||||
|
break; |
||||
|
case "二维地图压缩包": |
||||
|
siteWeekBo.setDirTileZip(siteOssDirList.get(i).getDictValue()); |
||||
|
break; |
||||
|
case "图片": |
||||
|
siteWeekBo.setDirImg(siteOssDirList.get(i).getDictValue()); |
||||
|
break; |
||||
|
case "视频": |
||||
|
siteWeekBo.setDirVideo(siteOssDirList.get(i).getDictValue()); |
||||
|
break; |
||||
|
} |
||||
|
}*/ |
||||
|
|
||||
|
siteWeekService.insertByBo(siteWeekBo); |
||||
|
siteWeekVo = BeanUtil.copyProperties(siteWeekBo, SiteWeekVo.class); |
||||
|
} |
||||
|
return R.ok(siteWeekVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 修改工地日期周 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeek:edit") |
||||
|
@Log(title = "工地日期周", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SiteWeekBo bo) { |
||||
|
return toAjax(siteWeekService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
@SaCheckPermission("system:siteWeek:edit") |
||||
|
@Log(title = "更新工地日期周", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping("changeKeepFlag") |
||||
|
public R<Void> changeKeepFlag(@Validated(EditGroup.class) @RequestBody SiteWeekBo bo) { |
||||
|
return toAjax(siteWeekService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除工地日期周 |
||||
|
* |
||||
|
* @param ids 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeek:remove") |
||||
|
@Log(title = "工地日期周", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] ids) { |
||||
|
// Boolean result = siteWeekService.deleteWithValidByIds(List.of(ids), true);
|
||||
|
|
||||
|
Boolean result = true; |
||||
|
for (Long id : ids) { |
||||
|
SiteWeekOssBo siteWeekOssBo = new SiteWeekOssBo(); |
||||
|
siteWeekOssBo.setSiteWeekId(id); |
||||
|
List<SiteWeekOssVo> siteWeekOssVoList = siteWeekOssService.queryList(siteWeekOssBo); |
||||
|
for (SiteWeekOssVo siteWeekOssVo : siteWeekOssVoList) { |
||||
|
try{ |
||||
|
ossTianyiClientUtils.deleteFile(siteWeekOssVo.getUrl()); //minio删除文件
|
||||
|
siteWeekOssService.deleteWithValidByIds(List.of(siteWeekOssVo.getId()),true); //工地周数据删除
|
||||
|
}catch (Exception e){ |
||||
|
result = false; |
||||
|
System.err.println("天翼oss文件删除失败"+ siteWeekOssVo.getUrl()); |
||||
|
} |
||||
|
} |
||||
|
siteWeekService.deleteWithValidByIds(List.of(id),true); |
||||
|
} |
||||
|
|
||||
|
return toAjax(result); |
||||
|
} |
||||
|
} |
@ -0,0 +1,227 @@ |
|||||
|
package org.dromara.system.controller.site; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.net.URLEncoder; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import cn.hutool.core.io.FileUtil; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import jakarta.servlet.ServletOutputStream; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.apache.poi.util.IOUtils; |
||||
|
import org.dromara.system.config.OssTianyiConfig; |
||||
|
import org.dromara.system.domain.bo.SiteWeekBo; |
||||
|
import org.dromara.system.domain.vo.SiteWeekVo; |
||||
|
import org.dromara.system.service.ISiteWeekService; |
||||
|
import org.dromara.system.utils.OssTianyiClientUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.system.domain.vo.SiteWeekOssVo; |
||||
|
import org.dromara.system.domain.bo.SiteWeekOssBo; |
||||
|
import org.dromara.system.service.ISiteWeekOssService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
/** |
||||
|
* 工地周OSS对象存储 |
||||
|
* 前端访问路由地址为:/system/siteWeekOss |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-10 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/siteWeekOss") |
||||
|
public class SiteWeekOssController extends BaseController { |
||||
|
|
||||
|
private final ISiteWeekOssService siteWeekOssService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ISiteWeekService siteWeekService; |
||||
|
|
||||
|
@Autowired |
||||
|
private OssTianyiClientUtils ossTianyiClientUtils; |
||||
|
|
||||
|
/** |
||||
|
* 查询工地周OSS对象存储列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeekOss:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<SiteWeekOssVo> list(SiteWeekOssBo bo, PageQuery pageQuery) { |
||||
|
return siteWeekOssService.queryPageList(bo, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出工地周OSS对象存储列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeekOss:export") |
||||
|
@Log(title = "工地周OSS对象存储", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(SiteWeekOssBo bo, HttpServletResponse response) { |
||||
|
List<SiteWeekOssVo> list = siteWeekOssService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "工地周OSS对象存储", SiteWeekOssVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取工地周OSS对象存储详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeekOss:query") |
||||
|
@GetMapping("/{id}") |
||||
|
public R<SiteWeekOssVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable Long id) { |
||||
|
return R.ok(siteWeekOssService.queryById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增工地周OSS对象存储 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeekOss:add") |
||||
|
@Log(title = "工地周OSS对象存储", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SiteWeekOssBo bo) { |
||||
|
return toAjax(siteWeekOssService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改工地周OSS对象存储 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeekOss:edit") |
||||
|
@Log(title = "工地周OSS对象存储", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SiteWeekOssBo bo) { |
||||
|
return toAjax(siteWeekOssService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
// @Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
|
||||
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
||||
|
@Operation(summary = "上传OSS对象存储",description = "上传OSS对象存储") |
||||
|
public R<SiteWeekOssBo> upload(@RequestPart("file") MultipartFile file, @RequestParam("siteWeekId") Long siteWeekId) { |
||||
|
if (ObjectUtil.isNull(file)) { |
||||
|
return R.fail("上传文件不能为空"); |
||||
|
} |
||||
|
|
||||
|
SiteWeekVo siteWeekVo = siteWeekService.queryById(siteWeekId); |
||||
|
//工地日期周默认上传路径
|
||||
|
String baseUrl = siteWeekVo.getNameTime() + "/" + siteWeekVo.getDirTile() + "/"; |
||||
|
|
||||
|
//上传到minio
|
||||
|
String fileUrl = baseUrl + file.getOriginalFilename(); |
||||
|
ossTianyiClientUtils.uploadFile(fileUrl, file); |
||||
|
|
||||
|
|
||||
|
//记录到本地
|
||||
|
SiteWeekOssBo siteWeekOssBo = new SiteWeekOssBo(); |
||||
|
siteWeekOssBo.setSiteWeekId(siteWeekVo.getId()); |
||||
|
siteWeekOssBo.setWeekNo(siteWeekVo.getWeekNo()); |
||||
|
siteWeekOssBo.setFileName(file.getOriginalFilename()); |
||||
|
siteWeekOssBo.setOriginalName(file.getOriginalFilename()); |
||||
|
siteWeekOssBo.setFileSuffix(FileUtil.extName(file.getOriginalFilename())); |
||||
|
siteWeekOssBo.setUrl(fileUrl); |
||||
|
siteWeekOssBo.setService("tianyiOss"); |
||||
|
|
||||
|
Boolean uploadBo = siteWeekOssService.insertByBo(siteWeekOssBo); |
||||
|
|
||||
|
|
||||
|
// SysOssVo oss = iSysOssService.upload(file);
|
||||
|
// SiteWeekOssBo uploadVo = new SiteWeekOssBo();
|
||||
|
// uploadVo.setUrl(oss.getUrl());
|
||||
|
// uploadVo.setFileName(oss.getOriginalName());
|
||||
|
// uploadVo.setOssId(oss.getOssId().toString());
|
||||
|
// return R.ok(uploadVo);
|
||||
|
return R.ok(siteWeekOssBo); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 下载OSS对象存储 |
||||
|
* |
||||
|
* @param id OSS对象ID |
||||
|
*/ |
||||
|
@GetMapping("/download/{id}") |
||||
|
@Operation(summary = "下载OSS对象存储",description = "下载OSS对象存储") |
||||
|
public void download(@PathVariable Long id, HttpServletResponse response) throws IOException { |
||||
|
SiteWeekOssVo siteWeekOssVo = siteWeekOssService.queryById(id); |
||||
|
// InputStream inputStream = ossTianyiClientUtils.downloadFile(siteWeekOssVo.getUrl());
|
||||
|
|
||||
|
// String encodedFileName = URLEncoder.encode(siteWeekOssVo.getFileName(), "UTF-8").replaceAll("\\+", "%20");
|
||||
|
// response.setContentType("application/octet-stream");
|
||||
|
// response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedFileName);
|
||||
|
// response.setHeader("download-filename", encodedFileName);
|
||||
|
// // 文件流复制
|
||||
|
// try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||
|
// IOUtils.copy(inputStream, outputStream);
|
||||
|
// outputStream.flush();
|
||||
|
// } finally {
|
||||
|
// inputStream.close(); // 关闭流
|
||||
|
// }
|
||||
|
|
||||
|
try (InputStream inputStream = ossTianyiClientUtils.downloadFile(siteWeekOssVo.getUrl())) { |
||||
|
|
||||
|
// 文件名进行编码
|
||||
|
String encodedFileName = URLEncoder.encode(siteWeekOssVo.getFileName(), "UTF-8").replaceAll("\\+", "%20"); |
||||
|
response.setContentType("application/octet-stream");// 设置响应内容类型
|
||||
|
response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedFileName); |
||||
|
|
||||
|
// 获取响应输出流
|
||||
|
ServletOutputStream outputStream = response.getOutputStream(); |
||||
|
// 文件内容写入响应输出流
|
||||
|
byte[] buffer = new byte[1024]; |
||||
|
|
||||
|
int bytesRead; |
||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) { |
||||
|
outputStream.write(buffer, 0, bytesRead); |
||||
|
} |
||||
|
outputStream.flush(); |
||||
|
} catch (Exception e) { |
||||
|
throw new RuntimeException("下载有误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 删除工地周OSS对象存储 |
||||
|
* |
||||
|
* @param ids 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:siteWeekOss:remove") |
||||
|
@Log(title = "工地周OSS对象存储", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] ids) { |
||||
|
// Boolean result = siteWeekOssService.deleteWithValidByIds(List.of(ids), true);
|
||||
|
Boolean result = true; |
||||
|
for (Long id : ids) { |
||||
|
SiteWeekOssVo siteWeekOssVo = siteWeekOssService.queryById(id); |
||||
|
try{ |
||||
|
ossTianyiClientUtils.deleteFile(siteWeekOssVo.getUrl()); //minio删除文件
|
||||
|
siteWeekOssService.deleteWithValidByIds(List.of(id),true); //工地周数据删除
|
||||
|
}catch (Exception e){ |
||||
|
result = false; |
||||
|
System.err.println("天翼oss文件删除失败"+ siteWeekOssVo.getUrl()); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
return toAjax(result); |
||||
|
} |
||||
|
} |
@ -0,0 +1,240 @@ |
|||||
|
package org.dromara.system.controller.system; |
||||
|
|
||||
|
import java.nio.file.CopyOption; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.bean.copier.CopyOptions; |
||||
|
import cn.hutool.core.util.BooleanUtil; |
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import cn.hutool.http.HttpRequest; |
||||
|
import cn.hutool.http.HttpUtil; |
||||
|
import cn.hutool.json.JSONArray; |
||||
|
import cn.hutool.json.JSONObject; |
||||
|
import cn.hutool.json.JSONUtil; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.dromara.common.core.utils.MapstructUtils; |
||||
|
import org.dromara.common.core.utils.SpringUtils; |
||||
|
import org.dromara.common.excel.core.ExcelResult; |
||||
|
import org.dromara.system.domain.SysSubmailConfigUser; |
||||
|
import org.dromara.system.domain.SysSubmailLog; |
||||
|
import org.dromara.system.domain.SysUser; |
||||
|
import org.dromara.system.domain.bo.SysSubmailConfigUserBo; |
||||
|
import org.dromara.system.domain.bo.SysSubmailLogBo; |
||||
|
import org.dromara.system.domain.vo.SysSubmailConfigUserVo; |
||||
|
import org.dromara.system.domain.vo.SysUserImportVo; |
||||
|
import org.dromara.system.listener.SysUserImportListener; |
||||
|
import org.dromara.system.service.ISysConfigService; |
||||
|
import org.dromara.system.service.ISysSubmailConfigUserService; |
||||
|
import org.dromara.system.service.ISysSubmailLogService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.system.domain.vo.SysSubmailConfigVo; |
||||
|
import org.dromara.system.domain.bo.SysSubmailConfigBo; |
||||
|
import org.dromara.system.service.ISysSubmailConfigService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
/** |
||||
|
* 赛邮服务配置 |
||||
|
* 前端访问路由地址为:/system/sysSubmailConfig |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-11 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/submailConfig") |
||||
|
public class SysSubmailConfigController extends BaseController { |
||||
|
|
||||
|
private final ISysSubmailConfigService sysSubmailConfigService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ISysSubmailConfigUserService sysSubmailConfigUserService; |
||||
|
|
||||
|
/** |
||||
|
* 查询赛邮服务配置列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfig:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<SysSubmailConfigVo> list(SysSubmailConfigBo bo, PageQuery pageQuery) { |
||||
|
TableDataInfo<SysSubmailConfigVo> sysSubmailConfigVoTableDataInfo = sysSubmailConfigService.queryPageList(bo, pageQuery); |
||||
|
List<SysSubmailConfigVo> rows = sysSubmailConfigVoTableDataInfo.getRows(); |
||||
|
List<Long> configIds = rows.stream().map(SysSubmailConfigVo::getId).toList(); |
||||
|
|
||||
|
List<SysSubmailConfigUserVo> sysSubmailConfigUserVoList = sysSubmailConfigUserService.selectConfigUserByConfigIds(configIds); |
||||
|
for (SysSubmailConfigVo configVo : rows) { |
||||
|
List<SysSubmailConfigUserVo> collect = sysSubmailConfigUserVoList.stream().filter(item -> item.getSubmailConfigId().equals(configVo.getId())).collect(Collectors.toList()); |
||||
|
configVo.setConfigUserList(collect); |
||||
|
} |
||||
|
return sysSubmailConfigVoTableDataInfo; |
||||
|
} |
||||
|
|
||||
|
@SaCheckPermission("system:sysSubmailConfig:list") |
||||
|
@GetMapping("/listAll") |
||||
|
public List<SysSubmailConfigVo> listAll(SysSubmailConfigBo bo) { |
||||
|
return sysSubmailConfigService.queryList(bo); |
||||
|
} |
||||
|
|
||||
|
@SaCheckPermission("system:sysSubmailConfig:export") |
||||
|
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
||||
|
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { |
||||
|
// ExcelResult<SysSubmailConfigVo> result = ExcelUtil.importExcel(file.getInputStream(), SysSubmailConfigVo.class, new SysUserImportListener(updateSupport));
|
||||
|
System.out.println(file.getName()); |
||||
|
return R.ok(null); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/importTemplate") |
||||
|
public void importTemplate(HttpServletResponse response) { |
||||
|
ExcelUtil.exportExcel(new ArrayList<>(), "配置数据", SysSubmailConfigVo.class, response); |
||||
|
} |
||||
|
/** |
||||
|
* 导出赛邮服务配置列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfig:export") |
||||
|
@Log(title = "赛邮服务配置", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(SysSubmailConfigBo bo, HttpServletResponse response) { |
||||
|
List<SysSubmailConfigVo> list = sysSubmailConfigService.queryList(bo); |
||||
|
// ExcelUtil.exportExcel(list, "赛邮服务配置", SysSubmailConfigVo.class, response);
|
||||
|
|
||||
|
List<SysSubmailConfigVo> listVo = MapstructUtils.convert(list, SysSubmailConfigVo.class); |
||||
|
// 导出方法
|
||||
|
ExcelUtil.exportExcel(listVo, "赛邮服务数据", SysSubmailConfigVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取赛邮服务配置详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfig:query") |
||||
|
@GetMapping("/{id}") |
||||
|
public R<SysSubmailConfigVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable Long id) { |
||||
|
return R.ok(sysSubmailConfigService.queryById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增赛邮服务配置 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfig:add") |
||||
|
@Log(title = "赛邮服务配置", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysSubmailConfigBo bo) { |
||||
|
return toAjax(sysSubmailConfigService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改赛邮服务配置 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfig:edit") |
||||
|
@Log(title = "赛邮服务配置", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysSubmailConfigBo bo) { |
||||
|
return toAjax(sysSubmailConfigService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
//配置
|
||||
|
@SaCheckPermission("system:sysSubmailConfig:edit") |
||||
|
@Log(title = "配置赛邮服务配置用户", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping("/configUser") |
||||
|
public R<Void> configUser(@Validated(EditGroup.class) @RequestBody SysSubmailConfigBo bo) { |
||||
|
|
||||
|
//删除旧配置
|
||||
|
SysSubmailConfigUserBo userBo = new SysSubmailConfigUserBo(); |
||||
|
userBo.setSubmailConfigId(bo.getId()); |
||||
|
List<SysSubmailConfigUserVo> sysSubmailConfigUserVoList = sysSubmailConfigUserService.queryList(userBo); |
||||
|
List<Long> configUserIds = sysSubmailConfigUserVoList.stream().map(SysSubmailConfigUserVo::getId).toList(); |
||||
|
sysSubmailConfigUserService.deleteWithValidByIds(configUserIds,true); |
||||
|
|
||||
|
//保留新配置
|
||||
|
for (SysUser sysUser : bo.getConfigUserList()) { |
||||
|
SysSubmailConfigUserBo sysSubmailConfigUser = new SysSubmailConfigUserBo(); |
||||
|
sysSubmailConfigUser.setSubmailConfigId(bo.getId()); |
||||
|
sysSubmailConfigUser.setUserId(sysUser.getUserId()); |
||||
|
sysSubmailConfigUser.setName(sysUser.getNickName()); |
||||
|
sysSubmailConfigUser.setPhonenumber(sysUser.getPhonenumber()); |
||||
|
sysSubmailConfigUserService.insertByBo(sysSubmailConfigUser); |
||||
|
} |
||||
|
|
||||
|
return toAjax(1); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除赛邮服务配置 |
||||
|
* |
||||
|
* @param ids 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailConfig:remove") |
||||
|
@Log(title = "赛邮服务配置", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] ids) { |
||||
|
return toAjax(sysSubmailConfigService.deleteWithValidByIds(List.of(ids), true)); |
||||
|
} |
||||
|
|
||||
|
//发送测试
|
||||
|
|
||||
|
@Autowired |
||||
|
private ISysSubmailLogService sysSubmailLogService; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param code 必须传参:smsMultixsend |
||||
|
* @param multiParam 前台传参 JSON.stringfy( {"jobName":"翟山街道华盛","labelCn":"普通垃圾","labelEn":"garbage","deptName":"翟山街道","lat":"34.20994348014929","lng":"117.2054671683176"}) |
||||
|
* @return |
||||
|
*/ |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping("/cmdSend") |
||||
|
public R<String> cmdSend(@RequestParam("code") String code, @RequestParam("multiParam") String multiParam) { |
||||
|
if(StrUtil.isBlank(code)){ |
||||
|
return R.fail("发送类型为空"); |
||||
|
} |
||||
|
return sysSubmailConfigService.cmdSend(code, multiParam); |
||||
|
} |
||||
|
|
||||
|
//发送测试
|
||||
|
@RepeatSubmit() |
||||
|
@PostMapping("/autoSend") |
||||
|
public R<String> autoSend(@Validated(AddGroup.class) @RequestBody SysSubmailConfigBo bo) { |
||||
|
|
||||
|
//判断是否配置用户
|
||||
|
SysSubmailConfigUserBo mailUserQuery = new SysSubmailConfigUserBo(); |
||||
|
mailUserQuery.setSubmailConfigId(bo.getId()); |
||||
|
List<SysSubmailConfigUserVo> sysSubmailConfigUserVoList = sysSubmailConfigUserService.queryList(mailUserQuery); |
||||
|
List<SysSubmailConfigUserVo> configUserVoList = sysSubmailConfigUserVoList.stream().filter(item -> StrUtil.isNotBlank(item.getPhonenumber())).collect(Collectors.toList()); |
||||
|
if(configUserVoList.size() <= 0) { |
||||
|
return R.fail("暂无配置有效用户"); |
||||
|
} |
||||
|
|
||||
|
String result = sysSubmailConfigService.submailSendUtil(bo, configUserVoList); |
||||
|
|
||||
|
return R.ok(result); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
package org.dromara.system.controller.system; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.system.domain.vo.SysSubmailLogVo; |
||||
|
import org.dromara.system.domain.bo.SysSubmailLogBo; |
||||
|
import org.dromara.system.service.ISysSubmailLogService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 赛邮服务发送log |
||||
|
* 前端访问路由地址为:/system/sysSubmailLog |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-11 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/submailLog") |
||||
|
public class SysSubmailLogController extends BaseController { |
||||
|
|
||||
|
private final ISysSubmailLogService sysSubmailLogService; |
||||
|
|
||||
|
/** |
||||
|
* 查询赛邮服务发送log列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailLog:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<SysSubmailLogVo> list(SysSubmailLogBo bo, PageQuery pageQuery) { |
||||
|
return sysSubmailLogService.queryPageList(bo, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出赛邮服务发送log列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailLog:export") |
||||
|
@Log(title = "赛邮服务发送log", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(SysSubmailLogBo bo, HttpServletResponse response) { |
||||
|
List<SysSubmailLogVo> list = sysSubmailLogService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "赛邮服务发送log", SysSubmailLogVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取赛邮服务发送log详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailLog:query") |
||||
|
@GetMapping("/{id}") |
||||
|
public R<SysSubmailLogVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable Long id) { |
||||
|
return R.ok(sysSubmailLogService.queryById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增赛邮服务发送log |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailLog:add") |
||||
|
@Log(title = "赛邮服务发送log", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysSubmailLogBo bo) { |
||||
|
return toAjax(sysSubmailLogService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改赛邮服务发送log |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailLog:edit") |
||||
|
@Log(title = "赛邮服务发送log", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysSubmailLogBo bo) { |
||||
|
return toAjax(sysSubmailLogService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除赛邮服务发送log |
||||
|
* |
||||
|
* @param ids 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:sysSubmailLog:remove") |
||||
|
@Log(title = "赛邮服务发送log", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] ids) { |
||||
|
return toAjax(sysSubmailLogService.deleteWithValidByIds(List.of(ids), true)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
package org.dromara.system.domain; |
||||
|
|
||||
|
import org.dromara.common.tenant.core.TenantEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import java.util.Date; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* 大疆开发对象 dji_api |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("dji_api") |
||||
|
public class DjiApi extends TenantEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 大疆api类型 |
||||
|
*/ |
||||
|
private String djiApiType; |
||||
|
|
||||
|
/** |
||||
|
* 版本名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 版本号 |
||||
|
*/ |
||||
|
private String nameVersionNo; |
||||
|
|
||||
|
/** |
||||
|
* 版本次数 |
||||
|
*/ |
||||
|
private Integer versionCount; |
||||
|
|
||||
|
/** |
||||
|
* 发步日期 |
||||
|
*/ |
||||
|
private Date timeRelease; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
package org.dromara.system.domain; |
||||
|
|
||||
|
import org.dromara.common.tenant.core.TenantEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* 大疆开发-错误码对象 dji_api_error |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("dji_api_error") |
||||
|
public class DjiApiError extends TenantEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 大疆APIId |
||||
|
*/ |
||||
|
private Long djiApiId; |
||||
|
|
||||
|
/** |
||||
|
* 大疆API版本 |
||||
|
*/ |
||||
|
private String djiApiName; |
||||
|
|
||||
|
/** |
||||
|
* 错误码 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 中文描述 |
||||
|
*/ |
||||
|
private String nameCn; |
||||
|
|
||||
|
/** |
||||
|
* 英文描述 |
||||
|
*/ |
||||
|
private String nameEn; |
||||
|
|
||||
|
/** |
||||
|
* 是否变更 |
||||
|
*/ |
||||
|
private String isChangeFlag; |
||||
|
|
||||
|
/** |
||||
|
* 历史变更次数 |
||||
|
*/ |
||||
|
private Integer changeHistroyCount; |
||||
|
|
||||
|
/** |
||||
|
* 历史变更Ids(,分隔) |
||||
|
*/ |
||||
|
private String changeHistoryIds; |
||||
|
|
||||
|
/** |
||||
|
* 大疆开发-错误码 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
package org.dromara.system.domain; |
||||
|
|
||||
|
import org.dromara.common.tenant.core.TenantEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* 工地日期周对象 site_week |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("site_week") |
||||
|
public class SiteWeek extends TenantEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 年月日名称 |
||||
|
*/ |
||||
|
private String nameTime; |
||||
|
|
||||
|
/** |
||||
|
* 周编号 |
||||
|
*/ |
||||
|
private Long weekNo; |
||||
|
|
||||
|
/** |
||||
|
* 周描述 |
||||
|
*/ |
||||
|
private String weekNoDescr; |
||||
|
|
||||
|
/** |
||||
|
* 分组编号(备用) |
||||
|
*/ |
||||
|
private Long groupNo; |
||||
|
|
||||
|
private String dirTile; |
||||
|
private String dirTileZip; |
||||
|
private String dirImg; |
||||
|
private String dirVideo; |
||||
|
private String isKeepFlag; //是否保存(0正常 1停用)
|
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package org.dromara.system.domain; |
||||
|
|
||||
|
import org.dromara.common.tenant.core.TenantEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* 工地周OSS对象存储对象 site_week_oss |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("site_week_oss") |
||||
|
public class SiteWeekOss extends TenantEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 工地周id |
||||
|
*/ |
||||
|
private Long siteWeekId; |
||||
|
|
||||
|
/** |
||||
|
* 周编号 |
||||
|
*/ |
||||
|
private Long weekNo; |
||||
|
|
||||
|
/** |
||||
|
* 文件名 |
||||
|
*/ |
||||
|
private String fileName; |
||||
|
|
||||
|
/** |
||||
|
* 原名 |
||||
|
*/ |
||||
|
private String originalName; |
||||
|
|
||||
|
/** |
||||
|
* 文件后缀名 |
||||
|
*/ |
||||
|
private String fileSuffix; |
||||
|
|
||||
|
/** |
||||
|
* URL地址 |
||||
|
*/ |
||||
|
private String url; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 服务商 |
||||
|
*/ |
||||
|
private String service; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,92 @@ |
|||||
|
package org.dromara.system.domain; |
||||
|
|
||||
|
import org.dromara.common.tenant.core.TenantEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* 赛邮服务配置对象 sys_submail_config |
||||
|
* |
||||
|
* @author szs |
||||
|
* @date 2025-05-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("sys_submail_config") |
||||
|
public class SysSubmailConfig extends TenantEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 字典编码 |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 接口名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 接口编码 |
||||
|
*/ |
||||
|
private String code; |
||||
|
|
||||
|
/** |
||||
|
* 赛邮类型(Mail, Message,Voice,Internationalsms,Mobiledata) |
||||
|
*/ |
||||
|
private String type; |
||||
|
|
||||
|
/** |
||||
|
* 接口Url |
||||
|
*/ |
||||
|
private String url; |
||||
|
|
||||
|
/** |
||||
|
* AppId |
||||
|
*/ |
||||
|
private String appid; |
||||
|
|
||||
|
/** |
||||
|
* signature |
||||
|
*/ |
||||
|
private String signature; |
||||
|
private String project; //模板编码
|
||||
|
|
||||
|
/** |
||||
|
* tag参数 |
||||
|
*/ |
||||
|
private String tag; |
||||
|
|
||||
|
/** |
||||
|
* UNIX 时间戳 |
||||
|
*/ |
||||
|
private String timestamp; |
||||
|
|
||||
|
/** |
||||
|
* API 授权模式(normal) |
||||
|
*/ |
||||
|
private String signType; |
||||
|
|
||||
|
/** |
||||
|
* signature加密计算方式 |
||||
|
*/ |
||||
|
private String signVersion; |
||||
|
|
||||
|
/** |
||||
|
* 最新反馈状态(1是 0否) |
||||
|
*/ |
||||
|
private String latestResStatus; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
|
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue