|
@@ -9,6 +9,7 @@ import com.kym.entity.WashDevice;
|
|
|
import com.kym.entity.WashOrder;
|
|
import com.kym.entity.WashOrder;
|
|
|
import com.kym.entity.common.PageBean;
|
|
import com.kym.entity.common.PageBean;
|
|
|
import com.kym.entity.queryParams.DeviceQueryParams;
|
|
import com.kym.entity.queryParams.DeviceQueryParams;
|
|
|
|
|
+import com.kym.entity.vo.DevicePriceVo;
|
|
|
import com.kym.entity.vo.WashDeviceVo;
|
|
import com.kym.entity.vo.WashDeviceVo;
|
|
|
import com.kym.mapper.WashDeviceMapper;
|
|
import com.kym.mapper.WashDeviceMapper;
|
|
|
import com.kym.service.DeviceConfigService;
|
|
import com.kym.service.DeviceConfigService;
|
|
@@ -70,6 +71,13 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
|
|
|
.orderByAsc(WashDevice::getState)
|
|
.orderByAsc(WashDevice::getState)
|
|
|
.orderByAsc(WashDevice::getDeviceName)
|
|
.orderByAsc(WashDevice::getDeviceName)
|
|
|
.list();
|
|
.list();
|
|
|
|
|
+
|
|
|
|
|
+ if (list.isEmpty()) {
|
|
|
|
|
+ return Collections.emptyList();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var configMap = loadDeviceConfigMap(list);
|
|
|
|
|
+
|
|
|
var voList = new ArrayList<WashDeviceVo>();
|
|
var voList = new ArrayList<WashDeviceVo>();
|
|
|
//TODO 根据订单查询占用中的设备
|
|
//TODO 根据订单查询占用中的设备
|
|
|
// var currentUserId = StpUtil.getLoginIdAsLong();
|
|
// var currentUserId = StpUtil.getLoginIdAsLong();
|
|
@@ -78,6 +86,7 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
|
|
|
// .setCurrentUserId(currentUserId);
|
|
// .setCurrentUserId(currentUserId);
|
|
|
BeanUtils.copyProperties(washDevice, vo);
|
|
BeanUtils.copyProperties(washDevice, vo);
|
|
|
vo.setShortId(KymCache.INSTANCE.getShortIdByProductKeyAndDeviceName(washDevice.getProductKey(), washDevice.getDeviceName()));
|
|
vo.setShortId(KymCache.INSTANCE.getShortIdByProductKeyAndDeviceName(washDevice.getProductKey(), washDevice.getDeviceName()));
|
|
|
|
|
+ vo.setPrice(toDevicePriceVo(configMap.get(washDevice.getDeviceConfigId())));
|
|
|
voList.add(vo);
|
|
voList.add(vo);
|
|
|
}
|
|
}
|
|
|
return voList;
|
|
return voList;
|
|
@@ -109,6 +118,11 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
|
|
|
|
|
|
|
|
var vo = new WashDeviceVo().setCurrentUserId(StpUtil.getLoginIdAsLong());
|
|
var vo = new WashDeviceVo().setCurrentUserId(StpUtil.getLoginIdAsLong());
|
|
|
BeanUtils.copyProperties(washDevice, vo.setShortId(shortId));
|
|
BeanUtils.copyProperties(washDevice, vo.setShortId(shortId));
|
|
|
|
|
+
|
|
|
|
|
+ if (washDevice != null && washDevice.getDeviceConfigId() != null) {
|
|
|
|
|
+ var config = deviceConfigService.getById(washDevice.getDeviceConfigId());
|
|
|
|
|
+ vo.setPrice(toDevicePriceVo(config));
|
|
|
|
|
+ }
|
|
|
return vo;
|
|
return vo;
|
|
|
} else {
|
|
} else {
|
|
|
throw new BusinessException("设备他人使用中!");
|
|
throw new BusinessException("设备他人使用中!");
|
|
@@ -248,4 +262,35 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
|
|
|
|
|
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
+ //region 价格公示
|
|
|
|
|
+
|
|
|
|
|
+ private java.util.Map<Long, DeviceConfig> loadDeviceConfigMap(List<WashDevice> devices) {
|
|
|
|
|
+ var configIds = devices.stream().map(WashDevice::getDeviceConfigId).filter(id -> id != null).toList();
|
|
|
|
|
+ if (configIds.isEmpty()) {
|
|
|
|
|
+ return Collections.emptyMap();
|
|
|
|
|
+ }
|
|
|
|
|
+ return deviceConfigService.lambdaQuery()
|
|
|
|
|
+ .in(DeviceConfig::getId, configIds)
|
|
|
|
|
+ .list().stream().collect(Collectors.toMap(DeviceConfig::getId, Function.identity()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private DevicePriceVo toDevicePriceVo(DeviceConfig config) {
|
|
|
|
|
+ if (config == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ return new DevicePriceVo()
|
|
|
|
|
+ .setPriceSpace(config.getPriceSpace())
|
|
|
|
|
+ .setPriceWater(config.getPriceWater())
|
|
|
|
|
+ .setPriceFoam(config.getPriceFoam())
|
|
|
|
|
+ .setPriceCleaner(config.getPriceCleaner())
|
|
|
|
|
+ .setPriceTap(config.getPriceTap())
|
|
|
|
|
+ .setPriceUserExt(config.getPriceUserExt())
|
|
|
|
|
+ .setPriceCoat(config.getPriceCoat())
|
|
|
|
|
+ .setPriceBlow(config.getPriceBlow())
|
|
|
|
|
+ .setAmountMinLimit(config.getAmountMinLimit())
|
|
|
|
|
+ .setPrepayMoney(config.getPrepayMoney());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //endregion
|
|
|
|
|
+
|
|
|
}
|
|
}
|