|
@@ -1,15 +1,24 @@
|
|
import com.alibaba.druid.pool.DruidDataSource;
|
|
import com.alibaba.druid.pool.DruidDataSource;
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
import com.hrsk.cloud.eg.Application;
|
|
import com.hrsk.cloud.eg.Application;
|
|
import com.hrsk.cloud.eg.app.business.ApiRouteService;
|
|
import com.hrsk.cloud.eg.app.business.ApiRouteService;
|
|
|
|
+import com.hrsk.cloud.eg.app.constant.EgApiTypeEnum;
|
|
|
|
+import com.hrsk.cloud.eg.constant.GlobalDataStatusEnum;
|
|
import com.hrsk.cloud.eg.domain.api.ApiGateway;
|
|
import com.hrsk.cloud.eg.domain.api.ApiGateway;
|
|
import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
|
|
import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
|
|
import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
|
|
import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
|
|
import com.hrsk.cloud.eg.dto.data.user.UserBaseInfoDto;
|
|
import com.hrsk.cloud.eg.dto.data.user.UserBaseInfoDto;
|
|
import com.hrsk.cloud.eg.app.business.GenerateCheckIntoHttpApiConfigService;
|
|
import com.hrsk.cloud.eg.app.business.GenerateCheckIntoHttpApiConfigService;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.config.client.HessianUtils;
|
|
import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiDo;
|
|
import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiDo;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiEndpointDo;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiLoanExtendDo;
|
|
import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
|
|
import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
|
|
import com.hrsk.cloud.eg.infrastructure.service.EgApiEndpointService;
|
|
import com.hrsk.cloud.eg.infrastructure.service.EgApiEndpointService;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.service.EgApiLoanExtendService;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.service.EgApiService;
|
|
import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
|
|
import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runner.RunWith;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
@@ -50,7 +59,10 @@ public class StartApiTest {
|
|
private ApiRouteService apiRouteService;
|
|
private ApiRouteService apiRouteService;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
- private DruidDataSource druidDataSource;
|
|
|
|
|
|
+ private EgApiLoanExtendService egApiLoanExtendService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private EgApiService egApiService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -422,10 +434,42 @@ public class StartApiTest {
|
|
@Test
|
|
@Test
|
|
public void initApi(){
|
|
public void initApi(){
|
|
List<ProductBusinessApiInfoDo> productBusinessApiInfoDos = productBusinessApiInfoService.apiList();
|
|
List<ProductBusinessApiInfoDo> productBusinessApiInfoDos = productBusinessApiInfoService.apiList();
|
|
- for (ProductBusinessApiInfoDo productBusinessApiInfoDo : productBusinessApiInfoDos) {
|
|
|
|
|
|
+
|
|
|
|
+ List<EgApiDo> egApiDoList=new ArrayList<>();
|
|
|
|
+ for (ProductBusinessApiInfoDo api : productBusinessApiInfoDos) {
|
|
EgApiDo egApiDo = new EgApiDo();
|
|
EgApiDo egApiDo = new EgApiDo();
|
|
- egApiDo.setApiType();
|
|
|
|
|
|
+ egApiDo.setApiType(EgApiTypeEnum.LOAN_API.getCode());
|
|
|
|
+ egApiDo.setApiCode(api.getJoinMethod());
|
|
|
|
+ egApiDo.setApiName(api.getName());
|
|
|
|
+ egApiDo.setStatus(GlobalDataStatusEnum.YES.getCode());
|
|
|
|
+ egApiDo.setBusiOwnerUsername(api.getContractSignaturer());
|
|
|
|
+ egApiDo.setTechOwnerUsername(api.getCreater());
|
|
|
|
+ egApiDo.setId(Long.valueOf(api.getId()));
|
|
|
|
+ egApiDoList.add(egApiDo);
|
|
|
|
+
|
|
|
|
+ EgApiEndpointDo egApiEndpointDo = new EgApiEndpointDo();
|
|
|
|
+ egApiEndpointDo.setApiCode(api.getJoinMethod());
|
|
|
|
+ egApiEndpointDo.setApiName(api.getName());
|
|
|
|
+ egApiEndpointDo.setStatus(GlobalDataStatusEnum.YES.getCode());
|
|
|
|
+ if (StringUtils.isNotBlank(api.getThreeSystemConfig())) {
|
|
|
|
+ egApiEndpointDo.setApiConfig(HessianUtils.serialize(api.getThreeSystemConfig()));
|
|
|
|
+ }else{
|
|
|
|
+ egApiEndpointDo.setApiConfig(HessianUtils.serialize(JSONObject.toJSONString(api)));
|
|
|
|
+ }
|
|
|
|
+ egApiEndpointDo.setApiId(Long.valueOf(api.getId()));
|
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
|
+
|
|
|
|
+ EgApiLoanExtendDo egApiLoanExtendDo = new EgApiLoanExtendDo();
|
|
|
|
+ egApiLoanExtendDo.setEndpointId(egApiEndpointDo.getId());
|
|
|
|
+ egApiLoanExtendDo.setNeedCheck(api.getNeedCheck());
|
|
|
|
+ egApiLoanExtendDo.setStatus(GlobalDataStatusEnum.YES.getCode());
|
|
|
|
+ egApiLoanExtendDo.setProtocol(api.getProtocol());
|
|
|
|
+ egApiLoanExtendDo.setShareType(api.getShareType());
|
|
|
|
+ egApiLoanExtendDo.setSharePurpose(api.getSharePurpose());
|
|
|
|
+ egApiLoanExtendDo.setSharePurpose(api.getSharePurpose());
|
|
|
|
+ egApiLoanExtendService.save(egApiLoanExtendDo);
|
|
}
|
|
}
|
|
|
|
+ egApiService.saveBatch(egApiDoList);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|