import com.hrsk.cloud.eg.Application; import com.hrsk.cloud.eg.domain.api.ApiGateway; import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto; import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto; import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto; import com.hrsk.cloud.eg.app.business.GenerateCheckIntoHttpApiConfigService; import com.hrsk.cloud.eg.infrastructure.service.EgApiEndpointService; import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author zhangyy * @version 1.0 * @description: Test * @date 2024/8/28 17:03 */ @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) public class StartApiTest { @Resource private GenerateCheckIntoHttpApiConfigService generateCHeckIntoHttpApiConfigService; @Resource private ProductBusinessApiInfoService productBusinessApiInfoService; @Resource private EgApiEndpointService egApiEndpointService; @Resource private ApiGateway apiGateway; @Test public void apiHuiRonTest(){ Long apiId= 441293753667392L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } @Test public void openApiRsaTest(){ Long apiId= 441312253769280L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: 庆鱼暂时不支持解析 !!! * @param: * @return: * @author zhangyy * @date: 2024/9/5 11:03 */ @Test public void qinYuApiRsaTest(){ Long apiId= 441333216126016L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: 鑫鹿 APi test * @param: * @return: * @author zhangyy * @date: 2024/9/5 14:15 */ @Test public void xinLuApiRsaTest(){ Long apiId= 441336439865408L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: 享可达 api 测试 * @param: * @return: * @author zhangyy * @date: 2024/9/5 14:34 */ @Test public void xkdApiRsaTest(){ Long apiId= 441336439865408L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: 锦碟V2 api 测试 * @param: * @return: * @author zhangyy * @date: 2024/9/5 14:34 */ @Test public void jinDieApiRsaTest(){ Long apiId= 441425735573312L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: 融享客 api 测试 * @param: * @return: * @author zhangyy * @date: 2024/9/5 14:34 */ @Test public void rxkApiTest(){ Long apiId= 441338278858304L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: 惠众 api 测试 * @param: * @return: * @author zhangyy * @date: 2024/9/5 14:34 */ @Test public void huiZhonApiTest(){ Long apiId= 441421777748032L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: 银华咨询 api 测试 * @param: * @return: * @author zhangyy * @date: 2024/9/5 14:34 */ @Test public void huiZhongApiTest(){ Long apiId= 441425580433728L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: 银华咨询 api 测试 * @param: * @return: * @author zhangyy * @date: 2024/9/5 14:34 */ @Test public void yinHuaApiTest(){ Long apiId= 441425513479232L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } /** * @description: * @author zhangyy * @date 2024/9/9 11:47 * @version 1.0 */ @Test public void huiXinApiTest(){ Long apiId= 441424531642944L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } @Test public void yuKuaiHuaApiTest(){ Long apiId= 441424861741888L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } @Test public void youRonApiTest(){ Long apiId= 441426447379776L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } @Test public void HamiguaApiTest(){ Long apiId= 441426784657728L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } @Test public void haohanwuyinApiTest(){ Long apiId= 441427018106688L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } @Test public void gexinjinfuApiTest(){ Long apiId= 441427703907136L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCompanyCity("重庆"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } @Test public void kuaiyidaiApiTest(){ Long apiId= 441428658950208L; UserInBaseInfoDto user =new UserInBaseInfoDto(); user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb"); user.setCityAllName("重庆市"); PlanDto plan =new PlanDto(); plan.setApiId(apiId); plan.setBid("aff1c7b30d8b240826030235business"); CheckIntoParamDto checkin =new CheckIntoParamDto(); checkin.setPlan(plan); checkin.setUser(user); apiGateway.checkIntoRequest(checkin); } @Test public void spel(){ Map map =new HashMap<>(); map.put("key","1"); Map map2 =new HashMap<>(); List list =new ArrayList<>(); list.add("1"); list.add("2"); map2.put("key","3"); map.put("1",list); String spel = "#root['1'][0]"; ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext context = new StandardEvaluationContext(map); // 这里很关键,如果没有配置MapAccessor,那么只能用['c']['a']这种解析方式 System.out.println(parser.parseExpression(spel).getValue(context)); } }