feat: mqtt增加设置和查询终端系统时间

dev
huangfeng 2 months ago
parent 7a0f83b654
commit a552791773

@ -4,6 +4,7 @@ import com.shxy.xymanager_common.exception.ApiException;
import com.shxy.xymanager_common.model.mqtt.MessageSend;
import com.shxy.xymanager_common.model.mqtt.ParamArray;
import com.shxy.xymanager_common.model.mqtt.Paras;
import com.shxy.xymanager_common.util.DateUtil;
import com.shxy.xymanager_service.mqtt.MqttPublisherService;
import com.shxy.xymanager_service.service.MqttService;
import lombok.extern.slf4j.Slf4j;
@ -12,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -47,7 +49,9 @@ public class MqttServiceImpl implements MqttService {
private MessageSend buildMessage(Map<String, String> map) {
MessageSend msg = new MessageSend();
Paras paras = msg.getParas();
Integer channel, preset, ctrl;
Integer channel, preset, ctrl, flag, group;
Long time;
String str;
String act = map.get("act");
switch (act) {
case "capture":
@ -70,22 +74,22 @@ public class MqttServiceImpl implements MqttService {
paras.setChannelId(String.valueOf(channel));
ctrl = Integer.parseInt(map.get("ctrl"));
paras.setActionCommand(ctrl);
if (ctrl == 2 || ctrl == 9) {
if (ctrl == 1 || ctrl == 2 || ctrl == 8 || ctrl == 9) {
preset = Integer.parseInt(map.get("preset"));
paras.setActionCommandParameter(preset);
}
break;
case "schedule":
Integer flag = Integer.parseInt(map.get("flag"));
Integer scheduleChannel = Integer.parseInt(map.get("channel"));
paras.setChannelNumber(scheduleChannel);
flag = Integer.parseInt(map.get("flag"));
channel = Integer.parseInt(map.get("channel"));
paras.setChannelNumber(channel);
if (flag == 0) {
msg.setServiceId("PlatformQueryDataCommandLssueService");
msg.setCmd("getCaptureTimesTaskInformation");
} else {
msg.setServiceId("PlatformSettingParameterLssueService");
msg.setCmd("setCaptureTimesTaskParameter");
Integer group = Integer.parseInt(map.get("group"));
group = Integer.parseInt(map.get("group"));
paras.setGroupNumber(group);
List<ParamArray> paramArrayList = new ArrayList<>();
for (int i = 1; i <= group; i++) {
@ -98,6 +102,21 @@ public class MqttServiceImpl implements MqttService {
paras.setParamArray(paramArrayList);
}
break;
case "time":
flag = Integer.parseInt(map.get("flag"));
if (flag == 0) {
msg.setServiceId("PlatformQueryDataCommandLssueService");
msg.setCmd("getDeviceTime");
} else {
msg.setServiceId("PlatformSettingParameterLssueService");
msg.setCmd("setDeviceTime");
time = Long.parseLong(map.get("time"));
Date date = new Date(time * 1000);
str = DateUtil.format(date, "yyyy-MM-ddTHH:mm:ssZ");
paras.setTime(str);
paras.setTimingType(0);
}
break;
default:
throw new ApiException(act + "暂时无法处理");
}

@ -1,8 +1,6 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.vo.TermCtrlVo;
import java.util.Map;
public interface MqttService {
@ -10,4 +8,5 @@ public interface MqttService {
void takePic(String cmdid, Integer channel, Integer preset, Integer type, Integer requestId) throws Exception;
void setTermCamera(Map<String, String> ctrlBeanMap, String cmdid) throws Exception;
}

Loading…
Cancel
Save