二维码支付
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.store;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.StoreResult;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
@ -179,21 +180,15 @@ public class AppStoreController {
|
||||
@Operation(summary = "添加二维码订单")
|
||||
public String payByCodeOrder(@RequestBody StoreOrderDto dto) {
|
||||
|
||||
String s = orderService.cardPay(dto);
|
||||
String s = orderService.codePay(dto);
|
||||
|
||||
if("true".equals(s)){
|
||||
return JsonUtils.toJsonString(StoreResult.success(null));
|
||||
} else if ("false".equals(s)) {
|
||||
return JsonUtils.toJsonString(StoreResult.fail("余额不足"));
|
||||
}else {
|
||||
if(StrUtil.isNotBlank(s)){
|
||||
return JsonUtils.toJsonString(StoreResult.fail(s));
|
||||
}else {
|
||||
return JsonUtils.toJsonString(StoreResult.success(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String reverseHexAndConvert(String hexStr) {
|
||||
// 将十六进制字符串反转,每两位一组
|
||||
StringBuilder reversedHex = new StringBuilder();
|
||||
|
@ -44,4 +44,9 @@ public class StoreOrderDetailDO extends BaseDO {
|
||||
*/
|
||||
private Integer number;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private Double weight;
|
||||
|
||||
}
|
@ -160,14 +160,17 @@ public class StoreOrderServiceImpl implements StoreOrderService {
|
||||
public String codePay(StoreOrderDto dto) {
|
||||
String s = validateJWT(dto.getJwt());
|
||||
if (StrUtil.isBlank(s)) {
|
||||
return "false";
|
||||
return "二维码过期";
|
||||
}
|
||||
MemberUserDO user = userService.getUser(Long.valueOf(s));
|
||||
Double totalPrice = createOrder(dto).getTotalPrice();
|
||||
BigDecimal total = BigDecimal.valueOf(totalPrice).setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return "";
|
||||
BigDecimal compute = compute(total, user.getId());
|
||||
if (compute.compareTo(BigDecimal.ZERO) < 0) {
|
||||
return "金额不足";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user