|
@@ -2,11 +2,19 @@ package com.hrsk.cloud.eg.infrastructure.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.hrsk.cloud.eg.client.dto.plan.command.EgLoanApiConfigInfoCmd;
|
|
|
+import com.hrsk.cloud.eg.domain.common.HessianUtils;
|
|
|
+import com.hrsk.cloud.eg.infrastructure.repository.database.dao.EgApiLoanExtendDao;
|
|
|
import com.hrsk.cloud.eg.infrastructure.repository.database.dao.EgressApiChannelDao;
|
|
|
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiLoanExtendDo;
|
|
|
import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgressApiChannelDo;
|
|
|
import com.hrsk.cloud.eg.infrastructure.service.EgApiChannelService;
|
|
|
+import com.hrsk.cloud.eg.infrastructure.service.EgApiLoanExtendService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
/**
|
|
|
* @author zhangyy
|
|
|
* @version 1.0
|
|
@@ -16,6 +24,10 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class EgApiChannelServiceImpl extends ServiceImpl<EgressApiChannelDao, EgressApiChannelDo> implements EgApiChannelService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private EgApiLoanExtendDao egApiLoanExtendDao;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public EgressApiChannelDo findByApiId(Integer apiId) {
|
|
|
|
|
@@ -29,4 +41,34 @@ public class EgApiChannelServiceImpl extends ServiceImpl<EgressApiChannelDao, Eg
|
|
|
}
|
|
|
return egApiEndpointDo;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public EgLoanApiConfigInfoCmd findEgressConfigCmdByApiIdAndChannel(Integer apiId, String channelCode) {
|
|
|
+ EgLoanApiConfigInfoCmd cmd=new EgLoanApiConfigInfoCmd();
|
|
|
+ LambdaQueryWrapper<EgressApiChannelDo> queryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(EgressApiChannelDo::getApiId, apiId);
|
|
|
+ queryWrapper.eq(EgressApiChannelDo::getChannelCode,channelCode);
|
|
|
+ queryWrapper.orderByDesc(EgressApiChannelDo::getId);
|
|
|
+ queryWrapper.last("limit 1");
|
|
|
+ EgressApiChannelDo egressApiChannelDo = baseMapper.selectOne(queryWrapper);
|
|
|
+ if (Objects.isNull(egressApiChannelDo)) {
|
|
|
+ return new EgLoanApiConfigInfoCmd();
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<EgApiLoanExtendDo> loanExtend=new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(EgressApiChannelDo::getApiId, egressApiChannelDo.getApiId());
|
|
|
+ queryWrapper.orderByDesc(EgressApiChannelDo::getId);
|
|
|
+ queryWrapper.last("limit 1");
|
|
|
+ EgApiLoanExtendDo egApiLoanExtendDo = egApiLoanExtendDao.selectOne(loanExtend);
|
|
|
+ if (Objects.isNull(egApiLoanExtendDo)) {
|
|
|
+ return new EgLoanApiConfigInfoCmd();
|
|
|
+ }
|
|
|
+ cmd.setApiId(egressApiChannelDo.getApiId());
|
|
|
+ cmd.setChannelCode(egressApiChannelDo.getChannelCode());
|
|
|
+ cmd.setRequestConfig(HessianUtils.serialize(egressApiChannelDo.getRequestConfig()));
|
|
|
+ cmd.setIntegrationMode(egressApiChannelDo.getIntegrationMode());
|
|
|
+ cmd.setIntegrationSystem(egApiLoanExtendDo.getIntegrationSystem());
|
|
|
+ cmd.setNeedCheck(egApiLoanExtendDo.getCheckInto());
|
|
|
+ return cmd;
|
|
|
+
|
|
|
+ }
|
|
|
}
|