瀏覽代碼

Merge branch 'master' into pre

zoujiajian 3 年之前
父節點
當前提交
c6b79b5e2d
共有 19 個文件被更改,包括 322 次插入80 次删除
  1. 4 0
      netflix-dao/src/main/java/com/cyksj/mapper/OrderDiscountPlusPurchaseSkuRelationMapper.java
  2. 17 0
      netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonSku.java
  3. 1 1
      netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonSpec.java
  4. 2 0
      netflix-dao/src/main/java/com/cyksj/model/entity/OrderDiscountPlusPurchaseSkuRelation.java
  5. 1 3
      netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuSpec.java
  6. 3 3
      netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpecSingle.java
  7. 0 2
      netflix-dao/src/main/java/com/cyksj/model/request/CombinationSkuReq.java
  8. 3 0
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuView.java
  9. 13 0
      netflix-dao/src/main/resources/mapper/OrderDiscountPlusPurchaseSkuRelationMapper.xml
  10. 13 11
      netflix-service/src/main/java/com/cyksj/service/exchange/impl/ExchangeCodeServiceImpl.java
  11. 1 1
      netflix-service/src/main/java/com/cyksj/service/mange/CmsGoodsDonSpecService.java
  12. 1 1
      netflix-service/src/main/java/com/cyksj/service/mange/CmsOrderDonService.java
  13. 162 40
      netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonSpecServiceImpl.java
  14. 17 0
      netflix-service/src/main/java/com/cyksj/service/mange/group/CmsGroupServiceImpl.java
  15. 43 1
      netflix-service/src/main/java/com/cyksj/service/mange/impl/CmsOrderDonServiceImpl.java
  16. 2 1
      netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java
  17. 1 1
      netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java
  18. 37 14
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSkuController.java
  19. 1 1
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSpecController.java

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/mapper/OrderDiscountPlusPurchaseSkuRelationMapper.java

@@ -2,6 +2,9 @@ package com.cyksj.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.OrderDiscountPlusPurchaseSkuRelation;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /*
  *项目名: netflix
@@ -10,4 +13,5 @@ import com.cyksj.model.entity.OrderDiscountPlusPurchaseSkuRelation;
  *创建时间:2023/7/21 9:56
  */
 public interface OrderDiscountPlusPurchaseSkuRelationMapper extends BaseMapper<OrderDiscountPlusPurchaseSkuRelation> {
+	List<OrderDiscountPlusPurchaseSkuRelation> selectPlusRelationByIdAndUserId(@Param("relationId") Long relationId, @Param("userId") Long userId);
 }

+ 17 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonSku.java

@@ -7,6 +7,7 @@ import com.ejlchina.searcher.bean.DbField;
 import com.ejlchina.searcher.bean.DbIgnore;
 import com.ejlchina.searcher.bean.SearchBean;
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -129,4 +130,20 @@ public class GoodsDonSku extends BaseEntity {
     @DbIgnore
     @TableField(exist = false)
     private List<GoodsDiscountPlusPurchaseRelationFrontView> dpSkuViews;
+
+    /**
+     * 前端展示
+     */
+    @DbIgnore
+    @TableField(exist = false)
+    @JsonProperty("gname")
+    private String gName;
+
+    /**
+     * 前端展示
+     */
+    @DbIgnore
+    @TableField(exist = false)
+    @JsonProperty("sname")
+    private String sName;
 }

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonSpec.java

