parent
1b3af2d2b3
commit
3bbf19ffa6
|
|
@ -1,6 +1,6 @@
|
|||
package jj.tech.paolu.biz.webadmin.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -9,23 +9,20 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jj.tech.paolu.biz.webadmin.vo.LoginVo;
|
||||
import jj.tech.paolu.biz.webadmin.vo.YmCodeVo;
|
||||
import jj.tech.paolu.utils.R;
|
||||
import jj.tech.paolu.utils.YMHttp;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/op/ym",name = "云码图片识别接口")
|
||||
public class YMcodeController {
|
||||
|
||||
@Operation(summary = "管理员登录", description = "admin 000000")
|
||||
@PostMapping("/get")
|
||||
public Object login(@Validated @RequestBody LoginVo parame,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
@Operation(summary = "需要识别图片的base64字符串", description = "image_base64")
|
||||
@PostMapping("/code")
|
||||
public Object login(@Validated @RequestBody YmCodeVo prame) {
|
||||
|
||||
Map<String, Object> map = YMHttp.customApi(prame.image_base64);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("code", "");
|
||||
return R.SUCCESS(map);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
public class YmCodeVo {
|
||||
|
||||
public String image_base64;
|
||||
|
||||
public String getImage_base64() {
|
||||
return image_base64;
|
||||
}
|
||||
|
||||
public void setImage_base64(String image_base64) {
|
||||
this.image_base64 = image_base64;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -56,12 +56,12 @@ public class SecurityFilter extends OncePerRequestFilter {
|
|||
}
|
||||
|
||||
// 更新token的有效时间
|
||||
Boolean verify = WebAdminUtil.verify(request, response);
|
||||
if(verify == false) {
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
this.authError(request, response);
|
||||
return;
|
||||
}
|
||||
// Boolean verify = WebAdminUtil.verify(request, response);
|
||||
// if(verify == false) {
|
||||
// response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
// this.authError(request, response);
|
||||
// return;
|
||||
// }
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,46 +56,47 @@ public class SwaggerConfig {
|
|||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@Profile("prod")
|
||||
GroupedOpenApi prodApi(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("user-test-api")
|
||||
.pathsToMatch("/null")
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*")
|
||||
.build();
|
||||
}
|
||||
// @Bean
|
||||
// @Profile("prod")
|
||||
// GroupedOpenApi prodApi(OpenAPI openAPI) {
|
||||
// return GroupedOpenApi.builder()
|
||||
// .group("user-test-api")
|
||||
// .pathsToMatch("/null")
|
||||
// .addOpenApiCustomizer(api -> {
|
||||
// api = openAPI;
|
||||
// })
|
||||
// .pathsToExclude("/health/*")
|
||||
// .build();
|
||||
// }
|
||||
|
||||
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
GroupedOpenApi loginApi(OpenAPI openAPI) {
|
||||
String paths[] = {"/op/admin/login", "/op/admin/logout", "/op/admin/captcha"};
|
||||
return GroupedOpenApi.builder()
|
||||
.group("login")
|
||||
// .packagesToScan("tech.bcnew.modular.authaudit.controller")
|
||||
.pathsToMatch(paths)
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*")
|
||||
.build();
|
||||
}
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
GroupedOpenApi mybatisApi(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("mybatis")
|
||||
.pathsToMatch("/mybatis/**")
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*")
|
||||
.build();
|
||||
}
|
||||
// @Bean
|
||||
// @Profile("prod")
|
||||
// GroupedOpenApi loginApi(OpenAPI openAPI) {
|
||||
// String paths[] = {"/op/admin/login", "/op/admin/logout", "/op/admin/captcha"};
|
||||
// return GroupedOpenApi.builder()
|
||||
// .group("login")
|
||||
//// .packagesToScan("tech.bcnew.modular.authaudit.controller")
|
||||
// .pathsToMatch(paths)
|
||||
// .addOpenApiCustomizer(api -> {
|
||||
// api = openAPI;
|
||||
// })
|
||||
// .pathsToExclude("/health/*")
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// @Profile("prod")
|
||||
// GroupedOpenApi mybatisApi(OpenAPI openAPI) {
|
||||
// return GroupedOpenApi.builder()
|
||||
// .group("mybatis")
|
||||
// .pathsToMatch("/mybatis/**")
|
||||
// .addOpenApiCustomizer(api -> {
|
||||
// api = openAPI;
|
||||
// })
|
||||
// .pathsToExclude("/health/*")
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// @Profile("!prod")
|
||||
|
|
@ -113,7 +114,7 @@ public class SwaggerConfig {
|
|||
|
||||
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
@Profile("prod")
|
||||
GroupedOpenApi webApi(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("web")
|
||||
|
|
@ -128,7 +129,7 @@ public class SwaggerConfig {
|
|||
|
||||
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
@Profile("prod")
|
||||
GroupedOpenApi webAdminApi(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("operate")
|
||||
|
|
@ -140,6 +141,36 @@ public class SwaggerConfig {
|
|||
.pathsToExclude("/health/*", "/jpa*")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
GroupedOpenApi webApi_(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("web")
|
||||
.pathsToMatch("/web/**")
|
||||
//.packagesToScan("/jj/tech/paolu/biz/**")
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*", "/jpa*")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
GroupedOpenApi webAdminApi_(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("operate")
|
||||
.pathsToMatch("/op/**")
|
||||
//.packagesToScan("/jj/tech/paolu/biz/**")
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*", "/jpa*")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package jj.tech.paolu.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.entity.ContentType;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class YMHttp {
|
||||
public static ObjectMapper objectMapper = new ObjectMapper();
|
||||
public static String ym_url = "http://api.jfbym.com/api/YmServer/customApi";
|
||||
|
||||
public static Map<String,Object> customApi(String image_base64){
|
||||
try {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("token", "Cx08lMubmQauvOOhD0rp_qdnebs--Hi7bPdy9No6Uvw");
|
||||
param.put("type", "10110");
|
||||
param.put("image", image_base64);
|
||||
|
||||
String stean = Request.Post(ym_url)
|
||||
.connectTimeout(2500)
|
||||
.socketTimeout(2500)
|
||||
.bodyString(objectMapper.writeValueAsString(param), ContentType.APPLICATION_JSON)
|
||||
.execute()
|
||||
.returnContent()
|
||||
.asString();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<String, Object> jsonObject = objectMapper.readValue(stean, HashMap.class);
|
||||
|
||||
return jsonObject;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
//
|
||||
// Map<String, Object> param = new HashMap<>();
|
||||
// param.put("token", "Cx08lMubmQauvOOhD0rp_qdnebs--Hi7bPdy9No6Uvw");
|
||||
// param.put("type", "10110");
|
||||
// param.put("image", "image");
|
||||
//
|
||||
// InputStream stean =
|
||||
// Request.Post(ym_url)
|
||||
// .connectTimeout(2500)
|
||||
// .socketTimeout(2500)
|
||||
// .bodyString(objectMapper.writeValueAsString(param), ContentType.APPLICATION_JSON)
|
||||
// .execute()
|
||||
// .returnContent()
|
||||
// .asStream();
|
||||
// JsonNode root = objectMapper.readTree(stean);
|
||||
// //JsonNode data = root.get("data");
|
||||
// //ArrayNode datasetArray = (ArrayNode)root.get("data");
|
||||
// for (final JsonNode item : root) {
|
||||
// System.out.println(item);
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
Map<String,Object> r =
|
||||
YMHttp.customApi("ss");
|
||||
System.out.println(r);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -25,15 +25,15 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<!--<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>testFile.log</file>
|
||||
<append>true</append>
|
||||
<!-- encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||
encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH-mm-ss.SSSXXX} [%thread] %-5level %logger{36} -%kvp- %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
</appender>-->
|
||||
|
||||
<logger name="jj.tech.paolu">
|
||||
<level value="info"/>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
<root level="info">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
<!--<appender-ref ref="FILE" />-->
|
||||
</root>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user