diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java index 3e1ec635..74773ad6 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java @@ -121,6 +121,9 @@ public class ShoppingController extends ControllerBase { @Resource private StringRedisTemplate stringRedisTemplate; + @Resource + private IDictionaryItemTranslateService dictionaryItemTranslateService; + /** * 购物车-获取报价对象 */ @@ -565,6 +568,8 @@ public class ShoppingController extends ControllerBase { List adjustItems = shoppingOrderAdjustItemService.getParts(id); carts.forEach(cart -> { ShoppingCartVO cartVO = Convert.convert(ShoppingCartVO.class, cart); + cartVO.setDeliveryMethodName(dictionaryItemTranslateService.getByDictionaryItemId(cartVO.getDeliveryMethod(), MultilingualUtil.getLanguage())); + cartVO.setCurrencyName(dictionaryItemTranslateService.getByDictionaryItemId(cartVO.getCurrency(), MultilingualUtil.getLanguage())); QuotationShoppingOrderAdjustItem adjustItem = adjustItems.stream() .filter(item -> item.getCartId().equals(cart.getId()) && item.getConfigItemId().equals(0L)) .findFirst() diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/vo/ShoppingCartVO.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/vo/ShoppingCartVO.java index 9b68a5cd..1081aaf4 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/vo/ShoppingCartVO.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/vo/ShoppingCartVO.java @@ -115,6 +115,11 @@ public class ShoppingCartVO { */ private Long deliveryMethod; + /** + * 交货方式名称 + */ + private String deliveryMethodName; + /** * 交货时间 */ @@ -145,6 +150,11 @@ public class ShoppingCartVO { */ private Long currency; + /** + * 币种名称 + */ + private String currencyName; + /** * 汇率 */ diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IDictionaryItemTranslateService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IDictionaryItemTranslateService.java index a91394c5..a272060d 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IDictionaryItemTranslateService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IDictionaryItemTranslateService.java @@ -36,4 +36,6 @@ public interface IDictionaryItemTranslateService extends IService getListByDictionaryCode(String dictionaryCode); + + String getByDictionaryItemId(Long dictionaryItemId, String language); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DictionaryItemTranslateServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DictionaryItemTranslateServiceImpl.java index ccb13392..eff54099 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DictionaryItemTranslateServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DictionaryItemTranslateServiceImpl.java @@ -25,12 +25,12 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Optional; /** *

* 字典值翻译 服务实现类 *

- * * @author 曹鹏飞 * @since 2025-01-20 */ @@ -48,12 +48,12 @@ public class DictionaryItemTranslateServiceImpl extends ServiceImpl getListByDictionaryItemId(Long id) { - List datas=baseMapper.getListByDictionaryItemId(id); - List languages=languageService.getLanguages(); - languages.forEach(l->{ - DictionaryItemTranslateVO vo=datas.stream().filter(d->StrUtil.equals(l.getCode(),d.getCode())).findFirst().orElse(null); - if (Objects.isNull(vo)){ - vo=new DictionaryItemTranslateVO() + List datas = baseMapper.getListByDictionaryItemId(id); + List languages = languageService.getLanguages(); + languages.forEach(l -> { + DictionaryItemTranslateVO vo = datas.stream().filter(d -> StrUtil.equals(l.getCode(), d.getCode())).findFirst().orElse(null); + if (Objects.isNull(vo)) { + vo = new DictionaryItemTranslateVO() .setCode(l.getCode()) .setName(l.getName()); datas.add(vo); @@ -130,9 +130,9 @@ public class DictionaryItemTranslateServiceImpl extends ServiceImpl getListByDictionaryCode(String dictionaryCode) { return baseMapper.getByDictionaryCode(dictionaryCode); } + + @Override + public String getByDictionaryItemId(Long dictionaryItemId, String language) { + DictionaryItemTranslate translate = lambdaQuery() + .eq(DictionaryItemTranslate::getDictionaryItemId, dictionaryItemId) + .eq(DictionaryItemTranslate::getLanguageCode, language) + .one(); + if (Objects.isNull(translate)) { + return ""; + } + return translate.getValue(); + } } \ No newline at end of file