Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
张松
2025-11-25 11:32:38 +08:00
7 changed files with 62 additions and 30 deletions

View File

@@ -27,4 +27,5 @@ public interface UserInfoService extends IService<UserInfo> {
void updateDistributionAmount(long userId, BigDecimal amount);
void initAc(UserInfo userInfo);
}

View File

@@ -30,13 +30,14 @@ public class CountPayTypeVo {
private static final Map<String, String> PAY_TYPE_MAPPING = new LinkedHashMap<>();
static {
PAY_TYPE_MAPPING.put("memberPay", "会员支付");
PAY_TYPE_MAPPING.put("cashPay", "现金支付");
PAY_TYPE_MAPPING.put("wechatPay", "微信支付");
PAY_TYPE_MAPPING.put("alipayPay", "支付宝支付");
PAY_TYPE_MAPPING.put("mainScanPay", "扫支付");
PAY_TYPE_MAPPING.put("backScanPay", "扫支付");
PAY_TYPE_MAPPING.put("creditPay", "信用支付");
PAY_TYPE_MAPPING.put("mainScanPay", "扫支付");
PAY_TYPE_MAPPING.put("backScanPay", "扫支付");
PAY_TYPE_MAPPING.put("memberPay", "余额支付");
PAY_TYPE_MAPPING.put("creditPay", "挂账支付");
}

View File

@@ -0,0 +1,22 @@
package com.czg.order.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 用于获取 商品成本价
*
* @author ww
* @description
*/
@Data
public class ProductCostAmountVO {
private Long productId;
private Long skuId;
//向上取整 保留两位小数
private BigDecimal costAmount;
private Long count;
private BigDecimal totalCostAmount;
}

View File

@@ -36,8 +36,6 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
@Resource
private WechatAuthUtil wechatAuthUtil;
@Resource
private AcAccountUtil acAccountUtil;
@Resource
private AlipayUtil alipayUtil;
@Resource
private UserInfoService userInfoService;
@@ -121,28 +119,10 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
userInfo.setLastLoginTime(DateUtil.date().toLocalDateTime());
userInfoService.saveOrUpdate(userInfo);
initAc(userInfo);
userInfoService.initAc(userInfo);
// StpKit.USER.login(userInfo.getId());
StpKit.USER.login(userInfo.getId(), openId, null, null, null, MyStpLogic.LoginType.USER, false, "userMini", false);
String followIndex = paramsService.getSysParamValue(SysParamCodeEnum.FOLLOW_INDEX.getCode());
return new LoginTokenDTO(StpKit.USER.getTokenValue(), followIndex, userInfo);
}
/**
* 初始化用户微信公众号二维码\
*/
private void initAc(UserInfo userInfo) {
if (userInfo.getIsAc() == null) {
userInfo.setIsAc(0);
}
if (userInfo.getIsAc() == 0 &&
(StrUtil.isBlank(userInfo.getWechatAcQrcode()) || userInfo.getAcQrcodeValidTime() == null || userInfo.getAcQrcodeValidTime().isBefore(LocalDateTime.now()))) {
String qrCode = acAccountUtil.createQrCode(userInfo.getId());
if (StrUtil.isNotBlank(qrCode)) {
userInfo.setWechatAcQrcode(qrCode);
userInfo.setAcQrcodeValidTime(LocalDateTime.now().plusDays(29));
userInfoService.updateById(userInfo);
}
}
}
}

View File

@@ -16,6 +16,7 @@ import com.czg.exception.CzgException;
import com.czg.service.RedisService;
import com.czg.service.account.mapper.ShopUserMapper;
import com.czg.service.account.mapper.UserInfoMapper;
import com.czg.service.account.util.AcAccountUtil;
import com.czg.system.service.SmsService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
@@ -24,6 +25,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 服务层实现。
@@ -37,6 +39,8 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
private ShopUserMapper shopUserMapper;
@Resource
private RedisService redisService;
@Resource
private AcAccountUtil acAccountUtil;
@DubboReference
private SmsService smsService;
@@ -47,7 +51,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
if (userInfo == null) {
throw new CzgException("用户信息不存在");
}
initAc(userInfo);
UserInfoAssetsSummaryDTO assetsSummaryDTO = shopUserMapper.selectAssetsSummary(userInfoId);
UserInfoDTO userInfoDTO = BeanUtil.copyProperties(userInfo, UserInfoDTO.class);
userInfoDTO.setAssetsSummary(assetsSummaryDTO);
@@ -106,4 +110,23 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
throw new CzgException("更新分销金额失败");
}
}
/**
* 初始化用户微信公众号二维码\
*/
@Override
public void initAc(UserInfo userInfo) {
if (userInfo.getIsAc() == null) {
userInfo.setIsAc(0);
}
if (userInfo.getIsAc() == 0 &&
(StrUtil.isBlank(userInfo.getWechatAcQrcode()) || userInfo.getAcQrcodeValidTime() == null || userInfo.getAcQrcodeValidTime().isBefore(LocalDateTime.now()))) {
String qrCode = acAccountUtil.createQrCode(userInfo.getId());
if (StrUtil.isNotBlank(qrCode)) {
userInfo.setWechatAcQrcode(qrCode);
userInfo.setAcQrcodeValidTime(LocalDateTime.now().plusDays(29));
updateById(userInfo);
}
}
}
}

View File

@@ -1488,7 +1488,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
} else {
//新客立减
if (param.getNewCustomerDiscountId() != null) {
newConsumerDiscountRecordService.checkDiscount(param.getNewCustomerDiscountId(), shopUser.getId(), param.getOrderId(), param.getNewCustomerDiscountAmount());
newConsumerDiscountRecordService.checkDiscount(orderInfo.getShopId(), shopUser.getUserId(), param.getOrderId(), param.getNewCustomerDiscountAmount());
}
//积分使用
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {

View File

@@ -112,9 +112,14 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
@Override
public String getSysParamValue(String code) {
SysParams sysParam = getSysParam(code);
log.error("参数不存在,参数编码:{}", code);
AssertUtil.isNull(sysParam, "参数不存在");
AssertUtil.isBlank(sysParam.getParamValue(), "参数值为空");
if (sysParam == null) {
log.error("参数不存在,参数编码:{}", code);
return "";
}
if (sysParam.getParamValue() == null) {
log.error("参数值为空,参数编码:{}", code);
return "";
}
return sysParam.getParamValue();
}