Kaynağa Gözat

增加 商户正常设备列表 接口

hechunping 6 ay önce
ebeveyn
işleme
3fa5fbe4c1

+ 10 - 0
device-api-service-member/src/main/java/com/xy/controller/MemberDeviceController.java

@@ -79,4 +79,14 @@ public class MemberDeviceController {
         return R.ok(vos);
     }
 
+
+    @PostMapping("mercDevices")
+    @ApiOperation("商户设备")
+    public R<List<DeviceInfoDto.MercNormalListVo>> mercDevices(@RequestBody DeviceInfoDto.MercNormalListDto dto){
+        if(!Emptys.check(dto.getMercId())){
+            return R.ok(new ArrayList<>());
+        }
+        return deviceInfoService.mercNormalList(new DeviceInfoDto.MercNormalListDto().setMercId(dto.getMercId()));
+    }
+
 }

+ 19 - 0
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -1869,4 +1869,23 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
             throw new CommRuntimeException(msg);
         }
     }
+
+    @Override
+    @ApiOperation("商户正常设备列表")
+    public R<List<DeviceInfoDto.MercNormalListVo>> mercNormalList(@RequestBody @Validated DeviceInfoDto.MercNormalListDto dto) {
+        LambdaQueryWrapper<DeviceInfo> lqw = new LambdaQueryWrapper<DeviceInfo>()
+                .select(DeviceInfo::getDeviceId, DeviceInfo::getDeviceName)
+                .eq(DeviceInfo::getMercId, dto.getMercId())
+                .eq(DeviceInfo::getActiveState, DeviceActiveStateEnum.TRUE.getCode())
+                .eq(DeviceInfo::getBusyState, EnumDeviceBusyStatus.N_1.getCode())
+                .eq(DeviceInfo::getShowStatus, true)
+                .eq(DeviceInfo::getFreezeStatus, EnumDeviceFreezeStatus.N_1.getCode())
+                ;
+        List<DeviceInfo> list = list(lqw);
+        if (!Emptys.check(list)) {
+            return R.ok(new ArrayList<>());
+        }
+        List<DeviceInfoDto.MercNormalListVo> copy = copy(DeviceInfoDto.MercNormalListVo.class, list);
+        return R.ok(copy);
+    }
 }

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

@@ -40,6 +40,24 @@ public class DeviceInfoDto {
     public final static String CLEAR = "clear";
 
 
+    @Data
+    @Accessors(chain = true)
+    public static class MercNormalListDto {
+        @NotNull(message = "商户ID不能位空")
+        @ApiModelProperty(value = "商户Id")
+        private Long mercId;
+    }
+
+    @Data
+    @Accessors(chain = true)
+    public static class MercNormalListVo {
+        @ApiModelProperty(value = "设备名称")
+        private String deviceName;
+
+        @ApiModelProperty(value = "设备id")
+        private Long deviceId;
+    }
+
     @Data
     @Accessors(chain = true)
     public static class UpdateLonByPlaceId {

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

@@ -240,4 +240,12 @@ public interface DeviceInfoService {
      */
     @PostMapping("activationCount")
     R<Integer> activationCount(@RequestBody @Validated DeviceInfoDto.ActivationCount activationCount);
+
+    /**
+     * 商户正常设备列表
+     * @param dto
+     * @return
+     */
+    @PostMapping("mercNormalList")
+    R<List<DeviceInfoDto.MercNormalListVo>> mercNormalList(@RequestBody @Validated DeviceInfoDto.MercNormalListDto dto);
 }