Browse Source

Dashboard: 时区切换功能添加

wangPH 2 years ago
parent
commit
be8949dad0

+ 4 - 0
background-common/src/main/java/cn/kdan/compdf/utils/MD5Util.java

@@ -30,6 +30,10 @@ public class MD5Util {
 		return resultString;
 		return resultString;
 	}
 	}
 
 
+	public static void main(String[] args) {
+		System.out.println(MD5Util.MD5Encode("123456"));
+	}
+
 	/**
 	/**
 	 * 转换字符串
 	 * 转换字符串
 	 * @author Bob 2022-10-13
 	 * @author Bob 2022-10-13

+ 0 - 11
background-gateway/src/main/resources/application.yml

@@ -10,17 +10,6 @@ spring:
         ip: ${NACOS_IP:127.0.0.1}
         ip: ${NACOS_IP:127.0.0.1}
         username: ${NACOS_USERNAME:nacos}
         username: ${NACOS_USERNAME:nacos}
         password: ${NACOS_PASSWORD:Nacos@123!}
         password: ${NACOS_PASSWORD:Nacos@123!}
-      config:
-        server-addr: ${spring.cloud.nacos.discovery.server-addr}
-        username: ${spring.cloud.nacos.discovery.username}
-        password: ${spring.cloud.nacos.discovery.password}
-        file-extension: yml
-        refresh-enabled: true
-        shared-configs:
-          - data-id: compdf.yml
-            refresh: true
-          - data-id: compdf-gateway.yml
-            refresh: true
     gateway:
     gateway:
       discovery:
       discovery:
         locator:
         locator:

+ 14 - 2
background-user/src/main/java/cn/kdan/compdf/controller/v1/BackgroundUserWebhookController.java

@@ -1,8 +1,10 @@
 package cn.kdan.compdf.controller.v1;
 package cn.kdan.compdf.controller.v1;
 
 
+import cn.hutool.core.util.ObjectUtil;
 import cn.kdan.compdf.base.R;
 import cn.kdan.compdf.base.R;
 import cn.kdan.compdf.dto.AddNewWebhookDTO;
 import cn.kdan.compdf.dto.AddNewWebhookDTO;
 import cn.kdan.compdf.dto.EditWebhookDTO;
 import cn.kdan.compdf.dto.EditWebhookDTO;
+import cn.kdan.compdf.dto.WebhookLogsDTO;
 import cn.kdan.compdf.service.BackgroundUserWebhookService;
 import cn.kdan.compdf.service.BackgroundUserWebhookService;
 import cn.kdan.compdf.utils.TokenUtil;
 import cn.kdan.compdf.utils.TokenUtil;
 import cn.kdan.compdf.vo.BackgroundEventVO;
 import cn.kdan.compdf.vo.BackgroundEventVO;
@@ -32,8 +34,11 @@ public class BackgroundUserWebhookController {
      * 获取Webhooks列表
      * 获取Webhooks列表
      */
      */
     @GetMapping("/getWebhookList")
     @GetMapping("/getWebhookList")
-    public R<List<BackgroundUserWebhookVO>> getWebhookList() {
-        return R.ok(backgroundUserWebhookService.getWebhookList(TokenUtil.getRequestHeader().getId()));
+    public R<List<BackgroundUserWebhookVO>> getWebhookList(Integer timeZone) {
+        if (ObjectUtil.isEmpty(timeZone)) {
+            timeZone = 0;
+        }
+        return R.ok(backgroundUserWebhookService.getWebhookList(TokenUtil.getRequestHeader().getId(),timeZone));
     }
     }
 
 
     /**
     /**
@@ -89,4 +94,11 @@ public class BackgroundUserWebhookController {
         backgroundUserWebhookService.deleteById(id);
         backgroundUserWebhookService.deleteById(id);
         return R.ok();
         return R.ok();
     }
     }
+
+    @PostMapping("/last-send-sync")
+    public R<Void> updateWebhookLastSendTime(@RequestBody List<WebhookLogsDTO> webhookLogsDTOList){
+        backgroundUserWebhookService.updateWebhookLastSendTime(webhookLogsDTOList);
+        return R.ok();
+    }
+
 }
 }

+ 26 - 0
background-user/src/main/java/cn/kdan/compdf/dto/WebhookLogsDTO.java

@@ -0,0 +1,26 @@
+package cn.kdan.compdf.dto;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author ComPDFKit-WPH 2022/12/7
+ *
+ * WebhookLogsDTO
+ */
+@Data
+@ToString
+public class WebhookLogsDTO implements Serializable {
+    /**
+     * 发送时间
+     */
+    private LocalDateTime sendTime;
+    /**
+     * webhook id
+     */
+    private Long webhookId;
+
+}

+ 3 - 1
background-user/src/main/java/cn/kdan/compdf/entity/BackgroundUserWebhook.java

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
+
+import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -48,6 +50,6 @@ public class BackgroundUserWebhook extends BaseEntity{
     /**
     /**
      * 上一次发送请求的时间
      * 上一次发送请求的时间
      */
      */
-    private Date responseTime;
+    private LocalDateTime responseTime;
 
 
 }
 }

+ 4 - 0
background-user/src/main/java/cn/kdan/compdf/entity/dto/DashboardQueryDTO.java

@@ -50,5 +50,9 @@ public class DashboardQueryDTO {
      * 工具id
      * 工具id
      */
      */
     private Long toolId;
     private Long toolId;
+    /**
+     * 时区
+     */
+    private Integer timeZone;
 
 
 }
 }

+ 2 - 0
background-user/src/main/java/cn/kdan/compdf/mapper/BackgroundUserWebhookMapper.java

