parent
23f4e36bda
commit
fed28278d8
|
|
@ -4,6 +4,7 @@ import com.czg.account.dto.QueryReceiveDto;
|
|||
import com.czg.account.dto.ShopCouponDTO;
|
||||
import com.czg.account.service.ShopCouponService;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.account.vo.UserCouponVo;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
|
|
@ -71,5 +72,15 @@ public class ShopCouponController {
|
|||
return CzgResult.success(couponService.queryReceive(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单后使用
|
||||
* 通过用户Id 查找优惠券
|
||||
*
|
||||
* @param shopUserId 店铺用户Id
|
||||
*/
|
||||
@GetMapping("/findCoupon")
|
||||
public CzgResult<List<UserCouponVo>> findCoupon(@RequestParam Long shopUserId, @RequestParam(required = false) Integer type) {
|
||||
return CzgResult.success(couponService.findCoupon(StpKit.USER.getShopId(), shopUserId, type));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class UserShopCouponController {
|
|||
* @param shopUserId 店铺用户Id
|
||||
*/
|
||||
@GetMapping("/findCoupon")
|
||||
public CzgResult<List<UserCouponVo>> findCoupon(@RequestHeader String shopId, @RequestParam Long shopUserId) {
|
||||
return CzgResult.success(couponService.findCoupon(Long.parseLong(shopId), shopUserId));
|
||||
public CzgResult<List<UserCouponVo>> findCoupon(@RequestHeader String shopId, @RequestParam Long shopUserId, @RequestParam(required = false) Integer type) {
|
||||
return CzgResult.success(couponService.findCoupon(Long.parseLong(shopId), shopUserId, type));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@ public interface ShopActivateCouponRecordService extends IService<ShopActivateCo
|
|||
|
||||
List<ShopActivateCouponRecord> findByUser(List<Long> shopUserIds, Integer status);
|
||||
|
||||
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId);
|
||||
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public interface ShopCouponService extends IService<ShopCoupon> {
|
|||
|
||||
Page<ShopActivateCouponRecord> find(Long userId,Long shopId, Integer status);
|
||||
|
||||
List<UserCouponVo> findCoupon(Long shopId, Long shopUserId);
|
||||
List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type);
|
||||
|
||||
Boolean use(List<Long> ids, Long shopUserId, Long orderId);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ public interface ShopActivateCouponRecordMapper extends BaseMapper<ShopActivateC
|
|||
List<CouponReceiveVo> queryReceive(QueryReceiveDto param);
|
||||
|
||||
List<ShopActivateCouponRecord> findByUser(List<Long> shopUserIds, Integer status);
|
||||
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId);
|
||||
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId,Integer type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class ShopActivateCouponRecordServiceImpl extends ServiceImpl<ShopActivat
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId) {
|
||||
return getMapper().queryByVipIdAndShopId(shopId, shopUserId);
|
||||
public List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type) {
|
||||
return getMapper().queryByVipIdAndShopId(shopId, shopUserId, type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<UserCouponVo> findCoupon(Long shopId, Long shopUserId) {
|
||||
List<UserCouponVo> tbUserCouponVos = couponRecordService.queryByVipIdAndShopId(shopId, shopUserId);
|
||||
public List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type) {
|
||||
List<UserCouponVo> tbUserCouponVos = couponRecordService.queryByVipIdAndShopId(shopId, shopUserId,type);
|
||||
if (CollectionUtil.isNotEmpty(tbUserCouponVos)) {
|
||||
String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("周");
|
||||
LocalTime now = LocalTime.now();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
inRecord.over_num as num,
|
||||
inRecord.use_end_time as endTime
|
||||
FROM
|
||||
tb_activate_in_record inRecord
|
||||
tb_shop_activate_coupon_record inRecord
|
||||
LEFT JOIN tb_shop_info shop ON inRecord.shop_id = shop.id
|
||||
LEFT JOIN tb_product pro ON inRecord.pro_id = pro.id and pro.shop_id = #{shopId}
|
||||
WHERE
|
||||
|
|
@ -74,7 +74,10 @@
|
|||
<if test="shopId != null and shopId != ''">
|
||||
and inRecord.shop_id = #{shopId}
|
||||
</if>
|
||||
and inRecord.over_num != 0
|
||||
<if test="type != null ">
|
||||
and inRecord.type = #{type}
|
||||
</if>
|
||||
and inRecord.status = 0
|
||||
and inRecord.use_start_time < now()
|
||||
and inRecord.use_end_time > now()
|
||||
order by inRecord.use_end_time
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ public class PayServiceImpl implements PayService {
|
|||
orderInfo.setRefundRemark(orderInfo.getRefundRemark() + param.getRefundReason());
|
||||
orderInfoService.updateById(orderInfo);
|
||||
//退款返还库存
|
||||
rabbitPublisher.sendOrderRefundMsg(JSONObject.toJSONString(returnProMap));
|
||||
rabbitPublisher.sendOrderRefundMsg(JSONObject.toJSONString(Map.of("orderId", orderInfo.getId(), "returnProMap", returnProMap)));
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue