|
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xy.collections.list.JArrayList;
|
|
|
import com.xy.collections.list.JList;
|
|
|
+import com.xy.collections.map.JHashMap;
|
|
|
import com.xy.collections.map.JMap;
|
|
|
import com.xy.config.DeviceThreadPoolConfig;
|
|
|
import com.xy.consts.DictConsts;
|
|
@@ -115,6 +116,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
private final MercUserBindDeviceService mercUserBindDeviceService;
|
|
|
|
|
|
+ private final DevicePartServiceImpl devicePartService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@ApiOperation("设备列表-管理员")
|
|
@@ -596,7 +599,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
public R update(@RequestBody @Validated DeviceInfoDto.Update update) {
|
|
|
DeviceInfo deviceInfo = getById(update.getDeviceId());
|
|
|
//判断是否更新了点位
|
|
|
- if(Emptys.check(update.getPlaceId()) && !Objects.equals(deviceInfo.getPlaceId(),update.getPlaceId())){
|
|
|
+ if (Emptys.check(update.getPlaceId()) && !Objects.equals(deviceInfo.getPlaceId(), update.getPlaceId())) {
|
|
|
//把设备绑定给点位管理员
|
|
|
MercUserBindDeviceDto.BindByDeviceUpdate bindByPlaceIdDTto = new MercUserBindDeviceDto.BindByDeviceUpdate();
|
|
|
bindByPlaceIdDTto.setDeviceId(update.getDeviceId())
|
|
@@ -1735,7 +1738,25 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
public PageBean<DeviceInfoDto.Vo2> queryPage(DeviceInfoDto.Page page) {
|
|
|
IPage<DeviceInfoQueryPage> iPage = baseMapper.queryPage(toIPage(page.getPage()), page);
|
|
|
- return toPageBean(DeviceInfoDto.Vo2.class, iPage);
|
|
|
+ PageBean<DeviceInfoDto.Vo2> pageBean = toPageBean(DeviceInfoDto.Vo2.class, iPage);
|
|
|
+ List<DeviceInfoDto.Vo2> records = pageBean.getRecords();
|
|
|
+ JMap<Long, List<DevicePart>> cover;
|
|
|
+ if (Emptys.check(records)) {
|
|
|
+ List<DevicePart> deviceParts = devicePartService.list(new LambdaQueryWrapper<DevicePart>()
|
|
|
+ .in(DevicePart::getDeviceId, new JArrayList<>(records).getProperty(DeviceInfoDto.Vo2::getDeviceId))
|
|
|
+ .orderByDesc(DevicePart::getCode)
|
|
|
+ );
|
|
|
+ if (Emptys.check(deviceParts)) {
|
|
|
+ cover = new JArrayList<>(deviceParts).toMap(DevicePart::getDeviceId).group();
|
|
|
+ records.forEach(vo2 -> {
|
|
|
+ List<DevicePart> devicePartss = cover.get(vo2.getDeviceId());
|
|
|
+ if (Emptys.check(devicePartss)) {
|
|
|
+ vo2.setDeviceParts(copy(DevicePartDto.Vo.class, deviceParts));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return pageBean;
|
|
|
}
|
|
|
|
|
|
private <T> void check(T value, T value2, String msg) {
|