Commit b96c1be1 authored by duanruiming's avatar duanruiming

[add] 海康与万集信号机控制模式转换

parent 682d24af
......@@ -8,9 +8,7 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wanji.utc.common.baseentity.BaseCrossInfo;
import net.wanji.utc.common.commonentity.HttpRequest;
import net.wanji.utc.common.constant.Constants;
import net.wanji.utc.common.typeenum.BasicEnum;
import net.wanji.utc.mapper.CrossInfoMapper;
import net.wanji.utc.mapper.CrossLightsMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
......@@ -18,9 +16,8 @@ import net.wanji.utc.po.CrossLightsPO;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.runninginfo.HkLightsStatusService;
import net.wanji.utc.util.PathUtil;
import net.wanji.utc.util.StringUtils;
import net.wanji.utc.vo.LightsStatusVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
......@@ -41,6 +38,17 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
private final CrossInfoMapper crossInfoMapper;
private final ManufacturerInfoMapper manufacturerInfoMapper;
public static Map<String, String> runModeParseMap = new HashMap<String, String>();
static {
// key:海康控制模式 value:万集控制模式
runModeParseMap.put("2", "4"); // 黄闪
runModeParseMap.put("3", "3"); // 全红
runModeParseMap.put("4", "11"); // 定周期=恢复时间表
runModeParseMap.put("10", "9"); // 步进
runModeParseMap.put("12", "2"); // 相位锁定
}
@Override
public List<LightsStatusVO> getHkLightsStatus(List<BaseCrossInfo> baseCrossInfoList) {
List<LightsStatusVO> result = new ArrayList<>();
......@@ -75,7 +83,15 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
String patternNo = jsonObject.getString("patternNo"); // 方案编号
JSONArray rings = jsonObject.getJSONArray("rings"); // 环列表
JSONArray channelState = jsonObject.getJSONArray("channelState"); // 灯组列表
infoVo.setRunMode(jsonObject.getString("controlType")); // 控制模式
String HKControlType = jsonObject.getString("controlType");
String WJControlType = null;
if (StringUtils.isNotBlank(HKControlType)) {
WJControlType = runModeParseMap.get(HKControlType);
}
if (StringUtils.isEmpty(WJControlType)) {
WJControlType = "255";// 转换失败默认临时方案
}
infoVo.setRunMode(WJControlType);// 控制模式
infoVo.setPhasePlanId(patternNo); // 相位方案号
int cycleLen = jsonObject.getIntValue("cycle"); // 周期时长
int curRunTime = jsonObject.getIntValue("curRunTime"); // 当前运行时长
......
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