Merge remote-tracking branch 'origin/master'

This commit is contained in:
张松 2025-03-20 11:27:41 +08:00
commit 8d962676fc
3 changed files with 21 additions and 21 deletions

View File

@ -32,7 +32,7 @@ public class SysUserEditPwdDTO {
/**
* 密码
*/
@Size(min = 1, message = "密码不为空")
@NotBlank(message = "确认密码不为空")
private String password;

View File

@ -4,6 +4,7 @@ import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@ -88,4 +89,7 @@ public class FreeDineConfig implements Serializable {
*/
private String childShopIdList;
public Integer getMultiple() {
return rechargeTimes == null ? 2 : rechargeTimes;
}
}

View File

@ -86,6 +86,8 @@ public class PayServiceImpl implements PayService {
private ShopCouponService couponService;
@DubboReference
private MemberPointsService pointsService;
@DubboReference
private FreeDineConfigService freeConfigService;
@Resource
private CzgPayService czgPayService;
@Resource
@ -146,6 +148,11 @@ public class PayServiceImpl implements PayService {
throw new ValidateException("充值金额不正确");
}
if (payParam.getOrderId() != null) {
FreeDineConfig freeConfig = freeConfigService.getById(payParam.getShopId());
AssertUtil.isNull(freeConfig, "该店铺未启用霸王餐");
if (!freeConfig.getEnable()) {
throw new CzgException("该店铺未启用霸王餐");
}
OrderInfo orderInfo = orderInfoService.getById(payParam.getOrderId());
AssertUtil.isNull(orderInfo, "订单不存在");
//获取商品信息 计算金额 需要传入优惠券 减去优惠券
@ -155,7 +162,12 @@ public class PayServiceImpl implements PayService {
//最终打包费
BigDecimalDTO packAmount = new BigDecimalDTO(BigDecimal.ZERO);
orderInfoService.processOrderDetails2(orderDetails, null, null, totalAmount, packAmount, payParam.isAllPack(), null, true);
BigDecimal payAmount = (totalAmount.getPrice().add(packAmount.getPrice())).multiply(BigDecimal.TWO);
BigDecimal total = totalAmount.getPrice().add(packAmount.getPrice());
if (total.compareTo(freeConfig.getRechargeThreshold()) < 0) {
throw new CzgException("霸王餐满" + freeConfig.getRechargeThreshold() + "可用,当前订单金额为" + total);
}
BigDecimal payAmount = (totalAmount.getPrice().add(packAmount.getPrice())).multiply(new BigDecimal(freeConfig.getMultiple()));
log.info("霸王餐应支付金额:{},充值金额为:{}", payAmount, payParam.getAmount());
if (payAmount.compareTo(payParam.getAmount()) != 0) {
throw new ValidateException("霸王餐支付金额不正确");
}
@ -340,7 +352,6 @@ public class PayServiceImpl implements PayService {
@Override
@Transactional
public CzgResult<Object> cashPayVip(VipPayParamDTO payParam) {
boolean isFree = checkPayVip(payParam);
ShopUser shopUser = shopUserService.getById(payParam.getShopUserId());
AssertUtil.isNull(shopUser, "充值失败 该店铺用户不存在");
ShopInfo shopInfo = shopInfoService.getById(payParam.getShopId());
@ -359,11 +370,6 @@ public class PayServiceImpl implements PayService {
updateInfo.setJoinTime(LocalDateTime.now());
updateInfo.setId(payParam.getShopUserId());
shopUserService.updateById(updateInfo);
// UpdateChain.of(ShopUser.class)
// .set(ShopUser::getIsVip, 1)
// .set(ShopUser::getJoinTime, LocalDateTime.now())
// .eq(ShopUser::getId, payParam.getShopUserId())
// .update();
}
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
.setId(shopUser.getId())
@ -371,20 +377,10 @@ public class PayServiceImpl implements PayService {
.setType(1)
.setRemark("现金充值")
.setBizEnum(ShopUserFlowBizEnum.CASH_IN);
if (isFree) {
shopUserMoneyEditDTO.setBizEnum(ShopUserFlowBizEnum.FREE_IN);
UpdateChain.of(OrderInfo.class).eq(OrderInfo::getId, payParam.getOrderId())
.set(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode())
.set(OrderInfo::getIsFreeDine, 1)
.set(OrderInfo::getPayAmount, 0)
.update();
}
//更新会员余额 并生成流水
Long flowId = shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
if (!isFree) {
//会员活动
shopActivateService.giveActivate(shopUser, payParam.getAmount(), payParam.getActivateId(), flowId);
}
//会员活动
shopActivateService.giveActivate(shopUser, payParam.getAmount(), payParam.getActivateId(), flowId);
return CzgResult.success();
}
@ -567,7 +563,7 @@ public class PayServiceImpl implements PayService {
isPay = false;
refPayOrderNo = "";
}
if(isPay){
if (isPay) {
if (shopInfo.getIsReturnPwd().equals(1)) {
AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用");
if (!SecureUtil.md5(param.getPwd()).equals(shopInfo.getOperationPwd())) {