Commit 3baf70fc authored by suhuiguang's avatar suhuiguang

1.修改mqtt消息重复

2.新增报表demo
parent 4397dd29
......@@ -6,8 +6,15 @@ package com.yeejoin.equipmanage.common.enums;
*
*/
public enum WordTemplateTypeEum {
resume("简历","jianli.ftl"),
firePatrolReport("消防巡查报表","FirePatrolReport.ftl");
/**
* 模板分类
*/
resume("简历","jianli.ftl"),
firePatrolReport("消防巡查报表","FirePatrolReport.ftl"),
fireAutoSysManageReport("消防自动化综合管理报表","fireAutoSysManageReport.ftl");
private String label;
private String templateFile;
......
......@@ -364,28 +364,28 @@ public class CarController extends AbstractBaseController {
iCarService.dataSyncDeletedIds(carIds);
}
String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
boolean flag = false;
for (String id : idStrings) {
String iotCode = iCarService.getById(id).getIotCode();
if (StringUtil.isNotEmpty(iotCode)) {
String prefix = iotCode.substring(0, 8);
String suffix = iotCode.substring(8);
String oldTopic = prefix + "/" + suffix + "/property";
for (String topic : topics) {
if (topic.equals(oldTopic)) {
flag = true;
break;
}
}
if (flag) {
try {
equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
// boolean flag = false;
// for (String id : idStrings) {
// String iotCode = iCarService.getById(id).getIotCode();
// if (StringUtil.isNotEmpty(iotCode)) {
// String prefix = iotCode.substring(0, 8);
// String suffix = iotCode.substring(8);
// String oldTopic = prefix + "/" + suffix + "/property";
// for (String topic : topics) {
// if (topic.equals(oldTopic)) {
// flag = true;
// break;
// }
// }
// if (flag) {
// try {
// equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property");
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
// }
CarController controllerProxy = SpringUtils.getBean(CarController.class);
controllerProxy.refreshAllCount();
......
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.service.IFirePatrolReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
/**
* @author shg
* @date 2022-04-28
*/
@RestController
@Api(tags = "消防自动化综合管理报表Api")
@RequestMapping(value = "/fire-manage-report")
@Slf4j
public class FireAutoSysManageReportController extends BaseController {
@Autowired
IFirePatrolReportService iFirePatrolReportService;
@ApiOperation(value = "下载报表", notes = "下载报表")
@GetMapping(value = "/download")
@TycloudOperation(ApiLevel = UserType.PUBLIC, needAuth = false)
public void download(HttpServletRequest request, HttpServletResponse response,
@ApiParam(value = "换流站编码", required = true) @RequestParam String stationCode,
@ApiParam(value = "开始日期", required = true) @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@ApiParam(value = "结束日期", required = true) @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
iFirePatrolReportService.download(request, response, stationCode, startDate, endDate);
}
@ApiOperation(value = "预览报表", notes = "预览报表")
@GetMapping(value = "/preview")
@TycloudOperation(ApiLevel = UserType.PUBLIC)
public String preview(
@ApiParam(value = "换流站编码", required = true) @RequestParam String stationCode,
@ApiParam(value = "开始日期", required = true) @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@ApiParam(value = "结束日期", required = true) @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
return iFirePatrolReportService.preview(stationCode, startDate, endDate);
}
@SuppressWarnings("unchecked")
@ApiOperation(value = "所有站查询列表", notes = "所有站查询列表")
@GetMapping(value = "/allPage")
@TycloudOperation(ApiLevel = UserType.PUBLIC)
public IPage<AnalysisReportLogDto> allPage(Page page, @RequestParam Integer reportType,
@ApiParam(value = "开始日期") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@ApiParam(value = "结束日期") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
@ApiParam(value = "换流站编码") @RequestParam(required = false) String stationCode) {
return iFirePatrolReportService.allPage(page, reportType, startDate, endDate, stationCode);
}
}
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
public interface IFireAutoSysManageReportService {
void download(HttpServletRequest request, HttpServletResponse response, String code, Date startDate, Date endDate);
String preview(String code, Date startDate, Date endDate);
IPage<AnalysisReportLogDto> allPage(Page<AnalysisReportLogDto> page, Integer reportType, Date startDate, Date endDate, String stationCode);
}
......@@ -510,28 +510,28 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
private static void regEquipMqttTopic(String iotCode, EquipmentIotMqttReceiveConfig equipmentIotMqttReceiveConfig) {
if (StringUtil.isNotEmpty(iotCode)) {
String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
if (8 < iotCode.length()) {
String prefix = iotCode.substring(0, 8);
String suffix = iotCode.substring(8);
String newTopic = prefix + "/" + suffix + "/property";
boolean flag = false;
for (String topic : topics) {
if (topic.equals(newTopic)) {
flag = true;
break;
}
}
if (!flag) {
try {
equipmentIotMqttReceiveConfig.adapter.addTopic(prefix + "/" + suffix + "/property", 1);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
// if (StringUtil.isNotEmpty(iotCode)) {
// String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
// if (8 < iotCode.length()) {
// String prefix = iotCode.substring(0, 8);
// String suffix = iotCode.substring(8);
// String newTopic = prefix + "/" + suffix + "/property";
// boolean flag = false;
// for (String topic : topics) {
// if (topic.equals(newTopic)) {
// flag = true;
// break;
// }
// }
// if (!flag) {
// try {
// equipmentIotMqttReceiveConfig.adapter.addTopic(prefix + "/" + suffix + "/property", 1);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
// }
}
@Override
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment