|
@@ -32,6 +32,7 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import static com.xy.utils.Beans.copy;
|
|
|
import static com.xy.utils.PlusBeans.toIPage;
|
|
|
import static com.xy.utils.PlusBeans.toPageBean;
|
|
|
|
|
@@ -66,24 +67,6 @@ public class DeviceChargingServiceImpl extends ServiceImpl<DeviceChargingMapper,
|
|
|
|
|
|
private AlipayDeviceService alipayDeviceService;
|
|
|
|
|
|
- @PostMapping("init")
|
|
|
- @ApiOperation("初始化")
|
|
|
- public R init() {
|
|
|
- String timeout = DataTime.getStringAround(0, 0, 365, 0, 0, 0);
|
|
|
- LocalDateTime localDateTime = LocalDateTime.now();
|
|
|
- List<DeviceInfo> list = deviceInfoService.list(new LambdaQueryWrapper<DeviceInfo>().eq(DeviceInfo::getActiveState, 1));
|
|
|
- List<DeviceCharging> deviceChargings = new ArrayList<>(list.size());
|
|
|
- for (DeviceInfo deviceInfo : list) {
|
|
|
- DeviceCharging deviceCharging = new DeviceCharging()
|
|
|
- .setDeviceId(deviceInfo.getDeviceId())
|
|
|
- .setTimeout(DataTime.toLocal(timeout))
|
|
|
- .setCreateTime(localDateTime);
|
|
|
- deviceChargings.add(deviceCharging);
|
|
|
- }
|
|
|
- saveBatch(deviceChargings);
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
-
|
|
|
@PostMapping("del")
|
|
|
@ApiOperation("删除")
|
|
|
public R del(@RequestBody @Validated DeviceChargingDto.Del del) {
|
|
@@ -400,4 +383,14 @@ public class DeviceChargingServiceImpl extends ServiceImpl<DeviceChargingMapper,
|
|
|
}
|
|
|
return R.ok();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @ApiOperation("集合查询")
|
|
|
+ public R<List<DeviceChargingDto.Vo>> list(DeviceChargingDto.SelectList selectList) {
|
|
|
+ LambdaQueryWrapper<DeviceCharging> lambdaQueryWrapper = new LambdaQueryWrapper<DeviceCharging>()
|
|
|
+ .in(DeviceCharging::getDeviceId, selectList.getDeviceIds());
|
|
|
+ List<DeviceCharging> list = list(lambdaQueryWrapper);
|
|
|
+ List<DeviceChargingDto.Vo> copy = copy(DeviceChargingDto.Vo.class, list);
|
|
|
+ return R.ok(copy);
|
|
|
+ }
|
|
|
}
|