mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
新增 netty整合mqtt协议,与车位相机通讯并保存通讯信息
This commit is contained in:
@@ -6,13 +6,18 @@ import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.model.ObjectMetadata;
|
||||
import com.jsowell.common.config.AliyunOssConfig;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.file.AliyunOssUploadUtils;
|
||||
import com.jsowell.common.util.file.ImageUtils;
|
||||
import com.jsowell.pile.domain.PileCameraInfo;
|
||||
import com.jsowell.pile.dto.GenerateOccupyOrderDTO;
|
||||
import com.jsowell.pile.dto.camera.CameraHeartBeatDTO;
|
||||
import com.jsowell.pile.dto.camera.CameraIdentifyResultsDTO;
|
||||
import com.jsowell.pile.service.IPileCameraInfoService;
|
||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||
import io.netty.channel.Channel;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -23,6 +28,8 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Base64;
|
||||
@@ -46,26 +53,36 @@ public class CameraService {
|
||||
@Autowired
|
||||
private IPileCameraInfoService pileCameraInfoService;
|
||||
|
||||
@Autowired
|
||||
private OrderPileOccupyService orderPileOccupyService;
|
||||
|
||||
|
||||
public void receiveIdentifyResults(JSONObject jsonObject) {
|
||||
// 区分入场和出场
|
||||
// Integer parking_state = jsonObject.getJSONObject("parking").getInteger("parking_state");
|
||||
// if (parking_state == 1) {
|
||||
// // 入场
|
||||
// String parkingState = "ENTRY";
|
||||
// vehicleEntry(jsonObject, parkingState);
|
||||
// }
|
||||
// if (parking_state == 2) {
|
||||
// // 在场
|
||||
// }
|
||||
// if (parking_state == 4) {
|
||||
// // 出场
|
||||
// }
|
||||
Integer parking_state = jsonObject.getJSONObject("parking").getInteger("parking_state");
|
||||
if (parking_state == 1) {
|
||||
// 入场
|
||||
String parkingState = "ENTRY";
|
||||
vehicleEntry(jsonObject, parkingState);
|
||||
}
|
||||
if (parking_state == 2) {
|
||||
// 在场
|
||||
}
|
||||
if (parking_state == 4) {
|
||||
// 出场
|
||||
}
|
||||
|
||||
saveInfo2DataBase(jsonObject);
|
||||
// saveInfo2DataBase(jsonObject);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void saveHeartBeat2Redis(CameraHeartBeatDTO dto) {
|
||||
// 将基本信息存入缓存
|
||||
String redisKey = CacheConstants.CAMERA_HEARTBEAT + dto.getIp();
|
||||
redisCache.setCacheObject(redisKey, dto.getSn());
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆入场
|
||||
* @param jsonObject
|
||||
@@ -76,6 +93,13 @@ public class CameraService {
|
||||
|
||||
// 将信息存数据库
|
||||
saveInfo2DataBase(jsonObject);
|
||||
|
||||
// TODO 生成占桩订单
|
||||
// GenerateOccupyOrderDTO dto = new GenerateOccupyOrderDTO();
|
||||
// dto.setMemberId();
|
||||
// dto.setPileSn();
|
||||
// dto.setConnectorCode();
|
||||
// orderPileOccupyService.generateOccupyPileOrder()
|
||||
}
|
||||
|
||||
private boolean saveInfo2DataBase(JSONObject jsonObject) {
|
||||
|
||||
Reference in New Issue
Block a user