|
|
@@ -3,11 +3,13 @@ package com.kym.service.impl;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.kym.common.utils.CommUtil;
|
|
|
import com.kym.entity.common.PageBean;
|
|
|
+import com.kym.entity.RechargeConfig;
|
|
|
import com.kym.entity.WashDevice;
|
|
|
import com.kym.entity.WashStation;
|
|
|
import com.kym.entity.queryParams.StationQueryParams;
|
|
|
import com.kym.entity.vo.WashStationVo;
|
|
|
import com.kym.mapper.WashStationMapper;
|
|
|
+import com.kym.service.RechargeConfigService;
|
|
|
import com.kym.service.WashDeviceService;
|
|
|
import com.kym.service.WashStationService;
|
|
|
import com.kym.service.cache.KymCache;
|
|
|
@@ -37,9 +39,11 @@ public class WashStationServiceImpl extends MyBaseServiceImpl<WashStationMapper,
|
|
|
}
|
|
|
|
|
|
private final WashDeviceService washDeviceService;
|
|
|
+ private final RechargeConfigService rechargeConfigService;
|
|
|
|
|
|
- public WashStationServiceImpl(WashDeviceService washDeviceService) {
|
|
|
+ public WashStationServiceImpl(WashDeviceService washDeviceService, RechargeConfigService rechargeConfigService) {
|
|
|
this.washDeviceService = washDeviceService;
|
|
|
+ this.rechargeConfigService = rechargeConfigService;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -51,6 +55,20 @@ public class WashStationServiceImpl extends MyBaseServiceImpl<WashStationMapper,
|
|
|
CommUtil.asserts(count == 0, "站点已存在");
|
|
|
save(station);
|
|
|
|
|
|
+ // 自动使用默认充值配置:将平台默认配置复制一份关联到新站点
|
|
|
+ var defaultConfigs = rechargeConfigService.lambdaQuery()
|
|
|
+ .isNull(RechargeConfig::getStationId).list();
|
|
|
+ if (!defaultConfigs.isEmpty()) {
|
|
|
+ var stationConfigs = defaultConfigs.stream().map(c -> {
|
|
|
+ var config = new RechargeConfig();
|
|
|
+ config.setRechargeAmount(c.getRechargeAmount());
|
|
|
+ config.setGrantsAmount(c.getGrantsAmount());
|
|
|
+ config.setLabel(c.getLabel());
|
|
|
+ config.setStationId(station.getStationId());
|
|
|
+ return config;
|
|
|
+ }).toList();
|
|
|
+ rechargeConfigService.saveBatch(stationConfigs);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|