Commit 2366e1f4 authored by duanruiming's avatar duanruiming

[add] 策略查询修改数据结构;增加策略锁定接口

parent e4681840
......@@ -9,6 +9,7 @@ import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import net.wanji.opt.synthesis.pojo.vo.StrategyControlVO;
import net.wanji.opt.synthesis.pojo.vo.StrategyFactoryQueryVO;
import net.wanji.opt.synthesis.service.StrategyControlService;
import net.wanji.opt.vo.StrategyLockSendVO;
import net.wanji.opt.vo.StrategyNameCrossVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.validation.annotation.Validated;
......@@ -153,6 +154,18 @@ public class StrategyControlController {
return strategyControlService.strategyFactoryList(vo);
}
@ApiOperation(value = "策略管理-路口详情-策略锁定", notes = "策略管理-路口详情-策略锁定",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/strategyLockSend",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = StrategyNameCrossVO.class),
})
public JsonViewObject strategyLockCrossInfo(@RequestBody StrategyLockSendVO strategyLockSendVO) throws Exception {
return strategyControlService.strategyLockSend(strategyLockSendVO);
}
@ApiOperation(value = "策略管理-路口详情-优化策略查询", notes = "策略管理-路口详情-优化策略查询",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
......
......@@ -6,6 +6,7 @@ import net.wanji.opt.synthesis.pojo.StrategyControlDetailList;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import net.wanji.opt.synthesis.pojo.vo.StrategyControlVO;
import net.wanji.opt.synthesis.pojo.vo.StrategyFactoryQueryVO;
import net.wanji.opt.vo.StrategyLockSendVO;
import java.util.List;
......@@ -39,4 +40,6 @@ public interface StrategyControlService {
JsonViewObject strategyFactoryDel(List<Integer> ids) throws Exception;
JsonViewObject strategyNameCrossInfo(String crossId) throws Exception;
JsonViewObject strategyLockSend(StrategyLockSendVO strategyLockSendVO) throws Exception;
}
......@@ -28,6 +28,7 @@ import net.wanji.opt.synthesis.pojo.*;
import net.wanji.opt.synthesis.pojo.vo.*;
import net.wanji.opt.synthesis.service.PushStrategyControlService;
import net.wanji.opt.synthesis.service.StrategyControlService;
import net.wanji.opt.vo.StrategyLockSendVO;
import net.wanji.opt.vo.StrategyNameCrossVO;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
......@@ -1182,21 +1183,27 @@ public class StrategyControlServiceImpl implements StrategyControlService {
}
List<StrategyFactoryEntity> factoryEntities = strategyFactoryMapper.selectList(factoryQuery);
String currentName = "";
List<String> strategyNames = new ArrayList<>();
String currentNo = "";
List<StrategyNameCrossVO.Detail> details = new ArrayList<>();
for (StrategyFactoryEntity factoryEntity : factoryEntities) {
String company = factoryEntity.getCompany();
String strategyName = factoryEntity.getStrategyName();
String method = factoryEntity.getMethod();
String strategyNo = factoryEntity.getStrategyNo();
String name = String.join("-", company, method, strategyName);
strategyNames.add(name);
StrategyNameCrossVO.Detail detail = new StrategyNameCrossVO.Detail();
detail.setStrategyNo(strategyNo);
detail.setStrategyName(name);
details.add(detail);
if (StringUtils.equals(strategyNo, currentStrategyNo)) {
currentName = name;
currentNo = currentStrategyNo;
}
}
if (StringUtils.isNotBlank(currentName)) {
strategyNameCrossVO.setCurrentName(currentName);
strategyNameCrossVO.setStrategyNo(currentNo);
} else {
if (!CollectionUtils.isEmpty(factoryEntities)) {
StrategyFactoryEntity strategyFactoryEntity = factoryEntities.get(0);
......@@ -1205,9 +1212,10 @@ public class StrategyControlServiceImpl implements StrategyControlService {
String method = strategyFactoryEntity.getMethod();
String name = String.join("-", company, method, strategyName);
strategyNameCrossVO.setCurrentName(name);
strategyNameCrossVO.setStrategyNo(strategyFactoryEntity.getStrategyNo());
}
}
strategyNameCrossVO.setStrategyNames(strategyNames);
strategyNameCrossVO.setDetails(details);
}
return jsonViewObject.success(strategyNameCrossVO);
} catch (Exception e) {
......@@ -1215,4 +1223,11 @@ public class StrategyControlServiceImpl implements StrategyControlService {
return jsonViewObject.fail("策略管理-路口详情-优化策略查询失败");
}
}
@Override
public JsonViewObject strategyLockSend(StrategyLockSendVO strategyLockSendVO) throws Exception {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
log.error("收到请求参数:{}", strategyLockSendVO);
return jsonViewObject.success("策略锁定成功");
}
}
package net.wanji.opt.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author duanruiming
* @date 2025/02/15 14:51
* @description 策略管理-地图路口详情-策略锁定实体
*/
@Data
@ApiModel(value = "StrategyLockSendVO", description = "策略管理-地图路口详情-策略锁定实体")
public class StrategyLockSendVO {
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId;
@ApiModelProperty(name = "路口ID",notes = "")
private Double lockTime;
}
......@@ -14,5 +14,12 @@ import java.util.List;
@ApiModel(value = "StrategyNameCrossVO", description = "策略管理-路口详情-优化策略返回实体")
public class StrategyNameCrossVO {
private String currentName;
private List<String> strategyNames;
private String strategyNo;
private List<Detail> details;
@Data
public static class Detail {
private String strategyName;
private String strategyNo;
}
}
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