Commit 7651a841 authored by duanruiming's avatar duanruiming

Merge remote-tracking branch 'origin/master'

parents ab52b423 e3d7551e
package net.wanji.opt.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;
/**
* @author duanruiming
* @date 2024/12/11 20:33
*/
@Getter
@AllArgsConstructor
public enum ConsgestionStatusEnum {
AMBLE_STATUS(2, "缓行"),
CONSGESTION_STATUS(3, "拥堵");
private Integer code;
private String desc;
public static String getDesc(Integer code) {
for (ConsgestionStatusEnum value : ConsgestionStatusEnum.values()) {
if (Objects.equals(code, value.getCode())) {
return value.getDesc();
}
}
return ConsgestionStatusEnum.AMBLE_STATUS.getDesc();
}
}
package net.wanji.opt.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;
/**
* @author duanruiming
* @date 2024/12/11 20:33
*/
@Getter
@AllArgsConstructor
public enum WeekEnum {
MON(1, "周一"),
TUE(2, "周二"),
WED(3, "周三"),
THU(4, "周四"),
FRI(5, "周五"),
SAT(6, "周六"),
SUN(7, "周日");
private Integer code;
private String desc;
public static String getDesc(Integer code) {
for (WeekEnum value : WeekEnum.values()) {
if (Objects.equals(code, value.getCode())) {
return value.getDesc();
}
}
return WeekEnum.MON.getDesc();
}
}
package net.wanji.opt.constant;
/**
* @author fengyi
* @date 2025/4/8
* @description
*/
public enum PeakEnum {
AM_PEAK(1, "早高峰"),
PM_PEAK(2,"晚高峰"),
PF_PEAK(3,"平峰");
private Integer code;
private String name;
PeakEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public static PeakEnum getNameByCode(Integer code){
for (PeakEnum abnormalEnum : PeakEnum.values()) {
if(abnormalEnum.getCode().equals(code)){
return abnormalEnum;
}
}
return null;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
package net.wanji.opt.constant;
/**
* @author fengyi
* @date 2025/4/8
* @description
*/
public enum WeekDayEnum {
MONDAY(1, "周一"),
TUESDAY(2,"周二"),
WEDNESDAY(3,"周三"),
THURSDAY(4,"周四"),
FRIDAY(5,"周五"),
SATURDAY(6,"周六"),
SUNDAY(7,"周日");
private Integer code;
private String name;
WeekDayEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public static WeekDayEnum getNameByCode(Integer code){
for (WeekDayEnum abnormalEnum : WeekDayEnum.values()) {
if(abnormalEnum.getCode().equals(code)){
return abnormalEnum;
}
}
return null;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
......@@ -12,10 +12,17 @@ import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.GreenReportOverviewAnalysisResult;
import net.wanji.opt.controllerv2.report.design.GreenReportProblemDetailAnalysis;
import net.wanji.opt.controllerv2.report.design.GreenReportProblemOverallAnalysis;
import net.wanji.opt.controllerv2.report.vo.GreenReportProblemDetailAnalysisResponse;
import net.wanji.opt.controllerv2.report.vo.GreenReportProblemOverallAnalysisResult;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisGreenCongestionPeriodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 干线概况 接口API
......@@ -30,21 +37,25 @@ import org.springframework.web.bind.annotation.RestController;
@Api(value="GreenWaveProblemAnalysisController", description="干线分析报告接口", tags = "干线分析报告-周报")
public class GreenWaveProblemAnalysisController {
@Autowired
private AnalysisGreenCongestionPeriodService analysisGreenCongestionPeriodService;
@ApiOperation(httpMethod="GET",value="4.1-干线问题-总体分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = true, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = false, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "20"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "13"),
})
@GetMapping(value = "/getProblemData")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenReportProblemOverallAnalysis.class),
})
public JsonViewObject getGreenInfoList(Integer year,Integer week, String ids) {
public JsonViewObject getGreenInfoList(Integer year,Integer week,@RequestParam(required = false) String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
GreenReportProblemOverallAnalysisResult greenReportProblemOverallAnalysisResult = analysisGreenCongestionPeriodService.selectListByWeek(year,week,ids);
jsonViewObject.success(greenReportProblemOverallAnalysisResult);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
......@@ -55,18 +66,19 @@ public class GreenWaveProblemAnalysisController {
//GreenReportProblemDetailAnalysis
@ApiOperation(httpMethod="GET",value="4.2-干线问题-问题详情", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = true, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = false, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "20"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "13"),
})
@GetMapping(value = "/getProblemDetail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenReportProblemDetailAnalysis.class),
})
public JsonViewObject getProblemDetail(Integer year,Integer week, String ids) {
public JsonViewObject getProblemDetail(Integer year,Integer week,@RequestParam(required = false) String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<GreenReportProblemDetailAnalysisResponse> greenReportProblemDetailAnalysisResponseList = analysisGreenCongestionPeriodService.getProblemDetail(year,week,ids);
jsonViewObject.success(greenReportProblemDetailAnalysisResponseList);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
......
......@@ -12,12 +12,17 @@ import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.GreenReportOverviewAnalysisResult;
import net.wanji.opt.controllerv2.report.design.GreenReportRunStateResult;
import net.wanji.opt.controllerv2.report.design.GreenReportSamePeriodCompareResult;
import net.wanji.opt.servicev2.report.AnalysisGreenWavePeakDetailService;
import net.wanji.opt.servicev2.report.GreenWaveCrossRidService;
import net.wanji.opt.vo2.report.GreenReportRunStateResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 干线概况 接口API
......@@ -32,6 +37,8 @@ import org.springframework.web.bind.annotation.RestController;
@Api(value="GreenWaveRunStateController", description="干线分析报告接口", tags = "干线分析报告-周报")
public class GreenWaveRunStateController {
@Resource
private AnalysisGreenWavePeakDetailService analysisGreenWavePeakDetailService;
@ApiOperation(httpMethod="GET",value="3.1-干线运行分析", notes="")
@ApiImplicitParams({
......@@ -43,10 +50,11 @@ public class GreenWaveRunStateController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenReportRunStateResult.class),
})
public JsonViewObject getData(Integer year,Integer week, String ids) {
public JsonViewObject getData(String ids,Integer year,Integer week) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<GreenReportRunStateResponseVO> list = analysisGreenWavePeakDetailService.selectWeekRunStateSituation(ids,year,week);
jsonViewObject.success(list);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
......
package net.wanji.opt.controllerv2.report.util;
import lombok.Data;
import java.time.Duration;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
public class TimeIntervalMerger {
// 定义时间区间类
@Data
static class TimeInterval {
private LocalTime start;
private LocalTime end;
public TimeInterval(LocalTime start, LocalTime end) {
this.start = start;
this.end = end;
}
// 判断两个区间是否重叠
public boolean overlapsWith(TimeInterval other) {
return !this.end.isBefore(other.start) && !other.end.isBefore(this.start);
}
// 合并两个区间
public TimeInterval mergeWith(TimeInterval other) {
return new TimeInterval(
this.start.isBefore(other.start) ? this.start : other.start,
this.end.isAfter(other.end) ? this.end : other.end
);
}
// 计算时间段的持续时间(以秒为单位)
public long getDurationInSeconds() {
return Duration.between(start, end).getSeconds();
}
}
// 定义支持单个数字小时部分的 DateTimeFormatter
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("H:mm");
public static String timeString(List<String> timeStrings) {
// 解析时间字符串为 TimeInterval 对象
List<TimeInterval> intervals = timeStrings.stream()
.map(timeStr -> {
String[] parts = timeStr.split("~");
LocalTime start = LocalTime.parse(parts[0].trim(), TIME_FORMATTER);
LocalTime end = LocalTime.parse(parts[1].trim(), TIME_FORMATTER);
return new TimeInterval(start, end);
})
.sorted(Comparator.comparing(TimeInterval::getStart)) // 按开始时间排序
.collect(Collectors.toList());
// 合并重叠的区间
List<TimeInterval> mergedIntervals = new ArrayList<>();
for (TimeInterval current : intervals) {
if (mergedIntervals.isEmpty() || !current.overlapsWith(mergedIntervals.get(mergedIntervals.size() - 1))) {
mergedIntervals.add(current); // 如果不重叠,直接添加
} else {
// 如果重叠,合并当前区间与最后一个区间
TimeInterval last = mergedIntervals.get(mergedIntervals.size() - 1);
mergedIntervals.set(mergedIntervals.size() - 1, last.mergeWith(current));
}
}
// 按时间段长度从大到小排序
mergedIntervals.sort((t1, t2) -> Long.compare(t2.getDurationInSeconds(), t1.getDurationInSeconds()));
// 截取前三个时间段
List<TimeInterval> topThreeIntervals = mergedIntervals.stream()
.limit(3)
.sorted(Comparator.comparing(TimeInterval::getStart)) // 按开始时间重新排序
.collect(Collectors.toList());
// 拼接结果字符串
StringBuilder result = new StringBuilder();
for (int i = 0; i < topThreeIntervals.size(); i++) {
TimeInterval interval = topThreeIntervals.get(i);
if (i > 0) {
result.append(",");
}
result.append(interval.getStart()).append("~").append(interval.getEnd());
}
return result.toString();
}
// 测试代码
public static void main(String[] args) {
List<String> timeStrings = Arrays.asList(
"7:00~8:00",
"12:00~13:30",
"17:30~18:40",
"7:30~9:00",
"17:00~18:00"
);
String result = timeString(timeStrings);
System.out.println(result); // 输出结果
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(description = "绿波干线高峰时段分析实体类")
public class AnalysisGreenCongestionPeriodVO {
@ApiModelProperty(value = "干线ID", example = "1")
private Integer greenId;
@ApiModelProperty(value = "干线车流运行方向 (w2e/e2w/s2n/n2s)", example = "w2e")
private String roadDirection;
@ApiModelProperty(value = "星期几:1~7代表周一至周日", example = "1")
private Integer weekDay;
@ApiModelProperty(value = "拥堵开始时间", example = "2025-04-07 08:00:00")
private Date congestStartTime;
@ApiModelProperty(value = "拥堵截止时间", example = "2025-04-07 10:00:00")
private Date congestEndTime;
@ApiModelProperty(value = "平均拥堵指数", example = "1.5")
private Double congestIndex;
@ApiModelProperty(value = "拥堵类型:2缓行;3拥堵", example = "2")
private Integer status;
@ApiModelProperty(value = "行程时间,单位秒", example = "3600")
private Integer travelTime;
@ApiModelProperty(value = "平均速度 (km/h)", example = "40.5")
private Double speed;
@ApiModelProperty(value = "高峰类型:1早高峰;2晚高峰", example = "1")
private String peakType;
@ApiModelProperty(value = "一年中的第几周,格式yyyyw,如20251", example = "20251")
private Integer yearWeek;
@ApiModelProperty(value = "一周的第一天", example = "2025-04-07 00:00:00")
private Date weekStartTime;
@ApiModelProperty(value = "一周的最后一天", example = "2025-04-13 23:59:59")
private Date weekEndTime;
@ApiModelProperty(value = "数据插入时间", example = "2025-04-07 12:30:00")
private Date insertTime;
}
\ No newline at end of file
......@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestParam;
public class AreaParamBody {
@ApiModelProperty(value = "区域名称", example = "",required = true)
String name;
@ApiModelProperty(required = true,value = "区域边界坐标,格式:x1,y1;...;xn,yn", example = "117.049347926,36.654744674;117.066122093,36.654772445;117.0800809517208,36.65440636491661;117.07979265456723,36.65214909599633;117.07706941120558,36.63829789737139;117.07414217382905,36.63736765765722;117.0707410731053,36.636677059391445;117.06550839703021,36.63722151604908;117.06267677771574,36.63667912391616;117.0577271202223,36.63483777099411;117.05251580910459,36.63437969486462;117.04433347163972,36.63696466063367;117.04843387376732,36.637934238407;117.04968488845323,36.638408635754985;117.049347926,36.654744674;117.066122093,36.654772445;117.0800809517208,36.65440636491661;117.07979265456723,36.65214909599633;117.07706941120558,36.63829789737139;117.07414217382905,36.63736765765722;117.0707410731053,36.636677059391445;117.06550839703021,36.63722151604908;117.06267677771574,36.63667912391616;117.0577271202223,36.63483777099411;117.05251580910459,36.63437969486462;117.04433347163972,36.63696466063367;117.04843387376732,36.637934238407;117.04968488845323,36.638408635754985;117.049347926,36.654744674")
......
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GreenReportProblemDetail {
@ApiModelProperty(value = "星期", example = "周一")
private String week;
@ApiModelProperty(value = "问题时段", example = "7:35~8:40")
private String problemSpan;
@ApiModelProperty(value = "状态:缓行/拥堵", example = "拥堵")
private String status;
@ApiModelProperty(value = "拥堵指数", example = "4.5")
private Double congestIndex;
@ApiModelProperty(value = "平均速度", example = "10")
private Double avgSpeed;
@ApiModelProperty(value = "行程时间,单位分钟", example = "10")
private Integer travelTime;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportProblemDetailAnalysisResponse {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "干线工作日拥堵时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String workDayCongestSpan;
@ApiModelProperty(value = "干线工作日平均拥堵时长", example = "1小时")
private String workDayAvgCongestTime;
@ApiModelProperty(value = "干线工作日平均拥堵指数",example = "3.5")
private String workDayAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线工作日缓行时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String workDaySlowRunSpan;
@ApiModelProperty(value = "干线工作日平均缓行时长", example = "0.5小时")
private String workDayAvgSlowRunTime;
@ApiModelProperty(value = "干线工作日缓行平均拥堵指数",example = "3.5")
private String workDayAvgSlowAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线周末拥堵时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String weekEndCongestSpan;
@ApiModelProperty(value = "干线周末平均拥堵时长", example = "1小时")
private String weekEndAvgCongestTime;
@ApiModelProperty(value = "干线周末平均拥堵指数",example = "3.5")
private String weekEndAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线周末缓行时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String weekEndSlowRunSpan;
@ApiModelProperty(value = "干线周末平均缓行时长", example = "0.5小时")
private String weekEndAvgSlowRunTime;
@ApiModelProperty(value = "干线周末缓行平均拥堵指数",example = "3.5")
private String weekEndAvgSlowAvgCongestIndex;
private List<GreenReportProblemDetail> dataList = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportProblemOverallAnalysisResult {
@ApiModelProperty(value = "区域干线总拥堵次数", example = "56次")
private String totalCongestCount;
@ApiModelProperty(value = "区域干线总拥堵时长", example = "11小时")
private String totalCongestDuration;
@ApiModelProperty(value = "拥堵严重干线",example = "经十路(舜耕路-山大路)、经十路(洪山路-舜华路)")
private String congestHeavyGreenWave;
private List<GreenReportProblemOverallData> dataList = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportProblemOverallData {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
List<GreenWaveDirProblemData> list = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
class GreenReportRunStateResponseVO {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "本周早高峰时段集中情况", example = "7:30~8:30")
private String weekAmPeakSpan;
@ApiModelProperty(value = "本周早高峰时段开始时间同比(上周)情况", example = "提前20分钟")
private String amStartSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段截止时间同比(上周)情况", example = "延后20分钟")
private String amEndSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段持续时长", example = "45分钟")
private String amDuration;
@ApiModelProperty(value = "本周早高峰时段持续时长同比(上周)情况", example = "增加5分钟")
private String amDurationSameRatioSituation;
@ApiModelProperty(value = "本周早高峰最大行程时间", example = "30分钟")
private String amMaxTravelTime;
@ApiModelProperty(value = "本周早高峰最大行程时间同比(上周)情况", example = "减少6分钟")
private String amMaxTravelTimeSameRatioSituation;
@ApiModelProperty(value = "平均拥堵指数", example = "4.5")
private String amAvgContestIndex;
@ApiModelProperty(value = "平均拥堵指数同比(上周)情况", example = "减少0.5")
private String amAvgContestIndexSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段集中情况", example = "7:30~8:30")
private String weekPmPeakSpan;
@ApiModelProperty(value = "本周早高峰时段开始时间同比(上周)情况", example = "提前20分钟")
private String pmStartSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段截止时间同比(上周)情况", example = "延后20分钟")
private String pmEndSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段持续时长", example = "45分钟")
private String pmDuration;
@ApiModelProperty(value = "本周早高峰时段持续时长同比(上周)情况", example = "增加5分钟")
private String pmDurationSameRatioSituation;
@ApiModelProperty(value = "本周早高峰最大行程时间", example = "30分钟")
private String pmMaxTravelTime;
@ApiModelProperty(value = "本周早高峰最大行程时间同比(上周)情况", example = "减少6分钟")
private String pmMaxTravelTimeSameRatioSituation;
@ApiModelProperty(value = "平均拥堵指数", example = "4.5")
private String pmAvgContestIndex;
@ApiModelProperty(value = "平均拥堵指数同比(上周)情况", example = "减少0.5")
private String pmAvgContestIndexSameRatioSituation;
private List<GreenReportRunStatedDataVO> dataList = new ArrayList<>();
}
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
class GreenReportRunStatedDataVO {
@ApiModelProperty(value = "星期", example = "星期一")
private String weekName;
@ApiModelProperty(value = "峰期类型 早高峰、晚高峰、全天", example = "早高峰")
private String peakName;
@ApiModelProperty(value = "本周拥堵时段", example = "7:35~8:40")
private String thisWeekCongestSpan;
@ApiModelProperty(value = "上周拥堵时段", example = "7:50~8:40")
private String lastWeekCongestSpan;
@ApiModelProperty(value = "本周拥堵指数", example = "3.5")
private Double thisWeekCongestIndex;
@ApiModelProperty(value = "上周拥堵指数", example = "3.0")
private Double lastWeekCongestIndex;
@ApiModelProperty(value = "本周平均车速km/h", example = "30.5")
private Double thisWeekAvgSpeed;
@ApiModelProperty(value = "上周平均车速km", example = "30.2")
private Double lastWeekAvgSpeed;
@ApiModelProperty(value = "本周行程时间(分钟)", example = "6.5")
private Double thisWeekTravelTime;
@ApiModelProperty(value = "上周行程时间(分钟)", example = "-1.5%")
private Double lastWeekTravelTime;
}
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GreenWaveDirProblemData{
@ApiModelProperty(value = "干线类型", example = "主干路")
private String greenWaveType;
@ApiModelProperty(value = "方向", example = "东向西")
private String dir;
@ApiModelProperty(value = "拥堵指数", example = "4.5")
private Double congestIndex;
@ApiModelProperty(value = "拥堵次数", example = "10")
private Integer congestCount;
@ApiModelProperty(value = "拥堵时长,单位秒", example = "10")
private Integer congestDuration;
}
\ No newline at end of file
......@@ -9,13 +9,13 @@ import lombok.Data;
@ApiModel(value = "绿波干线周总体拥堵概况", description = "绿波干线周总体拥堵概况")
public class GreenWaveWeekDataVO {
@ApiModelProperty(value = "路口ID",example = "")
@ApiModelProperty(value = "干线ID",example = "1")
private Integer greenId ;
@ApiModelProperty(value = "干线名称",example = "")
private String greenName ;
@ApiModelProperty(value = "干线路段长度,单位米",example = "")
@ApiModelProperty(value = "干线路段长度,单位米",example = "232.5")
private double length ;
@ApiModelProperty(value = "干线道路类型,以文字形式描述",example = "主干道")
......
......@@ -2,6 +2,7 @@ package net.wanji.opt.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.opt.dto.induce.MessageParam;
import net.wanji.opt.dto.report.StrategyGreenOptHistDTO;
import net.wanji.opt.po.StrategyGreenOptHistEntity;
import net.wanji.opt.vo2.dto.GreenLastOptResultDTO;
......@@ -19,4 +20,6 @@ public interface StrategyGreenOptHistMapper extends BaseMapper<StrategyGreenOptH
List<MessageParam> selectGreenOptEndTimeEquipCode();
List<GreenLastOptResultDTO> selectLastGreenOptResultList();
List<StrategyGreenOptHistDTO> findGreenWaveOptHist();
}
package net.wanji.opt.dao.mapper.judgeanalysis;
import net.wanji.opt.controllerv2.report.vo.AnalysisGreenCongestionPeriodVO;
import net.wanji.opt.entity.judgeanalysis.AnalysisGreenCongestionPeriod;
import org.apache.ibatis.annotations.Param;
......@@ -9,4 +10,6 @@ import java.util.Map;
public interface AnalysisGreenCongestionPeriodMapper {
List<AnalysisGreenCongestionPeriod> selectGreenDataHist(@Param("date") String date);
void insertGreenCongestionPeriodData(Map<String, Object> map);
List<AnalysisGreenCongestionPeriodVO> selectListByWeek(@Param("yearWeek") Integer yearWeek);
}
package net.wanji.opt.dao.mapper.report;
import net.wanji.opt.entity.report.AnalysisGreenWaveOptimizeWeek;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface AnalysisGreenWaveOptimizeWeekMapper extends BaseMapper<AnalysisGreenWaveOptimizeWeek>{
/**
* 查询表t_analysis_green_wave_optimize_week所有信息
*/
List<AnalysisGreenWaveOptimizeWeek> findAllAnalysisGreenWaveOptimizeWeek();
/**
* 根据主键greenId查询表t_analysis_green_wave_optimize_week信息
* @param greenId
*/
AnalysisGreenWaveOptimizeWeek findAnalysisGreenWaveOptimizeWeekBygreenId(@Param("greenId") Integer greenId);
/**
* 根据条件查询表t_analysis_green_wave_optimize_week信息
* @param analysisGreenWaveOptimizeWeek
*/
List<AnalysisGreenWaveOptimizeWeek> findAnalysisGreenWaveOptimizeWeekByCondition(AnalysisGreenWaveOptimizeWeek analysisGreenWaveOptimizeWeek);
/**
* 根据主键greenId查询表t_analysis_green_wave_optimize_week信息
* @param greenId
*/
Integer deleteAnalysisGreenWaveOptimizeWeekBygreenId(@Param("greenId") Integer greenId);
/**
* 根据主键greenId更新表t_analysis_green_wave_optimize_week信息
* @param analysisGreenWaveOptimizeWeek
*/
Integer updateAnalysisGreenWaveOptimizeWeekBygreenId(AnalysisGreenWaveOptimizeWeek analysisGreenWaveOptimizeWeek);
/**
* 新增表t_analysis_green_wave_optimize_week信息
* @param analysisGreenWaveOptimizeWeek
*/
Integer addAnalysisGreenWaveOptimizeWeek(AnalysisGreenWaveOptimizeWeek analysisGreenWaveOptimizeWeek);
}
package net.wanji.opt.dao.mapper.report;
import net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail;
import java.util.Date;
import java.util.List;
import java.util.Map;
import net.wanji.opt.vo2.report.GreenCongestTimeSpanVO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
/**
* <p>
*
* </p>
*
* @Author fengyi
* @Date 2025-04-07
*/
public interface AnalysisGreenWavePeakDetailMapper extends BaseInterfaceMapper<AnalysisGreenWavePeakDetail> {
List<GreenCongestTimeSpanVO> findCongestTimeSpanInPeakTime(@Param("yearWeek") Integer yearWeek,
@Param("greenId") Integer greenId,
@Param("peakStartTime") Date peakStartTime,
@Param("peakEndTime") Date peakEndTime
);
}
package net.wanji.opt.dto.report;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* @author duanruiming
* @date 2024/11/19 17:48
*/
@Data
public class StrategyGreenOptHistDTO {
@TableField("green_id")
private Integer greenId;
@TableField("length")
private Double length;
@TableField("cycle")
private Integer cycle;
@TableField("control_time")
private String controlTime;
@TableField("control_duration")
private Integer controlDuration;
@TableField("control_method")
private Integer controlMethod;
@TableField("type")
private Integer type;
@TableField("dynamic")
private Integer dynamic;
@TableField("dir_type")
private Integer dirType;
@TableField("dir")
private String dir;
@TableField("max_speed")
private Double maxSpeed;
@TableField("min_speed")
private Double minSpeed;
@TableField("green_width_time")
private Double greenWidthTime;
@TableField("cross_green_detail")
private String crossGreenDetail;
@TableField("key_cross")
private String keyCross;
@TableField("response_code")
private Integer responseCode;
@TableField("response_content")
private String responseContent;
@TableField("duration")
private Integer duration;
}
package net.wanji.opt.entity.report;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("t_analysis_green_wave_optimize_week")
public class AnalysisGreenWaveOptimizeWeek implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "green_id", type = IdType.AUTO)
private Integer greenId;
/**
* 干线车流运行方向 w2e/e2w/s2n/n2s
*/
private String roadDirection;
/**
* 星期几:1~7代表周一至周日
*/
private Integer weekDay;
/**
* 优化时段开始时间
*/
private LocalDateTime optimizeStartTime;
/**
* 优化时段截止时间
*/
private LocalDateTime optimizeEndTime;
/**
* 策略ID
*/
private Integer stragetyId;
/**
* 策略时段内优化次数
*/
private Integer optimizeCount;
/**
* 策略时段内优化总时长,单位秒
*/
private Integer optimizeDuration;
/**
* 通行能力(辆)
*/
private Integer capacity;
/**
* 停车次数
*/
private Double stopTimes;
/**
* 延误时间,单位秒
*/
private Double delayTime;
/**
* 行程时间,单位秒
*/
private Integer travelTime;
/**
* 平均速度,单位km/h
*/
private Double speed;
/**
* 一年中的第几周
*/
private Integer yearWeek;
/**
* 一一年中的第几周,格式yyyyw,如20251
*/
private LocalDateTime weekStartTime;
/**
* 一周的第二天
*/
private LocalDateTime weekEndTime;
/**
* 数据插入时间
*/
private LocalDateTime insertTime;
}
package net.wanji.opt.entity.report;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.wanji.common.framework.domain.TrackableEntity;
import java.util.Date;
import java.math.BigDecimal;
/**
* <p>
*
* </p>
*
* @Author fengyi
* @Date 2025-04-07
*/
@Data
@ApiModel(value="AnalysisGreenWavePeakDetail对象", description="")
public class AnalysisGreenWavePeakDetail extends TrackableEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "干线ID")
private Integer greenId;
@ApiModelProperty(value = "干线车流运行方向 w2e/e2w/s2n/n2s")
private String roadDirection;
@ApiModelProperty(value = "星期几:1~7代表周一至周日")
private Integer weekDay;
@ApiModelProperty(value = "峰期开始时间")
private Date peakStartTime;
@ApiModelProperty(value = "峰期截止时间")
private Date peakEndTime;
@ApiModelProperty(value = "平均拥堵指数")
private Double trafficIndex;
@ApiModelProperty(value = "拥堵类型:2缓行;3拥堵")
private Integer status;
@ApiModelProperty(value = "行程时间,单位秒")
private Integer travelTime;
@ApiModelProperty(value = "平均速度 km/h")
private Double speed;
@ApiModelProperty(value = "车流量")
private Integer flow;
@ApiModelProperty(value = "高峰类型 1早高峰 2晚高峰 3平峰")
private String peakType;
@ApiModelProperty(value = "一年中的第几周,格式yyyyw,如20251")
private Integer yearWeek;
@ApiModelProperty(value = "一周的第一天")
private Date weekStartTime;
@ApiModelProperty(value = "一周的第二天")
private Date weekEndTime;
@ApiModelProperty(value = "数据插入时间")
private Date insertTime;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.judgeanalysis.AiOptimizeStatisticMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
cross_id, strategy, optimize_count, optimize_duration, statistic_time, gmt_create, gmt_modified, type
</sql>
<!-- 通用条件列 -->
<sql id="AiOptimizeStatisticByCondition">
<if test="crossId!=null and crossId!=''">
AND cross_id = #{crossId}
</if>
<if test="strategy!=null and strategy!=''">
AND strategy = #{strategy}
</if>
<if test="optimizeCount!=null and optimizeCount!=''">
AND optimize_count = #{optimizeCount}
</if>
<if test="optimizeDuration!=null and optimizeDuration!=''">
AND optimize_duration = #{optimizeDuration}
</if>
<if test="statisticTime!=null and statisticTime!=''">
AND statistic_time = #{statisticTime}
</if>
<if test="gmtCreate!=null">
AND gmt_create = #{gmtCreate}
</if>
<if test="gmtModified!=null">
AND gmt_modified = #{gmtModified}
</if>
<if test="type!=null and type!=''">
AND type = #{type}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="AiOptimizeStatisticSetColumns">
<if test="strategy!=null and strategy!=''">
strategy = #{strategy},
</if>
<if test="optimizeCount!=null and optimizeCount!=''">
optimize_count = #{optimizeCount},
</if>
<if test="optimizeDuration!=null and optimizeDuration!=''">
optimize_duration = #{optimizeDuration},
</if>
<if test="statisticTime!=null and statisticTime!=''">
statistic_time = #{statisticTime},
</if>
<if test="gmtCreate!=null">
gmt_create = #{gmtCreate},
</if>
<if test="gmtModified!=null">
gmt_modified = #{gmtModified},
</if>
<if test="type!=null and type!=''">
type = #{type},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="AiOptimizeStatisticMap" type="net.wanji.opt.entity.judgeanalysis.AiOptimizeStatistic">
<id column="cross_id" property="crossId"/>
<result column="strategy" property="strategy"/>
<result column="optimize_count" property="optimizeCount"/>
<result column="optimize_duration" property="optimizeDuration"/>
<result column="statistic_time" property="statisticTime"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="type" property="type"/>
</resultMap>
<!-- 查询表t_ai_optimize_statistic所有信息 -->
<select id="findAllAiOptimizeStatistic" resultMap="AiOptimizeStatisticMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_ai_optimize_statistic
</select>
<!-- 根据主键crossId查询表t_ai_optimize_statistic信息 -->
<select id="findAiOptimizeStatisticBycrossId" resultMap="AiOptimizeStatisticMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_ai_optimize_statistic
WHERE cross_id=#{crossId}
</select>
<!-- 根据条件查询表t_ai_optimize_statistic信息 -->
<select id="findAiOptimizeStatisticByCondition" resultMap="AiOptimizeStatisticMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_ai_optimize_statistic
WHERE 1=1
<include refid="AiOptimizeStatisticByCondition" />
</select>
<!-- 根据主键crossId删除表t_ai_optimize_statistic信息 -->
<delete id="deleteAiOptimizeStatisticBycrossId">
DELETE FROM
t_ai_optimize_statistic
WHERE cross_id=#{crossId}
</delete>
<!-- 根据主键crossId更新表t_ai_optimize_statistic信息 -->
<update id="updateAiOptimizeStatisticBycrossId" parameterType="net.wanji.opt.entity.judgeanalysis.AiOptimizeStatistic">
UPDATE t_ai_optimize_statistic
<set>
<include refid="AiOptimizeStatisticSetColumns"/>
</set>
WHERE
cross_id=#{crossId}
</update>
<!-- 新增表t_ai_optimize_statistic信息 -->
<insert id="addAiOptimizeStatistic">
INSERT INTO t_ai_optimize_statistic (
cross_id
,strategy
,optimize_count
,optimize_duration
,statistic_time
,gmt_create
,gmt_modified
,type
) VALUES (
#{crossId}
,#{strategy}
,#{optimizeCount}
,#{optimizeDuration}
,#{statisticTime}
,#{gmtCreate}
,#{gmtModified}
,#{type}
)
</insert>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDirHourMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
id, area_id, event_category, event_type, event_number, event_total_time, window_start_time, window_end_time, cross_id, dir, dt, insert_time
</sql>
<!-- 通用条件列 -->
<sql id="AnalysisProblemCrossDirHourByCondition">
<if test="id!=null and id!=''">
AND id = #{id}
</if>
<if test="areaId!=null and areaId!=''">
AND area_id = #{areaId}
</if>
<if test="eventCategory!=null and eventCategory!=''">
AND event_category = #{eventCategory}
</if>
<if test="eventType!=null and eventType!=''">
AND event_type = #{eventType}
</if>
<if test="eventNumber!=null and eventNumber!=''">
AND event_number = #{eventNumber}
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
AND event_total_time = #{eventTotalTime}
</if>
<if test="windowStartTime!=null">
AND window_start_time = #{windowStartTime}
</if>
<if test="windowEndTime!=null">
AND window_end_time = #{windowEndTime}
</if>
<if test="crossId!=null and crossId!=''">
AND cross_id = #{crossId}
</if>
<if test="dir!=null and dir!=''">
AND dir = #{dir}
</if>
<if test="dt!=null and dt!=''">
AND dt = #{dt}
</if>
<if test="insertTime!=null">
AND insert_time = #{insertTime}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="AnalysisProblemCrossDirHourSetColumns">
<if test="id!=null and id!=''">
id = #{id},
</if>
<if test="areaId!=null and areaId!=''">
area_id = #{areaId},
</if>
<if test="eventCategory!=null and eventCategory!=''">
event_category = #{eventCategory},
</if>
<if test="eventNumber!=null and eventNumber!=''">
event_number = #{eventNumber},
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
event_total_time = #{eventTotalTime},
</if>
<if test="windowStartTime!=null">
window_start_time = #{windowStartTime},
</if>
<if test="windowEndTime!=null">
window_end_time = #{windowEndTime},
</if>
<if test="crossId!=null and crossId!=''">
cross_id = #{crossId},
</if>
<if test="dir!=null and dir!=''">
dir = #{dir},
</if>
<if test="dt!=null and dt!=''">
dt = #{dt},
</if>
<if test="insertTime!=null">
insert_time = #{insertTime},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="AnalysisProblemCrossDirHourMap" type="net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDirHour">
<id column="event_type" property="eventType"/>
<result column="id" property="id"/>
<result column="area_id" property="areaId"/>
<result column="event_category" property="eventCategory"/>
<result column="event_number" property="eventNumber"/>
<result column="event_total_time" property="eventTotalTime"/>
<result column="window_start_time" property="windowStartTime"/>
<result column="window_end_time" property="windowEndTime"/>
<result column="cross_id" property="crossId"/>
<result column="dir" property="dir"/>
<result column="dt" property="dt"/>
<result column="insert_time" property="insertTime"/>
</resultMap>
<!-- 查询表t_analysis_problem_cross_dir_hour所有信息 -->
<select id="findAllAnalysisProblemCrossDirHour" resultMap="AnalysisProblemCrossDirHourMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_cross_dir_hour
</select>
<!-- 根据主键eventType查询表t_analysis_problem_cross_dir_hour信息 -->
<select id="findAnalysisProblemCrossDirHourByeventType" resultMap="AnalysisProblemCrossDirHourMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_cross_dir_hour
WHERE event_type=#{eventType}
</select>
<!-- 根据条件查询表t_analysis_problem_cross_dir_hour信息 -->
<select id="findAnalysisProblemCrossDirHourByCondition" resultMap="AnalysisProblemCrossDirHourMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_cross_dir_hour
WHERE 1=1
<include refid="AnalysisProblemCrossDirHourByCondition" />
</select>
<!-- 根据主键eventType删除表t_analysis_problem_cross_dir_hour信息 -->
<delete id="deleteAnalysisProblemCrossDirHourByeventType">
DELETE FROM
t_analysis_problem_cross_dir_hour
WHERE event_type=#{eventType}
</delete>
<!-- 根据主键eventType更新表t_analysis_problem_cross_dir_hour信息 -->
<update id="updateAnalysisProblemCrossDirHourByeventType" parameterType="net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDirHour">
UPDATE t_analysis_problem_cross_dir_hour
<set>
<include refid="AnalysisProblemCrossDirHourSetColumns"/>
</set>
WHERE
event_type=#{eventType}
</update>
<!-- 新增表t_analysis_problem_cross_dir_hour信息 -->
<insert id="addAnalysisProblemCrossDirHour">
INSERT INTO t_analysis_problem_cross_dir_hour (
id
,area_id
,event_category
,event_type
,event_number
,event_total_time
,window_start_time
,window_end_time
,cross_id
,dir
,dt
,insert_time
) VALUES (
#{id}
,#{areaId}
,#{eventCategory}
,#{eventType}
,#{eventNumber}
,#{eventTotalTime}
,#{windowStartTime}
,#{windowEndTime}
,#{crossId}
,#{dir}
,#{dt}
,#{insertTime}
)
</insert>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemGreenHourMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
id, area_id, event_category, event_type, event_number, event_total_time, window_start_time, window_end_time, green_id, dir, dt, insert_time
</sql>
<!-- 通用条件列 -->
<sql id="AnalysisProblemGreenHourByCondition">
<if test="id!=null and id!=''">
AND id = #{id}
</if>
<if test="areaId!=null and areaId!=''">
AND area_id = #{areaId}
</if>
<if test="eventCategory!=null and eventCategory!=''">
AND event_category = #{eventCategory}
</if>
<if test="eventType!=null and eventType!=''">
AND event_type = #{eventType}
</if>
<if test="eventNumber!=null and eventNumber!=''">
AND event_number = #{eventNumber}
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
AND event_total_time = #{eventTotalTime}
</if>
<if test="windowStartTime!=null">
AND window_start_time = #{windowStartTime}
</if>
<if test="windowEndTime!=null">
AND window_end_time = #{windowEndTime}
</if>
<if test="greenId!=null and greenId!=''">
AND green_id = #{greenId}
</if>
<if test="dir!=null and dir!=''">
AND dir = #{dir}
</if>
<if test="dt!=null and dt!=''">
AND dt = #{dt}
</if>
<if test="insertTime!=null">
AND insert_time = #{insertTime}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="AnalysisProblemGreenHourSetColumns">
<if test="id!=null and id!=''">
id = #{id},
</if>
<if test="areaId!=null and areaId!=''">
area_id = #{areaId},
</if>
<if test="eventCategory!=null and eventCategory!=''">
event_category = #{eventCategory},
</if>
<if test="eventNumber!=null and eventNumber!=''">
event_number = #{eventNumber},
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
event_total_time = #{eventTotalTime},
</if>
<if test="windowStartTime!=null">
window_start_time = #{windowStartTime},
</if>
<if test="windowEndTime!=null">
window_end_time = #{windowEndTime},
</if>
<if test="greenId!=null and greenId!=''">
green_id = #{greenId},
</if>
<if test="dir!=null and dir!=''">
dir = #{dir},
</if>
<if test="dt!=null and dt!=''">
dt = #{dt},
</if>
<if test="insertTime!=null">
insert_time = #{insertTime},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="AnalysisProblemGreenHourMap" type="net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenHour">
<id column="event_type" property="eventType"/>
<result column="id" property="id"/>
<result column="area_id" property="areaId"/>
<result column="event_category" property="eventCategory"/>
<result column="event_number" property="eventNumber"/>
<result column="event_total_time" property="eventTotalTime"/>
<result column="window_start_time" property="windowStartTime"/>
<result column="window_end_time" property="windowEndTime"/>
<result column="green_id" property="greenId"/>
<result column="dir" property="dir"/>
<result column="dt" property="dt"/>
<result column="insert_time" property="insertTime"/>
</resultMap>
<!-- 查询表t_analysis_problem_green_hour所有信息 -->
<select id="findAllAnalysisProblemGreenHour" resultMap="AnalysisProblemGreenHourMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_green_hour
</select>
<!-- 根据主键eventType查询表t_analysis_problem_green_hour信息 -->
<select id="findAnalysisProblemGreenHourByeventType" resultMap="AnalysisProblemGreenHourMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_green_hour
WHERE event_type=#{eventType}
</select>
<!-- 根据条件查询表t_analysis_problem_green_hour信息 -->
<select id="findAnalysisProblemGreenHourByCondition" resultMap="AnalysisProblemGreenHourMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_green_hour
WHERE 1=1
<include refid="AnalysisProblemGreenHourByCondition" />
</select>
<!-- 根据主键eventType删除表t_analysis_problem_green_hour信息 -->
<delete id="deleteAnalysisProblemGreenHourByeventType">
DELETE FROM
t_analysis_problem_green_hour
WHERE event_type=#{eventType}
</delete>
<!-- 根据主键eventType更新表t_analysis_problem_green_hour信息 -->
<update id="updateAnalysisProblemGreenHourByeventType" parameterType="net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenHour">
UPDATE t_analysis_problem_green_hour
<set>
<include refid="AnalysisProblemGreenHourSetColumns"/>
</set>
WHERE
event_type=#{eventType}
</update>
<!-- 新增表t_analysis_problem_green_hour信息 -->
<insert id="addAnalysisProblemGreenHour">
INSERT INTO t_analysis_problem_green_hour (
id
,area_id
,event_category
,event_type
,event_number
,event_total_time
,window_start_time
,window_end_time
,green_id
,dir
,dt
,insert_time
) VALUES (
#{id}
,#{areaId}
,#{eventCategory}
,#{eventType}
,#{eventNumber}
,#{eventTotalTime}
,#{windowStartTime}
,#{windowEndTime}
,#{greenId}
,#{dir}
,#{dt}
,#{insertTime}
)
</insert>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.strategy.StrategyPriorityMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
id, daily_plan_id, week_execute, daily_plan_details, cross_id
</sql>
<!-- 通用条件列 -->
<sql id="StrategyPriorityDailyInfoByCondition">
<if test="id!=null and id!=''">
AND id = #{id}
</if>
<if test="dailyPlanId!=null and dailyPlanId!=''">
AND daily_plan_id = #{dailyPlanId}
</if>
<if test="weekExecute!=null and weekExecute!=''">
AND week_execute = #{weekExecute}
</if>
<if test="dailyPlanDetails!=null and dailyPlanDetails!=''">
AND daily_plan_details = #{dailyPlanDetails}
</if>
<if test="crossId!=null and crossId!=''">
AND cross_id = #{crossId}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="StrategyPriorityDailyInfoSetColumns">
<if test="dailyPlanId!=null and dailyPlanId!=''">
daily_plan_id = #{dailyPlanId},
</if>
<if test="weekExecute!=null and weekExecute!=''">
week_execute = #{weekExecute},
</if>
<if test="dailyPlanDetails!=null and dailyPlanDetails!=''">
daily_plan_details = #{dailyPlanDetails},
</if>
<if test="crossId!=null and crossId!=''">
cross_id = #{crossId},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="StrategyPriorityDailyInfoMap" type="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
<id column="id" property="id"/>
<result column="daily_plan_id" property="dailyPlanId"/>
<result column="week_execute" property="weekExecute"/>
<result column="daily_plan_details" property="dailyPlanDetails"/>
<result column="cross_id" property="crossId"/>
</resultMap>
<!-- 查询表t_strategy_priority_daily_info所有信息 -->
<select id="findAllStrategyPriorityDailyInfo" resultMap="StrategyPriorityDailyInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_strategy_priority_daily_info
</select>
<!-- 根据主键id查询表t_strategy_priority_daily_info信息 -->
<select id="findStrategyPriorityDailyInfoByid" resultMap="StrategyPriorityDailyInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_strategy_priority_daily_info
WHERE id=#{id}
</select>
<!-- 根据条件查询表t_strategy_priority_daily_info信息 -->
<select id="findStrategyPriorityDailyInfoByCondition" resultMap="StrategyPriorityDailyInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_strategy_priority_daily_info
WHERE 1=1
<include refid="StrategyPriorityDailyInfoByCondition" />
</select>
<!-- 根据主键id删除表t_strategy_priority_daily_info信息 -->
<delete id="deleteStrategyPriorityDailyInfoByid">
DELETE FROM
t_strategy_priority_daily_info
WHERE id=#{id}
</delete>
<!-- 根据主键id更新表t_strategy_priority_daily_info信息 -->
<update id="updateStrategyPriorityDailyInfoByid" parameterType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
UPDATE t_strategy_priority_daily_info
<set>
<include refid="StrategyPriorityDailyInfoSetColumns"/>
</set>
WHERE
id=#{id}
</update>
<!-- 新增表t_strategy_priority_daily_info信息 -->
<insert id="addStrategyPriorityDailyInfo">
INSERT INTO t_strategy_priority_daily_info (
id
,daily_plan_id
,week_execute
,daily_plan_details
,cross_id
) VALUES (
#{id}
,#{dailyPlanId}
,#{weekExecute}
,#{dailyPlanDetails}
,#{crossId}
)
</insert>
</mapper>
package net.wanji.opt.servicev2.judgeanalysis;
import net.wanji.opt.controllerv2.report.vo.GreenReportProblemDetailAnalysisResponse;
import net.wanji.opt.controllerv2.report.vo.GreenReportProblemOverallAnalysisResult;
import java.text.ParseException;
import java.util.List;
public interface AnalysisGreenCongestionPeriodService {
public void selectCountByCongestionPeriod() throws ParseException;
GreenReportProblemOverallAnalysisResult selectListByWeek(Integer year, Integer week, String ids);
List<GreenReportProblemDetailAnalysisResponse> getProblemDetail(Integer year, Integer week, String ids);
}
package net.wanji.opt.servicev2.report;
import net.wanji.opt.entity.report.AnalysisGreenWaveOptimizeWeek;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author fengyi
* @since 2025-04-09
*/
public interface AnalysisGreenWaveOptimizeWeekService extends IService<AnalysisGreenWaveOptimizeWeek> {
/**
* 详情
* @param id
* @return
*/
AnalysisGreenWaveOptimizeWeek info(Long id);
/**
* 新增
* @param param 根据需要进行传值
* @return
*/
void add(AnalysisGreenWaveOptimizeWeek param);
/**
* 修改
* @param param 根据需要进行传值
* @return
*/
void modify(AnalysisGreenWaveOptimizeWeek param);
/**
* 删除(单个条目)
* @param id
* @return
*/
void remove(Long id);
/**
* 删除(多个条目)
* @param ids
* @return
*/
void removes(List<Long> ids);
}
package net.wanji.opt.servicev2.report;
import net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.opt.vo2.report.GreenReportRunStateResponseVO;
import java.util.List;
/**
* <p>
*
* </p>
*
* @Author fengyi
* @Date 2025-04-07
*/
public interface AnalysisGreenWavePeakDetailService extends BaseDubboInterface<AnalysisGreenWavePeakDetail> {
public List<GreenReportRunStateResponseVO> selectWeekRunStateSituation(String ids, Integer year, Integer week);
}
package net.wanji.opt.servicev2.report.impl;
import net.wanji.opt.entity.report.AnalysisGreenWaveOptimizeWeek;
import net.wanji.opt.dao.mapper.report.AnalysisGreenWaveOptimizeWeekMapper;
import net.wanji.opt.servicev2.report.AnalysisGreenWaveOptimizeWeekService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author fengyi
* @since 2025-04-09
*/
@Service
public class AnalysisGreenWaveOptimizeWeekServiceImpl extends ServiceImpl<AnalysisGreenWaveOptimizeWeekMapper, AnalysisGreenWaveOptimizeWeek> implements AnalysisGreenWaveOptimizeWeekService {
@Resource
private AnalysisGreenWaveOptimizeWeekMapper analysisGreenWaveOptimizeWeekMapper;
/**
* 详情
* @param id
* @return
*/
@Override
public AnalysisGreenWaveOptimizeWeek info(Long id) {
return getById(id);
}
/**
* 新增
* @param param 根据需要进行传值
* @return
*/
@Override
public void add(AnalysisGreenWaveOptimizeWeek param) {
save(param);
}
/**
* 修改
* @param param 根据需要进行传值
* @return
*/
@Override
public void modify(AnalysisGreenWaveOptimizeWeek param) {
updateById(param);
}
/**
* 删除(单个条目)
* @param id
* @return
*/
@Override
public void remove(Long id) {
removeById(id);
}
/**
* 删除(多个条目)
* @param ids
* @return
*/
@Override
public void removes(List<Long> ids) {
removeByIds(ids);
}
}
package net.wanji.opt.task;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.dao.mapper.GreenwaveHistoryMapper;
import net.wanji.opt.dao.mapper.StrategyGreenOptHistMapper;
import net.wanji.opt.dto.report.StrategyGreenOptHistDTO;
import org.joda.time.DateTime;
import org.joda.time.Seconds;
import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author fengyi
* @date 2023/1/13
* @description
*/
//@Component
@Configurable
@EnableScheduling
@Slf4j
@Profile("!dev")
public class OptimizeStatisticTask {
@Resource
StrategyGreenOptHistMapper strategyGreenOptHistMapper;
@Resource
GreenwaveHistoryMapper historyMapper;
/**
* 干线策略优化时长计算
*/
// @Scheduled(cron查询上周优化记录
public void optimizeGreenWaveDurationCal() {
long st = System.currentTimeMillis();
try {
long et = System.currentTimeMillis();
List<StrategyGreenOptHistDTO> durationList = new ArrayList<>();
List<StrategyGreenOptHistDTO> list = strategyGreenOptHistMapper.findGreenWaveOptHist();
Map<Integer, List<StrategyGreenOptHistDTO>> groupByGreenId = list.stream().collect(Collectors.groupingBy(o -> o.getGreenId()));
for (Map.Entry<Integer, List<StrategyGreenOptHistDTO>> entry : groupByGreenId.entrySet()) {
List<StrategyGreenOptHistDTO> value = entry.getValue();
value = value.stream().sorted(Comparator.comparing(StrategyGreenOptHistDTO::getControlTime)).collect(Collectors.toList());
int i = 0;
for (StrategyGreenOptHistDTO result : value) {
int seconds = 900;
if (i != value.size() - 1) {
if (value.get(i + 1).getControlMethod() == -1) {
//下一条记录为取消状态,当前取消时间-上次下方时间
seconds = Seconds.secondsBetween(new DateTime(result.getControlTime()), new DateTime(value.get(i + 1).getControlTime())).getSeconds();
//超过设定的ControlDuration取ControlDuration
if (seconds > result.getControlDuration()) {
seconds = result.getControlDuration();
}
//log.info("greenId={}:干线绿波方案持续时间计算,下一条记录为取消状态 开始时间:{},截止时间:{},持续时长:{}秒",
// result.getGreenId(),
// new DateTime(result.getControlTime()).toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")),
// new DateTime(value.get(i + 1).getControlTime()).toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")),
// seconds);
} else if(result.getControlMethod() != -1) {
//两条记录之前没有取消状态,取ControlDuration
seconds = result.getControlDuration();
//log.info("greenId={}:干线绿波方案持续时间计算,两条记录之前没有取消状态 开始时间:{},截止时间:{},持续时长:{}秒",
// result.getGreenId(),
// new DateTime(result.getControlTime()).toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")),
// new DateTime(value.get(i + 1).getControlTime()).toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")),
// seconds);
}
} else if (result.getControlMethod() != -1) {
//最后一天记录不为-1取消状态
seconds = Seconds.secondsBetween(new DateTime(result.getControlTime()), new DateTime(new Date())).getSeconds();
if (seconds > result.getControlDuration()) {
seconds = result.getControlDuration();
}
//log.info("greenId={}:干线绿波方案持续时间计算,最后一天记录不为取消状态 开始时间:{},截止时间:{},持续时长:{}秒",
// result.getGreenId(),
// new DateTime(result.getControlTime()).toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")),
// new DateTime(new Date()).toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")),
// seconds);
}
result.setDuration(seconds);
//优化控制时段-开始时间
String controlStartTime = result.getControlTime();
//优化控制时段-截止时间
String controlEndTime = new DateTime(result.getControlTime()).plusSeconds(seconds).toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"));
durationList.add(result);
i++;
}
}
if (!durationList.isEmpty()) {
}
log.info("更新干线策略持续时间据耗时:{}ms,size:{}", et - st, durationList.size());
} catch (Exception e) {
log.error("", e);
}
}
}
package net.wanji.opt.vo2.report;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class GreenCongestTimeSpanVO {
@ApiModelProperty(value = "拥堵开始时间" )
private Date congestStartTime;
@ApiModelProperty(value = "拥堵截止时间" )
private Date congestEndTime;
}
package net.wanji.opt.vo2.report;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.common.utils.tool.DateUtil;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Data
public class GreenReportRunStateResponseVO {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "本周早高峰时段集中情况", example = "7:30~8:30")
private String weekAmPeakSpan;
@ApiModelProperty(value = "本周早高峰时段开始时间同比(上周)情况", example = "提前20分钟")
private String amStartSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段截止时间同比(上周)情况", example = "延后20分钟")
private String amEndSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段持续时长", example = "45分钟")
private String amDuration;
@ApiModelProperty(value = "本周早高峰时段持续时长同比(上周)情况", example = "增加5分钟")
private String amDurationSameRatioSituation;
@ApiModelProperty(value = "本周早高峰最大行程时间", example = "30分钟")
private String amMaxTravelTime;
@ApiModelProperty(value = "本周早高峰最大行程时间同比(上周)情况", example = "减少6分钟")
private String amMaxTravelTimeSameRatioSituation;
@ApiModelProperty(value = "平均拥堵指数", example = "4.5")
private String amAvgContestIndex;
@ApiModelProperty(value = "平均拥堵指数同比(上周)情况", example = "减少0.5")
private String amAvgContestIndexSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段集中情况", example = "7:30~8:30")
private String weekPmPeakSpan;
@ApiModelProperty(value = "本周早高峰时段开始时间同比(上周)情况", example = "提前20分钟")
private String pmStartSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段截止时间同比(上周)情况", example = "延后20分钟")
private String pmEndSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段持续时长", example = "45分钟")
private String pmDuration;
@ApiModelProperty(value = "本周早高峰时段持续时长同比(上周)情况", example = "增加5分钟")
private String pmDurationSameRatioSituation;
@ApiModelProperty(value = "本周早高峰最大行程时间", example = "30分钟")
private String pmMaxTravelTime;
@ApiModelProperty(value = "本周早高峰最大行程时间同比(上周)情况", example = "减少6分钟")
private String pmMaxTravelTimeSameRatioSituation;
@ApiModelProperty(value = "平均拥堵指数", example = "4.5")
private String pmAvgContestIndex;
@ApiModelProperty(value = "平均拥堵指数同比(上周)情况", example = "减少0.5")
private String pmAvgContestIndexSameRatioSituation;
@ApiModelProperty(value = "本周峰期最早开始时间")
@JSONField(format = "yyyy-MM-dd HH:mm:ss",serialize = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date thisWeekPeakEarliestStartTime;
@ApiModelProperty(value = "本周峰期最晚截止时间")
@JSONField(format = "yyyy-MM-dd HH:mm:ss",serialize = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date thisWeekPeakLatestEndTime;
@ApiModelProperty(value = "上周峰期最早开始时间")
@JSONField(format = "yyyy-MM-dd HH:mm:ss",serialize = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date lastWeekPeakEarliestStartTime;
@ApiModelProperty(value = "上周峰期最晚截止时间")
@JSONField(format = "yyyy-MM-dd HH:mm:ss",serialize = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date lastWeekPeakLatestEndTime;
private List<GreenReportRunStatedDataVO> dataList = new ArrayList<>();
}
package net.wanji.opt.vo2.report;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GreenReportRunStatedDataVO {
@ApiModelProperty(value = "星期", example = "星期一")
private String weekName;
@ApiModelProperty(value = "峰期类型 早高峰、晚高峰、平峰、全天", example = "早高峰")
private String peakName;
@ApiModelProperty(value = "本周拥堵时段", example = "7:35~8:40")
private String thisWeekCongestSpan;
@ApiModelProperty(value = "上周拥堵时段", example = "7:50~8:40")
private String lastWeekCongestSpan;
@ApiModelProperty(value = "本周拥堵指数", example = "3.5")
private Double thisWeekCongestIndex;
@ApiModelProperty(value = "上周拥堵指数", example = "3.0")
private Double lastWeekCongestIndex;
@ApiModelProperty(value = "本周平均车速km/h", example = "30.5")
private Double thisWeekAvgSpeed;
@ApiModelProperty(value = "上周平均车速km", example = "30.2")
private Double lastWeekAvgSpeed;
@ApiModelProperty(value = "本周行程时间(分钟)", example = "6.5")
private Double thisWeekTravelTime;
@ApiModelProperty(value = "上周行程时间(分钟)", example = "8.5")
private Double lastWeekTravelTime;
@ApiModelProperty(value = "峰期时段", example = "7:35~8:40")
private String thisWeekDayPeakSpan;
@ApiModelProperty(value = "上周拥堵时段", example = "7:50~8:40")
private String lastWeekDayPeakSpan;
}
......@@ -4,30 +4,62 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.StrategyGreenOptHistMapper">
<select id="selectByGreenId" resultType="net.wanji.opt.po.StrategyGreenOptHistEntity" parameterType="String" >
select * from t_strategy_green_opt_hist a
inner join (
-- 先查询出最后一条数据的时间
select `green_id`, MAX(`control_time`) control_time from t_strategy_green_opt_hist group by `green_id`
) b on a.`green_id` = b.`green_id` and a.`control_time` = b.`control_time`
and a.`green_id` = #{greenId} and a.`control_method` = 1
and TIMESTAMPDIFF(SECOND,a.`control_time`, now()) &lt; a.`control_duration`
<select id="selectByGreenId" resultType="net.wanji.opt.po.StrategyGreenOptHistEntity" parameterType="String">
select *
from t_strategy_green_opt_hist a
inner join (
-- 先查询出最后一条数据的时间
select `green_id`, MAX(`control_time`) control_time from t_strategy_green_opt_hist group by `green_id`
) b on a.`green_id` = b.`green_id` and a.`control_time` = b.`control_time`
and a.`green_id` = #{greenId} and a.`control_method` = 1
and TIMESTAMPDIFF(SECOND,a.`control_time`, now()) &lt; a.`control_duration`
</select>
<!-- 查询绿波优化记录表当天结束的绿波-->
<select id="selectGreenOptEndTimeEquipCode" resultType="net.wanji.opt.dto.induce.MessageParam">
select t1.green_id as greenId, t1.control_time as endTime, t2.equip_code as equipCode, t2.id as induceId, t2.source_id as sourceId from
(select green_id, max(control_time) control_time from t_strategy_green_opt_hist t1 where control_time > CURDATE() and control_method = -1 group by green_id) t1
left join t_greenwave_induces t2 on t1.green_id = t2.green_id
select t1.green_id as greenId,
t1.control_time as endTime,
t2.equip_code as equipCode,
t2.id as induceId,
t2.source_id as sourceId
from (select green_id, max(control_time) control_time
from t_strategy_green_opt_hist t1
where control_time > CURDATE()
and control_method = -1
group by green_id) t1
left join t_greenwave_induces t2 on t1.green_id = t2.green_id
</select>
<!-- 查询最新的绿波优化记录列表 -->
<select id="selectLastGreenOptResultList" resultType="net.wanji.opt.vo2.dto.GreenLastOptResultDTO">
select t2.green_id as greenId, DATE_FORMAT(t2.control_time, '%Y-%m-%d %H:%i:%s') as optTime,
t2.control_duration as duration,
t2.response_code as responseCode, t2.control_method as controlMethod
from (select max(id) id, green_id from t_strategy_green_opt_hist where control_time > curdate() group by green_id) t1
inner join t_strategy_green_opt_hist t2 on t1.id = t2.id and t1.green_id = t2.green_id
select t2.green_id as greenId,
DATE_FORMAT(t2.control_time, '%Y-%m-%d %H:%i:%s') as optTime,
t2.control_duration as duration,
t2.response_code as responseCode,
t2.control_method as controlMethod
from (select max(id) id, green_id
from t_strategy_green_opt_hist
where control_time > curdate()
group by green_id) t1
inner join t_strategy_green_opt_hist t2 on t1.id = t2.id and t1.green_id = t2.green_id
</select>
<!-- 查询上周优化记录 -->
<select id="findGreenWaveOptHist" resultType="net.wanji.opt.dto.report.StrategyGreenOptHistDTO">
SELECT a.green_id,
a.control_time,
a.control_duration,
a.control_method,
min(DATE_SUB(CURDATE(), INTERVAL (WEEKDAY(CURDATE()) + 7) DAY)) week_start_day,
max(DATE_SUB(CURDATE(), INTERVAL (WEEKDAY(CURDATE()) ) +1 DAY)) week_end_day,
(week(control_time)+1) year_week,
(WEEKDAY(control_time)+1) week_day
FROM t_strategy_green_opt_hist a
WHERE control_time >= DATE_SUB(CURDATE(), INTERVAL (WEEKDAY(CURDATE()) + 7) DAY)
and control_time &lt; DATE_SUB(CURDATE(), INTERVAL (WEEKDAY(CURDATE()) ) DAY)
and control_method in (-1, 1)
group by green_id, control_time, control_duration, control_method
ORDER BY green_id,control_time
</select>
</mapper>
\ No newline at end of file
......@@ -15,6 +15,10 @@
and a.green_id is not null
order by a.green_id,a.road_direction,a.start_time
</select>
<select id="selectListByWeek"
resultType="net.wanji.opt.controllerv2.report.vo.AnalysisGreenCongestionPeriodVO">
select * from t_analysis_green_wave_congest_time_span where year_week = #{yearWeek}
</select>
<insert id="insertGreenCongestionPeriodData" parameterType="map">
insert into t_analysis_green_wave_congest_time_span (green_id,road_direction,week_day,congest_start_time,congest_end_time,congest_index,status,travel_time,speed,peak_type,year_week,week_start_time,week_end_time,insert_time)
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.report.AnalysisGreenWaveOptimizeWeekMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
green_id, road_direction, week_day, optimize_start_time, optimize_end_time, stragety_id, optimize_count, optimize_duration, capacity, stop_times, delay_time, travel_time, speed, year_week, week_start_time, week_end_time, insert_time
</sql>
<!-- 通用条件列 -->
<sql id="AnalysisGreenWaveOptimizeWeekByCondition">
<if test="greenId!=null and greenId!=''">
AND green_id = #{greenId}
</if>
<if test="roadDirection!=null and roadDirection!=''">
AND road_direction = #{roadDirection}
</if>
<if test="weekDay!=null and weekDay!=''">
AND week_day = #{weekDay}
</if>
<if test="optimizeStartTime!=null">
AND optimize_start_time = #{optimizeStartTime}
</if>
<if test="optimizeEndTime!=null">
AND optimize_end_time = #{optimizeEndTime}
</if>
<if test="stragetyId!=null and stragetyId!=''">
AND stragety_id = #{stragetyId}
</if>
<if test="optimizeCount!=null and optimizeCount!=''">
AND optimize_count = #{optimizeCount}
</if>
<if test="optimizeDuration!=null and optimizeDuration!=''">
AND optimize_duration = #{optimizeDuration}
</if>
<if test="capacity!=null and capacity!=''">
AND capacity = #{capacity}
</if>
<if test="stopTimes!=null and stopTimes!=''">
AND stop_times = #{stopTimes}
</if>
<if test="delayTime!=null and delayTime!=''">
AND delay_time = #{delayTime}
</if>
<if test="travelTime!=null and travelTime!=''">
AND travel_time = #{travelTime}
</if>
<if test="speed!=null and speed!=''">
AND speed = #{speed}
</if>
<if test="yearWeek!=null and yearWeek!=''">
AND year_week = #{yearWeek}
</if>
<if test="weekStartTime!=null">
AND week_start_time = #{weekStartTime}
</if>
<if test="weekEndTime!=null">
AND week_end_time = #{weekEndTime}
</if>
<if test="insertTime!=null">
AND insert_time = #{insertTime}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="AnalysisGreenWaveOptimizeWeekSetColumns">
<if test="roadDirection!=null and roadDirection!=''">
road_direction = #{roadDirection},
</if>
<if test="weekDay!=null and weekDay!=''">
week_day = #{weekDay},
</if>
<if test="optimizeStartTime!=null">
optimize_start_time = #{optimizeStartTime},
</if>
<if test="optimizeEndTime!=null">
optimize_end_time = #{optimizeEndTime},
</if>
<if test="stragetyId!=null and stragetyId!=''">
stragety_id = #{stragetyId},
</if>
<if test="optimizeCount!=null and optimizeCount!=''">
optimize_count = #{optimizeCount},
</if>
<if test="optimizeDuration!=null and optimizeDuration!=''">
optimize_duration = #{optimizeDuration},
</if>
<if test="capacity!=null and capacity!=''">
capacity = #{capacity},
</if>
<if test="stopTimes!=null and stopTimes!=''">
stop_times = #{stopTimes},
</if>
<if test="delayTime!=null and delayTime!=''">
delay_time = #{delayTime},
</if>
<if test="travelTime!=null and travelTime!=''">
travel_time = #{travelTime},
</if>
<if test="speed!=null and speed!=''">
speed = #{speed},
</if>
<if test="yearWeek!=null and yearWeek!=''">
year_week = #{yearWeek},
</if>
<if test="weekStartTime!=null">
week_start_time = #{weekStartTime},
</if>
<if test="weekEndTime!=null">
week_end_time = #{weekEndTime},
</if>
<if test="insertTime!=null">
insert_time = #{insertTime},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="AnalysisGreenWaveOptimizeWeekMap" type="net.wanji.opt.entity.report.AnalysisGreenWaveOptimizeWeek">
<id column="green_id" property="greenId"/>
<result column="road_direction" property="roadDirection"/>
<result column="week_day" property="weekDay"/>
<result column="optimize_start_time" property="optimizeStartTime"/>
<result column="optimize_end_time" property="optimizeEndTime"/>
<result column="stragety_id" property="stragetyId"/>
<result column="optimize_count" property="optimizeCount"/>
<result column="optimize_duration" property="optimizeDuration"/>
<result column="capacity" property="capacity"/>
<result column="stop_times" property="stopTimes"/>
<result column="delay_time" property="delayTime"/>
<result column="travel_time" property="travelTime"/>
<result column="speed" property="speed"/>
<result column="year_week" property="yearWeek"/>
<result column="week_start_time" property="weekStartTime"/>
<result column="week_end_time" property="weekEndTime"/>
<result column="insert_time" property="insertTime"/>
</resultMap>
<!-- 查询表t_analysis_green_wave_optimize_week所有信息 -->
<select id="findAllAnalysisGreenWaveOptimizeWeek" resultMap="AnalysisGreenWaveOptimizeWeekMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_green_wave_optimize_week
</select>
<!-- 根据主键greenId查询表t_analysis_green_wave_optimize_week信息 -->
<select id="findAnalysisGreenWaveOptimizeWeekBygreenId" resultMap="AnalysisGreenWaveOptimizeWeekMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_green_wave_optimize_week
WHERE green_id=#{greenId}
</select>
<!-- 根据条件查询表t_analysis_green_wave_optimize_week信息 -->
<select id="findAnalysisGreenWaveOptimizeWeekByCondition" resultMap="AnalysisGreenWaveOptimizeWeekMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_green_wave_optimize_week
WHERE 1=1
<include refid="AnalysisGreenWaveOptimizeWeekByCondition" />
</select>
<!-- 根据主键greenId删除表t_analysis_green_wave_optimize_week信息 -->
<delete id="deleteAnalysisGreenWaveOptimizeWeekBygreenId">
DELETE FROM
t_analysis_green_wave_optimize_week
WHERE green_id=#{greenId}
</delete>
<!-- 根据主键greenId更新表t_analysis_green_wave_optimize_week信息 -->
<update id="updateAnalysisGreenWaveOptimizeWeekBygreenId" parameterType="net.wanji.opt.entity.report.AnalysisGreenWaveOptimizeWeek">
UPDATE t_analysis_green_wave_optimize_week
<set>
<include refid="AnalysisGreenWaveOptimizeWeekSetColumns"/>
</set>
WHERE
green_id=#{greenId}
</update>
<!-- 新增表t_analysis_green_wave_optimize_week信息 -->
<insert id="addAnalysisGreenWaveOptimizeWeek">
INSERT INTO t_analysis_green_wave_optimize_week (
green_id
,road_direction
,week_day
,optimize_start_time
,optimize_end_time
,stragety_id
,optimize_count
,optimize_duration
,capacity
,stop_times
,delay_time
,travel_time
,speed
,year_week
,week_start_time
,week_end_time
,insert_time
) VALUES (
#{greenId}
,#{roadDirection}
,#{weekDay}
,#{optimizeStartTime}
,#{optimizeEndTime}
,#{stragetyId}
,#{optimizeCount}
,#{optimizeDuration}
,#{capacity}
,#{stopTimes}
,#{delayTime}
,#{travelTime}
,#{speed}
,#{yearWeek}
,#{weekStartTime}
,#{weekEndTime}
,#{insertTime}
)
</insert>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.report.AnalysisGreenWavePeakDetailMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail">
<id column="green_id" property="greenId" />
<result column="road_direction" property="roadDirection" />
<result column="week_day" property="weekDay" />
<result column="peak_start_time" property="peakStartTime" />
<result column="peak_end_time" property="peakEndTime" />
<result column="traffic_index" property="trafficIndex" />
<result column="status" property="status" />
<result column="travel_time" property="travelTime" />
<result column="speed" property="speed" />
<result column="flow" property="flow" />
<result column="peak_type" property="peakType" />
<result column="year_week" property="yearWeek" />
<result column="week_start_time" property="weekStartTime" />
<result column="week_end_time" property="weekEndTime" />
<result column="insert_time" property="insertTime" />
</resultMap>
<sql id="Table_Name">
t_analysis_green_wave_peak_detail
</sql>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
green_id, road_direction, week_day, peak_start_time, peak_end_time, traffic_index, status, travel_time, speed, flow, peak_type, year_week, week_start_time, week_end_time, insert_time
</sql>
<!-- 查询峰期内拥堵时段 -->
<select id="findCongestTimeSpanInPeakTime" resultType="net.wanji.opt.vo2.report.GreenCongestTimeSpanVO">
select congest_start_time,congest_end_time
from t_analysis_green_wave_congest_time_span
where
year_week=#{yearWeek} and green_id=#{greenId}
and congest_start_time > #{peakStartTime} and congest_end_time &lt; #{peakEndTime}
<!-- and status=3 -->
</select>
<!--新增操作 -->
<insert id="save" parameterType="net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail">
insert into
<include refid="Table_Name"/>
(<include refid="Base_Column_List"/>)
values(
#{greenId}
,#{roadDirection}
,#{weekDay}
,#{peakStartTime}
,#{peakEndTime}
,#{trafficIndex}
,#{status}
,#{travelTime}
,#{speed}
,#{flow}
,#{peakType}
,#{yearWeek}
,#{weekStartTime}
,#{weekEndTime}
,#{insertTime}
)
</insert>
<!--根据ID查询-->
<select id="findById" resultMap="BaseResultMap" parameterType="String">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
where id = #{id}
</select>
<!--获取数据总数-->
<select id="getCount" parameterType="java.util.Map" resultType="int">
select count(*) from
<include refid="Table_Name"/>
where 1=1
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</select>
<!-- 查询所有数据-->
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!-- 通过条件查询所有数据-->
<select id="findByMap" parameterType="java.util.Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
<if test="greenIdList != null and greenIdList.size() > 0">
AND green_id IN
<foreach collection="greenIdList" item="greenId" open="(" close=")" separator=",">
#{greenId}
</foreach>
</if>
</where>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!--分组分页查询-->
<select id="findByPage" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
limit #{startRowNum}, #{pageSize}
</select>
<!--更新-->
<update id="update" parameterType="net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail">
update
<include refid="Table_Name"/>
<include refid="sql_update"/>
where
green_id = #{greenId}
</update>
<!--根据ID删除-->
<delete id="deleteById" parameterType="String">
delete from
<include refid="Table_Name"/>
where
green_id = #{greenId}
</delete>
<sql id="fuzzySearch">
<if test="keyword != null and keyword !=''">
and (locate(#{keyword,jdbcType=VARCHAR}, s_name)>0
)
</if>
</sql>
<sql id="sql_query">
<if test="greenId != null and greenId != '' ">
<![CDATA[ and green_id = #{greenId}]]>
</if>
<if test="roadDirection != null and roadDirection != '' ">
<![CDATA[ and road_direction = #{roadDirection}]]>
</if>
<if test="weekDay != null and weekDay != '' ">
<![CDATA[ and week_day = #{weekDay}]]>
</if>
<if test="peakStartTime != null and peakStartTime != '' ">
<![CDATA[ and peak_start_time = #{peakStartTime}]]>
</if>
<if test="peakEndTime != null and peakEndTime != '' ">
<![CDATA[ and peak_end_time = #{peakEndTime}]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ and traffic_index = #{trafficIndex}]]>
</if>
<if test="status != null and status != '' ">
<![CDATA[ and status = #{status}]]>
</if>
<if test="travelTime != null and travelTime != '' ">
<![CDATA[ and travel_time = #{travelTime}]]>
</if>
<if test="speed != null and speed != '' ">
<![CDATA[ and speed = #{speed}]]>
</if>
<if test="flow != null and flow != '' ">
<![CDATA[ and flow = #{flow}]]>
</if>
<if test="peakType != null and peakType != '' ">
<![CDATA[ and peak_type = #{peakType}]]>
</if>
<if test="yearWeek != null and yearWeek != '' ">
<![CDATA[ and year_week = #{yearWeek}]]>
</if>
<if test="weekStartTime != null and weekStartTime != '' ">
<![CDATA[ and week_start_time = #{weekStartTime}]]>
</if>
<if test="weekEndTime != null and weekEndTime != '' ">
<![CDATA[ and week_end_time = #{weekEndTime}]]>
</if>
<if test="insertTime != null and insertTime != '' ">
<![CDATA[ and insert_time = #{insertTime}]]>
</if>
</sql>
<!--更新操作-->
<sql id="sql_update">
<set>
<if test="greenId != null and greenId != '' ">
<![CDATA[ green_id = #{greenId}, ]]>
</if>
<if test="roadDirection != null and roadDirection != '' ">
<![CDATA[ road_direction = #{roadDirection}, ]]>
</if>
<if test="weekDay != null and weekDay != '' ">
<![CDATA[ week_day = #{weekDay}, ]]>
</if>
<if test="peakStartTime != null and peakStartTime != '' ">
<![CDATA[ peak_start_time = #{peakStartTime}, ]]>
</if>
<if test="peakEndTime != null and peakEndTime != '' ">
<![CDATA[ peak_end_time = #{peakEndTime}, ]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ traffic_index = #{trafficIndex}, ]]>
</if>
<if test="status != null and status != '' ">
<![CDATA[ status = #{status}, ]]>
</if>
<if test="travelTime != null and travelTime != '' ">
<![CDATA[ travel_time = #{travelTime}, ]]>
</if>
<if test="speed != null and speed != '' ">
<![CDATA[ speed = #{speed}, ]]>
</if>
<if test="flow != null and flow != '' ">
<![CDATA[ flow = #{flow}, ]]>
</if>
<if test="peakType != null and peakType != '' ">
<![CDATA[ peak_type = #{peakType}, ]]>
</if>
<if test="yearWeek != null and yearWeek != '' ">
<![CDATA[ year_week = #{yearWeek}, ]]>
</if>
<if test="weekStartTime != null and weekStartTime != '' ">
<![CDATA[ week_start_time = #{weekStartTime}, ]]>
</if>
<if test="weekEndTime != null and weekEndTime != '' ">
<![CDATA[ week_end_time = #{weekEndTime}, ]]>
</if>
<if test="insertTime != null and insertTime != '' ">
<![CDATA[ insert_time = #{insertTime}, ]]>
</if>
</set>
</sql>
</mapper>
......@@ -262,7 +262,7 @@
<select id="getParamConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT
id,strategy_no,cross_id,param_details
id,strategy_no,cross_id,param_details,scheduling_param
FROM
t_strategy_priority_parameter
WHERE
......
package net.wanji.opt.controllerv2.judgeanalysis;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.rest.impl.AbstractRestServerImpl;
import net.wanji.opt.servicev2.judgeanalysis.BaseAreaInfoService;
import net.wanji.opt.entity.judgeanalysis.BaseAreaInfo;
import net.wanji.common.framework.rest.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiImplicitParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
* 区域基础信息 接口API
* </p>
* @version 1.0
* @author wangtao
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/base-area-info")
@Api(value="BaseAreaInfoController", description="区域基础信息接口", tags = "区域基础信息")
public class BaseAreaInfoController extends AbstractRestServerImpl<BaseAreaInfo> implements AbstractRestServer<BaseAreaInfo>{
@Autowired
private BaseAreaInfoService baseAreaInfoService;
@Override
public BaseAreaInfoService getBaseDubboInterface() {
return this.baseAreaInfoService;
}
/**
* 获取所有区域基础信息记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "区域基础信息-获取所有记录", notes = "获取所有区域基础信息记录", response = BaseAreaInfo.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getAll() {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
List<BaseAreaInfo> list = this.getBaseDubboInterface().findAll();
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据id查询区域基础信息记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "区域基础信息-根据id查询记录", notes = "根据id查询区域基础信息记录", response = BaseAreaInfo.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getById(@PathVariable String id) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
BaseAreaInfo entity = this.getBaseDubboInterface().findById(id);
jsonView.success(entity);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
@ApiOperation(value = "区域基础信息-根据条件查询记录", notes = "根据条件查询记录", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getByWhere(@RequestBody BaseAreaInfo entity) {
return super.getByWhere(entity);
}
@ApiOperation(value = "区域基础信息-根据条件分页查询记录", notes = "根据条件分页查询记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/byPage", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ResponseBody
public JsonViewObject getPage(@RequestBody Page<BaseAreaInfo> page){
return super.getPage(page);
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "区域基础信息-根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON ,hidden = true)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
public JsonViewObject deleteByIds(String ids) {
return super.deleteByIds(ids);
}
/**
* 新建记录
*
* @param entity
* @return JsonViewObject
*/
@ApiOperation(value = "区域基础信息-新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject save( @RequestBody BaseAreaInfo entity){
return super.save(entity);
}
/**
* 修改记录
*
* @param entity
* @return
*/
@ApiOperation(value = "区域基础信息-修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject update(@RequestBody BaseAreaInfo entity){
return super.update(entity);
}
}
package net.wanji.opt.controllerv2.report;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.rest.impl.AbstractRestServerImpl;
import net.wanji.opt.servicev2.report.AnalysisGreenWavePeakDetailService;
import net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail;
import net.wanji.common.framework.rest.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiImplicitParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
* 接口API
* </p>
* @version 1.0
* @author fengyi
* @Date 2025-04-07
*/
@RestController
@Slf4j
@RequestMapping("/analysis-green-wave-peak-detail")
@Api(value="AnalysisGreenWavePeakDetailController", description="接口", tags = "")
public class AnalysisGreenWavePeakDetailController extends AbstractRestServerImpl<AnalysisGreenWavePeakDetail> implements AbstractRestServer<AnalysisGreenWavePeakDetail>{
@Autowired
private AnalysisGreenWavePeakDetailService analysisGreenWavePeakDetailService;
@Override
public AnalysisGreenWavePeakDetailService getBaseDubboInterface() {
return this.analysisGreenWavePeakDetailService;
}
/**
* 获取所有记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "-获取所有记录", notes = "获取所有记录", response = AnalysisGreenWavePeakDetail.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getAll() {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
List<AnalysisGreenWavePeakDetail> list = this.getBaseDubboInterface().findAll();
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据id查询记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "-根据id查询记录", notes = "根据id查询记录", response = AnalysisGreenWavePeakDetail.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getById(@PathVariable String id) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
AnalysisGreenWavePeakDetail entity = this.getBaseDubboInterface().findById(id);
jsonView.success(entity);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
@ApiOperation(value = "-根据条件查询记录", notes = "根据条件查询记录", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getByWhere(@RequestBody AnalysisGreenWavePeakDetail entity) {
return super.getByWhere(entity);
}
@ApiOperation(value = "-根据条件分页查询记录", notes = "根据条件分页查询记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/byPage", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ResponseBody
public JsonViewObject getPage(@RequestBody Page<AnalysisGreenWavePeakDetail> page){
return super.getPage(page);
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "-根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON ,hidden = true)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
public JsonViewObject deleteByIds(String ids) {
return super.deleteByIds(ids);
}
/**
* 新建记录
*
* @param entity
* @return JsonViewObject
*/
@ApiOperation(value = "-新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject save( @RequestBody AnalysisGreenWavePeakDetail entity){
return super.save(entity);
}
/**
* 修改记录
*
* @param entity
* @return
*/
@ApiOperation(value = "-修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject update(@RequestBody AnalysisGreenWavePeakDetail entity){
return super.update(entity);
}
}
package net.wanji.opt.dao.mapper.judgeanalysis;
import net.wanji.opt.entity.judgeanalysis.BaseAreaInfo;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
/**
* <p>
* 区域基础信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
public interface BaseAreaInfoMapper extends BaseInterfaceMapper<BaseAreaInfo> {
}
package net.wanji.opt.dao.mapper.report;
import net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
/**
* <p>
*
* </p>
*
* @Author fengyi
* @Date 2025-04-07
*/
public interface AnalysisGreenWavePeakDetailMapper extends BaseInterfaceMapper<AnalysisGreenWavePeakDetail> {
}
package net.wanji.opt.entity.judgeanalysis;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.wanji.common.framework.domain.TrackableEntity;
import java.util.Date;
import java.math.BigDecimal;
/**
* <p>
* 区域基础信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
@Data
@ApiModel(value="BaseAreaInfo对象", description="区域基础信息")
public class BaseAreaInfo extends TrackableEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "行政区划代码")
private Long code;
@ApiModelProperty(value = "行政区划名称")
private String name;
@ApiModelProperty(value = "道路名称")
private String roadName;
@ApiModelProperty(value = "区划类型:1行政区划;2交警辖区;3商圈;4交通小区;5热点区域;6道路")
private Integer type;
@ApiModelProperty(value = "父节点")
private Integer parentCode;
@ApiModelProperty(value = "区域中心点")
private String location;
@ApiModelProperty(value = "区域边界")
private String polylines;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建时间")
private Date gmtCreate;
@ApiModelProperty(value = "修改时间")
private Date gmtModified;
}
package net.wanji.opt.entity.report;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.wanji.common.framework.domain.TrackableEntity;
import java.util.Date;
import java.math.BigDecimal;
/**
* <p>
*
* </p>
*
* @Author fengyi
* @Date 2025-04-07
*/
@Data
@ApiModel(value="AnalysisGreenWavePeakDetail对象", description="")
public class AnalysisGreenWavePeakDetail extends TrackableEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "干线ID")
private Integer greenId;
@ApiModelProperty(value = "干线车流运行方向 w2e/e2w/s2n/n2s")
private String roadDirection;
@ApiModelProperty(value = "星期几:1~7代表周一至周日")
private Integer weekDay;
@ApiModelProperty(value = "峰期开始时间")
private Date peakStartTime;
@ApiModelProperty(value = "峰期截止时间")
private Date peakEndTime;
@ApiModelProperty(value = "平均拥堵指数")
private Double congestIndex;
@ApiModelProperty(value = "拥堵类型:2缓行;3拥堵")
private Integer status;
@ApiModelProperty(value = "行程时间,单位秒")
private Integer travelTime;
@ApiModelProperty(value = "平均速度 km/h")
private Double speed;
@ApiModelProperty(value = "车流量")
private Integer flow;
@ApiModelProperty(value = "高峰类型 1早高峰 2晚高峰 3平峰")
private String peakType;
@ApiModelProperty(value = "一年中的第几周,格式yyyyw,如20251")
private Integer yearWeek;
@ApiModelProperty(value = "一周的第一天")
private Date weekStartTime;
@ApiModelProperty(value = "一周的第二天")
private Date weekEndTime;
@ApiModelProperty(value = "数据插入时间")
private Date insertTime;
}
package net.wanji.opt.servicev2.judgeanalysis;
import net.wanji.opt.entity.judgeanalysis.BaseAreaInfo;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
/**
* <p>
* 区域基础信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
public interface BaseAreaInfoService extends BaseDubboInterface<BaseAreaInfo> {
}
package net.wanji.opt.servicev2.judgeanalysis.impl;
import net.wanji.common.framework.dubbointerface.impl.BaseDubboInterfaceImpl;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.judgeanalysis.BaseAreaInfo;
import net.wanji.opt.servicev2.judgeanalysis.BaseAreaInfoService;
import net.wanji.opt.dao.mapper.judgeanalysis.BaseAreaInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* <p>
* 区域基础信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
@Slf4j
@Component
@Service
public class BaseAreaInfoServiceImpl extends BaseDubboInterfaceImpl<BaseAreaInfo> implements BaseAreaInfoService {
@Resource
private BaseAreaInfoMapper baseAreaInfoMapper;
@Override
public BaseInterfaceMapper<BaseAreaInfo> getBaseInterfaceMapper() {
return this.baseAreaInfoMapper;
}
}
package net.wanji.opt.servicev2.report;
import net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
/**
* <p>
*
* </p>
*
* @Author fengyi
* @Date 2025-04-07
*/
public interface AnalysisGreenWavePeakDetailService extends BaseDubboInterface<AnalysisGreenWavePeakDetail> {
}
package net.wanji.opt.servicev2.report.impl;
import net.wanji.common.framework.dubbointerface.impl.BaseDubboInterfaceImpl;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail;
import net.wanji.opt.servicev2.report.AnalysisGreenWavePeakDetailService;
import net.wanji.opt.dao.mapper.report.AnalysisGreenWavePeakDetailMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* <p>
*
* </p>
*
* @Author fengyi
* @Date 2025-04-07
*/
@Slf4j
@Component
@Service
public class AnalysisGreenWavePeakDetailServiceImpl extends BaseDubboInterfaceImpl<AnalysisGreenWavePeakDetail> implements AnalysisGreenWavePeakDetailService {
@Resource
private AnalysisGreenWavePeakDetailMapper analysisGreenWavePeakDetailMapper;
@Override
public BaseInterfaceMapper<AnalysisGreenWavePeakDetail> getBaseInterfaceMapper() {
return this.analysisGreenWavePeakDetailMapper;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.report.AnalysisGreenWavePeakDetailMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail">
<id column="green_id" property="greenId" />
<result column="road_direction" property="roadDirection" />
<result column="week_day" property="weekDay" />
<result column="peak_start_time" property="peakStartTime" />
<result column="peak_end_time" property="peakEndTime" />
<result column="congest_index" property="congestIndex" />
<result column="status" property="status" />
<result column="travel_time" property="travelTime" />
<result column="speed" property="speed" />
<result column="flow" property="flow" />
<result column="peak_type" property="peakType" />
<result column="year_week" property="yearWeek" />
<result column="week_start_time" property="weekStartTime" />
<result column="week_end_time" property="weekEndTime" />
<result column="insert_time" property="insertTime" />
</resultMap>
<sql id="Table_Name">
t_analysis_green_wave_peak_detail
</sql>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
green_id, road_direction, week_day, peak_start_time, peak_end_time, congest_index, status, travel_time, speed, flow, peak_type, year_week, week_start_time, week_end_time, insert_time
</sql>
<!--新增操作 -->
<insert id="save" parameterType="net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail">
insert into
<include refid="Table_Name"/>
(<include refid="Base_Column_List"/>)
values(
#{greenId}
,#{roadDirection}
,#{weekDay}
,#{peakStartTime}
,#{peakEndTime}
,#{congestIndex}
,#{status}
,#{travelTime}
,#{speed}
,#{flow}
,#{peakType}
,#{yearWeek}
,#{weekStartTime}
,#{weekEndTime}
,#{insertTime}
)
</insert>
<!--根据ID查询-->
<select id="findById" resultMap="BaseResultMap" parameterType="String">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
where id = #{id}
</select>
<!--获取数据总数-->
<select id="getCount" parameterType="java.util.Map" resultType="int">
select count(*) from
<include refid="Table_Name"/>
where 1=1
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</select>
<!-- 查询所有数据-->
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!-- 通过条件查询所有数据-->
<select id="findByMap" parameterType="java.util.Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!--分组分页查询-->
<select id="findByPage" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
limit #{startRowNum}, #{pageSize}
</select>
<!--更新-->
<update id="update" parameterType="net.wanji.opt.entity.report.AnalysisGreenWavePeakDetail">
update
<include refid="Table_Name"/>
<include refid="sql_update"/>
where
green_id = #{greenId}
</update>
<!--根据ID删除-->
<delete id="deleteById" parameterType="String">
delete from
<include refid="Table_Name"/>
where
green_id = #{greenId}
</delete>
<sql id="fuzzySearch">
<if test="keyword != null and keyword !=''">
and (locate(#{keyword,jdbcType=VARCHAR}, s_name)>0
)
</if>
</sql>
<sql id="sql_query">
<if test="greenId != null and greenId != '' ">
<![CDATA[ and green_id = #{greenId}]]>
</if>
<if test="roadDirection != null and roadDirection != '' ">
<![CDATA[ and road_direction = #{roadDirection}]]>
</if>
<if test="weekDay != null and weekDay != '' ">
<![CDATA[ and week_day = #{weekDay}]]>
</if>
<if test="peakStartTime != null and peakStartTime != '' ">
<![CDATA[ and peak_start_time = #{peakStartTime}]]>
</if>
<if test="peakEndTime != null and peakEndTime != '' ">
<![CDATA[ and peak_end_time = #{peakEndTime}]]>
</if>
<if test="congestIndex != null and congestIndex != '' ">
<![CDATA[ and congest_index = #{congestIndex}]]>
</if>
<if test="status != null and status != '' ">
<![CDATA[ and status = #{status}]]>
</if>
<if test="travelTime != null and travelTime != '' ">
<![CDATA[ and travel_time = #{travelTime}]]>
</if>
<if test="speed != null and speed != '' ">
<![CDATA[ and speed = #{speed}]]>
</if>
<if test="flow != null and flow != '' ">
<![CDATA[ and flow = #{flow}]]>
</if>
<if test="peakType != null and peakType != '' ">
<![CDATA[ and peak_type = #{peakType}]]>
</if>
<if test="yearWeek != null and yearWeek != '' ">
<![CDATA[ and year_week = #{yearWeek}]]>
</if>
<if test="weekStartTime != null and weekStartTime != '' ">
<![CDATA[ and week_start_time = #{weekStartTime}]]>
</if>
<if test="weekEndTime != null and weekEndTime != '' ">
<![CDATA[ and week_end_time = #{weekEndTime}]]>
</if>
<if test="insertTime != null and insertTime != '' ">
<![CDATA[ and insert_time = #{insertTime}]]>
</if>
</sql>
<!--更新操作-->
<sql id="sql_update">
<set>
<if test="greenId != null and greenId != '' ">
<![CDATA[ green_id = #{greenId}, ]]>
</if>
<if test="roadDirection != null and roadDirection != '' ">
<![CDATA[ road_direction = #{roadDirection}, ]]>
</if>
<if test="weekDay != null and weekDay != '' ">
<![CDATA[ week_day = #{weekDay}, ]]>
</if>
<if test="peakStartTime != null and peakStartTime != '' ">
<![CDATA[ peak_start_time = #{peakStartTime}, ]]>
</if>
<if test="peakEndTime != null and peakEndTime != '' ">
<![CDATA[ peak_end_time = #{peakEndTime}, ]]>
</if>
<if test="congestIndex != null and congestIndex != '' ">
<![CDATA[ congest_index = #{congestIndex}, ]]>
</if>
<if test="status != null and status != '' ">
<![CDATA[ status = #{status}, ]]>
</if>
<if test="travelTime != null and travelTime != '' ">
<![CDATA[ travel_time = #{travelTime}, ]]>
</if>
<if test="speed != null and speed != '' ">
<![CDATA[ speed = #{speed}, ]]>
</if>
<if test="flow != null and flow != '' ">
<![CDATA[ flow = #{flow}, ]]>
</if>
<if test="peakType != null and peakType != '' ">
<![CDATA[ peak_type = #{peakType}, ]]>
</if>
<if test="yearWeek != null and yearWeek != '' ">
<![CDATA[ year_week = #{yearWeek}, ]]>
</if>
<if test="weekStartTime != null and weekStartTime != '' ">
<![CDATA[ week_start_time = #{weekStartTime}, ]]>
</if>
<if test="weekEndTime != null and weekEndTime != '' ">
<![CDATA[ week_end_time = #{weekEndTime}, ]]>
</if>
<if test="insertTime != null and insertTime != '' ">
<![CDATA[ insert_time = #{insertTime}, ]]>
</if>
</set>
</sql>
</mapper>
......@@ -24,12 +24,12 @@ import java.util.List;
public class CodeGeneratorMyBatis1 {
private static final String dburl = "jdbc:mysql://37.12.182.29:3306/wjdit_ecosystem_db_v1.0.0?serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&characterEncoding=utf8";
private static final String dburl = "jdbc:mysql://localhost:3306/wjdit_ecosystem_db_v1.0.0?serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&characterEncoding=utf8";
private static final String userName = "root";
private static final String password = "Wanji300552";
private static final String TABLE_NAMES ="t_base_area_info";
private static final String password = "123456";
private static final String TABLE_NAMES ="t_analysis_green_wave_peak_detail";
private static String ENTITY_NAME = null;
private static final String AUTHOR ="wangtao";
private static final String AUTHOR ="fengyi";
private static final boolean OVERITE_FILE = true; //是否覆盖源文件
private static final String PARENT_PACAGE = "net.wanji";
......@@ -38,7 +38,7 @@ public class CodeGeneratorMyBatis1 {
//表头标识
private static final String TABLE_PREFIX="t_";
static String subModulePackage = ".judgeanalysis";
static String subModulePackage = ".report";
private static String toEntityName(String tableName) {
if (tableName.startsWith(TABLE_PREFIX)) {
......@@ -69,8 +69,8 @@ public class CodeGeneratorMyBatis1 {
// 全局配置
GlobalConfig gc = new GlobalConfig();
// String projectPath = "./signal-optimize-service";
String projectPath = "./wj-gernerator/output";
String projectPath = "./signal-optimize-service";
// String projectPath = "./wj-gernerator/output";
gc.setOutputDir(projectPath+"/src/main/java");
gc.setAuthor(AUTHOR);
......
......@@ -10,7 +10,7 @@ import ${package.Service}.${entity}Service;
import ${package.Mapper}.${table.mapperName};
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment