|
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.EnvCommonService;
|
|
import com.cyksj.common.EnvCommonService;
|
|
|
import com.cyksj.common.annotation.NoSubmit;
|
|
import com.cyksj.common.annotation.NoSubmit;
|
|
@@ -179,6 +180,10 @@ public class CpsPopularizeController {
|
|
|
}
|
|
}
|
|
|
link += "/?gid=" + data.getGoodsId();
|
|
link += "/?gid=" + data.getGoodsId();
|
|
|
}
|
|
}
|
|
|
|
|
+ if (data.getSkuId() != null && data.getSkuId() > 0) {
|
|
|
|
|
+ Optional.ofNullable(skuMapper.selectById(data.getSkuId())).ifPresent(sku -> data.setSpecVal(sku.getSpecVal()));
|
|
|
|
|
+ link += "&skuId=" + data.getSkuId();
|
|
|
|
|
+ }
|
|
|
data.setUrlCode(QrCodeUtil.generateAsBase64(link, QrConfig.create(), "png"));
|
|
data.setUrlCode(QrCodeUtil.generateAsBase64(link, QrConfig.create(), "png"));
|
|
|
//会员订单数据
|
|
//会员订单数据
|
|
|
if (data.getGoodsId() != null && data.getGoodsId() == Constant.VIP_RELATE_GOODS_ID) {
|
|
if (data.getGoodsId() != null && data.getGoodsId() == Constant.VIP_RELATE_GOODS_ID) {
|
|
@@ -266,6 +271,28 @@ public class CpsPopularizeController {
|
|
|
List<CpsGoodsDonDistributeView> list = beanSearcher.searchAll(CpsGoodsDonDistributeView.class, builder
|
|
List<CpsGoodsDonDistributeView> list = beanSearcher.searchAll(CpsGoodsDonDistributeView.class, builder
|
|
|
.put("distribute_id", String.format("and distribute_id = (select id from user_distribute where user_id = %s and deleted is true limit 1)", cpsUserId))
|
|
.put("distribute_id", String.format("and distribute_id = (select id from user_distribute where user_id = %s and deleted is true limit 1)", cpsUserId))
|
|
|
.build());
|
|
.build());
|
|
|
|
|
+ UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, cpsUserId)
|
|
|
|
|
+ .eq(UserDistribute::getDeleted, Boolean.TRUE)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ list.forEach(goods->{
|
|
|
|
|
+ LambdaQueryWrapper<GoodsDonSku> wrapper = Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
|
|
+ .eq(GoodsDonSku::getGoodsId, goods.getId())
|
|
|
|
|
+ .eq(GoodsDonSku::getStatus, Boolean.TRUE);
|
|
|
|
|
+ if (goods.getIsSkuDistribute()) {
|
|
|
|
|
+ //开启规格分销 需要排除那些为0的规格
|
|
|
|
|
+ List<UserPlatSkuDistributeRate> userPlatSkuDistributeRates = beanSearcher.searchList(UserPlatSkuDistributeRate.class, MapUtils.builder()
|
|
|
|
|
+ .field(UserPlatSkuDistributeRate::getDistributeId, userDistribute.getId())
|
|
|
|
|
+ .field(UserPlatSkuDistributeRate::getRate, 0)
|
|
|
|
|
+ .build());
|
|
|
|
|
+ List<Long> exuSkuIds = userPlatSkuDistributeRates.stream().map(UserPlatSkuDistributeRate::getSkuId).collect(Collectors.toList());
|
|
|
|
|
+ if (CollUtil.isNotEmpty(exuSkuIds)) {
|
|
|
|
|
+ wrapper.notIn(GoodsDonSku::getId, exuSkuIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ List<GoodsDonSku> goodsDonSkus = skuMapper.selectList(wrapper
|
|
|
|
|
+ .select(GoodsDonSku::getId, GoodsDonSku::getSpecVal));
|
|
|
|
|
+ goods.setSkus(goodsDonSkus);
|
|
|
|
|
+ });
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
}
|
|
}
|
|
|
|
|
|