|
@@ -15,10 +15,9 @@ import org.springblade.ldt.platform.service.IPlatformSettingService;
|
|
|
import org.springblade.yeePay.common.YeepayProduct;
|
|
import org.springblade.yeePay.common.YeepayProduct;
|
|
|
import org.springblade.yeePay.entity.saas.InvitationDto;
|
|
import org.springblade.yeePay.entity.saas.InvitationDto;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
-import java.util.Optional;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author: lianghanqiang
|
|
* @author: lianghanqiang
|
|
@@ -70,6 +69,30 @@ public class PlatformCache {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据类型获取平台默认易宝的产品信息
|
|
|
|
|
+ */
|
|
|
|
|
+ public static List<InvitationDto.ProductInfo> productInfo(YeepayProduct[] yeepayProduct) {
|
|
|
|
|
+ R res = CacheUtil.get(CacheNames.PLATFORM, PLATFORM_PREFIX, PlatformConst.YEEPAY_PRODUCT_INFO, R.class, false);
|
|
|
|
|
+ PlatformSetting platformSetting ;
|
|
|
|
|
+ if(Objects.isNull(res)){
|
|
|
|
|
+ platformSetting = getSetting(PlatformConst.YEEPAY_PRODUCT_INFO);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ platformSetting = (PlatformSetting) res.getData();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<InvitationDto.ProductInfo> productInfos = JSON.parseArray(platformSetting.getSettingValue(), InvitationDto.ProductInfo.class);
|
|
|
|
|
+ List<InvitationDto.ProductInfo> result = new LinkedList<>();
|
|
|
|
|
+ //所有产品码
|
|
|
|
|
+ Set<String> yeepayProductSet = Arrays.stream(yeepayProduct).map(YeepayProduct::name).collect(Collectors.toSet());
|
|
|
|
|
+ //遍历产品信息
|
|
|
|
|
+ for (InvitationDto.ProductInfo productInfo : productInfos) {
|
|
|
|
|
+ if(yeepayProductSet.contains(productInfo.getProductCode().name())){
|
|
|
|
|
+ result.add(productInfo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private static PlatformSetting getSetting(String key) {
|
|
private static PlatformSetting getSetting(String key) {
|
|
|
return platformSettingService.getOne(new QueryWrapper<PlatformSetting>().lambda()
|
|
return platformSettingService.getOne(new QueryWrapper<PlatformSetting>().lambda()
|
|
|
.eq(PlatformSetting::getSettingKey, key));
|
|
.eq(PlatformSetting::getSettingKey, key));
|