作者 钟来

水产舆情采集海报生成

... ... @@ -2,10 +2,12 @@ package com.ruoyi.quartz.task;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.io.Resources;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.tool.SysLogininforType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.quartz.task.aquatic.AquaticPublicOpinionBase;
import com.ruoyi.quartz.task.aquatic.AquaticPublicOpinionService;
import com.zhonglai.luhui.dao.service.PublicService;
import com.zhonglai.luhui.sys.manager.AsyncManager;
... ... @@ -15,9 +17,17 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.TimerTask;
/**
* 水产舆情
... ... @@ -53,6 +63,7 @@ public class AquaticPublicOpinionTask {
if (null != lsit && lsit.size()!=0)
{
List<AbstractMap.SimpleEntry<String, String>> dataList = new ArrayList<>();
for (Map<String,Object> map:lsit)
{
StringBuffer content = new StringBuffer();
... ... @@ -71,8 +82,9 @@ public class AquaticPublicOpinionTask {
text.put("mentioned_mobile_list",new String[]{"@all"});
jsonObject.put("text",text);
HttpUtil.post("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6d6b4790-d20f-4692-bc4a-e8ceb1e8cfda",jsonObject.toJSONString());
}
}
}
}
... ...
... ... @@ -23,11 +23,13 @@ public abstract class AquaticPublicOpinionBase implements AquaticPublicOpinionS
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
protected PublicService publicService;
public static final String saveFilePath = "uploadPath/aquaticPublicOpinion/";
public void updateSaveInfo(String text,Integer id)
{
if(StringUtils.isNotEmpty(text))
{
Path path = Paths.get("uploadPath/aquaticPublicOpinion/"+id+".txt");
Path path = Paths.get(saveFilePath+id+".txt");
String filepath = saveFile(text, path);
if(StringUtils.isNotEmpty(filepath))
{
... ...
... ... @@ -69,10 +69,10 @@ public class WwwCafsAcCn extends AquaticPublicOpinionBase{
StringBuilder text = new StringBuilder();
// 遍历段落,保留换行
for (Element p : content.select("p")) {
for (Element p : content.children()) {
String line = p.text().trim();
if (!line.isEmpty()) {
text.append(line).append("\n\n");
text.append(line).append("\n");
}
}
... ...
... ... @@ -77,10 +77,10 @@ public class WwwChinaCfaOrg extends AquaticPublicOpinionBase{
StringBuilder text = new StringBuilder();
// 遍历段落,保留换行
for (Element p : content.select("p")) {
for (Element p : content.children()) {
String line = p.text().trim();
if (!line.isEmpty()) {
text.append(line).append("\n\n");
text.append(line).append("\n");
}
}
... ...
... ... @@ -67,10 +67,10 @@ public class WwwCsfishOrgCn extends AquaticPublicOpinionBase{
text.append( title);
text.append("\n\n");
// 遍历段落,保留换行
for (Element p : content.select("p")) {
for (Element p : content.children()) {
String line = p.text().trim();
if (!line.isEmpty()) {
text.append(line).append("\n\n");
text.append(line).append("\n");
}
}
... ...
... ... @@ -44,10 +44,10 @@ public class WwwMoaGovCn extends AquaticPublicOpinionBase{
StringBuilder text = new StringBuilder();
// 遍历段落,保留换行
for (Element p : content.select("p")) {
for (Element p : content.children()) {
String line = p.text().trim();
if (!line.isEmpty()) {
text.append(line).append("\n\n");
text.append(line).append("\n");
}
}
... ...
... ... @@ -91,10 +91,10 @@ public class WwwNftecAgriCn extends AquaticPublicOpinionBase{
StringBuilder text = new StringBuilder();
// 遍历段落,保留换行
for (Element p : content.select("p")) {
for (Element p : content.children()) {
String line = p.text().trim();
if (!line.isEmpty()) {
text.append(line).append("\n\n");
text.append(line).append("\n");
}
}
... ... @@ -109,4 +109,10 @@ public class WwwNftecAgriCn extends AquaticPublicOpinionBase{
return null;
}
public static void main(String[] args) {
WwwNftecAgriCn wwwNftecAgriCn = new WwwNftecAgriCn();
String str= wwwNftecAgriCn.getInfo("http://www.nftec.agri.cn/tzgg/202507/t20250711_8748522.htm");
System.out.println(str);
}
}
... ...
package com.ruoyi.quartz.util;
import com.google.common.io.Resources;
import com.ruoyi.common.utils.DateUtils;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.AlphaComposite;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.List;
public class MultiTextImageGenerator {
private static final String savePath = "uploadPath/aquaticPublicOpinion/img/";
private static final String backgroundPath = "moban.png";
public static void main(String[] args) throws IOException {
// 1. 示例数据
List<AbstractMap.SimpleEntry<String, String>> dataList = Arrays.asList(
new AbstractMap.SimpleEntry<>("水质监测", "用于监测水体中溶氧、温度、pH 等参数,保障水产养殖环境。"),
new AbstractMap.SimpleEntry<>("智能告警", "当监测数据异常时,可通过APP或短信方式自动告警提醒。"),
new AbstractMap.SimpleEntry<>("移动便携", "设备小巧轻便,支持户外测量,数据实时同步上传。")
);
// 2. 配置加载
generateImage(dataList,new StyleConfig());
}
public static String generateImage(List<AbstractMap.SimpleEntry<String, String>> dataList, StyleConfig style) throws IOException {
// 3. 背景图
BufferedImage image = ImageIO.read(new File(backgroundPath));
int width = image.getWidth();
int height = image.getHeight();
BufferedImage newImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = newImage.createGraphics();
g.drawImage(image, 0, 0, null);
// 抗锯齿
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
int maxTextWidth = width - 2 * style.startX;
int currY = style.startY;
// 4. 绘制每组内容块
for (int i = 0; i < dataList.size(); i++) {
String title = (i + 1) + ". " + dataList.get(i).getKey();
String content = dataList.get(i).getValue();
g.setFont(style.titleFont);
FontMetrics titleMetrics = g.getFontMetrics();
int titleHeight = titleMetrics.getHeight();
g.setFont(style.contentFont);
FontMetrics contentMetrics = g.getFontMetrics();
List<String> lines = splitTextIntoLines(content, contentMetrics, maxTextWidth);
int lineHeight = contentMetrics.getHeight() + style.lineSpacing;
int contentHeight = lines.size() * lineHeight;
int totalTextHeight = titleHeight + 10 + contentHeight;
int blockHeight = totalTextHeight + 2 * style.padding;
int blockWidth = maxTextWidth + 2 * style.padding;
int blockX = style.startX - style.padding;
int blockY = currY;
if (style.showBackgroundBlock)
{
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, style.backgroundAlpha));
g.setColor(style.backgroundColor);
g.fillRoundRect(blockX, blockY, blockWidth, blockHeight, style.cornerRadius, style.cornerRadius);
}
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
g.setColor(style.textColor);
int textStartY = blockY + style.padding + (blockHeight - 2 * style.padding - totalTextHeight) / 2;
g.setFont(style.titleFont);
int titleY = textStartY + titleHeight;
g.drawString(title, style.startX, titleY);
g.setFont(style.contentFont);
int contentStartY = titleY + 10 + lineHeight;
for (int j = 0; j < lines.size(); j++) {
int y = contentStartY + j * lineHeight;
g.drawString(lines.get(j), style.startX, y);
}
currY = blockY + blockHeight + style.blockSpacing;
}
// 5. 添加文字水印
drawTextWatermark(g, width, height, style);
// 6. 添加图片水印
// drawImageWatermark(g, width, height, style);
g.dispose();
// 7. 保存输出
String saveFile = savePath + DateUtils.getDate()+ "_output.png";
ImageIO.write(newImage, "png", new File(saveFile));
return saveFile;
}
// 文字自动换行
private static List<String> splitTextIntoLines(String text, FontMetrics metrics, int maxWidth) {
List<String> lines = new ArrayList<>();
StringBuilder line = new StringBuilder();
for (char c : text.toCharArray()) {
line.append(c);
if (metrics.stringWidth(line.toString()) > maxWidth) {
line.deleteCharAt(line.length() - 1);
lines.add(line.toString());
line = new StringBuilder().append(c);
}
}
if (!line.toString().isEmpty()) {
lines.add(line.toString());
}
return lines;
}
// 文字水印
private static void drawTextWatermark(Graphics2D g, int width, int height, StyleConfig style) {
g.setFont(style.watermarkFont);
g.setColor(style.watermarkColor);
FontMetrics metrics = g.getFontMetrics();
int textWidth = metrics.stringWidth(style.watermarkText);
int x = width - textWidth - style.watermarkTextMarginX;
int y = height - style.watermarkTextMarginY;
g.drawString(style.watermarkText, x, y);
}
// 图片水印
private static void drawImageWatermark(Graphics2D g, int width, int height, StyleConfig style) {
try {
String watermarkImagePath = style.watermarkImagePath;
File file = new File(watermarkImagePath);
if (!file.exists()) {
System.out.println("⚠️ 水印图片未找到:" + watermarkImagePath);
return;
}
Image logo = ImageIO.read(file).getScaledInstance(
style.watermarkImageWidth,
style.watermarkImageHeight,
Image.SCALE_SMOOTH
);
int x = width - style.watermarkImageWidth - style.watermarkImageMarginX;
int y = height - style.watermarkImageHeight - style.watermarkImageMarginY;
g.drawImage(logo, x, y, null);
} catch (IOException e) {
System.err.println("❌ 加载图片水印失败:" + e.getMessage());
}
}
}
... ...
package com.ruoyi.quartz.util;
import java.awt.*;
import java.io.File;
/**
* 样式配置类
*/
public class StyleConfig {
public StyleConfig() {
try {
Font baseFont = Font.createFont(Font.TRUETYPE_FONT,
new File("NotoSansCJKsc-Black.otf"));
titleFont = baseFont.deriveFont(Font.BOLD, 36f);
contentFont = baseFont.deriveFont(Font.PLAIN, 28f);
watermarkFont = baseFont.deriveFont(Font.PLAIN, 20f);
GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(baseFont);
} catch (Exception e) {
System.err.println("❌ 加载字体失败,使用默认字体:" + e.getMessage());
titleFont = new Font("Serif", Font.BOLD, 36);
contentFont = new Font("Serif", Font.PLAIN, 28);
}
}
// 文本样式配置
public Font titleFont = new Font("微软雅黑", Font.BOLD, 36);
// 标题字体,微软雅黑,加粗,字号36
public Font contentFont = new Font("微软雅黑", Font.PLAIN, 28);
// 正文字体,微软雅黑,常规,字号28
public Color textColor = Color.WHITE;
// 文字颜色,默认为白色
// 是否显示遮罩背景块(默认开启)
public boolean showBackgroundBlock = false;
// 遮罩块样式(文字背景)
public Color backgroundColor = new Color(0, 0, 0);
// 遮罩背景颜色,默认黑色(RGB)
public float backgroundAlpha = 0.4f;
// 遮罩背景透明度(0.0f~1.0f,0是完全透明,1是不透明)
public int cornerRadius = 20;
// 遮罩背景圆角半径,单位像素
public int padding = 20;
// 遮罩内部边距:文字距离遮罩边缘的内边距(上下左右均使用该值)
public int blockSpacing = 0;
// 每个标题+内容之间的垂直间距(块间隔),单位像素
public int startX = 97;
// 文字区域的起始横坐标(左边距)
public int startY = 245;
// 第一段文字区域的起始纵坐标(上边距)
public int lineSpacing = 5;
// 内容段落之间的行间距(单位像素)
// 文字水印配置
public String watermarkText = "@鱼儿乐科技";
// 添加的文字水印内容
public Font watermarkFont = new Font("微软雅黑", Font.PLAIN, 20);
// 水印字体:微软雅黑,常规,字号20
public Color watermarkColor = new Color(255, 255, 255, 180);
// 水印颜色:白色,透明度约70%(255=不透明,180≈70%透明)
public int watermarkTextMarginX = 567;
// 文字水印的横坐标偏移量,单位像素(从左上角或右下角偏移)
public int watermarkTextMarginY = 1236;
// 文字水印的纵坐标偏移量,单位像素(从左上角或右下角偏移)
// 图片水印配置
public String watermarkImagePath = "logo.jpg";
// 图片水印的文件路径,支持 PNG/JPG 格式
public int watermarkImageWidth = 100;
// 图片水印缩放后的宽度(单位像素)
public int watermarkImageHeight = 100;
// 图片水印缩放后的高度(单位像素)
public int watermarkImageMarginX = 20;
// 图片水印的横向偏移量(从右下角向内缩进的距离)
public int watermarkImageMarginY = 20;
// 图片水印的纵向偏移量(从右下角向内缩进的距离)
}
... ...
package com.zhonglai.luhui.admin.controller.monitor;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
... ... @@ -12,15 +10,17 @@ import com.ruoyi.common.utils.GsonConstructor;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.framework.web.domain.Server;
import com.ruoyi.quartz.util.MultiTextImageGenerator;
import com.ruoyi.quartz.util.StyleConfig;
import com.ruoyi.system.domain.sys.SysMonitorApplication;
import com.ruoyi.system.domain.sys.SysMonitorApplicationLog;
import com.ruoyi.system.domain.sys.SysMonitorServer;
import com.ruoyi.system.domain.sys.SysMonitorServerLog;
import com.zhonglai.luhui.action.BaseController;
import com.zhonglai.luhui.admin.dto.GenerateAquaticPublicOpinionPosterDto;
import com.zhonglai.luhui.admin.dto.MonitorServerUploadApplicationDto;
import com.zhonglai.luhui.admin.dto.MonitorServerUploadDto;
import com.zhonglai.luhui.admin.qywx.AesException;
import com.zhonglai.luhui.admin.qywx.QyWxApplication;
import com.zhonglai.luhui.admin.qywx.WXBizMsgCrypt;
import com.zhonglai.luhui.admin.service.SendSysMonitorServerMessge;
import com.zhonglai.luhui.dao.service.PublicService;
... ... @@ -28,7 +28,6 @@ import com.zhonglai.luhui.device.analysis.comm.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StreamUtils;
... ... @@ -44,11 +43,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.*;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
... ... @@ -176,12 +177,40 @@ public class ServerController extends BaseController
@ApiOperation("获取当天水产新闻")
@GetMapping("/getNowAquaticPublicOpinion")
public AjaxResult getNowAquaticPublicOpinion()
public AjaxResult getNowAquaticPublicOpinion(String day)
{
List<Map<String,Object>> lsit = publicService.getObjectListBySQL("SELECT * FROM `fish_aquatic_public_opinion` WHERE release_time='"+DateUtils.getDate()+" 00:00:00'");
if(StringUtils.isEmpty(day))
{
day = DateUtils.getDate();
}
List<Map<String,Object>> lsit = publicService.getObjectListBySQL("SELECT * FROM `fish_aquatic_public_opinion` WHERE release_time='"+day+" 00:00:00'");
return AjaxResult.success(lsit);
}
@ApiOperation("生成水产新闻海报")
@PostMapping("/generateAquaticPublicOpinionPoster")
public AjaxResult generateAquaticPublicOpinionPoster(@RequestBody List<GenerateAquaticPublicOpinionPosterDto> list)
{
if (null == list || list.size()==0)
{
return AjaxResult.error("参数不能为空");
}
List<AbstractMap.SimpleEntry<String, String>> dataList = list.stream()
.map(dto -> new AbstractMap.SimpleEntry<>(dto.getTitle(), dto.getContent()))
.collect(Collectors.toList());
try {
logger.info("转换数据:{}",dataList);
String savePath = MultiTextImageGenerator.generateImage(dataList, new StyleConfig());
String imgurl = "https://lh.admin.yu2le.com/api/"+savePath.replace("uploadPath","profile");
return AjaxResult.success(imgurl);
} catch (IOException e) {
logger.info(new File("moban.png").getAbsolutePath());
logger.error("生成海报错误",e);
return AjaxResult.error("生成海报错误"+e.getMessage());
}
}
@ApiOperation("获取服务器应用列表")
@GetMapping("/getServiceAoolicationList")
public Map<String,Object> getServiceAoolicationList()
... ...
package com.zhonglai.luhui.admin.dto;
/**
* 生成水产新闻海报对象
*/
public class GenerateAquaticPublicOpinionPosterDto {
private String title;
private String content;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
... ...
# 项目相关配置 jhlt: # 名称 name: zhonglai # 版本 version: 3.8.2 # 版权年份 copyrightYear: 2022 # 实例演示开关 demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: E:/work/idea/Luhui/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 8080 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn com.zhonglai.luhui: debug # Spring配置 spring: # 资源信息 messages: # 国际化资源文件路径 basename: i18n/messages profiles: active: druid # 文件上传 servlet: multipart: # 单个文件大小 max-file-size: 10MB # 设置总上传的文件大小 max-request-size: 20MB # 服务模块 devtools: restart: # 热部署开关 enabled: true # redis 配置 redis: # 地址 host: 119.23.218.181 # 端口,默认为6379 port: 6379 # 数据库索引 database: 1 # 密码 password: # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8 # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # token配置 token: # 令牌自定义标识 header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 1440 rediskey: lh-admin # MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain,com.zhonglai.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 pagehelper: helperDialect: mysql supportMethodsArguments: true params: count=countSql # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* mqtt: client: device_life: 180 sys: ## // 对于登录login 注册register 验证码captchaImage 允许匿名访问 antMatchers: /login,/register,/captchaImage,/getCacheObject,/v2/api-docs,/tool/gen/generatorCodeFromDb,/data/**,/monitor/server/upload,/monitor/server/getSysMonitorServerList,/monitor/server/getSysMonitorServerLogList # NameServer地址 rocketmq: name-server: 8.129.224.117:9876 # 默认的消息组 producer: group: deviceCommand send-message-timeout: 30000 send-topic: lh-mqtt-service-deviceCommand-test send-tags: 1
\ No newline at end of file
# 项目相关配置 jhlt: # 名称 name: zhonglai # 版本 version: 3.8.2 # 版权年份 copyrightYear: 2022 # 实例演示开关 demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: E:/work/idea/Luhui/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 8080 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn com.zhonglai.luhui: debug # Spring配置 spring: # 资源信息 messages: # 国际化资源文件路径 basename: i18n/messages profiles: active: druid # 文件上传 servlet: multipart: # 单个文件大小 max-file-size: 10MB # 设置总上传的文件大小 max-request-size: 20MB # 服务模块 devtools: restart: # 热部署开关 enabled: true # redis 配置 redis: # 地址 host: 119.23.218.181 # 端口,默认为6379 port: 6379 # 数据库索引 database: 1 # 密码 password: # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8 # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # token配置 token: # 令牌自定义标识 header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 1440 rediskey: lh-admin # MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain,com.zhonglai.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 pagehelper: helperDialect: mysql supportMethodsArguments: true params: count=countSql # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* mqtt: client: device_life: 180 sys: ## // 对于登录login 注册register 验证码captchaImage 允许匿名访问 antMatchers: /login,/register,/captchaImage,/getCacheObject,/v2/api-docs,/tool/gen/generatorCodeFromDb,/data/**,/monitor/server/upload,/monitor/server/getSysMonitorServerList,/monitor/server/getSysMonitorServerLogList,/monitor/server/getNowAquaticPublicOpinion # NameServer地址 rocketmq: name-server: 8.129.224.117:9876 # 默认的消息组 producer: group: deviceCommand send-message-timeout: 30000 send-topic: lh-mqtt-service-deviceCommand-test send-tags: 1
\ No newline at end of file
... ...
... ... @@ -57,9 +57,7 @@ public class IotTerminalController extends BaseController
@GetMapping("/listByDeviceId/{deviceId}")
public AjaxResult listByDeviceId(@PathVariable String deviceId)
{
IotTerminal iotTerminal = new IotTerminal();
iotTerminal.setDevice_id(deviceId);
List<IotTerminal> list = iotTerminalService.selectIotTerminalListByUserId(iotTerminal);
List<IotTerminal> list = iotTerminalService.selectNotUserIotTerminalListByImei(deviceId);
return AjaxResult.success(list);
}
... ...