zoujiajian 1 year ago
parent
commit
ac5748316e

+ 5 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -527,4 +527,9 @@ public interface Constant {
 	 * 企业微信引流前缀标识key
 	 */
 	String CORP_WX_YL_PREFIX = "qywxyl_";
+
+	/**
+	 * 引流新人优惠券id
+	 */
+	String YL_NEW_WELFARE_COUPON_ID = "yl_new_welfare_coupon_id";
 }

+ 28 - 0
netflix-web/src/main/java/com/cyksj/web/controller/coupon/CouponFrontController.java

@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.common.annotation.NoSubmit;
+import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.dto.Result;
@@ -23,6 +24,7 @@ import com.cyksj.model.request.CouponCollectReq;
 import com.cyksj.model.views.*;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.coupon.CouponFontService;
+import com.cyksj.service.sys.SysConfigService;
 import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.param.Operator;
@@ -68,6 +70,8 @@ public class CouponFrontController {
 
 	private final HttpServletRequest request;
 
+	private final SysConfigService sysConfigService;
+
 	/**
 	 * 优惠券领取中心列表
 	 */
@@ -400,4 +404,28 @@ public class CouponFrontController {
 		}
 		return GatewayResponse.SUCCESS.newBuilder().toResult(couponDetailView);
 	}
+
+	/**
+	 * 引流新人优惠券详情
+	 */
+	@GetMapping("/get/yl/welfare/coupon/detail")
+	public Result<CouponDetailView> getYlWelfareCouponDetail() {
+		SysConfig one = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+				.eq(SysConfig::getSysKey, Constant.YL_NEW_WELFARE_COUPON_ID)
+				.last("limit 1"));
+		if (one == null) {
+			return GatewayResponse.SUCCESS.newBuilder().toResult();
+		}
+		String couponId = one.getSysValue();
+		CouponDetailView couponDetailView = beanSearcher.searchFirst(CouponDetailView.class, MapUtils.flatBuilder(request.getParameterMap()).field(CouponDetailView::getCouponId, couponId).build());
+		String str = couponSkuMapper.selectGoodsSkuStr(couponDetailView.getCouponId());
+		couponDetailView.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
+		List<CouponSkuView> couponSkus = couponSkuMapper.getGoodsSkuByCouponId(couponDetailView.getCouponId());
+		try {
+			couponDetailView.setGoodsSkuIds(Jsons.toJson(couponSkus));
+		} catch (Exception e) {
+
+		}
+		return GatewayResponse.SUCCESS.newBuilder().toResult(couponDetailView);
+	}
 }