@@ -1,5 +1,6 @@
 package cn.kdan.compdf.mapper;
 package cn.kdan.compdf.mapper;
 
 
+import cn.kdan.compdf.dto.WebhookLogsDTO;
 import cn.kdan.compdf.entity.BackgroundUserWebhook;
 import cn.kdan.compdf.entity.BackgroundUserWebhook;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 
@@ -8,4 +9,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
  */
 public interface BackgroundUserWebhookMapper extends BaseMapper<BackgroundUserWebhook> {
 public interface BackgroundUserWebhookMapper extends BaseMapper<BackgroundUserWebhook> {
 
 
+    void updateWebhookLastSendTime(WebhookLogsDTO webhookLogsDTO);
 }
 }

+ 7 - 1
background-user/src/main/java/cn/kdan/compdf/service/BackgroundUserWebhookService.java

@@ -2,6 +2,7 @@ package cn.kdan.compdf.service;
 
 
 import cn.kdan.compdf.dto.AddNewWebhookDTO;
 import cn.kdan.compdf.dto.AddNewWebhookDTO;
 import cn.kdan.compdf.dto.EditWebhookDTO;
 import cn.kdan.compdf.dto.EditWebhookDTO;
+import cn.kdan.compdf.dto.WebhookLogsDTO;
 import cn.kdan.compdf.entity.BackgroundUserWebhook;
 import cn.kdan.compdf.entity.BackgroundUserWebhook;
 import cn.kdan.compdf.vo.BackgroundEventVO;
 import cn.kdan.compdf.vo.BackgroundEventVO;
 import cn.kdan.compdf.vo.BackgroundUserWebhookInfoVO;
 import cn.kdan.compdf.vo.BackgroundUserWebhookInfoVO;
@@ -28,7 +29,7 @@ public interface BackgroundUserWebhookService extends IService<BackgroundUserWeb
      * @param userId 用户id
      * @param userId 用户id
      * @return 用户Webhooks列表
      * @return 用户Webhooks列表
      */
      */
-    List<BackgroundUserWebhookVO> getWebhookList(Long userId);
+    List<BackgroundUserWebhookVO> getWebhookList(Long userId,Integer timeZone);
 
 
     /**
     /**
      * 获取系统所有事件
      * 获取系统所有事件
@@ -49,4 +50,9 @@ public interface BackgroundUserWebhookService extends IService<BackgroundUserWeb
     void editWebhook(EditWebhookDTO editWebhookDTO);
     void editWebhook(EditWebhookDTO editWebhookDTO);
 
 
     void deleteById(Long id);
     void deleteById(Long id);
+
+    /**
+     * 修改webhook最后调用时间
+     */
+    void updateWebhookLastSendTime(List<WebhookLogsDTO> webhookLogsDTOList);
 }
 }

+ 75 - 72
background-user/src/main/java/cn/kdan/compdf/service/impl/BackgroundConvertDataServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.kdan.compdf.service.impl;
 package cn.kdan.compdf.service.impl;
 
 
+import cn.hutool.core.util.ObjectUtil;
 import cn.kdan.compdf.config.ExcelWidthStyleStrategy;
 import cn.kdan.compdf.config.ExcelWidthStyleStrategy;
 import cn.kdan.compdf.config.RedisConstantServer;
 import cn.kdan.compdf.config.RedisConstantServer;
 import cn.kdan.compdf.dto.DashboardStatisticsDTO;
 import cn.kdan.compdf.dto.DashboardStatisticsDTO;
@@ -14,6 +15,7 @@ import cn.kdan.compdf.exception.CommonException;
 import cn.kdan.compdf.mapper.BackgroundConvertDataMapper;
 import cn.kdan.compdf.mapper.BackgroundConvertDataMapper;
 import cn.kdan.compdf.service.BackgroundConvertDataService;
 import cn.kdan.compdf.service.BackgroundConvertDataService;
 import cn.kdan.compdf.service.BackgroundUserService;
 import cn.kdan.compdf.service.BackgroundUserService;
+import cn.kdan.compdf.utils.MyLocalDateUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.util.MapUtils;
 import com.alibaba.excel.util.MapUtils;
 import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
 import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
@@ -68,7 +70,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
     }
     }
 
 
     @Override
     @Override
-    @Cacheable(value = RedisConstantServer.DASHBOARD_ANALYSIS_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
+//    @Cacheable(value = RedisConstantServer.DASHBOARD_ANALYSIS_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
     public AnalysisDataDTO getAnalysisData(DashboardQueryDTO queryDTO) {
     public AnalysisDataDTO getAnalysisData(DashboardQueryDTO queryDTO) {
         // 获取一个查询query
         // 获取一个查询query
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = getDashboardQueryWrapper(queryDTO);
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = getDashboardQueryWrapper(queryDTO);
@@ -110,7 +112,6 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
      * ms-s-min-时间处理
      * ms-s-min-时间处理
      * @param time 毫秒时间
      * @param time 毫秒时间
      * @param type 指定转换类型1:s;2:min
      * @param type 指定转换类型1:s;2:min
-     * @return
      */
      */
     private String TimeConvert(BigDecimal time, Integer type) {
     private String TimeConvert(BigDecimal time, Integer type) {
         BigDecimal convertTime = time;
         BigDecimal convertTime = time;
@@ -139,7 +140,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
     }
     }
 
 
     @Override
     @Override
-    @Cacheable(value = RedisConstantServer.DASHBOARD_SUCCESS_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
+//    @Cacheable(value = RedisConstantServer.DASHBOARD_SUCCESS_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
     public List<DashboardDetailedDataDTO> getSuccessfulRequestDetailedData(DashboardQueryDTO queryDTO) {
     public List<DashboardDetailedDataDTO> getSuccessfulRequestDetailedData(DashboardQueryDTO queryDTO) {
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = getDashboardQueryWrapper(queryDTO);
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = getDashboardQueryWrapper(queryDTO);
         // 添加select 查询参数
         // 添加select 查询参数
@@ -147,7 +148,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
         // 查询数据
         // 查询数据
         List<BackgroundConvertData> backgroundConvertData = this.baseMapper.selectList(queryWrapper);
         List<BackgroundConvertData> backgroundConvertData = this.baseMapper.selectList(queryWrapper);
 
 
-        LocalDateTime nowTime = getLocalDataTime();
+        LocalDateTime nowTime = MyLocalDateUtil.getLocalDataTime();
         // 返回数据集合
         // 返回数据集合
         List<DashboardDetailedDataDTO> dataDTOS = new ArrayList<>();
         List<DashboardDetailedDataDTO> dataDTOS = new ArrayList<>();
 
 
@@ -159,20 +160,22 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                     for (int i = 0; i < 24; i++) {
                     for (int i = 0; i < 24; i++) {
                         // 减去 i 小时时间
                         // 减去 i 小时时间
                         LocalDateTime minus = nowTime.minus(i, ChronoUnit.HOURS);
                         LocalDateTime minus = nowTime.minus(i, ChronoUnit.HOURS);
-                        successTotal = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus)
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusHours(1)))
+                        successTotal = backgroundConvertData.stream().filter(convertData -> MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), minus)
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), minus.plusHours(1)))
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileSuccessTotal)).getSum();
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileSuccessTotal)).getSum();
 
 
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
-                                .xData(minus.toString())
+                                .xData(MyLocalDateUtil.timeZoneConversion(minus, queryDTO.getTimeZone()).toString())
                                 .yData(successTotal + "").build());
                                 .yData(successTotal + "").build());
                     }
                     }
                 } else {
                 } else {
                     for (int i = 0; i < queryDTO.getDays(); i++) {
                     for (int i = 0; i < queryDTO.getDays(); i++) {
                         // 减去 i 天时间
                         // 减去 i 天时间
                         LocalDate minus = nowTime.minus(i, ChronoUnit.DAYS).toLocalDate();
                         LocalDate minus = nowTime.minus(i, ChronoUnit.DAYS).toLocalDate();
-                        successTotal = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus.atStartOfDay())
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusDays(1).atStartOfDay()))
+                        successTotal = backgroundConvertData.stream()
+                                .filter(convertData ->
+                                        MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone())) &&
+                                       !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plusDays(1),-queryDTO.getTimeZone())))
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileSuccessTotal)).getSum();
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileSuccessTotal)).getSum();
 
 
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
@@ -190,8 +193,9 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                     for (int i = 1; i <= 24; i++) {
                     for (int i = 1; i <= 24; i++) {
                         // 减去 i 小时时间
                         // 减去 i 小时时间
                         LocalDateTime minus = endDateTime.atStartOfDay().minus(i, ChronoUnit.HOURS);
                         LocalDateTime minus = endDateTime.atStartOfDay().minus(i, ChronoUnit.HOURS);
-                        successTotal = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus)
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plus(1L, ChronoUnit.HOURS)))
+                        successTotal = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plus(1L, ChronoUnit.HOURS),-queryDTO.getTimeZone())))
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileSuccessTotal)).getSum();
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileSuccessTotal)).getSum();
 
 
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
@@ -202,8 +206,9 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                     for (int i = 0; i < days; i++) {
                     for (int i = 0; i < days; i++) {
                         // 减去 i 天时间
                         // 减去 i 天时间
                         LocalDate minus = endDateTime.minus(i, ChronoUnit.DAYS);
                         LocalDate minus = endDateTime.minus(i, ChronoUnit.DAYS);
-                        successTotal = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus.atStartOfDay())
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusDays(1).atStartOfDay()))
+                        successTotal = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plusDays(1),-queryDTO.getTimeZone())))
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileSuccessTotal)).getSum();
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileSuccessTotal)).getSum();
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                                 .xData(minus.toString())
                                 .xData(minus.toString())
@@ -219,7 +224,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
     }
     }
 
 
     @Override
     @Override
-    @Cacheable(value = RedisConstantServer.DASHBOARD_FAIL_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
+//    @Cacheable(value = RedisConstantServer.DASHBOARD_FAIL_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
     public List<DashboardDetailedDataDTO> getErrorRequestDetailedData(DashboardQueryDTO queryDTO) {
     public List<DashboardDetailedDataDTO> getErrorRequestDetailedData(DashboardQueryDTO queryDTO) {
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = getDashboardQueryWrapper(queryDTO);
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = getDashboardQueryWrapper(queryDTO);
         // 添加select 查询参数
         // 添加select 查询参数
@@ -227,7 +232,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
         // 查询数据
         // 查询数据
         List<BackgroundConvertData> backgroundConvertData = this.baseMapper.selectList(queryWrapper);
         List<BackgroundConvertData> backgroundConvertData = this.baseMapper.selectList(queryWrapper);
         // 判断查询类型
         // 判断查询类型
-        LocalDateTime nowTime = getLocalDataTime();
+        LocalDateTime nowTime = MyLocalDateUtil.getLocalDataTime();
         // 返回数据集合
         // 返回数据集合
         List<DashboardDetailedDataDTO> dataDTOS = new ArrayList<>();
         List<DashboardDetailedDataDTO> dataDTOS = new ArrayList<>();
 
 
@@ -239,28 +244,28 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                         // 减去 i 小时时间
                         // 减去 i 小时时间
                         LocalDateTime minus = nowTime.minus(i, ChronoUnit.HOURS);
                         LocalDateTime minus = nowTime.minus(i, ChronoUnit.HOURS);
 
 
-                        fileFailedTotal = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus)
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusHours(1)))
+                        fileFailedTotal = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), minus)
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), minus.plusHours(1)))
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileFailedTotal)).getSum();
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileFailedTotal)).getSum();
 
 
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
-                                .xData(minus.toString())
+                                .xData(MyLocalDateUtil.timeZoneConversion(minus, queryDTO.getTimeZone()).toString())
                                 .yData(fileFailedTotal + "").build());
                                 .yData(fileFailedTotal + "").build());
