Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 8 months ago
parent
commit
da9b991379
  1. 59
      zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java
  2. 384
      zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java
  3. 4
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java
  4. 86
      zc-business/src/main/java/com/zc/business/domain/export/RealTimeTrafficFlow.java
  5. 111
      zc-business/src/main/java/com/zc/business/domain/export/SectionTrafficIndexAnalysis.java
  6. 62
      zc-business/src/main/java/com/zc/business/domain/export/SectionTrafficRanking.java
  7. 62
      zc-business/src/main/java/com/zc/business/domain/export/TrafficPeriodAnalysis.java
  8. 27
      zc-business/src/main/java/com/zc/business/mapper/DcInfoBoardVocabularyMapper.java
  9. 22
      zc-business/src/main/java/com/zc/business/service/IDcInfoBoardVocabularyService.java
  10. 12
      zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java
  11. 34
      zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java
  12. 78
      zc-business/src/main/java/com/zc/business/service/impl/DcInfoBoardVocabularyServiceImpl.java
  13. 2
      zc-business/src/main/java/com/zc/business/statistics/cache/gantry/QuarterlyTrafficGantryStatisticsCache.java
  14. 2
      zc-business/src/main/java/com/zc/business/statistics/cache/metrics/QuarterlyGantryMetricsStatisticsCache.java
  15. 2
      zc-business/src/main/java/com/zc/business/statistics/cache/section/QuarterlyTrafficSectionStatisticsCache.java
  16. 2
      zc-business/src/main/java/com/zc/business/statistics/cache/tollstation/QuarterlyTrafficTollStationStatisticsCache.java
  17. BIN
      zc-business/src/main/resources/excelTemplate/敏感字模板.xlsx
  18. 16
      zc-business/src/main/resources/mapper/business/DcInfoBoardVocabularyMapper.xml

59
zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java

@ -1,33 +1,28 @@
package com.zc.business.controller; package com.zc.business.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.DcInfoBoardVocabulary; import com.zc.business.domain.DcInfoBoardVocabulary;
import com.zc.business.service.IDcInfoBoardVocabularyService; import com.zc.business.service.IDcInfoBoardVocabularyService;
import com.ruoyi.common.utils.poi.ExcelUtil; import io.swagger.annotations.Api;
import com.ruoyi.common.core.page.TableDataInfo; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
/** /**
* 情报板敏感字管理Controller * 情报板敏感字管理Controller
* *
* @author ruoyi * @author ruoyi
* @date 2024-01-05 * @date 2024-01-05
*/ */
@ -66,6 +61,32 @@ public class DcInfoBoardVocabularyController extends BaseController
util.exportExcel(response, list, "情报板敏感字管理数据"); util.exportExcel(response, list, "情报板敏感字管理数据");
} }
@ApiOperation("导出敏感词模板")
@Log(title = "导出敏感词模板", businessType = BusinessType.EXPORT)
@PostMapping("/exportModel")
public void exportModel(HttpServletResponse response)
{
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("excelTemplate/敏感字模板.xlsx");
try {
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
}
}
/**
* 导入值敏感字
*/
@ApiOperation("导入值敏感字")
@PostMapping("/importVocabulary")
public AjaxResult importVocabulary(MultipartFile file) throws Exception{
return dcInfoBoardVocabularyService.importVocabulary(file);
}
/** /**
* 获取情报板敏感字管理详细信息 * 获取情报板敏感字管理详细信息
*/ */

384
zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java

