Commit 4e64d785 authored by xiaoyu's avatar xiaoyu
Browse files

下单可用通道代码优化

parent 2e62a745
...@@ -114,16 +114,22 @@ public class MchPayPassageService extends ServiceImpl<MchPayPassageMapper, MchPa ...@@ -114,16 +114,22 @@ public class MchPayPassageService extends ServiceImpl<MchPayPassageMapper, MchPa
if (list.isEmpty()) { if (list.isEmpty()) {
return null; return null;
}else { // 校验当前通道是否可用 }else { // 返回一个可用通道
HashMap<String, MchPayPassage> mchPayPassageMap = new HashMap<>();
for (MchPayPassage mchPayPassage:list) { for (MchPayPassage mchPayPassage:list) {
// 接口状态判断 mchPayPassageMap.put(mchPayPassage.getIfCode(), mchPayPassage);
PayInterfaceDefine interfaceDefine = payInterfaceDefineService }
.getOne(PayInterfaceDefine.gw() // 查询ifCode所有接口
.select(PayInterfaceDefine::getState) PayInterfaceDefine interfaceDefine = payInterfaceDefineService
.eq(PayInterfaceDefine::getIfCode, mchPayPassage.getIfCode())); .getOne(PayInterfaceDefine.gw()
if (interfaceDefine.getState() == CS.YES) { .select(PayInterfaceDefine::getIfCode, PayInterfaceDefine::getState)
return mchPayPassage; .eq(PayInterfaceDefine::getState, CS.YES)
} .in(PayInterfaceDefine::getIfCode, mchPayPassageMap.keySet()), false);
if (interfaceDefine != null) {
return mchPayPassageMap.get(interfaceDefine.getIfCode());
} }
} }
return null; return null;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment