From 699b5fadc595f0b92a435c95a6f583aa2cfcf7f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com>
Date: Wed, 19 Jun 2024 16:43:21 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BA=A4=E9=80=9A=E6=B5=81=E9=A2=84=E8=AD=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zc-business/pom.xml | 6 +
.../controller/DcHolidaysController.java | 113 ++++++++++++++++
.../controller/DcTrafficFlowWarning.java | 111 ++++++++++++++++
.../controller/DcTrafficFlowWarningDate.java | 98 ++++++++++++++
.../zc/business/controller/FTPDeletion.java | 112 ++++++++++++++++
.../com/zc/business/domain/DcHolidays.java | 82 ++++++++++++
.../zc/business/mapper/DcHolidaysMapper.java | 81 ++++++++++++
.../business/service/IDcHolidaysService.java | 81 ++++++++++++
.../service/impl/DcHolidaysServiceImpl.java | 123 ++++++++++++++++++
.../mapper/business/DcHolidaysMapper.xml | 90 +++++++++++++
10 files changed, 897 insertions(+)
create mode 100644 zc-business/src/main/java/com/zc/business/controller/DcHolidaysController.java
create mode 100644 zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarning.java
create mode 100644 zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarningDate.java
create mode 100644 zc-business/src/main/java/com/zc/business/controller/FTPDeletion.java
create mode 100644 zc-business/src/main/java/com/zc/business/domain/DcHolidays.java
create mode 100644 zc-business/src/main/java/com/zc/business/mapper/DcHolidaysMapper.java
create mode 100644 zc-business/src/main/java/com/zc/business/service/IDcHolidaysService.java
create mode 100644 zc-business/src/main/java/com/zc/business/service/impl/DcHolidaysServiceImpl.java
create mode 100644 zc-business/src/main/resources/mapper/business/DcHolidaysMapper.xml
diff --git a/zc-business/pom.xml b/zc-business/pom.xml
index b185377e..d612ab2e 100644
--- a/zc-business/pom.xml
+++ b/zc-business/pom.xml
@@ -21,6 +21,12 @@
org.eclipse.paho.client.mqttv3
1.2.2
+
+
+ commons-net
+ commons-net
+ 3.8.0
+
org.json
json
diff --git a/zc-business/src/main/java/com/zc/business/controller/DcHolidaysController.java b/zc-business/src/main/java/com/zc/business/controller/DcHolidaysController.java
new file mode 100644
index 00000000..7c878c5c
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/controller/DcHolidaysController.java
@@ -0,0 +1,113 @@
+package com.zc.business.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.common.enums.BusinessType;
+import com.zc.business.domain.DcHolidays;
+import com.zc.business.service.IDcHolidaysService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 节假日 基础数据
+Controller
+ *
+ * @author ruoyi
+ * @date 2024-06-18
+ */
+@RestController
+@RequestMapping("/system/holidays")
+public class DcHolidaysController extends BaseController
+{
+ @Autowired
+ private IDcHolidaysService dcHolidaysService;
+
+ /**
+ * 查询节假日 基础数据
+列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:holidays:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(DcHolidays dcHolidays)
+ {
+ startPage();
+ List list = dcHolidaysService.selectDcHolidaysList(dcHolidays);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出节假日 基础数据
+列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:holidays:export')")
+ @Log(title = "节假日 基础数据 ", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, DcHolidays dcHolidays)
+ {
+ List list = dcHolidaysService.selectDcHolidaysList(dcHolidays);
+ ExcelUtil util = new ExcelUtil<>(DcHolidays.class);
+ util.exportExcel(response, list, "节假日 基础数据数据");
+ }
+
+ /**
+ * 获取节假日 基础数据
+详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:holidays:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(dcHolidaysService.selectDcHolidaysById(id));
+ }
+
+ /**
+ * 新增节假日 基础数据
+
+ */
+ @PreAuthorize("@ss.hasPermi('system:holidays:add')")
+ @Log(title = "节假日 基础数据 ", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody DcHolidays dcHolidays)
+ {
+ return toAjax(dcHolidaysService.insertDcHolidays(dcHolidays));
+ }
+
+ /**
+ * 修改节假日 基础数据
+
+ */
+ @PreAuthorize("@ss.hasPermi('system:holidays:edit')")
+ @Log(title = "节假日 基础数据 ", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody DcHolidays dcHolidays)
+ {
+ return toAjax(dcHolidaysService.updateDcHolidays(dcHolidays));
+ }
+
+ /**
+ * 删除节假日 基础数据
+
+ */
+ @PreAuthorize("@ss.hasPermi('system:holidays:remove')")
+ @Log(title = "节假日 基础数据 ", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(dcHolidaysService.deleteDcHolidaysByIds(ids));
+ }
+}
diff --git a/zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarning.java b/zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarning.java
new file mode 100644
index 00000000..ac4f9484
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarning.java
@@ -0,0 +1,111 @@
+package com.zc.business.controller;
+
+import com.google.gson.Gson;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.common.utils.uuid.UUID;
+import com.zc.business.domain.DcHolidays;
+import com.zc.business.domain.DcNoStakeWarningTable;
+import com.zc.business.service.IDcGantryStatisticsDataService;
+import com.zc.business.service.IDcHolidaysService;
+import com.zc.business.service.impl.DcNoStakeWarningTableServiceImpl;
+import com.zc.common.core.websocket.WebSocketService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+/**
+ *
+ */
+
+
+@Component
+public class DcTrafficFlowWarning {
+ @Resource
+ private DcNoStakeWarningTableServiceImpl dcNoStakeWarningTableService;
+ @Autowired
+ private IDcHolidaysService dcHolidaysService;
+ @Autowired
+ private IDcGantryStatisticsDataService dcGantryStatisticsDataService;
+ // @Scheduled(cron = "0/10 * * * * ?")
+ //@Scheduled(cron = "0 0/5 * * * ?")
+ public void DcTrafficFlow() {
+ System.out.println("每隔10秒执行一次:" + new Date());
+
+ // 获取当前日期
+ LocalDate currentDate = LocalDate.now();
+ // 获取当前年份
+ int currentYear = currentDate.getYear();
+ DcHolidays dcHolidays = new DcHolidays();
+ dcHolidays.setDate(currentYear);
+ //查询当前年份假期
+ List dcHolidaysList = dcHolidaysService.selectDcHolidaysList(dcHolidays);
+ // 计算当前日期加上七天的日期
+ LocalDate dateAfterSevenDays = currentDate.plusDays(7);
+ // 格式化日期输出(可选)
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ String formattedDate = dateAfterSevenDays.format(formatter);
+ // String formattedDate ="2024-05-01";
+
+ for (DcHolidays holidays : dcHolidaysList) {
+ String vacation = holidays.getVacation();
+ String[] dates = vacation.split("\\|");
+ //判断当前日期+ 7天 与 日期 数据对比
+ if (formattedDate.equals(dates[0])) {
+ //当前假期名称
+ String name = holidays.getName();
+ dcHolidays.setDate(currentYear-1);
+
+ DcHolidays dcHolidaysLast = dcHolidaysService.selectDcHolidaysListNameByDate(currentYear-1,name);
+ String vacation1 = dcHolidaysLast.getVacation();
+
+
+ String[] date = vacation1.split("\\|");
+ Map>>> mapListOne = new HashMap<>();
+
+ Map>> map = new HashMap<>();
+ Map>> map2 = new HashMap<>();
+ for (int i1 = 0; i1 < date.length; i1++) {
+ List