|
@@ -46,23 +46,17 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
@Override
|
|
@Override
|
|
@ApiOperation("购买")
|
|
@ApiOperation("购买")
|
|
public R pay(DeviceAlgorithmChargingDto.Pay pay) {
|
|
public R pay(DeviceAlgorithmChargingDto.Pay pay) {
|
|
- int give = 100;
|
|
|
|
JList<DeviceAlgorithmChargingDto.Pay.DeviceAlgorithmCharging> deviceAlgorithmChargings = new JArrayList<>(pay.getDeviceAlgorithmChargings());
|
|
JList<DeviceAlgorithmChargingDto.Pay.DeviceAlgorithmCharging> deviceAlgorithmChargings = new JArrayList<>(pay.getDeviceAlgorithmChargings());
|
|
LocalDateTime now = LocalDateTime.now();
|
|
LocalDateTime now = LocalDateTime.now();
|
|
- //获取算法包月字典
|
|
|
|
- Map<String, SysDictRedis> algorithmMoonConfigMaps = SysDictUtils.get(EnumAlgorithmMoonConfig.Code.CODE.getCode());
|
|
|
|
List<DeviceAlgorithmChargingHistory> deviceAlgorithmChargingHistories = new ArrayList<>(deviceAlgorithmChargings.size());
|
|
List<DeviceAlgorithmChargingHistory> deviceAlgorithmChargingHistories = new ArrayList<>(deviceAlgorithmChargings.size());
|
|
deviceAlgorithmChargings.forEach(deviceAlgorithmCharging -> {
|
|
deviceAlgorithmChargings.forEach(deviceAlgorithmCharging -> {
|
|
- SysDictRedis sysDictRedis = algorithmMoonConfigMaps.get(deviceAlgorithmCharging.getAlgorithmId().toString());
|
|
|
|
- DeviceAlgorithmChargingDto.AlgorithmMoonConfig algorithmMoonConfig = JSONUtil.parseObj(sysDictRedis.getValue()).toBean(DeviceAlgorithmChargingDto.AlgorithmMoonConfig.class);
|
|
|
|
- Integer payType = pay.getPayType();
|
|
|
|
DeviceAlgorithmChargingHistory deviceAlgorithmChargingHistory = new DeviceAlgorithmChargingHistory()
|
|
DeviceAlgorithmChargingHistory deviceAlgorithmChargingHistory = new DeviceAlgorithmChargingHistory()
|
|
.setId(YitIdHelper.nextId())
|
|
.setId(YitIdHelper.nextId())
|
|
.setOrderId(pay.getOrderId())
|
|
.setOrderId(pay.getOrderId())
|
|
.setDeviceId(deviceAlgorithmCharging.getDeviceId())
|
|
.setDeviceId(deviceAlgorithmCharging.getDeviceId())
|
|
.setAlgorithmId(deviceAlgorithmCharging.getAlgorithmId())
|
|
.setAlgorithmId(deviceAlgorithmCharging.getAlgorithmId())
|
|
.setChargingSize(deviceAlgorithmCharging.getChargingSize())
|
|
.setChargingSize(deviceAlgorithmCharging.getChargingSize())
|
|
- .setChargingMoney(payType == give ? 0 : algorithmMoonConfig.getMoney() * deviceAlgorithmCharging.getChargingSize())
|
|
|
|
|
|
+ .setChargingMoney(deviceAlgorithmCharging.getMoney())
|
|
.setChargingType(pay.getPayType())
|
|
.setChargingType(pay.getPayType())
|
|
.setCreateTime(now)
|
|
.setCreateTime(now)
|
|
.setUpdateTime(now);
|
|
.setUpdateTime(now);
|