zoujiajian 1 tahun lalu
induk
melakukan
ac07e4b5fa

+ 21 - 3
netflix-dao/src/main/java/com/cyksj/model/views/GoodsQaShowView.java

@@ -1,6 +1,5 @@
 package com.cyksj.model.views;
 
-import com.cyksj.model.entity.GoodsDon;
 import com.ejlchina.searcher.bean.DbField;
 import com.ejlchina.searcher.bean.DbIgnore;
 import com.ejlchina.searcher.bean.SearchBean;
@@ -23,12 +22,17 @@ import java.util.List;
 		" left join goods_don_category gc on gc.id = gcr.category",
 		where = "ga.status is true and ga.deleted is true and g.status is true")
 public class GoodsQaShowView {
+	@DbField("if(ga.type = 1,'售前','售后')")
+	private String label;
 	/**
 	 * 1.售前,2.售后
 	 */
 	@DbField("ga.type")
 	private Integer type;
 
+	@DbIgnore
+	private Integer value;
+
 	@DbField("g.id")
 	private Long goodsId;
 
@@ -49,8 +53,22 @@ public class GoodsQaShowView {
 	public static class QaGoodsType {
 		private Long category;
 
-		private String name;
+		//分类名
+		private String label;
+
+		//分类名
+		private String value;
+
+		private List<GoodsDonQaView> children;
+
+		@Getter
+		@Setter
+		public static class GoodsDonQaView{
+			//平台名
+			private String label;
 
-		private List<GoodsDon> children;
+			//平台id
+			private Long value;
+		}
 	}
 }

+ 9 - 8
netflix-web/src/main/java/com/cyksj/web/controller/qa/CorpKfQaController.java

@@ -5,7 +5,6 @@ import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.CustomerConsultationRecordMapper;
 import com.cyksj.model.entity.CustomerConsultationRecord;
-import com.cyksj.model.entity.GoodsDon;
 import com.cyksj.model.views.GoodsQaShowView;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.util.MapUtils;
@@ -49,6 +48,7 @@ public class CorpKfQaController {
 		byType.forEach((type, typeViews) -> {
 			GoodsQaShowView typeGroup = new GoodsQaShowView();
 			typeGroup.setType(type);
+			typeGroup.setValue(type);
 
 			// 按categoryName分组并转换为QaGoodsType
 			Map<String, List<GoodsQaShowView>> byCategory = typeViews.stream()
@@ -57,9 +57,10 @@ public class CorpKfQaController {
 			List<GoodsQaShowView.QaGoodsType> qaGoodsTypes = new ArrayList<>();
 			byCategory.forEach((categoryName, categoryViews) -> {
 				GoodsQaShowView.QaGoodsType qaType = new GoodsQaShowView.QaGoodsType();
-				qaType.setName(categoryName);
+				qaType.setLabel(categoryName);
+				qaType.setValue(categoryName);
 				// 假设需要将GoodsQaShowView转换为GoodsDon,此处需要具体逻辑
-				List<GoodsDon> goodsDons = categoryViews.stream()
+				List<GoodsQaShowView.QaGoodsType.GoodsDonQaView> goodsDons = categoryViews.stream()
 						.map(view -> convertToGoodsDon(view)) // 自定义转换方法
 						.collect(Collectors.toList());
 				qaType.setChildren(goodsDons);
@@ -83,10 +84,10 @@ public class CorpKfQaController {
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
 
-	private GoodsDon convertToGoodsDon(GoodsQaShowView view) {
-		GoodsDon don = new GoodsDon();
-		don.setTitle(view.getTitle());
-		don.setId(view.getGoodsId());
-		return don;
+	private GoodsQaShowView.QaGoodsType.GoodsDonQaView convertToGoodsDon(GoodsQaShowView view) {
+		GoodsQaShowView.QaGoodsType.GoodsDonQaView goodsDonQaView = new GoodsQaShowView.QaGoodsType.GoodsDonQaView();
+		goodsDonQaView.setLabel(view.getTitle());
+		goodsDonQaView.setValue(view.getGoodsId());
+		return goodsDonQaView;
 	}
 }