diff --git a/smart-switch-ruoyi/smart-switch-generator/src/main/resources/vm/vue/index.vue.vm b/smart-switch-ruoyi/smart-switch-generator/src/main/resources/vm/vue/index.vue.vm index ebdc0b30..14b49e96 100644 --- a/smart-switch-ruoyi/smart-switch-generator/src/main/resources/vm/vue/index.vue.vm +++ b/smart-switch-ruoyi/smart-switch-generator/src/main/resources/vm/vue/index.vue.vm @@ -430,7 +430,7 @@ export default { // 查询参数 queryParams: { pageNum: 1, - pageSize: 10, + pageSize: 20, orderByColumn: defaultSort.prop, isAsc: defaultSort.order, #foreach ($column in $columns) diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusConverterImpl.java index a9ab9dfa..05832198 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusConverterImpl.java @@ -21,6 +21,7 @@ import com.ruoyi.ss.transactionBill.domain.vo.UserRechargeServiceVO; import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.user.domain.SmUserVo; import com.ruoyi.ss.user.service.ISmUserService; +import com.ruoyi.system.domain.enums.config.ConfigKey; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysDeptService; import org.springframework.beans.factory.annotation.Autowired; @@ -111,13 +112,12 @@ public class BonusConverterImpl implements BonusConverter { if (DeviceServiceMode.DIRECT.getMode().equals(device.getServiceMode())) { // 平台收取服务费 UserRechargeServiceVO userRechargeService = transactionBillService.getMchRechargeService(channel, mch, device); - String serviceType = userRechargeService.getServiceType(); // 服务费类型 - BigDecimal serviceRate = userRechargeService.getServiceRate(); // 服务费 - // 如果按照百分比收取服务费 - if(ServiceType.PERCENT.getType().equals(serviceType)) { - result.add(this.toPo(platform, serviceRate)); - point = point.subtract(serviceRate); - } + + // 按照百分比收取服务费 + BigDecimal serviceRate = userRechargeService.getServiceRate(); // 服务费比例 + result.add(this.toPo(platform, serviceRate)); + + point = point.subtract(serviceRate); } // 代理模式 else if (DeviceServiceMode.AGENT.getMode().equals(device.getServiceMode())) { diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusServiceImpl.java index 34b2392f..06df411e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusServiceImpl.java @@ -24,6 +24,7 @@ import com.ruoyi.ss.store.service.StoreService; import com.ruoyi.ss.user.domain.SmUserVo; import com.ruoyi.ss.user.service.ISmUserService; import com.ruoyi.ss.user.service.UserAssembler; +import com.ruoyi.system.domain.enums.config.ConfigKey; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysDeptService; import org.springframework.beans.factory.annotation.Autowired; @@ -215,6 +216,11 @@ public class BonusServiceImpl implements BonusService LocalDateTime now = LocalDateTime.now(); + // TODO 最低分成,假设为 0.05 元,若判断金额小于 0.05 则全部收取,若分成小于 0.05 则收取0.05元 + // 获取平台的分成 + BonusVO platform = bonusList.stream().filter(bonus -> bonus.getArrivalType().equals(BonusArrivalType.PLATFORM.getType())).findFirst().orElse(null); + ServiceUtil.assertion(platform == null, "平台不存在"); + // 循环遍历,构造分成金额 for (BonusVO bonus : bonusList) { BigDecimal amount = money.multiply(bonus.getPoint()).divide(decimal100, 2, RoundingMode.HALF_UP); @@ -233,9 +239,7 @@ public class BonusServiceImpl implements BonusService } dividedAmount = dividedAmount.add(amount); } - // 平台吃掉误差 - BonusVO platform = bonusList.stream().filter(bonus -> bonus.getArrivalType().equals(BonusArrivalType.PLATFORM.getType())).findFirst().orElse(null); - ServiceUtil.assertion(platform == null, "平台不存在"); + // 若存在误差,则平台吃掉误差 if (dividedAmount.compareTo(money) != 0) { BigDecimal subtract = money.subtract(dividedAmount); // 误差值 platform.setAmount(platform.getAmount().add(subtract)); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/Device.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/Device.java index d21bd893..770b503a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/Device.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/Device.java @@ -208,6 +208,7 @@ public class Device extends BaseEntity @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "最后在线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty("最后在线时间") + @JsonView(JsonViewProfile.App.class) private LocalDateTime lastOnlineTime; @ApiModelProperty("上次恢复余额的时间戳") diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index 5f2b5745..225858e4 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -264,6 +264,8 @@ public class TransactionBillServiceImpl implements TransactionBillService, After bo.setBonusList(bonusList); } + // TODO 收取月费 + transactionTemplate.execute(status -> { // 新增订单 int insert = this.insertSmTransactionBill(order);