@@ -21,7 +21,7 @@ public class GoodsDonSpec extends BaseEntity {
     /**
      * 规格属性值最大id
      */
-    private Long maxId;
+    private Integer maxId;
 
     /**
      * 商品规格数量

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/OrderDiscountPlusPurchaseSkuRelation.java

@@ -14,6 +14,8 @@ import lombok.Setter;
 public class OrderDiscountPlusPurchaseSkuRelation extends BaseEntity{
 	private Long orderId;
 
+	private Long userId;
+
 	/**
 	 * 优惠加购规格id
 	 */

+ 1 - 3
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuSpec.java

@@ -13,8 +13,6 @@ import java.util.List;
 @Getter
 @Setter
 public class ReqGoodsSkuSpec {
-    private Long id;
-
     private String key;
 
     private List<Node> values;
@@ -22,7 +20,7 @@ public class ReqGoodsSkuSpec {
     @Getter
     @Setter
     public static class Node {
-        private Long id;
+        private Integer id;
 
         private String value;
 

+ 3 - 3
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpecSingle.java

@@ -20,10 +20,10 @@ public class ReqGoodsSpecSingle {
     private Long goodsId;
 
     @NotNull(message = "缺少规格属性id")
-    private Long id;
+    private Integer id;
 
     @NotNull(message = "缺少总规格属性id")
-    private Long keyId;
+    private Integer keyId;
 
     @NotBlank(message = "缺少规格名")
     private String key;
@@ -31,5 +31,5 @@ public class ReqGoodsSpecSingle {
     @NotBlank(message = "缺少属性名.")
     private String name;
 
-    private Long maxId;
+    private Integer maxId;
 }

+ 0 - 2
netflix-dao/src/main/java/com/cyksj/model/request/CombinationSkuReq.java

@@ -15,8 +15,6 @@ import java.util.List;
 @Getter
 @Setter
 public class CombinationSkuReq {
-	private Long id;
-
 	private String key;
 
 	private List<ReqGoodsSkuSpec.Node> values;

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

@@ -35,6 +35,9 @@ public class GoodsDonSkuView {
 	@DbField("gdk.spec_val")
 	private String specVal;
 
+	@DbField("gdk.spec_json")
+	private String specJson;
+
 	@DbField("gdk.days")
 	private Integer days;
 

+ 13 - 0
netflix-dao/src/main/resources/mapper/OrderDiscountPlusPurchaseSkuRelationMapper.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.cyksj.mapper.OrderDiscountPlusPurchaseSkuRelationMapper">
+
+    <select id="selectPlusRelationByIdAndUserId"
+            resultType="com.cyksj.model.entity.OrderDiscountPlusPurchaseSkuRelation">
+        select id, relation_ids
+        from order_discount_plus_purchase_sku_relation
+        where user_id = #{userId}
+          and relation_ids like concat('%',#{relationId},'%')
+    </select>
+</mapper>

+ 13 - 11
netflix-service/src/main/java/com/cyksj/service/exchange/impl/ExchangeCodeServiceImpl.java

@@ -391,18 +391,20 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
 			//锁定座位
 			setRelation(relation.getId(), userId);
 			relation.setUserId(userId);
-			relation.setStatus(GroupsRelation.Status.validity);
-			//如果续费增加时间,如果首次则设置当前时间为初始时间
-			Date expiryTime = Optional.ofNullable(relation.getExpiryTime()).orElse(new Date());
-			Date newDate;
-			if (sku.getDays() != null && sku.getDays() > 0) {
-				newDate = DateUtil.offsetDay(expiryTime, sku.getDays() * 1);
-			} else {
-				newDate = DateUtil.offset(expiryTime, DateField.MONTH, sku.getMonths() * 1);
+			GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
+			if (GroupsTrips.Status.validity.equals(groupsTrips.getStatus())) {
+				//如果续费增加时间,如果首次则设置当前时间为初始时间
+				Date expiryTime = Optional.ofNullable(relation.getExpiryTime()).orElse(new Date());
+				Date newDate;
+				if (sku.getDays() != null && sku.getDays() > 0) {
+					newDate = DateUtil.offsetDay(expiryTime, sku.getDays() * 1);
+				} else {
+					newDate = DateUtil.offset(expiryTime, DateField.MONTH, sku.getMonths() * 1);
+				}
+				relation.setExpiryTime(newDate);
+				relation.setStartTime(relation.getStartTime() == null ? new Date() : null);
 			}
-			relation.setExpiryTime(newDate);
-			relation.setStartTime(relation.getStartTime() == null ? new Date() : null);
-
+			relation.setStatus(GroupsRelation.Status.validity);
 			int isSuccess = groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
 					.set(GroupsRelation::getUserId, userId)
 					.set(GroupsRelation::getStatus, GroupsRelation.Status.validity)

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mange/CmsGoodsDonSpecService.java

@@ -17,7 +17,7 @@ public interface CmsGoodsDonSpecService extends IService<GoodsDonSpec> {
 	/**
 	 * 新增或编辑规格spec
 	 */
-	void insertOrUpdateSkuSpec(ReqGoodsSkuInsert insert) throws Exception;
+	void insertOrUpdateSkuSpec(ReqGoodsSkuInsert insert,Boolean isUpdate) throws Exception;
 
 	void skuAppend(ReqGoodsSkuInsert insert, GoodsDon goods) throws Exception;
 

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mange/CmsOrderDonService.java

@@ -41,7 +41,7 @@ public interface CmsOrderDonService extends IService<OrderDon> {
 	/**
 	 * 更换车票
 	 */
-	void changeRelation(ChangeRelationReq req);
+	void changeRelation(ChangeRelationReq req) throws Exception;
 
 	/**
 	 * 退款记录

+ 162 - 40
netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonSpecServiceImpl.java

@@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.snowflake.Sequence;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.mapper.GoodsDonMapper;
 import com.cyksj.mapper.GoodsDonSkuMapper;
@@ -27,6 +26,8 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
 
 /**
@@ -37,21 +38,26 @@ import java.util.stream.Collectors;
 @Service
 @RequiredArgsConstructor
 public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper, GoodsDonSpec> implements CmsGoodsDonSpecService {
-	private final static Sequence SEQUENCE = new Sequence(0);
-
 	private final GoodsDonMapper goodsDonMapper;
 
 	private final GoodsDonSkuMapper goodsDonSkuMapper;
 
 	@Override
-	public void insertOrUpdateSkuSpec(ReqGoodsSkuInsert insert) throws Exception {
+	public void insertOrUpdateSkuSpec(ReqGoodsSkuInsert insert, Boolean isUpdate) throws Exception {
 		GoodsDon goods = goodsDonMapper.selectById(insert.getGoodsId());
 		if (null == goods) {
 			throw new RuntimeException("找不到商品spu.");
 		}
 		GoodsDonSpec loveSpec = this.getOne(Wrappers.lambdaQuery(GoodsDonSpec.class).eq(GoodsDonSpec::getGoodsId, insert.getGoodsId()));
+		Map<String, List<ReqGoodsSkuSpec>> dbSpecMap = null;
+		Map<Integer, ReqGoodsSkuSpec.Node> dbNodeMap = null;
 		if (null != loveSpec) {
-			throw new RuntimeException("该商品已新增总规格, 请点击编辑并追加该商品的sku.");
+			insert.setId(loveSpec.getId());
+			String specsJson = loveSpec.getSpecsJson();
+			dbSpecMap = Jsons.parseList(specsJson, ReqGoodsSkuSpec.class).stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec::getKey));
+		}
+		if (isUpdate && loveSpec == null) {
+			throw BusinessRuntimeException.getInstance("所更新的平台id:{0}属性不存在", insert.getGoodsId());
 		}
 
 		List<ReqGoodsSkuSpec> specs = insert.getSpecs();
@@ -60,18 +66,17 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 		}
 
 		// 属性最大id
-		Long maxId = 0l;
+		Integer maxId = 0;
 		// 统计总属性数
-		Long total = 0l;
+		Integer total = 0;
 		// 判断id是否有重复
-		Map<Long, ReqGoodsSpecSingle> map = null;
+		Map<Integer, ReqGoodsSpecSingle> map = null;
 		// 规格数量
 		int specNumber = specs.size();
 
+		dbNodeMap = checkUpdateGoodsSpec(goods.getId(), dbSpecMap, dbNodeMap, specs);
+
 		for (ReqGoodsSkuSpec spec : specs) {
-			if (spec.getId() == null) {
-				spec.setId(SEQUENCE.nextId());
-			}
 			if (StringUtils.isBlank(spec.getKey())) {
 				throw new RuntimeException("存在空白规格名.");
 			}
@@ -83,7 +88,7 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 			total += values.size();
 			for (ReqGoodsSkuSpec.Node e : values) {
 				if (null == e.getId() || e.getId() < 0) {
-					e.setId(SEQUENCE.nextId());
+					e.setId(maxId + 1);
 				}
 				if (StringUtils.isBlank(e.getValue())) {
 					throw new RuntimeException("规格[" + spec.getKey() + "]中存在空白属性.");
@@ -91,18 +96,23 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 				if (e.getId() > maxId) {
 					maxId = e.getId();
 				}
-
-				if (goods.getType() == 2 && (e.getPrice() == null || e.getPrice().compareTo(BigDecimal.ZERO) < 0)) {
-					throw BusinessRuntimeException.getInstance("实物规格:{0}对应价格错误", e.getValue());
+				//新增时 实物价格要填入
+				if (goods.getType() == 2 && insert.getId()  == null && (e.getPrice() == null || e.getPrice().compareTo(BigDecimal.ZERO) < 0)) {
+					throw BusinessRuntimeException.getInstance("实物规格:{0}对应价格请输入", e.getValue());
 				}
 
 				if (null == map) {
 					map = new HashMap<>(16);
 				}
+				String benefitsList = e.getBenefitsList();
+				if (StrUtil.isNotBlank(benefitsList)) {
+					Set<GoodsDonSku> benefitsSkuIds = Jsons.parseSet(benefitsList, GoodsDonSku.class);
+					e.setBenefitsList(Jsons.toJson(benefitsSkuIds));
+				}
+				syncSpecNodeSku(goods.getId(), dbNodeMap, e);
 
 				ReqGoodsSpecSingle single = new ReqGoodsSpecSingle();
 				single.setId(e.getId());
-				single.setKeyId(spec.getId());
 				single.setKey(spec.getKey());
 				single.setName(e.getValue());
 				map.put(e.getId(), single);
@@ -114,6 +124,7 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 		}
 
 		GoodsDonSpec spec = new GoodsDonSpec();
+		spec.setId(insert.getId());
 		spec.setGoodsId(insert.getGoodsId());
 		spec.setMaxId(maxId);
 		spec.setSpecsJson(Jsons.toJson(specs));
@@ -213,6 +224,12 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 			goodsDonSku.setDupSpecIds(dupSpecIds);
 			goodsDonSku.setSpecVal(specVal);
 			goodsDonSku.setSpecJson(specJson);
+			String benefitsList = goodsDonSku.getBenefitsList();
+			if (StrUtil.isNotBlank(benefitsList)) {
+				Set<GoodsDonSku> benefitsSkuIds = Jsons.parseSet(benefitsList, GoodsDonSku.class);
+				goodsDonSku.setIsBenefits(true);
+				goodsDonSku.setBenefitsList(Jsons.toJson(benefitsSkuIds));
+			}
 			if (goods.getType() == 1) {
 				if (sku.getMonths() != null && sku.getMonths() > 0 && sku.getDays() != null && sku.getDays() > 0)
 					throw BusinessRuntimeException.getInstance("续费天数和续费月数不能同时存在");
@@ -237,23 +254,20 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 		}
 		String specsJson = loveSpec.getSpecsJson();
 		List<ReqGoodsSkuSpec> specsList = Jsons.parseList(specsJson, ReqGoodsSkuSpec.class);
-		Map<Long, List<ReqGoodsSkuSpec>> specValueMap = specsList.stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec::getId));
+		Map<String, List<ReqGoodsSkuSpec>> specValueMap = specsList.stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec::getKey));
 		if (combinations.isEmpty()) {
 			throw BusinessRuntimeException.getInstance("请选择对应的规格组合");
 		}
 		List<ReqGoodsSkuInsert.Sku> skus = new LinkedList<>();
 		ReqGoodsSkuInsert reqGoodsSkuInsert = new ReqGoodsSkuInsert();
 		reqGoodsSkuInsert.setGoodsId(goodsId);
-		List<List<Long>> specIdLists = new LinkedList<>();
+		List<List<Integer>> specIdLists = new LinkedList<>();
 		CombinationSkuReq request = combinations.get(0);
-		if (request.getId() == null) {
-			throw BusinessRuntimeException.getInstance("传入的总规格属性id不存在");
-		}
-		List<ReqGoodsSkuSpec> reqGoodsSkuSpecs = specValueMap.get(request.getId());
+		List<ReqGoodsSkuSpec> reqGoodsSkuSpecs = specValueMap.get(request.getKey());
 		if (reqGoodsSkuSpecs == null) {
-			throw BusinessRuntimeException.getInstance("传入的id:{0}总规格属性不存在", request.getId());
+			throw BusinessRuntimeException.getInstance("传入的总规格属性:{0}不存在", request.getKey());
 		}
-		Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap = reqGoodsSkuSpecs.get(0).getValues().stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec.Node::getId));
+		Map<Integer, List<ReqGoodsSkuSpec.Node>> nodeIdMap = reqGoodsSkuSpecs.get(0).getValues().stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec.Node::getId));
 		if (CollUtil.isNotEmpty(request.getValues())) {
 			unifiedHandleCombinationSku(combinations, request.getValues(), specValueMap, nodeIdMap, specIdLists, skus);
 		} else {
@@ -264,18 +278,18 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 		skuAppend(reqGoodsSkuInsert, goodsDon);
 	}
 
-	public void unifiedHandleCombinationSku(List<CombinationSkuReq> combinations, List<ReqGoodsSkuSpec.Node> values, Map<Long, List<ReqGoodsSkuSpec>> specValueMap, Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap, List<List<Long>> specIdLists, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
+	public void unifiedHandleCombinationSku(List<CombinationSkuReq> combinations, List<ReqGoodsSkuSpec.Node> values, Map<String, List<ReqGoodsSkuSpec>> specValueMap, Map<Integer, List<ReqGoodsSkuSpec.Node>> nodeIdMap, List<List<Integer>> specIdLists, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
 		for (ReqGoodsSkuSpec.Node node_value : values) {
 			ReqGoodsSkuInsert.Sku sku = new ReqGoodsSkuInsert.Sku();
 			sku.setPrice(BigDecimal.ZERO);
-			List<Long> specIds = new LinkedList<>();
+			List<Integer> specIds = new LinkedList<>();
 			unifiedHandleSecondCombinationSku(node_value, nodeIdMap, sku, specIds);
 			recurCombinationSku(combinations, combinations.size(), 1, 1, specIds, specIdLists, sku, specValueMap, skus);
 		}
 	}
 
 
-	public void unifiedHandleSecondCombinationSku(ReqGoodsSkuSpec.Node temp_node, Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap, ReqGoodsSkuInsert.Sku sku, List<Long> specIds) {
+	public void unifiedHandleSecondCombinationSku(ReqGoodsSkuSpec.Node temp_node, Map<Integer, List<ReqGoodsSkuSpec.Node>> nodeIdMap, ReqGoodsSkuInsert.Sku sku, List<Integer> specIds) {
 		List<ReqGoodsSkuSpec.Node> nodes = nodeIdMap.get(temp_node.getId());
 		if (CollUtil.isEmpty(nodes)) {
 			throw BusinessRuntimeException.getInstance("{0}规格不存在", temp_node.getValue());
@@ -290,11 +304,9 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 		}
 		sku.setPrice(sku.getPrice().add(price));
 		specIds.add(temp_node.getId());
-		if (node.getValue().contains("套餐")) {
-			if (StrUtil.isNotEmpty(node.getBenefitsList())) {
-				sku.setIsBenefits(true);
-				sku.setBenefitsList(node.getBenefitsList());
-			}
+		if (StrUtil.isNotEmpty(node.getBenefitsList())) {
+			sku.setIsBenefits(true);
+			sku.setBenefitsList(node.getBenefitsList());
 		}
 	}
 
@@ -307,7 +319,7 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 	 * @param sku          待插入库中的sku
 	 * @param specValueMap 总规格库中对应values
 	 */
-	private void recurCombinationSku(List<CombinationSkuReq> combinations, Integer total, Integer has, Integer start, List<Long> specIds, List<List<Long>> specIdLists, ReqGoodsSkuInsert.Sku sku, Map<Long, List<ReqGoodsSkuSpec>> specValueMap, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
+	private void recurCombinationSku(List<CombinationSkuReq> combinations, Integer total, Integer has, Integer start, List<Integer> specIds, List<List<Integer>> specIdLists, ReqGoodsSkuInsert.Sku sku, Map<String, List<ReqGoodsSkuSpec>> specValueMap, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
 		if (has == total) {
 			if (specIdLists.contains(specIds)) {
 				return;
@@ -317,15 +329,12 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 			return;
 		}
 		CombinationSkuReq request = combinations.get(start);
-		if (request.getId() == null) {
-			throw BusinessRuntimeException.getInstance("总规格属性id不存在");
-		}
-		List<ReqGoodsSkuSpec> reqGoodsSkuSpecs = specValueMap.get(request.getId());
+		List<ReqGoodsSkuSpec> reqGoodsSkuSpecs = specValueMap.get(request.getKey());
 		if (reqGoodsSkuSpecs == null) {
-			throw BusinessRuntimeException.getInstance("{0}总规格属性不存在", request.getKey());
+			throw BusinessRuntimeException.getInstance("总规格属性{0}不存在", request.getKey());
 		}
 		ReqGoodsSkuSpec reqGoodsSkuSpec = reqGoodsSkuSpecs.get(0);
-		Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap = reqGoodsSkuSpec.getValues().stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec.Node::getId));
+		Map<Integer, List<ReqGoodsSkuSpec.Node>> nodeIdMap = reqGoodsSkuSpec.getValues().stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec.Node::getId));
 		if (CollUtil.isNotEmpty(request.getValues())) {
 			createNewSkuAndRecurCombination(combinations, request.getValues(), nodeIdMap, has, start, specIds, specIdLists, sku, specValueMap, skus);
 			return;
@@ -336,7 +345,7 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 	/**
 	 * 新的规格 递归
 	 */
-	public void createNewSkuAndRecurCombination(List<CombinationSkuReq> combinations, List<ReqGoodsSkuSpec.Node> values, Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap, Integer has, Integer start, List<Long> specIds, List<List<Long>> specIdLists, ReqGoodsSkuInsert.Sku sku, Map<Long, List<ReqGoodsSkuSpec>> specValueMap, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
+	public void createNewSkuAndRecurCombination(List<CombinationSkuReq> combinations, List<ReqGoodsSkuSpec.Node> values, Map<Integer, List<ReqGoodsSkuSpec.Node>> nodeIdMap, Integer has, Integer start, List<Integer> specIds, List<List<Integer>> specIdLists, ReqGoodsSkuInsert.Sku sku, Map<String, List<ReqGoodsSkuSpec>> specValueMap, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
 		for (ReqGoodsSkuSpec.Node node_value : values) {
 			BigDecimal last_price = sku.getPrice();
 			unifiedHandleSecondCombinationSku(node_value, nodeIdMap, sku, specIds);
@@ -346,4 +355,117 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 			sku.setPrice(last_price);
 		}
 	}
+
+	/**
+	 * 更新删除总属性 一级分类 校验
+	 */
+	public Map<Integer, ReqGoodsSkuSpec.Node> checkUpdateGoodsSpec(Long goodsId, Map<String, List<ReqGoodsSkuSpec>> dbSpecMap, Map<Integer, ReqGoodsSkuSpec.Node> dbNodeMap, List<ReqGoodsSkuSpec> specs) {
+		if (CollUtil.isNotEmpty(dbSpecMap)) {
+			Map<String, List<ReqGoodsSkuSpec>> updateSpecMap = specs.stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec::getKey));
+			dbNodeMap = new ConcurrentHashMap<>();
+			for (String key : dbSpecMap.keySet()) {
+				List<ReqGoodsSkuSpec> reqGoodsSkuSpecs = updateSpecMap.get(key);
+				if (CollUtil.isNotEmpty(reqGoodsSkuSpecs)) {
+					ReqGoodsSkuSpec reqGoodsSkuSpec = reqGoodsSkuSpecs.get(0);
+					if (CollUtil.isEmpty(reqGoodsSkuSpec.getValues())) {
+						//删除整个一级分类key
+						String specFirstKey = reqGoodsSkuSpec.getKey();
+						GoodsDonSku sku = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class)
+								.eq(GoodsDonSku::getGoodsId, goodsId)
+								.like(GoodsDonSku::getSpecJson, specFirstKey).last("limit 1"));
+						if (sku != null) {
+							throw BusinessRuntimeException.getInstance("删除总规格分类,存在使用该总规格分类的规格");
+						}
+					} else {
+						Map<Integer, List<ReqGoodsSkuSpec.Node>> updateSecondMap = reqGoodsSkuSpec.getValues().stream().filter(node -> node.getId() != null).collect(Collectors.groupingBy(ReqGoodsSkuSpec.Node::getId));
+						ReqGoodsSkuSpec dbReqGoodsSkuSpec = dbSpecMap.get(key).get(0);
+						for (ReqGoodsSkuSpec.Node dbSecondValue : dbReqGoodsSkuSpec.getValues()) {
+							if (updateSecondMap.get(dbSecondValue.getId()) == null) {
+								GoodsDonSku sku = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class)
+										.eq(GoodsDonSku::getGoodsId, goodsId)
+										.like(GoodsDonSku::getSpecVal, dbSecondValue.getValue()).last("limit 1"));
+								if (sku != null) {
+									throw BusinessRuntimeException.getInstance("删除总规格分类,存在使用该总规格分类的规格");
+								}
+							}
+							dbNodeMap.put(dbSecondValue.getId(), dbSecondValue);
+						}
+					}
+				}
+				//去除总规格分类时
+				//校验是否已引用该属性规格
+				if (CollUtil.isEmpty(reqGoodsSkuSpecs)) {
+					ReqGoodsSkuSpec dbReqGoodsSkuSpec = dbSpecMap.get(key).get(0);
+					//删除整个一级分类key
+					String specFirstKey = dbReqGoodsSkuSpec.getKey();
+					GoodsDonSku sku = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class)
+							.eq(GoodsDonSku::getGoodsId, goodsId)
+							.like(GoodsDonSku::getSpecJson, specFirstKey).last("limit 1"));
+					if (sku != null) {
+						throw BusinessRuntimeException.getInstance("删除总规格分类,存在使用该总规格分类的规格");
+					}
+				}
+			}
+			return dbNodeMap;
+		}
+		return null;
+	}
+
+	/**
+	 * 更新二级分类标题价格等 同步库中sku
+	 */
+	public void syncSpecNodeSku(Long goodsId, Map<Integer, ReqGoodsSkuSpec.Node> dbNodeMap, ReqGoodsSkuSpec.Node e) {
+		if (CollUtil.isNotEmpty(dbNodeMap)) {
+			ReqGoodsSkuSpec.Node dbNode = dbNodeMap.get(e.getId());
+			if (dbNode == null) {
+				return;
+			}
+			AtomicBoolean isUpdateTitle = new AtomicBoolean(false);
+			AtomicBoolean isUpdatePrice = new AtomicBoolean(false);
+			AtomicBoolean isUpdateBenefits = new AtomicBoolean(false);
+			if (!StrUtil.equals(dbNode.getValue(), e.getValue())) {
+				isUpdateTitle.set(true);
+			}
+			if (e.getPrice() == null) {
+				e.setPrice(BigDecimal.ZERO);
+			}
+			if (dbNode.getPrice() != null && e.getPrice().compareTo(dbNode.getPrice()) != 0) {
+				isUpdatePrice.set(true);
+			}
+			if (!StrUtil.equals(dbNode.getBenefitsList(), e.getBenefitsList())) {
+				isUpdateBenefits.set(true);
+			}
+			if (isUpdateTitle.get() || isUpdatePrice.get() || isUpdateBenefits.get()) {
+				List<GoodsDonSku> goodsDonSkus = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
+						.eq(GoodsDonSku::getGoodsId, goodsId));
+
+				goodsDonSkus.forEach(sku -> {
+					try {
+						List<Integer> specIdsList = Jsons.parseList(sku.getSpecIds(), Integer.class);
+						if (specIdsList.contains(dbNode.getId())) {
+							if (isUpdateTitle.get()) {
+								sku.setSpecJson(sku.getSpecJson().replaceAll(dbNode.getValue(), e.getValue()));
+								sku.setSpecVal(sku.getSpecVal().replaceAll(dbNode.getValue(), e.getValue()));
+							}
+							if (isUpdatePrice.get()) {
+								sku.setPrice(sku.getPrice().subtract(dbNode.getPrice()).add(e.getPrice()));
+							}
+							if (isUpdateBenefits.get()) {
+								if (StrUtil.isEmpty(e.getBenefitsList())) {
+									sku.setBenefitsList(StrUtil.EMPTY);
+								} else {
+									try {
+										sku.setBenefitsList(e.getBenefitsList());
+									} catch (Exception exception) {
+									}
+								}
+							}
+							goodsDonSkuMapper.updateById(sku);
+						}
+					} catch (Exception exception) {
+					}
+				});
+			}
+		}
+	}
 }

+ 17 - 0
netflix-service/src/main/java/com/cyksj/service/mange/group/CmsGroupServiceImpl.java

@@ -73,6 +73,8 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
 
     private final AccountCommonService accountCommonService;
 
+    private final OrderDiscountPlusPurchaseSkuRelationMapper discountPlusPurchaseSkuRelationMapper;
+
     private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
 
 
@@ -180,6 +182,21 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
             GroupsRelation relation = groupsRelations.get(i);
             if (relation.getExpiryTime() == null) {
                 List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, relation.getUserId()).eq(OrderDon::getRelationId, relation.getId()).eq(OrderDon::getStatus, OrderDon.Status.hasPayment));
+                //加购车票
+                if (orderDonList.isEmpty()) {
+                    GoodsDonSku donSku = skuMapper.selectById(groupsTrips.getSkuId());
+                    Date expiryTime = Optional.ofNullable(relation.getExpiryTime()).orElse(new Date());
+                    Date newDate;
+                    if (donSku.getDays() != null && donSku.getDays() > 0) {
+                        newDate = DateUtil.offsetDay(expiryTime, donSku.getDays() * 1);
+                    } else {
+                        newDate = DateUtil.offset(expiryTime, DateField.MONTH, donSku.getMonths() * 1);
+                    }
+                    relation.setExpiryTime(newDate);
+                    relation.setStartTime(relation.getStartTime() == null ? new Date() : null);
+                    relationMapper.updateById(relation);
+                    return;
+                }
                 orderDonList.forEach((orderDon) -> {
                     //如果续费增加时间,如果首次则设置当前时间为初始时间
                     Date expiryTime = Optional.ofNullable(relation.getExpiryTime()).orElse(new Date());

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

@@ -34,6 +34,7 @@ import com.cyksj.mapper.stock.GoodsSkuStockRelateMapper;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.excel.ExcelOrderDonInfo;
 import com.cyksj.model.manage.request.ReqSetLogisticsPost;
+import com.cyksj.model.manage.views.GroupsRelationView;
 import com.cyksj.model.request.ChangeRelationReq;
 import com.cyksj.model.request.ClickOutReq;
 import com.cyksj.model.request.OrderRefundReq;
@@ -50,6 +51,8 @@ import com.cyksj.service.relation.GroupRelationClearService;
 import com.cyksj.service.stripe.StripeService;
 import com.cyksj.service.user.UserBenefitsService;
 import com.cyksj.service.wechat.WeChatService;
+import com.ejlchina.searcher.BeanSearcher;
+import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.dao.DuplicateKeyException;
@@ -136,6 +139,8 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
 
     private final EquipmentUserDistributeTransportBenefitsMapper transportBenefitsMapper;
 
+    private final BeanSearcher beanSearcher;
+
     private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
 
     @Override
@@ -355,7 +360,7 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
 
     @Override
     @Transactional(rollbackFor = Throwable.class)
-    public void changeRelation(ChangeRelationReq req) {
+    public void changeRelation(ChangeRelationReq req) throws Exception {
         Long relationId = req.getRelationId();
         Long groupId = req.getGroupsId();
         UserTicketClearedRecord.Source source = req.getSource();
@@ -371,6 +376,37 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
                 .eq(OrderDon::getRelationId, relationId)
                 .notIn(OrderDon::getStatus, Constant.noOrderStatus)
                 .last("limit 1"));
+        OrderDiscountPlusPurchaseSkuRelation plusPurchaseSkuRelation = null;
+        List<Long> plus_relationList = null;
+        if (orderDon == null) {
+            List<OrderDiscountPlusPurchaseSkuRelation> plusPurchaseSkuRelations = orderDiscountPlusPurchaseSkuRelationMapper.selectPlusRelationByIdAndUserId(relation.getId(), relation.getUserId());
+            for (OrderDiscountPlusPurchaseSkuRelation data : plusPurchaseSkuRelations) {
+                String relationIds = data.getRelationIds();
+                if (StrUtil.isEmpty(relationIds)) {
+                    return;
+                }
+                List<Long> relationList = Jsons.parseList(relationIds, Long.class);
+                if (relationList.contains(relationId)) {
+                    plusPurchaseSkuRelation = data;
+                    break;
+                }
+            }
+            if (plusPurchaseSkuRelation != null) {
+                String relationIds = plusPurchaseSkuRelation.getRelationIds();
+                if (StrUtil.isNotEmpty(relationIds)) {
+                    plus_relationList = Jsons.parseList(relationIds, Long.class);
+                    if (plus_relationList.contains(relationId)) {
+                        orderDon = new OrderDon();
+                        GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getId, relationId).build());
+                        Assert.notNull(groupsRelationView, "车票已不存在");
+                        orderDon.setUserId(groupsRelationView.getUserId());
+                        orderDon.setSkuId(groupsRelationView.getSkuId());
+                        orderDon.setGoodsId(groupsRelationView.getGoodsId());
+                        orderDon.setStatus(OrderDon.Status.complete);
+                    }
+                }
+            }
+        }
         Assert.notNull(orderDon, "订单不存在");
         if (orderDon.getStatus() == OrderDon.Status.refund) {
             throw BusinessRuntimeException.getInstance("订单已退款");
@@ -441,6 +477,12 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
             });
             return;
         }
