Переглянути джерело

补扣订单审核分页。用户设备分页、用户设备授权。

谭斌 2 роки тому
батько
коміт
daea36c511

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

@@ -55,7 +55,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
 
     private final RedisService<String> redisService;
 
-    private String keyPrefix = "device:history:";
+    private final String keyPrefix = "device:history:";
 
     @Override
     @ApiOperation("对象查询")
@@ -182,6 +182,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
     @Transactional(rollbackFor = Exception.class)
     public R<Boolean> mercDeviceAuth(DeviceInfoDto.MercDeviceAuthDto auth) {
         Long mercId = auth.getMercId();
+        String mercCode = auth.getMercCode();
         //商户最终设备列表
         List<Long> deviceIds = auth.getDeviceIds();
         List<DeviceInfo> devices = getDevicesByMercId(mercId);
@@ -196,7 +197,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         List<DeviceInfo> deviceInfos = this.listByIds(deviceIds);
         deviceInfos.forEach(deviceInfo -> {
             //绑定关系
-            deviceInfo.setMercId(mercId);
+            deviceInfo.setMercId(mercId).setMercCode(mercCode);
         });
         updateBatchById(deviceInfos);
         //原来存在的设备关系,不在最终设备列表中的移除
@@ -234,6 +235,14 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         return updateBatchById(deviceInfos);
     }
 
+
+    @ApiOperation("集合查询")
+    @Override
+    public R<List<DeviceInfoDto.Vo>> list(DeviceInfoDto.ListDto dto) {
+        List<DeviceInfo> list = list(new LambdaQueryWrapper<DeviceInfo>().in(CollUtil.isNotEmpty(dto.getDeviceIds()), DeviceInfo::getDeviceId, dto.getDeviceIds()));
+        return R.ok(copy(DeviceInfoDto.Vo.class, list));
+    }
+
     /**
      * 获取商户设备列表
      *

+ 11 - 0
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -27,6 +27,14 @@ public class DeviceInfoDto {
         private Boolean isTwoDoor;
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class ListDto {
+        @ApiModelProperty(value = "设备id批量查", required = false)
+        private List<Long> deviceIds;
+    }
+
+
     @Data
     @Accessors(chain = true)
     public static class Update extends Vo {
@@ -213,6 +221,9 @@ public class DeviceInfoDto {
         @ApiModelProperty(value = "商户ID", required = true)
         private Long mercId;
 
+        @ApiModelProperty(value = "商户编码", required = true)
+        private String mercCode;
+
 
     }
 }

+ 12 - 0
device-api/src/main/java/com/xy/service/DeviceInfoService.java

@@ -7,6 +7,8 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import java.util.List;
+
 /**
  * <p>
  * 设备-信息 服务类
@@ -54,4 +56,14 @@ public interface DeviceInfoService {
      */
     @PostMapping("mercDeviceAuth")
     R<Boolean> mercDeviceAuth(@RequestBody @Validated DeviceInfoDto.MercDeviceAuthDto auth);
+
+
+    /**
+     * 集合查询
+     *
+     * @param dto
+     * @return
+     */
+    @PostMapping("list")
+    R<List<DeviceInfoDto.Vo>> list(DeviceInfoDto.ListDto dto);
 }