|
@@ -0,0 +1,79 @@
|
|
|
+package com.hrsk.cloud.eg.app.api;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author: bianlanzhou
|
|
|
+ * @create: 2024-08-02 10:57
|
|
|
+ * @description: 保存api
|
|
|
+ **/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api")
|
|
|
+public class ApiServiceImpl {
|
|
|
+// @Resource
|
|
|
+// private EgApiEndpointMapper egApiEndpointMapper;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// private ApiGateway apiGateway;
|
|
|
+//
|
|
|
+// @GetMapping("/save")
|
|
|
+// public void save(){
|
|
|
+// EgApiEndpointDo egApiEndpointDo = new EgApiEndpointDo();
|
|
|
+// egApiEndpointDo.setApiId(1234L);
|
|
|
+// egApiEndpointDo.setEndpointType("http");
|
|
|
+// egApiEndpointDo.setCreateUid("100000");
|
|
|
+// egApiEndpointDo.setCreateUsername("admin");
|
|
|
+// egApiEndpointDo.setModifyUid("100000");
|
|
|
+// egApiEndpointDo.setModifyUsername("admin");
|
|
|
+// egApiEndpointDo.setEndpointConfig(HessianUtils.serialize(createBean()));
|
|
|
+// egApiEndpointMapper.insert(egApiEndpointDo);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/request")
|
|
|
+// public void request(){
|
|
|
+// apiGateway.request();
|
|
|
+// }
|
|
|
+//
|
|
|
+// private HttpApiConfig createBean(){
|
|
|
+// FunctionObject md5 = new FunctionObject();
|
|
|
+// md5.setCode("md5");
|
|
|
+// HttpApiConfig hac = new HttpApiConfig()
|
|
|
+// .setUrl("https://baidu.com");
|
|
|
+// hac.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
|
|
|
+// hac.setType("http");
|
|
|
+// List<KeyValueObject> h = Lists.newArrayList();
|
|
|
+// KeyValueObject h1 = new KeyValueObject();
|
|
|
+// h1.setKey("secretKey");
|
|
|
+// h1.setType("text");
|
|
|
+// h1.setValue("Khw99%$l%-2gF7P4jXglp_-jQqQirtYnOY5D");
|
|
|
+// h.add(h1);
|
|
|
+// KeyValueObject h2 = new KeyValueObject();
|
|
|
+// h2.setKey("merchantNo");
|
|
|
+// h2.setType("spel");
|
|
|
+// h2.setValue("#param.realName");
|
|
|
+// h.add(h2);
|
|
|
+// List<ValueObject> p = Lists.newArrayList();
|
|
|
+// ValueObject p1 = new ValueObject();
|
|
|
+// p1.setType("text");
|
|
|
+// p1.setValue("123");
|
|
|
+// ValueObject p2 = new ValueObject();
|
|
|
+// p2.setType("text");
|
|
|
+// p2.setValue("456");
|
|
|
+// p2.getFunctions().add(md5);
|
|
|
+// p.add(p1);
|
|
|
+// p.add(p2);
|
|
|
+// List<KeyValueObject> s = Lists.newArrayList();
|
|
|
+// KeyValueObject s1 = new KeyValueObject();
|
|
|
+// s1.setKey("username");
|
|
|
+// s1.setType("spel");
|
|
|
+// s1.setValue("#param.username");
|
|
|
+// KeyValueObject s2 = new KeyValueObject();
|
|
|
+// s2.setKey("channel");
|
|
|
+// s2.setType("spel");
|
|
|
+// s2.setValue("#param.channel");
|
|
|
+// s.add(s2);
|
|
|
+// hac.setPath(p).setSearch(s).setHeader(h).setMethod("GET");
|
|
|
+// hac.setContent("{\"merchant\":\"xxxxxxfffff\",\"phone\":\"#{\\\"value\\\":\\\"#param.userMobile\\\",\\\"type\\\": \\\"spel\\\",\\\"functions\\\":[ {\\\"code\\\": \\\"md5\\\"}]}\"}");
|
|
|
+// return hac;
|
|
|
+// }
|
|
|
+}
|