Compare commits
15 Commits
bcd4a39822
...
bb0e14dcfb
Author | SHA1 | Date |
---|---|---|
|
bb0e14dcfb | |
|
b71300a918 | |
|
623e1ac614 | |
|
1aee5c1744 | |
|
36d726f3bd | |
|
f817669bd0 | |
|
39b7e2f354 | |
|
ba39ca8472 | |
|
1e68d2bfcf | |
|
2668b9f13a | |
|
c2e61ca3ca | |
|
de1427de50 | |
|
049227636c | |
|
8bd931ea6e | |
|
d09153864d |
|
@ -1,7 +1,7 @@
|
|||
package com.ruoyi.web.controller.board;
|
||||
|
||||
import com.ruoyi.board.domain.AlertPlan;
|
||||
import com.ruoyi.board.service.AlertPlanService;
|
||||
import com.ruoyi.board.service.IAlertPlanService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
@ -22,10 +22,10 @@ import java.util.List;
|
|||
* @Date 2024-08-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/alertPlan")
|
||||
@RequestMapping("/board/plan")
|
||||
public class AlertPlanController extends BaseController {
|
||||
@Autowired
|
||||
private AlertPlanService alertPlanService;
|
||||
private IAlertPlanService alertPlanService;
|
||||
|
||||
/**
|
||||
* 查询预警计划列表
|
||||
|
@ -34,7 +34,7 @@ public class AlertPlanController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public TableDataInfo list(AlertPlan alertPlan) {
|
||||
startPage();
|
||||
List<AlertPlan> list = alertPlanService.list();
|
||||
List<AlertPlan> list = alertPlanService.selectList(alertPlan);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.ruoyi.web.controller.board;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.board.domain.BoardInfo;
|
||||
import com.ruoyi.board.service.BoardInfoService;
|
||||
import com.ruoyi.board.service.IBoardInfoService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
@ -22,21 +23,19 @@ import java.util.List;
|
|||
* @date 2024-08-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/board")
|
||||
public class BoardInfoController extends BaseController
|
||||
{
|
||||
@RequestMapping("/board/info")
|
||||
public class BoardInfoController extends BaseController {
|
||||
@Autowired
|
||||
private BoardInfoService BoardInfoService;
|
||||
private IBoardInfoService boardInfoService;
|
||||
|
||||
/**
|
||||
* 查询情报板信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('board:info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BoardInfo BoardInfo)
|
||||
{
|
||||
public TableDataInfo list(BoardInfo BoardInfo) {
|
||||
startPage();
|
||||
List<BoardInfo> list = BoardInfoService.list();
|
||||
List<BoardInfo> list = boardInfoService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -46,9 +45,8 @@ public class BoardInfoController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('board:info:export')")
|
||||
@Log(title = "情报板信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BoardInfo BoardInfo)
|
||||
{
|
||||
List<BoardInfo> list = BoardInfoService.list();
|
||||
public void export(HttpServletResponse response, BoardInfo BoardInfo) {
|
||||
List<BoardInfo> list = boardInfoService.list();
|
||||
ExcelUtil<BoardInfo> util = new ExcelUtil<BoardInfo>(BoardInfo.class);
|
||||
util.exportExcel(response, list, "情报板信息数据");
|
||||
}
|
||||
|
@ -58,9 +56,8 @@ public class BoardInfoController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('board:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(BoardInfoService.getById(id));
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(boardInfoService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,9 +66,9 @@ public class BoardInfoController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('board:info:add')")
|
||||
@Log(title = "情报板信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BoardInfo BoardInfo)
|
||||
{
|
||||
return toAjax(BoardInfoService.save(BoardInfo));
|
||||
public AjaxResult add(@RequestBody BoardInfo boardInfo) {
|
||||
logger.info(JSON.toJSONString(boardInfo));
|
||||
return toAjax(boardInfoService.save(boardInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,9 +77,8 @@ public class BoardInfoController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('board:info:edit')")
|
||||
@Log(title = "情报板信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BoardInfo BoardInfo)
|
||||
{
|
||||
return toAjax(BoardInfoService.saveOrUpdate(BoardInfo));
|
||||
public AjaxResult edit(@RequestBody BoardInfo BoardInfo) {
|
||||
return toAjax(boardInfoService.saveOrUpdate(BoardInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,8 +87,7 @@ public class BoardInfoController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('board:info:remove')")
|
||||
@Log(title = "情报板信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids)
|
||||
{
|
||||
return toAjax(BoardInfoService.removeByIds(ids));
|
||||
public AjaxResult remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(boardInfoService.removeByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package com.ruoyi.web.controller.board;
|
||||
|
||||
import com.ruoyi.board.domain.PresetContent;
|
||||
import com.ruoyi.board.service.IPresetContentService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预置信息及模版Controller
|
||||
*
|
||||
* @author fuhao
|
||||
* @date 2024-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/board/content")
|
||||
public class PresetContentController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IPresetContentService presetContentService;
|
||||
|
||||
/**
|
||||
* 查询预置信息及模版列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('board:content:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PresetContent presetContent)
|
||||
{
|
||||
startPage();
|
||||
List<PresetContent> list = presetContentService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出预置信息及模版列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('board:content:export')")
|
||||
@Log(title = "预置信息及模版", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PresetContent presetContent)
|
||||
{
|
||||
List<PresetContent> list = presetContentService.list();
|
||||
ExcelUtil<PresetContent> util = new ExcelUtil<PresetContent>(PresetContent.class);
|
||||
util.exportExcel(response, list, "预置信息及模版数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预置信息及模版详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('board:content:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(presetContentService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增预置信息及模版
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('board:content:add')")
|
||||
@Log(title = "预置信息及模版", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PresetContent presetContent)
|
||||
{
|
||||
return toAjax(presetContentService.save(presetContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改预置信息及模版
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('board:content:edit')")
|
||||
@Log(title = "预置信息及模版", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PresetContent presetContent)
|
||||
{
|
||||
return toAjax(presetContentService.updateById(presetContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除预置信息及模版
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('board:content:remove')")
|
||||
@Log(title = "预置信息及模版", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(presetContentService.removeByIds(Arrays.asList(ids)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.web.controller.board;
|
||||
|
||||
import com.ruoyi.board.domain.ReleaseRecord;
|
||||
import com.ruoyi.board.service.IReleaseRecordService;
|
||||
import com.ruoyi.board.service.impl.ReleaseRecordServiceImpl;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 发布记录表(pub_release_record)表控制层
|
||||
*
|
||||
* @author fuhao
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pub_release_record")
|
||||
public class ReleaseRecordController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private IReleaseRecordService releaseRecordServiceImpl;
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("selectOne")
|
||||
public ReleaseRecord selectOne(Integer id) {
|
||||
return releaseRecordServiceImpl.getById(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.web.controller.sensor;
|
||||
|
||||
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.sensor.domain.PerceptionParams;
|
||||
import com.ruoyi.sensor.service.ISensorDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sensor/data")
|
||||
public class OpenSensorDataController {
|
||||
|
||||
@Autowired
|
||||
private ISensorDataService sensorDataService;
|
||||
|
||||
@Anonymous
|
||||
@PostMapping("/judge")
|
||||
public void list(PerceptionParams perceptionParams) {
|
||||
sensorDataService.perceptionParamsHandler(perceptionParams);
|
||||
}
|
||||
}
|
|
@ -9,9 +9,10 @@
|
|||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<charset>UTF-8</charset>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
|
@ -24,8 +25,9 @@
|
|||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<charset>UTF-8</charset>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
|
@ -46,6 +48,7 @@
|
|||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<charset>UTF-8</charset>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
|
@ -68,6 +71,7 @@
|
|||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<charset>UTF-8</charset>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
|
Binary file not shown.
|
@ -136,6 +136,19 @@
|
|||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.4</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- mybatis-plus-join 表关联增强 -->
|
||||
<!-- https://mybatisplusjoin.com/pages/core/lambda/select/selectAll.html -->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.4.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -143,6 +156,20 @@
|
|||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- httpclient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>zhishuang.wang</groupId>
|
||||
<artifactId>SanSiCMS</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/protocol/sansi/SanSiCMS.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -4,6 +4,8 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
@ -19,27 +21,34 @@ public class BaseEntity implements Serializable
|
|||
|
||||
/** 搜索值 */
|
||||
@JsonIgnore
|
||||
@TableField(exist = false)
|
||||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
@TableField(exist = false)
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(exist = false)
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
@TableField(exist = false)
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(exist = false)
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
@TableField(exist = false)
|
||||
private String remark;
|
||||
|
||||
/** 请求参数 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params;
|
||||
|
||||
public String getSearchValue()
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.common.utils.http;
|
||||
|
||||
/**
|
||||
* http 配置信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class HttpConf
|
||||
{
|
||||
// 获取连接的最大等待时间
|
||||
public static int WAIT_TIMEOUT = 10000;
|
||||
|
||||
// 连接超时时间
|
||||
public static int CONNECT_TIMEOUT = 10000;
|
||||
|
||||
// 读取超时时间
|
||||
public static int SO_TIMEOUT = 60000;
|
||||
|
||||
// 最大连接数
|
||||
public static int MAX_TOTAL_CONN = 200;
|
||||
|
||||
// 每个路由最大连接数
|
||||
public static int MAX_ROUTE_CONN = 150;
|
||||
|
||||
// 重试次数
|
||||
public static int RETRY_COUNT = 3;
|
||||
|
||||
// EPTWebServes地址
|
||||
public static String EPTWEBSERVES_URL;
|
||||
|
||||
// tomcat默认keepAliveTimeout为20s
|
||||
public static int KEEP_ALIVE_TIMEOUT;
|
||||
}
|
|
@ -10,13 +10,44 @@ import java.net.SocketTimeoutException;
|
|||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpRequestRetryHandler;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.config.RequestConfig.Builder;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
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.conn.ConnectTimeoutException;
|
||||
import org.apache.http.conn.ConnectionKeepAliveStrategy;
|
||||
import org.apache.http.conn.HttpClientConnectionManager;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.TrustStrategy;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.ssl.SSLContextBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
|
@ -24,13 +55,26 @@ import com.ruoyi.common.utils.StringUtils;
|
|||
|
||||
/**
|
||||
* 通用http发送方法
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class HttpUtils
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(HttpUtils.class);
|
||||
|
||||
public static RequestConfig requestConfig;
|
||||
|
||||
private static CloseableHttpClient httpClient;
|
||||
|
||||
private static PoolingHttpClientConnectionManager connMgr;
|
||||
|
||||
private static IdleConnectionMonitorThread idleThread;
|
||||
|
||||
static
|
||||
{
|
||||
HttpUtils.initClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送GET方法的请求
|
||||
*
|
||||
|
@ -59,7 +103,7 @@ public class HttpUtils
|
|||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @param contentType 编码类型
|
||||
* @param contentType 内容类型 编码类型
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, String param, String contentType)
|
||||
|
@ -216,7 +260,7 @@ public class HttpUtils
|
|||
String ret = "";
|
||||
while ((ret = br.readLine()) != null)
|
||||
{
|
||||
if (ret != null && !"".equals(ret.trim()))
|
||||
if (ret != null && !ret.trim().equals(""))
|
||||
{
|
||||
result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
@ -271,4 +315,479 @@ public class HttpUtils
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取httpClient
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static CloseableHttpClient getHttpClient()
|
||||
{
|
||||
if (httpClient != null)
|
||||
{
|
||||
return httpClient;
|
||||
}
|
||||
else
|
||||
{
|
||||
return HttpClients.createDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建连接池管理器
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static PoolingHttpClientConnectionManager createConnectionManager()
|
||||
{
|
||||
|
||||
PoolingHttpClientConnectionManager connMgr = new PoolingHttpClientConnectionManager();
|
||||
// 将最大连接数增加到
|
||||
connMgr.setMaxTotal(HttpConf.MAX_TOTAL_CONN);
|
||||
// 将每个路由基础的连接增加到
|
||||
connMgr.setDefaultMaxPerRoute(HttpConf.MAX_ROUTE_CONN);
|
||||
|
||||
return connMgr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前配置创建HTTP请求配置参数。
|
||||
*
|
||||
* @return 返回HTTP请求配置。
|
||||
*/
|
||||
private static RequestConfig createRequestConfig()
|
||||
{
|
||||
Builder builder = RequestConfig.custom();
|
||||
builder.setConnectionRequestTimeout(StringUtils.nvl(HttpConf.WAIT_TIMEOUT, 10000));
|
||||
builder.setConnectTimeout(StringUtils.nvl(HttpConf.CONNECT_TIMEOUT, 10000));
|
||||
builder.setSocketTimeout(StringUtils.nvl(HttpConf.SO_TIMEOUT, 60000));
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建默认的HTTPS客户端,信任所有的证书。
|
||||
*
|
||||
* @return 返回HTTPS客户端,如果创建失败,返回HTTP客户端。
|
||||
*/
|
||||
private static CloseableHttpClient createHttpClient(HttpClientConnectionManager connMgr)
|
||||
{
|
||||
try
|
||||
{
|
||||
final SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy()
|
||||
{
|
||||
@Override
|
||||
public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException
|
||||
{
|
||||
// 信任所有
|
||||
return true;
|
||||
}
|
||||
}).build();
|
||||
final SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext);
|
||||
|
||||
// 重试机制
|
||||
HttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler(HttpConf.RETRY_COUNT, true);
|
||||
ConnectionKeepAliveStrategy connectionKeepAliveStrategy = new ConnectionKeepAliveStrategy()
|
||||
{
|
||||
@Override
|
||||
public long getKeepAliveDuration(HttpResponse httpResponse, HttpContext httpContext)
|
||||
{
|
||||
return HttpConf.KEEP_ALIVE_TIMEOUT; // tomcat默认keepAliveTimeout为20s
|
||||
}
|
||||
};
|
||||
httpClient = HttpClients.custom().setSSLSocketFactory(sslsf).setConnectionManager(connMgr)
|
||||
.setDefaultRequestConfig(requestConfig).setRetryHandler(retryHandler)
|
||||
.setKeepAliveStrategy(connectionKeepAliveStrategy).build();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("Create http client failed", e);
|
||||
httpClient = HttpClients.createDefault();
|
||||
}
|
||||
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化 只需调用一次
|
||||
*/
|
||||
public synchronized static CloseableHttpClient initClient()
|
||||
{
|
||||
if (httpClient == null)
|
||||
{
|
||||
connMgr = createConnectionManager();
|
||||
requestConfig = createRequestConfig();
|
||||
// 初始化httpClient连接池
|
||||
httpClient = createHttpClient(connMgr);
|
||||
// 清理连接池
|
||||
idleThread = new IdleConnectionMonitorThread(connMgr);
|
||||
idleThread.start();
|
||||
}
|
||||
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭HTTP客户端。
|
||||
*
|
||||
*/
|
||||
public synchronized static void shutdown()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (idleThread != null)
|
||||
{
|
||||
idleThread.shutdown();
|
||||
idleThread = null;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("httpclient connection manager close", e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (httpClient != null)
|
||||
{
|
||||
httpClient.close();
|
||||
httpClient = null;
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("httpclient close", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 GET提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String getCall(final String uri) throws Exception
|
||||
{
|
||||
|
||||
return getCall(uri, null, null, Constants.UTF8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 GET提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String getCall(final String uri, Map<String, String> header) throws Exception
|
||||
{
|
||||
|
||||
return getCall(uri, null, header, Constants.UTF8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 GET提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param contentType 内容类型
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String getCall(final String uri, String contentType) throws Exception
|
||||
{
|
||||
|
||||
return getCall(uri, contentType, null, Constants.UTF8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 GET提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param contentType 内容类型
|
||||
* @param charsetName 编码格式
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String getCall(final String uri, String contentType, Map<String, String> header, String charsetName) throws Exception
|
||||
{
|
||||
final String url = uri;
|
||||
final HttpGet httpGet = new HttpGet(url);
|
||||
httpGet.setConfig(requestConfig);
|
||||
if (!StringUtils.isEmpty(contentType)) {
|
||||
httpGet.addHeader("Content-Type", contentType);
|
||||
}
|
||||
if (!MapUtils.isEmpty(header)) {
|
||||
header.forEach(httpGet::addHeader);
|
||||
}
|
||||
final CloseableHttpResponse httpRsp = getHttpClient().execute(httpGet);
|
||||
try {
|
||||
if (httpRsp.getStatusLine().getStatusCode() == HttpStatus.SC_OK
|
||||
|| httpRsp.getStatusLine().getStatusCode() == HttpStatus.SC_FORBIDDEN) {
|
||||
final HttpEntity entity = httpRsp.getEntity();
|
||||
final String rspText = EntityUtils.toString(entity, charsetName);
|
||||
EntityUtils.consume(entity);
|
||||
return rspText;
|
||||
} else {
|
||||
throw new IOException("HTTP StatusCode=" + httpRsp.getStatusLine().getStatusCode());
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
httpRsp.close();
|
||||
} catch (Exception e) {
|
||||
log.error("关闭httpRsp异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param paramsMap 参数
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String postCall(final String uri, Map<String, Object> paramsMap) throws Exception
|
||||
{
|
||||
return postCall(uri, null, paramsMap, Constants.UTF8, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL url
|
||||
* @param paramsMap 参数 参数
|
||||
* @param header 请求头
|
||||
* @throws IOException IO异常 异常
|
||||
*/
|
||||
public static String postCall(final String uri, Map<String, Object> paramsMap, Map<String, String> header) throws Exception
|
||||
{
|
||||
return postCall(uri, null, paramsMap, Constants.UTF8, header);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param contentType 内容类型
|
||||
* @param paramsMap 参数
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
// public static String postCall(final String uri, String contentType, Map<String, Object> paramsMap) throws Exception {
|
||||
//
|
||||
// return postCall(uri, contentType, paramsMap, Constants.UTF8, null);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param contentType 内容类型
|
||||
* @param paramsMap 参数
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String postCall(final String uri, String contentType, Map<String, Object> paramsMap, Map<String,String> header) throws Exception
|
||||
{
|
||||
|
||||
return postCall(uri, contentType, paramsMap, Constants.UTF8, header);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param contentType 内容类型
|
||||
* @param paramsMap 参数
|
||||
* @param charsetName 编码格式
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String postCall(final String uri, String contentType, Map<String, Object> paramsMap,
|
||||
String charsetName, Map<String, String> header) throws Exception
|
||||
{
|
||||
|
||||
final String url = uri;
|
||||
final HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.setConfig(requestConfig);
|
||||
if (!StringUtils.isEmpty(contentType))
|
||||
{
|
||||
httpPost.addHeader("Content-Type", contentType);
|
||||
}
|
||||
if (!MapUtils.isEmpty(header)) {
|
||||
header.forEach(httpPost::addHeader);
|
||||
}
|
||||
// 添加参数
|
||||
List<NameValuePair> list = new ArrayList<>();
|
||||
if (paramsMap != null)
|
||||
{
|
||||
for (Map.Entry<String, Object> entry : paramsMap.entrySet())
|
||||
{
|
||||
list.add(new BasicNameValuePair(entry.getKey(), (String) entry.getValue()));
|
||||
}
|
||||
}
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(list, charsetName));
|
||||
|
||||
final CloseableHttpResponse httpRsp = getHttpClient().execute(httpPost);
|
||||
|
||||
try
|
||||
{
|
||||
if (httpRsp.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
|
||||
{
|
||||
final HttpEntity entity = httpRsp.getEntity();
|
||||
final String rspText = EntityUtils.toString(entity, charsetName);
|
||||
EntityUtils.consume(entity);
|
||||
return rspText;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IOException("HTTP StatusCode=" + httpRsp.getStatusLine().getStatusCode());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
httpRsp.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("关闭httpRsp异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param param
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String postCall(final String uri, String param) throws Exception
|
||||
{
|
||||
|
||||
return postCall(uri, null, param, Constants.UTF8, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param param
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String postCall(final String uri, String param, Map<String, String> header) throws Exception
|
||||
{
|
||||
|
||||
return postCall(uri, null, param, Constants.UTF8, header);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param contentType 内容类型
|
||||
* @param param
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String postCall(final String uri, String contentType, String param) throws Exception
|
||||
{
|
||||
|
||||
return postCall(uri, contentType, param, Constants.UTF8, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求上游 POST提交
|
||||
*
|
||||
* @param uri URL
|
||||
* @param contentType 内容类型
|
||||
* @param param
|
||||
* @param charsetName 编码格式
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String postCall(final String uri, String contentType, String param, String charsetName, Map<String, String> header)
|
||||
throws Exception
|
||||
{
|
||||
|
||||
final String url = uri;
|
||||
final HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.setConfig(requestConfig);
|
||||
if (!StringUtils.isEmpty(contentType))
|
||||
{
|
||||
httpPost.addHeader("Content-Type", contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
httpPost.addHeader("Content-Type", "application/json");
|
||||
}
|
||||
|
||||
if (!MapUtils.isEmpty(header)) {
|
||||
header.forEach(httpPost::addHeader);
|
||||
}
|
||||
|
||||
// 添加参数
|
||||
StringEntity paramEntity = new StringEntity(param, charsetName);
|
||||
httpPost.setEntity(paramEntity);
|
||||
|
||||
final CloseableHttpResponse httpRsp = getHttpClient().execute(httpPost);
|
||||
|
||||
try
|
||||
{
|
||||
if (httpRsp.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
|
||||
{
|
||||
final HttpEntity entity = httpRsp.getEntity();
|
||||
final String rspText = EntityUtils.toString(entity, charsetName);
|
||||
EntityUtils.consume(entity);
|
||||
return rspText;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IOException("HTTP StatusCode=" + httpRsp.getStatusLine().getStatusCode());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
httpRsp.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("关闭httpRsp异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断HTTP异常是否为读取超时。
|
||||
*
|
||||
* @param e 异常对象。
|
||||
* @return 如果是读取引起的异常(而非连接),则返回true;否则返回false。
|
||||
*/
|
||||
public static boolean isReadTimeout(final Throwable e)
|
||||
{
|
||||
return (!isCausedBy(e, ConnectTimeoutException.class) && isCausedBy(e, SocketTimeoutException.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测异常e被触发的原因是不是因为异常cause。检测被封装的异常。
|
||||
*
|
||||
* @param e 捕获的异常。
|
||||
* @param cause 异常触发原因。
|
||||
* @return 如果异常e是由cause类异常触发,则返回true;否则返回false。
|
||||
*/
|
||||
public static boolean isCausedBy(final Throwable e, final Class<? extends Throwable> cause)
|
||||
{
|
||||
if (cause.isAssignableFrom(e.getClass()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Throwable t = e.getCause();
|
||||
while (t != null && t != e)
|
||||
{
|
||||
if (cause.isAssignableFrom(t.getClass()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
t = t.getCause();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.ruoyi.common.utils.http;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.http.conn.HttpClientConnectionManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 连接池清理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class IdleConnectionMonitorThread extends Thread
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(IdleConnectionMonitorThread.class);
|
||||
|
||||
private final HttpClientConnectionManager connMgr;
|
||||
|
||||
private volatile boolean shutdown;
|
||||
|
||||
public IdleConnectionMonitorThread(HttpClientConnectionManager connMgr)
|
||||
{
|
||||
super();
|
||||
this.shutdown = false;
|
||||
this.connMgr = connMgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
while (!shutdown)
|
||||
{
|
||||
try
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
// 每5秒检查一次关闭连接
|
||||
wait(HttpConf.KEEP_ALIVE_TIMEOUT / 4);
|
||||
// 关闭失效的连接
|
||||
connMgr.closeExpiredConnections();
|
||||
// 可选的, 关闭20秒内不活动的连接
|
||||
connMgr.closeIdleConnections(HttpConf.KEEP_ALIVE_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||
// log.debug("关闭失效的连接");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("关闭失效连接异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
shutdown = true;
|
||||
if (connMgr != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
connMgr.shutdown();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("连接池异常", e);
|
||||
}
|
||||
}
|
||||
synchronized (this)
|
||||
{
|
||||
notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.common.utils.http;
|
||||
|
||||
import io.netty.handler.codec.http.HttpUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
class HttpUtilsTest {
|
||||
|
||||
void getCall() throws Exception {
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("id", "1");
|
||||
paramsMap.put("name", "ruoyi");
|
||||
|
||||
String json = "{\"id\": 1, \"name\": \"ry\"}";
|
||||
String uri = "http://localhost:8080/sensor/data/judge";
|
||||
|
||||
HttpUtils.postCall(uri, paramsMap);
|
||||
HttpUtils.postCall(uri, json);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.framework.manager;
|
||||
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -19,6 +20,7 @@ public class ShutdownManager
|
|||
public void destroy()
|
||||
{
|
||||
shutdownAsyncManager();
|
||||
HttpUtils.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -12,7 +13,7 @@ import lombok.EqualsAndHashCode;
|
|||
* 警报计划表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "pub_alert_plan")
|
||||
public class AlertPlan extends BaseEntity {
|
||||
/**
|
||||
|
@ -37,13 +38,13 @@ public class AlertPlan extends BaseEntity {
|
|||
* 最大值
|
||||
*/
|
||||
@TableField(value = "max_value")
|
||||
private Integer maxValue;
|
||||
private BigDecimal maxValue;
|
||||
|
||||
/**
|
||||
* 最小值
|
||||
*/
|
||||
@TableField(value = "min_value")
|
||||
private Integer minValue;
|
||||
private BigDecimal minValue;
|
||||
|
||||
/**
|
||||
* 显示内容
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
package com.ruoyi.board.domain;
|
||||
|
||||
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 java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 预置信息及模版表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "pub_preset_content")
|
||||
public class PresetContent {
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 预置信息名称
|
||||
*/
|
||||
@TableField(value = "`name`")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 情报板尺寸
|
||||
*/
|
||||
@TableField(value = "board_size")
|
||||
private String boardSize;
|
||||
|
||||
/**
|
||||
* 信息类型
|
||||
*/
|
||||
@TableField(value = "info_type")
|
||||
private Integer infoType;
|
||||
|
||||
/**
|
||||
* 预置内容
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 预览路径
|
||||
*/
|
||||
@TableField(value = "preview_path")
|
||||
private String previewPath;
|
||||
|
||||
/**
|
||||
* 字体样式
|
||||
*/
|
||||
@TableField(value = "font_style")
|
||||
private String fontStyle;
|
||||
|
||||
/**
|
||||
* 字体大小
|
||||
*/
|
||||
@TableField(value = "font_size")
|
||||
private Integer fontSize;
|
||||
|
||||
/**
|
||||
* 字体间距
|
||||
*/
|
||||
@TableField(value = "letter_spacing")
|
||||
private Integer letterSpacing;
|
||||
|
||||
/**
|
||||
* 字体颜色
|
||||
*/
|
||||
@TableField(value = "font_color")
|
||||
private String fontColor;
|
||||
|
||||
/**
|
||||
* 字体坐标X
|
||||
*/
|
||||
@TableField(value = "font_position_x")
|
||||
private Integer fontPositionX;
|
||||
|
||||
/**
|
||||
* 字体坐标Y
|
||||
*/
|
||||
@TableField(value = "font_position_y")
|
||||
private Integer fontPositionY;
|
||||
|
||||
/**
|
||||
* 播放时间
|
||||
*/
|
||||
@TableField(value = "play_time")
|
||||
private Integer playTime;
|
||||
|
||||
/**
|
||||
* 当前预置类型 1:内置模版 0:预发布信息
|
||||
*/
|
||||
@TableField(value = "preset_type")
|
||||
private Integer presetType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@TableField(value = "create_by")
|
||||
private Integer createBy;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
@TableField(value = "update_by")
|
||||
private Integer updateBy;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.board.domain;
|
||||
|
||||
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 java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 发布记录表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "pub_release_record")
|
||||
public class ReleaseRecord {
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 情报板ID
|
||||
*/
|
||||
@TableField(value = "board_id")
|
||||
private Integer boardId;
|
||||
|
||||
/**
|
||||
* 预置信息ID
|
||||
*/
|
||||
@TableField(value = "preset_content_id")
|
||||
private Integer presetContentId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private Integer createdBy;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.ruoyi.board.domain;
|
||||
|
||||
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 java.util.Date;
|
||||
|
||||
/**
|
||||
* 发布记录表
|
||||
*/
|
||||
@Data
|
||||
public class ReleaseRecordDto {
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 情报板ID
|
||||
*/
|
||||
@TableField(value = "board_id")
|
||||
private Integer boardId;
|
||||
|
||||
/**
|
||||
* 预置信息ID
|
||||
*/
|
||||
@TableField(value = "preset_content_id")
|
||||
private Integer presetContentId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private Integer createdBy;
|
||||
|
||||
@TableField(value = "info_type")
|
||||
private Integer infoType;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi.board.domain.enums;
|
||||
|
||||
public class AlertPlanType {
|
||||
|
||||
public static int getPlanTypeByName(String planTypeName) {
|
||||
// 0:雾,1:雨,2:雪
|
||||
switch (planTypeName) {
|
||||
case "雾":
|
||||
return 0;
|
||||
case "雨":
|
||||
return 1;
|
||||
case "雪":
|
||||
return 2;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package com.ruoyi.board.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.ruoyi.board.domain.AlertPlan;
|
||||
|
||||
public interface AlertPlanMapper extends BaseMapper<AlertPlan> {
|
||||
public interface AlertPlanMapper extends MPJBaseMapper<AlertPlan> {
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package com.ruoyi.board.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.ruoyi.board.domain.BoardInfo;
|
||||
|
||||
public interface BoardInfoMapper extends BaseMapper<BoardInfo> {
|
||||
public interface BoardInfoMapper extends MPJBaseMapper<BoardInfo> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.ruoyi.board.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.ruoyi.board.domain.PresetContent;
|
||||
|
||||
public interface PresetContentMapper extends MPJBaseMapper<PresetContent> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.ruoyi.board.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.ruoyi.board.domain.ReleaseRecord;
|
||||
|
||||
public interface ReleaseRecordMapper extends MPJBaseMapper<ReleaseRecord> {
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package com.ruoyi.board.service;
|
||||
|
||||
import com.ruoyi.board.domain.AlertPlan;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
public interface AlertPlanService extends IService<AlertPlan>{
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package com.ruoyi.board.service;
|
||||
|
||||
import com.ruoyi.board.domain.BoardInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
public interface BoardInfoService extends IService<BoardInfo>{
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.ruoyi.board.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.ruoyi.board.domain.AlertPlan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IAlertPlanService extends MPJBaseService<AlertPlan> {
|
||||
|
||||
List<AlertPlan> selectList(AlertPlan alertPlan);
|
||||
|
||||
AlertPlan getOneByTypeAndValue(Integer type, Double value);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.ruoyi.board.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.ruoyi.board.domain.BoardInfo;
|
||||
|
||||
public interface IBoardInfoService extends MPJBaseService<BoardInfo> {
|
||||
|
||||
BoardInfo getOneByIP(String ip);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.ruoyi.board.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.ruoyi.board.domain.PresetContent;
|
||||
|
||||
public interface IPresetContentService extends MPJBaseService<PresetContent> {
|
||||
|
||||
PresetContent getOneByContentAndBoardSize(String content, String boardSize, Integer type);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.ruoyi.board.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.ruoyi.board.domain.ReleaseRecord;
|
||||
|
||||
public interface IReleaseRecordService extends MPJBaseService<ReleaseRecord> {
|
||||
|
||||
ReleaseRecord getOneLatestByBoardId(String boardId, Integer type);
|
||||
}
|
|
@ -1,11 +1,36 @@
|
|||
package com.ruoyi.board.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.board.domain.AlertPlan;
|
||||
import com.ruoyi.board.mapper.AlertPlanMapper;
|
||||
import com.ruoyi.board.service.AlertPlanService;
|
||||
@Service
|
||||
public class AlertPlanServiceImpl extends ServiceImpl<AlertPlanMapper, AlertPlan> implements AlertPlanService{
|
||||
import com.ruoyi.board.service.IAlertPlanService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AlertPlanServiceImpl extends MPJBaseServiceImpl<AlertPlanMapper, AlertPlan> implements IAlertPlanService {
|
||||
|
||||
@Override
|
||||
public List<AlertPlan> selectList(AlertPlan alertPlan) {
|
||||
LambdaQueryWrapper<AlertPlan> alertPlanLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
alertPlanLambdaQueryWrapper.eq(ObjectUtils.isNotEmpty(alertPlan.getType()), AlertPlan::getType, alertPlan.getType());
|
||||
alertPlanLambdaQueryWrapper.eq(ObjectUtils.isNotEmpty(alertPlan.getLevel()), AlertPlan::getLevel, alertPlan.getLevel());
|
||||
return list(alertPlanLambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertPlan getOneByTypeAndValue(Integer planType, Double value) {
|
||||
if (planType < 0) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<AlertPlan> alertPlanLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
alertPlanLambdaQueryWrapper
|
||||
.eq(AlertPlan::getType, planType)
|
||||
.le(AlertPlan::getMinValue, value)
|
||||
.ge(AlertPlan::getMaxValue, value);
|
||||
return getOne(alertPlanLambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
package com.ruoyi.board.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.board.mapper.BoardInfoMapper;
|
||||
import com.ruoyi.board.domain.BoardInfo;
|
||||
import com.ruoyi.board.service.BoardInfoService;
|
||||
import com.ruoyi.board.service.IBoardInfoService;
|
||||
|
||||
@Service
|
||||
public class BoardInfoServiceImpl extends ServiceImpl<BoardInfoMapper, BoardInfo> implements BoardInfoService{
|
||||
public class BoardInfoServiceImpl extends MPJBaseServiceImpl<BoardInfoMapper, BoardInfo> implements IBoardInfoService {
|
||||
|
||||
@Override
|
||||
public BoardInfo getOneByIP(String ip) {
|
||||
LambdaQueryWrapper<BoardInfo> boardInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
boardInfoLambdaQueryWrapper.eq(BoardInfo::getBoardIp, ip);
|
||||
return getOne(boardInfoLambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.board.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.board.mapper.PresetContentMapper;
|
||||
import com.ruoyi.board.domain.PresetContent;
|
||||
import com.ruoyi.board.service.IPresetContentService;
|
||||
|
||||
@Service
|
||||
public class PresetContentServiceImpl extends MPJBaseServiceImpl<PresetContentMapper, PresetContent> implements IPresetContentService {
|
||||
@Override
|
||||
public PresetContent getOneByContentAndBoardSize(String content, String boardSize, Integer type) {
|
||||
LambdaQueryWrapper<PresetContent> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.eq(PresetContent::getContent, content)
|
||||
.eq(PresetContent::getBoardSize, boardSize)
|
||||
.eq(PresetContent::getInfoType, type);
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.ruoyi.board.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.ruoyi.board.domain.PresetContent;
|
||||
import com.ruoyi.board.domain.ReleaseRecordDto;
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.board.domain.ReleaseRecord;
|
||||
import com.ruoyi.board.mapper.ReleaseRecordMapper;
|
||||
import com.ruoyi.board.service.IReleaseRecordService;
|
||||
|
||||
@Service
|
||||
public class ReleaseRecordServiceImpl extends MPJBaseServiceImpl<ReleaseRecordMapper, ReleaseRecord> implements IReleaseRecordService {
|
||||
|
||||
@Override
|
||||
public ReleaseRecord getOneLatestByBoardId(String boardId, Integer type) {
|
||||
// LambdaQueryWrapper<ReleaseRecord> releaseRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// releaseRecordLambdaQueryWrapper
|
||||
// .eq(ReleaseRecord::getBoardId, boardId)
|
||||
// .orderByDesc(ReleaseRecord::getCreateTime)
|
||||
// .last("LIMIT 1");
|
||||
|
||||
ReleaseRecordDto releaseRecord = selectJoinOne(ReleaseRecordDto.class,
|
||||
new MPJLambdaWrapper<ReleaseRecord>()
|
||||
.selectAll(ReleaseRecord.class)
|
||||
.select(PresetContent::getInfoType)
|
||||
.leftJoin(PresetContent.class, PresetContent::getId, ReleaseRecord::getPresetContentId)
|
||||
.eq(ReleaseRecord::getBoardId, boardId)
|
||||
.eq(PresetContent::getInfoType, type)
|
||||
.orderByDesc(ReleaseRecord::getCreateTime)
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
System.out.println(releaseRecord);
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package com.ruoyi.protocol.sansi;
|
||||
|
||||
import com.ruoyi.board.domain.BoardInfo;
|
||||
import com.ruoyi.board.domain.PresetContent;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.protocol.sansi.enums.SanSiFontColor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import zhishuang.wang.sansi.fcms.devinfor.DeviceControl;
|
||||
import zhishuang.wang.sansi.fcms.devinfor.DeviceVar;
|
||||
import zhishuang.wang.sansi.playlist.AreaItem;
|
||||
import zhishuang.wang.sansi.playlist.PageItem;
|
||||
import zhishuang.wang.sansi.playlist.PlayItem;
|
||||
import zhishuang.wang.sansi.playlist.entry.*;
|
||||
import zhishuang.wang.sansi.playlist.fcms.PlayListFcms;
|
||||
import zhishuang.wang.sansi.tools.ReturnData;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SanSiProtocol {
|
||||
private static final Logger log = LoggerFactory.getLogger(SanSiProtocol.class);
|
||||
|
||||
String deviceId = "1";
|
||||
|
||||
public String createTextItem(PresetContent presetContent, BoardInfo boardInfo) {
|
||||
Animation animation = new Animation();
|
||||
animation.setInAnimation(0);
|
||||
animation.setInAnimationSpeed(200);
|
||||
|
||||
TextBase textBase = new TextBase(0, presetContent.getContent());
|
||||
textBase.setFontSize(presetContent.getFontSize()+","+presetContent.getFontSize());
|
||||
textBase.setFontName(presetContent.getFontStyle());
|
||||
textBase.setWordSpace(presetContent.getLetterSpacing());
|
||||
BaseColour fontColour = SanSiFontColor.getBaseColourByColorName(presetContent.getFontColor());
|
||||
if (null == fontColour) {
|
||||
log.error("BaseColour fontColour = SanSiFontColor.getBaseColourByColorName(presetContent.getFontColor()); 没有匹配到相应的字体颜色");
|
||||
return null;
|
||||
}
|
||||
textBase.setFontColour(fontColour);
|
||||
|
||||
PlayTimeBase textPlayTime = new PlayTimeBase(presetContent.getPlayTime());
|
||||
PlayItem textPlayItem = new PlayItem(1, "1", "test", textBase, textPlayTime);
|
||||
textPlayItem.setAnimation(animation);
|
||||
textPlayItem.setX(presetContent.getFontPositionX());
|
||||
textPlayItem.setY(presetContent.getFontPositionY());
|
||||
|
||||
List<PlayItem> playItemList = new ArrayList<>();
|
||||
playItemList.add(textPlayItem);
|
||||
|
||||
String boardSize = boardInfo.getBoardSize();
|
||||
String[] split = StringUtils.split(boardSize, "*");
|
||||
if (split.length < 2) {
|
||||
log.info("尺寸有问题,请重新设置尺寸");
|
||||
return null;
|
||||
}
|
||||
int height = Integer.parseInt(split[0]);
|
||||
int width = Integer.parseInt(split[1]);
|
||||
|
||||
AreaPositon areaPositon = new AreaPositon(0, 0, height, width, 0);
|
||||
AreaItem areaItem = new AreaItem("1", "areaItem", areaPositon, playItemList);
|
||||
|
||||
List<AreaItem> areaItemList = new ArrayList<>();
|
||||
areaItemList.add(areaItem);
|
||||
|
||||
PageItem pageItem = new PageItem("1", "pageItem", areaItemList);
|
||||
PlayListFcms plf = new PlayListFcms();
|
||||
|
||||
String path = "./sansi/" + UUID.fastUUID() + "/play.lst";
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
ReturnData rd = plf.createFcmsPlayList(path, pageItem);
|
||||
System.out.println("====" + rd.getCode());
|
||||
System.out.println("====" + rd.getMessage());
|
||||
if (rd.getCode() != 0) {
|
||||
log.error("生成三思的上传文件出错了");
|
||||
return null;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
private void loginDevice(BoardInfo boardInfo) {
|
||||
DeviceVar.deviceInforInit(deviceId, 1, boardInfo.getBoardIp(), boardInfo.getBoardPort(), 2048);
|
||||
}
|
||||
|
||||
private boolean uploadAndStartPlayList(String path) {
|
||||
ReturnData uploadPlayListRD = DeviceControl.fcmsUploadPlayList(deviceId, path);//上传播放表
|
||||
if (uploadPlayListRD.getCode() != 0) {
|
||||
log.error("上传错误");
|
||||
return false;
|
||||
}
|
||||
ReturnData activePlayListRD = DeviceControl.fcmsActivePlayList(deviceId, "play.lst");
|
||||
if (activePlayListRD.getCode() != 0) {
|
||||
log.error("播放错误");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean publishContent(BoardInfo boardInfo, PresetContent presetContent){
|
||||
loginDevice(boardInfo);
|
||||
String filePath = createTextItem(presetContent, boardInfo);
|
||||
return uploadAndStartPlayList(filePath);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.ruoyi.protocol.sansi.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import zhishuang.wang.sansi.playlist.entry.BaseColour;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
public enum SanSiFontColor {
|
||||
|
||||
red("red", new BaseColour(255, 0, 0, 0, 0)),
|
||||
yellow("yellow", new BaseColour(255, 255, 0, 0, 0)),
|
||||
green("green", new BaseColour(0, 255, 0, 0, 0));
|
||||
|
||||
private final String colorName;
|
||||
private final BaseColour colour;
|
||||
|
||||
SanSiFontColor(String colorName, BaseColour colour) {
|
||||
this.colorName = colorName;
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
public static BaseColour getBaseColourByColorName(String colorName) {
|
||||
return Stream.of(SanSiFontColor.values())
|
||||
.filter(fontColor -> fontColor.getColorName().equals(colorName))
|
||||
.map(SanSiFontColor::getColour)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.ruoyi.protocol.service;
|
||||
|
||||
public interface IProtocolService {
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.ruoyi.protocol.service.impl;
|
||||
|
||||
import com.ruoyi.protocol.service.IProtocolService;
|
||||
|
||||
public class ProtocolServiceImpl implements IProtocolService {
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.sensor.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PerceptionParams {
|
||||
|
||||
/**
|
||||
* 感知类型: 雾 / 冰 或者 0/1/2/3 表示
|
||||
*/
|
||||
private String perceptionType;
|
||||
|
||||
/**
|
||||
* 感知值: 浮点数,精度为小数点后 2 位
|
||||
*/
|
||||
private Double perceptionValue;
|
||||
|
||||
/**
|
||||
* 情报板 IP 地址
|
||||
*/
|
||||
private String boardIp;
|
||||
|
||||
/**
|
||||
* 情报板协议
|
||||
*/
|
||||
private String boardProtocol;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.sensor.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class WarningStatusInfo {
|
||||
private String infoBoardIP;
|
||||
private String warningType;
|
||||
private Double warningValue;
|
||||
private Integer currentWarningLevel;
|
||||
private String status;
|
||||
private Date triggerTime;
|
||||
private String warningMessage;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.ruoyi.sensor.merchants;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.sensor.domain.WarningStatusInfo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MerchantsHttp {
|
||||
private static final Logger log = LoggerFactory.getLogger(MerchantsHttp.class);
|
||||
|
||||
private static final String uri = "http://localhost:8080/merchants";
|
||||
|
||||
public static void sendWarning(WarningStatusInfo warningStatusInfo){
|
||||
String jsonString = JSON.toJSONString(warningStatusInfo);
|
||||
String result = null;
|
||||
Map<String, String> header = new HashMap<>();
|
||||
try {
|
||||
result = HttpUtils.postCall(uri, jsonString, header);
|
||||
} catch (Exception e) {
|
||||
log.error("send warning error", e);
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isEmpty(result)) {
|
||||
log.error("send warning error");
|
||||
return;
|
||||
}
|
||||
// 记录上报结果
|
||||
log.info(result);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.ruoyi.sensor.service;
|
||||
|
||||
import com.ruoyi.sensor.domain.PerceptionParams;
|
||||
|
||||
public interface ISensorDataService {
|
||||
|
||||
void perceptionParamsHandler(PerceptionParams params);
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package com.ruoyi.sensor.service.impl;
|
||||
|
||||
import com.ruoyi.board.domain.AlertPlan;
|
||||
import com.ruoyi.board.domain.BoardInfo;
|
||||
import com.ruoyi.board.domain.PresetContent;
|
||||
import com.ruoyi.board.domain.ReleaseRecord;
|
||||
import com.ruoyi.board.domain.enums.AlertPlanType;
|
||||
import com.ruoyi.board.service.IAlertPlanService;
|
||||
import com.ruoyi.board.service.IBoardInfoService;
|
||||
import com.ruoyi.board.service.IPresetContentService;
|
||||
import com.ruoyi.board.service.IReleaseRecordService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.protocol.sansi.SanSiProtocol;
|
||||
import com.ruoyi.sensor.domain.PerceptionParams;
|
||||
import com.ruoyi.sensor.domain.WarningStatusInfo;
|
||||
import com.ruoyi.sensor.merchants.MerchantsHttp;
|
||||
import com.ruoyi.sensor.service.ISensorDataService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class SensorDataServiceImpl implements ISensorDataService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SensorDataServiceImpl.class);
|
||||
@Autowired
|
||||
private IBoardInfoService boardInfoService;
|
||||
@Autowired
|
||||
private IAlertPlanService alertPlanService;
|
||||
@Autowired
|
||||
private IPresetContentService presetContentService;
|
||||
@Autowired
|
||||
private IReleaseRecordService releaseRecordService;
|
||||
|
||||
@Override
|
||||
public void perceptionParamsHandler(PerceptionParams params) {
|
||||
int planTypeByName = AlertPlanType.getPlanTypeByName(params.getPerceptionType());
|
||||
// 找到符合计划的预警
|
||||
AlertPlan oneByTypeAndValue = alertPlanService.getOneByTypeAndValue(planTypeByName, params.getPerceptionValue());
|
||||
if (null == oneByTypeAndValue) {
|
||||
log.error("找不到预警计划");
|
||||
return;
|
||||
}
|
||||
// 情报板设备信息
|
||||
BoardInfo oneByIP = boardInfoService.getOneByIP(params.getBoardIp());
|
||||
if (null == oneByIP) {
|
||||
log.error("找不到情报板信息");
|
||||
return;
|
||||
}
|
||||
// 预置发布的信息
|
||||
PresetContent oneByContentAndBoardSize = presetContentService.getOneByContentAndBoardSize(oneByTypeAndValue.getDisplayContent(), oneByIP.getBoardSize(), planTypeByName);
|
||||
if (null == oneByContentAndBoardSize) {
|
||||
log.error("找不到预置发布的信息");
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取同类型最新的一条发布记录
|
||||
ReleaseRecord oneLatestByBoardId = releaseRecordService.getOneLatestByBoardId(oneByIP.getBoardIp(), 1);
|
||||
if (null == oneLatestByBoardId) {
|
||||
// 说明之前没有发布记录
|
||||
}
|
||||
|
||||
// todo 发布
|
||||
boolean sanSiProtocol = new SanSiProtocol().publishContent(oneByIP, oneByContentAndBoardSize);
|
||||
// 经过主动发布之后就变成预置信息
|
||||
// 发布之后记录发布内容 ReleaseRecord
|
||||
ReleaseRecord releaseRecord = new ReleaseRecord();
|
||||
releaseRecord.setBoardId(oneByIP.getId());
|
||||
releaseRecord.setPresetContentId(oneByContentAndBoardSize.getId());
|
||||
releaseRecord.setCreateTime(new Date());
|
||||
releaseRecord.setCreatedBy(SecurityUtils.getUserId().intValue());
|
||||
releaseRecordService.save(releaseRecord);
|
||||
// 记录完了之后就需要向对方发送日志记录
|
||||
WarningStatusInfo statusInfo = new WarningStatusInfo();
|
||||
statusInfo.setStatus("");
|
||||
statusInfo.setInfoBoardIP(oneByIP.getBoardIp());
|
||||
statusInfo.setWarningType(params.getPerceptionType());
|
||||
statusInfo.setWarningMessage(oneByContentAndBoardSize.getContent());
|
||||
statusInfo.setWarningValue(params.getPerceptionValue());
|
||||
statusInfo.setCurrentWarningLevel(oneByTypeAndValue.getLevel());
|
||||
statusInfo.setTriggerTime(new Date());
|
||||
// 开始发送状态记录
|
||||
MerchantsHttp.sendWarning(new WarningStatusInfo());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?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="com.ruoyi.board.mapper.PresetContentMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.board.domain.PresetContent">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table pub_preset_content-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="board_size" jdbcType="VARCHAR" property="boardSize" />
|
||||
<result column="info_type" jdbcType="INTEGER" property="infoType" />
|
||||
<result column="content" jdbcType="VARCHAR" property="content" />
|
||||
<result column="preview_path" jdbcType="VARCHAR" property="previewPath" />
|
||||
<result column="font_style" jdbcType="VARCHAR" property="fontStyle" />
|
||||
<result column="font_size" jdbcType="INTEGER" property="fontSize" />
|
||||
<result column="letter_spacing" jdbcType="INTEGER" property="letterSpacing" />
|
||||
<result column="font_color" jdbcType="VARCHAR" property="fontColor" />
|
||||
<result column="font_position_x" jdbcType="INTEGER" property="fontPositionX" />
|
||||
<result column="font_position_y" jdbcType="INTEGER" property="fontPositionY" />
|
||||
<result column="play_time" jdbcType="INTEGER" property="playTime" />
|
||||
<result column="preset_type" jdbcType="INTEGER" property="presetType" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="create_by" jdbcType="INTEGER" property="createBy" />
|
||||
<result column="update_by" jdbcType="INTEGER" property="updateBy" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, board_size, info_type, content, preview_path, font_style, font_size,
|
||||
letter_spacing, font_color, font_position_x, font_position_y, play_time, preset_type,
|
||||
remark, create_time, update_time, create_by, update_by
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,17 @@
|
|||
<?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="com.ruoyi.board.mapper.ReleaseRecordMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.board.domain.ReleaseRecord">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table pub_release_record-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="board_id" jdbcType="INTEGER" property="boardId" />
|
||||
<result column="preset_content_id" jdbcType="INTEGER" property="presetContentId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="created_by" jdbcType="INTEGER" property="createdBy" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, board_id, preset_content_id, create_time, created_by
|
||||
</sql>
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
# 页面标题
|
||||
VUE_APP_TITLE = 若依管理系统
|
||||
VUE_APP_TITLE = 瓷器活发布系统
|
||||
|
||||
# 开发环境配置
|
||||
ENV = 'development'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# 页面标题
|
||||
VUE_APP_TITLE = 若依管理系统
|
||||
VUE_APP_TITLE = 瓷器活发布系统
|
||||
|
||||
# 生产环境配置
|
||||
ENV = 'production'
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询预置信息及模版列表
|
||||
export function listContent(query) {
|
||||
return request({
|
||||
url: '/board/content/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询预置信息及模版详细
|
||||
export function getContent(id) {
|
||||
return request({
|
||||
url: '/board/content/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增预置信息及模版
|
||||
export function addContent(data) {
|
||||
return request({
|
||||
url: '/board/content',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改预置信息及模版
|
||||
export function updateContent(data) {
|
||||
return request({
|
||||
url: '/board/content',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除预置信息及模版
|
||||
export function delContent(id) {
|
||||
return request({
|
||||
url: '/board/content/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询情报板信息列表
|
||||
export function listInfo(query) {
|
||||
return request({
|
||||
url: '/board/info/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询情报板信息详细
|
||||
export function getInfo(id) {
|
||||
return request({
|
||||
url: '/board/info/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增情报板信息
|
||||
export function addInfo(data) {
|
||||
return request({
|
||||
url: '/board/info',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改情报板信息
|
||||
export function updateInfo(data) {
|
||||
return request({
|
||||
url: '/board/info',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除情报板信息
|
||||
export function delInfo(id) {
|
||||
return request({
|
||||
url: '/board/info/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询警报计划列表
|
||||
export function listPlan(query) {
|
||||
return request({
|
||||
url: '/board/plan/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询警报计划详细
|
||||
export function getPlan(id) {
|
||||
return request({
|
||||
url: '/board/plan/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增警报计划
|
||||
export function addPlan(data) {
|
||||
return request({
|
||||
url: '/board/plan',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改警报计划
|
||||
export function updatePlan(data) {
|
||||
return request({
|
||||
url: '/board/plan',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除警报计划
|
||||
export function delPlan(id) {
|
||||
return request({
|
||||
url: '/board/plan/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 79 KiB |
|
@ -9,14 +9,6 @@
|
|||
<template v-if="device!=='mobile'">
|
||||
<search id="header-search" class="right-menu-item" />
|
||||
|
||||
<el-tooltip content="源码地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip content="文档地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
|
||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||
|
|
|
@ -0,0 +1,448 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="auto">
|
||||
<el-form-item label="预置信息名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入预置信息名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板尺寸" prop="boardSize">
|
||||
<el-select
|
||||
v-model="queryParams.boardSize"
|
||||
clearable
|
||||
placeholder="全部">
|
||||
<el-option
|
||||
v-for="dict in dict.type.board_size"
|
||||
:key="dict.value"
|
||||
:label="dict.label + ' ' + dict.value"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
clearable
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alert_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['board:content:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['board:content:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['board:content:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['board:content:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="contentList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="唯一编号" align="center" prop="id" />
|
||||
<el-table-column label="预置信息名称" align="center" prop="name" />
|
||||
<el-table-column label="情报板尺寸" align="center" prop="boardSize" />
|
||||
<el-table-column label="信息类型" align="center" prop="infoType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.alert_type" :value="scope.row.infoType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="预置内容" align="center" prop="content" />
|
||||
<el-table-column label="预览路径" align="center" prop="previewPath" />
|
||||
<!-- <el-table-column label="字体样式" align="center" prop="fontStyle" />-->
|
||||
<!-- <el-table-column label="字体大小" align="center" prop="fontSize" />-->
|
||||
<!-- <el-table-column label="字体间距" align="center" prop="letterSpacing" />-->
|
||||
<!-- <el-table-column label="字体颜色" align="center" prop="fontColor" />-->
|
||||
<!-- <el-table-column label="字体坐标X" align="center" prop="fontPositionX" />-->
|
||||
<!-- <el-table-column label="字体坐标Y" align="center" prop="fontPositionY" />-->
|
||||
<el-table-column label="播放时间" align="center" prop="playTime" />
|
||||
<!-- <el-table-column label="当前预置类型 1:内置模版 0:预发布信息" align="center" prop="presetType" />-->
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['board:content:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['board:content:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改预置信息及模版对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="auto">
|
||||
<el-form-item label="预置信息名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入预置信息名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预置信息类型" prop="infoType">
|
||||
<el-select
|
||||
v-model="form.infoType"
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alert_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板尺寸" prop="boardSize">
|
||||
<el-select
|
||||
v-model="form.boardSize"
|
||||
placeholder="请选择情报板尺寸">
|
||||
<el-option
|
||||
v-for="dict in dict.type.board_size"
|
||||
:key="dict.value"
|
||||
:label="dict.label + ' ' + dict.value"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="预置内容" prop="content">
|
||||
<el-input v-model="form.content" placeholder="请输入预置内容"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="字体样式" prop="fontStyle">
|
||||
<el-select
|
||||
v-model="form.fontStyle"
|
||||
placeholder="请选择字体样式">
|
||||
<el-option
|
||||
v-for="dict in dict.type.font_style"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字体颜色" prop="fontColor">
|
||||
<el-select
|
||||
v-model="form.fontColor"
|
||||
placeholder="请选择字体颜色">
|
||||
<el-option
|
||||
v-for="dict in dict.type.font_color"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字体大小" prop="fontSize">
|
||||
<el-input-number :min="0" v-model="form.fontSize" placeholder="请输入字体大小" />
|
||||
</el-form-item>
|
||||
<el-form-item label="字体间距" prop="letterSpacing">
|
||||
<el-input-number :min="0" v-model="form.letterSpacing" placeholder="请输入字体间距" />
|
||||
</el-form-item>
|
||||
<el-form-item label="字体坐标X" prop="fontPositionX">
|
||||
<el-input-number v-model="form.fontPositionX" placeholder="请输入字体坐标X" />
|
||||
</el-form-item>
|
||||
<el-form-item label="字体坐标Y" prop="fontPositionY">
|
||||
<el-input-number v-model="form.fontPositionY" placeholder="请输入字体坐标Y" />
|
||||
</el-form-item>
|
||||
<el-form-item label="播放时间" prop="playTime">
|
||||
<el-input-number :min="0" v-model="form.playTime" placeholder="请输入播放时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预览路径" prop="previewPath">
|
||||
<el-input v-model="form.previewPath" placeholder="请输入预览路径" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listContent, getContent, delContent, addContent, updateContent } from "@/api/board/content";
|
||||
|
||||
export default {
|
||||
name: "Content",
|
||||
dicts: ['board_size','font_color','font_style', 'alert_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 预置信息及模版表格数据
|
||||
contentList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
boardSize: null,
|
||||
infoType: null,
|
||||
content: null,
|
||||
previewPath: null,
|
||||
fontStyle: null,
|
||||
fontSize: null,
|
||||
letterSpacing: null,
|
||||
fontColor: null,
|
||||
fontPositionX: null,
|
||||
fontPositionY: null,
|
||||
playTime: null,
|
||||
presetType: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "预置信息名称不能为空", trigger: "blur" }
|
||||
],
|
||||
boardSize: [
|
||||
{ required: true, message: "情报板尺寸不能为空", trigger: "blur" }
|
||||
],
|
||||
infoType: [
|
||||
{ required: true, message: "信息类型不能为空", trigger: "change" }
|
||||
],
|
||||
content: [
|
||||
{ required: true, message: "预置内容不能为空", trigger: "blur" }
|
||||
],
|
||||
previewPath: [
|
||||
{ required: true, message: "预览路径不能为空", trigger: "blur" }
|
||||
],
|
||||
fontStyle: [
|
||||
{ required: true, message: "字体样式不能为空", trigger: "blur" }
|
||||
],
|
||||
fontSize: [
|
||||
{ required: true, message: "字体大小不能为空", trigger: "blur" }
|
||||
],
|
||||
letterSpacing: [
|
||||
{ required: true, message: "字体间距不能为空", trigger: "blur" }
|
||||
],
|
||||
fontColor: [
|
||||
{ required: true, message: "字体颜色不能为空", trigger: "blur" }
|
||||
],
|
||||
fontPositionX: [
|
||||
{ required: true, message: "字体坐标X不能为空", trigger: "blur" }
|
||||
],
|
||||
fontPositionY: [
|
||||
{ required: true, message: "字体坐标Y不能为空", trigger: "blur" }
|
||||
],
|
||||
playTime: [
|
||||
{ required: true, message: "播放时间不能为空", trigger: "blur" }
|
||||
],
|
||||
presetType: [
|
||||
{ required: false, message: "当前预置类型 1:内置模版 0:预发布信息不能为空", trigger: "change" }
|
||||
],
|
||||
remark: [
|
||||
{ required: false, message: "备注不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
],
|
||||
updateTime: [
|
||||
{ required: true, message: "更新时间不能为空", trigger: "blur" }
|
||||
],
|
||||
createBy: [
|
||||
{ required: true, message: "创建人id不能为空", trigger: "blur" }
|
||||
],
|
||||
updateBy: [
|
||||
{ required: true, message: "更新人id不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询预置信息及模版列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listContent(this.queryParams).then(response => {
|
||||
this.contentList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
boardSize: null,
|
||||
infoType: null,
|
||||
content: null,
|
||||
previewPath: null,
|
||||
fontStyle: null,
|
||||
fontSize: null,
|
||||
letterSpacing: null,
|
||||
fontColor: null,
|
||||
fontPositionX: null,
|
||||
fontPositionY: null,
|
||||
playTime: null,
|
||||
presetType: null,
|
||||
remark: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
createBy: null,
|
||||
updateBy: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加预置信息及模版";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getContent(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.form.infoType += '';
|
||||
this.open = true;
|
||||
this.title = "修改预置信息及模版";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateContent(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addContent(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除预置信息及模版编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delContent(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('board/content/export', {
|
||||
...this.queryParams
|
||||
}, `content_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,37 @@
|
|||
<template>
|
||||
<el-select
|
||||
v-model="size"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.board_size"
|
||||
:key="dict.value"
|
||||
:label="dict.label + ' ' + dict.value"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
dicts: [
|
||||
'board_size'
|
||||
],
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data: {
|
||||
return: {
|
||||
sizeValue: '',
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
|
@ -0,0 +1,424 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="auto">
|
||||
<el-form-item label="情报板名称" prop="boardName">
|
||||
<el-input
|
||||
v-model="queryParams.boardName"
|
||||
placeholder="请输入情报板名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板工桩号" prop="boardMileage">
|
||||
<el-input
|
||||
v-model="queryParams.boardMileage"
|
||||
placeholder="请输入情报板工桩号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板尺寸" prop="boardSize">
|
||||
<el-select
|
||||
v-model="queryParams.boardSize"
|
||||
clearable
|
||||
placeholder="全部">
|
||||
<el-option
|
||||
v-for="dict in dict.type.board_size"
|
||||
:key="dict.value"
|
||||
:label="dict.label + ' ' + dict.value"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板品牌" prop="boardBrand">
|
||||
<el-input
|
||||
v-model="queryParams.boardBrand"
|
||||
placeholder="请输入情报板品牌"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板通讯协议" prop="boardCommunicationProtocol">
|
||||
<el-select
|
||||
v-model="queryParams.boardCommunicationProtocol"
|
||||
clearable
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.board_protocol"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板路段" prop="boardRoadSection">
|
||||
<treeselect v-model="queryParams.boardRoadSection" :options="deptOptions" placeholder="请选择归属路段"
|
||||
style="width: 300px"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['board:info:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['board:info:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['board:info:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['board:info:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange" append-to-body>
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="唯一编号" align="center" prop="id"/>
|
||||
<el-table-column label="情报板名称" align="center" prop="boardName"/>
|
||||
<el-table-column label="情报板路段" align="center" prop="boardRoadSection"/>
|
||||
<el-table-column label="情报板方向" align="center" prop="boardDirection"/>
|
||||
<el-table-column label="情报板工桩号" align="center" prop="boardMileage"/>
|
||||
<el-table-column label="情报板尺寸" align="center" prop="boardSize">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.board_size" :value="scope.row.boardSize"/>
|
||||
{{ scope.row.boardSize }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="情报板品牌" align="center" prop="boardBrand"/>
|
||||
<el-table-column label="情报板通讯协议" align="center" prop="boardCommunicationProtocol">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.board_protocol" :value="scope.row.boardCommunicationProtocol"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="情报板IP" align="center" prop="boardIp"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['board:info:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['board:info:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改情报板信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="auto">
|
||||
<el-form-item label="情报板名称" prop="boardName">
|
||||
<el-input v-model="form.boardName" placeholder="请输入情报板名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板路段" prop="boardRoadSection">
|
||||
<treeselect v-model="form.boardRoadSection" :options="deptOptions" placeholder="请选择归属路段"
|
||||
style="width: 300px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板方向" prop="boardDirection">
|
||||
<el-input v-model="form.boardDirection" placeholder="请输入情报板方向"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板工桩号" prop="boardMileage">
|
||||
<el-input v-model="form.boardMileage" placeholder="请输入情报板工桩号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板尺寸" prop="boardSize">
|
||||
<el-select
|
||||
v-model="form.boardSize"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.board_size"
|
||||
:key="dict.value"
|
||||
:label="dict.label + ' ' + dict.value"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板品牌" prop="boardBrand">
|
||||
<el-input v-model="form.boardBrand" placeholder="请输入情报板品牌"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板通讯协议" prop="boardCommunicationProtocol">
|
||||
<el-select
|
||||
v-model="form.boardCommunicationProtocol"
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.board_protocol"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板IP" prop="boardIp">
|
||||
<el-input v-model="form.boardIp" placeholder="请输入情报板IP"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="情报板端口号" prop="boardPort">
|
||||
<el-input-number :min="0" :max="65535" v-model="form.boardPort"
|
||||
placeholder="填0为默认端口"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listInfo, getInfo, delInfo, addInfo, updateInfo} from "@/api/board/info";
|
||||
import {deptTreeSelect} from "@/api/system/user";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
export default {
|
||||
name: "Info",
|
||||
dicts: ['board_size', 'board_protocol'],
|
||||
components: {Treeselect},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 部门树选项
|
||||
deptOptions: [],
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 情报板信息表格数据
|
||||
infoList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
boardName: null,
|
||||
boardRoadSection: null,
|
||||
boardDirection: null,
|
||||
boardMileage: null,
|
||||
boardSize: null,
|
||||
boardBrand: null,
|
||||
boardCommunicationProtocol: null,
|
||||
boardIp: null,
|
||||
boardPort: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
boardName: [
|
||||
{required: true, message: "情报板名称不能为空", trigger: "blur"}
|
||||
],
|
||||
boardRoadSection: [
|
||||
{required: true, message: "情报板路段不能为空", trigger: "blur"}
|
||||
],
|
||||
boardDirection: [
|
||||
{required: true, message: "情报板方向不能为空", trigger: "blur"}
|
||||
],
|
||||
boardMileage: [
|
||||
{required: true, message: "情报板工桩号不能为空", trigger: "blur"}
|
||||
],
|
||||
boardSize: [
|
||||
{required: true, message: "情报板尺寸不能为空", trigger: "blur"}
|
||||
],
|
||||
boardBrand: [
|
||||
{required: true, message: "情报板品牌不能为空", trigger: "blur"}
|
||||
],
|
||||
boardCommunicationProtocol: [
|
||||
{required: true, message: "情报板通讯协议不能为空", trigger: "blur"}
|
||||
],
|
||||
boardIp: [
|
||||
{required: true, message: "情报板IP不能为空", trigger: "blur"},
|
||||
{
|
||||
pattern: /^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$/,
|
||||
message: "请输入正确的 IP",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
boardPort: [
|
||||
{required: true, message: "情报板端口号不能为空", trigger: "blur"}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDeptTree();
|
||||
},
|
||||
methods: {
|
||||
/** 查询情报板信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listInfo(this.queryParams).then(response => {
|
||||
this.infoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
boardName: null,
|
||||
boardRoadSection: null,
|
||||
boardDirection: null,
|
||||
boardMileage: null,
|
||||
boardSize: null,
|
||||
boardBrand: null,
|
||||
boardCommunicationProtocol: null,
|
||||
boardIp: null,
|
||||
boardPort: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
console.log(this.queryParams)
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加情报板信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getInfo(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改情报板信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除情报板信息编号为"' + ids + '"的数据项?').then(function () {
|
||||
return delInfo(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('board/info/export', {
|
||||
...this.queryParams
|
||||
}, `info_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
getDeptTree() {
|
||||
deptTreeSelect().then(response => {
|
||||
this.deptOptions = response.data;
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,355 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="auto">
|
||||
<el-form-item label="等级" prop="level">
|
||||
<el-select
|
||||
v-model="queryParams.level"
|
||||
clearable
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alert_level"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
clearable
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alert_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="最大值" prop="maxValue">
|
||||
<el-input
|
||||
v-model="queryParams.maxValue"
|
||||
placeholder="请输入最大值"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="最小值" prop="minValue">
|
||||
<el-input
|
||||
v-model="queryParams.minValue"
|
||||
placeholder="请输入最小值"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['board:plan:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['board:plan:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['board:plan:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['board:plan:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="唯一编号" align="center" prop="id" />
|
||||
<el-table-column label="类型" align="center" prop="type">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.alert_type" :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="等级" align="center" prop="level">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.alert_level" :value="scope.row.level"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最大值" align="center" prop="maxValue" />
|
||||
<el-table-column label="最小值" align="center" prop="minValue" />
|
||||
<el-table-column label="显示内容" align="center" prop="displayContent" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['board:plan:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['board:plan:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改警报计划对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="等级" prop="level">
|
||||
<el-select
|
||||
v-model="form.level"
|
||||
placeholder="全部"
|
||||
:value="1"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alert_level"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select
|
||||
v-model="form.type"
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alert_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="最小值" prop="minValue">
|
||||
<el-input-number :min="0" :precision="2" v-model="form.minValue" placeholder="请输入最小值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最大值" prop="maxValue">
|
||||
<el-input-number :min="form.minValue" :precision="2" v-model="form.maxValue" placeholder="请输入最大值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="显示内容">
|
||||
<el-input v-model="form.displayContent" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/board/plan";
|
||||
|
||||
export default {
|
||||
name: "Plan",
|
||||
dicts: ['alert_level','alert_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 警报计划表格数据
|
||||
planList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
type: null,
|
||||
level: null,
|
||||
maxValue: null,
|
||||
minValue: null,
|
||||
displayContent: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
type: [
|
||||
{ required: true, message: "类型不能为空", trigger: "change" }
|
||||
],
|
||||
level: [
|
||||
{ required: true, message: "等级不能为空", trigger: "blur" }
|
||||
],
|
||||
maxValue: [
|
||||
{ required: true, message: "最大值不能为空", trigger: "blur" }
|
||||
],
|
||||
minValue: [
|
||||
{ required: true, message: "最小值不能为空", trigger: "blur" }
|
||||
],
|
||||
displayContent: [
|
||||
{ required: true, message: "显示内容不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询警报计划列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPlan(this.queryParams).then(response => {
|
||||
this.planList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
type: null,
|
||||
level: null,
|
||||
maxValue: null,
|
||||
minValue: null,
|
||||
displayContent: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加警报计划";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getPlan(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.form.type += '';
|
||||
this.form.level += '';
|
||||
this.open = true;
|
||||
this.title = "修改警报计划";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updatePlan(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPlan(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除警报计划编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delPlan(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('board/plan/export', {
|
||||
...this.queryParams
|
||||
}, `plan_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 字典翻译 */
|
||||
dictAlertPlanTypeFormat(){
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div class="login">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<h3 class="title">若依后台管理系统</h3>
|
||||
<!-- <h3 class="title">若依后台管理系统</h3>-->
|
||||
<h3 class="title">发布系统</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
|
@ -56,7 +57,8 @@
|
|||
</el-form>
|
||||
<!-- 底部 -->
|
||||
<div class="el-login-footer">
|
||||
<span>Copyright © 2018-2024 ruoyi.vip All Rights Reserved.</span>
|
||||
<!-- <span>Copyright © 2018-2024 ruoyi.vip All Rights Reserved.</span>-->
|
||||
<span>瓷器活科技</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div class="register">
|
||||
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
|
||||
<h3 class="title">若依后台管理系统</h3>
|
||||
<!-- <h3 class="title">若依后台管理系统</h3>-->
|
||||
<h3 class="title">发布系统</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
|
@ -61,7 +62,8 @@
|
|||
</el-form>
|
||||
<!-- 底部 -->
|
||||
<div class="el-register-footer">
|
||||
<span>Copyright © 2018-2024 ruoyi.vip All Rights Reserved.</span>
|
||||
<!-- <span>Copyright © 2018-2024 ruoyi.vip All Rights Reserved.</span>-->
|
||||
<span>瓷器活科技</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -7,7 +7,7 @@ function resolve(dir) {
|
|||
|
||||
const CompressionPlugin = require('compression-webpack-plugin')
|
||||
|
||||
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
|
||||
const name = process.env.VUE_APP_TITLE || '瓷器活发布系统' // 网页标题
|
||||
|
||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||
|
||||
|
@ -36,6 +36,7 @@ module.exports = {
|
|||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://localhost:8080`,
|
||||
// target: `http://192.168.2.137:8080`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
|
Loading…
Reference in New Issue