|
@@ -36,61 +36,14 @@ public class CallbackUtil {
|
|
|
CameraLogDetailService cameraLogDetailService;
|
|
|
@Autowired
|
|
|
MqLogService mqLogService;
|
|
|
- @Autowired
|
|
|
- private RedisCache redisCache;
|
|
|
- @Autowired
|
|
|
- BaseCameraManagementService baseCameraManagementService;
|
|
|
- @Autowired
|
|
|
- BaseRailwayManagementService baseRailwayManagementService;
|
|
|
- @Value("${base.imgUrl}")
|
|
|
- private String imgUrl;
|
|
|
private static CameraLogDetailService cameraLogDetail;
|
|
|
private static MqLogService mqLog;
|
|
|
- private static RedisCache redis;
|
|
|
- private static BaseCameraManagementService baseCameraManagement;
|
|
|
- private static BaseRailwayManagementService baseRailwayManagement;
|
|
|
- public static String url;
|
|
|
|
|
|
|
|
|
- public static String screenshot(String deviceSn, String stream, String imageUrl) {
|
|
|
- String path = null;
|
|
|
- Map<String, Object> screenshot = redis.getCacheMap("screenshot");
|
|
|
- if (ObjectUtils.isEmpty(screenshot)) {
|
|
|
- List<BaseCameraManagement> list = baseCameraManagement.list();
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
- for (BaseCameraManagement came : list) {
|
|
|
- BaseRailwayManagement baseRailwayManagementOne = baseRailwayManagement.getOne(new LambdaQueryWrapper<BaseRailwayManagement>()
|
|
|
- .eq(BaseRailwayManagement::getRailwayCode, came.getRailwayCode()));
|
|
|
- map.put(came.getCameraCode(), "/" + baseRailwayManagementOne.getRailwayName() + "/" + AppendUtils.stringAppend(came.getInstallMile()) + "/");
|
|
|
- if (came.equals(deviceSn)) {
|
|
|
- path = url + "/" + baseRailwayManagementOne.getRailwayName() + "/" + AppendUtils.stringAppend(came.getInstallMile()) + "/" + LocalDate.now().getYear() + "/" + LocalDate.now().getMonthValue() + "/" + LocalDate.now().getDayOfMonth() + "/" + LocalTime.now().getHour() + "/" + imageUrl;
|
|
|
- }
|
|
|
- }
|
|
|
- redis.setCacheMap("screenshot", map);
|
|
|
- return path;
|
|
|
- } else {
|
|
|
- for (Map.Entry<String, Object> entry : screenshot.entrySet()) {
|
|
|
- String key = entry.getKey();
|
|
|
- Object value = entry.getValue();
|
|
|
- // 将Object转换为String
|
|
|
- if (key.equals(deviceSn)) {
|
|
|
- String stringValue = value != null ? value.toString() : null;
|
|
|
- path = url + stringValue + LocalDate.now().getYear() + "/" + LocalDate.now().getMonthValue() + "/" + LocalDate.now().getDayOfMonth() + "/" + LocalTime.now().getHour() + "/" + imageUrl;
|
|
|
- return path;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
@PostConstruct
|
|
|
public void init() {
|
|
|
cameraLogDetail = cameraLogDetailService;
|
|
|
mqLog = mqLogService;
|
|
|
- redis = redisCache;
|
|
|
- baseCameraManagement = baseCameraManagementService;
|
|
|
- baseRailwayManagement = baseRailwayManagementService;
|
|
|
- url = imgUrl;
|
|
|
}
|
|
|
|
|
|
public static void callback(String deviceSn, Integer code, String remark) {
|