-//                        fileFailedTotal = 0;
                     }
                     }
                 } else {
                 } else {
                     for (int i = 0; i < queryDTO.getDays(); i++) {
                     for (int i = 0; i < queryDTO.getDays(); i++) {
                         // 减去 i 天时间
                         // 减去 i 天时间
                         LocalDate minus = nowTime.minus(i, ChronoUnit.DAYS).toLocalDate();
                         LocalDate minus = nowTime.minus(i, ChronoUnit.DAYS).toLocalDate();
 
 
-                        fileFailedTotal = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus.atStartOfDay())
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusDays(1).atStartOfDay()))
+                        fileFailedTotal = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plusDays(1),-queryDTO.getTimeZone())))
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileFailedTotal)).getSum();
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileFailedTotal)).getSum();
 
 
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                                 .xData(minus.toString())
                                 .xData(minus.toString())
                                 .yData(fileFailedTotal + "").build());
                                 .yData(fileFailedTotal + "").build());
-//                        fileFailedTotal = 0;
                     }
                     }
                 }
                 }
                 break;
                 break;
@@ -272,28 +277,26 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                     endDateTime = endDateTime.plusDays(1L);
                     endDateTime = endDateTime.plusDays(1L);
                     for (int i = 1; i <= 24; i++) {
                     for (int i = 1; i <= 24; i++) {
                         // 减去 i 小时时间
                         // 减去 i 小时时间
-
                         LocalDateTime minus = endDateTime.atStartOfDay().minus(i, ChronoUnit.HOURS);
                         LocalDateTime minus = endDateTime.atStartOfDay().minus(i, ChronoUnit.HOURS);
-                        fileFailedTotal = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus)
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plus(1L, ChronoUnit.HOURS)))
+                        fileFailedTotal = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plus(1L, ChronoUnit.HOURS),-queryDTO.getTimeZone())))
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileFailedTotal)).getSum();
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileFailedTotal)).getSum();
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                                 .xData(minus.toString())
                                 .xData(minus.toString())
                                 .yData(fileFailedTotal + "").build());
                                 .yData(fileFailedTotal + "").build());
-//                        fileFailedTotal = 0;
                     }
                     }
                 } else {
                 } else {
                     for (int i = 0; i < days; i++) {
                     for (int i = 0; i < days; i++) {
                         // 减去 i 天时间
                         // 减去 i 天时间
                         LocalDate minus = endDateTime.minus(i, ChronoUnit.DAYS);
                         LocalDate minus = endDateTime.minus(i, ChronoUnit.DAYS);
-
-                        fileFailedTotal = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus.atStartOfDay())
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusDays(1).atStartOfDay()))
+                        fileFailedTotal = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plusDays(1),-queryDTO.getTimeZone())))
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileFailedTotal)).getSum();
                                 .collect(Collectors.summarizingLong(BackgroundConvertData::getFileFailedTotal)).getSum();
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                                 .xData(minus.toString())
                                 .xData(minus.toString())
                                 .yData(fileFailedTotal + "").build());
                                 .yData(fileFailedTotal + "").build());
-//                        fileFailedTotal = 0;
                     }
                     }
                 }
                 }
                 break;
                 break;
@@ -305,7 +308,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
     }
     }
 
 
     @Override
     @Override
