diff --git a/cash-common/cash-common-service/src/main/java/com/czg/account/service/UserInfoService.java b/cash-common/cash-common-service/src/main/java/com/czg/account/service/UserInfoService.java index 1241e6c16..f048f07ca 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/account/service/UserInfoService.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/account/service/UserInfoService.java @@ -27,4 +27,5 @@ public interface UserInfoService extends IService { void updateDistributionAmount(long userId, BigDecimal amount); + void initAc(UserInfo userInfo); } diff --git a/cash-common/cash-common-service/src/main/java/com/czg/order/vo/ProductCostAmountVO.java b/cash-common/cash-common-service/src/main/java/com/czg/order/vo/ProductCostAmountVO.java new file mode 100644 index 000000000..e718bc631 --- /dev/null +++ b/cash-common/cash-common-service/src/main/java/com/czg/order/vo/ProductCostAmountVO.java @@ -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; +} diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserAuthorizationServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserAuthorizationServiceImpl.java index e6ac73317..664ae2769 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserAuthorizationServiceImpl.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserAuthorizationServiceImpl.java @@ -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); - } - } - } } diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserInfoServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserInfoServiceImpl.java index 6cf8a5c9a..a469d4485 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserInfoServiceImpl.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserInfoServiceImpl.java @@ -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 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 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 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); + } + } + } }