@ -6,22 +6,32 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StakeMarkUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.*; import com.zc.business.domain.*;
import com.zc.business.domain.export.*;
import com.zc.business.enums.StakeMarkRange;
import com.zc.business.request.DcTrafficMetricsDataRequest; import com.zc.business.request.DcTrafficMetricsDataRequest;
import com.zc.business.request.DcTrafficSectionDataRequest; import com.zc.business.request.DcTrafficSectionDataRequest;
import com.zc.business.service.*; import com.zc.business.service.*;
import com.zc.common.core.httpclient.exception.HttpException; import com.zc.common.core.httpclient.exception.HttpException;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.text.SimpleDateFormat;
import java.util.Map; import java.time.LocalDate;
import java.util.Set; import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/** /**
@ -203,6 +213,75 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String
// 将查询结果封装为成功响应并返回 // 将查询结果封装为成功响应并返回
return AjaxResult.success(mapList); return AjaxResult.success(mapList);
} }
/**
* 导出全路段双向实时车流量
* @param startDate 时间
* @param direction 方向
* @param periodType 时间粒子
*/
@ApiOperation(value="导出全路段车流量状况分析",tags = {"ECharts导出"})
@GetMapping("/history/exportRealTimeTrafficFlow")
public AjaxResult exportRealTimeTrafficFlow(HttpServletResponse response,String startDate, String direction,String periodType ){
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(direction) || StringUtils.isEmpty(periodType)){
return AjaxResult.error("参数错误");
}
String endDate = "";
if ("4".equals(periodType)){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate inputDate = LocalDate.parse(startDate, formatter);
// 获取一年前的日期
LocalDate end = inputDate.minusYears(1);
endDate = end.format(formatter);
} else if ("3".equals(periodType)){
String[] parts = startDate.split("-");
int year = Integer.parseInt(parts[0]);
int month = Integer.parseInt(parts[1]);
// 计算一年前的年份和月份
year -= 1;
// 如果计算后月份为0,则调整为上一年的12月
if (month == 0) {
year -= 1;
month = 12;
}
endDate = String.format("%04d-%02d", year, month);
} else if ("1".equals(periodType)){
int year = Integer.parseInt(startDate) - 1;
endDate = String.valueOf(year);
}
List<RealTimeTrafficFlow> list = new ArrayList<>();
List<Map<String,String>> mapList = dcGantryStatisticsDataService.realTimeTrafficFlow(startDate,direction,periodType);
List<Map<String,String>> lastList = dcGantryStatisticsDataService.realTimeTrafficFlow(endDate,direction,periodType);
mapList = mapList.stream().sorted(
Comparator.comparing(map -> {
String stakeMark = map.get("stake_make");
return StakeMarkUtils.formatMetre(stakeMark);
}))
.collect(Collectors.toList());
lastList = lastList.stream().sorted(
Comparator.comparing(map -> {
String stakeMark = map.get("stake_make");
return StakeMarkUtils.formatMetre(stakeMark);
}))
.collect(Collectors.toList());
for (int i = 0; i < mapList.size(); i++) {
RealTimeTrafficFlow realTimeTrafficFlow = new RealTimeTrafficFlow();
realTimeTrafficFlow.setName(mapList.get(i).get("name"));
realTimeTrafficFlow.setTotalPassengerFlow(String.valueOf(mapList.get(i).get("totalPassengerFlow")));
realTimeTrafficFlow.setTypeSpecialVehicleFlow(String.valueOf(mapList.get(i).get("typeSpecialVehicleFlow")));
realTimeTrafficFlow.setTypeTruckFlow(String.valueOf(mapList.get(i).get("typeTruckFlow")));
realTimeTrafficFlow.setLastYearTotal(String.valueOf(lastList.get(i).get("volume")));
list.add(realTimeTrafficFlow);
}
ExcelUtil<RealTimeTrafficFlow> util = new ExcelUtil<>(RealTimeTrafficFlow.class);
util.exportExcel(response, list, "全路段双向实时车流量");
// 将查询结果封装为成功响应并返回
return AjaxResult.success("导出成功");
}
/** /**
* 车流量时段分析 * 车流量时段分析
* @param startDate 时间 * @param startDate 时间
@ -217,6 +296,75 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String
return AjaxResult.success(mapList); return AjaxResult.success(mapList);
} }
/**
* 导出车流量时段分析
* @param startDate 时间
* @param direction 方向
* @param periodType 时间粒子
*/
@ApiOperation(value="导出车流量时段分析",tags = {"ECharts导出"})
@GetMapping("/history/exportTrafficPeriodAnalysis")
public AjaxResult exportTrafficPeriodAnalysis(HttpServletResponse response,String startDate, String direction,String periodType ){
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(direction) || StringUtils.isEmpty(periodType)){
return AjaxResult.error("参数错误");
}
String endDate = "";
if ("4".equals(periodType)){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate inputDate = LocalDate.parse(startDate, formatter);
// 获取一年前的日期
LocalDate end = inputDate.minusYears(1);
endDate = end.format(formatter);
} else if ("3".equals(periodType)){
String[] parts = startDate.split("-");
int year = Integer.parseInt(parts[0]);
int month = Integer.parseInt(parts[1]);
// 计算一年前的年份和月份
year -= 1;
// 如果计算后月份为0,则调整为上一年的12月
if (month == 0) {
year -= 1;
month = 12;
}
endDate = String.format("%04d-%02d", year, month);
} else if ("1".equals(periodType)){
int year = Integer.parseInt(startDate) - 1;
endDate = String.valueOf(year);
}
List<TrafficPeriodAnalysis> list = new ArrayList<>();
List<Map<String,String>> mapList = dcGantryStatisticsDataService.trafficPeriodAnalysis(startDate,direction,periodType);
Map<String,String> mapData = new HashMap<>();
if (mapList != null && mapList.size() > 0){
for (Map<String, String> item : mapList) {
mapData.put(item.get("statisticalHour"),item.get("trafficVolume"));
}
}
List<Map<String,String>> lastList = dcGantryStatisticsDataService.trafficPeriodAnalysis(endDate,direction,periodType);
Map<String,String> lastData = new HashMap<>();
if (lastList != null && lastList.size() > 0){
for (Map<String, String> item : lastList) {
lastData.put(item.get("statisticalHour"),item.get("trafficVolume"));
}
}
for (int i = 0; i < 24; i++) {
TrafficPeriodAnalysis trafficPeriodAnalysis = new TrafficPeriodAnalysis();
trafficPeriodAnalysis.setTime(i + "点至" + (i+1) + "点");
trafficPeriodAnalysis.setCurrentData(mapData.getOrDefault(String.valueOf(i), "0"));
trafficPeriodAnalysis.setContemporaneousData(lastData.getOrDefault(String.valueOf(i), "0"));
list.add(trafficPeriodAnalysis);
}
ExcelUtil<TrafficPeriodAnalysis> util = new ExcelUtil<>(TrafficPeriodAnalysis.class);
util.exportExcel(response, list, "车流量时段分析");
// 将查询结果封装为成功响应并返回
return AjaxResult.success("导出成功");
}
@ApiOperation("断面车流量排名") @ApiOperation("断面车流量排名")
@GetMapping("/history/sectionTrafficRanking") @GetMapping("/history/sectionTrafficRanking")
public AjaxResult sectionTrafficRanking(String startDate, String direction,String periodType ){ public AjaxResult sectionTrafficRanking(String startDate, String direction,String periodType ){
@ -224,6 +372,34 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String
// 将查询结果封装为成功响应并返回 // 将查询结果封装为成功响应并返回
return AjaxResult.success(dcStatisticsData); return AjaxResult.success(dcStatisticsData);
} }
/**
* 导出断面车流量排名
* @param startDate 时间
* @param direction 方向
* @param periodType 时间粒子
*/
@ApiOperation(value="导出断面车流量排名",tags = {"ECharts导出"})
@GetMapping("/history/exportSectionTrafficRanking")
public AjaxResult exportSectionTrafficRanking(HttpServletResponse response,String startDate, String direction,String periodType ){
List<SectionTrafficRanking> list = new ArrayList<>();
List<Map<String, String>> dcStatisticsData = dcGantryStatisticsDataService.sectionTrafficRanking(startDate,direction,periodType);
for (int i = 0; i < dcStatisticsData.size(); i++) {
SectionTrafficRanking sectionTrafficRanking = new SectionTrafficRanking();
sectionTrafficRanking.setRank(i + 1);
sectionTrafficRanking.setFacilityName(dcStatisticsData.get(i).get("facilityName"));
sectionTrafficRanking.setNumber(String.valueOf(dcStatisticsData.get(i).get("trafficVolume")));
list.add(sectionTrafficRanking);
}
ExcelUtil<SectionTrafficRanking> util = new ExcelUtil<>(SectionTrafficRanking.class);
util.exportExcel(response, list, "断面车流量排名");
// 将查询结果封装为成功响应并返回
return AjaxResult.success("导出成功");
}
/** /**
* sectionTrafficIndexAnalysis * sectionTrafficIndexAnalysis
* @param startDate 时间 * @param startDate 时间
@ -239,6 +415,76 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String
// 将查询结果封装为成功响应并返回 // 将查询结果封装为成功响应并返回
return AjaxResult.success(mapList); return AjaxResult.success(mapList);
} }
@ApiOperation(value="导出路段交通指标分析",tags = {"ECharts导出"})
@GetMapping("/history/exportSectionTrafficIndexAnalysis")
public AjaxResult exportSectionTrafficIndexAnalysis(HttpServletResponse response,String startDate, String direction,String periodType,Long ranking){
List<SectionTrafficIndexAnalysis> list = new ArrayList<>();
String endDate = "";
if ("4".equals(periodType)){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate inputDate = LocalDate.parse(startDate, formatter);
// 获取一年前的日期
LocalDate end = inputDate.minusYears(1);
endDate = end.format(formatter);
} else if ("3".equals(periodType)){
String[] parts = startDate.split("-");
int year = Integer.parseInt(parts[0]);
int month = Integer.parseInt(parts[1]);
// 计算一年前的年份和月份
year -= 1;
// 如果计算后月份为0,则调整为上一年的12月
if (month == 0) {
year -= 1;
month = 12;
}
endDate = String.format("%04d-%02d", year, month);
} else if ("1".equals(periodType)){
int year = Integer.parseInt(startDate) - 1;
endDate = String.valueOf(year);
}
List<Map<String, Object>> thisYearList = dcGantryMetricsStatisticsDataService.sectionTrafficIndexAnalysis(startDate,direction,periodType,ranking);
Map<String,List<Map<String, Object>>> thisYearData = thisYearList.stream().collect(Collectors.groupingBy(item -> item.get("groupName").toString()));
List<Map<String, Object>> lastYearList = dcGantryMetricsStatisticsDataService.sectionTrafficIndexAnalysis(endDate,direction,periodType,ranking);
Map<String,List<Map<String, Object>>> lastYearData = lastYearList.stream().collect(Collectors.groupingBy(item -> item.get("groupName").toString()));
for (StakeMarkRange value : StakeMarkRange.values()) {
String sectionName = value.getDescription();
SectionTrafficIndexAnalysis sectionTrafficIndexAnalysis = new SectionTrafficIndexAnalysis();
sectionTrafficIndexAnalysis.setName(value.getDescription());
if (thisYearData.containsKey(sectionName)){
Map<String, Object> sectionData = thisYearData.get(sectionName).get(0);
sectionTrafficIndexAnalysis.setCrowdingRate(sectionData.get("crowdingRate").toString());
sectionTrafficIndexAnalysis.setSaturationRate(sectionData.get("saturationRate").toString());
sectionTrafficIndexAnalysis.setTrafficCompositionRate(sectionData.get("trafficCompositionRate").toString());
} else {
sectionTrafficIndexAnalysis.setCrowdingRate("0");
sectionTrafficIndexAnalysis.setSaturationRate("0");
sectionTrafficIndexAnalysis.setTrafficCompositionRate("0");
}
if (lastYearData.containsKey(sectionName)){
Map<String, Object> sectionData = lastYearData.get(sectionName).get(0);
sectionTrafficIndexAnalysis.setCrowdingRateLastYear(sectionData.get("crowdingRate").toString());
sectionTrafficIndexAnalysis.setSaturationRateLastYear(sectionData.get("saturationRate").toString());
sectionTrafficIndexAnalysis.setTrafficCompositionRateLastYear(sectionData.get("trafficCompositionRate").toString());
} else {
sectionTrafficIndexAnalysis.setCrowdingRateLastYear("0");
sectionTrafficIndexAnalysis.setSaturationRateLastYear("0");
sectionTrafficIndexAnalysis.setTrafficCompositionRateLastYear("0");
}
list.add(sectionTrafficIndexAnalysis);
}
ExcelUtil<SectionTrafficIndexAnalysis> util = new ExcelUtil<>(SectionTrafficIndexAnalysis.class);
util.exportExcel(response, list, "路段交通指标分析");
// 将查询结果封装为成功响应并返回
return AjaxResult.success("导出成功");
}
@ApiOperation("通指标时间分布") @ApiOperation("通指标时间分布")
@GetMapping("/history/passIndicatorTimeDistribution") @GetMapping("/history/passIndicatorTimeDistribution")
public AjaxResult passIndicatorTimeDistribution(String startDate, String direction,String periodType ){ public AjaxResult passIndicatorTimeDistribution(String startDate, String direction,String periodType ){
@ -414,4 +660,136 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD
return AjaxResult.success(mapList); return AjaxResult.success(mapList);
} }
/**
* 导出全路段双向实时车流量
*/
@ApiOperation(value = "导出全路段双向实时车流量",tags = {"ECharts导出"})
@GetMapping("/history/exportRealTimeTrafficFlowHour")
public AjaxResult exportRealTimeTrafficFlowHour(HttpServletResponse response) throws IOException, HttpException {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate currentDate = LocalDate.now();
String now = currentDate.format(formatter);
// 获取一年前的日期
LocalDate oneYearAgo = currentDate.minusYears(1);
String lastYear = oneYearAgo.format(formatter);
List<Map<String,Object>> thisYearHZ = dcTrafficStatisticsService.realTimeTrafficFlowHour(now,1L);
List<Map<String,Object>> thisYearJN = dcTrafficStatisticsService.realTimeTrafficFlowHour(now,3L);
List<Map<String,Object>> lastYearHZ = dcTrafficStatisticsService.realTimeTrafficFlowHour(lastYear,1L);
List<Map<String,Object>> lastYearJN = dcTrafficStatisticsService.realTimeTrafficFlowHour(lastYear,3L);
Workbook workbook = new XSSFWorkbook(); // 创建工作簿
Sheet sheet = workbook.createSheet("全路段双向实时车流量"); // 创建工作表
// 创建数据行样式
CellStyle dataStyle = workbook.createCellStyle();
dataStyle.setAlignment(HorizontalAlignment.CENTER);
dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
dataStyle.setBorderRight(BorderStyle.THIN);
dataStyle.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
dataStyle.setBorderLeft(BorderStyle.THIN);
dataStyle.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
dataStyle.setBorderTop(BorderStyle.THIN);
dataStyle.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
dataStyle.setBorderBottom(BorderStyle.THIN);
dataStyle.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
Font dataFont = workbook.createFont();
dataFont.setFontName("Arial");
dataFont.setFontHeightInPoints((short) 10);
dataStyle.setFont(dataFont);
// 创建表头样式
CellStyle headerStyle = workbook.createCellStyle();
headerStyle.cloneStyleFrom(dataStyle);
headerStyle.setAlignment(HorizontalAlignment.CENTER);
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
headerStyle.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
Font headerFont = workbook.createFont();
headerFont.setFontName("Arial");
headerFont.setFontHeightInPoints((short) 10);
headerFont.setBold(true);
headerFont.setColor(IndexedColors.WHITE.getIndex());
headerStyle.setFont(headerFont);
// 添加第一层级表头
Row row = sheet.createRow(0);
Cell cell = row.createCell(0);
cell.setCellValue("路段名称");
cell.setCellStyle(headerStyle);
cell = row.createCell(1);
cell.setCellValue("济南方向");
cell.setCellStyle(headerStyle);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(headerStyle);;
cell = row.createCell(3);
cell.setCellValue("菏泽方向");
cell.setCellStyle(headerStyle);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(headerStyle);
// 添加第二层级表头(与第一层级对齐)
Row subHeaderRow1 = sheet.createRow(1);
cell = subHeaderRow1.createCell(0);
cell.setCellValue("");
cell.setCellStyle(headerStyle);
cell = subHeaderRow1.createCell(1);
cell.setCellValue("本期车流量");
cell.setCellStyle(headerStyle);
cell = subHeaderRow1.createCell(2);
cell.setCellValue("去年同期");
cell.setCellStyle(headerStyle);
cell = subHeaderRow1.createCell(3);
cell.setCellValue("本期车流量");
cell.setCellStyle(headerStyle);
cell = subHeaderRow1.createCell(4);
cell.setCellValue("去年同期");
cell.setCellStyle(headerStyle);
//合并单元格,参数依次为起始行,结束行,起始列,结束列 (从0开始)
//路段名称
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
//济南方向
sheet.addMergedRegion(new CellRangeAddress(0, 0, 1, 2));
//菏泽方向
sheet.addMergedRegion(new CellRangeAddress(0, 0, 3, 4));
for (int i = 0; i < thisYearHZ.size(); i++) {
Row subHeaderRow = sheet.createRow(i+2);
cell = subHeaderRow.createCell(0);
cell.setCellValue(thisYearJN.get(i).get("name").toString());
cell.setCellStyle(dataStyle);
cell = subHeaderRow.createCell(1);
cell.setCellValue(thisYearJN.get(i).get("totalFlow").toString());
cell.setCellStyle(dataStyle);
cell = subHeaderRow.createCell(2);
cell.setCellValue(lastYearJN.get(i).get("totalFlow").toString());
cell.setCellStyle(dataStyle);
cell = subHeaderRow.createCell(3);
cell.setCellValue(thisYearHZ.get(i).get("totalFlow").toString());
cell.setCellStyle(dataStyle);
cell = subHeaderRow.createCell(4);
cell.setCellValue(lastYearHZ.get(i).get("totalFlow").toString());
cell.setCellStyle(dataStyle);
}
// 写入文件
try {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
workbook.write(response.getOutputStream());
} finally {
workbook.close();
}
return AjaxResult.success("导出感知事件多发时段成功");
}
} }