-    @Cacheable(value = RedisConstantServer.DASHBOARD_ERROR_RATIO_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
+//    @Cacheable(value = RedisConstantServer.DASHBOARD_ERROR_RATIO_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
     public List<DashboardDetailedDataDTO> getErrorRatioDetailedData(DashboardQueryDTO queryDTO) {
     public List<DashboardDetailedDataDTO> getErrorRatioDetailedData(DashboardQueryDTO queryDTO) {
         List<DashboardDetailedDataDTO> successfulRequestDetailedData = this.getSuccessfulRequestDetailedData(queryDTO);
         List<DashboardDetailedDataDTO> successfulRequestDetailedData = this.getSuccessfulRequestDetailedData(queryDTO);
         List<DashboardDetailedDataDTO> errorRequestDetailedData = this.getErrorRequestDetailedData(queryDTO);
         List<DashboardDetailedDataDTO> errorRequestDetailedData = this.getErrorRequestDetailedData(queryDTO);
@@ -325,7 +328,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
     }
     }
 
 
     @Override
     @Override
-    @Cacheable(value = RedisConstantServer.DASHBOARD_AVERAGE_PROCESS_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
+//    @Cacheable(value = RedisConstantServer.DASHBOARD_AVERAGE_PROCESS_DATA, cacheManager = "myCacheManager", key = "T(String).valueOf(#queryDTO.toString())", unless = "#result == null")
     public List<DashboardDetailedDataDTO> getAverageProcessTimeDetailedData(DashboardQueryDTO queryDTO) {
     public List<DashboardDetailedDataDTO> getAverageProcessTimeDetailedData(DashboardQueryDTO queryDTO) {
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = getDashboardQueryWrapper(queryDTO);
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = getDashboardQueryWrapper(queryDTO);
         // 添加select 查询参数
         // 添加select 查询参数
@@ -333,7 +336,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
         // 查询数据
         // 查询数据
         List<BackgroundConvertData> backgroundConvertData = this.baseMapper.selectList(queryWrapper);
         List<BackgroundConvertData> backgroundConvertData = this.baseMapper.selectList(queryWrapper);
         // 判断查询类型
         // 判断查询类型
-        LocalDateTime nowTime = getLocalDataTime();
+        LocalDateTime nowTime = MyLocalDateUtil.getLocalDataTime();;
         // 返回数据集合
         // 返回数据集合
         List<DashboardDetailedDataDTO> dataDTOS = new ArrayList<>();
         List<DashboardDetailedDataDTO> dataDTOS = new ArrayList<>();
 
 
@@ -344,34 +347,39 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                     for (int i = 0; i < 24; i++) {
                     for (int i = 0; i < 24; i++) {
                         // 减去 i 小时时间
                         // 减去 i 小时时间
                         LocalDateTime minus = nowTime.minus(i, ChronoUnit.HOURS);
                         LocalDateTime minus = nowTime.minus(i, ChronoUnit.HOURS);
-                        long count = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus)
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusHours(1)) && convertData.getFileConvertTime() != null &&
+                        long count = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), minus)
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), minus.plusHours(1)) && convertData.getFileConvertTime() != null &&
                                 convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0).count();
                                 convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0).count();
                         if (count <= 0) {
                         if (count <= 0) {
                             convertTime = BigDecimal.ZERO;
                             convertTime = BigDecimal.ZERO;
                         } else {
                         } else {
-                            convertTime = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus)
-                                    && !localDataCompareTo(convertData.getSyncTime(), minus.plusHours(1)) && convertData.getFileConvertTime() != null &&
+                            convertTime = backgroundConvertData.stream().filter(convertData -> MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), minus)
+                                    && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), minus.plusHours(1)) && convertData.getFileConvertTime() != null &&
                                     convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0)
                                     convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0)
                                     .map(BackgroundConvertData::getFileConvertTime).reduce(BigDecimal.ZERO, BigDecimal::add)
                                     .map(BackgroundConvertData::getFileConvertTime).reduce(BigDecimal.ZERO, BigDecimal::add)
                                     .divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
                                     .divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
                         }
                         }
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
                         dataDTOS.add(DashboardDetailedDataDTO.builder()
-                                .xData(minus.toString())
+                                .xData(MyLocalDateUtil.timeZoneConversion(minus, queryDTO.getTimeZone()).toString())
                                 .yData(convertTime.stripTrailingZeros().toPlainString()).build());
                                 .yData(convertTime.stripTrailingZeros().toPlainString()).build());
                     }
                     }
                 } else {
                 } else {
                     for (int i = 0; i < queryDTO.getDays(); i++) {
                     for (int i = 0; i < queryDTO.getDays(); i++) {
                         // 减去 i 天时间
                         // 减去 i 天时间
                         LocalDate minus = nowTime.minus(i, ChronoUnit.DAYS).toLocalDate();
                         LocalDate minus = nowTime.minus(i, ChronoUnit.DAYS).toLocalDate();
-                        long count = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus.atStartOfDay())
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusDays(1).atStartOfDay()) && convertData.getFileConvertTime() != null &&
+                        long count = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(),MyLocalDateUtil.timeZoneConversion(minus.plusDays(1),-queryDTO.getTimeZone()))
+                                        && convertData.getFileConvertTime() != null &&
                                 convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0).count();
                                 convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0).count();
                         if (count <= 0) {
                         if (count <= 0) {
                             convertTime = BigDecimal.ZERO;
                             convertTime = BigDecimal.ZERO;
                         } else {
                         } else {
-                            convertTime = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus.atStartOfDay())
-                                    && !localDataCompareTo(convertData.getSyncTime(), minus.plusDays(1).atStartOfDay()) && convertData.getFileConvertTime() != null &&
+                            convertTime = backgroundConvertData.stream().filter(convertData ->
+                                    MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                            && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(),MyLocalDateUtil.timeZoneConversion(minus.plusDays(1),-queryDTO.getTimeZone()))
+                                            && convertData.getFileConvertTime() != null &&
                                     convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0)
                                     convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0)
                                     .map(BackgroundConvertData::getFileConvertTime).reduce(BigDecimal.ZERO, BigDecimal::add)
                                     .map(BackgroundConvertData::getFileConvertTime).reduce(BigDecimal.ZERO, BigDecimal::add)
                                     .divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
                                     .divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
