Commit 3de6c327 authored by duanruiming's avatar duanruiming

[add] 策略日计划保存优化

parent 93b08e28
package net.wanji.opt.controllerv2.strategy;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo;
import net.wanji.opt.entity.strategy.StrategyParameterConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo;
......@@ -14,19 +11,15 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroupVO;
import net.wanji.opt.servicev2.strategy.StrategyPriorityService;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import net.wanji.opt.api.ResultGenerator;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -115,7 +108,7 @@ public class StrategyPriorityController {
@ApiImplicitParam(name = "dataList", value = "优先级配置数据", required = false, dataType = "String"),
})
@PostMapping("/savePriority")
public JsonViewObject savePriority(@RequestBody List<StrategyPriorityGroup>dataList){
public JsonViewObject savePriority(@RequestBody List<StrategyPriorityGroupVO>dataList){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
strategyPriorityService.savePriority(dataList);
......@@ -152,7 +145,7 @@ public class StrategyPriorityController {
@ApiImplicitParam(name = "dailyPlanDetails", value = "日计划配置数据", required = false, dataType = "String"),
})
@PostMapping("/savePlanConfig")
public JsonViewObject savePlanConfig(@RequestBody List<StrategyPriorityGroup>dailyPlanDetails){
public JsonViewObject savePlanConfig(@RequestBody List<StrategyPriorityGroupVO>dailyPlanDetails){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
strategyPriorityService.savePlanConfig(dailyPlanDetails);
......@@ -189,10 +182,10 @@ public class StrategyPriorityController {
@ApiImplicitParam(name = "strategyPriorityGroup", value = "参数配置数据", required = false, dataType = "String"),
})
@PostMapping("/saveParamterConfig")
public JsonViewObject saveParamterConfig(@RequestBody StrategyPriorityGroup strategyPriorityGroup){
public JsonViewObject saveParamterConfig(@RequestBody StrategyPriorityGroupVO strategyPriorityGroupVO){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
strategyPriorityService.saveParamterConfig(strategyPriorityGroup);
strategyPriorityService.saveParamterConfig(strategyPriorityGroupVO);
jsonView.success();
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
......
package net.wanji.opt.dao.mapper.strategy;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.opt.entity.strategy.StrategyParameterConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo;
import java.util.List;
import java.util.Map;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDailyInfo>{
/**
* 查询表t_strategy_priority_daily_info所有信息
*/
List<StrategyPriorityDailyInfo> findAllStrategyPriorityDailyInfo();
/**
* 根据主键id查询表t_strategy_priority_daily_info信息
* @param id
*/
StrategyPriorityDailyInfo findStrategyPriorityDailyInfoByid(@Param("id") Long id);
import java.util.List;
public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDailyInfo> {
/**
* 查询表t_strategy_priority_daily_info所有信息
*/
List<StrategyPriorityDailyInfo> findAllStrategyPriorityDailyInfo();
/**
* 根据主键id查询表t_strategy_priority_daily_info信息
*
* @param id
*/
StrategyPriorityDailyInfo findStrategyPriorityDailyInfoByid(@Param("id") Long id);
/**
* 根据条件查询表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo
*/
List<StrategyPriorityDailyInfo> findStrategyPriorityDailyInfoByCondition(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/**
* 根据主键id查询表t_strategy_priority_daily_info信息
*
* @param id
*/
Integer deleteStrategyPriorityDailyInfoByid(@Param("id") Long id);
/**
* 根据条件查询表t_strategy_priority_daily_info信息
* @param strategyPriorityDailyInfo
*/
List<StrategyPriorityDailyInfo> findStrategyPriorityDailyInfoByCondition(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/**
* 根据主键id更新表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo
*/
Integer updateStrategyPriorityDailyInfoByid(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/**
* 根据主键id查询表t_strategy_priority_daily_info信息
* @param id
*/
Integer deleteStrategyPriorityDailyInfoByid(@Param("id") Long id);
/**
* 根据主键id更新表t_strategy_priority_daily_info信息
* @param strategyPriorityDailyInfo
*/
Integer updateStrategyPriorityDailyInfoByid(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/**
* 新增表t_strategy_priority_daily_info信息
* @param strategyPriorityDailyInfo
*/
Integer addStrategyPriorityDailyInfo(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/**
* 新增表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo
*/
Integer addStrategyPriorityDailyInfo(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
List<StrategyPriorityDailyInfo> pageStrategyCrossList();
List<StrategyPriorityDailyInfo> pageStrategyCrossList();
List<StrategyFactoryEntity> getStrategyList();
List<StrategyFactoryEntity> getStrategyList();
List<StrategyFactoryEntity> getSceneList(Integer type);
List<StrategyFactoryEntity> getSceneList(Integer type);
List<StrategyFactoryEntity> getCompanyList();
List<StrategyFactoryEntity> getCompanyList();
void savePriorityInsert(List<StrategyPriorityConfig> saveList);
void savePriorityInsert(List<StrategyPriorityConfig> saveList);
List<StrategyPriorityConfig> selectPriorityTable(String crossId);
List<StrategyPriorityConfig> selectPriorityTable(String crossId);
void deletePriorityConfig(String crossId);
void deletePriorityConfig(String crossId);
List<String> getstrategyNo(@Param("crossId") String crossId, @Param("type") Integer type);
List<String> getstrategyNo(@Param("crossId") String crossId,@Param("type") Integer type);
List<StrategyFactoryEntity> getPriorityConfigData(@Param("strategyNo") List<String> strategyNo, @Param("crossId") String crossId, @Param("type") Integer type);
List<StrategyFactoryEntity> getPriorityConfigData(@Param("strategyNo") List<String> strategyNo,@Param("crossId") String crossId,@Param("type") Integer type);
void savePlanConfig(@Param("savePlanList") List<StrategyPriorityDailyInfo> savePlanList);
void savePlanConfig(@Param("savePlanList") List<StrategyPriorityDailyInfo> savePlanList);
List<StrategyPriorityDailyInfo> selectPlanTable(String crossId);
List<StrategyPriorityDailyInfo> selectPlanTable(String crossId);
void deletePlanConfig(String crossId);
void deletePlanConfig(String crossId);
List<StrategyPriorityDailyInfo> getPlanConfigData(@Param("crossId") String crossId, @Param("type") Integer type);
List<StrategyPriorityDailyInfo> getPlanConfigData(@Param("crossId") String crossId,@Param("type")Integer type);
List<StrategyParameterConfig> paramterConfigTable(String crossId);
List<StrategyParameterConfig> paramterConfigTable(String crossId);
void deleteParamterConfig(String crossId);
void deleteParamterConfig(String crossId);
void saveParamConfig(@Param("savePlanList") List<StrategyParameterConfig> savePlanList);
void saveParamConfig(@Param("savePlanList") List<StrategyParameterConfig> savePlanList);
List<StrategyParameterConfig> getParamConfigData(@Param("crossId") String crossId, @Param("type") Integer type, @Param("strategyNo") String strategyNo);
List<StrategyParameterConfig> getParamConfigData(@Param("crossId") String crossId,@Param("type")Integer type,@Param("strategyNo") String strategyNo);
List<StrategyPriorityDailyInfo> getStrategyGreenWave();
List<StrategyPriorityDailyInfo> getStrategyGreenWave();
List<StrategyPriorityConfig> selectGreenPriorityTable(Integer greenId);
List<StrategyPriorityConfig> selectGreenPriorityTable(Integer greenId);
void deleteGreenPriorityConfig(Integer greenId);
void deleteGreenPriorityConfig(Integer greenId);
List<String> getGreenstrategyNo(@Param("greenId") Integer greenId, @Param("type") Integer type);
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);
List<StrategyFactoryEntity> getGreenPriorityConfigData(@Param("strategyNo") List<String> strategyNo, @Param("greenId") Integer greenId,@Param("type") Integer type);
List<StrategyPriorityDailyInfo> selectGreenPlanTable(Integer greenId);
List<StrategyPriorityDailyInfo> selectGreenPlanTable(Integer greenId);
void deleteGreenPlanConfig(Integer greenId);
void deleteGreenPlanConfig(Integer greenId);
List<StrategyPriorityDailyInfo> getGreenPlanConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type);
List<StrategyPriorityDailyInfo> getGreenPlanConfigData(@Param("greenId") Integer greenId,@Param("type")Integer type);
List<StrategyParameterConfig> paramterGreenConfigTable(Integer greenId);
List<StrategyParameterConfig> paramterGreenConfigTable(Integer greenId);
void deleteGreenParamterConfig(Integer greenId);
void deleteGreenParamterConfig(Integer greenId);
List<StrategyParameterConfig> getGreenParamConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type, @Param("strategyNo") String strategyNo);
List<StrategyParameterConfig> getGreenParamConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type,@Param("strategyNo") String strategyNo);
/**
* 通过路口编号,分组编号查询策略详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List<StrategyFactoryEntity> selectCrossGroupStrategyList(@Param("crossId") String crossId, @Param("greenId") Integer greenId, @Param("groupId") Integer groupId);
}
package net.wanji.opt.entity.strategy;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.util.List;
import io.swagger.models.auth.In;
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 lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
import net.wanji.opt.entity.comprehensivequery.CrossEntity;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@TableName("t_strategy_priority_daily_info")
public class StrategyPriorityDailyInfo implements Serializable {
......@@ -68,5 +66,4 @@ public class StrategyPriorityDailyInfo implements Serializable {
private Integer type;
}
package net.wanji.opt.entity.strategy.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.models.auth.In;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import net.wanji.opt.entity.strategy.*;
import net.wanji.opt.entity.strategy.StrategyPriorityConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityParamter;
import net.wanji.opt.entity.strategy.StrategyPriorityPlanDetails;
import net.wanji.opt.entity.strategy.StrategySchedulingParam;
import java.util.List;
/**
* @author
* @date
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
public class StrategyPriorityGroup {
//分组ID
private Integer labelCode;
//分组名称
private String label;
//路口Id
private String crossId;
//路口Id
public class StrategyPriorityGroupVO {
@ApiModelProperty("分组ID")
private Integer groupId;
@ApiModelProperty("分组名称")
private String groupName;
@ApiModelProperty("路口编号列表")
private List<String> crossIds;
//执行时间
@ApiModelProperty("执行时间")
private String weekExecute;
//日计划编号
@ApiModelProperty("日计划编号")
private Integer dailyPlanId;
//策略编号
@ApiModelProperty("策略编号")
private String strategyNo;
//优先级的配置信息
@ApiModelProperty("优先级的配置信息")
private List<StrategyPriorityConfig> data;
//计划表的配置信息日计划详情
@ApiModelProperty("计划表的配置信息日计划详情")
private List<StrategyPriorityPlanDetails> dailyPlanDetails;
// 参数配置表的配置信息
private List<StrategyPriorityParamter> parameterConfigList;
// 调度配置表的配置信息
@ApiModelProperty("参数配置表的配置信息")
private List<StrategyPriorityParamter> parameterConfigList;
@ApiModelProperty("调度配置表的配置信息")
private StrategySchedulingParam schedulingParamters;
//1:路口,2干线
@ApiModelProperty("类型:1:路口,2干线")
private Integer type;
//干线 ID
private Integer greenId;
//干线 IDs
@ApiModelProperty("干线编号列表")
private List<Integer> greenIds;
//策略名称 参数配置神思用
/**
* 策略名称 参数配置神思用
*/
private String strategyName;
//场景 参数配置神思用
/**
* 场景 参数配置神思用
*/
private String method;
//场景code 参数配置神思用
/**
* 场景code 参数配置神思用
*/
private Integer scene;
}
......@@ -366,7 +366,9 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
stringBuilder.append(GreenBeltDirEnum.getCode(Integer.valueOf(dir))).append(",");
}
}
result.setGreenDir(stringBuilder.toString());
int length = stringBuilder.length();
String substring = stringBuilder.substring(0, length - 1);
result.setGreenDir(substring);
}
}
});
......
package net.wanji.opt.servicev2.strategy;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.models.auth.In;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.strategy.StrategyParameterConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroupVO;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -33,16 +27,16 @@ public interface StrategyPriorityService extends IService<StrategyPriorityDailyI
List<StrategyFactoryEntity> getCompanyList();
void savePriority(List<StrategyPriorityGroup> dataList) throws Exception;
void savePriority(List<StrategyPriorityGroupVO> dataList) throws Exception;
List<StrategyFactoryEntity> getPriorityData(String crossId,Integer greenId, Integer type) throws Exception;
void savePlanConfig(List<StrategyPriorityGroup> dailyPlanDetails) throws Exception;
void savePlanConfig(List<StrategyPriorityGroupVO> dailyPlanDetails) throws Exception;
List<StrategyPriorityDailyInfo> getPlanConfigData(String crossId, Integer greenId,Integer type);
void saveParamterConfig(StrategyPriorityGroup strategyPriorityGroup) throws Exception;
void saveParamterConfig(StrategyPriorityGroupVO strategyPriorityGroupVO) throws Exception;
List<StrategyParameterConfig> getParamConfigData(String crossId,Integer greenId, Integer type,String strategyNo);
......
......@@ -8,7 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.dao.mapper.strategy.StrategyPriorityMapper;
import net.wanji.opt.entity.strategy.*;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroupVO;
import net.wanji.opt.servicev2.strategy.StrategyPriorityService;
import net.wanji.opt.synthesis.pojo.Result;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
......@@ -89,20 +89,23 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
return strategyList;
}
/*
/**
* 策略优先级保存 路口 干线共用
* */
*
* @param dataList
* @throws Exception
*/
@Override
@Transactional
public void savePriority(List<StrategyPriorityGroup> dataList) throws Exception {
public void savePriority(List<StrategyPriorityGroupVO> dataList) throws Exception {
try {
List<StrategyPriorityConfig> saveList = new ArrayList<>();
for (StrategyPriorityGroup group : dataList) {
for (StrategyPriorityGroupVO group : dataList) {
//Type : 1;路口2:干线
Integer typePd = group.getType();
if (typePd == 1) {
String label = group.getLabel();
Integer labelCode = group.getLabelCode();
String groupName = group.getGroupName();
Integer groupId = group.getGroupId();
//1;路口2干线
Integer type = group.getType();
//路口id
......@@ -120,9 +123,9 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
StrategyPriorityConfig strategyPriorityConfig = new StrategyPriorityConfig();
strategyPriorityConfig.setCrossId(crossId);
//分组id
strategyPriorityConfig.setGroupId(labelCode);
strategyPriorityConfig.setGroupId(groupId);
//分组名称
strategyPriorityConfig.setGroupName(label);
strategyPriorityConfig.setGroupName(groupName);
//策略编号
strategyPriorityConfig.setStrategyNo(item.getStrategyNo());
//优先级
......@@ -134,8 +137,8 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
}
}
} else if (typePd == 2) {
String label = group.getLabel();
Integer labelCode = group.getLabelCode();
String label = group.getGroupName();
Integer labelCode = group.getGroupId();
//1;路口2干线
Integer type = group.getType();
//干线id
......@@ -228,12 +231,12 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
* */
@Override
@Transactional
public void savePlanConfig(List<StrategyPriorityGroup> dailyPlanDetails) throws Exception {
public void savePlanConfig(List<StrategyPriorityGroupVO> dailyPlanDetails) throws Exception {
try {
List<StrategyPriorityDailyInfo> savePlanList = new ArrayList<>();
ObjectMapper objectMapper = new ObjectMapper();
for (StrategyPriorityGroup group : dailyPlanDetails) {
for (StrategyPriorityGroupVO group : dailyPlanDetails) {
//Type : 1;路口2:干线
Integer typePd = group.getType();
if (typePd == 1) {
......@@ -260,6 +263,19 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
//取出日计划详情
List<StrategyPriorityPlanDetails> dailyPlanDetails1 = group.getDailyPlanDetails();
if (CollectionUtils.isNotEmpty(dailyPlanDetails1)) {
dailyPlanDetails1.forEach(item -> {
StringBuilder sb = new StringBuilder();
List<StrategyFactoryEntity> factoryList = strategyPriorityMapper.selectCrossGroupStrategyList(crossId, null, item.getGroupId());
if (CollectionUtils.isNotEmpty(factoryList)) {
for (StrategyFactoryEntity factory : factoryList) {
sb.append(factory.getMethod()).append(",");
}
String content = sb.substring(0, sb.length() - 1);
item.setContent(content);
}
});
}
String dailyPlanDetailsJson = JSON.toJSONString(dailyPlanDetails1);
strategyPriorityDailyInfo.setDailyPlanDetails(dailyPlanDetailsJson);
......@@ -289,6 +305,19 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
//取出日计划详情
List<StrategyPriorityPlanDetails> dailyPlanDetails1 = group.getDailyPlanDetails();
if (CollectionUtils.isNotEmpty(dailyPlanDetails1)) {
dailyPlanDetails1.forEach(item -> {
StringBuilder sb = new StringBuilder();
List<StrategyFactoryEntity> factoryList = strategyPriorityMapper.selectCrossGroupStrategyList(null, greenId, item.getGroupId());
if (CollectionUtils.isNotEmpty(factoryList)) {
for (StrategyFactoryEntity factory : factoryList) {
sb.append(factory.getMethod()).append(",");
}
String content = sb.substring(0, sb.length() - 1);
item.setContent(content);
}
});
}
String dailyPlanDetailsJson = JSON.toJSONString(dailyPlanDetails1);
strategyPriorityDailyInfo.setDailyPlanDetails(dailyPlanDetailsJson);
......@@ -301,9 +330,9 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
List<StrategyPriorityPlanPush> strategyPriorityPlanPush = pushStrategyPriorityPlan(dailyPlanDetails);
//推送日计划配置到神思
StrategyPriorityPlanPushReq req = new StrategyPriorityPlanPushReq();
req.setData(strategyPriorityPlanPush);
Result result = pushStrategyControlService.StartegyPriorityPlanPush(req);
StrategyPriorityPlanPushReq req = new StrategyPriorityPlanPushReq();
req.setData(strategyPriorityPlanPush);
Result result = pushStrategyControlService.StartegyPriorityPlanPush(req);
} catch (Exception e) {
log.error("{} savePlanConfig", this.getClass().getSimpleName(), e);
throw e;
......@@ -338,7 +367,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
* */
@Override
@Transactional
public void saveParamterConfig(StrategyPriorityGroup group) throws Exception {
public void saveParamterConfig(StrategyPriorityGroupVO group) throws Exception {
try {
List<StrategyParameterConfig> savePlanList = new ArrayList<>();
......@@ -610,7 +639,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
// return pushStrategyPriorityList;
// }
/*优先级配置神思推送*/
private List<StrategyPriorityConfigPush> pushStrategyPriorityConfig(List<StrategyPriorityGroup> dataList) {
private List<StrategyPriorityConfigPush> pushStrategyPriorityConfig(List<StrategyPriorityGroupVO> dataList) {
// 最终优先级配置推送神思
List<StrategyPriorityConfigPush> pushStrategyPriorityList = new ArrayList<>();
......@@ -618,7 +647,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
StrategyPriorityConfigPush strategyPriorityConfigPush = new StrategyPriorityConfigPush();
// 分组详情列表
List<GroupIdDetails> groupIdDetailsList = new ArrayList<>();
for (StrategyPriorityGroup group : dataList) {
for (StrategyPriorityGroupVO group : dataList) {
// 设置基本信息
Integer type = group.getType();
......@@ -636,8 +665,8 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
GroupIdDetails groupIdDetails = new GroupIdDetails();
// 设置分组名称和编号
groupIdDetails.setGroupName(group.getLabel());
groupIdDetails.setGroupId(group.getLabelCode());
groupIdDetails.setGroupName(group.getGroupName());
groupIdDetails.setGroupId(group.getGroupId());
// 创建一个临时列表,用于存储所有策略详情数据
List<StrategyPriorityDetailsPush> detailsList = new ArrayList<>();
......@@ -678,14 +707,14 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
}
/*日计划配置神思推送*/
private List<StrategyPriorityPlanPush> pushStrategyPriorityPlan(List<StrategyPriorityGroup> dailyPlanDetails) {
private List<StrategyPriorityPlanPush> pushStrategyPriorityPlan(List<StrategyPriorityGroupVO> dailyPlanDetails) {
//日计划推送到神思
List<StrategyPriorityPlanPush> strategyPriorityPlanPushList = new ArrayList<>();
StrategyPriorityPlanPush strategyPriorityPlanPush = new StrategyPriorityPlanPush();
//
List<DailyPlanDetails> dailyPlanDetailsList = new ArrayList<>();
for (StrategyPriorityGroup group : dailyPlanDetails) {
for (StrategyPriorityGroupVO group : dailyPlanDetails) {
Integer type = group.getType();
strategyPriorityPlanPush.setType(type);
......@@ -742,7 +771,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
}
/*参数配置神思推送*/
private List<StrategyParameterPush> pushStrategyPriorityParam(StrategyPriorityGroup group) {
private List<StrategyParameterPush> pushStrategyPriorityParam(StrategyPriorityGroupVO group) {
List<StrategyParameterPush> StrategyParameterPushList = new ArrayList<>();
//推送神思接口
StrategyParameterPush strategyParameterPush = new StrategyParameterPush();
......
......@@ -61,10 +61,10 @@ public class StrategyFactoryEntity {
* 分组名称
*/
@TableField(exist = false)
private String label;
private String groupName;
/**
* 分组ID
*/
@TableField(exist = false)
private Integer labelCode;
private Integer groupId;
}
spring:
profiles:
active: test
logging:
level:
org.apache.ibatis: DEBUG
\ No newline at end of file
......@@ -2,7 +2,7 @@
<!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
......@@ -10,46 +10,46 @@
<!-- 通用条件列 -->
<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>
<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>
<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"/>
<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所有信息 -->
......@@ -73,7 +73,7 @@
<include refid="Base_Column_List"/>
FROM t_strategy_priority_daily_info
WHERE 1=1
<include refid="StrategyPriorityDailyInfoByCondition" />
<include refid="StrategyPriorityDailyInfoByCondition"/>
</select>
<!-- 根据主键id删除表t_strategy_priority_daily_info信息 -->
......@@ -84,7 +84,8 @@
</delete>
<!-- 根据主键id更新表t_strategy_priority_daily_info信息 -->
<update id="updateStrategyPriorityDailyInfoByid" parameterType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
<update id="updateStrategyPriorityDailyInfoByid"
parameterType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
UPDATE t_strategy_priority_daily_info
<set>
<include refid="StrategyPriorityDailyInfoSetColumns"/>
......@@ -96,60 +97,61 @@
<!-- 新增表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
id
,daily_plan_id
,week_execute
,daily_plan_details
,cross_id
) VALUES (
#{id}
,#{dailyPlanId}
,#{weekExecute}
,#{dailyPlanDetails}
,#{crossId}
#{id}
,#{dailyPlanId}
,#{weekExecute}
,#{dailyPlanDetails}
,#{crossId}
)
</insert>
<select id="pageStrategyCrossList" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
<select id="pageStrategyCrossList" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT
DISTINCT
t4.`name` as waveName, t3.`name` as crossName,
t3.id as crossId,
GROUP_CONCAT(t2.daily_plan_details SEPARATOR ', ') AS dailyPlanDetails
DISTINCT
t4.`name` as waveName, t3.`name` as crossName,
t3.id as crossId,
GROUP_CONCAT(t2.daily_plan_details SEPARATOR ', ') AS dailyPlanDetails
FROM
t_base_cross_info t3
t_base_cross_info t3
LEFT join t_greenwave_cross t1 on t3.id =t1.cross_id
LEFT JOIN t_strategy_priority_daily_info t2 on t3.id = t2.cross_id and t2.type=1
LEFT JOIN t_greenwave_info t4 on t4.id = t1.green_id
WHERE t3.is_signal='1'
LEFT JOIN t_strategy_priority_daily_info t2 on t3.id = t2.cross_id and t2.type=1
LEFT JOIN t_greenwave_info t4 on t4.id = t1.green_id
WHERE t3.is_signal='1'
GROUP BY t3.id
</select>
<select id="getStrategyList" parameterType="map" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT
Distinct
*
Distinct
*
FROM
t_strategy_factory_info
WHERE status='1'
t_strategy_factory_info
WHERE status='1'
</select>
<select id="getSceneList" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT
Distinct
*
*
FROM
t_strategy_factory_info
WHERE status='1'
<if test="type != null and type == 1">
AND type = 1
</if>
t_strategy_factory_info
WHERE status='1'
<if test="type != null and type == 1">
AND type = 1
</if>
</select>
<select id="getCompanyList" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT
Distinct
*
Distinct
*
FROM
t_strategy_factory_info
WHERE status='1'
t_strategy_factory_info
WHERE status='1'
</select>
<insert id="savePriorityInsert" parameterType="java.util.List">
......@@ -162,52 +164,55 @@
</insert>
<select id="selectPriorityTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityConfig">
<select id="selectPriorityTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityConfig">
select
id,group_id,cross_id
FROM
t_strategy_priority_config
id,group_id,cross_id
FROM
t_strategy_priority_config
WHERE
1=1
1=1
<if test="crossId!=null and crossId!=''">
and cross_id = #{crossId}
and cross_id = #{crossId}
</if>
</select>
<delete id="deletePriorityConfig" parameterType="map">
DELETE
FROM t_strategy_priority_config
WHERE cross_id =#{crossId}
DELETE
FROM t_strategy_priority_config
WHERE cross_id =#{crossId}
</delete>
<select id="getPriorityConfigData" parameterType="map" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT t2.status,t2.scene,
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>
<select id="getPriorityConfigData" parameterType="map"
resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT t2.status,t2.scene,
t2.method,t2.strategy_name,t2.strategy_no,
t2.mark,t2.company,t1.priority as priority,t1.id,
t1.group_id, t1.group_name, 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="crossId!=null and crossId!=''">
AND t1.cross_id=#{crossId}
AND t1.cross_id=#{crossId}
</if>
<if test="type!=null and type!=''">
AND t1.type=#{type}
AND t1.type=#{type}
</if>
</select>
<select id="getGreenPriorityConfigData" parameterType="map" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT t2.status,
<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'
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
......@@ -215,25 +220,25 @@
#{item}
</foreach>
<if test="greenId!=null and greenId!=''">
AND green_id=#{greenId}
AND green_id=#{greenId}
</if>
<if test="type!=null and type!=''">
AND t1.type=#{type}
AND t1.type=#{type}
</if>
</select>
<select id="getstrategyNo" resultType="java.lang.String">
SELECT
strategy_no
FROM
t_strategy_priority_config
WHERE
1=1
<if test="crossId!=null and crossId!=''">
AND cross_id=#{crossId}
</if>
SELECT
strategy_no
FROM
t_strategy_priority_config
WHERE
1=1
<if test="crossId!=null and crossId!=''">
AND cross_id=#{crossId}
</if>
<if test="type!=null and type!=''">
AND type=#{type}
AND type=#{type}
</if>
</select>
<select id="getGreenstrategyNo" resultType="java.lang.String">
......@@ -244,22 +249,23 @@
WHERE
1=1
<if test="greenId!=null and greenId!=''">
AND green_id=#{greenId}
AND green_id=#{greenId}
</if>
<if test="type!=null and type!=''">
AND type=#{type}
AND type=#{type}
</if>
</select>
<insert id="savePlanConfig" parameterType="java.util.List" >
INSERT INTO
t_strategy_priority_daily_info (daily_plan_id,week_execute,daily_plan_details,cross_id,type,green_id)
VALUES
<foreach collection="savePlanList" item="item" separator=",">
(#{item.dailyPlanId},#{item.weekExecute},#{item.dailyPlanDetails},#{item.crossId},#{item.type},#{item.greenId})
</foreach>
<insert id="savePlanConfig" parameterType="java.util.List">
INSERT INTO
t_strategy_priority_daily_info (daily_plan_id,week_execute,daily_plan_details,cross_id,type,green_id)
VALUES
<foreach collection="savePlanList" item="item" separator=",">
(#{item.dailyPlanId},#{item.weekExecute},#{item.dailyPlanDetails},#{item.crossId},#{item.type},#{item.greenId})
</foreach>
</insert>
<select id="selectPlanTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
<select id="selectPlanTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
select
id,daily_plan_id,cross_id
FROM
......@@ -270,7 +276,8 @@
and cross_id = #{crossId}
</if>
</select>
<select id="selectGreenPlanTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
<select id="selectGreenPlanTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
select
id,daily_plan_id,cross_id
FROM
......@@ -283,7 +290,7 @@
</select>
<delete id="deletePlanConfig">
DELETE
FROM t_strategy_priority_daily_info
FROM t_strategy_priority_daily_info
WHERE cross_id =#{crossId}
</delete>
<delete id="deleteGreenPlanConfig">
......@@ -291,13 +298,14 @@
FROM t_strategy_priority_daily_info
WHERE green_id =#{greenId}
</delete>
<select id="getPlanConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
<select id="getPlanConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT
id,daily_plan_id,week_execute,daily_plan_details,cross_id
FROM
t_strategy_priority_daily_info
t_strategy_priority_daily_info
WHERE
1=1
1=1
<if test="crossId!=null and crossId!=''">
and cross_id = #{crossId}
</if>
......@@ -305,7 +313,8 @@
and type = #{type}
</if>
</select>
<select id="getGreenPlanConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
<select id="getGreenPlanConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT
id,daily_plan_id,week_execute,daily_plan_details,cross_id
FROM
......@@ -319,24 +328,26 @@
and type = #{type}
</if>
</select>
<select id="paramterConfigTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
<select id="paramterConfigTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT
id,cross_id
FROM t_strategy_priority_parameter
id,cross_id
FROM t_strategy_priority_parameter
WHERE
1=1
1=1
<if test="crossId!=null">
AND cross_id =#{crossId}
AND cross_id =#{crossId}
</if>
</select>
<select id="paramterGreenConfigTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
<select id="paramterGreenConfigTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT
id,cross_id
FROM t_strategy_priority_parameter
FROM t_strategy_priority_parameter
WHERE
1=1
<if test="greenId!=null">
AND green_id =#{greenId}
AND green_id =#{greenId}
</if>
</select>
......@@ -350,25 +361,26 @@
FROM t_strategy_priority_parameter
WHERE green_id = #{greenId}
</delete>
<insert id="saveParamConfig" parameterType="list" >
<insert id="saveParamConfig" parameterType="list">
INSERT INTO t_strategy_priority_parameter
(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.type},#{item.greenId})
</foreach>
(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.type},#{item.greenId})
</foreach>
</insert>
<select id="getParamConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
<select id="getParamConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT
id,strategy_no,cross_id,param_details,scheduling_param,type
FROM
id,strategy_no,cross_id,param_details,scheduling_param,type
FROM
t_strategy_priority_parameter
WHERE
1=1
<if test="crossId!=null and crossId!=''" >
AND cross_id =#{crossId}
</if>
1=1
<if test="crossId!=null and crossId!=''">
AND cross_id =#{crossId}
</if>
<if test="type!=null and type!=''">
and type = #{type}
</if>
......@@ -377,7 +389,8 @@
</if>
</select>
<select id="getGreenParamConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
<select id="getGreenParamConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT
id,strategy_no,cross_id,param_details,type
FROM
......@@ -395,16 +408,18 @@
</if>
</select>
<select id="getStrategyGreenWave" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
<select id="getStrategyGreenWave" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT t1.green_id as greenId, t4.name as waveName, t1.cross_id as crossId,
t3.name as crossName,t1.sort,
t2.daily_plan_details as dailyPlanDetails
FROM t_greenwave_info t4
LEFT JOIN t_greenwave_cross t1 on t1.green_id = t4.id
LEFT JOIN t_strategy_priority_daily_info t2 on t1.green_id = t2.green_id and t2.type=2
LEFT JOIN t_base_cross_info t3 on t1.cross_id = t3.id
t3.name as crossName,t1.sort,
t2.daily_plan_details as dailyPlanDetails
FROM t_greenwave_info t4
LEFT JOIN t_greenwave_cross t1 on t1.green_id = t4.id
LEFT JOIN t_strategy_priority_daily_info t2 on t1.green_id = t2.green_id and t2.type=2
LEFT JOIN t_base_cross_info t3 on t1.cross_id = t3.id
</select>
<select id="selectGreenPriorityTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityConfig">
<select id="selectGreenPriorityTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityConfig">
select
id,group_id,cross_id
FROM
......@@ -421,4 +436,24 @@
WHERE green_id =#{greenId}
</delete>
<select id="selectCrossGroupStrategyList" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
select t2.type, t2.scene, t2.strategy_name, t2.strategy_no, t2.method, t2.company,
t2.mark, t2.status, t2.opt_type, t2.create_time, t2.modify_time
from t_strategy_priority_config t1
left join t_strategy_factory_info t2 on t1.strategy_no = t2.strategy_no
<where>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
</if>
<if test="greenId!=null and greenId!=''">
and t1.green_id = #{greenId}
</if>
<if test="groupId != null and groupId != ''">
and t1.group_id = #{groupId}
</if>
order by t1.priority
</where>
</select>
</mapper>
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