|
|
@@ -3,6 +3,7 @@ package com.cyksj.web.controller.manage.coupon;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.annotation.Log;
|
|
|
+import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.BusinessType;
|
|
|
@@ -12,6 +13,7 @@ import com.cyksj.mapper.manage.coupon.*;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.request.CouponActiveReq;
|
|
|
import com.cyksj.model.request.CouponClassificationReq;
|
|
|
+import com.cyksj.model.request.CouponDistributeReq;
|
|
|
import com.cyksj.model.views.*;
|
|
|
import com.cyksj.service.mange.coupon.CouponCommonService;
|
|
|
import com.cyksj.service.translations.BackInfoTranslationsFrontService;
|
|
|
@@ -122,6 +124,47 @@ public class CouponController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult("发放优惠券成功");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 优惠券关联固定推广者
|
|
|
+ */
|
|
|
+ @PostMapping("/set/relation")
|
|
|
+ public Result<String> setPopularizeRelation(@RequestBody CouponDistributeReq couponDistributeReq) {
|
|
|
+ couponCommonService.setPopularizeRelation(couponDistributeReq);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult("优惠券关联固定推广者成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置固定推广者兑换码
|
|
|
+ */
|
|
|
+ @PutMapping("/set/relation/exCode")
|
|
|
+ public Result<String> setPopularizeRelationCode(@RequestBody CouponDistributePopularize couponDistributePopularize) {
|
|
|
+ couponCommonService.setPopularizeRelationCode(couponDistributePopularize);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult("设置固定推广者兑换码成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关联某优惠券列表
|
|
|
+ */
|
|
|
+ @GetMapping("/get/relation/list")
|
|
|
+ public Result<SearchResult<CouponDistributePopularizeView>> getRelationList(HttpServletRequest request) {
|
|
|
+ SearchResult<CouponDistributePopularizeView> search = beanSearcher.search(CouponDistributePopularizeView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
+ search.getDataList().forEach(data -> {
|
|
|
+ Integer usedNum = orderDonMapper.selectCouponCodeUserNum(data.getId(), data.getExCode(), Constant.noOrderAllStatus);
|
|
|
+ data.setUsedNum(usedNum);
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除固定推广者关联
|
|
|
+ */
|
|
|
+ @DeleteMapping("/relation/del/{relationId}")
|
|
|
+ public Result<String> deleteRelationById(@PathVariable Long relationId) {
|
|
|
+ couponDistributePopularizeMapper.deleteById(relationId);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult("删除推广者关联成功");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 优惠券列表
|
|
|
*/
|