@@ -391,14 +399,18 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                     for (int i = 1; i <= 24; i++) {
                     for (int i = 1; i <= 24; i++) {
                         // 减去 i 小时时间
                         // 减去 i 小时时间
                         LocalDateTime minus = endDateTime.atStartOfDay().minus(i, ChronoUnit.HOURS);
                         LocalDateTime minus = endDateTime.atStartOfDay().minus(i, ChronoUnit.HOURS);
-                        long count = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus)
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plus(1L, ChronoUnit.HOURS)) && convertData.getFileConvertTime() != null &&
+                        long count = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plus(1L, ChronoUnit.HOURS),-queryDTO.getTimeZone()))
+                                        && convertData.getFileConvertTime() != null &&
                                 convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0).count();
                                 convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0).count();
                         if (count <= 0) {
                         if (count <= 0) {
                             convertTime = BigDecimal.ZERO;
                             convertTime = BigDecimal.ZERO;
                         } else {
                         } else {
-                            convertTime = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus)
-                                    && !localDataCompareTo(convertData.getSyncTime(), minus.plus(1L, ChronoUnit.HOURS)) && convertData.getFileConvertTime() != null &&
+                            convertTime = backgroundConvertData.stream().filter(convertData ->
+                                    MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                            && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plus(1L, ChronoUnit.HOURS),-queryDTO.getTimeZone()))
+                                            && convertData.getFileConvertTime() != null &&
                                     convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0)
                                     convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0)
                                     .map(BackgroundConvertData::getFileConvertTime).reduce(BigDecimal.ZERO, BigDecimal::add)
                                     .map(BackgroundConvertData::getFileConvertTime).reduce(BigDecimal.ZERO, BigDecimal::add)
                                     .divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
                                     .divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
@@ -411,14 +423,18 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                     for (int i = 0; i < days; i++) {
                     for (int i = 0; i < days; i++) {
                         // 减去 i 天时间
                         // 减去 i 天时间
                         LocalDate minus = endDateTime.minus(i, ChronoUnit.DAYS);
                         LocalDate minus = endDateTime.minus(i, ChronoUnit.DAYS);
-                        long count = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus.atStartOfDay())
-                                && !localDataCompareTo(convertData.getSyncTime(), minus.plusDays(1).atStartOfDay()) && convertData.getFileConvertTime() != null &&
+                        long count = backgroundConvertData.stream().filter(convertData ->
+                                MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plusDays(1),-queryDTO.getTimeZone()))
+                                        && convertData.getFileConvertTime() != null &&
                                 convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0).count();
                                 convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0).count();
                         if (count <= 0) {
                         if (count <= 0) {
                             convertTime = BigDecimal.ZERO;
                             convertTime = BigDecimal.ZERO;
                         } else {
                         } else {
-                            convertTime = backgroundConvertData.stream().filter(convertData -> localDataCompareTo(convertData.getSyncTime(), minus.atStartOfDay())
-                                    && !localDataCompareTo(convertData.getSyncTime(), minus.plusDays(1).atStartOfDay()) && convertData.getFileConvertTime() != null &&
+                            convertTime = backgroundConvertData.stream().filter(convertData ->
+                                    MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus,-queryDTO.getTimeZone()))
+                                            && !MyLocalDateUtil.localDataCompareTo(convertData.getSyncTime(), MyLocalDateUtil.timeZoneConversion(minus.plusDays(1),-queryDTO.getTimeZone()))
+                                            && convertData.getFileConvertTime() != null &&
                                     convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0)
                                     convertData.getFileConvertTime().compareTo(BigDecimal.ZERO) > 0)
                                     .map(BackgroundConvertData::getFileConvertTime).reduce(BigDecimal.ZERO, BigDecimal::add)
                                     .map(BackgroundConvertData::getFileConvertTime).reduce(BigDecimal.ZERO, BigDecimal::add)
                                     .divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
                                     .divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
@@ -586,6 +602,10 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<BackgroundConvertData> queryWrapper = new LambdaQueryWrapper<>();
         // 查询类型
         // 查询类型
         Integer queryType = queryDTO.getQueryType();
         Integer queryType = queryDTO.getQueryType();
+        // 如果时区未传,默认0时区
+        if (ObjectUtil.isEmpty(queryDTO.getTimeZone())){
+            queryDTO.setTimeZone(0);
+        }
         log.info("本次查询AnalysisData参数:{}", queryDTO);
         log.info("本次查询AnalysisData参数:{}", queryDTO);
         /* 如果时间范围查询为系统定义 */
         /* 如果时间范围查询为系统定义 */
         if (queryType == 0) {
         if (queryType == 0) {
@@ -599,7 +619,8 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
             }
             }
             LocalDateTime nowDateTime = LocalDateTime.now();
             LocalDateTime nowDateTime = LocalDateTime.now();
             LocalDateTime minus = nowDateTime.minus(days, ChronoUnit.DAYS);
             LocalDateTime minus = nowDateTime.minus(days, ChronoUnit.DAYS);
