Parcourir la source

Merge branch 'coupon_classification'

zoujiajian il y a 3 ans
Parent
commit
d958b3497b

+ 13 - 0
netflix-dao/src/main/java/com/cyksj/mapper/manage/coupon/CouponClassificationMapper.java

@@ -0,0 +1,13 @@
+package com.cyksj.mapper.manage.coupon;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.CouponClassification;
+
+/*
+ *项目名: netflix
+ *文件名: CouponClassificationMapper
+ *创建者: JavaZou
+ *创建时间:2023/3/20 10:54
+ */
+public interface CouponClassificationMapper extends BaseMapper<CouponClassification> {
+}

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/mapper/manage/coupon/CouponSkuMapper.java

@@ -3,6 +3,7 @@ package com.cyksj.mapper.manage.coupon;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.CouponSku;
 import com.cyksj.model.views.CouponSkuView;
+import com.cyksj.model.views.GoodsDonSkuView;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -24,6 +25,10 @@ public interface CouponSkuMapper extends BaseMapper<CouponSku> {
 			" left join `goods_don_sku` gdk on gdk.id = ck.sku_id where ck.coupon_id = #{couponId}")
 	String selectGoodsSkuStr(Long couponId);
 
+	@Select("select gd.id as goods_id, gd.title as goods_title, gdk.spec_val,gd.type as goods_don_type from `coupon_sku` ck left join `goods_don` gd on gd.id = ck.goods_id" +
+			" left join `goods_don_sku` gdk on gdk.id = ck.sku_id where ck.coupon_id = #{couponId}")
+	List<GoodsDonSkuView> selectGoodsSkuViewList(Long couponId);
+
 	@Delete("delete from coupon_sku where coupon_id = #{couponId}")
 	void deleteRelationSku(Long couponId);
 

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/Coupon.java

