Browse Source

1.新增根据店铺id集合获取商家id集合接口业务 2.新增商家id集合获取商家优惠券信息接口业务 3.下单业务店铺优惠券汇算改为商家优惠券汇算

multiwx
dy-hu 1 month ago
parent
commit
d7adcea5db
  1. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerShopCouponDAO.java
  2. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerShopCouponService.java
  3. 10
      cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerShopCouponServiceImpl.java
  4. 8
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java
  5. 17
      cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerShopCouponDAO.xml
  6. 8
      cereshop-business/src/main/resources/mybatis/mapper/business/CerePlatformBusinessDAO.xml

4
cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerShopCouponDAO.java

@ -53,4 +53,8 @@ public interface CereBuyerShopCouponDAO extends BaseMapper<CereBuyerShopCoupon>
List<CommonCoupon> selectTakeCount(@Param("buyerUserId") Long buyerUserId,
@Param("couponIdList") List<Long> couponIdList);
List<Long> findBusinessIdsByShops(@Param("list") List<Long> list);
List<CereBuyerShopCoupon> findBuyerShopCouponsByBusinessIds(@Param("list") List<Long> list);
}

4
cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerShopCouponService.java

@ -42,4 +42,8 @@ public interface CereBuyerShopCouponService {
* @return
*/
List<CommonCoupon> selectTakeCount(Long buyerUserId, List<Long> couponIdList);
List<Long> findBusinessIdsByShops(List<Long> shopIdList);
List<CereBuyerShopCoupon> findBuyerShopCouponsByBusinessIds(List<Long> businessIdList);
}

10
cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerShopCouponServiceImpl.java

@ -79,4 +79,14 @@ public class CereBuyerShopCouponServiceImpl implements CereBuyerShopCouponServic
public List<CommonCoupon> selectTakeCount(Long buyerUserId, List<Long> couponIdList) {
return cereBuyerShopCouponDAO.selectTakeCount(buyerUserId, couponIdList);
}
@Override
public List<Long> findBusinessIdsByShops(List<Long> shopIdList) {
return cereBuyerShopCouponDAO.findBusinessIdsByShops(shopIdList);
}
@Override
public List<CereBuyerShopCoupon> findBuyerShopCouponsByBusinessIds(List<Long> businessIdList) {
return null;
}
}

8
cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java

@ -608,9 +608,11 @@ public abstract class PlaceOrderTemplate {
}
}
//查询所有店铺优惠券数据
//查询所有店铺优惠券数据(改为获取所有商家优惠券)
List<Long> shopIdList = param.getShops().stream().map(OrderProductParam::getShopId).distinct().collect(Collectors.toList());
List<CereBuyerShopCoupon> list = cereBuyerShopCouponService.findByIds(shopIdList);
//查询店铺所属的商家id
List<Long> businessIdList = cereBuyerShopCouponService.findBusinessIdsByShops(shopIdList);
List<CereBuyerShopCoupon> list = cereBuyerShopCouponService.findBuyerShopCouponsByBusinessIds(businessIdList);
//计算店铺优惠券金额总和--注意订单不是根据店铺作为主键的但是店铺优惠券是根据店铺作为主键的要做好怎么分配--TODO pxh
if (!EmptyUtils.isEmpty(list)) {
@ -620,7 +622,7 @@ public abstract class PlaceOrderTemplate {
Long shopId = param.getShops().stream().filter(o->o.getId() != null && o.getId().equals(cereBuyerShopCoupon.getId())).map(OrderProductParam::getShopId).findAny().orElse(0L);
Optional<OrderProductParam> productParam = param.getShops().stream().filter(o->o.getShopId().equals(shopId)).findFirst();
int priceCount = 0;
if (productParam.isPresent()){
if (productParam != null && productParam.isPresent()){
List<ProductSku> skuList = productParam.get().getSkus();
for (ProductSku sku:skuList) {
if (sku.getPriceId() != null && sku.getPriceId() > 0) {

17
cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerShopCouponDAO.xml

@ -250,6 +250,23 @@
)
</select>
<select id="findBusinessIdsByShops" parameterType="java.lang.Object" resultType="java.lang.Long">
SELECT DISTINCT business_id FROM cere_platform_shop WHERE shop_id IN (
<foreach collection="list" item="shopId" index="index" separator=",">
#{shopId}
</foreach>
)
</select>
<select id="findBuyerShopCouponsByBusinessIds" parameterType="java.util.List" resultType="com.shop.cereshop.commons.domain.buyer.CereBuyerShopCoupon">
select a.* FROM cere_buyer_shop_coupon a join cere_shop_coupon b on a.shop_coupon_id = b.shop_coupon_id
where b.shop_id in (
<foreach collection="list" item="businessId" index="index" separator=",">
#{businessId}
</foreach>
)
</select>
<select id="findCouponMatchCondition" resultMap="ProductCouponMap">
SELECT a.id, a.start_time, a.end_time, a.full_money, a.reduce_money, a.coupon_type, a.coupon_type as discount_mode,
a.state, c.if_add, a.shop_coupon_id, c.apply_type, 0 as product_id

8
cereshop-business/src/main/resources/mybatis/mapper/business/CerePlatformBusinessDAO.xml

@ -341,10 +341,10 @@
</select>
<select id="getHotProducts" resultType="com.shop.cereshop.business.page.index.HotSellProduct">
SELECT a.product_name,SUM(a.number) from cere_order_product a
select c.product_name, SUM(c.number) from
(SELECT a.product_name, a.number,b.shop_id from cere_order_product a
LEFT JOIN cere_shop_order b ON a.order_id=b.order_id
where b.shop_id=#{businessId}
AND b.project = #{project} and b.state=4
where b.project = #{project} and b.state=4
<if test='condition=="1"'>
and DATEDIFF(LEFT(NOW(),10),LEFT(b.create_time,10))=0
</if>
@ -357,7 +357,7 @@
<if test='condition=="4"'>
and DATE_SUB(CURDATE(),INTERVAL 30 DAY)&lt;=b.create_time
</if>
GROUP BY a.product_id
GROUP BY a.product_id) c left join cere_platform_shop d on c.shop_id = d.shop_id where d.business_id = #{businessId}
</select>
<select id="findVisits" resultType="java.math.BigDecimal">

Loading…
Cancel
Save