+        if (plusPurchaseSkuRelation != null && plus_relationList != null) {
+            plus_relationList.remove(relationId);
+            plus_relationList.add(newRelation.getId());
+            plusPurchaseSkuRelation.setRelationIds(plus_relationList.toString());
+            orderDiscountPlusPurchaseSkuRelationMapper.updateById(plusPurchaseSkuRelation);
+        }
         List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, userId).eq(OrderDon::getRelationId, relationId).eq(OrderDon::getStatus, OrderDon.Status.complete));
         orderDonList.forEach(completeOrder->{
             completeOrder.setRelationId(newRelation.getId());

+ 2 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -358,6 +358,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			OrderDiscountPlusPurchaseSkuRelation orderDiscountPlusPurchaseSkuRelation = new OrderDiscountPlusPurchaseSkuRelation();
 			orderDiscountPlusPurchaseSkuRelation.setOrderId(orderDon.getId());
 			orderDiscountPlusPurchaseSkuRelation.setPlusSkuIds(dpSkuIds.toString());
+			orderDiscountPlusPurchaseSkuRelation.setUserId(orderDon.getUserId());
 			orderDiscountPlusPurchaseSkuRelationMapper.insert(orderDiscountPlusPurchaseSkuRelation);
 		}
 
@@ -2015,7 +2016,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			Integer success = userMapper.deductBalance(user.getId(), subBalance, userBalance);
 			if (success != 1) throw BusinessRuntimeException.getInstance("您的余额不足!");
 			orderDon.setBalance(subBalance);
-			userBenefitsService.recordBalanceBySource(user.getId(), BigDecimal.valueOf(-balance.longValue()), UserBalanceSourceRecord.Source.payment);
+			userBenefitsService.recordBalanceBySource(user.getId(), BigDecimal.valueOf(-subBalance.longValue()), UserBalanceSourceRecord.Source.payment);
 		}
 	}
 

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java

@@ -563,7 +563,7 @@ public class CmsOrderController {
 	 * 更换用户车票
 	 */
 	@PutMapping("/put/sameSpec/empty/relation")
-	public Result<String> changeRelation(@RequestBody @Validated ChangeRelationReq req) {
+	public Result<String> changeRelation(@RequestBody @Validated ChangeRelationReq req) throws Exception {
 		cmsOrderDonService.changeRelation(req);
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}

+ 37 - 14
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSkuController.java

@@ -1,22 +1,23 @@
 package com.cyksj.web.controller.manage.goods;
 
-import com.baomidou.mybatisplus.core.toolkit.Assert;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.annotation.Log;
 import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.common.util.Jsons;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.BusinessType;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.model.entity.GoodsDon;
 import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.entity.GoodsDonSpec;
 import com.cyksj.model.manage.request.ReqGoodsSkuInsert;
 import com.cyksj.model.request.CombinationSkuReq;
-import com.cyksj.model.views.GoodsDonSkuView;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.mange.CmsGoodsDonService;
 import com.cyksj.service.mange.CmsGoodsDonSkuService;
 import com.cyksj.service.mange.CmsGoodsDonSpecService;
 import com.ejlchina.searcher.BeanSearcher;
+import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -58,7 +59,7 @@ public class CmsGoodsDonSkuController {
     @PostMapping(value = "/post/spec-sku")
     @Log(module = "平台管理/新增商品sku&spec", businessType = BusinessType.POST, isSaveRequestData = true)
     public Result<String> skuInsert(@Validated @RequestBody ReqGoodsSkuInsert insert) throws Exception{
-        goodsDonSpecService.insertOrUpdateSkuSpec(insert);
+        goodsDonSpecService.insertOrUpdateSkuSpec(insert, false);
 
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
@@ -68,13 +69,7 @@ public class CmsGoodsDonSkuController {
      */
     @PutMapping("/update/spec")
     public Result<String> updateGoodsSpec(@Validated @RequestBody ReqGoodsSkuInsert insert) throws Exception {
-        Long id = insert.getId();
-        Assert.notNull(id, "规格属性id不存在");
-        GoodsDonSpec spec = goodsDonSpecService.getById(id);
-        if (spec == null || !spec.getGoodsId().equals(insert.getGoodsId())) {
-            throw BusinessRuntimeException.getInstance("规格不存在");
-        }
-        goodsDonSpecService.insertOrUpdateSkuSpec(insert);
+        goodsDonSpecService.insertOrUpdateSkuSpec(insert, true);
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
 
@@ -104,7 +99,7 @@ public class CmsGoodsDonSkuController {
     @Transactional(rollbackFor = Throwable.class)
     @PutMapping(value = "/update")
     @Log(module = "平台管理/编辑规格", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> skuUpdate(@RequestBody GoodsDonSku sku){
+    public Result<String> skuUpdate(@RequestBody GoodsDonSku sku) throws Exception {
         Long goodsId = sku.getGoodsId();
         GoodsDon goods = goodsDonService.getById(goodsId);
         if (goods.getType() == 1) {
@@ -121,6 +116,12 @@ public class CmsGoodsDonSkuController {
         }
         //优惠加购
         goodsDonSkuService.handleDiscountPurchaseGoods(sku, sku.getDpSku());
+
+        String benefitsList = sku.getBenefitsList();
+        if (StrUtil.isNotBlank(benefitsList)) {
+            Set<GoodsDonSku> benefitsSkuIds = Jsons.parseSet(benefitsList, GoodsDonSku.class);
+            sku.setBenefitsList(Jsons.toJson(benefitsSkuIds));
+        }
         goodsDonSkuService.saveOrUpdate(sku);
         //给平台更新额外属性
         goodsDonService.updateGoodsSkuPrice(sku.getGoodsId(), null);
@@ -161,8 +162,30 @@ public class CmsGoodsDonSkuController {
      * 获取平台规格列表
      */
     @GetMapping("/get/list")
-    public Result<List<GoodsDonSkuView>> getGoodsSkuList() {
-        List<GoodsDonSkuView> skuViewList = beanSearcher.searchAll(GoodsDonSkuView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
+    public Result<SearchResult<GoodsDonSku>> getGoodsSkuList() {
+        SearchResult<GoodsDonSku> skuViewList = beanSearcher.search(GoodsDonSku.class, MapUtils.flatBuilder(request.getParameterMap()).build());
         return GatewayResponse.SUCCESS.newBuilder().toResult(skuViewList);
     }
+
+    /**
+     * 批量上架
+     */
+    @PutMapping("/batch/update/status/{goodsId}")
+    public Result<String> batchUpdateStatus(@PathVariable Long goodsId, @RequestBody List<Long> skuIds) {
+        GoodsDon goodsDon = goodsDonService.getById(goodsId);
+        if (goodsDon == null || !goodsDon.getDeleted()) {
+            throw BusinessRuntimeException.getInstance("商品不存在");
+        }
+        boolean update = goodsDonSkuService.update(null, Wrappers.lambdaUpdate(GoodsDonSku.class)
+                .set(GoodsDonSku::getStatus, true)
+                .eq(GoodsDonSku::getGoodsId, goodsId)
+                .in(GoodsDonSku::getId, skuIds)
+                .eq(GoodsDonSku::getStatus, false));
+        if (update) {
+            goodsDonService.updateGoodsSkuPrice(goodsId, null);
+            Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+            redisService.del(keys.toArray(String[]::new));
+        }
+        return GatewayResponse.SUCCESS.newBuilder().toResult();
+    }
 }

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSpecController.java

@@ -72,7 +72,7 @@ public class CmsGoodsDonSpecController {
         String specsJson = Jsons.toJson(specs);
 
         JavaType type = Jsons.javaType().constructMapType(HashMap.class, Integer.class, ReqGoodsSpecSingle.class);
-        Map<Long, ReqGoodsSpecSingle> map = Jsons.parseObject(v2spec.getSpecMapping(), type);
+        Map<Integer, ReqGoodsSpecSingle> map = Jsons.parseObject(v2spec.getSpecMapping(), type);
         map.put(specSingle.getId(), specSingle);
         String specMapping = Jsons.toJson(map);