|
@@ -2,7 +2,6 @@ package edu.travel.commodity.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import edu.travel.adapter.service.country.CountryAdapter;
|
|
@@ -92,12 +91,12 @@ public class ShopParametersServiceImpl extends SysServiceImpl<ShopParametersMapp
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
// Step 3: 提取国家服务ID
|
|
|
- Set<Long> countryServeIds = shopParametersList.stream()
|
|
|
+ Set<String> countryServeIds = shopParametersList.stream()
|
|
|
.map(ShopParameters::getCountryId)
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
|
// Step 4: 查询国家信息
|
|
|
- Map<String, BaseCountryServeVo> countryMap = fetchCountryData(countryServeIds);
|
|
|
+ Map<String, ShopParametersVo> countryMap = fetchCountryData(countryServeIds);
|
|
|
|
|
|
// Step 5: 将国家信息放入参数列表中
|
|
|
for (ShopParameters shopParameters : shopParametersList) {
|
|
@@ -125,7 +124,7 @@ public class ShopParametersServiceImpl extends SysServiceImpl<ShopParametersMapp
|
|
|
private ShopParameters convertVoToEntity(ShopParametersVo parametersVo) {
|
|
|
ShopParameters parameters = new ShopParameters();
|
|
|
// 复制各个属性
|
|
|
- parameters.setId(Long.valueOf(parametersVo.getId()));
|
|
|
+ parameters.setId(parametersVo.getId());
|
|
|
parameters.setParametersName(parametersVo.getParametersName());
|
|
|
parameters.setIsNecessary(parametersVo.getIsNecessary());
|
|
|
parameters.setProject(parametersVo.getProject());
|
|
@@ -141,14 +140,18 @@ public class ShopParametersServiceImpl extends SysServiceImpl<ShopParametersMapp
|
|
|
/**
|
|
|
* 提取国家数据
|
|
|
*/
|
|
|
- private Map<String, BaseCountryServeVo> fetchCountryData(Set<Long> countryServeIds) {
|
|
|
- Map<String, BaseCountryServeVo> countryMap = new HashMap<>();
|
|
|
- if (!countryServeIds.isEmpty()) {
|
|
|
- for (Long countryServeId : countryServeIds) {
|
|
|
- RPCBaseResponse<BaseCountryServeVo> response = countryAdapter.getFormId(String.valueOf(countryServeId));
|
|
|
- if (response != null && response.getData() != null) {
|
|
|
- countryMap.put(String.valueOf(countryServeId), response.getData());
|
|
|
- }
|
|
|
+ private Map<String, ShopParametersVo> fetchCountryData(Set<String> countryServeIds) {
|
|
|
+ Map<String, ShopParametersVo> countryMap = new HashMap<>();
|
|
|
+ for (String countryServeId : countryServeIds){
|
|
|
+ BaseCountryServeVo country = countryAdapter.getFormId(countryServeId).getData();
|
|
|
+ if (country != null){
|
|
|
+ ShopParametersVo shopParametersVo = new ShopParametersVo();
|
|
|
+ shopParametersVo.setCountryId(countryServeId);
|
|
|
+ shopParametersVo.setMap(new HashMap<>());
|
|
|
+ shopParametersVo.getMap().put("countryNameZh", country.getCountryNameZh());
|
|
|
+ shopParametersVo.getMap().put("countryNameEn", country.getCountryNameEn());
|
|
|
+ shopParametersVo.getMap().put("countryNameLocal", country.getCountryNameLocal());
|
|
|
+ countryMap.put(countryServeId, shopParametersVo);
|
|
|
}
|
|
|
}
|
|
|
return countryMap;
|