Commit c6c0433d authored by zhoushiguang's avatar zhoushiguang

Merge remote-tracking branch 'origin/master'

parents 80366e8f 6073c8be
...@@ -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,
......
...@@ -452,9 +452,9 @@ public class TrendServiceImpl implements TrendService { ...@@ -452,9 +452,9 @@ public class TrendServiceImpl implements TrendService {
abnormalCrossDetailVO.setCrossStopTimes(crossDataRealtimePO.getStopTimes()); abnormalCrossDetailVO.setCrossStopTimes(crossDataRealtimePO.getStopTimes());
abnormalCrossDetailVO.setSpeed(crossDataRealtimePO.getSpeed()); abnormalCrossDetailVO.setSpeed(crossDataRealtimePO.getSpeed());
Double sturation = crossDataRealtimePO.getSturation(); Double sturation = crossDataRealtimePO.getSturation();
abnormalCrossDetailVO.setSturation((double) Math.round(sturation) * 100); abnormalCrossDetailVO.setSturation((int)(sturation * 100));
String serviceLevel = CrossUtil.getServiceLevel(sturation); //String serviceLevel = CrossUtil.getServiceLevel(sturation);
abnormalCrossDetailVO.setServiceLevel(serviceLevel); abnormalCrossDetailVO.setServiceLevel(crossDataRealtimePO.getServiceLevel());
abnormalCrossDetailVO.setHourFlow(crossDataRealtimePO.getFlow() * 12); abnormalCrossDetailVO.setHourFlow(crossDataRealtimePO.getFlow() * 12);
BigDecimal bigDecimal = BigDecimal.valueOf(crossDataRealtimePO.getTrafficIndex()).setScale(2, RoundingMode.HALF_UP); BigDecimal bigDecimal = BigDecimal.valueOf(crossDataRealtimePO.getTrafficIndex()).setScale(2, RoundingMode.HALF_UP);
abnormalCrossDetailVO.setCongestionIndex(bigDecimal); abnormalCrossDetailVO.setCongestionIndex(bigDecimal);
......
...@@ -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;
...@@ -21,10 +22,13 @@ public class AbnormalCrossDetailVO { ...@@ -21,10 +22,13 @@ public class AbnormalCrossDetailVO {
@ApiModelProperty(value = "路口状态:0正常;1失衡;2拥堵;3溢出") @ApiModelProperty(value = "路口状态:0正常;1失衡;2拥堵;3溢出")
private Integer crossStatus; private Integer crossStatus;
@ApiModelProperty(value = "最大排队") @ApiModelProperty(value = "最大排队")
@JsonSerialize(using = net.wanji.common.framework.DoubleSerialize.class)
private Double crossQueueLength; private Double crossQueueLength;
@ApiModelProperty(value = "流率") @ApiModelProperty(value = "流率")
@JsonSerialize(using = net.wanji.common.framework.DoubleSerialize.class)
private Double crossFlowRate; private Double crossFlowRate;
@ApiModelProperty(value = "平均停车次数") @ApiModelProperty(value = "平均停车次数")
@JsonSerialize(using = net.wanji.common.framework.DoubleSerialize.class)
private Double crossStopTimes; private Double crossStopTimes;
@ApiModelProperty(value = "拥堵指数") @ApiModelProperty(value = "拥堵指数")
private BigDecimal congestionIndex; private BigDecimal congestionIndex;
...@@ -35,9 +39,10 @@ public class AbnormalCrossDetailVO { ...@@ -35,9 +39,10 @@ public class AbnormalCrossDetailVO {
@ApiModelProperty(value = "方向实时数据") @ApiModelProperty(value = "方向实时数据")
private List<DirDataElement> dirData; private List<DirDataElement> dirData;
@ApiModelProperty(value = "平均速度") @ApiModelProperty(value = "平均速度")
@JsonSerialize(using = net.wanji.common.framework.DoubleSerialize.class)
private Double speed; private Double speed;
@ApiModelProperty(value = "饱和度") @ApiModelProperty(value = "饱和度")
private Double sturation; private Integer sturation;
@ApiModelProperty(value = "路口服务水平") @ApiModelProperty(value = "路口服务水平")
private String serviceLevel; private String serviceLevel;
@ApiModelProperty(value = "小时流量") @ApiModelProperty(value = "小时流量")
......
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 crossId;
@ApiModelProperty("路口名称")
private String crossName;
@ApiModelProperty("时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@ApiModelProperty("干线方向") @ApiModelProperty("干线方向")
private String dirName; private String dirName;
@ApiModelProperty("流量") @ApiModelProperty("路口名称")
private Integer flow; private String crossName;
@ApiModelProperty("绿信比") private List<Detail> detailList;
private Double greenTimeRatio; @Data
public static class Detail {
@ApiModelProperty("路口编号")
private String crossId;
@ApiModelProperty("干线方向")
private String dir;
@ApiModelProperty("路口名称")
private String crossName;
@ApiModelProperty("时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@ApiModelProperty("流量")
private Integer flow;
@ApiModelProperty("绿信比")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
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("时间") @ApiModelProperty("干线方向名称")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@ApiModelProperty("干线方向")
private String dirName; private String dirName;
@ApiModelProperty("速度") private List<Detail> detailList;
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class) @Data
private Double speed; public static class Detail {
@ApiModelProperty("带宽") @ApiModelProperty("时间")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8")
private Double width; private Date startTime;
@ApiModelProperty("干线方向")
private String dir;
@ApiModelProperty("速度")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
private Double speed;
@ApiModelProperty("带宽")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
private Double width;
}
} }
...@@ -15,15 +15,21 @@ import java.util.Objects; ...@@ -15,15 +15,21 @@ import java.util.Objects;
@AllArgsConstructor @AllArgsConstructor
@RequiredArgsConstructor @RequiredArgsConstructor
public enum DataBrainControlModeEnum { public enum DataBrainControlModeEnum {
//海信线协调控制是单个干线绿波,区域协调控制是多个干线绿波,到万集都是21,绿波协调
//对信号机来说都是绿波协调
LOCK(2, 52, "锁定"), LOCK(2, 52, "锁定"),
ALL_RED(3, 12, "全红"), ALL_RED(3, 12, "全红"),
YELLOW_FLASH(4, 13, "黄闪"), YELLOW_FLASH(4, 13, "黄闪"),
CLOSED_FLASH(5, 11, "关灯"), CLOSED_FLASH(5, 11, "关灯"),
STEP_CONTROL(9, 52, "步进"), STEP_CONTROL(9, 52, "步进"),
FIX_CYCLE(11, 21, "定周期"), FIX_CYCLE(11, 21, "定周期"),
SELF_ADAPTION(100, 23, "单点自适应控制"), SELF_ADAPTION(20, 23, "单点自适应控制"),
LINE_COORDINATE(100, 31, "线协调控制"), LINE_COORDINATE(21, 31, "线协调控制"),
REGION_COORDINATE(100, 41, "区域协调控制"), REGION_COORDINATE(21, 41, "区域协调控制"),
MANUAL_CONTROL(31, 51, "手动控制"),
MANUAL_LOCK(31, 52, "手动控制-锁定阶段"),
MANUAL_TEMP_SCHEME(31, 53, "手动控制-指定方案"),
MANUAL_LOCK_CHANNEL(31, 54, "手动控制-锁定通道"),
TEMP_PLAN(255, 53, "临时方案"); TEMP_PLAN(255, 53, "临时方案");
private Integer wjControl; private Integer wjControl;
......
...@@ -264,12 +264,12 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -264,12 +264,12 @@ public class SignalStatusServiceImpl implements SignalStatusService {
try { try {
OkHttpClientUtil.jsonPost(shensiUrl, jackson.writeValueAsString(hisenseLightStatusPojos)); OkHttpClientUtil.jsonPost(shensiUrl, jackson.writeValueAsString(hisenseLightStatusPojos));
} catch (Exception e) { } catch (Exception e) {
log.error("海信灯态推送百度失败:{}", e); log.error("海信灯态推送神思失败:{}", e.getMessage());
} }
try { try {
OkHttpClientUtil.jsonPost(baiduUrl, jackson.writeValueAsString(hisenseLightStatusPojos)); OkHttpClientUtil.jsonPost(baiduUrl, jackson.writeValueAsString(hisenseLightStatusPojos));
} catch (Exception e) { } catch (Exception e) {
log.error("海信灯态推送百度失败:{}", e); log.error("海信灯态推送百度失败:{}", e.getMessage());
} }
} }
......
...@@ -65,7 +65,7 @@ public class OkHttpClientUtil { ...@@ -65,7 +65,7 @@ public class OkHttpClientUtil {
return responseString; return responseString;
} }
} catch (Exception e) { } catch (Exception e) {
log.error("OkHttpClientUtil远程服务url:{}, 调用异常:{}", url, e); log.error("OkHttpClientUtil远程服务url:{}, 调用异常:{}", url, e.getMessage());
throw new Exception(); throw new Exception();
} }
return null; return null;
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--路径--> <!--路径-->
<fileNamePattern>${LOG_PATH}/hisense/%d{yyyy-MM-dd}/info.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <fileNamePattern>${LOG_PATH}/hisense/%d{yyyy-MM-dd}/info.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<MaxHistory>30</MaxHistory> <MaxHistory>15</MaxHistory>
<totalSizeCap >10GB</totalSizeCap > <totalSizeCap >50GB</totalSizeCap >
<maxFileSize>200MB</maxFileSize> <maxFileSize>200MB</maxFileSize>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
...@@ -62,8 +62,8 @@ ...@@ -62,8 +62,8 @@
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--路径--> <!--路径-->
<fileNamePattern>${LOG_PATH}/hisense/%d{yyyy-MM-dd}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <fileNamePattern>${LOG_PATH}/hisense/%d{yyyy-MM-dd}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<MaxHistory>30</MaxHistory> <MaxHistory>15</MaxHistory>
<totalSizeCap >10GB</totalSizeCap > <totalSizeCap >50GB</totalSizeCap >
<maxFileSize>200MB</maxFileSize> <maxFileSize>200MB</maxFileSize>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
......
package net.wanji.utc.service.control.impl; package net.wanji.utc.service.control.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.IpAddressUtil;
import net.wanji.common.utils.tool.LocalDateTimeUtil;
import net.wanji.databus.dao.entity.*; import net.wanji.databus.dao.entity.*;
import net.wanji.databus.dao.mapper.*; import net.wanji.databus.dao.mapper.*;
import net.wanji.databus.dto.ExtendPhaseDTO; import net.wanji.databus.dto.ExtendPhaseDTO;
...@@ -19,20 +24,22 @@ import net.wanji.utc.common.typeenum.DateStyle; ...@@ -19,20 +24,22 @@ import net.wanji.utc.common.typeenum.DateStyle;
import net.wanji.utc.po.hk.request.DelBaseConfigPO; import net.wanji.utc.po.hk.request.DelBaseConfigPO;
import net.wanji.utc.service.control.ControlCommandService; import net.wanji.utc.service.control.ControlCommandService;
import net.wanji.utc.service.control.ControlCommandStrategyService; import net.wanji.utc.service.control.ControlCommandStrategyService;
import net.wanji.utc.task.SignalStatusTask;
import net.wanji.utc.util.StringUtils; import net.wanji.utc.util.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.concurrent.ConcurrentHashMap;
import java.util.List;
import java.util.Objects;
/** /**
* @author duanruiming * @author duanruiming
...@@ -57,6 +64,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -57,6 +64,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
private final CrossInfoCache crossInfoCache; private final CrossInfoCache crossInfoCache;
private final CrossLightsMapper crossLightsMapper; private final CrossLightsMapper crossLightsMapper;
private final CrossPhaseLightsMapper crossPhaseLightsMapper; private final CrossPhaseLightsMapper crossPhaseLightsMapper;
private final SignalCommandLogPOMapper signalCommandLogPOMapper;
private final CrossPhaseDirTurnCache crossPhaseDirTurnCache; private final CrossPhaseDirTurnCache crossPhaseDirTurnCache;
private final CrossSchemePhaseTimeCountCache crossSchemePhaseTimeCountCache; private final CrossSchemePhaseTimeCountCache crossSchemePhaseTimeCountCache;
...@@ -230,28 +238,89 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -230,28 +238,89 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
@Override @Override
public JsonViewObject lockControlStrategy(ControlCommandVO commandVO) throws Exception { public JsonViewObject lockControlStrategy(ControlCommandVO commandVO) throws Exception {
String now = LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER);
JsonViewObject jsonViewObject; JsonViewObject jsonViewObject;
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(commandVO.getCrossCode()); try {
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerIdCode)) { String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(commandVO.getCrossCode());
jsonViewObject = hkControlCommandService.lockControl(commandVO); if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerIdCode)) {
} else { jsonViewObject = hkControlCommandService.lockControl(commandVO);
jsonViewObject = wanJiControlCommandService.lockControl(commandVO); } else {
jsonViewObject = wanJiControlCommandService.lockControl(commandVO);
}
} catch (Exception e) {
jsonViewObject = JsonViewObject.newInstance().fail(e.getMessage());
} }
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(commandVO));
jsonObject.put("crossId",commandVO.getCrossCode());
//插入命令操作日志
insertCommandLog(now,jsonViewObject, jsonObject,3);
return jsonViewObject; return jsonViewObject;
} }
@Override @Override
public JsonViewObject stepControlStrategy(String crossId, Integer command, Integer stepNum) throws Exception { public JsonViewObject stepControlStrategy(String crossId, Integer command, Integer stepNum) throws Exception {
String now = LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER);
JsonViewObject jsonViewObject; JsonViewObject jsonViewObject;
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(crossId); try {
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerIdCode)) { String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(crossId);
jsonViewObject = hkControlCommandService.stepControl(crossId, command, stepNum); if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerIdCode)) {
} else { jsonViewObject = hkControlCommandService.stepControl(crossId, command, stepNum);
jsonViewObject = wanJiControlCommandService.stepControl(crossId, command, stepNum); } else {
jsonViewObject = wanJiControlCommandService.stepControl(crossId, command, stepNum);
}
} catch (Exception e) {
jsonViewObject = JsonViewObject.newInstance().fail(e.getMessage());
} }
JSONObject jsonObject = new JSONObject();
jsonObject.put("crossId",crossId);
jsonObject.put("command",command);
jsonObject.put("stepNum",stepNum);
//插入命令操作日志
insertCommandLog(now,jsonViewObject, jsonObject,1);
return jsonViewObject; return jsonViewObject;
} }
/**
* @Description 插入命令日志
* @Param nowTime 请求时间戳
* @Param jsonViewObject 操作结果
* @Param jsonObject 参数
* @return void
**/
public void insertCommandLog(String queryTime,JsonViewObject jsonViewObject, JSONObject jsonObject,int commandType){
SignalCommandLogPO signalCommandLogPO = new SignalCommandLogPO();
signalCommandLogPO.setCrossId(jsonObject.getString("crossId"));
signalCommandLogPO.setDataInfo(jsonObject.toJSONString());
signalCommandLogPO.setCommandType(commandType);
signalCommandLogPO.setQueryTime(queryTime);
Integer code = jsonViewObject.getCode();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String ip = IpAddressUtil.getIpAddress(request);
signalCommandLogPO.setIp(ip);
if (code == 200){
signalCommandLogPO.setCommandResult(1);
}else {
signalCommandLogPO.setCommandResult(2);
}
signalCommandLogPO.setResultMessage(jsonViewObject.getMessage());
ConcurrentHashMap<String, List<LightsStatusVO2>> produceListMap = SignalStatusTask.produceListMap;
if (!produceListMap.isEmpty()) {
List<LightsStatusVO2> list = produceListMap.get(jsonObject.get("crossId"));
if (ObjectUtil.isNotEmpty(list)){
LightsStatusVO2 lightsStatusVO2 = list.get(0);
String runMode = lightsStatusVO2.getRunMode();
String lampTime = lightsStatusVO2.getTimeStamp();
//时间转换
lampTime = LocalDateTimeUtil.formatTimeStamp(Long.valueOf(lampTime), LocalDateTimeUtil.TIMEFORMATTER);
signalCommandLogPO.setRunMode(runMode);
signalCommandLogPO.setLampTime(lampTime);
}
}
signalCommandLogPOMapper.insert(signalCommandLogPO);
}
@Override @Override
public JsonViewObject setSignalControlStrategy(String crossId, Integer command, Integer commandType) throws Exception { public JsonViewObject setSignalControlStrategy(String crossId, Integer command, Integer commandType) throws Exception {
JsonViewObject jsonViewObject; JsonViewObject jsonViewObject;
...@@ -266,6 +335,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -266,6 +335,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
@Override @Override
public JsonViewObject recoverScheduleStrategy(String crossId) throws Exception { public JsonViewObject recoverScheduleStrategy(String crossId) throws Exception {
String now = LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER);
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isBlank(crossId)) { if (StringUtils.isBlank(crossId)) {
return jsonViewObject.fail("路口编号不能为空"); return jsonViewObject.fail("路口编号不能为空");
...@@ -276,6 +346,10 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -276,6 +346,10 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
} else { } else {
jsonViewObject = wanJiControlCommandService.recoverSchedule(crossId); jsonViewObject = wanJiControlCommandService.recoverSchedule(crossId);
} }
JSONObject jsonObject = new JSONObject();
jsonObject.put("crossId",crossId);
//插入命令操作日志
insertCommandLog(now,jsonViewObject, jsonObject,2);
return jsonViewObject; return jsonViewObject;
} }
...@@ -358,12 +432,20 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -358,12 +432,20 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
@Override @Override
public JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception { public JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception {
String manufacturerCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossId()); String now = LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER);
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) { try {
} else { String manufacturerCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossId());
jsonViewObject = wanJiControlCommandService.tempSchemeDetail(tempSchemeSendVO); if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
} else {
jsonViewObject = wanJiControlCommandService.tempSchemeDetail(tempSchemeSendVO);
}
} catch (Exception e) {
jsonViewObject = JsonViewObject.newInstance().fail(e.getMessage());
} }
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(tempSchemeSendVO));
//插入命令操作日志
insertCommandLog(now,jsonViewObject, jsonObject,4);
return jsonViewObject; return jsonViewObject;
} }
......
package net.wanji.utc.service.staticinfo.impl; package net.wanji.utc.service.staticinfo.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
...@@ -9,6 +10,7 @@ import lombok.RequiredArgsConstructor; ...@@ -9,6 +10,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.JacksonUtils; import net.wanji.common.utils.tool.JacksonUtils;
import net.wanji.common.utils.tool.LocalDateTimeUtil;
import net.wanji.common.utils.tool.StringUtils; import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.dao.entity.*; import net.wanji.databus.dao.entity.*;
import net.wanji.databus.dao.mapper.*; import net.wanji.databus.dao.mapper.*;
...@@ -24,6 +26,7 @@ import net.wanji.feign.service.common.FeignCommon; ...@@ -24,6 +26,7 @@ import net.wanji.feign.service.common.FeignCommon;
import net.wanji.utc.cache.CrossInfoCache; import net.wanji.utc.cache.CrossInfoCache;
import net.wanji.utc.cache.UtcFeignClientCache; import net.wanji.utc.cache.UtcFeignClientCache;
import net.wanji.utc.common.Result; import net.wanji.utc.common.Result;
import net.wanji.utc.service.control.impl.ControlCommandStrategyServiceImpl;
import net.wanji.utc.service.staticinfo.WanJiCommonStaticInfoService; import net.wanji.utc.service.staticinfo.WanJiCommonStaticInfoService;
import net.wanji.utc.util.HttpRestUtil; import net.wanji.utc.util.HttpRestUtil;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -59,6 +62,7 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe ...@@ -59,6 +62,7 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
private final UtcFeignClientCache utcFeignClientCache; private final UtcFeignClientCache utcFeignClientCache;
private final BaseCrossSchemeMapper baseCrossSchemeMapper; private final BaseCrossSchemeMapper baseCrossSchemeMapper;
private final CrossSchemeStageOptLogMapper crossSchemeStageOptLogMapper; private final CrossSchemeStageOptLogMapper crossSchemeStageOptLogMapper;
private final ControlCommandStrategyServiceImpl controlCommandStrategyService;
@Override @Override
...@@ -209,23 +213,32 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe ...@@ -209,23 +213,32 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
@Override @Override
public JsonViewObject crossSchemeRings(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception { public JsonViewObject crossSchemeRings(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
String now = LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER);
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(crossSchemeRingsDTO.getCrossId()); String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(crossSchemeRingsDTO.getCrossId());
JsonViewObject jsonViewObject = null; JsonViewObject jsonViewObject = null;
String crossId = crossSchemeRingsDTO.getCrossId(); String crossId = crossSchemeRingsDTO.getCrossId();
if ("HISENSE".equals(manufacturerIdCode)) { if ("HISENSE".equals(manufacturerIdCode)) {
FeignCommon utcFeignClientService = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode); FeignCommon utcFeignClientService = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode);
jsonViewObject = utcFeignClientService.crossSchemeRings(crossSchemeRingsDTO); jsonViewObject = utcFeignClientService.crossSchemeRings(crossSchemeRingsDTO);
log.info("方案环图请求,crossId:{},result:{}",crossId,jsonViewObject);
Integer code = jsonViewObject.getCode();
if (code != 200){
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(crossSchemeRingsDTO));
//插入命令操作日志
controlCommandStrategyService.insertCommandLog(now,jsonViewObject, jsonObject,10);
}
} else { } else {
CrossSchemeRings crossSchemeRings = getCrossSchemeRings(crossSchemeRingsDTO); CrossSchemeRings crossSchemeRings = getCrossSchemeRings(crossSchemeRingsDTO);
if (ObjectUtil.isNotEmpty(crossSchemeRings)) { if (ObjectUtil.isNotEmpty(crossSchemeRings)) {
jsonViewObject = JsonViewObject.newInstance().success(crossSchemeRings); jsonViewObject = JsonViewObject.newInstance().success(crossSchemeRings);
} else { } else {
jsonViewObject = JsonViewObject.newInstance().fail(); jsonViewObject = JsonViewObject.newInstance().fail("该方案信息未同步");
} }
} }
if (Objects.isNull(jsonViewObject) || jsonViewObject.getCode() != 200) { /*if (Objects.isNull(jsonViewObject) || jsonViewObject.getCode() != 200) {
throw new Exception("方案环图请求远程服务调用异常,异常信息" + jsonViewObject.getMessage()); throw new Exception("方案环图请求远程服务调用异常,异常信息" + jsonViewObject.getMessage());
} }*/
return jsonViewObject; return jsonViewObject;
} }
......
...@@ -84,7 +84,7 @@ public class SignalStatusTask { ...@@ -84,7 +84,7 @@ public class SignalStatusTask {
@Autowired @Autowired
private EHualuFeignClients eHualuFeignClients; private EHualuFeignClients eHualuFeignClients;
private static final ConcurrentHashMap<String, List<LightsStatusVO2>> produceListMap = new ConcurrentHashMap<>(); public static final ConcurrentHashMap<String, List<LightsStatusVO2>> produceListMap = new ConcurrentHashMap<>();
// 运行状态、告警,1分钟一次 // 运行状态、告警,1分钟一次
@Scheduled(fixedRate = 60 * 1000) @Scheduled(fixedRate = 60 * 1000)
......
...@@ -18,7 +18,7 @@ public class GreenwaveRealtimePO { ...@@ -18,7 +18,7 @@ public class GreenwaveRealtimePO {
/** 绿波ID */ /** 绿波ID */
@ApiModelProperty(name = "id",notes = "") @ApiModelProperty(name = "id",notes = "")
@TableId @TableId
private Integer id ; private Long id ;
@ApiModelProperty(name = "绿波ID",notes = "") @ApiModelProperty(name = "绿波ID",notes = "")
private Integer greenId; private Integer greenId;
/** 交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知 */ /** 交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知 */
......
package net.wanji.databus.dao.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.sql.Date;
/**
* @ClassName CrossSchemeOptLog
* @Description 命令操作日志
* @Author zhouleilei
* @Date 2024/12/23 15:23
*/
@Data
@TableName("t_signal_command_log")
public class SignalCommandLogPO {
@ApiModelProperty(value = "路口编号")
private String crossId;
@ApiModelProperty(value = "请求信息")
private String dataInfo;
@ApiModelProperty(value = "控制类型:1-步进控制/恢复(信控系统);2-恢复时间表(公用);3-相位锁定/解锁(公用);4-临时方案下发(公用);5-步进相位(神思);10-查询环图失败记录")
private Integer commandType;
@ApiModelProperty(value = "优化结果:1-成功 2-失败")
private Integer commandResult;
@ApiModelProperty(value = "返回信息")
private String resultMessage;
@ApiModelProperty(value = "运行模式 `2=手动锁定当前相位`,`3=手动全红`,`4=手动黄闪`,`5=手动关灯`,`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`,`255=临时控制方案`")
private String runMode;
@ApiModelProperty(value = "调用IP")
private String ip;
@ApiModelProperty(value = "请求时间")
private String queryTime;
@ApiModelProperty(value = "灯态时间")
private String lampTime;
@ApiModelProperty(value = "数据插入时间")
private Date insertTime;
}
...@@ -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,
......
package net.wanji.databus.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.databus.dao.entity.SignalCommandLogPO;
/**
* @ClassName SignalCommandLogPOMapper
* @Description SignalCommandLogPOMapper
* @Author zhouleilei
* @Date 2024/12/23 15:23
*/
public interface SignalCommandLogPOMapper extends BaseMapper<SignalCommandLogPO> {
}
...@@ -16,7 +16,8 @@ import java.util.Map; ...@@ -16,7 +16,8 @@ import java.util.Map;
@ApiModel(value = "LightsStatusVO", description = "实时灯态信息实体") @ApiModel(value = "LightsStatusVO", description = "实时灯态信息实体")
public class LightsStatusVO extends BaseCrossInfo { public class LightsStatusVO extends BaseCrossInfo {
@ApiModelProperty(value = "运行模式 `2=手动锁定当前相位`,`3=手动全红`,`4=手动黄闪`,`5=手动关灯`," + @ApiModelProperty(value = "运行模式 `2=手动锁定当前相位`,`3=手动全红`,`4=手动黄闪`,`5=手动关灯`," +
"`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`,`255=临时控制方案`") "`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`," +
"`20=单点自适应控制`,`21=绿波协调`,`31=手动控制`,`255=临时控制方案`")
private String runMode; private String runMode;
@ApiModelProperty(value = "控制模式") @ApiModelProperty(value = "控制模式")
private String controlMode; private String controlMode;
......
...@@ -18,7 +18,8 @@ import java.util.List; ...@@ -18,7 +18,8 @@ import java.util.List;
@ApiModel(value = "LightsStatusVO2", description = "实时灯态信息实体版本2") @ApiModel(value = "LightsStatusVO2", description = "实时灯态信息实体版本2")
public class LightsStatusVO2 extends BaseCrossInfo { public class LightsStatusVO2 extends BaseCrossInfo {
@ApiModelProperty(value = "运行模式 `2=手动锁定当前相位`,`3=手动全红`,`4=手动黄闪`,`5=手动关灯`," + @ApiModelProperty(value = "运行模式 `2=手动锁定当前相位`,`3=手动全红`,`4=手动黄闪`,`5=手动关灯`," +
"`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`,`255=临时控制方案`") "`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`," +
"`20=单点自适应控制`,`21=绿波协调`,`31=手动控制`,`255=临时控制方案`")
private String runMode; private String runMode;
@ApiModelProperty(value = "控制模式") @ApiModelProperty(value = "控制模式")
private String controlMode; private String controlMode;
......
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
AND schedules.`week` = #{week} AND schedules.`week` = #{week}
AND DATE_FORMAT( NOW(), '%H:%i' ) BETWEEN DATE_FORMAT( CAST( section.start_time AS TIME ), '%H:%i' ) AND DATE_FORMAT( NOW(), '%H:%i' ) BETWEEN DATE_FORMAT( CAST( section.start_time AS TIME ), '%H:%i' )
AND DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) AND DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' )
ORDER BY DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) ASC LIMIT 1 ORDER BY DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) DESC LIMIT 1
</select> </select>
<select id="selectSchemeByParams" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO"> <select id="selectSchemeByParams" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
AND schedules.`week` = #{week} AND schedules.`week` = #{week}
AND DATE_FORMAT( #{queryTime}, '%H:%i' ) BETWEEN DATE_FORMAT( CAST( section.start_time AS TIME ), '%H:%i' ) AND DATE_FORMAT( #{queryTime}, '%H:%i' ) BETWEEN DATE_FORMAT( CAST( section.start_time AS TIME ), '%H:%i' )
AND DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) AND DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' )
ORDER BY DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) ASC LIMIT 1 ORDER BY DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) DESC LIMIT 1
</select> </select>
......
...@@ -88,10 +88,13 @@ ...@@ -88,10 +88,13 @@
<insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveHistPO"> <insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveHistPO">
insert into t_greenwave_hist insert into t_greenwave_hist
(<include refid="Base_Column_List"/>) (green_id, status,type,traffic_index,speed,trval_time,stop_times,queue_length,cong_rate,delay_time,nopark_pass_rate,
cord_reliability,cord_queue_ratio,uncoordinate_phase_queue, start_time, gmt_create,gmt_modified,
strategy, strategy_duration, optimize_count, optimize_seconds,
green_wave_width, direction, plan_cycle, speed_high, speed_down, road_direction, sturation, batch_time)
values values
<foreach collection="list" item="entity" separator=","> <foreach collection="list" item="entity" separator=",">
(#{entity.id}, #{entity.greenId}, #{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed}, (#{entity.greenId}, #{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed},
#{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate}, #{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate},
#{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio}, #{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio},
#{entity.uncoordinatePhaseQueue}, #{entity.startTime}, #{entity.gmtCreate}, #{entity.gmtModified}, #{entity.uncoordinatePhaseQueue}, #{entity.startTime}, #{entity.gmtCreate}, #{entity.gmtModified},
...@@ -100,6 +103,8 @@ ...@@ -100,6 +103,8 @@
#{entity.speedDown}, #{entity.roadDirection}, #{entity.sturation}, #{entity.batchTime} #{entity.speedDown}, #{entity.roadDirection}, #{entity.sturation}, #{entity.batchTime}
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE
gmt_modified = values(gmt_modified)
</insert> </insert>
</mapper> </mapper>
...@@ -54,10 +54,13 @@ ...@@ -54,10 +54,13 @@
<insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveRealtimePO"> <insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveRealtimePO">
insert into t_greenwave_realtime insert into t_greenwave_realtime
(<include refid="Base_Column_List"></include>) (green_id, status,type,traffic_index,speed,trval_time,stop_times,queue_length,cong_rate,delay_time,nopark_pass_rate,
cord_reliability, cord_queue_ratio, uncoordinate_phase_queue, start_time, gmt_create,gmt_modified,
strategy, strategy_duration, optimize_count, optimize_seconds,
green_wave_width, direction, plan_cycle, speed_high, speed_down, road_direction, sturation, batch_time)
values values
<foreach collection="list" item="entity" separator=","> <foreach collection="list" item="entity" separator=",">
(#{entity.id}, #{entity.greenId}, #{entity.status}, #{entity.type}, #{entity.trafficIndex}, #{entity.speed}, (#{entity.greenId}, #{entity.status}, #{entity.type}, #{entity.trafficIndex}, #{entity.speed},
#{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate}, #{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate},
#{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio}, #{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio},
#{entity.uncoordinatePhaseQueue}, #{entity.startTime}, #{entity.gmtCreate}, #{entity.gmtModified}, #{entity.uncoordinatePhaseQueue}, #{entity.startTime}, #{entity.gmtCreate}, #{entity.gmtModified},
......
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