-            queryWrapper.ge(BackgroundConvertData::getSyncTime, minus);
+            queryWrapper.ge(BackgroundConvertData::getSyncTime, minus)
+                    .le(BackgroundConvertData::getSyncTime,nowDateTime);
         } else if (queryType == 1) {
         } else if (queryType == 1) {
             LocalDate startDateTime = queryDTO.getStartDateTime();
             LocalDate startDateTime = queryDTO.getStartDateTime();
             LocalDate endDateTime = queryDTO.getEndDateTime();
             LocalDate endDateTime = queryDTO.getEndDateTime();
@@ -607,7 +628,7 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
             if (startDateTime.isAfter(endDateTime)) {
             if (startDateTime.isAfter(endDateTime)) {
                 // 查询参数异常 开始时间大于结束时间
                 // 查询参数异常 开始时间大于结束时间
                 throw new CommonException(BackgroundErrorEnum.QUEUE_PARAMETER_ERROR);
                 throw new CommonException(BackgroundErrorEnum.QUEUE_PARAMETER_ERROR);
-            } else if (endDateTime.isAfter(LocalDate.now())) {
+            } else if (endDateTime.isAfter(MyLocalDateUtil.timeZoneConversion(LocalDateTime.now(), queryDTO.getTimeZone()).toLocalDate())) {
                 throw new CommonException(BackgroundErrorEnum.QUEUE_PARAMETER_ERROR);
                 throw new CommonException(BackgroundErrorEnum.QUEUE_PARAMETER_ERROR);
             } else if (startDateTime.equals(endDateTime)) {
             } else if (startDateTime.equals(endDateTime)) {
                 // 开始时间等于结束时间
                 // 开始时间等于结束时间
@@ -617,8 +638,8 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
                 startDateTime = endDateTime.minus(30, ChronoUnit.DAYS);
                 startDateTime = endDateTime.minus(30, ChronoUnit.DAYS);
                 queryDTO.setStartDateTime(endDateTime.minus(30, ChronoUnit.DAYS));
                 queryDTO.setStartDateTime(endDateTime.minus(30, ChronoUnit.DAYS));
             }
             }
-            queryWrapper.ge(BackgroundConvertData::getSyncTime, startDateTime)
-                    .le(BackgroundConvertData::getSyncTime, endDateTime);
+            queryWrapper.ge(BackgroundConvertData::getSyncTime, MyLocalDateUtil.timeZoneConversion(startDateTime, -queryDTO.getTimeZone()))
+                    .le(BackgroundConvertData::getSyncTime, MyLocalDateUtil.timeZoneConversion(endDateTime, -queryDTO.getTimeZone()));
         } else {
         } else {
             throw new CommonException(BackgroundErrorEnum.ERROR_INNER);
             throw new CommonException(BackgroundErrorEnum.ERROR_INNER);
         }
         }
@@ -634,24 +655,6 @@ public class BackgroundConvertDataServiceImpl extends ServiceImpl<BackgroundConv
         return queryWrapper;
         return queryWrapper;
     }
     }
 
 
-    /**
-     * 获取整数小时时间
-     */
-    private static LocalDateTime getLocalDataTime() {
-        LocalDateTime nowTime = LocalDateTime.now();
-        LocalDate nowData = LocalDate.now();
-        return LocalDateTime.of(nowData, LocalTime.of(nowTime.getHour(), 0));
-    }
-
-    private static boolean localDataCompareTo(LocalDateTime dateTime1, LocalDateTime dateTime2) {
-        return dateTime1.compareTo(dateTime2) >= 0;
-    }
 
 
 
 
-    public static void main(String[] args) {
-        Integer a = Integer.valueOf("+8");
-        System.out.println(a);
-        Integer b = Integer.valueOf("-8");
-        System.out.println(b);
-    }
 }
 }

+ 14 - 1
background-user/src/main/java/cn/kdan/compdf/service/impl/BackgroundUserWebhookServiceImpl.java

@@ -7,6 +7,7 @@ import cn.hutool.json.JSONUtil;
 import cn.kdan.compdf.dto.AddNewWebhookDTO;
 import cn.kdan.compdf.dto.AddNewWebhookDTO;
 import cn.kdan.compdf.dto.AddNewWebhookSaaSDTO;
 import cn.kdan.compdf.dto.AddNewWebhookSaaSDTO;
 import cn.kdan.compdf.dto.EditWebhookDTO;
 import cn.kdan.compdf.dto.EditWebhookDTO;
+import cn.kdan.compdf.dto.WebhookLogsDTO;
 import cn.kdan.compdf.entity.BackgroundEvent;
 import cn.kdan.compdf.entity.BackgroundEvent;
 import cn.kdan.compdf.entity.BackgroundUserProject;
 import cn.kdan.compdf.entity.BackgroundUserProject;
 import cn.kdan.compdf.entity.BackgroundUserWebhook;
 import cn.kdan.compdf.entity.BackgroundUserWebhook;
@@ -19,6 +20,7 @@ import cn.kdan.compdf.service.BackgroundUserProjectService;
 import cn.kdan.compdf.service.BackgroundUserWebhookService;
 import cn.kdan.compdf.service.BackgroundUserWebhookService;
 import cn.kdan.compdf.service.BackgroundWebhookEventService;
 import cn.kdan.compdf.service.BackgroundWebhookEventService;
 import cn.kdan.compdf.utils.MD5Util;
 import cn.kdan.compdf.utils.MD5Util;
+import cn.kdan.compdf.utils.MyLocalDateUtil;
 import cn.kdan.compdf.utils.TokenUtil;
 import cn.kdan.compdf.utils.TokenUtil;
 import cn.kdan.compdf.vo.BackgroundEventVO;
 import cn.kdan.compdf.vo.BackgroundEventVO;
 import cn.kdan.compdf.vo.BackgroundUserWebhookInfoVO;
 import cn.kdan.compdf.vo.BackgroundUserWebhookInfoVO;
@@ -33,6 +35,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.time.LocalDateTime;
 import java.util.Collections;
 import java.util.Collections;
 import java.util.List;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -63,7 +66,7 @@ public class BackgroundUserWebhookServiceImpl extends ServiceImpl<BackgroundUser
      * @return 用户Webhooks列表
      * @return 用户Webhooks列表
      */
      */
     @Override
     @Override
