Commit b75dd53f authored by duanruiming's avatar duanruiming

[update] 海康批量校时接口

parent 83505167
...@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.Objects;
import static net.wanji.utc.common.constant.Constants.*; import static net.wanji.utc.common.constant.Constants.*;
...@@ -198,7 +199,10 @@ public class ControlCommandController { ...@@ -198,7 +199,10 @@ public class ControlCommandController {
@AspectLog(description = "信号机校时", operationType = BaseEnum.OperationTypeEnum.UPDATE) @AspectLog(description = "信号机校时", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "信号机校时", notes = "信号机校时") @ApiOperation(value = "信号机校时", notes = "信号机校时")
@PostMapping("/signalTiming") @PostMapping("/signalTiming")
public JsonViewObject signalTiming(@RequestParam String crossCode, @RequestParam Date date) throws Exception { public JsonViewObject signalTiming(@RequestParam String crossCode, Date date) throws Exception {
if (Objects.isNull(date)) {
date = new Date();
}
return controlCommandStrategyService.timing(crossCode, date); return controlCommandStrategyService.timing(crossCode, date);
} }
......
...@@ -295,6 +295,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -295,6 +295,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
String manufacturerCode = crossInfoCache.getManufacturerCodeByCrossId(crossCode); String manufacturerCode = crossInfoCache.getManufacturerCodeByCrossId(crossCode);
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) { if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
jsonViewObject = hkControlCommandService.timing(crossCode, date);
} else { } else {
jsonViewObject = wanJiControlCommandService.timing(crossCode, date); jsonViewObject = wanJiControlCommandService.timing(crossCode, date);
} }
......
...@@ -9,6 +9,7 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig; ...@@ -9,6 +9,7 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dao.entity.CrossPhasePO; import net.wanji.databus.dao.entity.CrossPhasePO;
import net.wanji.databus.dao.entity.SetTimingPO;
import net.wanji.databus.dao.mapper.CrossInfoMapper; import net.wanji.databus.dao.mapper.CrossInfoMapper;
import net.wanji.databus.dao.mapper.CrossPhaseMapper; import net.wanji.databus.dao.mapper.CrossPhaseMapper;
import net.wanji.databus.dao.mapper.ManufacturerInfoMapper; import net.wanji.databus.dao.mapper.ManufacturerInfoMapper;
...@@ -534,7 +535,19 @@ public class HKControlCommandServiceImpl implements ControlCommandService { ...@@ -534,7 +535,19 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
@Override @Override
public JsonViewObject timing(String crossCode, Date date) throws Exception { public JsonViewObject timing(String crossCode, Date date) throws Exception {
return null; SetTimingPO setTimingPO = new SetTimingPO();
setTimingPO.setTurnOffOn(1);
setTimingPO.setSystemAdjustime("1");
setTimingPO.setNtpInfo("10.102.1.183:80");
setTimingPO.setIntervalTime(60);
setTimingPO.setTimingImmediate(1);
Map<String, String> path = PathUtil.getPathMapByApiCode("setTiming");
String strResult = ArtemisHttpUtil.doPostStringArtemis(artemisConfig, path, JSON.toJSONString(setTimingPO), null, null, "application/json", null);
HKResponse hkResponse = JSONObject.parseObject(strResult, HKResponse.class);
if (Objects.nonNull(hkResponse) && Objects.equals(HK_SUCCESS_STRING_CODE, hkResponse.getCode())) {
return JsonViewObject.newInstance().success("海康信号机批量校时控制成功");
}
return JsonViewObject.newInstance().fail("海康信号机批量校时控制失败");
} }
@Override @Override
......
package net.wanji.databus.dao.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author duanruiming
* @date 2023/08/09 8:36
*/
@Data
@ApiModel(value = "信号机设置校时实体")
public class SetTimingPO {
@ApiModelProperty(name = "0-不启用校时, 1-不启用校时", notes = "")
private Integer turnOffOn;
@ApiModelProperty(name = "0-系统时间校时, 1-NTP校时", notes = "")
private String systemAdjustime;
@ApiModelProperty(name = "systemAdjustime=1, NTP校时地址", notes = "")
private String ntpInfo;
@ApiModelProperty(name = "校时时间间隔(分钟)", notes = "")
private Integer intervalTime;
@ApiModelProperty(name = "0-时间间隔校时,1-立即校时", notes = "")
private Integer timingImmediate;
}
...@@ -10,6 +10,7 @@ import java.util.Date; ...@@ -10,6 +10,7 @@ import java.util.Date;
/** /**
* @author duanruiming * @author duanruiming
* @date 2023/08/08 18:00 * @date 2023/08/08 18:00
* @description 海康信号机返回校时实体
*/ */
@Data @Data
@ApiModel(value = "信号机返回校时实体") @ApiModel(value = "信号机返回校时实体")
......
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