4
zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

@ -255,10 +255,10 @@ public class WeatherForecastController extends BaseController {
if (jsonResult.getInteger("code") == UniversalEnum.TWO_HUNDRED.getNumber()) { if (jsonResult.getInteger("code") == UniversalEnum.TWO_HUNDRED.getNumber()) {
JSONArray data = jsonResult.getJSONArray("data"); JSONArray data = jsonResult.getJSONArray("data");
if (data.size() != UniversalEnum.ZERO.getNumber()) { if (data.size() != UniversalEnum.ZERO.getNumber()) {
redisCache.setCacheList("currentWeatherAndForecastInformation", data); redisCache.setCacheObject("currentWeatherAndForecastInformation", data);
return AjaxResult.success(data); return AjaxResult.success(data);
} else { } else {
return AjaxResult.success(redisCache.getCacheList("currentWeatherAndForecastInformation")); return AjaxResult.success(redisCache.getCacheObject("currentWeatherAndForecastInformation"));
} }
} else { } else {
return AjaxResult.error(jsonResult.getInteger("code"), UniversalEnum.REQUEST_FAILED.getValue()); return AjaxResult.error(jsonResult.getInteger("code"), UniversalEnum.REQUEST_FAILED.getValue());

86
zc-business/src/main/java/com/zc/business/domain/export/RealTimeTrafficFlow.java

@ -0,0 +1,86 @@
package com.zc.business.domain.export;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 导出全路段双向实时车流量对象
*
* @author ruoyi
* @date 2024-01-13
*/
public class RealTimeTrafficFlow extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 路段 */
@Excel(name = "路段")
private String name;
/** 客车 */
@Excel(name = "客车")
private String totalPassengerFlow;
/** 货车 */
@Excel(name = "货车")
private String typeTruckFlow;
/** 专项车 */
@Excel(name = "专项车")
private String typeSpecialVehicleFlow;
/** 去年同期 */
@Excel(name = "去年同期")
private String lastYearTotal;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTotalPassengerFlow() {
return totalPassengerFlow;
}
public void setTotalPassengerFlow(String totalPassengerFlow) {
this.totalPassengerFlow = totalPassengerFlow;
}
public String getTypeTruckFlow() {
return typeTruckFlow;
}
public void setTypeTruckFlow(String typeTruckFlow) {
this.typeTruckFlow = typeTruckFlow;
}
public String getTypeSpecialVehicleFlow() {
return typeSpecialVehicleFlow;
}
public void setTypeSpecialVehicleFlow(String typeSpecialVehicleFlow) {
this.typeSpecialVehicleFlow = typeSpecialVehicleFlow;
}
public String getLastYearTotal() {
return lastYearTotal;
}
public void setLastYearTotal(String lastYearTotal) {
this.lastYearTotal = lastYearTotal;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName())
.append("totalPassengerFlow", getTotalPassengerFlow())
.append("typeTruckFlow", getTypeTruckFlow())
.append("typeSpecialVehicleFlow", getTypeSpecialVehicleFlow())
.append("lastYearTotal", getLastYearTotal())
.toString();
}
}

111
zc-business/src/main/java/com/zc/business/domain/export/SectionTrafficIndexAnalysis.java

@ -0,0 +1,111 @@
package com.zc.business.domain.export;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 导出路段交通指标分析对象
*
* @author ruoyi
* @date 2024-01-13
*/
public class SectionTrafficIndexAnalysis extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 路段 */
@Excel(name = "路段")
private String name;
/** 饱和度 */
@Excel(name = "饱和度")
private String saturationRate;
/** 拥挤度 */
@Excel(name = "拥挤度")
private String crowdingRate;
/** 交通组成特征指数 */
@Excel(name = "交通组成特征指数")
private String trafficCompositionRate;
/** 饱和度去年同期 */
@Excel(name = "饱和度去年同期")
private String saturationRateLastYear;
/** 拥挤度去年同期 */
@Excel(name = "拥挤度去年同期")
private String crowdingRateLastYear;
/** 交通组成特征指数去年同期 */
@Excel(name = "交通组成特征指数去年同期")
private String trafficCompositionRateLastYear;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSaturationRate() {
return saturationRate;
}
public void setSaturationRate(String saturationRate) {
this.saturationRate = saturationRate;
}
public String getCrowdingRate() {
return crowdingRate;
}
public void setCrowdingRate(String crowdingRate) {
this.crowdingRate = crowdingRate;
}
public String getTrafficCompositionRate() {
return trafficCompositionRate;
}
public void setTrafficCompositionRate(String trafficCompositionRate) {
this.trafficCompositionRate = trafficCompositionRate;
}
public String getSaturationRateLastYear() {
return saturationRateLastYear;
}
public void setSaturationRateLastYear(String saturationRateLastYear) {
this.saturationRateLastYear = saturationRateLastYear;
}
public String getCrowdingRateLastYear() {
return crowdingRateLastYear;
}
public void setCrowdingRateLastYear(String crowdingRateLastYear) {
this.crowdingRateLastYear = crowdingRateLastYear;
}
public String getTrafficCompositionRateLastYear() {
return trafficCompositionRateLastYear;
}
public void setTrafficCompositionRateLastYear(String trafficCompositionRateLastYear) {
this.trafficCompositionRateLastYear = trafficCompositionRateLastYear;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName())
.append("saturationRate", getSaturationRate())
.append("crowdingRate", getCrowdingRate())
.append("trafficCompositionRate", getTrafficCompositionRate())
.append("saturationRateLastYear", getSaturationRateLastYear())
.append("crowdingRateLastYear", getCrowdingRateLastYear())
.append("trafficCompositionRateLastYear", getTrafficCompositionRateLastYear())
.toString();
}
}