-    public List<BackgroundUserWebhookVO> getWebhookList(Long userId) {
+    public List<BackgroundUserWebhookVO> getWebhookList(Long userId,Integer timeZone) {
         // 查找用户下面状态正常的Webhook记录
         // 查找用户下面状态正常的Webhook记录
         LambdaQueryWrapper<BackgroundUserWebhook> backgroundUserWebhookeq = new LambdaQueryWrapper<BackgroundUserWebhook>()
         LambdaQueryWrapper<BackgroundUserWebhook> backgroundUserWebhookeq = new LambdaQueryWrapper<BackgroundUserWebhook>()
                 .between(BackgroundUserWebhook::getStatus, 1, 2)
                 .between(BackgroundUserWebhook::getStatus, 1, 2)
@@ -75,6 +78,7 @@ public class BackgroundUserWebhookServiceImpl extends ServiceImpl<BackgroundUser
             // 获取系统所有事件
             // 获取系统所有事件
             List<BackgroundEvent> backgroundEventList = backgroundEventService.getEventList();
             List<BackgroundEvent> backgroundEventList = backgroundEventService.getEventList();
             backgroundUserWebhookList.forEach(c -> {
             backgroundUserWebhookList.forEach(c -> {
+                c.setResponseTime(MyLocalDateUtil.timeZoneConversion(c.getResponseTime(),timeZone));
                 BackgroundUserWebhookVO backgroundUserWebhookVO = new BackgroundUserWebhookVO();
                 BackgroundUserWebhookVO backgroundUserWebhookVO = new BackgroundUserWebhookVO();
                 BeanUtil.copyProperties(c, backgroundUserWebhookVO);
                 BeanUtil.copyProperties(c, backgroundUserWebhookVO);
                 // 获取webhook关联事件
                 // 获取webhook关联事件
@@ -217,4 +221,13 @@ public class BackgroundUserWebhookServiceImpl extends ServiceImpl<BackgroundUser
         rabbitTemplate.convertAndSend(RabbitMQEnum.BACKGROUND_EXCHANGE, RabbitMQEnum.BACKGROUND_WEBHOOKS_DEL_ROUTING_KEY, id);
         rabbitTemplate.convertAndSend(RabbitMQEnum.BACKGROUND_EXCHANGE, RabbitMQEnum.BACKGROUND_WEBHOOKS_DEL_ROUTING_KEY, id);
     }
     }
 
 
+    @Override
+    public void updateWebhookLastSendTime(List<WebhookLogsDTO> webhookLogsDTOList) {
+        for (WebhookLogsDTO webhookLogsDTO : webhookLogsDTOList) {
+            this.baseMapper.updateWebhookLastSendTime(webhookLogsDTO);
+        }
+    }
+
+
+
 }
 }

+ 61 - 0
background-user/src/main/java/cn/kdan/compdf/utils/MyLocalDateUtil.java

@@ -0,0 +1,61 @@
+package cn.kdan.compdf.utils;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.temporal.ChronoUnit;
+
+/**
+ * @author ComPDFKit-WPH 2022/12/7
+ *
+ * localDate 工具类
+ */
+public class MyLocalDateUtil {
+
+    private MyLocalDateUtil(){};
+
+    /**
+     * 时区转换 utc0到其他
+     * @param localDateTime  时间
+     * @param timeZone 时区
+     * @return 新时间
+     */
+    public static LocalDateTime timeZoneConversion(LocalDateTime localDateTime,Integer timeZone){
+        return localDateTime.plus(timeZone, ChronoUnit.HOURS);
+    }
+
+    /**
+     * 时区转换 utc0到其他
+     * @param localDateTime  时间
+     * @param timeZone 时区
+     * @return 新时间
+     */
+    public static LocalDateTime timeZoneConversion(LocalDate localDateTime, Integer timeZone){
+        return localDateTime.atStartOfDay().plus(timeZone, ChronoUnit.HOURS);
+    }
+
+
+    /**
+     * 获取整数小时时间
+     */
+    public static LocalDateTime getLocalDataTime() {
+        LocalDateTime nowTime = LocalDateTime.now();
+        LocalDate nowData = LocalDate.now();
+        return LocalDateTime.of(nowData, LocalTime.of(nowTime.getHour(), 0));
+    }
+
+    public static boolean localDataCompareTo(LocalDateTime dateTime1, LocalDateTime dateTime2) {
+        return dateTime1.compareTo(dateTime2) >= 0;
+    }
+
+    public static void main(String[] args) {
+
+
+        System.out.println(LocalDateTime.now().toLocalDate());
+        System.out.println(LocalDate.now());
+        System.out.println(MyLocalDateUtil.timeZoneConversion(LocalDate.now(), Integer.valueOf("+08")));
+    }
+
+
+
+}

+ 4 - 4
background-user/src/main/resources/application.yml

@@ -8,10 +8,10 @@ spring:
     date-format: yyyy-MM-dd HH:mm:ss
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8
     time-zone: GMT+8
   rabbitmq:
   rabbitmq:
-    host: 106.55.99.175
-    port: 5672
-    username: background-admin
-    password: background-admin
+    host: ${MQ_HOST:101.132.103.13}
+    port: ${MQ_PORT:35672}
+    username: ${MQ_USERNAME:admin}
+    password: ${MQ_PASSWORD:1qazZAQ!2}
     virtualHost: /
     virtualHost: /
     # 发送端确认
     # 发送端确认
     publisher-confirm-type: correlated
     publisher-confirm-type: correlated

+ 7 - 0
background-user/src/main/resources/mapper/BackgroundUserWebhookMapper.xml

@@ -19,4 +19,11 @@
         <result property="updateBy" column="update_by" />
         <result property="updateBy" column="update_by" />
     </resultMap>
     </resultMap>
 
 
+
+    <update id="updateWebhookLastSendTime" parameterType="cn.kdan.compdf.dto.WebhookLogsDTO">
+        UPDATE background_user_webhook
+        SET response_time = #{sendTime}
+        WHERE id = #{webhookId}
+    </update>
+
 </mapper>
 </mapper>