Преглед изворни кода

支付宝设备信息编辑

谭斌 пре 2 година
родитељ
комит
2cb70917ff

+ 18 - 2
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -92,6 +92,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
     private final RedisService<String> redisService;
     private final GoodsService goodsService;
     private final OrderRefundService refundService;
+    private final AlipayDeviceService alipayDeviceService;
     private final String keyPrefix = "device:history:";
 
     @Override
@@ -100,8 +101,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         List<DeviceInfoDto.NetStateCount> netStateCountList = baseMapper.netStateCount(dto.getMercIdList());
         List<Long> netStateCountMercList = netStateCountList.stream().map(DeviceInfoDto.NetStateCount::getMercId).distinct().collect(Collectors.toList());
         Map<Long, DeviceInfoDto.NetStateCountVo> voMap = new HashMap<>();
-        List<Long> mercIdList = Emptys.check(dto.getMercIdList())?dto.getMercIdList():netStateCountMercList;
-        if(!Emptys.check(mercIdList)){
+        List<Long> mercIdList = Emptys.check(dto.getMercIdList()) ? dto.getMercIdList() : netStateCountMercList;
+        if (!Emptys.check(mercIdList)) {
             return R.ok();
         }
         for (Long mercId : mercIdList) {
@@ -270,6 +271,21 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         DeviceInfo deviceInfo = copy(DeviceInfo.class, update)
                 .setUpdateTime(LocalDateTime.now());
         updateById(deviceInfo);
+        DeviceInfoDto.Vo device = R.feignCheckData(this.obj(new DeviceInfoDto.Obj().setDeviceId(update.getDeviceId()).setIsSysinfo(true)));
+        Integer deviceType = device.getDeviceType();
+        if (ObjectUtil.equals(DeviceTypeEnum.TYPE5.getCode(), deviceType)) {
+            DeviceUpdateDTO deviceUpdateDTO = new DeviceUpdateDTO();
+            if (StrUtil.isNotEmpty(update.getDeviceName())) {
+                deviceUpdateDTO.setDeviceName(update.getDeviceName());
+            }
+            String deviceSn = device.getDeviceSysinfo().getDeviceSn();
+            if (deviceUpdateDTO != null) {
+                deviceUpdateDTO.setTerminalId(String.valueOf(update.getDeviceId()));
+                deviceUpdateDTO.setBoardSn(deviceSn);
+
+                alipayDeviceService.deviceUpdate(deviceUpdateDTO);
+            }
+        }
         return R.ok();
     }