first commit
This commit is contained in:
parent
075d363923
commit
2018c54dbb
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-modules</artifactId>
|
||||
<version>24.7.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>bonus-modules-ai</artifactId>
|
||||
|
||||
<description>
|
||||
bonus-modules-ai服务
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- bonus Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- bonus Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-datascope</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- bonus Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- bonus Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>30.0-jre</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bonus.ai;
|
||||
|
||||
import com.bonus.common.security.annotation.EnableCustomConfig;
|
||||
import com.bonus.common.security.annotation.EnableRyFeignClients;
|
||||
import com.bonus.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 文件服务
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
public class BonusAIApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(BonusAIApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 人工智能服务启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.bonus.ai.config;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Configuration
|
||||
public class RemoteCallConfig {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.ai.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 文件请求处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@RestController
|
||||
public class DeveloperController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(DeveloperController.class);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.ai.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 文件请求处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@RestController
|
||||
public class FacialRecogController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(FacialRecogController.class);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.ai.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
/**
|
||||
* 文件请求处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@RestController
|
||||
public class LLMController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(LLMController.class);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.ai.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件请求处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@RestController
|
||||
public class ModelTrainController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(ModelTrainController.class);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bonus.ai.controller;
|
||||
|
||||
//import com.bonus.ai.domain.IDCardInfo;
|
||||
import com.bonus.ai.domain.dto.ImageUpload;
|
||||
import com.bonus.ai.domain.po.AiIdcardrecognizeResult;
|
||||
import com.bonus.ai.domain.vo.IdCardVo;
|
||||
import com.bonus.ai.service.IOcrRecogService;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件请求处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ocr")
|
||||
public class OcrRecogController
|
||||
{
|
||||
@Autowired
|
||||
private IOcrRecogService ocrRecogService;
|
||||
|
||||
|
||||
@PostMapping("/recognition")
|
||||
public R<IdCardVo> idCardRecognize(
|
||||
@RequestBody ImageUpload imageUpload) {
|
||||
return R.ok(ocrRecogService.detectIdCard(imageUpload));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.ai.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 文件请求处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@RestController
|
||||
public class ViolationRecogController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(ViolationRecogController.class);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.ai.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 前段传来的身份证数据
|
||||
*/
|
||||
@Data
|
||||
public class ImageUpload {
|
||||
/**
|
||||
*类型字段,用于区分不同的识别请求
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 身份证正面
|
||||
*/
|
||||
private String recognitionFrontData;
|
||||
|
||||
/**
|
||||
* 身份证背面
|
||||
*/
|
||||
private String recognitionBackData;
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.bonus.ai.domain.po;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 身份证识别结果
|
||||
* @author wubin
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class AiIdcardrecognizeResult {
|
||||
|
||||
/** 结果ID,唯一标识一条记录 */
|
||||
private Long resultId;
|
||||
|
||||
/** 服务ID,标识处理身份证信息的服务 */
|
||||
private Long serviceId;
|
||||
|
||||
/** 用户姓名 */
|
||||
private String name;
|
||||
|
||||
/** 用户性别,'0' 表示男性,'1' 表示女性 */
|
||||
private char sex;
|
||||
|
||||
/** 用户民族 */
|
||||
private String enthnic;
|
||||
|
||||
/** 用户出生年月日,格式为 "YYYY-MM-DD" */
|
||||
private String birthday;
|
||||
|
||||
/** 用户住址,即身份证上的住址 */
|
||||
private String address;
|
||||
|
||||
/** 用户身份证号码 */
|
||||
private String idcardNumber;
|
||||
|
||||
/** 身份证签发机关 */
|
||||
private String issuingAuthority;
|
||||
|
||||
/** 身份证有效期 */
|
||||
private String idcardValidity;
|
||||
|
||||
/** 身份信息是否完整,'Y' 表示完整,'N' 表示不完整 */
|
||||
private Character ifComplete;
|
||||
|
||||
/** 身份证正面图片地址 */
|
||||
private String frontImageAddress;
|
||||
|
||||
/** 身份证反面图片地址 */
|
||||
private String backImageAddress;
|
||||
|
||||
/** 识别时间,即身份证信息被识别的时间 */
|
||||
private LocalDateTime recognizeTime;
|
||||
|
||||
/** 响应时长,即从提交到获取结果的时间长度 */
|
||||
private Integer responseLong;
|
||||
|
||||
/** 调用服务IP,即发起调用服务的客户端IP地址 */
|
||||
private String invokeIp;
|
||||
|
||||
/** 更新者,即最后一次更新记录的用户 */
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间,即记录最后一次更新的时间 */
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 删除标志,'0' 表示记录存在,'2' 表示记录已被删除 */
|
||||
private char delFlag;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.ai.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Data
|
||||
public class IdCardVo {
|
||||
private int code;
|
||||
private String msg;
|
||||
private Data data;
|
||||
@lombok.Data
|
||||
public static class Data {
|
||||
private String issuingAuthority;
|
||||
private String validTime;
|
||||
private String name;
|
||||
private char gender;
|
||||
private String ethnicity;
|
||||
private String dateOfBirth;
|
||||
private String address;
|
||||
private String idNumber;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.bonus.ai.error;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* @author wangvivi
|
||||
*/
|
||||
|
||||
|
||||
public class ErrorHandler {
|
||||
public static final int PYTHON_INTERPRETER_NO_EXIST = 30001;
|
||||
public static final int PYTHON_SCRIPT_NO_EXIST = 30002;
|
||||
public static final int PYTHON_PROCESS_START_ERROR = 30003;
|
||||
public static final int PYTHON_SCRIPT_EXECUTE_ERROR = 30004;
|
||||
public static final int PYTHON_EXECUTE_OTHER_ERROR = 30005;
|
||||
public static final int RECOGNITION_PARAM_ERROR = 30006;
|
||||
public static final int JAVA_CALL_PYTHON_UNKWON_ERROR = 30007;
|
||||
|
||||
public static String getErrorInfo(int errorCode) {
|
||||
switch (errorCode) {
|
||||
case PYTHON_INTERPRETER_NO_EXIST:
|
||||
return getInternalErrorInfo(errorCode, "python解释器文件不存在");
|
||||
case PYTHON_SCRIPT_NO_EXIST:
|
||||
return getInternalErrorInfo(errorCode, "python脚本不存在");
|
||||
case PYTHON_PROCESS_START_ERROR:
|
||||
return getInternalErrorInfo(errorCode, "启动python进程报错");
|
||||
case PYTHON_SCRIPT_EXECUTE_ERROR:
|
||||
return getInternalErrorInfo(errorCode, "python脚本执行异常");
|
||||
case RECOGNITION_PARAM_ERROR:
|
||||
return getInternalErrorInfo(errorCode, "参数检查错误");
|
||||
case PYTHON_EXECUTE_OTHER_ERROR:
|
||||
return getInternalErrorInfo(errorCode, "python脚本执行其他错误");
|
||||
default:
|
||||
return getInternalErrorInfo(JAVA_CALL_PYTHON_UNKWON_ERROR, "未知错误");
|
||||
}
|
||||
}
|
||||
|
||||
private static String getInternalErrorInfo(int errorCode, String errorMsg){
|
||||
ErrorInfo errorInfo = new ErrorInfo(errorCode, errorMsg);
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(errorInfo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.bonus.ai.error;
|
||||
|
||||
|
||||
/**
|
||||
* @author wangvivi
|
||||
*/
|
||||
public class ErrorInfo {
|
||||
private int code;
|
||||
private String msg;
|
||||
|
||||
public ErrorInfo(int errorCode, String errorMessage) {
|
||||
this.code = errorCode;
|
||||
this.msg = errorMessage;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setMsg(String errormsg) {
|
||||
this.msg = errormsg;
|
||||
}
|
||||
|
||||
public void setMsg(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.ai.mapper;
|
||||
import com.bonus.ai.domain.po.AiIdcardrecognizeResult;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author wubin
|
||||
*/
|
||||
@Repository
|
||||
public interface AiIdcardrecognizeMapper {
|
||||
void insert(AiIdcardrecognizeResult aiIdcardrecognizeResult);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.bonus.ai.service;
|
||||
import com.bonus.ai.domain.dto.ImageUpload;
|
||||
import com.bonus.ai.domain.vo.IdCardVo;
|
||||
|
||||
public interface IOcrRecogService {
|
||||
IdCardVo detectIdCard(ImageUpload imageUpload);
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.bonus.ai.service.impl;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.bonus.ai.domain.dto.ImageUpload;
|
||||
import com.bonus.ai.domain.po.AiIdcardrecognizeResult;
|
||||
import com.bonus.ai.domain.vo.IdCardVo;
|
||||
import com.bonus.ai.mapper.AiIdcardrecognizeMapper;
|
||||
import com.bonus.ai.service.IOcrRecogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.io.*;
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OcrRecogServiceImpl implements IOcrRecogService {
|
||||
// @Autowired
|
||||
// private RestTemplate restTemplate;
|
||||
|
||||
// private final AiIdcardrecognizeResult aiIdcardrecognizeResult;
|
||||
|
||||
@Autowired
|
||||
private AiIdcardrecognizeMapper aiIdcardrecognizeMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IdCardVo detectIdCard(ImageUpload imageUpload) {
|
||||
// String recogUrl = "http://192.168.0.188:8080/recognition";
|
||||
//
|
||||
// ResponseEntity<String> response = restTemplate.postForEntity(
|
||||
// recogUrl,imageUpload,String.class);
|
||||
// String json = String.valueOf(response.getBody());
|
||||
// String json_deal= json.substring(1, json.length() - 1);
|
||||
String response = "{\"code\": 20000, \"msg\": \"身份证信息完整\", \"data\": {\"issuingAuthority\": \"湘乡市公安局\", \"dateOfBirth\":\"2020.09.02\",\"validTime\": \"2020.09.02-2040.09.02\", \"name\": \"性#\", \"gender\": \"男\", \"ethnicity\": \"出生1964年11月30日\", \"dateOfBirth\": \"1964年11月30日\", \"address\": \"住地湖南省会同县广评镇西楼村三组6号\", \"idNumber\": \"43302919641130423X\"}}";
|
||||
|
||||
// 创建Gson实例,将python模型返回值赋值给前端对象
|
||||
Gson gson = new Gson();
|
||||
IdCardVo idCardVo = gson.fromJson(response, IdCardVo.class);
|
||||
System.out.println(idCardVo);
|
||||
|
||||
|
||||
// 保存数据
|
||||
char ifComplete = '否';
|
||||
if ("身份证信息完整".equals(idCardVo.getMsg())) {
|
||||
ifComplete = '是';
|
||||
}
|
||||
|
||||
String directoryPath = "C:\\images"; // 指定保存图片的目录
|
||||
String idNumber = idCardVo.getData().getIdNumber();
|
||||
String currentDate = LocalDate.now().toString();
|
||||
String frontFileName = idNumber + "_" + currentDate + "_front.jpg";
|
||||
String backFileName = idNumber + "_" + currentDate + "_back.jpg";
|
||||
byte[] frontImageBytes = Base64.getDecoder().decode(imageUpload.getRecognitionFrontData());
|
||||
byte[] backImageBytes = Base64.getDecoder().decode(imageUpload.getRecognitionBackData());
|
||||
try {
|
||||
Path frontFilePath = Paths.get(directoryPath, frontFileName);
|
||||
Path backFilePath = Paths.get(directoryPath, backFileName);
|
||||
Files.write(frontFilePath, frontImageBytes); // 将解码后的字节数组写入到文件中
|
||||
Files.write(backFilePath, backImageBytes);
|
||||
System.out.println("图片保存成功:" + frontFilePath + backFilePath);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("保存图片时出错:" + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
AiIdcardrecognizeResult aiIdcardrecognizeResult = AiIdcardrecognizeResult.builder()
|
||||
.resultId(2L)
|
||||
.serviceId(1L)
|
||||
.name(idCardVo.getData().getName())
|
||||
.sex(idCardVo.getData().getGender())
|
||||
.enthnic(idCardVo.getData().getEthnicity())
|
||||
.birthday(idCardVo.getData().getDateOfBirth())
|
||||
.address(idCardVo.getData().getAddress())
|
||||
.idcardNumber(idNumber)
|
||||
.issuingAuthority(idCardVo.getData().getIssuingAuthority())
|
||||
.idcardValidity(idCardVo.getData().getValidTime())
|
||||
.ifComplete(ifComplete)
|
||||
.frontImageAddress("a")
|
||||
.backImageAddress("a")
|
||||
.recognizeTime(LocalDateTime.now())
|
||||
.responseLong(2)
|
||||
.invokeIp("a")
|
||||
.updateBy("a")
|
||||
.updateTime(LocalDateTime.now())
|
||||
.delFlag('a')
|
||||
.build();
|
||||
System.out.println("最终结果:" + aiIdcardrecognizeResult);
|
||||
aiIdcardrecognizeMapper.insert(aiIdcardrecognizeResult);
|
||||
|
||||
return idCardVo;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
_ __ _ _
|
||||
(_) / _|(_)| |
|
||||
_ __ _ _ ___ _ _ _ ______ | |_ _ | | ___
|
||||
| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \
|
||||
| | | |_| || (_) || |_| || | | | | || || __/
|
||||
|_| \__,_| \___/ \__, ||_| |_| |_||_| \___|
|
||||
__/ |
|
||||
|___/
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 18083
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: bonus-ai
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
username: nacos
|
||||
password: nacos
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.0.14:8848
|
||||
namespace: 0cc70924-d088-4723-84c7-3d9a464e1bc3
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 192.168.0.14:8848
|
||||
namespace: 0cc70924-d088-4723-84c7-3d9a464e1bc3
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/bonus-file" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.bonus" level="debug" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bonus.ai.mapper.AiIdcardrecognizeMapper">
|
||||
<insert id="insert" parameterType="com.bonus.ai.domain.po.AiIdcardrecognizeResult">
|
||||
INSERT INTO ai_idcardrecognize_result
|
||||
(service_id, name, sex, enthnic, birthday, address, idcard_number,
|
||||
issuing_authority, idcard_validity, if_complete, frontImge_address,
|
||||
backImg_address, recognize_time, response_long, invoke_ip,
|
||||
update_by, update_time, del_flag)
|
||||
VALUES
|
||||
(#{serviceId}, #{name}, #{sex}, #{enthnic}, #{birthday}, #{address}, #{idcardNumber},
|
||||
#{issuingAuthority}, #{idcardValidity}, #{ifComplete}, #{frontImageAddress},
|
||||
#{backImageAddress}, #{recognizeTime}, #{responseLong}, #{invokeIp},
|
||||
#{updateBy}, #{updateTime}, #{delFlag})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue