zoujiajian 1 жил өмнө
parent
commit
4c38e3708a

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

@@ -42,7 +42,8 @@ public class BackInfoTranslations extends BaseEntity{
 		spec("一级规格"),
 		coupon("优惠券"),
 		coupon_classification("优惠券分类"),
-		goods_category("平台分类")
+		goods_category("平台分类"),
+		home_config("首页配置")
 		;
 		String remark;
 

+ 3 - 4
netflix-service/src/main/java/com/cyksj/service/translations/BackInfoTranslationsFrontService.java

@@ -2,10 +2,7 @@ package com.cyksj.service.translations;
 
 import com.cyksj.model.entity.GoodsDonSku;
 import com.cyksj.model.manage.views.GoodsDonViewer;
-import com.cyksj.model.views.CouponView;
-import com.cyksj.model.views.GoodsDonCategoryFrontView;
-import com.cyksj.model.views.GoodsFrontListCategoryView;
-import com.cyksj.model.views.GoodsFrontListView;
+import com.cyksj.model.views.*;
 
 import java.util.List;
 
@@ -44,4 +41,6 @@ public interface BackInfoTranslationsFrontService {
 	String getCategoryNameLanguage(Long category, String lang);
 
 	String getLanguagePayDesc(Long goodsId, String lang);
+
+	void getHomeConfigRealGoodsLanguage(List<HomeManagementFrontView> homeManagementFrontViews, String lang);
 }

+ 10 - 0
netflix-service/src/main/java/com/cyksj/service/translations/impl/BackInfoTranslationsFrontServiceImpl.java

@@ -248,4 +248,14 @@ public class BackInfoTranslationsFrontServiceImpl implements BackInfoTranslation
 		}
 		return null;
 	}
+
+	@Override
+	public void getHomeConfigRealGoodsLanguage(List<HomeManagementFrontView> homeManagementFrontViews, String lang) {
+		if (homeManagementFrontViews == null) {
+			return;
+		}
+		if (CollUtil.isNotEmpty(homeManagementFrontViews)) {
+			homeManagementFrontViews.forEach(rg -> setFieldLanguage(rg.getClass(), rg, BackInfoTranslations.Type.home_config.ordinal(), rg.getHomeManageConfigId(), lang));
+		}
+	}
 }

+ 10 - 0
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -624,6 +624,12 @@ public class GoodsDonController {
 //			key += ":hz-ip";
 //			isRemoveRg.set(true);
 //		}
+		String lang = request.getHeader("lang");
+		AtomicBoolean language = new AtomicBoolean(false);
+		if (lang != null && !StrUtil.equals(UserPageLanguage.Language.zh_CN.name(), lang)) {
+			key += ":" + lang;
+			language.set(true);
+		}
 		Long fUid = StpUserUtil.getUserIdAfterLogin();
 		Object o = redisService.get(key);
 		if (o == null) {
@@ -647,6 +653,10 @@ public class GoodsDonController {
 							}
 						}
 						List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
+						//实物推荐多语言
+						if (language.get() && type == HomeManagementConfig.Type.rg) {
+							backInfoTranslationsFrontService.getHomeConfigRealGoodsLanguage(homeManagementFrontViews, lang);
+						}
 						map.putIfAbsent(type.name(), homeManagementFrontViews);
 					});
 			redisService.setNx(key, map, 50 * 60l);

+ 11 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/home/HomeManageConfigController.java

@@ -1,12 +1,11 @@
 package com.cyksj.web.controller.manage.home;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Assert;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.GoodsDonCategory;
-import com.cyksj.model.entity.HomeManagementConfig;
-import com.cyksj.model.entity.HomeManagementConfigUserClickRecord;
+import com.cyksj.model.entity.*;
 import com.cyksj.model.request.HomeConfigTimingReq;
 import com.cyksj.model.request.HomeManageConfigReq;
 import com.cyksj.model.views.HomeManagementAvailableGoodsView;
@@ -14,6 +13,7 @@ import com.cyksj.model.views.HomeManagementConfigView;
 import com.cyksj.service.home.HomeManagementConfigService;
 import com.cyksj.service.mange.GoodsDonCategoryService;
 import com.cyksj.service.mange.RefreshCacheService;
+import com.cyksj.service.translations.BackInfoTranslationsService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.util.MapUtils;
@@ -43,6 +43,8 @@ public class HomeManageConfigController {
 
 	private final GoodsDonCategoryService goodsDonCategoryService;
 
+	private final BackInfoTranslationsService backInfoTranslationsService;
+
 	/**
 	 * 新增首页配置
 	 */
@@ -57,7 +59,12 @@ public class HomeManageConfigController {
 	 */
 	@PutMapping("/put")
 	public Result<String> updateConfig(@RequestBody HomeManageConfigReq config) {
-		homeManagementConfigService.saveOrUpdateConfig(config);
+		String lang = request.getHeader("lang");
+		if (lang != null && !StrUtil.equals(UserPageLanguage.Language.zh_CN.name(), lang)) {
+			backInfoTranslationsService.saveOrUpdateBackInfoTranslations(BackInfoTranslations.Type.home_config, config.getId(), config, lang);
+		} else {
+			homeManagementConfigService.saveOrUpdateConfig(config);
+		}
 		refreshCacheService.refreshYhHomePageCache();
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}