Commit 5d5132a7 authored by zhoushiguang's avatar zhoushiguang

Merge branch 'master' of http://106.120.201.126:14725/jinan/traffic-signal-platform

 Conflicts:
	signal-optimize-service/src/main/java/net/wanji/opt/task/HisenseGreenChartTask.java
parents 6be59d98 09b2e2c0
......@@ -184,7 +184,7 @@ public class StrategyPriorityController {
return jsonView;
}
@ApiOperation(value = "策略管理-策略参数配置批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiOperation(value = "策略管理-策略参数配置路口干线批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "strategyPriorityGroup", value = "参数配置数据", required = false, dataType = "String"),
})
......@@ -202,15 +202,18 @@ public class StrategyPriorityController {
}
@ApiOperation(value = "策略管理-参数配置数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiOperation(value = "策略管理-参数配置干线路口数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = true, dataType = "String")
@ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"),
@ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"),
})
@GetMapping("/getParamConfigData")
public JsonViewObject getParamConfigData(@RequestParam(required = true) String crossId){
public JsonViewObject getParamConfigData(@RequestParam(required = false) String crossId,@RequestParam(required = false) Integer greenId,
@RequestParam(required = true) Integer type){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyParameterConfig>list=strategyPriorityService.getParamConfigData(crossId);
List<StrategyParameterConfig>list=strategyPriorityService.getParamConfigData(crossId,greenId,type);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
......
......@@ -89,7 +89,7 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
void saveParamConfig(@Param("savePlanList") List<StrategyParameterConfig> savePlanList);
List<StrategyParameterConfig> getParamConfigData(String crossId);
List<StrategyParameterConfig> getParamConfigData(@Param("crossId") String crossId,@Param("type")Integer type);
List<StrategyPriorityDailyInfo> getStrategyGreenWave();
......@@ -106,5 +106,11 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
void deleteGreenPlanConfig(Integer greenId);
List<StrategyPriorityDailyInfo> getGreenPlanConfigData(@Param("greenId") Integer greenId,@Param("type")Integer type);
List<StrategyParameterConfig> paramterGreenConfigTable(Integer greenId);
void deleteGreenParamterConfig(Integer greenId);
List<StrategyParameterConfig> getGreenParamConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type);
}
......@@ -31,5 +31,6 @@ public class SchemeGreenDirGreenTimeDTO {
private Integer end;
private Integer dir;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField(value = "query_date")
private Date date;
}
package net.wanji.opt.entity.strategy;
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.AllArgsConstructor;
......@@ -12,7 +13,7 @@ import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("t_strategy_parameter_config")
@TableName("t_strategy_priority_parameter")
@NoArgsConstructor
@AllArgsConstructor
public class StrategyParameterConfig implements Serializable {
......@@ -45,6 +46,13 @@ public class StrategyParameterConfig implements Serializable {
* 调度配置执行详情
*/
private String schedulingParam;
/**
* 干线ID
*/
private Integer greenId;
/**
* 类型 1:路口 2干线
*/
private Integer type;
}
......@@ -44,7 +44,7 @@ public interface StrategyPriorityService extends IService<StrategyPriorityDailyI
void saveParamterConfig(StrategyPriorityGroup strategyPriorityGroup) throws JsonProcessingException;
List<StrategyParameterConfig> getParamConfigData(String crossId);
List<StrategyParameterConfig> getParamConfigData(String crossId,Integer greenId, Integer type);
List<StrategyPriorityDailyInfo> getStrategyGreenWave();
}
......@@ -310,9 +310,9 @@ import java.util.stream.Collectors;
return planList;
}
/*
* 策略参数配置
* */
/*
* 策略参数配置干线路口
* */
@Override
@Transactional
public void saveParamterConfig(StrategyPriorityGroup group) throws JsonProcessingException {
......@@ -321,32 +321,66 @@ import java.util.stream.Collectors;
List<StrategyParameterConfig> savePlanList = new ArrayList<>();
//路口ID
List<String> crossList = group.getCrossIds();
//选中多个路口存多条数据
for (String crossId : crossList) {
StrategyParameterConfig strategyParameterConfig = new StrategyParameterConfig();
//策略编号
String strategyNo = group.getStrategyNo();
strategyParameterConfig.setStrategyNo(strategyNo);
//路口id
//String crossId = group.getCrossId();
strategyParameterConfig.setCrossId(crossId);
//先判断表里有没有数据,有的话删除t_strategy_priority_parameter
List<StrategyParameterConfig> paramterConfig = strategyPriorityMapper.paramterConfigTable(crossId);
if (paramterConfig.size() > 0) {
strategyPriorityMapper.deleteParamterConfig(crossId);
//干线id
List<Integer> greenIdList = group.getGreenIds();
//Type : 1;路口2:干线
Integer typePd=group.getType();
if(typePd==1) {
//选中多个路口存多条数据
for (String crossId : crossList) {
StrategyParameterConfig strategyParameterConfig = new StrategyParameterConfig();
//Type : 1;路口2:干线
Integer type=group.getType();
strategyParameterConfig.setType(type);
//策略编号
String strategyNo = group.getStrategyNo();
strategyParameterConfig.setStrategyNo(strategyNo);
//路口id
//String crossId = group.getCrossId();
strategyParameterConfig.setCrossId(crossId);
//先判断表里有没有数据,有的话删除t_strategy_priority_parameter
List<StrategyParameterConfig> paramterConfig = strategyPriorityMapper.paramterConfigTable(crossId);
if (paramterConfig.size() > 0) {
strategyPriorityMapper.deleteParamterConfig(crossId);
}
//参数 场景配置
List<StrategyPriorityParamter> parameterConfigList = group.getParameterConfigList();
String jsonString = JSON.toJSONString(parameterConfigList);
strategyParameterConfig.setParamDetails(jsonString);
//策略调度参数配置
StrategySchedulingParam schedulingParamters = group.getSchedulingParamters();
ObjectMapper objectMapper = new ObjectMapper();
String schedulingParamter = objectMapper.writeValueAsString(schedulingParamters);
strategyParameterConfig.setSchedulingParam(schedulingParamter);
//添加到最终数据
savePlanList.add(strategyParameterConfig);
}
//参数 场景配置
List<StrategyPriorityParamter> parameterConfigList = group.getParameterConfigList();
String jsonString = JSON.toJSONString(parameterConfigList);
strategyParameterConfig.setParamDetails(jsonString);
//策略调度参数配置
StrategySchedulingParam schedulingParamters = group.getSchedulingParamters();
ObjectMapper objectMapper = new ObjectMapper();
String schedulingParamter = objectMapper.writeValueAsString(schedulingParamters);
strategyParameterConfig.setSchedulingParam(schedulingParamter);
//添加到最终数据
savePlanList.add(strategyParameterConfig);
}else if (typePd==2){
for (Integer greenId : greenIdList) {
StrategyParameterConfig strategyParameterConfig = new StrategyParameterConfig();
//Type : 1;路口2:干线
Integer type=group.getType();
strategyParameterConfig.setType(type);
//策略编号
String strategyNo = group.getStrategyNo();
strategyParameterConfig.setStrategyNo(strategyNo);
//路口id
//String crossId = group.getCrossId();
strategyParameterConfig.setGreenId(greenId);
//先判断表里有没有数据,有的话删除t_strategy_priority_parameter
List<StrategyParameterConfig> paramterConfig = strategyPriorityMapper.paramterGreenConfigTable(greenId);
if (paramterConfig.size() > 0) {
strategyPriorityMapper.deleteGreenParamterConfig(greenId);
}
//参数 场景配置
List<StrategyPriorityParamter> parameterConfigList = group.getParameterConfigList();
String jsonString = JSON.toJSONString(parameterConfigList);
strategyParameterConfig.setParamDetails(jsonString);
//添加到最终数据
savePlanList.add(strategyParameterConfig);
}
}
strategyPriorityMapper.saveParamConfig(savePlanList);
......@@ -357,12 +391,24 @@ import java.util.stream.Collectors;
}
/*
* 策略参数配置数据回显
* 策略参数配置干线路口数据回显
* */
@Override
public List<StrategyParameterConfig> getParamConfigData(String crossId) {
public List<StrategyParameterConfig> getParamConfigData(String crossId,Integer greenId, Integer type) {
try {
List<StrategyParameterConfig> paraterConfigList = strategyPriorityMapper.getParamConfigData(crossId);
List<StrategyParameterConfig> paraterConfigList=new ArrayList<>();
//type: 1路口 2干线
if (type==1){
if (crossId.isEmpty()){
throw new IllegalArgumentException("crossId cannot be null");
}
paraterConfigList = strategyPriorityMapper.getParamConfigData(crossId,type);
}else if(type==2){
if (greenId==null){
throw new IllegalArgumentException("greenId cannot be null");
}
paraterConfigList = strategyPriorityMapper.getGreenParamConfigData(greenId,type);
}
return paraterConfigList;
}catch (Exception e){
log.error("{} getParamConfigData", this.getClass().getSimpleName(), e);
......
......@@ -8,4 +8,5 @@ public class CrossRealTimeAlarmEntity {
private String startTime;
private String dir;
private String eventSerialNumber;
private String duration;
}
......@@ -10,6 +10,7 @@
<result property="startTime" column="startTime"></result>
<result property="dir" column="dir"></result>
<result property="eventSerialNumber" column="eventSerialNumber"></result>
<result property="duration" column="duration"></result>
</resultMap>
<select id="getOptTimes" resultMap="BaseResultMap" parameterType="String">
......@@ -61,7 +62,7 @@
</select>
<select id="getCrossRealTimeAlarms" parameterType="String" resultMap="CrossRealTimeAlarmsResultMap">
select a.type , a.start_time as startTime , SUBSTR(a.dir, 2, length(a.dir)-2) as dir , a.event_serial_number as eventSerialNumber
select a.type , a.start_time as startTime , SUBSTR(a.dir, 2, length(a.dir)-2) as dir , a.event_serial_number as eventSerialNumber , a.duration
from t_event_info a
where a.start_time = (select MAX(start_time) from t_event_info where cross_id = #{crossID}
and start_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s') and start_time >= DATE_FORMAT(DATE_SUB(#{time},INTERVAL 5 MINUTE), '%Y-%m-%d %H:%i:%s')
......@@ -71,7 +72,7 @@
</select>
<select id="getCrossRealTimeAlarmsPlan" parameterType="String" resultMap="CrossRealTimeAlarmsResultMap">
select '' as type,a.issue_time as startTime ,'' as dir ,a.event_id as eventSerialNumber from t_strategy_cross_result a
select '' as type,a.issue_time as startTime ,'' as dir ,a.event_id as eventSerialNumber ,'' as duration from t_strategy_cross_result a
where a.event_id = #{eventSerialNumber}
and response_code = 200
and dt = DATE_FORMAT(#{time}, '%Y%m%d')
......
......@@ -11,6 +11,7 @@
<result property="type" column="type"></result>
<result property="startTime" column="startTime"></result>
<result property="dir" column="dir"></result>
<result property="duration" column="duration"></result>
</resultMap>
<select id="getTrunkLineProblemDescribe" parameterType="String" resultMap="tlProblemDescribe">
......@@ -38,7 +39,7 @@
</select>
<select id="getTrunkLineRealTimeAlarm" parameterType="map" resultMap="tlRealTimeAlarmsResultMap">
select a.type , a.start_time as startTime , SUBSTR(a.dir, 2, length(a.dir)-2) as dir
select a.type , a.start_time as startTime , SUBSTR(a.dir, 2, length(a.dir)-2) as dir , a.duration
from t_event_info a
where a.start_time = (select MAX(start_time) from t_event_info where green_id = #{greenID}
and start_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s') and start_time >= DATE_FORMAT(DATE_SUB(#{time},INTERVAL 5 MINUTE), '%Y-%m-%d %H:%i:%s')
......@@ -48,7 +49,7 @@
</select>
<select id="getTrunkLineRealTimeAlarmPlan" parameterType="map" resultMap="tlRealTimeAlarmsResultMap">
select DISTINCT '' as type,a.control_time as startTime ,'' as dir from t_strategy_green_opt_hist a
select DISTINCT '' as type,a.control_time as startTime ,'' as dir, '' as duration from t_strategy_green_opt_hist a
where a.control_time = (select MAX(control_time) from t_strategy_green_opt_hist where green_id = #{greenID}
and control_time >= DATE_FORMAT(DATE_sub(#{time},INTERVAL control_duration SECOND),'%Y-%m-%d %H:%i:%s') and control_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
and response_code = 200 )
......@@ -56,7 +57,7 @@
</select>
<select id="getTrunkLineRealTimeAlarmPlan1" parameterType="map" resultMap="tlRealTimeAlarmsResultMap">
select DISTINCT '' as type,a.control_time as startTime ,'' as dir from t_strategy_green_opt_hist a
select DISTINCT '' as type,a.control_time as startTime ,'' as dir, '' as duration from t_strategy_green_opt_hist a
where a.control_time = (select MIN(control_time) from t_strategy_green_opt_hist where green_id = #{greenID}
and control_time <![CDATA[ <= ]]> DATE_FORMAT(DATE_ADD(#{time},INTERVAL 5 MINUTE),'%Y-%m-%d %H:%i:%s') and control_time >= DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
and response_code = 200 )
......
......@@ -118,7 +118,7 @@
GROUP_CONCAT(t2.daily_plan_details SEPARATOR ', ') AS dailyPlanDetails
FROM
t_base_cross_info t3
LEFT JOIN t_strategy_priority_daily_info t2 on t3.id = t2.cross_id
LEFT JOIN t_strategy_priority_daily_info t2 on t3.id = t2.cross_id and t2.type=1
LEFT JOIN t_strategy_priority_config t1 on t3.id=t1.cross_id
LEFT JOIN t_greenwave_info t4 on t4.id = t1.green_id
WHERE t3.is_signal='1'
......@@ -330,30 +330,63 @@
AND cross_id =#{crossId}
</if>
</select>
<select id="paramterGreenConfigTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT
id,cross_id
FROM t_strategy_priority_parameter
WHERE
1=1
<if test="greenId!=null">
AND green_id =#{greenId}
</if>
</select>
<delete id="deleteParamterConfig">
DELETE
FROM t_strategy_priority_parameter
WHERE cross_id =#{crossId}
</delete>
<delete id="deleteGreenParamterConfig">
DELETE
FROM t_strategy_priority_parameter
WHERE green_id = #{greenId}
</delete>
<insert id="saveParamConfig" parameterType="list" >
INSERT INTO t_strategy_priority_parameter
(cross_id,strategy_no,param_details,scheduling_param)
(cross_id,strategy_no,param_details,scheduling_param,type,green_id)
VALUES
<foreach collection="savePlanList" item="item" separator=",">
(#{item.crossId},#{item.strategyNo},#{item.paramDetails},#{item.schedulingParam})
(#{item.crossId},#{item.strategyNo},#{item.paramDetails},#{item.schedulingParam},#{item.type},#{item.greenId})
</foreach>
</insert>
<select id="getParamConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT
id,strategy_no,cross_id,param_details,scheduling_param
id,strategy_no,cross_id,param_details,scheduling_param,type
FROM
t_strategy_priority_parameter
WHERE
1=1
<if test="crossId!=null">
<if test="crossId!=null and crossId!=''" >
AND cross_id =#{crossId}
</if>
<if test="type!=null and type!=''">
and type = #{type}
</if>
</select>
<select id="getGreenParamConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT
id,strategy_no,cross_id,param_details,type
FROM
t_strategy_priority_parameter
WHERE
1=1
<if test="greenId!=null and greenId!=''">
AND green_id =#{greenId}
</if>
<if test="type!=null and type!=''">
and type = #{type}
</if>
</select>
<select id="getStrategyGreenWave" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
......
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