Commit e1876760 authored by zhouleilei's avatar zhouleilei

神思定制化-海信信号机步进指令下发/取消

新增锁相/解除锁相功能
parent 8668906d
......@@ -154,7 +154,7 @@ public class ControlCommandController {
@AspectLog(description = "恢复时间表-恢复路口时间表执行(恢复固定配时)", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "恢复时间表-恢复路口时间表执行(恢复固定配时)", notes = "恢复时间表-恢复路口时间表执行(恢复固定配时)")
@PostMapping("/recoverSchedule")
public JsonViewObject recoverSchedule(@RequestParam String crossCode) throws Exception {
public JsonViewObject recoverSchedule(@RequestParam @Validated String crossCode) throws Exception {
return controlCommandService.recoverSchedule(crossCode);
}
......@@ -205,7 +205,7 @@ public class ControlCommandController {
/**
* 步进相位
*/
@AspectLog(description = "步进相位", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@AspectLog(description = "步进相位-神思定制化", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "步进相位", notes = "步进相位")
@PostMapping("/stepingPhase")
public JsonViewObject stepingPhase(@RequestBody @Validated StepingPhaseDTO stepingPhaseDTO) throws Exception{
......
......@@ -18,7 +18,10 @@ import net.wanji.utc.hisense.pojo.result.CrossSchemeRings;
import net.wanji.utc.hisense.service.StaticInfoService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import javax.ws.rs.core.MediaType;
......@@ -98,7 +101,7 @@ public class StaticInfoController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CoordinationStatus.class)
})
public JsonViewObject crossPlanId(@NotNull String crossId) throws Exception {
public JsonViewObject crossPlanId(@NotNull String crossId) throws Exception {
CoordinationStatus coordinationStatus = staticInfoService.crossPlan(crossId);
if (ObjectUtils.isNotEmpty(coordinationStatus)) {
return JsonViewObject.newInstance().success(coordinationStatus);
......
......@@ -35,6 +35,10 @@ public class CrossSchemeRings {
* 方案中环的个数
*/
private String ringCount;
/**
* 相位差
*/
private String offset;
/**
* 环中相位的顺序,i 表示环号。相位号之间用空格隔开,屏障之间用下划线”_”分隔。
*/
......
......@@ -138,7 +138,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
String CoordCycleStatus = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("CoordCycleStatus");
String CoordSyncStatus = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("CoordSyncStatus");
CoordinationStatus coordinationStatus = CoordinationStatus.builder()
.spot(spot)
.spot(crossId)
.coordPatternStatus(CoordPatternStatus)
.coordCycleStatus(CoordCycleStatus)
.coordSyncStatus(CoordSyncStatus)
......@@ -173,17 +173,18 @@ public class StaticInfoServiceImpl implements StaticInfoService {
String result = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
if (HttpConstants.RESULT_1.equals(result)){
//成功
String spot = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("Spot");
String patternRest = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("Pattern");
String cycleLen = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("CycleLen");
String ringCount = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("RingCount");
String offset = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("Offset");
List<Element> cycleElementList = postResult.selectNodes(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT + "/CycleList");
List<Element> phaseElementList = postResult.selectNodes(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT + "/PhaseList");
CrossSchemeRings crossSchemeRings = new CrossSchemeRings();
crossSchemeRings.setSpot(spot);
crossSchemeRings.setSpot(crossSchemeRingsDTO.getCrossId());
crossSchemeRings.setPattern(patternRest);
crossSchemeRings.setRingCount(ringCount);
crossSchemeRings.setCycleLen(cycleLen);
crossSchemeRings.setOffset(offset);
JSONObject jsonObject = new JSONObject();
for (Element cycle : cycleElementList) {
......
......@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dto.CrossIdDTO;
import net.wanji.databus.dto.ExtendPhaseDTO;
import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.vo.TempSchemeSendVO;
......@@ -164,14 +165,14 @@ public class ControlCommandController {
/**
* 恢复时间表
*
* @param crossCode
* @param crossIdDTO
* @return
*/
@AspectLog(description = "恢复时间表-恢复路口时间表执行", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "恢复时间表-恢复路口时间表执行", notes = "恢复时间表-恢复路口时间表执行")
@PostMapping("/recoverSchedule")
public JsonViewObject recoverSchedule(@RequestParam String crossCode) throws Exception {
return controlCommandStrategyService.recoverScheduleStrategy(crossCode);
public JsonViewObject recoverSchedule(@Validated @RequestBody CrossIdDTO crossIdDTO) throws Exception {
return controlCommandStrategyService.recoverScheduleStrategy(crossIdDTO.getCrossId());
}
/**
......@@ -255,6 +256,8 @@ public class ControlCommandController {
@ApiOperation(value = "海信-步进相位", notes = "海信-步进相位")
@PostMapping("/stepingPhase")
public JsonViewObject stepingPhase(@RequestBody @Validated StepingPhaseDTO stepingPhaseDTO) throws Exception{
//调用信控系统的步进功能,该controller为了保证对外提供的接口参数统一放在body里
// return controlCommandStrategyService.stepControlStrategy(stepingPhaseDTO.getCrossId(), stepingPhaseDTO.getCommand(), stepingPhaseDTO.getStepCount());
return controlCommandStrategyService.stepingPhase(stepingPhaseDTO);
}
......
......@@ -129,8 +129,8 @@ public class StaticInfoController {
@ApiResponse(code = 200, message = "OK", response = CrossSchedulesPO.class)
})
@ApiOperation(value = "获取当前运行方案号", notes = "获取当前运行方案号")
public JsonViewObject crossSchemeNo(@RequestParam String crossId) throws Exception {
return staticInfoService.crossSchemeNo(crossId);
public JsonViewObject crossSchemeNo(@Validated @RequestBody CrossIdDTO crossIdDTO) throws Exception {
return staticInfoService.crossSchemeNo(crossIdDTO.getCrossId());
}
@AspectLog(description = "方案环图请求", operationType = BaseEnum.OperationTypeEnum.QUERY)
@PostMapping(value = "/crossSchemeRings", produces = MediaType.APPLICATION_JSON)
......
......@@ -359,7 +359,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
@Override
public JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception {
String manufacturerCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossCode());
String manufacturerCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossId());
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
} else {
......
......@@ -182,7 +182,7 @@ public class WanJiControlCommandServiceImpl implements ControlCommandService {
*/
//海信协议
TempSchemeSendVO tempSchemeSendVO = getTempSchemeSendVO(schemeOptSendVO);
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossCode());
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossId());
jsonViewObject = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode).tempSchemeDetail(tempSchemeSendVO);
if (StringUtils.endsWithIgnoreCase("success", jsonViewObject.getStatus())) {
return jsonViewObject.success("万集标准协议下发临时方案成功!");
......@@ -199,7 +199,7 @@ public class WanJiControlCommandServiceImpl implements ControlCommandService {
TempSchemeSendVO tempSchemeSendVO = new TempSchemeSendVO();
//路口号
String crossCode = schemeOptSendVO.getCrossCode();
tempSchemeSendVO.setCrossCode(crossCode);
tempSchemeSendVO.setCrossId(crossCode);
List<SchemeSendVO.Pattern> patternList = schemeOptSendVO.getPatternList();
if (Optional.ofNullable(patternList).isPresent()) {
//现在系统只传一个方案
......@@ -240,7 +240,7 @@ public class WanJiControlCommandServiceImpl implements ControlCommandService {
}
@Override
public JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception {
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossCode());
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossId());
JsonViewObject jsonViewObject = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode).tempSchemeDetail(tempSchemeSendVO);
if (StringUtils.endsWithIgnoreCase("success", jsonViewObject.getStatus())) {
return jsonViewObject.success("下发临时方案成功!");
......@@ -263,8 +263,8 @@ public class WanJiControlCommandServiceImpl implements ControlCommandService {
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(stepingPhaseDTO.getCrossId());
JsonViewObject jsonViewObject = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode).stepingPhase(stepingPhaseDTO);
if (StringUtils.endsWithIgnoreCase("success", jsonViewObject.getStatus())) {
return jsonViewObject.success("海信-步进相位成功!");
return jsonViewObject.success("步进相位成功!");
}
return jsonViewObject.fail("海信-步进相位失败!");
return jsonViewObject.fail("步进相位失败!");
}
}
package net.wanji.databus.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/**
* @ClassName CrossIdDTO
* @Description crossId参数
* @Author zhouleilei
* @Date 2024/11/8 11:30
*/
@Data
@Valid
@ApiModel(value="根据路口编号查询", description="")
public class CrossIdDTO {
@ApiModelProperty(value = "路口ID")
@Pattern(regexp = "^[A-Za-z0-9]{11}$", message = "路口编号只能包含英文、数字,必须11个字符")
@NotNull(message = "crossId不能为空")
private String crossId;
}
......@@ -26,6 +26,11 @@ public class StepingPhaseDTO {
@NotNull(message = "crossId不能为空")
private String crossId;
@ApiModelProperty(value = "跳过几个相位,跳过几个相位")
@ApiModelProperty(value = "0 顺序步进 n 跳过n个相位")
@NotNull(message = "stepCount不能为空")
private Integer stepCount;
@ApiModelProperty(value = "1 开始步进 0 取消步进")
@NotNull(message = "command不能为空")
private Integer command;
}
package net.wanji.databus.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
......@@ -18,23 +18,26 @@ public class TempSchemeSendVO {
@ApiModelProperty(value = "路口编号", notes = "路口编号")
@Pattern(regexp = "^[A-Za-z0-9]{11}$", message = "路口编号只能包含英文、数字,必须11个字符")
@NotBlank(message = "路口编号不可为空")
private String crossCode;
private String crossId;
@ApiModelProperty(value = "基础方案号", notes = "优化的基础方案号,该方案号需在信号机提前配置")
@NotBlank(message = "基础方案号不能为空")
@NotBlank(message = "基础方案号pattern不能为空")
private String pattern;
@ApiModelProperty(value = "周期长", notes = "需要优化的周期长,单位秒")
@NotBlank(message = "周期长不能为空")
@NotBlank(message = "cycle不能为空")
private String cycle;
@ApiModelProperty(value = "相位差", notes = "相位差。需要优化的相位差,单位秒")
@NotBlank(message = "offset不能为空")
private String offset;
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=15(瓶颈模式,\n" +
"按比例调整)")
@NotBlank(message = "type不能为空")
private String type;
@ApiModelProperty(value = "比值", notes = "Type=1 时为预案模式,值为绿信比时间,Type=15 时为瓶颈模式,值为调整比例")
@ApiModelProperty(value = "绿信比时间", notes = "Type=1 时为预案模式,值为绿信比时间,Type=15 时为瓶颈模式,值为调整比例")
@NotBlank(message = "split不能为空")
private String split;
}
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