62
zc-business/src/main/java/com/zc/business/domain/export/SectionTrafficRanking.java

@ -0,0 +1,62 @@
package com.zc.business.domain.export;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 导出断面车流量排名对象
*
* @author ruoyi
* @date 2024-01-13
*/
public class SectionTrafficRanking extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 排名 */
@Excel(name = "排名")
private Integer rank;
/** 路段名称 */
@Excel(name = "路段名称")
private String facilityName;
/** 车流量 */
@Excel(name = "车流量")
private String number;
public Integer getRank() {
return rank;
}
public void setRank(Integer rank) {
this.rank = rank;
}
public String getFacilityName() {
return facilityName;
}
public void setFacilityName(String facilityName) {
this.facilityName = facilityName;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("rank", getRank())
.append("facilityName", getFacilityName())
.append("number", getNumber())
.toString();
}
}

62
zc-business/src/main/java/com/zc/business/domain/export/TrafficPeriodAnalysis.java

@ -0,0 +1,62 @@
package com.zc.business.domain.export;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 导出车流量时段分析对象
*
* @author ruoyi
* @date 2024-01-13
*/
public class TrafficPeriodAnalysis extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 时段 */
@Excel(name = "时段")
private String time;
/** 本期车流量 */
@Excel(name = "本期车流量")
private String currentData;
/** 去年同期 */
@Excel(name = "去年同期")
private String contemporaneousData;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getCurrentData() {
return currentData;
}
public void setCurrentData(String currentData) {
this.currentData = currentData;
}
public String getContemporaneousData() {
return contemporaneousData;
}
public void setContemporaneousData(String contemporaneousData) {
this.contemporaneousData = contemporaneousData;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("time", getTime())
.append("currentData", getCurrentData())
.append("contemporaneousData", getContemporaneousData())
.toString();
}
}

