Browse Source

Merge branch 'master' into test

李进 1 năm trước cách đây
mục cha
commit
f0386864a4

+ 38 - 0
device-api-service/src/main/java/com/xy/alipay/AlipayTradeVideoServiceImpl.java

@@ -0,0 +1,38 @@
+package com.xy.alipay;
+
+import com.xy.dto.TradeVideoQueryDTO;
+import com.xy.service.AlipayTradeService;
+import com.xy.utils.R;
+import com.xy.vo.TradeVideoQueryVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+
+/**
+ * 交易视频相关
+ *
+ * @author 谭斌
+ * @date 2023/04/16
+ */
+@Slf4j
+@Service
+@AllArgsConstructor
+@Api(tags = "支付宝动态柜交易视频")
+public class AlipayTradeVideoServiceImpl {
+
+    private AlipayTradeService alipayTradeService;
+
+
+    @ApiOperation("视频捞取API")
+    @PostMapping
+    public R requestTradeVideo(@RequestBody TradeVideoQueryDTO tradeVideoQueryDTO) {
+        TradeVideoQueryVO tradeVideoQueryVO = alipayTradeService.tradeVideoQuery(tradeVideoQueryDTO);
+        return R.ok(tradeVideoQueryVO);
+    }
+
+}

+ 7 - 5
device-api-service/src/main/java/com/xy/alipay/SpiDeviceServiceImpl.java

@@ -1,6 +1,7 @@
 package com.xy.alipay;
 
 import cn.hutool.json.JSONObject;
+import com.xy.constants.SpiResponseConst;
 import com.xy.consumer.disconnect.DisconnectedMqttConfiguration;
 import com.xy.consumer.disconnect.DisconnectedProducer;
 import com.xy.dto.DeviceEventMsgDto;
@@ -24,7 +25,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
-import java.util.Map;
 
 
 /**
@@ -49,7 +49,7 @@ public class SpiDeviceServiceImpl implements SpiDeviceService {
 
     @Override
     @ApiOperation("设备告警通知")
-    public void deviceAlarmNotify(Map<String, String> params, DeviceAlarmNotifyDTO deviceAlarmNotifyDTO) {
+    public String deviceAlarmNotify(DeviceAlarmNotifyDTO deviceAlarmNotifyDTO) {
         //查询设备信息
         DeviceInfo deviceInfo = deviceInfoService.getById(Long.valueOf(deviceAlarmNotifyDTO.getTerminalId()));
         String faultCode = deviceAlarmNotifyDTO.getFaultCode();
@@ -57,7 +57,7 @@ public class SpiDeviceServiceImpl implements SpiDeviceService {
                 : faultCode.equals("DoorOpenedOnNoTrade") ? DeviceErrorRecordTypesEnum.DOOR_LOCK
                 : null;
         if (deviceErrorRecordTypesEnum == null) {
-            return;
+            return SpiResponseConst.FAIL;
         }
         //添加设备异常记录
         DeviceEventMsgDto.Save save = new DeviceEventMsgDto.Save()
@@ -70,16 +70,17 @@ public class SpiDeviceServiceImpl implements SpiDeviceService {
             JSONObject jsonObject = new JSONObject().set("clientid", deviceInfo.getDeviceId());
             disconnectedProducer.sendToMqtt(jsonObject.toString(), DisconnectedMqttConfiguration.TOPIC, 1);
         }
+        return SpiResponseConst.SPI_SUCCESS;
     }
 
     @Override
     @ApiOperation("设备状态变更通知")
-    public void deviceStatusChangeNotify(Map<String, String> params, DeviceStatusChangeNotifyDTO deviceStatusChangeNotifyDTO) {
+    public String deviceStatusChangeNotify(DeviceStatusChangeNotifyDTO deviceStatusChangeNotifyDTO) {
         //查询设备信息
         DeviceInfo deviceInfo = deviceInfoService.getById(Long.valueOf(deviceStatusChangeNotifyDTO.getTerminalId()));
         Integer status = deviceStatusChangeNotifyDTO.getStatus();
         if (deviceInfo.getFreezeStatus().equals(status)) {
-            return;
+            return SpiResponseConst.FAIL;
         }
         //修改冻结状态、运营状态
         DeviceInfo updateDeviceInfo = new DeviceInfo()
@@ -106,5 +107,6 @@ public class SpiDeviceServiceImpl implements SpiDeviceService {
             }
         }
         deviceInfoService.updateById(updateDeviceInfo);
+        return SpiResponseConst.SPI_SUCCESS;
     }
 }