Commit 31190f08 authored by wangyecheng's avatar wangyecheng

策略管理优先级配置干线路口回显

parent 0289faac
......@@ -110,7 +110,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 = "dataList", value = "优先级配置数据", required = false, dataType = "String"),
})
......@@ -127,15 +127,18 @@ 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 = "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("/getPriorityConfig")
public JsonViewObject getPriorityData(@RequestParam(required = true) String crossId){
public JsonViewObject getPriorityData(@RequestParam(required = false) String crossId,@RequestParam(required = false) Integer greenId,
@RequestParam(required = true) Integer type){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyFactoryEntity>list=strategyPriorityService.getPriorityData(crossId);
List<StrategyFactoryEntity>list=strategyPriorityService.getPriorityData(crossId,greenId,type);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
......
......@@ -69,9 +69,9 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
List<String> getstrategyNo(String crossId);
List<String> getstrategyNo(@Param("crossId") String crossId,@Param("type") Integer type);
List<StrategyFactoryEntity> getPriorityConfigData(@Param("strategyNo") List<String> strategyNo,@Param("crossId") String crossId);
List<StrategyFactoryEntity> getPriorityConfigData(@Param("strategyNo") List<String> strategyNo,@Param("crossId") String crossId,@Param("type") Integer type);
void savePlanConfig(@Param("savePlanList") List<StrategyPriorityDailyInfo> savePlanList);
......@@ -96,5 +96,9 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
List<StrategyPriorityConfig> selectGreenPriorityTable(Integer greenId);
void deleteGreenPriorityConfig(Integer greenId);
List<String> getGreenstrategyNo(@Param("greenId") Integer greenId,@Param("type") Integer type);
List<StrategyFactoryEntity> getGreenPriorityConfigData(@Param("strategyNo") List<String> strategyNo, @Param("greenId") Integer greenId,@Param("type") Integer type);
}
......@@ -34,7 +34,7 @@ public interface StrategyPriorityService extends IService<StrategyPriorityDailyI
void savePriority(List<StrategyPriorityGroup> dataList);
List<StrategyFactoryEntity> getPriorityData(String crossId);
List<StrategyFactoryEntity> getPriorityData(String crossId,Integer greenId, Integer type) throws Exception;
void savePlanConfig(List<StrategyPriorityGroup> dailyPlanDetails) throws JsonProcessingException;
......
......@@ -82,7 +82,7 @@ import java.util.stream.Collectors;
return strategyList;
}
/*
* 策略优先级保存
* 策略优先级保存 路口 干线共用
* */
@Override
@Transactional
......@@ -168,17 +168,38 @@ import java.util.stream.Collectors;
}
}
/*
* 策略优先级路口跟干线数据回显
* */
@Override
@Transactional
public List<StrategyFactoryEntity> getPriorityData(String crossId) {
public List<StrategyFactoryEntity> getPriorityData(String crossId,Integer greenId, Integer type) throws Exception {
try {
//先获取策略编号
List<String> strategyNo = strategyPriorityMapper.getstrategyNo(crossId);
if (CollectionUtils.isEmpty(strategyNo)){
return Collections.emptyList();
List<StrategyFactoryEntity> priorityList =new ArrayList<>();
//type: 1路口 2干线
if (type==1) {
if (crossId.isEmpty()){
throw new IllegalArgumentException("crossId cannot be null");
}
//先获取策略编号
List<String> strategyNo = strategyPriorityMapper.getstrategyNo(crossId,type);
if (CollectionUtils.isEmpty(strategyNo)) {
return Collections.emptyList();
}
priorityList = strategyPriorityMapper.getPriorityConfigData(strategyNo, crossId,type);
}else if (type==2){
if (greenId==null){
throw new IllegalArgumentException("greenId cannot be null");
}
//先获取策略编号
List<String> strategyNo = strategyPriorityMapper.getGreenstrategyNo(greenId,type);
if (CollectionUtils.isEmpty(strategyNo)) {
return Collections.emptyList();
}
priorityList = strategyPriorityMapper.getGreenPriorityConfigData(strategyNo, greenId,type);
}
List<StrategyFactoryEntity> priorityList = strategyPriorityMapper.getPriorityConfigData(strategyNo,crossId);
return priorityList;
}catch (Exception e){
log.error("{} getPriorityData", this.getClass().getSimpleName(), e);
......
......@@ -197,7 +197,32 @@
<if test="crossId!=null and crossId!=''">
AND t1.cross_id=#{crossId}
</if>
<if test="type!=null and type!=''">
AND t1.type=#{type}
</if>
</select>
<select id="getGreenPriorityConfigData" parameterType="map" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT t2.status,
t2.method,t2.strategy_name,t2.strategy_no,
t2.mark,t2.company,t1.priority as priority,t1.id,
t1.group_id as labelCode ,t1.group_name as label,t1.cross_id as crossId
FROM
t_strategy_priority_config t1
LEFT JOIN t_strategy_factory_info t2 on t1.strategy_no=t2.strategy_no and t2.status='1'
WHERE
1=1
AND t1.strategy_no IN
<foreach item="item" collection="strategyNo" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="greenId!=null and greenId!=''">
AND green_id=#{greenId}
</if>
<if test="type!=null and type!=''">
AND t1.type=#{type}
</if>
</select>
<select id="getstrategyNo" resultType="java.lang.String">
SELECT
strategy_no
......@@ -208,6 +233,23 @@
<if test="crossId!=null and crossId!=''">
AND cross_id=#{crossId}
</if>
<if test="type!=null and type!=''">
AND type=#{type}
</if>
</select>
<select id="getGreenstrategyNo" resultType="java.lang.String">
SELECT
strategy_no
FROM
t_strategy_priority_config
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>
<insert id="savePlanConfig" parameterType="java.util.List" >
......
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