Commit 428f9506 authored by duanruiming's avatar duanruiming

[add] 优化监测-AI干线优化

parent beaf2b3c
...@@ -4,20 +4,25 @@ import lombok.AllArgsConstructor; ...@@ -4,20 +4,25 @@ import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import net.wanji.common.utils.tool.StringUtils; import net.wanji.common.utils.tool.StringUtils;
import java.util.Objects;
/** /**
* @author duanruiming * @author duanruiming
* @date 2024/12/03 19:14 * @date 2024/12/03 19:14
* @description
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum GreenBeltDirEnum { public enum GreenBeltDirEnum {
E2W("e2w", "东向西"), //
W2E("w2e", "西向东"), E2W("e2w", "东向西", 3),
N2S("n2s", "北向南"), W2E("w2e", "西向东", 7),
S2N("s2n", "南向北"); N2S("n2s", "北向南", 1),
S2N("s2n", "南向北", 5);
private String code; private String code;
private String desc; private String desc;
private Integer inDir;
public static String getDesc(String code) { public static String getDesc(String code) {
for (GreenBeltDirEnum dirEnum : GreenBeltDirEnum.values()) { for (GreenBeltDirEnum dirEnum : GreenBeltDirEnum.values()) {
...@@ -27,4 +32,22 @@ public enum GreenBeltDirEnum { ...@@ -27,4 +32,22 @@ public enum GreenBeltDirEnum {
} }
return ""; return "";
} }
public static Integer getInDir(String code) {
for (GreenBeltDirEnum value : GreenBeltDirEnum.values()) {
if (StringUtils.equalsIgnoreCase(code, value.getCode())) {
return value.getInDir();
}
}
return 1;
}
public static String getInDirName(Integer dir) {
for (GreenBeltDirEnum value : GreenBeltDirEnum.values()) {
if (Objects.equals(dir, value.getInDir())) {
return value.getDesc();
}
}
return "";
}
} }
...@@ -55,13 +55,13 @@ public class GreenBeltController { ...@@ -55,13 +55,13 @@ public class GreenBeltController {
@ApiResponse(code = 200, message = "OK", response = GreenBeltSpeedWidthVO.class), @ApiResponse(code = 200, message = "OK", response = GreenBeltSpeedWidthVO.class),
}) })
public JsonViewObject greenBeltSpeedWidth(Integer greenId) { public JsonViewObject greenBeltSpeedWidth(Integer greenId) {
Map<String, List<GreenBeltSpeedWidthVO>> map = Collections.EMPTY_MAP; List<GreenBeltSpeedWidthVO> list = Collections.EMPTY_LIST;
try { try {
map = greenBeltInfoService.greenBeltSpeedWidth(greenId); list = greenBeltInfoService.greenBeltSpeedWidth(greenId);
} catch (Exception e) { } catch (Exception e) {
JsonViewObject.newInstance().fail("绿波带宽曲线异常"); JsonViewObject.newInstance().fail("绿波带宽曲线异常");
} }
return JsonViewObject.newInstance().success(map); return JsonViewObject.newInstance().success(list);
} }
@ApiOperation(value = "绿波关键路口流量绿信比", notes = "优化监测-绿波关键路口流量绿信比", response = JsonViewObject.class, @ApiOperation(value = "绿波关键路口流量绿信比", notes = "优化监测-绿波关键路口流量绿信比", response = JsonViewObject.class,
...@@ -71,13 +71,13 @@ public class GreenBeltController { ...@@ -71,13 +71,13 @@ public class GreenBeltController {
@ApiResponse(code = 200, message = "OK", response = GreenBeltKeyCrossFlowTimeVO.class), @ApiResponse(code = 200, message = "OK", response = GreenBeltKeyCrossFlowTimeVO.class),
}) })
public JsonViewObject greenBeltKeyCrossFlowTime(Integer greenId) { public JsonViewObject greenBeltKeyCrossFlowTime(Integer greenId) {
Map<String, List<GreenBeltKeyCrossFlowTimeVO>> map = Collections.EMPTY_MAP; List<GreenBeltKeyCrossFlowTimeVO> list = Collections.EMPTY_LIST;
try { try {
map = greenBeltInfoService.greenBeltKeyCrossFlowTime(greenId); list = greenBeltInfoService.greenBeltKeyCrossFlowTime(greenId);
} catch (Exception e) { } catch (Exception e) {
JsonViewObject.newInstance().fail("绿波带宽曲线异常"); JsonViewObject.newInstance().fail("绿波带宽曲线异常");
} }
return JsonViewObject.newInstance().success(map); return JsonViewObject.newInstance().success(list);
} }
@ApiOperation(value = "干线详情", notes = "优化监测-干线详情", response = JsonViewObject.class, @ApiOperation(value = "干线详情", notes = "优化监测-干线详情", response = JsonViewObject.class,
......
...@@ -6,15 +6,13 @@ import net.wanji.opt.vo.GreenBeltKeyCrossFlowTimeVO; ...@@ -6,15 +6,13 @@ import net.wanji.opt.vo.GreenBeltKeyCrossFlowTimeVO;
import net.wanji.opt.vo.GreenBeltSpeedWidthVO; import net.wanji.opt.vo.GreenBeltSpeedWidthVO;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author duanruiming * @author duanruiming
* @date 2024/11/19 18:07 * @date 2024/11/19 18:07
*/ */
public interface GreenBeltInfoService { public interface GreenBeltInfoService {
List<GreenBeltFlowStopTimeVO> greenBeltCrossDetailHist(Integer greenId) throws Exception; List<GreenBeltFlowStopTimeVO> greenBeltCrossDetailHist(Integer greenId) throws Exception;
Map<String, List<GreenBeltSpeedWidthVO>> greenBeltSpeedWidth(Integer greenId) throws Exception; List<GreenBeltSpeedWidthVO> greenBeltSpeedWidth(Integer greenId) throws Exception;
Map<String, List<GreenBeltKeyCrossFlowTimeVO>> greenBeltKeyCrossFlowTime(Integer greenId) throws Exception; List<GreenBeltKeyCrossFlowTimeVO> greenBeltKeyCrossFlowTime(Integer greenId) throws Exception;
GreenBeltCrossDetailVO greenBeltCrossDetailList(Integer greenId) throws Exception; GreenBeltCrossDetailVO greenBeltCrossDetailList(Integer greenId) throws Exception;
} }
package net.wanji.opt.vo; package net.wanji.opt.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import net.wanji.opt.config.Double2TwoDecimalPlacesSerializer;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author duanruiming * @author duanruiming
...@@ -14,17 +17,26 @@ import java.util.Date; ...@@ -14,17 +17,26 @@ import java.util.Date;
@Data @Data
@ApiModel(value = "优化监测-绿波关键路口流量绿信比实体") @ApiModel(value = "优化监测-绿波关键路口流量绿信比实体")
public class GreenBeltKeyCrossFlowTimeVO { public class GreenBeltKeyCrossFlowTimeVO {
@ApiModelProperty("干线方向")
private String dirName;
@ApiModelProperty("路口名称")
private String crossName;
private List<Detail> detailList;
@Data
public static class Detail {
@ApiModelProperty("路口编号") @ApiModelProperty("路口编号")
private String crossId; private String crossId;
@ApiModelProperty("干线方向")
private String dir;
@ApiModelProperty("路口名称") @ApiModelProperty("路口名称")
private String crossName; private String crossName;
@ApiModelProperty("时间") @ApiModelProperty("时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8")
private Date startTime; private Date startTime;
@ApiModelProperty("干线方向")
private String dirName;
@ApiModelProperty("流量") @ApiModelProperty("流量")
private Integer flow; private Integer flow;
@ApiModelProperty("绿信比") @ApiModelProperty("绿信比")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
private Double greenTimeRatio; private Double greenTimeRatio;
}
} }
...@@ -8,6 +8,7 @@ import lombok.Data; ...@@ -8,6 +8,7 @@ import lombok.Data;
import net.wanji.opt.config.Double2TwoDecimalPlacesSerializer; import net.wanji.opt.config.Double2TwoDecimalPlacesSerializer;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author duanruiming * @author duanruiming
...@@ -16,15 +17,21 @@ import java.util.Date; ...@@ -16,15 +17,21 @@ import java.util.Date;
@Data @Data
@ApiModel(value = "优化监测-绿波带宽曲线实体") @ApiModel(value = "优化监测-绿波带宽曲线实体")
public class GreenBeltSpeedWidthVO { public class GreenBeltSpeedWidthVO {
@ApiModelProperty("干线方向名称")
private String dirName;
private List<Detail> detailList;
@Data
public static class Detail {
@ApiModelProperty("时间") @ApiModelProperty("时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8")
private Date startTime; private Date startTime;
@ApiModelProperty("干线方向") @ApiModelProperty("干线方向")
private String dirName; private String dir;
@ApiModelProperty("速度") @ApiModelProperty("速度")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class) @JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
private Double speed; private Double speed;
@ApiModelProperty("带宽") @ApiModelProperty("带宽")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class) @JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
private Double width; private Double width;
}
} }
...@@ -53,6 +53,7 @@ public interface CrossDirDataHistMapper extends BaseMapper<CrossDirDataHistPO> { ...@@ -53,6 +53,7 @@ public interface CrossDirDataHistMapper extends BaseMapper<CrossDirDataHistPO> {
List<CrossDirDataHistPO> selectByCrossIdsDirsAndTimestamp(List<String> crossIdList, List<Integer> dirCodeList, int startTimeStamp, int endTimeStamp); List<CrossDirDataHistPO> selectByCrossIdsDirsAndTimestamp(List<String> crossIdList, List<Integer> dirCodeList, int startTimeStamp, int endTimeStamp);
List<CrossDirDataHistPO> selectByCrossIdDirsAndTimestamp(String crossId, List<Integer> dirCodeList, int startTimeStamp, int endTimeStamp); List<CrossDirDataHistPO> selectByCrossIdDirsAndTimestamp(String crossId, List<Integer> dirCodeList, int startTimeStamp, int endTimeStamp);
List<CrossDirDataHistPO> selectDirDataList(String crossId, List<Integer> dirCodeList, int startTimeStamp, int endTimeStamp);
List<CrossDirDataHistPO> selectByCrossDirAndTimeSection( List<CrossDirDataHistPO> selectByCrossDirAndTimeSection(
@Param("crossId") String crossId, @Param("crossId") String crossId,
......
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