StartApiTest.java 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. import com.hrsk.cloud.eg.Application;
  2. import com.hrsk.cloud.eg.domain.api.ApiGateway;
  3. import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
  4. import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
  5. import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
  6. import com.hrsk.cloud.eg.infrastructure.business.GenerateCheckIntoHttpApiConfigService;
  7. import com.hrsk.cloud.eg.infrastructure.service.EgApiEndpointService;
  8. import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
  9. import org.junit.Test;
  10. import org.junit.runner.RunWith;
  11. import org.springframework.boot.test.context.SpringBootTest;
  12. import org.springframework.expression.ExpressionParser;
  13. import org.springframework.expression.spel.standard.SpelExpressionParser;
  14. import org.springframework.expression.spel.support.StandardEvaluationContext;
  15. import org.springframework.test.context.junit4.SpringRunner;
  16. import javax.annotation.Resource;
  17. import java.util.ArrayList;
  18. import java.util.HashMap;
  19. import java.util.List;
  20. import java.util.Map;
  21. /**
  22. * @author zhangyy
  23. * @version 1.0
  24. * @description: Test
  25. * @date 2024/8/28 17:03
  26. */
  27. @RunWith(SpringRunner.class)
  28. @SpringBootTest(classes = Application.class)
  29. public class StartApiTest {
  30. @Resource
  31. private GenerateCheckIntoHttpApiConfigService generateCHeckIntoHttpApiConfigService;
  32. @Resource
  33. private ProductBusinessApiInfoService productBusinessApiInfoService;
  34. @Resource
  35. private EgApiEndpointService egApiEndpointService;
  36. @Resource
  37. private ApiGateway apiGateway;
  38. @Test
  39. public void apiHuiRonTest(){
  40. Long apiId= 441293753667392L;
  41. UserInBaseInfoDto user =new UserInBaseInfoDto();
  42. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  43. PlanDto plan =new PlanDto();
  44. plan.setApiId(apiId);
  45. plan.setBid("aff1c7b30d8b240826030235business");
  46. CheckIntoParamDto checkin =new CheckIntoParamDto();
  47. checkin.setPlan(plan);
  48. checkin.setUser(user);
  49. apiGateway.checkIntoRequest(checkin);
  50. }
  51. @Test
  52. public void openApiRsaTest(){
  53. Long apiId= 441312253769280L;
  54. UserInBaseInfoDto user =new UserInBaseInfoDto();
  55. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  56. user.setCompanyCity("重庆");
  57. PlanDto plan =new PlanDto();
  58. plan.setApiId(apiId);
  59. plan.setBid("aff1c7b30d8b240826030235business");
  60. CheckIntoParamDto checkin =new CheckIntoParamDto();
  61. checkin.setPlan(plan);
  62. checkin.setUser(user);
  63. apiGateway.checkIntoRequest(checkin);
  64. }
  65. /**
  66. * @description: 庆鱼暂时不支持解析 !!!
  67. * @param:
  68. * @return:
  69. * @author zhangyy
  70. * @date: 2024/9/5 11:03
  71. */
  72. @Test
  73. public void qinYuApiRsaTest(){
  74. Long apiId= 441333216126016L;
  75. UserInBaseInfoDto user =new UserInBaseInfoDto();
  76. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  77. user.setCompanyCity("重庆");
  78. PlanDto plan =new PlanDto();
  79. plan.setApiId(apiId);
  80. plan.setBid("aff1c7b30d8b240826030235business");
  81. CheckIntoParamDto checkin =new CheckIntoParamDto();
  82. checkin.setPlan(plan);
  83. checkin.setUser(user);
  84. apiGateway.checkIntoRequest(checkin);
  85. }
  86. /**
  87. * @description: 鑫鹿 APi test
  88. * @param:
  89. * @return:
  90. * @author zhangyy
  91. * @date: 2024/9/5 14:15
  92. */
  93. @Test
  94. public void xinLuApiRsaTest(){
  95. Long apiId= 441336439865408L;
  96. UserInBaseInfoDto user =new UserInBaseInfoDto();
  97. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  98. user.setCompanyCity("重庆");
  99. PlanDto plan =new PlanDto();
  100. plan.setApiId(apiId);
  101. plan.setBid("aff1c7b30d8b240826030235business");
  102. CheckIntoParamDto checkin =new CheckIntoParamDto();
  103. checkin.setPlan(plan);
  104. checkin.setUser(user);
  105. apiGateway.checkIntoRequest(checkin);
  106. }
  107. /**
  108. * @description: 享可达 api 测试
  109. * @param:
  110. * @return:
  111. * @author zhangyy
  112. * @date: 2024/9/5 14:34
  113. */
  114. @Test
  115. public void xkdApiRsaTest(){
  116. Long apiId= 441336439865408L;
  117. UserInBaseInfoDto user =new UserInBaseInfoDto();
  118. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  119. user.setCompanyCity("重庆");
  120. PlanDto plan =new PlanDto();
  121. plan.setApiId(apiId);
  122. plan.setBid("aff1c7b30d8b240826030235business");
  123. CheckIntoParamDto checkin =new CheckIntoParamDto();
  124. checkin.setPlan(plan);
  125. checkin.setUser(user);
  126. apiGateway.checkIntoRequest(checkin);
  127. }
  128. /**
  129. * @description: 锦碟V2 api 测试
  130. * @param:
  131. * @return:
  132. * @author zhangyy
  133. * @date: 2024/9/5 14:34
  134. */
  135. @Test
  136. public void jinDieApiRsaTest(){
  137. Long apiId= 441425735573312L;
  138. UserInBaseInfoDto user =new UserInBaseInfoDto();
  139. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  140. user.setCompanyCity("重庆");
  141. PlanDto plan =new PlanDto();
  142. plan.setApiId(apiId);
  143. plan.setBid("aff1c7b30d8b240826030235business");
  144. CheckIntoParamDto checkin =new CheckIntoParamDto();
  145. checkin.setPlan(plan);
  146. checkin.setUser(user);
  147. apiGateway.checkIntoRequest(checkin);
  148. }
  149. /**
  150. * @description: 融享客 api 测试
  151. * @param:
  152. * @return:
  153. * @author zhangyy
  154. * @date: 2024/9/5 14:34
  155. */
  156. @Test
  157. public void rxkApiTest(){
  158. Long apiId= 441338278858304L;
  159. UserInBaseInfoDto user =new UserInBaseInfoDto();
  160. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  161. user.setCompanyCity("重庆");
  162. PlanDto plan =new PlanDto();
  163. plan.setApiId(apiId);
  164. plan.setBid("aff1c7b30d8b240826030235business");
  165. CheckIntoParamDto checkin =new CheckIntoParamDto();
  166. checkin.setPlan(plan);
  167. checkin.setUser(user);
  168. apiGateway.checkIntoRequest(checkin);
  169. }
  170. /**
  171. * @description: 惠众 api 测试
  172. * @param:
  173. * @return:
  174. * @author zhangyy
  175. * @date: 2024/9/5 14:34
  176. */
  177. @Test
  178. public void huiZhonApiTest(){
  179. Long apiId= 441421777748032L;
  180. UserInBaseInfoDto user =new UserInBaseInfoDto();
  181. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  182. user.setCompanyCity("重庆");
  183. PlanDto plan =new PlanDto();
  184. plan.setApiId(apiId);
  185. plan.setBid("aff1c7b30d8b240826030235business");
  186. CheckIntoParamDto checkin =new CheckIntoParamDto();
  187. checkin.setPlan(plan);
  188. checkin.setUser(user);
  189. apiGateway.checkIntoRequest(checkin);
  190. }
  191. /**
  192. * @description: 银华咨询 api 测试
  193. * @param:
  194. * @return:
  195. * @author zhangyy
  196. * @date: 2024/9/5 14:34
  197. */
  198. @Test
  199. public void huiZhongApiTest(){
  200. Long apiId= 441425580433728L;
  201. UserInBaseInfoDto user =new UserInBaseInfoDto();
  202. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  203. user.setCompanyCity("重庆");
  204. PlanDto plan =new PlanDto();
  205. plan.setApiId(apiId);
  206. plan.setBid("aff1c7b30d8b240826030235business");
  207. CheckIntoParamDto checkin =new CheckIntoParamDto();
  208. checkin.setPlan(plan);
  209. checkin.setUser(user);
  210. apiGateway.checkIntoRequest(checkin);
  211. }
  212. /**
  213. * @description: 银华咨询 api 测试
  214. * @param:
  215. * @return:
  216. * @author zhangyy
  217. * @date: 2024/9/5 14:34
  218. */
  219. @Test
  220. public void yinHuaApiTest(){
  221. Long apiId= 441425513479232L;
  222. UserInBaseInfoDto user =new UserInBaseInfoDto();
  223. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  224. user.setCompanyCity("重庆");
  225. PlanDto plan =new PlanDto();
  226. plan.setApiId(apiId);
  227. plan.setBid("aff1c7b30d8b240826030235business");
  228. CheckIntoParamDto checkin =new CheckIntoParamDto();
  229. checkin.setPlan(plan);
  230. checkin.setUser(user);
  231. apiGateway.checkIntoRequest(checkin);
  232. }
  233. /**
  234. * @description:
  235. * @author zhangyy
  236. * @date 2024/9/9 11:47
  237. * @version 1.0
  238. */
  239. @Test
  240. public void huiXinApiTest(){
  241. Long apiId= 441424531642944L;
  242. UserInBaseInfoDto user =new UserInBaseInfoDto();
  243. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  244. user.setCompanyCity("重庆");
  245. PlanDto plan =new PlanDto();
  246. plan.setApiId(apiId);
  247. plan.setBid("aff1c7b30d8b240826030235business");
  248. CheckIntoParamDto checkin =new CheckIntoParamDto();
  249. checkin.setPlan(plan);
  250. checkin.setUser(user);
  251. apiGateway.checkIntoRequest(checkin);
  252. }
  253. @Test
  254. public void yuKuaiHuaApiTest(){
  255. Long apiId= 441424861741888L;
  256. UserInBaseInfoDto user =new UserInBaseInfoDto();
  257. user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
  258. user.setCompanyCity("重庆");
  259. PlanDto plan =new PlanDto();
  260. plan.setApiId(apiId);
  261. plan.setBid("aff1c7b30d8b240826030235business");
  262. CheckIntoParamDto checkin =new CheckIntoParamDto();
  263. checkin.setPlan(plan);
  264. checkin.setUser(user);
  265. apiGateway.checkIntoRequest(checkin);
  266. }
  267. @Test
  268. public void spel(){
  269. Map<String,Object> map =new HashMap<>();
  270. map.put("key","1");
  271. Map<String,Object> map2 =new HashMap<>();
  272. List<String> list =new ArrayList<>();
  273. list.add("1");
  274. list.add("2");
  275. map2.put("key","3");
  276. map.put("1",list);
  277. String spel = "#root['1'][0]";
  278. ExpressionParser parser = new SpelExpressionParser();
  279. StandardEvaluationContext context = new StandardEvaluationContext(map);
  280. // 这里很关键,如果没有配置MapAccessor,那么只能用['c']['a']这种解析方式
  281. System.out.println(parser.parseExpression(spel).getValue(context));
  282. }
  283. }