套餐最低0.1元,手续费最低0.05元
This commit is contained in:
parent
a9b169b1d0
commit
eebccd5453
|
@ -52,7 +52,7 @@ public class Suit extends BaseEntity
|
||||||
@Excel(name = "价格/押金")
|
@Excel(name = "价格/押金")
|
||||||
@JsonView({DeviceView.SuitList.class, JsonViewProfile.AppMch.class})
|
@JsonView({DeviceView.SuitList.class, JsonViewProfile.AppMch.class})
|
||||||
@NotNull(message = "价格/押金不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
@NotNull(message = "价格/押金不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||||
@Min(value = 0, message = "价格/押金不允许小于0")
|
@DecimalMin(value = "0.1", message = "价格/押金不允许小于0.1")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
/** 详细说明 */
|
/** 详细说明 */
|
||||||
|
|
|
@ -286,4 +286,11 @@ public interface TransactionBillService
|
||||||
* 查询所有关于金额的总和
|
* 查询所有关于金额的总和
|
||||||
*/
|
*/
|
||||||
<T> List<TransactionAmountVO<T>> selectCommonSumOfMoney(TransactionBillQuery query, String groupBy);
|
<T> List<TransactionAmountVO<T>> selectCommonSumOfMoney(TransactionBillQuery query, String groupBy);
|
||||||
|
|
||||||
|
TransactionBillVO selectOne(TransactionBillQuery query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启/关闭订单设备
|
||||||
|
*/
|
||||||
|
int switchDevice(TransactionBillVO bill, boolean open);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.ss.transactionBill.service.impl;
|
package com.ruoyi.ss.transactionBill.service.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.core.redis.RedisLock;
|
import com.ruoyi.common.core.redis.RedisLock;
|
||||||
import com.ruoyi.common.core.redis.enums.RedisLockKey;
|
import com.ruoyi.common.core.redis.enums.RedisLockKey;
|
||||||
|
@ -289,6 +290,10 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
||||||
else if(ServiceType.PERCENT.getType().equals(serviceType)){
|
else if(ServiceType.PERCENT.getType().equals(serviceType)){
|
||||||
// 服务费
|
// 服务费
|
||||||
BigDecimal serviceCharge = serviceRate.multiply(order.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
BigDecimal serviceCharge = serviceRate.multiply(order.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
||||||
|
// 最低服务费0.05元
|
||||||
|
if (serviceCharge.compareTo(new BigDecimal("0.05")) < 0) {
|
||||||
|
serviceCharge = new BigDecimal("0.05");
|
||||||
|
}
|
||||||
order.setServiceCharge(serviceCharge);
|
order.setServiceCharge(serviceCharge);
|
||||||
// 商户最终到账的金额 = 交易金额 - 服务费
|
// 商户最终到账的金额 = 交易金额 - 服务费
|
||||||
order.setArrivalAmount(order.getMoney().subtract(serviceCharge));
|
order.setArrivalAmount(order.getMoney().subtract(serviceCharge));
|
||||||
|
@ -1565,6 +1570,32 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
||||||
return transactionBillMapper.selectCommonSumOfMoney(query, groupBy);
|
return transactionBillMapper.selectCommonSumOfMoney(query, groupBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TransactionBillVO selectOne(TransactionBillQuery query) {
|
||||||
|
PageHelper.startPage(1, 1);
|
||||||
|
List<TransactionBillVO> list = this.selectSmTransactionBillList(query);
|
||||||
|
if (CollectionUtils.isEmptyElement(list)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int switchDevice(TransactionBillVO bill, boolean open) {
|
||||||
|
ServiceUtil.assertion(bill == null, "订单不存在");
|
||||||
|
ServiceUtil.assertion(bill.getIsUsing() == null || !bill.getIsUsing(), "该订单不是正在使用中的订单,无法操作");
|
||||||
|
|
||||||
|
DeviceVO device = deviceService.selectSmDeviceByDeviceId(bill.getDeviceId());
|
||||||
|
ServiceUtil.assertion(device == null, "设备不存在");
|
||||||
|
ServiceUtil.assertion(StringUtils.isBlank(device.getMac()), "设备MAC为空,请联系管理员处理");
|
||||||
|
|
||||||
|
if (open) {
|
||||||
|
return iotService.open(device.getMac(), device.getModelProductId()) ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
return iotService.close(device.getMac(), device.getModelProductId()) ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserWithdrawServiceVO getUserWithdrawService(Long userId, Long channelId) {
|
public UserWithdrawServiceVO getUserWithdrawService(Long userId, Long channelId) {
|
||||||
SmUserVo user = userService.selectSmUserByUserId(userId);
|
SmUserVo user = userService.selectSmUserByUserId(userId);
|
||||||
|
|
|
@ -318,4 +318,17 @@ public class AppTransactionBillController extends BaseController
|
||||||
return success(transactionBillService.selectUnpaidTimingBill(query));
|
return success(transactionBillService.selectUnpaidTimingBill(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("开启/关闭正在使用的订单设备")
|
||||||
|
@PutMapping("/switchDevice")
|
||||||
|
public AjaxResult switchDevice(@RequestParam Long billId, @RequestParam Boolean open) {
|
||||||
|
TransactionBillQuery query = new TransactionBillQuery();
|
||||||
|
query.setUserId(getUserId());
|
||||||
|
query.setBillId(billId);
|
||||||
|
TransactionBillVO bill = transactionBillService.selectOne(query);
|
||||||
|
if (bill == null) {
|
||||||
|
return error("订单不存在");
|
||||||
|
}
|
||||||
|
return toAjax(transactionBillService.switchDevice(bill, open));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user