任务号增加日期,以避免重复

master
yiming 3 years ago
parent b8b4861b06
commit 6cb148ff3e

@ -199,4 +199,30 @@ public class CameraController {
return Result.success();
}
@GetMapping("/rtcConfig")
@ApiOperation(value = "获取rtcConfig")
public Result<String> rtcConfig(String rtcServer) {
List<Camera> cameraList = cameraService.getCamerasByRtcServer(rtcServer);
JSONObject jsonObject = new JSONObject();
JSONObject server = new JSONObject();
server.put("http_port",":8083");
String [] strings = new String[1];
strings[0] = "stun:stun.l.google.com:19302";
server.put("ice_servers",strings);
server.put("ice_username","");
server.put("ice_credential","");
jsonObject.put("server",server);
JSONObject streams = new JSONObject();
cameraList.forEach(camera -> {
JSONObject obj = new JSONObject();
obj.put("on_demand",false);
obj.put("disable_audio",true);
obj.put("url",camera.getRtsp());
streams.put("camera"+camera.getId(),obj);
});
jsonObject.put("streams",streams);
return Result.success(jsonObject.toJSONString());
}
}

@ -1,6 +1,7 @@
package com.leaper.web.service;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhehekeji.core.util.Assert;
@ -162,6 +163,13 @@ public class CameraService {
return cameraMapper.selectByMap(new HashMap<>());
}
public List<Camera> getCamerasByRtcServer(String rtcServer){
if(StringUtils.isEmpty(rtcServer)){
rtcServer = "127.0.0.1";
}
return cameraMapper.selectList(new QueryWrapper<Camera>().eq("rtc_server",rtcServer));
}
/**
* IO
*

@ -14,6 +14,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.nio.charset.Charset;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
@Slf4j
public class CommandRunnable implements Runnable{
@ -24,6 +27,13 @@ public class CommandRunnable implements Runnable{
lastLotnum = lotnum;
}
/**
* 30000
*
*/
private Map<String, LocalDate> dateMap = new HashMap<>();
private static String lastLotnum;
private PlcService plcService;
@ -75,8 +85,14 @@ public class CommandRunnable implements Runnable{
String srmNumber = null;
String cmdName = null;
if(dataInfo != null){
LocalDate now = LocalDate.now();
if(dateMap.get(dataInfo.getTaskId()) == null){
dateMap.put(dataInfo.getTaskId(),now);
}else {
now = dateMap.get(dataInfo.getTaskId());
}
plcCmdInfo = new PlcCmdInfo(dataInfo.getSRMNumber(), dataInfo.getTaskId(), dataInfo.getFromSide(), dataInfo.getFromDirection(), dataInfo.getFromColumn(), dataInfo.getFromRow(), dataInfo.getFromSeparation(),dataInfo.getToSide(), dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToRow(),dataInfo.getToSeparation(),lotnum);
plcCmdInfo = new PlcCmdInfo(dataInfo.getSRMNumber(), dataInfo.getTaskId()+"-"+now, dataInfo.getFromSide(), dataInfo.getFromDirection(), dataInfo.getFromColumn(), dataInfo.getFromRow(), dataInfo.getFromSeparation(),dataInfo.getToSide(), dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToRow(),dataInfo.getToSeparation(),lotnum);
srmNumber = dataInfo.getSRMNumber();
cmdName = dataInfo.getCmdName();
@ -119,6 +135,7 @@ public class CommandRunnable implements Runnable{
}
plcService.gyrateCamera(plcCmdInfo,Cmd.C5.name());
plcService.orderStop(plcCmdInfo);
dateMap.remove(dataInfo.getTaskId());
}
} else if (Cmd.C.name().equals(ksecInfo.getType())) {

Loading…
Cancel
Save