修改接口状态后仍调用该接口问题修改
This commit is contained in:
parent
27ce7f7217
commit
bdcb71005b
|
|
@ -20,8 +20,10 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jeequan.jeepay.core.constants.CS;
|
||||
import com.jeequan.jeepay.core.entity.MchPayPassage;
|
||||
import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
|
||||
import com.jeequan.jeepay.core.exception.BizException;
|
||||
import com.jeequan.jeepay.service.mapper.MchPayPassageMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
|
@ -42,6 +44,8 @@ import java.util.Map;
|
|||
@Service
|
||||
public class MchPayPassageService extends ServiceImpl<MchPayPassageMapper, MchPayPassage> {
|
||||
|
||||
@Autowired private PayInterfaceDefineService payInterfaceDefineService;
|
||||
|
||||
/**
|
||||
* @Author: ZhuXiao
|
||||
* @Description: 根据支付方式查询可用的支付接口列表
|
||||
|
|
@ -108,7 +112,21 @@ public class MchPayPassageService extends ServiceImpl<MchPayPassageMapper, MchPa
|
|||
.eq(MchPayPassage::getWayCode, wayCode)
|
||||
);
|
||||
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}else { // 校验当前通道是否可用
|
||||
for (MchPayPassage mchPayPassage:list) {
|
||||
// 接口状态判断
|
||||
PayInterfaceDefine interfaceDefine = payInterfaceDefineService
|
||||
.getOne(PayInterfaceDefine.gw()
|
||||
.select(PayInterfaceDefine::getState)
|
||||
.eq(PayInterfaceDefine::getIfCode, mchPayPassage.getIfCode()));
|
||||
if (interfaceDefine.getState() == CS.YES) {
|
||||
return mchPayPassage;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue