|
|
@ -9,12 +9,15 @@ |
|
|
|
package co.yixiang.modules.activity.service.impl; |
|
|
|
package co.yixiang.modules.activity.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.iocoder.yudao.framework.common.exception.YshopException; |
|
|
|
import cn.iocoder.yudao.framework.common.exception.YshopException; |
|
|
|
import co.yixiang.common.service.impl.BaseServiceImpl; |
|
|
|
import co.yixiang.common.service.impl.BaseServiceImpl; |
|
|
|
import co.yixiang.common.utils.QueryHelpPlus; |
|
|
|
import co.yixiang.common.utils.QueryHelpPlus; |
|
|
|
import co.yixiang.dozer.service.IGenerator; |
|
|
|
import co.yixiang.dozer.service.IGenerator; |
|
|
|
import co.yixiang.enums.OrderInfoEnum; |
|
|
|
import co.yixiang.enums.OrderInfoEnum; |
|
|
|
import co.yixiang.enums.ShopCommonEnum; |
|
|
|
import co.yixiang.enums.ShopCommonEnum; |
|
|
|
|
|
|
|
import co.yixiang.exception.BadRequestException; |
|
|
|
import co.yixiang.modules.activity.domain.YxStoreBargain; |
|
|
|
import co.yixiang.modules.activity.domain.YxStoreBargain; |
|
|
|
import co.yixiang.modules.activity.domain.YxStoreBargainUser; |
|
|
|
import co.yixiang.modules.activity.domain.YxStoreBargainUser; |
|
|
|
import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; |
|
|
|
import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; |
|
|
@ -30,6 +33,10 @@ import co.yixiang.modules.activity.vo.TopCountVo; |
|
|
|
import co.yixiang.modules.activity.vo.YxStoreBargainQueryVo; |
|
|
|
import co.yixiang.modules.activity.vo.YxStoreBargainQueryVo; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrder; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrder; |
|
|
|
import co.yixiang.modules.order.service.YxStoreOrderService; |
|
|
|
import co.yixiang.modules.order.service.YxStoreOrderService; |
|
|
|
|
|
|
|
import co.yixiang.modules.product.service.mapper.StoreProductMapper; |
|
|
|
|
|
|
|
import co.yixiang.modules.shop.service.YxSystemConfigService; |
|
|
|
|
|
|
|
import co.yixiang.modules.template.domain.YxShippingTemplates; |
|
|
|
|
|
|
|
import co.yixiang.modules.template.service.YxShippingTemplatesService; |
|
|
|
import co.yixiang.modules.user.domain.YxUser; |
|
|
|
import co.yixiang.modules.user.domain.YxUser; |
|
|
|
import co.yixiang.modules.user.vo.YxUserQueryVo; |
|
|
|
import co.yixiang.modules.user.vo.YxUserQueryVo; |
|
|
|
import co.yixiang.utils.FileUtil; |
|
|
|
import co.yixiang.utils.FileUtil; |
|
|
@ -76,8 +83,14 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private YxStoreBargainUserHelpService storeBargainUserHelpService; |
|
|
|
private YxStoreBargainUserHelpService storeBargainUserHelpService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private StoreProductMapper storeProductMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private YxSystemConfigService systemConfigService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private YxShippingTemplatesService shippingTemplatesService; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 退回库存销量 |
|
|
|
* 退回库存销量 |
|
|
|
* @param num 数量 |
|
|
|
* @param num 数量 |
|
|
@ -281,17 +294,34 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap |
|
|
|
if(storeBargain == null) { |
|
|
|
if(storeBargain == null) { |
|
|
|
throw new YshopException("砍价已结束"); |
|
|
|
throw new YshopException("砍价已结束"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 获取运费模板名称
|
|
|
|
|
|
|
|
String storeFreePostage = systemConfigService.getData("store_free_postage"); |
|
|
|
|
|
|
|
String tempName = ""; |
|
|
|
|
|
|
|
if(StrUtil.isBlank(storeFreePostage) |
|
|
|
|
|
|
|
|| !NumberUtil.isNumber(storeFreePostage) |
|
|
|
|
|
|
|
|| Integer.parseInt(storeFreePostage) == 0){ |
|
|
|
|
|
|
|
tempName = "全国包邮"; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeBargain.getTempId()); |
|
|
|
|
|
|
|
if(ObjectUtil.isNotNull(shippingTemplates)){ |
|
|
|
|
|
|
|
tempName = shippingTemplates.getName(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
throw new BadRequestException("请配置运费模板"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.addBargainLook(id); |
|
|
|
this.addBargainLook(id); |
|
|
|
|
|
|
|
|
|
|
|
YxStoreBargainQueryVo storeBargainQueryVo = generator.convert(storeBargain, |
|
|
|
YxStoreBargainQueryVo storeBargainQueryVo = generator.convert(storeBargain, |
|
|
|
YxStoreBargainQueryVo.class); |
|
|
|
YxStoreBargainQueryVo.class) |
|
|
|
|
|
|
|
.setConfig(storeProductMapper.selectById(storeBargain.getProductId()).getConfig()); |
|
|
|
|
|
|
|
|
|
|
|
return BargainVo |
|
|
|
return BargainVo |
|
|
|
.builder() |
|
|
|
.builder() |
|
|
|
.bargain(storeBargainQueryVo) |
|
|
|
.bargain(storeBargainQueryVo) |
|
|
|
.userInfo(generator.convert(yxUser, YxUserQueryVo.class)) |
|
|
|
.userInfo(generator.convert(yxUser, YxUserQueryVo.class)) |
|
|
|
.bargainSumCount(this.getBargainPayCount(id)) |
|
|
|
.bargainSumCount(this.getBargainPayCount(id)) |
|
|
|
|
|
|
|
.tempName(tempName) |
|
|
|
.build(); |
|
|
|
.build(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|