27
zc-business/src/main/java/com/zc/business/mapper/DcInfoBoardVocabularyMapper.java

@ -1,29 +1,34 @@
package com.zc.business.mapper; package com.zc.business.mapper;
import java.util.List;
import com.zc.business.domain.DcInfoBoardVocabulary; import com.zc.business.domain.DcInfoBoardVocabulary;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 情报板敏感字管理Mapper接口 * 情报板敏感字管理Mapper接口
* *
* @author ruoyi * @author ruoyi
* @date 2024-01-05 * @date 2024-01-05
*/ */
public interface DcInfoBoardVocabularyMapper public interface DcInfoBoardVocabularyMapper {
{
/** /**
* 查询情报板敏感字管理 * 查询情报板敏感字管理
* *
* @param id 情报板敏感字管理主键 * @param id 情报板敏感字管理主键
* @return 情报板敏感字管理 * @return 情报板敏感字管理
*/ */
public DcInfoBoardVocabulary selectDcInfoBoardVocabularyById(Long id); public DcInfoBoardVocabulary selectDcInfoBoardVocabularyById(Long id);
int selectWordNum(DcInfoBoardVocabulary dcInfoBoardVocabulary); int selectWordNum(DcInfoBoardVocabulary dcInfoBoardVocabulary);
/**
* 导入敏感字
*/
int importVocabulary(List<DcInfoBoardVocabulary> dcInfoBoardVocabularyList);
/** /**
* 查询情报板敏感字管理列表 * 查询情报板敏感字管理列表
* *
* @param dcInfoBoardVocabulary 情报板敏感字管理 * @param dcInfoBoardVocabulary 情报板敏感字管理
* @return 情报板敏感字管理集合 * @return 情报板敏感字管理集合
*/ */
@ -31,7 +36,7 @@ public interface DcInfoBoardVocabularyMapper
/** /**
* 新增情报板敏感字管理 * 新增情报板敏感字管理
* *
* @param dcInfoBoardVocabulary 情报板敏感字管理 * @param dcInfoBoardVocabulary 情报板敏感字管理
* @return 结果 * @return 结果
*/ */
@ -39,7 +44,7 @@ public interface DcInfoBoardVocabularyMapper
/** /**
* 修改情报板敏感字管理 * 修改情报板敏感字管理
* *
* @param dcInfoBoardVocabulary 情报板敏感字管理 * @param dcInfoBoardVocabulary 情报板敏感字管理
* @return 结果 * @return 结果
*/ */
@ -47,7 +52,7 @@ public interface DcInfoBoardVocabularyMapper
/** /**
* 删除情报板敏感字管理 * 删除情报板敏感字管理
* *
* @param id 情报板敏感字管理主键 * @param id 情报板敏感字管理主键
* @return 结果 * @return 结果
*/ */
@ -55,7 +60,7 @@ public interface DcInfoBoardVocabularyMapper
/** /**
* 批量删除情报板敏感字管理 * 批量删除情报板敏感字管理
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */

22
zc-business/src/main/java/com/zc/business/service/IDcInfoBoardVocabularyService.java

@ -4,18 +4,19 @@ import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcInfoBoardVocabulary; import com.zc.business.domain.DcInfoBoardVocabulary;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 情报板敏感字管理Service接口 * 情报板敏感字管理Service接口
* *
* @author ruoyi * @author ruoyi
* @date 2024-01-05 * @date 2024-01-05
*/ */
public interface IDcInfoBoardVocabularyService public interface IDcInfoBoardVocabularyService
{ {
/** /**
* 查询情报板敏感字管理 * 查询情报板敏感字管理
* *
* @param id 情报板敏感字管理主键 * @param id 情报板敏感字管理主键
* @return 情报板敏感字管理 * @return 情报板敏感字管理
*/ */
@ -23,15 +24,20 @@ public interface IDcInfoBoardVocabularyService
/** /**
* 查询情报板敏感字管理列表 * 查询情报板敏感字管理列表
* *
* @param dcInfoBoardVocabulary 情报板敏感字管理 * @param dcInfoBoardVocabulary 情报板敏感字管理
* @return 情报板敏感字管理集合 * @return 情报板敏感字管理集合
*/ */
List<DcInfoBoardVocabulary> selectDcInfoBoardVocabularyList(DcInfoBoardVocabulary dcInfoBoardVocabulary); List<DcInfoBoardVocabulary> selectDcInfoBoardVocabularyList(DcInfoBoardVocabulary dcInfoBoardVocabulary);
/**
* 导入敏感字
*/
AjaxResult importVocabulary(MultipartFile file) throws Exception;
/** /**
* 新增情报板敏感字管理 * 新增情报板敏感字管理
* *
* @param dcInfoBoardVocabulary 情报板敏感字管理 * @param dcInfoBoardVocabulary 情报板敏感字管理
* @return 结果 * @return 结果
*/ */
@ -39,7 +45,7 @@ public interface IDcInfoBoardVocabularyService
/** /**
* 修改情报板敏感字管理 * 修改情报板敏感字管理
* *
* @param dcInfoBoardVocabulary 情报板敏感字管理 * @param dcInfoBoardVocabulary 情报板敏感字管理
* @return 结果 * @return 结果
*/ */
@ -47,7 +53,7 @@ public interface IDcInfoBoardVocabularyService
/** /**
* 批量删除情报板敏感字管理 * 批量删除情报板敏感字管理
* *
* @param ids 需要删除的情报板敏感字管理主键集合 * @param ids 需要删除的情报板敏感字管理主键集合
* @return 结果 * @return 结果
*/ */
@ -55,7 +61,7 @@ public interface IDcInfoBoardVocabularyService
/** /**
* 删除情报板敏感字管理信息 * 删除情报板敏感字管理信息
* *
* @param id 情报板敏感字管理主键 * @param id 情报板敏感字管理主键
* @return 结果 * @return 结果
*/ */

12
zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java

@ -48,6 +48,18 @@ public class DcBatchFunctionsJobGroupServiceImpl extends ServiceImpl<DcBatchFunc
dcBatchFunctionsJobGroup.setUpdateTime(new Date()); dcBatchFunctionsJobGroup.setUpdateTime(new Date());
boolean update = update(dcBatchFunctionsJobGroup, lambdaQueryWrapper); boolean update = update(dcBatchFunctionsJobGroup, lambdaQueryWrapper);
if (update) { if (update) {
LambdaQueryWrapper<DcBatchFunctionsJob> dcBatchFunctionsJobLambdaQueryWrapper = new LambdaQueryWrapper<>();
dcBatchFunctionsJobLambdaQueryWrapper.eq(DcBatchFunctionsJob::getJobGroup,dcBatchFunctionsJobGroup.getId());
List<DcBatchFunctionsJob> list = dcBatchFunctionsJobService.list(dcBatchFunctionsJobLambdaQueryWrapper);
list.forEach(item->{
try {
dcBatchFunctionsJobService.editDcBatchFunctionsJob(item);
} catch (SchedulerException e) {
throw new RuntimeException(e);
} catch (TaskException e) {
throw new RuntimeException(e);
}
});
return dcBatchFunctionsJobGroup; return dcBatchFunctionsJobGroup;
} }
return null; return null;

34
zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java

@ -9,6 +9,7 @@ import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.zc.business.domain.DcBatchFunctionsJob; import com.zc.business.domain.DcBatchFunctionsJob;
import com.zc.business.domain.DcBatchFunctionsJobGroup; import com.zc.business.domain.DcBatchFunctionsJobGroup;
import com.zc.business.enums.UniversalEnum;
import com.zc.business.mapper.DcBatchFunctionsJobMapper; import com.zc.business.mapper.DcBatchFunctionsJobMapper;
import com.zc.business.service.IDcBatchFunctionsJobGroupService; import com.zc.business.service.IDcBatchFunctionsJobGroupService;
import com.zc.business.service.IDcBatchFunctionsJobService; import com.zc.business.service.IDcBatchFunctionsJobService;
@ -55,8 +56,18 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
JSONArray jsonArray = JSONObject.parseArray(dcBatchFunctionsJobGroup.getDetailedConfiguration()); JSONArray jsonArray = JSONObject.parseArray(dcBatchFunctionsJobGroup.getDetailedConfiguration());
for (Object o : jsonArray) { for (Object o : jsonArray) {
String time = ((JSONObject) o).getString("time"); String time = ((JSONObject) o).getString("time");
String[] times = time.split(":"); String[] times = time.split(UniversalEnum.IN_THE_COLON.getValue());
String cron = times[2] + " " + times[1] + " " + times[0] + " " + " * * ?"; String cron = times[UniversalEnum.TWO.getNumber()]
+ UniversalEnum.BLANK_SPACE.getValue()
+ times[UniversalEnum.ONE.getNumber()]
+ UniversalEnum.BLANK_SPACE.getValue()
+ times[UniversalEnum.ZERO.getNumber()]
+ UniversalEnum.BLANK_SPACE.getValue()
+ UniversalEnum.ASTERISK_ASTERISK.getValue()
+ UniversalEnum.BLANK_SPACE.getValue()
+ UniversalEnum.ASTERISK_ASTERISK.getValue()
+ UniversalEnum.BLANK_SPACE.getValue()
+ UniversalEnum.QUESTION_MARK.getValue();
JSONArray tasks = ((JSONObject) o).getJSONArray("tasks"); JSONArray tasks = ((JSONObject) o).getJSONArray("tasks");
for (Object task : tasks) { for (Object task : tasks) {
if (Objects.equals(String.valueOf(job.getJobId()), String.valueOf(task))) { if (Objects.equals(String.valueOf(job.getJobId()), String.valueOf(task))) {
@ -79,12 +90,15 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
if (time == null) { if (time == null) {
return null; return null;
} }
if (detailedConfigurations==null) {
detailedConfigurations = new JSONArray();
}
List<Object> detaileds = detailedConfigurations.stream().filter(detailed -> List<Object> detaileds = detailedConfigurations.stream().filter(detailed ->
Objects.equals((String) ((JSONObject) detailed).get("time"), time) Objects.equals((String) ((JSONObject) detailed).get("time"), time)
).collect(Collectors.toList()); ).collect(Collectors.toList());
Integer id = ThreadLocalRandom.current().nextInt(0, 999999999); Integer id = ThreadLocalRandom.current().nextInt(UniversalEnum.ZERO.getNumber(), UniversalEnum.NINE_HUNDRED_AND_NINETY_NINE_HUNDRED_AND_NINETY_NINE_HUNDRED_AND_NINETY_NINE.getNumber());
if (detaileds.size() > 0) { if (detaileds.size() > UniversalEnum.ZERO.getNumber()) {
JSONObject detailed = (JSONObject) detaileds.get(0); JSONObject detailed = (JSONObject) detaileds.get(UniversalEnum.ZERO.getNumber());
JSONArray tasks = detailed.getJSONArray("tasks"); JSONArray tasks = detailed.getJSONArray("tasks");
tasks.add(id); tasks.add(id);
detailed.put("tasks", tasks); detailed.put("tasks", tasks);
@ -152,10 +166,10 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
DcBatchFunctionsJob job = new DcBatchFunctionsJob(); DcBatchFunctionsJob job = new DcBatchFunctionsJob();
job.setJobId(Long.valueOf(id)); job.setJobId(Long.valueOf(id));
List<DcBatchFunctionsJob> dcBatchFunctionsJobs = listDcBatchFunctionsJob(job); List<DcBatchFunctionsJob> dcBatchFunctionsJobs = listDcBatchFunctionsJob(job);
if (dcBatchFunctionsJobs.size() == 0) { if (dcBatchFunctionsJobs.size() == UniversalEnum.ZERO.getNumber()) {
return false; return false;
} }
DcBatchFunctionsJob dcBatchFunctionsJob = dcBatchFunctionsJobs.get(0); DcBatchFunctionsJob dcBatchFunctionsJob = dcBatchFunctionsJobs.get(UniversalEnum.ZERO.getNumber());
ScheduleUtils.deleteJob(scheduler, dcBatchFunctionsJob); ScheduleUtils.deleteJob(scheduler, dcBatchFunctionsJob);
DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup = dcBatchFunctionsJobGroupService.getById(dcBatchFunctionsJob.getJobGroup()); DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup = dcBatchFunctionsJobGroupService.getById(dcBatchFunctionsJob.getJobGroup());
if (dcBatchFunctionsJobGroup == null) { if (dcBatchFunctionsJobGroup == null) {
@ -177,8 +191,8 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
return result; return result;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
System.out.println(detaileds); System.out.println(detaileds);
if (detaileds.size() > 0) { if (detaileds.size() > UniversalEnum.ZERO.getNumber()) {
JSONObject detailed = (JSONObject) detaileds.get(0); JSONObject detailed = (JSONObject) detaileds.get(UniversalEnum.ZERO.getNumber());
JSONArray tasks = detailed.getJSONArray("tasks"); JSONArray tasks = detailed.getJSONArray("tasks");
tasks = tasks.stream() tasks = tasks.stream()
@ -223,7 +237,7 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
@Override @Override
public boolean changeStatus(DcBatchFunctionsJob dcBatchFunctionsJob, String status) throws SchedulerException, TaskException { public boolean changeStatus(DcBatchFunctionsJob dcBatchFunctionsJob, String status) throws SchedulerException, TaskException {
if (Objects.equals(status, "0")) { if (Objects.equals(status, UniversalEnum.ZERO.getValue())) {
scheduler.resumeJob(ScheduleUtils.getJobKey(Long.valueOf(dcBatchFunctionsJob.getJobId()), String.valueOf(dcBatchFunctionsJob.getJobGroup()))); scheduler.resumeJob(ScheduleUtils.getJobKey(Long.valueOf(dcBatchFunctionsJob.getJobId()), String.valueOf(dcBatchFunctionsJob.getJobGroup())));
} else { } else {
scheduler.pauseJob(ScheduleUtils.getJobKey(Long.valueOf(dcBatchFunctionsJob.getJobId()), String.valueOf(dcBatchFunctionsJob.getJobGroup()))); scheduler.pauseJob(ScheduleUtils.getJobKey(Long.valueOf(dcBatchFunctionsJob.getJobId()), String.valueOf(dcBatchFunctionsJob.getJobGroup())));

78
zc-business/src/main/java/com/zc/business/service/impl/DcInfoBoardVocabularyServiceImpl.java

@ -1,15 +1,23 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import java.net.URLDecoder;
import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service; import com.ruoyi.common.utils.bean.BeanValidators;
import com.zc.business.mapper.DcInfoBoardVocabularyMapper; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.DcInfoBoardVocabulary; import com.zc.business.domain.DcInfoBoardVocabulary;
import com.zc.business.mapper.DcInfoBoardVocabularyMapper;
import com.zc.business.service.IDcInfoBoardVocabularyService; import com.zc.business.service.IDcInfoBoardVocabularyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.net.URLDecoder;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* 情报板敏感字管理Service业务层处理 * 情报板敏感字管理Service业务层处理
@ -18,11 +26,13 @@ import com.zc.business.service.IDcInfoBoardVocabularyService;
* @date 2024-01-05 * @date 2024-01-05
*/ */
@Service @Service
public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyService public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyService {
{
@Autowired @Autowired
private DcInfoBoardVocabularyMapper dcInfoBoardVocabularyMapper; private DcInfoBoardVocabularyMapper dcInfoBoardVocabularyMapper;
@Resource
protected Validator validator;
/** /**
* 查询情报板敏感字管理 * 查询情报板敏感字管理
* *
@ -30,8 +40,7 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 情报板敏感字管理 * @return 情报板敏感字管理
*/ */
@Override @Override
public DcInfoBoardVocabulary selectDcInfoBoardVocabularyById(Long id) public DcInfoBoardVocabulary selectDcInfoBoardVocabularyById(Long id) {
{
return dcInfoBoardVocabularyMapper.selectDcInfoBoardVocabularyById(id); return dcInfoBoardVocabularyMapper.selectDcInfoBoardVocabularyById(id);
} }
@ -42,11 +51,36 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 情报板敏感字管理 * @return 情报板敏感字管理
*/ */
@Override @Override
public List<DcInfoBoardVocabulary> selectDcInfoBoardVocabularyList(DcInfoBoardVocabulary dcInfoBoardVocabulary) public List<DcInfoBoardVocabulary> selectDcInfoBoardVocabularyList(DcInfoBoardVocabulary dcInfoBoardVocabulary) {
{
return dcInfoBoardVocabularyMapper.selectDcInfoBoardVocabularyList(dcInfoBoardVocabulary); return dcInfoBoardVocabularyMapper.selectDcInfoBoardVocabularyList(dcInfoBoardVocabulary);
} }
/**
* 导入敏感字
*
* @param file
* @return
*/
@Override
public AjaxResult importVocabulary(MultipartFile file) throws Exception {
ExcelUtil<DcInfoBoardVocabulary> util = new ExcelUtil<>(DcInfoBoardVocabulary.class);
List<DcInfoBoardVocabulary> vocabularyList = util.importExcel(file.getInputStream());
BeanValidators.validateWithException(validator, vocabularyList);//对象属性验证
Date nowDate = DateUtils.getNowDate();
List<DcInfoBoardVocabulary> dcInfoBoardVocabularies = dcInfoBoardVocabularyMapper.selectDcInfoBoardVocabularyList(new DcInfoBoardVocabulary());
List<DcInfoBoardVocabulary> wordsNotInDcInfoBoard = vocabularyList.stream()
.filter(dcInfoBoardVocabulary -> StringUtils.isNotEmpty(dcInfoBoardVocabulary.getWord()))
.filter(v -> dcInfoBoardVocabularies.stream().noneMatch(d -> d.getWord().equals(v.getWord())))
.collect(Collectors.toList());
wordsNotInDcInfoBoard.forEach(dcInfoBoardVocabulary -> {
dcInfoBoardVocabulary.setCreateTime(nowDate);
});
if (wordsNotInDcInfoBoard.size() > 0) {
return AjaxResult.success(dcInfoBoardVocabularyMapper.importVocabulary(wordsNotInDcInfoBoard));
}
return AjaxResult.success().put("msg", "请检查数据是否重复,或存在空值");
}
/** /**
* 新增情报板敏感字管理 * 新增情报板敏感字管理
* *
@ -54,11 +88,10 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 结果 * @return 结果
*/ */
@Override @Override
public AjaxResult insertDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary) public AjaxResult insertDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary) {
{
dcInfoBoardVocabulary.setCreateTime(DateUtils.getNowDate()); dcInfoBoardVocabulary.setCreateTime(DateUtils.getNowDate());
int oldNum = dcInfoBoardVocabularyMapper.selectWordNum(dcInfoBoardVocabulary); int oldNum = dcInfoBoardVocabularyMapper.selectWordNum(dcInfoBoardVocabulary);
if (oldNum > 0){ if (oldNum > 0) {
return AjaxResult.error("该关键词已存在!"); return AjaxResult.error("该关键词已存在!");
} }
dcInfoBoardVocabularyMapper.insertDcInfoBoardVocabulary(dcInfoBoardVocabulary); dcInfoBoardVocabularyMapper.insertDcInfoBoardVocabulary(dcInfoBoardVocabulary);
@ -72,10 +105,9 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 结果 * @return 结果
*/ */
@Override @Override
public AjaxResult updateDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary) public AjaxResult updateDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary) {
{
int oldNum = dcInfoBoardVocabularyMapper.selectWordNum(dcInfoBoardVocabulary); int oldNum = dcInfoBoardVocabularyMapper.selectWordNum(dcInfoBoardVocabulary);
if (oldNum > 0){ if (oldNum > 0) {
return AjaxResult.error("该关键词已存在!"); return AjaxResult.error("该关键词已存在!");
} }
dcInfoBoardVocabularyMapper.updateDcInfoBoardVocabulary(dcInfoBoardVocabulary); dcInfoBoardVocabularyMapper.updateDcInfoBoardVocabulary(dcInfoBoardVocabulary);
@ -89,8 +121,7 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDcInfoBoardVocabularyByIds(Long[] ids) public int deleteDcInfoBoardVocabularyByIds(Long[] ids) {
{
return dcInfoBoardVocabularyMapper.deleteDcInfoBoardVocabularyByIds(ids); return dcInfoBoardVocabularyMapper.deleteDcInfoBoardVocabularyByIds(ids);
} }
@ -101,8 +132,7 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDcInfoBoardVocabularyById(Long id) public int deleteDcInfoBoardVocabularyById(Long id) {
{
return dcInfoBoardVocabularyMapper.deleteDcInfoBoardVocabularyById(id); return dcInfoBoardVocabularyMapper.deleteDcInfoBoardVocabularyById(id);
} }
@ -113,7 +143,7 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 结果 * @return 结果
*/ */
@Override @Override
public AjaxResult checkBoardContent(String content){ public AjaxResult checkBoardContent(String content) {
if (content == null || content.equals("")) { if (content == null || content.equals("")) {
return AjaxResult.error("情报板内容为空"); return AjaxResult.error("情报板内容为空");
} else { } else {
@ -125,7 +155,7 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
e.printStackTrace(); e.printStackTrace();
return AjaxResult.error(); return AjaxResult.error();
} }
for (int i = 0;i < boardVocabularies.size();i++) { for (int i = 0; i < boardVocabularies.size(); i++) {
String word = boardVocabularies.get(i).getWord(); String word = boardVocabularies.get(i).getWord();
if (content.contains(word)) { if (content.contains(word)) {
return AjaxResult.error("当前发布内容包含敏感字段'" + word + "',请修改"); return AjaxResult.error("当前发布内容包含敏感字段'" + word + "',请修改");

2
zc-business/src/main/java/com/zc/business/statistics/cache/gantry/QuarterlyTrafficGantryStatisticsCache.java

@ -148,7 +148,7 @@ public class QuarterlyTrafficGantryStatisticsCache extends AbstractTrafficStatis
*/ */
private static String formatDate(Date date) { private static String formatDate(Date date) {
// 使用 DateUtil 工具类将 date 格式化为指定格式的字符串 // 使用 DateUtil 工具类将 date 格式化为指定格式的字符串
return DateUtil.format(date, "yyyy-MM-01"); return DateUtil.format(DateUtil.beginOfQuarter(new Date()), "yyyy-MM-dd");
} }
} }

2
zc-business/src/main/java/com/zc/business/statistics/cache/metrics/QuarterlyGantryMetricsStatisticsCache.java

@ -148,7 +148,7 @@ public class QuarterlyGantryMetricsStatisticsCache extends AbstractTrafficStatis
*/ */
private static String formatDate(Date date) { private static String formatDate(Date date) {
// 使用 DateUtil 工具类将 date 格式化为指定格式的字符串 // 使用 DateUtil 工具类将 date 格式化为指定格式的字符串
return DateUtil.format(date, "yyyy-MM-01"); return DateUtil.format(DateUtil.beginOfQuarter(new Date()), "yyyy-MM-dd");
} }
} }

2
zc-business/src/main/java/com/zc/business/statistics/cache/section/QuarterlyTrafficSectionStatisticsCache.java

@ -143,7 +143,7 @@ public class QuarterlyTrafficSectionStatisticsCache extends AbstractTrafficStati
*/ */
private static String formatDate(Date date) { private static String formatDate(Date date) {
// 使用 DateUtil 工具类将 date 格式化为指定格式的字符串 // 使用 DateUtil 工具类将 date 格式化为指定格式的字符串
return DateUtil.format(date, "yyyy-MM-01"); return DateUtil.format(DateUtil.beginOfQuarter(new Date()), "yyyy-MM-dd");
} }
} }

2
zc-business/src/main/java/com/zc/business/statistics/cache/tollstation/QuarterlyTrafficTollStationStatisticsCache.java

@ -148,7 +148,7 @@ public class QuarterlyTrafficTollStationStatisticsCache extends AbstractTrafficS
*/ */
private static String formatDate(Date date) { private static String formatDate(Date date) {
// 使用 DateUtil 工具类将 date 格式化为指定格式的字符串 // 使用 DateUtil 工具类将 date 格式化为指定格式的字符串
return DateUtil.format(date, "yyyy-MM-01"); return DateUtil.format(DateUtil.beginOfQuarter(new Date()), "yyyy-MM-dd");
} }
} }

BIN
zc-business/src/main/resources/excelTemplate/敏感字模板.xlsx

Binary file not shown.

16
zc-business/src/main/resources/mapper/business/DcInfoBoardVocabularyMapper.xml

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcInfoBoardVocabularyMapper"> <mapper namespace="com.zc.business.mapper.DcInfoBoardVocabularyMapper">
<resultMap type="DcInfoBoardVocabulary" id="DcInfoBoardVocabularyResult"> <resultMap type="DcInfoBoardVocabulary" id="DcInfoBoardVocabularyResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="word" column="word" /> <result property="word" column="word" />
@ -16,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcInfoBoardVocabularyList" parameterType="DcInfoBoardVocabulary" resultMap="DcInfoBoardVocabularyResult"> <select id="selectDcInfoBoardVocabularyList" parameterType="DcInfoBoardVocabulary" resultMap="DcInfoBoardVocabularyResult">
<include refid="selectDcInfoBoardVocabularyVo"/> <include refid="selectDcInfoBoardVocabularyVo"/>
<where> <where>
<if test="word != null and word != ''"> and word like concat('%', #{word}, '%')</if> <if test="word != null and word != ''"> and word like concat('%', #{word}, '%')</if>
</where> </where>
</select> </select>
@ -35,6 +35,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<insert id="importVocabulary" parameterType="list">
insert into dc_info_board_vocabulary (word,create_time)
values
<foreach collection="list" item="dcInfoBoardVocabulary" separator=",">
(#{dcInfoBoardVocabulary.word}, #{dcInfoBoardVocabulary.createTime})
</foreach>
</insert>
<insert id="insertDcInfoBoardVocabulary" parameterType="DcInfoBoardVocabulary" useGeneratedKeys="true" keyProperty="id"> <insert id="insertDcInfoBoardVocabulary" parameterType="DcInfoBoardVocabulary" useGeneratedKeys="true" keyProperty="id">
insert into dc_info_board_vocabulary insert into dc_info_board_vocabulary
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -61,9 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteDcInfoBoardVocabularyByIds" parameterType="String"> <delete id="deleteDcInfoBoardVocabularyByIds" parameterType="String">
delete from dc_info_board_vocabulary where id in delete from dc_info_board_vocabulary where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

Loading…
Cancel
Save