Compare commits
No commits in common. "2d9c1b481594c6ea13261c64356e37db3c22461a" and "84f0cb0a9baa7a2b6af71efa4cf76ded8d5343dc" have entirely different histories.
2d9c1b4815
...
84f0cb0a9b
|
|
@ -3,7 +3,9 @@ package com.czg.controller.admin;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.market.dto.*;
|
import com.czg.market.dto.MkCouponGiftDTO;
|
||||||
|
import com.czg.market.dto.MkShopCouponRecordDTO;
|
||||||
|
import com.czg.market.dto.ShopCouponDTO;
|
||||||
import com.czg.market.service.MkCouponGiftService;
|
import com.czg.market.service.MkCouponGiftService;
|
||||||
import com.czg.market.service.MkShopCouponRecordService;
|
import com.czg.market.service.MkShopCouponRecordService;
|
||||||
import com.czg.market.service.ShopCouponService;
|
import com.czg.market.service.ShopCouponService;
|
||||||
|
|
@ -168,13 +170,4 @@ public class ACouponController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 券发放
|
|
||||||
* @return 是否发放成功
|
|
||||||
*/
|
|
||||||
@PostMapping("/grant")
|
|
||||||
public CzgResult<Boolean> rewardCoupon(@Validated @RequestBody MkRewardCouponDTO rewardCouponDTO) {
|
|
||||||
return CzgResult.success(couponRecordService.grant(rewardCouponDTO.getShopId() != null ? rewardCouponDTO.getShopId() : StpKit.USER.getShopId(), rewardCouponDTO));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||||
.notMatch("/notify/**")
|
.notMatch("/notify/**")
|
||||||
.notMatch("/admin/auth/**")
|
.notMatch("/admin/auth/**")
|
||||||
.notMatch("/admin/shopMsgPush/subscribe/**")
|
.notMatch("/admin/shopMsgPush/subscribe/**")
|
||||||
.notMatch("/admin/coupon/grant")
|
|
||||||
.check(r -> MyStpLogic.ADMIN_LOGIC.checkLogin());
|
.check(r -> MyStpLogic.ADMIN_LOGIC.checkLogin());
|
||||||
|
|
||||||
})).addPathPatterns("/**");
|
})).addPathPatterns("/**");
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package com.czg.market.dto;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.Min;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MkRewardCouponDTO implements Serializable {
|
|
||||||
@NotNull(message = "用户ID不能为空")
|
|
||||||
private Long userId;
|
|
||||||
@NotNull(message = "优惠券ID不能为空")
|
|
||||||
private Long couponId;
|
|
||||||
@NotNull(message = "数量不能为空")
|
|
||||||
@Min(value = 1, message = "数量不能小于1")
|
|
||||||
private Integer num;
|
|
||||||
|
|
||||||
private Long shopId;
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.czg.market.dto;
|
package com.czg.market.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -12,7 +11,6 @@ import java.io.Serializable;
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
|
||||||
public class MkShopCouponGiftDTO implements Serializable {
|
public class MkShopCouponGiftDTO implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.czg.market.service;
|
||||||
import com.czg.account.dto.QueryReceiveDto;
|
import com.czg.account.dto.QueryReceiveDto;
|
||||||
import com.czg.account.vo.CouponReceiveVo;
|
import com.czg.account.vo.CouponReceiveVo;
|
||||||
import com.czg.account.vo.UserCouponVo;
|
import com.czg.account.vo.UserCouponVo;
|
||||||
import com.czg.market.dto.MkRewardCouponDTO;
|
|
||||||
import com.czg.market.dto.MkShopCouponGiftDTO;
|
import com.czg.market.dto.MkShopCouponGiftDTO;
|
||||||
import com.czg.market.dto.MkShopCouponRecordDTO;
|
import com.czg.market.dto.MkShopCouponRecordDTO;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
|
@ -43,13 +42,8 @@ public interface MkShopCouponRecordService extends IService<MkShopCouponRecord>
|
||||||
*/
|
*/
|
||||||
void receiveCoupon(MkShopCouponGiftDTO giftDTO, Integer number, boolean isLimit);
|
void receiveCoupon(MkShopCouponGiftDTO giftDTO, Integer number, boolean isLimit);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户优惠券 失效/删除
|
* 用户优惠券 失效/删除
|
||||||
*/
|
*/
|
||||||
void deleteRecord(Long id);
|
void deleteRecord(Long id);
|
||||||
|
|
||||||
Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import com.czg.account.service.UserInfoService;
|
||||||
import com.czg.account.vo.CouponReceiveVo;
|
import com.czg.account.vo.CouponReceiveVo;
|
||||||
import com.czg.account.vo.UserCouponVo;
|
import com.czg.account.vo.UserCouponVo;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.market.dto.MkRewardCouponDTO;
|
|
||||||
import com.czg.market.dto.MkShopCouponGiftDTO;
|
import com.czg.market.dto.MkShopCouponGiftDTO;
|
||||||
import com.czg.market.dto.MkShopCouponRecordDTO;
|
import com.czg.market.dto.MkShopCouponRecordDTO;
|
||||||
import com.czg.market.entity.MkShopCouponRecord;
|
import com.czg.market.entity.MkShopCouponRecord;
|
||||||
|
|
@ -200,15 +199,4 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
||||||
public void deleteRecord(Long id) {
|
public void deleteRecord(Long id) {
|
||||||
updateById(new MkShopCouponRecord().setId(id).setIsDel(1), true);
|
updateById(new MkShopCouponRecord().setId(id).setIsDel(1), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO) {
|
|
||||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, rewardCouponDTO.getUserId()));
|
|
||||||
MkShopCouponGiftDTO giftDTO = new MkShopCouponGiftDTO().setCouponId(rewardCouponDTO.getCouponId())
|
|
||||||
.setShopId(shopId)
|
|
||||||
.setShopUserId(shopUser == null ? null : shopUser.getId())
|
|
||||||
.setSource("后台发放");
|
|
||||||
receiveCoupon(giftDTO, rewardCouponDTO.getNum(), false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue