群聊优惠券活动
This commit is contained in:
@@ -3,6 +3,7 @@ package com.czg.controller.admin;
|
|||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.market.dto.ChatCouponDTO;
|
import com.czg.market.dto.ChatCouponDTO;
|
||||||
import com.czg.market.dto.ChatCouponGrantDTO;
|
import com.czg.market.dto.ChatCouponGrantDTO;
|
||||||
|
import com.czg.market.entity.ChatCoupon;
|
||||||
import com.czg.market.entity.MkShopCouponRecord;
|
import com.czg.market.entity.MkShopCouponRecord;
|
||||||
import com.czg.market.service.ChatCouponService;
|
import com.czg.market.service.ChatCouponService;
|
||||||
import com.czg.market.vo.ChatCouponVO;
|
import com.czg.market.vo.ChatCouponVO;
|
||||||
@@ -32,10 +33,10 @@ public class AChatCouponController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@SaAdminCheckPermission(value = "chat:coupon:create", name = "群聊优惠券活动-创建")
|
@SaAdminCheckPermission(value = "chat:coupon:create", name = "群聊优惠券活动-创建")
|
||||||
public CzgResult<Void> createChatCoupon(@RequestBody @Validated ChatCouponDTO chatCoupon) {
|
public CzgResult<ChatCoupon> createChatCoupon(@RequestBody @Validated ChatCouponDTO chatCoupon) {
|
||||||
Long shopId = StpKit.USER.getShopId();
|
Long shopId = StpKit.USER.getShopId();
|
||||||
chatCouponService.createChatCoupon(shopId, chatCoupon);
|
ChatCoupon coupon = chatCouponService.createChatCoupon(shopId, chatCoupon);
|
||||||
return CzgResult.success();
|
return CzgResult.success(coupon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public interface ChatCouponService extends IService<ChatCoupon> {
|
|||||||
/**
|
/**
|
||||||
* 创建聊天优惠券发放活动
|
* 创建聊天优惠券发放活动
|
||||||
*/
|
*/
|
||||||
void createChatCoupon(Long shopId, ChatCouponDTO chatCoupon);
|
ChatCoupon createChatCoupon(Long shopId, ChatCouponDTO chatCoupon);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询聊天优惠券发放活动
|
* 分页查询聊天优惠券发放活动
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class ChatCouponServiceImpl extends ServiceImpl<ChatCouponMapper, ChatCou
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void createChatCoupon(Long shopId, ChatCouponDTO chatCoupon) {
|
public ChatCoupon createChatCoupon(Long shopId, ChatCouponDTO chatCoupon) {
|
||||||
ShopCoupon coupon = couponService.getOne(QueryWrapper.create()
|
ShopCoupon coupon = couponService.getOne(QueryWrapper.create()
|
||||||
.eq(ShopCoupon::getId, chatCoupon.getCouponId())
|
.eq(ShopCoupon::getId, chatCoupon.getCouponId())
|
||||||
);
|
);
|
||||||
@@ -62,6 +62,7 @@ public class ChatCouponServiceImpl extends ServiceImpl<ChatCouponMapper, ChatCou
|
|||||||
MkShopCouponRecord record = recordService.assembleRecord(saveChatCoupon.getId(), coupon);
|
MkShopCouponRecord record = recordService.assembleRecord(saveChatCoupon.getId(), coupon);
|
||||||
saveChatCoupon.setCouponJson(JSONObject.toJSONString(record));
|
saveChatCoupon.setCouponJson(JSONObject.toJSONString(record));
|
||||||
updateById(saveChatCoupon);
|
updateById(saveChatCoupon);
|
||||||
|
return saveChatCoupon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user