Commit afdca7dd authored by duanruiming's avatar duanruiming

优化信号控制参数校验

parent 373f2a42
...@@ -8,10 +8,7 @@ import net.wanji.feign.service.UtcFeignClients; ...@@ -8,10 +8,7 @@ import net.wanji.feign.service.UtcFeignClients;
import net.wanji.web.common.util.StringUtils; import net.wanji.web.common.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Objects; import java.util.Objects;
...@@ -102,9 +99,9 @@ public class SignalServiceController { ...@@ -102,9 +99,9 @@ public class SignalServiceController {
@ApiOperation(value = "恢复时间表-恢复路口时间表执行", notes = "恢复时间表-恢复路口时间表执行") @ApiOperation(value = "恢复时间表-恢复路口时间表执行", notes = "恢复时间表-恢复路口时间表执行")
@PostMapping("/recoverSchedule") @PostMapping("/recoverSchedule")
public JsonViewObject recoverSchedule(@RequestBody String code) throws Exception { public JsonViewObject recoverSchedule(@RequestParam String code) throws Exception {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isNotEmpty(code)) { if (StringUtils.isBlank(code)) {
return jsonViewObject.fail("路口编号不能为空"); return jsonViewObject.fail("路口编号不能为空");
} }
jsonViewObject = utcFeignClients.recoverSchedule(code); jsonViewObject = utcFeignClients.recoverSchedule(code);
......
...@@ -50,7 +50,7 @@ public class ControlCommandController { ...@@ -50,7 +50,7 @@ public class ControlCommandController {
*/ */
@ApiOperation(value = "计划下发-计划信息、时段信息", notes = "计划下发-计划信息、时段信息") @ApiOperation(value = "计划下发-计划信息、时段信息", notes = "计划下发-计划信息、时段信息")
@PostMapping("/planSend") @PostMapping("/planSend")
public JsonViewObject planSend(@RequestBody PlanSendVO planSendVO) throws Exception { public JsonViewObject planSend(@RequestBody @Validated PlanSendVO planSendVO) throws Exception {
return controlCommandStrategyService.planSendStrategy(planSendVO); return controlCommandStrategyService.planSendStrategy(planSendVO);
} }
...@@ -63,7 +63,7 @@ public class ControlCommandController { ...@@ -63,7 +63,7 @@ public class ControlCommandController {
*/ */
@ApiOperation(value = "时间表下发-时间表信息", notes = "时间表下发-时间表信息") @ApiOperation(value = "时间表下发-时间表信息", notes = "时间表下发-时间表信息")
@PostMapping("/scheduleSend") @PostMapping("/scheduleSend")
public JsonViewObject scheduleSend(@RequestBody ScheduleSendVO scheduleSendVO) throws Exception { public JsonViewObject scheduleSend(@RequestBody @Validated ScheduleSendVO scheduleSendVO) throws Exception {
return controlCommandStrategyService.scheduleSendStrategy(scheduleSendVO); return controlCommandStrategyService.scheduleSendStrategy(scheduleSendVO);
} }
...@@ -75,7 +75,7 @@ public class ControlCommandController { ...@@ -75,7 +75,7 @@ public class ControlCommandController {
*/ */
@ApiOperation(value = "相位配时下发-(下发相位参数)", notes = "相位配时下发-(下发相位参数)") @ApiOperation(value = "相位配时下发-(下发相位参数)", notes = "相位配时下发-(下发相位参数)")
@PostMapping("/phaseTimingSend") @PostMapping("/phaseTimingSend")
public JsonViewObject phaseTimingSend(@RequestBody PhaseTimingSendVO phaseTimingSendVO) throws Exception { public JsonViewObject phaseTimingSend(@RequestBody @Validated PhaseTimingSendVO phaseTimingSendVO) throws Exception {
return controlCommandStrategyService.phaseTimingSendStrategy(phaseTimingSendVO); return controlCommandStrategyService.phaseTimingSendStrategy(phaseTimingSendVO);
} }
......
...@@ -245,7 +245,10 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -245,7 +245,10 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
@Override @Override
public JsonViewObject recoverScheduleStrategy(String crossId) throws Exception { public JsonViewObject recoverScheduleStrategy(String crossId) throws Exception {
JsonViewObject jsonViewObject; JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isBlank(crossId)) {
return jsonViewObject.fail("路口编号不能为空");
}
String manufacturerIdCode = getManufacturerCodeByCrossId(crossId); String manufacturerIdCode = getManufacturerCodeByCrossId(crossId);
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerIdCode)) { if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerIdCode)) {
jsonViewObject = hkControlCommandService.recoverSchedule(crossId); jsonViewObject = hkControlCommandService.recoverSchedule(crossId);
......
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