@@ -24,6 +24,11 @@ public class Coupon extends BaseEntity {
 	@NotEmpty(message = "优惠券名称不能为空")
 	private String name;
 
+	/**
+	 * 优惠券分类id
+	 */
+	private Long classificationId;
+
 	/**
 	 * 优惠券平台类型
 	 */

+ 19 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/CouponClassification.java

@@ -0,0 +1,19 @@
+package com.cyksj.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotEmpty;
+
+/*
+ *项目名: netflix
+ *文件名: CouponClassification
+ *创建者: JavaZou
+ *创建时间:2023/3/20 10:35
+ */
+@Getter
+@Setter
+public class CouponClassification extends BaseEntity{
+	@NotEmpty
+	private String name;
+}

+ 28 - 0
netflix-dao/src/main/java/com/cyksj/model/request/CouponClassificationReq.java

@@ -0,0 +1,28 @@
+package com.cyksj.model.request;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/*
+ *项目名: netflix
+ *文件名: CouponClassificationReq
+ *创建者: JavaZou
+ *创建时间:2023/3/20 11:14
+ */
+@Getter
+@Setter
+public class CouponClassificationReq {
+	/**
+	 * 旧的分类id
+	 */
+	@NotNull(message = "被删除的分类id不能为空")
+	private Long id;
+
+	/**
+	 * 新的分类id
+	 */
+	@NotNull(message = "新分类id不能为空")
+	private Long newClassificationId;
+}

+ 11 - 1
netflix-dao/src/main/java/com/cyksj/model/views/CouponActiveView.java

@@ -10,6 +10,7 @@ import lombok.Setter;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /*
  *项目名: netflix
@@ -19,7 +20,7 @@ import java.util.Date;
  */
 @Getter
 @Setter
-@SearchBean(tables = "coupon_active ca left join coupon c on c.id = ca.coupon_id",
+@SearchBean(tables = "coupon_active ca left join coupon c on c.id = ca.coupon_id left join coupon_classification cc on cc.id = c.classification_id",
 		where = "ca.deleted is true")
 public class CouponActiveView {
 	@DbField("ca.id")
@@ -37,6 +38,12 @@ public class CouponActiveView {
 	@DbField("c.name")
 	private String name;
 
+	@DbField("cc.id")
+	private Long classificationId;
+
+	@DbField("cc.name")
+	private String couponClassificationName;
+
 	/**
 	 * 优惠券平台类型
 	 */
@@ -82,6 +89,9 @@ public class CouponActiveView {
 	@DbIgnore
 	private String goodsSkuStr;
 
+	@DbIgnore
+	private List<GoodsDonSkuView> skuViewList;
+
 	/**
 	 * 是否是有效时间
 	 */

+ 35 - 0
netflix-dao/src/main/java/com/cyksj/model/views/CouponClassificationView.java

@@ -0,0 +1,35 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/*
+ *项目名: netflix
+ *文件名: CouponClassificationView
+ *创建者: JavaZou
+ *创建时间:2023/3/20 10:59
+ */
+@Getter
+@Setter
+@SearchBean(tables = "coupon_classification cc left join coupon c on cc.id = c.classification_id",
+groupBy = "cc.id,cc.name,cc.created_time,cc.update_time")
+public class CouponClassificationView {
+	@DbField("cc.id")
+	private Long id;
+
+	@DbField("cc.name")
+	private String name;
+
+	@DbField("count(c.id)")
+	private Integer numOfCoupon;
+
+	@DbField("cc.created_time")
+	private Date createdTime;
+
+	@DbField("cc.update_time")
+	private Date updateTime;
+}

+ 11 - 1
netflix-dao/src/main/java/com/cyksj/model/views/CouponRecommendView.java

@@ -10,6 +10,7 @@ import lombok.Setter;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /*
  *项目名: netflix
@@ -19,7 +20,7 @@ import java.util.Date;
  */
 @Setter
 @Getter
-@SearchBean(tables = "coupon_recommend cr left join coupon c on c.id = cr.coupon_id",
+@SearchBean(tables = "coupon_recommend cr left join coupon c on c.id = cr.coupon_id left join coupon_classification cc on cc.id = c.classification_id",
 		where = "cr.deleted is true and c.deleted is true")
 public class CouponRecommendView {
 	@DbField("cr.id")
@@ -34,6 +35,12 @@ public class CouponRecommendView {
 	@DbField("c.name")
 	private String name;
 
+	@DbField("cc.id")
+	private Long classificationId;
+
+	@DbField("cc.name")
+	private String couponClassificationName;
+
 	/**
 	 * 优惠券平台类型
 	 */
@@ -73,6 +80,9 @@ public class CouponRecommendView {
 	@DbIgnore
 	private String goodsSkuStr;
 
+	@DbIgnore
+	private List<GoodsDonSkuView> skuViewList;
+
 	/**
 	 * 领取人范围
 	 */

+ 7 - 1
netflix-dao/src/main/java/com/cyksj/model/views/CouponUserView.java

@@ -21,7 +21,7 @@ import java.util.Date;
 @Getter
 @Setter
 @SearchBean(tables = "coupon_user cu left join coupon_active ca on ca.id = cu.coupon_active_id" +
-		" left join coupon c on c.id = cu.coupon_id")
+		" left join coupon c on c.id = cu.coupon_id left join coupon_classification cc on cc.id = c.classification_id")
 public class CouponUserView {
 	@DbField("cu.id")
 	private Long id;
@@ -62,6 +62,12 @@ public class CouponUserView {
 	@DbField("c.name")
 	private String name;
 
+	@DbField("cc.id")
+	private Long classificationId;
+
+	@DbField("cc.name")
+	private String couponClassificationName;
+
 	/**
 	 * 优惠券平台类型
 	 */

+ 33 - 1
netflix-dao/src/main/java/com/cyksj/model/views/CouponView.java

@@ -1,6 +1,7 @@
 package com.cyksj.model.views;
 
 import com.cyksj.model.entity.Coupon;
+import com.ejlchina.searcher.bean.DbField;
 import com.ejlchina.searcher.bean.DbIgnore;
 import com.ejlchina.searcher.bean.SearchBean;
 import lombok.Getter;
@@ -8,6 +9,7 @@ import lombok.Setter;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /*
  *项目名: netflix
@@ -17,89 +19,115 @@ import java.util.Date;
  */
 @Getter
 @Setter
-@SearchBean(tables = "coupon c",
+@SearchBean(tables = "coupon c left join coupon_classification cc on cc.id = c.classification_id",
 		where = "c.deleted is true")
 public class CouponView {
+	@DbField("c.id")
 	private Long id;
 
 	/**
 	 * 优惠券名称
 	 */
+	@DbField("c.name")
 	private String name;
 
+	@DbField("cc.id")
+	private Long classificationId;
+
+	@DbField("cc.name")
+	private String couponClassificationName;
+
 	/**
 	 * 优惠券平台类型
 	 */
+	@DbField("c.goods_type")
 	private Coupon.GoodsType goodsType;
 
 	/**
 	 * 优惠券类型
 	 */
+	@DbField("c.type")
 	private Coupon.Type type;
 
 	/**
 	 * 可用满减卷金额条件
 	 */
+	@DbField("c.reduce_condition")
 	private BigDecimal reduceCondition;
 
 	/**
 	 * 抵扣金额
 	 */
+	@DbField("c.reduce_money")
 	private BigDecimal reduceMoney;
 
 	/**
 	 * 折扣
 	 */
+	@DbField("c.discount")
 	private BigDecimal discount;
 
 	/**
 	 * 领取人范围
 	 */
+	@DbField("c.scope")
 	private Coupon.Scope scope;
 
 	/**
 	 * 平台规格集合
 	 */
+	@DbField("c.goods_sku_ids")
 	private String goodsSkuIds;
 
 	/**
 	 * 是否是有效时间
 	 */
+	@DbField("c.is_valid_time")
 	private Boolean isValidTime;
 
 	/**
 	 * 起始有效时间
 	 */
+	@DbField("c.valid_start_time")
 	private Date validStartTime;
 
 	/**
 	 * 截止有效时间
 	 */
+	@DbField("c.valid_end_time")
 	private Date validEndTime;
 
 	/**
 	 * 领取有效天数
 	 */
+	@DbField("c.valid_days")
 	private Integer validDays;
 
 	/**
 	 * 是否可在续费时使用
 	 */
+	@DbField("c.is_renew")
 	private Boolean isRenew;
 
 	/**
 	 * 兑换码
 	 */
+	@DbField("c.ex_code")
 	private String exCode;
 
+	@DbIgnore
+	private Integer usedNum;
+
 	/**
 	 * 发放状态
 	 */
+	@DbField("c.send_status")
 	private Boolean sendStatus;
 
 	/**
 	 * 推荐状态
 	 */
+	@DbField("c.hot_status")
 	private Boolean hotStatus;
 
 	@DbIgnore
@@ -108,5 +136,9 @@ public class CouponView {
 	@DbIgnore
 	private String goodsSkuStr;
 
+	@DbIgnore
+	private List<GoodsDonSkuView> skuViewList;
+
+	@DbField("c.created_time")
 	private Date createdTime;
 }

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuView.java

@@ -26,6 +26,9 @@ public class GoodsDonSkuView {
 	@DbField("gd.title")
 	private String goodsTitle;
 
+	@DbField("gd.type")
+	private Integer goodsDonType;
+
 	@DbField("gd.type")
 	private Integer type;
 

+ 6 - 1
netflix-service/src/main/java/com/cyksj/service/mange/impl/CmsOrderDonServiceImpl.java

@@ -19,6 +19,7 @@ import com.cyksj.service.order.UserRealOrderBenefitsService;
 import com.cyksj.service.template.TemplateCommonService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -70,7 +71,11 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
         orderDonWaybill.setRemark(reqSetLogisticsPost.getRemark());
         OrderDon orderDon = getById(orderDonWaybill.getOrderId());
         if(orderDonWaybill.getId() == null){
-            orderDonWaybillMapper.insert(orderDonWaybill);
+            try {
+                orderDonWaybillMapper.insert(orderDonWaybill);
+            } catch (DuplicateKeyException e) {
+                return orderDonWaybill;
+            }
             orderDon.setStatus(OrderDon.Status.transport);
             updateById(orderDon);
             //发放实物购买权益

+ 2 - 1
netflix-web/src/main/java/com/cyksj/config/SaTokenConfigure.java

@@ -34,7 +34,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
 						"/manage/user/get/loginInfo",
 						"/manage/user/login",
 						"/manage/admin/send/template",
-						"/manage/admin/callback"));
+						"/manage/admin/callback",
+						"/manage/coupon/get/classification"));
 		//注解权限校验
 		registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**");
 	}

+ 113 - 40
netflix-web/src/main/java/com/cyksj/web/controller/manage/coupon/CouponController.java

@@ -15,11 +15,9 @@ import com.cyksj.mapper.manage.coupon.*;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.request.CorpCouponSendReq;
 import com.cyksj.model.request.CouponActiveReq;
+import com.cyksj.model.request.CouponClassificationReq;
 import com.cyksj.model.request.CouponDistributeReq;
-import com.cyksj.model.views.CouponActiveView;
-import com.cyksj.model.views.CouponDistributePopularizeView;
-import com.cyksj.model.views.CouponRecommendView;
-import com.cyksj.model.views.CouponView;
+import com.cyksj.model.views.*;
 import com.cyksj.service.corp.msg.CorpEventActionService;
 import com.cyksj.service.mange.coupon.CouponCommonService;
 import com.ejlchina.searcher.BeanSearcher;
@@ -27,15 +25,15 @@ import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.constraints.Min;
 import java.util.List;
-import java.util.Map;
-import java.util.Optional;
 import java.util.stream.Collectors;
 
 /*
@@ -71,6 +69,10 @@ public class CouponController {
 
 	private final CorpUserAuthMapper corpUserAuthMapper;
 
+	private final CouponClassificationMapper couponClassificationMapper;
+
+	private final HttpServletRequest request;
+
 	/**
 	 * 新增优惠券
 	 */
@@ -151,14 +153,9 @@ public class CouponController {
 	public Result<SearchResult<CouponDistributePopularizeView>> getRelationList(HttpServletRequest request) {
 		SearchResult<CouponDistributePopularizeView> search = beanSearcher.search(CouponDistributePopularizeView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 		search.getDataList().forEach(data -> {
-			List<CouponUser> couponUsers = couponUserMapper.selectList(Wrappers.lambdaQuery(CouponUser.class).eq(CouponUser::getPopularizeId, data.getId()).select(CouponUser::getId, CouponUser::getStatus));
-			Optional.ofNullable(couponUsers).ifPresentOrElse(list -> {
-				Map<CouponUser.Status, List<CouponUser>> listMap = list.stream().collect(Collectors.groupingBy(CouponUser::getStatus));
-				List<CouponUser> used = listMap.get(CouponUser.Status.used);
-				data.setUsedNum(used == null ? 0 : used.size());
-			}, () -> {
-				data.setUsedNum(0);
-			});
+			Integer usedNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
+					.eq(CouponUser::getPopularizeId, data.getId()).eq(CouponUser::getStatus, CouponUser.Status.used));
+			data.setUsedNum(usedNum);
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
@@ -180,8 +177,13 @@ public class CouponController {
 		SearchResult<CouponView> search = beanSearcher.search(CouponView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 		search.getDataList().forEach(data -> {
 			data.setRelationNum(couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getCouponId, data.getId())));
-			String str = couponSkuMapper.selectGoodsSkuStr(data.getId());
-			data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
+
+			Integer usedNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
+					.eq(CouponUser::getCouponId, data.getId()).eq(CouponUser::getStatus, CouponUser.Status.used));
+			data.setUsedNum(usedNum);
+
+			List<GoodsDonSkuView> skuViewList = couponSkuMapper.selectGoodsSkuViewList(data.getId());
+			data.setSkuViewList(skuViewList);
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
@@ -193,18 +195,15 @@ public class CouponController {
 	public Result<SearchResult<CouponActiveView>> couponActiveList(HttpServletRequest request) {
 		SearchResult<CouponActiveView> search = beanSearcher.search(CouponActiveView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 		search.getDataList().forEach(data -> {
-			List<CouponUser> couponUsers = couponUserMapper.selectList(Wrappers.lambdaQuery(CouponUser.class).eq(CouponUser::getCouponActiveId, data.getId()).select(CouponUser::getId, CouponUser::getStatus));
-			String str = couponSkuMapper.selectGoodsSkuStr(data.getCouponId());
-			data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
-			Optional.ofNullable(couponUsers).ifPresentOrElse(list -> {
-				data.setReceiptNum(list.size());
-				Map<CouponUser.Status, List<CouponUser>> listMap = list.stream().collect(Collectors.groupingBy(CouponUser::getStatus));
-				List<CouponUser> used = listMap.get(CouponUser.Status.used);
-				data.setUsedNum(used == null ? 0 : used.size());
-			}, () -> {
-				data.setReceiptNum(0);
-				data.setUsedNum(0);
-			});
+			Integer usedNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
+					.eq(CouponUser::getCouponActiveId, data.getId()).eq(CouponUser::getStatus, CouponUser.Status.used));
+			Integer receiptNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
+					.eq(CouponUser::getCouponActiveId, data.getId()));
+			data.setReceiptNum(receiptNum);
+			data.setUsedNum(usedNum);
+
+			List<GoodsDonSkuView> skuViewList = couponSkuMapper.selectGoodsSkuViewList(data.getCouponId());
+			data.setSkuViewList(skuViewList);
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
@@ -252,18 +251,15 @@ public class CouponController {
 	public Result<SearchResult<CouponRecommendView>> couponRecommendList(HttpServletRequest request) {
 		SearchResult<CouponRecommendView> search = beanSearcher.search(CouponRecommendView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 		search.getDataList().forEach(data -> {
-			List<CouponUser> couponUsers = couponUserMapper.selectList(Wrappers.lambdaQuery(CouponUser.class).eq(CouponUser::getRecommendId, data.getId()).select(CouponUser::getId, CouponUser::getStatus));
-			String str = couponSkuMapper.selectGoodsSkuStr(data.getCouponId());
-			data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
-			Optional.ofNullable(couponUsers).ifPresentOrElse(list -> {
-				data.setReceiptNum(list.size());
-				Map<CouponUser.Status, List<CouponUser>> listMap = list.stream().collect(Collectors.groupingBy(CouponUser::getStatus));
-				List<CouponUser> used = listMap.get(CouponUser.Status.used);
-				data.setUsedNum(used == null ? 0 : used.size());
-			}, () -> {
-				data.setReceiptNum(0);
-				data.setUsedNum(0);
-			});
+			Integer usedNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
+					.eq(CouponUser::getRecommendId, data.getId()).eq(CouponUser::getStatus, CouponUser.Status.used));
+			Integer receiptNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
+					.eq(CouponUser::getRecommendId, data.getId()));
+			data.setReceiptNum(receiptNum);
+			data.setUsedNum(usedNum);
+
+			List<GoodsDonSkuView> skuViewList = couponSkuMapper.selectGoodsSkuViewList(data.getCouponId());
+			data.setSkuViewList(skuViewList);
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
@@ -319,6 +315,83 @@ public class CouponController {
 		return GatewayResponse.SUCCESS.newBuilder().toResult("发放优惠券成功");
 	}
 
+	/**
+	 * 新增优惠券分类
+	 */
+	@PostMapping("/post/classification")
+	public Result<String> saveClassification(@RequestBody @Validated CouponClassification classification) {
+		try {
+			couponClassificationMapper.insert(classification);
+		} catch (DuplicateKeyException e) {
+			throw BusinessRuntimeException.getInstance("优惠券名称重复");
+		}
+		return GatewayResponse.SUCCESS.newBuilder().toResult("新增优惠券成功");
+	}
+
+	/**
+	 * 删除优惠券分类
+	 */
+	@DeleteMapping("/delete/classification/{classificationId}")
+	public Result<String> deletedClassificationById(@PathVariable Long classificationId) {
+		Integer count = couponMapper.selectCount(Wrappers.lambdaQuery(Coupon.class)
+				.eq(Coupon::getClassificationId, classificationId)
+				.eq(Coupon::getDeleted, true));
+		if (count > 0) {
+			throw BusinessRuntimeException.getInstance("分类存在优惠券");
+		}
+		couponClassificationMapper.deleteById(classificationId);
+		return GatewayResponse.SUCCESS.newBuilder().toResult("删除优惠券分类成功");
+	}
+
+	/**
+	 * 优惠券转移分类
+	 */
+	@PutMapping("/update/coupon/classification")
+	public Result<String> changeCouponClassificationByClassificationId(@RequestBody @Validated CouponClassificationReq req) {
+		Long classificationId = req.getId();
+		Long newClassificationId = req.getNewClassificationId();
+		List<Coupon> coupons = couponMapper.selectList(Wrappers.lambdaQuery(Coupon.class)
+				.eq(Coupon::getClassificationId, classificationId)
+				.eq(Coupon::getDeleted, true)
+				.select(Coupon::getId));
+		if (coupons.isEmpty()) {
+			throw BusinessRuntimeException.getInstance("该分类下无优惠券");
+		}
+		CouponClassification couponClassification = couponClassificationMapper.selectById(newClassificationId);
+		if (couponClassification == null) {
+			throw BusinessRuntimeException.getInstance("要转移分类不存在");
+		}
+		couponMapper.update(null, Wrappers.lambdaUpdate(Coupon.class)
+				.set(Coupon::getClassificationId, newClassificationId)
+				.in(Coupon::getId, coupons.stream().map(Coupon::getId).collect(Collectors.toList())));
+		return GatewayResponse.SUCCESS.newBuilder().toResult("转移优惠券分类成功");
+	}
+
+	/**
+	 * 编辑优惠券分类
+	 */
+	@PutMapping("/update/classification")
+	public Result<String> updateClassification(@RequestBody @Validated CouponClassification classification) {
+		Long classificationId = classification.getId();
+		Assert.notNull(classificationId, "分类id为空");
+		CouponClassification couponClassification = couponClassificationMapper.selectById(classificationId);
+		if (couponClassification == null) {
+			throw BusinessRuntimeException.getInstance("该分类不存在");
+		}
+		couponClassificationMapper.updateById(classification);
+		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑分类成功");
+	}
+
+	/**
+	 * 优惠券分类列表
+	 */
+	@GetMapping("/get/classification")
+	public Result<SearchResult<CouponClassificationView>> classificationView() {
+		SearchResult<CouponClassificationView> search = beanSearcher.search(CouponClassificationView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
+
+
 	public String getUnionId(String corpId, String externalUserId) throws Exception {
 		WxCorpApp wxCorpApp = WeChatCorpFactory.getCorpConfigStrategy(corpId);
 		LambdaQueryWrapper<CorpUserAuth> corpUserAuthWrapper = Wrappers.lambdaQuery(CorpUserAuth.class)