diff --git a/lzbi-admin/src/main/resources/application-dev.yml b/lzbi-admin/src/main/resources/application-dev.yml index 142663f..4566b73 100644 --- a/lzbi-admin/src/main/resources/application-dev.yml +++ b/lzbi-admin/src/main/resources/application-dev.yml @@ -11,16 +11,31 @@ spring: username: admin password: admin virtual-host: / - # 这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调 - publisher-confirm-type: correlated - # 保证交换机能把消息推送到队列中 - publisher-returns: true - # 这个配置是保证消费者会消费消息,手动确认 + publisher-confirm-type: correlated # 这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调 + publisher-returns: true # 保证交换机能把消息推送到队列中 listener: simple: - acknowledge-mode: manual + acknowledge-mode: manual # 这个配置是保证消费者会消费消息,手动确认 + concurrency: 1 # 最小消费者数量 + max-concurrency: 1 # 最大的消费者数量 + prefetch: 1 # 指定一个请求能处理多少个消息,如果有事务的话,必须大于等于transaction数量 + default-requeue-rejected: true #设置是否重回队列 true即出现异常会将消息重新发送到队列中 + # 重试机制 + retry: + stateless: false #有无状态 + enabled: true #设置是否启用消息重试机制,默认为false + maxAttempts: 3 #最大重试次数,默认3 + initial-interval: 1000ms #设置消息重试的初始间隔时间,默认为1000ms + multiplier: 1 #设置消息重试的时间间隔倍数,默认为1(重试时间越来越长) + max-interval: 10000ms #设置消息重试的最大时间间隔,默认为10000ms。 template: mandatory: true + retry: + enabled: true # 开启rabbit初始化重试机制 + initial-interval: 1000ms # 初始重试间隔时间 + max-interval: 10000ms # 最大重试间隔时间 + multiplier: 1 # 重试间隔时间倍数 + max-attempts: 3 # 最大重试次数 redis: # 地址 host: 10.10.10.55 diff --git a/lzbi-admin/src/main/resources/application-test.yml b/lzbi-admin/src/main/resources/application-test.yml index df5114c..9d26470 100644 --- a/lzbi-admin/src/main/resources/application-test.yml +++ b/lzbi-admin/src/main/resources/application-test.yml @@ -5,6 +5,37 @@ server: # redis 配置 spring: + rabbitmq: + host: 10.10.10.55 + port: 5672 + username: admin + password: admin + virtual-host: / + publisher-confirm-type: correlated # 这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调 + publisher-returns: true # 保证交换机能把消息推送到队列中 + listener: + simple: + acknowledge-mode: manual # 这个配置是保证消费者会消费消息,手动确认 + concurrency: 1 # 最小消费者数量 + max-concurrency: 1 # 最大的消费者数量 + prefetch: 1 # 指定一个请求能处理多少个消息,如果有事务的话,必须大于等于transaction数量 + default-requeue-rejected: true #设置是否重回队列 true即出现异常会将消息重新发送到队列中 + # 重试机制 + retry: + stateless: false #有无状态 + enabled: true #设置是否启用消息重试机制,默认为false + maxAttempts: 3 #最大重试次数,默认3 + initial-interval: 1000ms #设置消息重试的初始间隔时间,默认为1000ms + multiplier: 1 #设置消息重试的时间间隔倍数,默认为1(重试时间越来越长) + max-interval: 10000ms #设置消息重试的最大时间间隔,默认为10000ms。 + template: + mandatory: true + retry: + enabled: true # 开启rabbit初始化重试机制 + initial-interval: 1000ms # 初始重试间隔时间 + max-interval: 10000ms # 最大重试间隔时间 + multiplier: 1 # 重试间隔时间倍数 + max-attempts: 3 # 最大重试次数 redis: # 地址 host: 10.10.10.55 diff --git a/lzbi-common/src/main/java/com/lzbi/common/config/RabbitConfig.java b/lzbi-common/src/main/java/com/lzbi/common/config/RabbitConfig.java index d37673d..2b25121 100644 --- a/lzbi-common/src/main/java/com/lzbi/common/config/RabbitConfig.java +++ b/lzbi-common/src/main/java/com/lzbi/common/config/RabbitConfig.java @@ -1,5 +1,6 @@ package com.lzbi.common.config; +import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.rabbit.config.RetryInterceptorBuilder; import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; @@ -30,6 +31,7 @@ import org.springframework.retry.support.RetryTemplate; * mandatory: true) * 3---设置重试 */ +@Slf4j @Configuration public class RabbitConfig { @@ -100,17 +102,17 @@ public class RabbitConfig { rabbitTemplate.setRetryTemplate(rabbitRetryTemplate()); //CorrelationData correlationData, boolean b, String s rabbitTemplate.setConfirmCallback((correlationData, b, s) -> { - System.out.println("ConfirmCallback " + "相关数据:" + correlationData); - System.out.println("ConfirmCallback " + "确认情况:" + b); - System.out.println("ConfirmCallback " + "原因:" + s); + log.info("ConfirmCallback " + "相关数据:{}", correlationData); + log.info("ConfirmCallback " + "确认情况:{}", b); + log.info("ConfirmCallback " + "原因:{}", s); }); //Message message, int i, String s, String s1, String s2 rabbitTemplate.setReturnCallback((message, i, s, s1, s2) -> { - System.out.println("ReturnCallback: " + "消息:" + message); - System.out.println("ReturnCallback: " + "回应码:" + i); - System.out.println("ReturnCallback: " + "回应消息:" + s); - System.out.println("ReturnCallback: " + "交换机:" + s1); - System.out.println("ReturnCallback: " + "路由键:" + s2); + log.info("ReturnCallback " + "消息:{}", message); + log.info("ReturnCallback " + "回应码:{}", i); + log.info("ReturnCallback " + "回应消息:{}", s); + log.info("ReturnCallback " + "交换机:{}", s1); + log.info("ReturnCallback " + "路由键:{}", s2); }); return rabbitTemplate; @@ -131,15 +133,13 @@ public class RabbitConfig { @Override public void close(RetryContext retryContext, RetryCallback retryCallback, Throwable throwable) { // 重试结束的时候调用 (最后一次重试 ) - System.out.println("---------------最后一次调用"); - - return; + log.info("---------------最后一次调用"); } @Override public void onError(RetryContext retryContext, RetryCallback retryCallback, Throwable throwable) { // 异常 都会调用 - System.err.println("-----第{}次调用" + retryContext.getRetryCount()); + log.info("-----第{}次调用", retryContext.getRetryCount()); } }); retryTemplate.setBackOffPolicy(backOffPolicyByProperties()); diff --git a/lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java b/lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java index 4fb96a4..569184d 100644 --- a/lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java +++ b/lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java @@ -9,22 +9,26 @@ public interface BizConstants { * 报表记录状态 */ interface ReportRecordStatus { + /** + * 待处理 + */ + String PENDING = "0"; /** * 准备数据 */ - String PREPARE_DATA = "0"; + String PREPARE_DATA = "1"; /** * 未下载 */ - String NOT_DOWNLOAD = "1"; + String NOT_DOWNLOAD = "2"; /** * 已下载 */ - String DOWNLOADED = "2"; + String DOWNLOADED = "3"; /** - * 导出失败 + * 发生错误 */ - String ERROR = "3"; + String ERROR = "4"; } /** diff --git a/lzbi-common/src/main/java/com/lzbi/common/constant/CacheConstants.java b/lzbi-common/src/main/java/com/lzbi/common/constant/CacheConstants.java index 5a8dcc3..5a6bed5 100644 --- a/lzbi-common/src/main/java/com/lzbi/common/constant/CacheConstants.java +++ b/lzbi-common/src/main/java/com/lzbi/common/constant/CacheConstants.java @@ -46,6 +46,12 @@ public class CacheConstants public static final String PATROL_SYS_ROUTE_TREE = "ROUTE_TREE"; public static final String PATROL_SYS_ALARM_MAP = "ALARM_MAP"; public static final String PATROL_SYS_TOKEN = "TOKEN:"; - - + /** + * RabbitMQ 幂等性Key + */ + public static final String RABBITMQ_IDEMPOTENT_KEY = "RABBITMQ_IDEMPOTENT_KEY:"; + /** + * 报表编号生成 redis key + */ + public static final String REPORT_CODE_GENERATE_KEY = "REPORT_CODE_GENERATE"; } diff --git a/lzbi-common/src/main/java/com/lzbi/common/core/redis/RedisCache.java b/lzbi-common/src/main/java/com/lzbi/common/core/redis/RedisCache.java index 34cb265..490a0d0 100644 --- a/lzbi-common/src/main/java/com/lzbi/common/core/redis/RedisCache.java +++ b/lzbi-common/src/main/java/com/lzbi/common/core/redis/RedisCache.java @@ -265,4 +265,8 @@ public class RedisCache { return redisTemplate.keys(pattern); } + + public long incr(final String key, final long delta) { + return redisTemplate.opsForValue().increment(key, delta); + } } diff --git a/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java index ad76529..f75bbce 100644 --- a/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java +++ b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java @@ -191,8 +191,7 @@ public class DcBusiHisReportController extends BaseController { @PreAuthorize("@ss.hasPermi('report:iot:export')") @PostMapping("/export") public AjaxResult export(@Validated @RequestBody LogTimeThreeQueryParamVo queryVo) { - LoginUser loginUser = SecurityUtils.getLoginUser(); - logTimesacleHistoryThreeService.exportDataReport(queryVo, 2, loginUser); + logTimesacleHistoryThreeService.exportDataReport(queryVo, 2); return AjaxResult.success(); } @@ -200,8 +199,7 @@ public class DcBusiHisReportController extends BaseController { @PreAuthorize("@ss.hasPermi('report:iot:export')") @PostMapping("/export2") public AjaxResult export2(@Validated @RequestBody LogTimeThreeQueryParamVo queryVo) { - LoginUser loginUser = SecurityUtils.getLoginUser(); - logTimesacleHistoryThreeService.exportDataReport(queryVo, 1, loginUser); + logTimesacleHistoryThreeService.exportDataReport(queryVo, 1); return AjaxResult.success(); } @@ -237,8 +235,7 @@ public class DcBusiHisReportController extends BaseController { @PreAuthorize("@ss.hasPermi('report:iot:export')") @PostMapping("/exportWeather") public AjaxResult exportWeather(@Validated @RequestBody ExportWeatherReq exportWeatherReq) throws IOException { - LoginUser loginUser = SecurityUtils.getLoginUser(); - logTimesacleHistoryThreeService.exportWeather(exportWeatherReq, loginUser); + logTimesacleHistoryThreeService.exportWeather(exportWeatherReq); return AjaxResult.success(); } } \ No newline at end of file diff --git a/lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java b/lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java index 3f0843d..761672f 100644 --- a/lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java +++ b/lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java @@ -6,6 +6,7 @@ import cn.hutool.core.io.IoUtil; import cn.hutool.poi.excel.BigExcelWriter; import cn.hutool.poi.excel.ExcelUtil; import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -40,9 +41,6 @@ import java.util.stream.Collectors; @Service public class LogTimesacleHistoryThreeService extends ServiceImpl implements IService { - @Value("${reportFilePath}") - private String reportFilePath; - @Autowired private DcBusiReportRecordService dcBusiReportRecordService; @@ -88,7 +86,7 @@ public class LogTimesacleHistoryThreeService extends ServiceImpl> getExcellData(DcBusiReportRecord dcBusiReportRecord, LogTimeThreeQueryParamVo queryVo, int type) { + public List> getExcelData(String params) { + if (null == params) { + return new ArrayList<>(); + } + JSONArray jsonArray = JSONArray.parseArray(params); + LogTimeThreeQueryParamVo queryVo = jsonArray.getObject(0, LogTimeThreeQueryParamVo.class); + int type = jsonArray.getInteger(1); List> excelData; // 设置头部数据 DcDymicHeaderQueryVo dcDymicHeaderQueryVo = new DcDymicHeaderQueryVo(); @@ -128,13 +135,13 @@ public class LogTimesacleHistoryThreeService extends ServiceImpl> getExportWeatherData(String params) { + if (null == params) { + return new ArrayList<>(); + } + JSONArray jsonArray = JSONArray.parseArray(params); + ExportWeatherReq exportWeatherReq = jsonArray.getObject(0, ExportWeatherReq.class); List weatherReportList = baseMapper.getWeatherReport(exportWeatherReq); List> excelData; if (CollectionUtils.isEmpty(weatherReportList)) { @@ -224,17 +240,6 @@ public class LogTimesacleHistoryThreeService extends ServiceImpl { - void process(Object msg, Channel channel, Message message); + void process(T msg, Channel channel, Message message); void business(Object msg); } diff --git a/lzbi-module/src/main/java/com/lzbi/rabbit/consumer/impl/ReportExportConsumer.java b/lzbi-module/src/main/java/com/lzbi/rabbit/consumer/impl/ReportExportConsumer.java index 2636615..427abb4 100644 --- a/lzbi-module/src/main/java/com/lzbi/rabbit/consumer/impl/ReportExportConsumer.java +++ b/lzbi-module/src/main/java/com/lzbi/rabbit/consumer/impl/ReportExportConsumer.java @@ -3,7 +3,11 @@ package com.lzbi.rabbit.consumer.impl; import cn.hutool.core.io.IoUtil; import cn.hutool.poi.excel.BigExcelWriter; import cn.hutool.poi.excel.ExcelUtil; +import com.alibaba.fastjson2.JSONArray; import com.lzbi.common.constant.BizConstants; +import com.lzbi.common.constant.CacheConstants; +import com.lzbi.common.core.redis.RedisCache; +import com.lzbi.common.utils.spring.SpringUtils; import com.lzbi.rabbit.consumer.IConsumerService; import com.lzbi.report.domain.DcBusiReportRecord; import com.lzbi.report.service.DcBusiReportRecordService; @@ -13,30 +17,47 @@ import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.io.IOException; import java.io.OutputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; @Slf4j @RabbitListener(queues = "ReportExportDirectQueue") @Component -public class ReportExportConsumer implements IConsumerService { +public class ReportExportConsumer implements IConsumerService { + + @Value("${reportFilePath}") + private String reportFilePath; @Autowired private DcBusiReportRecordService dcBusiReportRecordService; + @Autowired + private RedisCache redisCache; + @RabbitHandler @Override - public void process(Object msg, Channel channel, Message message) { - log.info("收到消息:{}", msg); + public void process(Long msg, Channel channel, Message message) { + log.info("收到消息:【{}】,{}", msg, message); try { - this.business(msg); + String key = CacheConstants.RABBITMQ_IDEMPOTENT_KEY + msg; + // 防止重复消费 + if (!redisCache.hasKey(key)) { + // 业务处理 + this.business(msg); + redisCache.setCacheObject(key, msg, 1, TimeUnit.HOURS); + } //由于配置设置了手动应答,所以这里要进行一个手动应答。注意:如果设置了自动应答,这里又进行手动应答,会出现double ack,那么程序会报错。 channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); } catch (IOException e) { @@ -48,34 +69,72 @@ public class ReportExportConsumer implements IConsumerService { public void business(Object msg) { Long reportRecordId = (Long) msg; DcBusiReportRecord dcBusiReportRecord = dcBusiReportRecordService.selectDcBusiReportRecordById(reportRecordId); -// try { -// -// // 更新报表记录 -// dcBusiReportRecord.setStatus(BizConstants.ReportRecordStatus.NOT_DOWNLOAD); -// dcBusiReportRecordService.updateDcBusiReportRecord(dcBusiReportRecord); -// } catch (IOException e) { -// log.error("导出数据异常", e); -// // 更新报表记录 -// dcBusiReportRecord.setStatus(BizConstants.ReportRecordStatus.ERROR); -// dcBusiReportRecordService.updateDcBusiReportRecord(dcBusiReportRecord); -// } + // 判断报表记录状态是否为待处理或发生错误 + if (BizConstants.ReportRecordStatus.PENDING.equals(dcBusiReportRecord.getStatus()) || BizConstants.ReportRecordStatus.ERROR.equals(dcBusiReportRecord.getStatus())) { + // 更新报表记录状态为准备数据 + dcBusiReportRecord.setStatus(BizConstants.ReportRecordStatus.PREPARE_DATA); + dcBusiReportRecord.setUpdatedBy("rabbitmq"); + dcBusiReportRecordService.updateDcBusiReportRecord(dcBusiReportRecord); + try { + // 获取数据 + List> reportData = this.getReportData(dcBusiReportRecord); + log.debug("报表数据:{}", JSONArray.toJSONString(reportData)); + // 导出excel + toExcel(dcBusiReportRecord, reportData); + // 更新报表记录未下载 + dcBusiReportRecord.setStatus(BizConstants.ReportRecordStatus.NOT_DOWNLOAD); + dcBusiReportRecordService.updateDcBusiReportRecord(dcBusiReportRecord); + } catch (Exception e) { + log.error("导出数据异常", e); + // 更新报表发生错误 + dcBusiReportRecord.setStatus(BizConstants.ReportRecordStatus.ERROR); + dcBusiReportRecordService.updateDcBusiReportRecord(dcBusiReportRecord); + } + } } + /** + * 获取报表数据 + * @param dcBusiReportRecord + * @return + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalAccessException + */ + private List> getReportData(DcBusiReportRecord dcBusiReportRecord) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + String beanName = dcBusiReportRecord.getBeanName(); + String methodName = dcBusiReportRecord.getMethodName(); + String params = dcBusiReportRecord.getParams(); + log.info("获取报表数据,beanName:{},methodName:{},params:{}", beanName, methodName, params); + Object bean = SpringUtils.getBean(beanName); + Method method = bean.getClass().getMethod(methodName, String.class); + Object data = method.invoke(bean, params); + if (null == data) { + return new ArrayList<>(); + } else { + return (List>) data; + } + } - -// private void toExcel(DcBusiReportRecord dcBusiReportRecord, List> mapList) throws IOException { -// Path folder = Paths.get(reportFilePath); -// if (!Files.exists(folder)) { -// Files.createDirectories(folder); -// } -// OutputStream out = Files.newOutputStream(Paths.get(dcBusiReportRecord.getUrl())); -// BigExcelWriter writer = ExcelUtil.getBigWriter(); -// writer.write(mapList, true); -// writer.flush(out, true); -// // 关闭writer,释放内存 -// writer.close(); -// //此处记得关闭输出流 -// IoUtil.close(out); -// } + /** + * 导出excel + * @param dcBusiReportRecord + * @param reportData + * @throws IOException + */ + private void toExcel(DcBusiReportRecord dcBusiReportRecord, List> reportData) throws IOException { + Path folder = Paths.get(reportFilePath); + if (!Files.exists(folder)) { + Files.createDirectories(folder); + } + OutputStream out = Files.newOutputStream(Paths.get(dcBusiReportRecord.getUrl())); + BigExcelWriter writer = ExcelUtil.getBigWriter(); + writer.write(reportData, true); + writer.flush(out, true); + // 关闭writer,释放内存 + writer.close(); + //此处记得关闭输出流 + IoUtil.close(out); + } } \ No newline at end of file diff --git a/lzbi-module/src/main/java/com/lzbi/rabbit/producer/ReportExportProducer.java b/lzbi-module/src/main/java/com/lzbi/rabbit/producer/ReportExportProducer.java index 534bd8b..e381b6f 100644 --- a/lzbi-module/src/main/java/com/lzbi/rabbit/producer/ReportExportProducer.java +++ b/lzbi-module/src/main/java/com/lzbi/rabbit/producer/ReportExportProducer.java @@ -1,5 +1,7 @@ package com.lzbi.rabbit.producer; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.rabbit.connection.CorrelationData; import org.springframework.amqp.rabbit.core.RabbitTemplate; @@ -15,11 +17,14 @@ import java.util.UUID; @Component public class ReportExportProducer { + // 雪花算法 + private static final Snowflake snowflake = IdUtil.getSnowflake(1, 4); + @Autowired private RabbitTemplate rabbitTemplate; public void sendMsg(Long reportRecordId) { log.info("发送消息,导出报表,报表记录id:{}", reportRecordId); - rabbitTemplate.convertAndSend("ReportExportDirectExchange", "123", reportRecordId, new CorrelationData(UUID.randomUUID().toString())); + rabbitTemplate.convertAndSend("ReportExportDirectExchange", "bigdata.report.export", reportRecordId, new CorrelationData(snowflake.nextIdStr())); } } diff --git a/lzbi-module/src/main/java/com/lzbi/report/domain/DcBusiReportRecord.java b/lzbi-module/src/main/java/com/lzbi/report/domain/DcBusiReportRecord.java index 90d3e4f..1bd767a 100644 --- a/lzbi-module/src/main/java/com/lzbi/report/domain/DcBusiReportRecord.java +++ b/lzbi-module/src/main/java/com/lzbi/report/domain/DcBusiReportRecord.java @@ -29,6 +29,11 @@ public class DcBusiReportRecord extends BaseModuleEntity @TableId(type = IdType.AUTO) private Long id; + /** 报表编号 */ + @Excel(name = "报表编号") + @ApiModelProperty(name = "报表编号",notes = "reportCode") + private String reportCode; + /** 报表名称 */ @Excel(name = "报表名称") @ApiModelProperty(name = "报表名称",notes = "reportName") @@ -44,6 +49,21 @@ public class DcBusiReportRecord extends BaseModuleEntity @ApiModelProperty(name = "状态 0准备数据 1未下载 2已下载",notes = "status") private String status; + /** spring bean 名称 */ + @Excel(name = "spring bean 名称") + @ApiModelProperty(name = "spring bean 名称",notes = "beanName") + private String beanName; + + /** 方法名称 */ + @Excel(name = "方法名称") + @ApiModelProperty(name = "方法名称",notes = "methodName") + private String methodName; + + /** 参数(格式:jsonArray) */ + @Excel(name = "参数", readConverterExp = "格=式:jsonArray") + @ApiModelProperty(name = "参数",notes = "") + private String params; + /** 部门ID */ @Excel(name = "部门ID") @ApiModelProperty(name = "部门ID",notes = "deptId") diff --git a/lzbi-module/src/main/java/com/lzbi/report/service/DcBusiReportRecordService.java b/lzbi-module/src/main/java/com/lzbi/report/service/DcBusiReportRecordService.java index dbc5d7c..dd5f790 100644 --- a/lzbi-module/src/main/java/com/lzbi/report/service/DcBusiReportRecordService.java +++ b/lzbi-module/src/main/java/com/lzbi/report/service/DcBusiReportRecordService.java @@ -1,26 +1,34 @@ package com.lzbi.report.service; -import java.io.*; -import java.nio.file.Files; -import java.util.Arrays; -import java.util.List; - import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.IdUtil; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lzbi.common.constant.BizConstants; +import com.lzbi.common.constant.CacheConstants; +import com.lzbi.common.core.redis.RedisCache; +import com.lzbi.common.utils.SecurityUtils; import com.lzbi.rabbit.producer.ReportExportProducer; +import com.lzbi.report.domain.DcBusiReportRecord; +import com.lzbi.report.mapper.DcBusiReportRecordMapper; import org.apache.commons.compress.utils.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import com.lzbi.report.domain.DcBusiReportRecord; -import com.lzbi.report.mapper.DcBusiReportRecordMapper; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; /** * 报表记录Service业务层处理 @@ -41,6 +49,9 @@ public class DcBusiReportRecordService extends ServiceImpl + + + + - - + + + + - select id, report_name, url, status, dept_id, created_by, created_time, updated_by, updated_time, remark from dc_busi_report_record + select id, report_code, report_name, url, status, bean_name, method_name, params, dept_id, created_by, created_time, updated_by, updated_time, remark, delete_by, delete_time, tenant_id, revision from dc_busi_report_record