Commit a0ebbc6a by chentian

增加image标准模块

parent 02eb01a4
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>service</artifactId>
<groupId>com.founder</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>image</artifactId>
</project>
\ No newline at end of file
package com.founder.image;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)//排除自动配置
@ComponentScan(basePackages = {"com.founder"})
@EnableDiscoveryClient
@EnableFeignClients
public class ImageApplication {
@Autowired
private RestTemplateBuilder restTemplateBuilder;
public static void main(String[] args) {
SpringApplication.run(ImageApplication.class, args);
}
@Bean
public RestTemplate restTemplate(){return restTemplateBuilder.build();}
}
package com.founder.image.controller;
import com.founder.commonutils.peopleEntity.CameraFaceTask;
import com.founder.commonutils.peopleEntity.FaceSearchParam;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.image.service.ImageService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* Created by Founder on 2021/4/14.
*/
@Api(description = "第三方图像接口管理-云天励飞")
@RestController
@RequestMapping("/image")
@Component
public class ImageController {
@Autowired
private ImageService imageService;
// 人脸动态检索接口接口
@PostMapping(value = "/getFaceImageByUploadImage")
public MapRestResult getFaceIdsByUploadImage(@RequestPart(value = "files",required = true) MultipartFile[] files, FaceSearchParam faceSearchParam) {
MapRestResult result=imageService.getFaceImageByUploadImage(files,faceSearchParam);
return result;
}
// 人像回溯接口
@PostMapping(value = "/sendTask")
public MapRestResult sendTask(@RequestBody CameraFaceTask cameraFaceTask) {
MapRestResult result=imageService.sendTask(cameraFaceTask);
return result;
}
}
package com.founder.image.service;
import com.founder.commonutils.peopleEntity.CameraFaceTask;
import com.founder.commonutils.peopleEntity.FaceSearchParam;
import com.founder.commonutils.publicEntity.MapRestResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
/**
* Created by Founder on 2021/4/14.
*/
@FeignClient("imageapi")
public interface ImageService {
//人脸动态检索接口
@PostMapping(value = "/image/getFaceImageByUploadImage")
public MapRestResult getFaceImageByUploadImage(@RequestPart(value = "files",required = true) MultipartFile[] files, @RequestParam(value = "faceSearchParam") FaceSearchParam faceSearchParam);
//人像回溯接口
@PostMapping(value = "/image/sendTask")
public MapRestResult sendTask(@RequestBody CameraFaceTask cameraFaceTask) ;
}
#配置中心地址
spring.cloud.nacos.config.server-addr=47.92.48.137:8848
spring.cloud.nacos.discovery.server-addr=47.92.48.137:8848
spring.profiles.active=dev
# 该配置影响统一配置中心中的dataId
spring.application.name=image
#dev
spring.cloud.nacos.config.namespace=052aa986-5c18-4013-a91a-583dc01aaf8b
#prod
#spring.cloud.nacos.config.namespace=1ffd9d32-3f03-4eb8-bf12-98b1ce397390
#spring.cloud.nacos.config.ext-config[0].data-id=image.properties
# 开启动态刷新配置,否则配置文件修改,工程无法感知
#spring.cloud.nacos.config.ext-config[0].refresh=true
......@@ -13,6 +13,7 @@
<module>asj</module>
<module>publicapi</module>
<module>es</module>
<module>image</module>
</modules>
<artifactId>service</artifactId>
<dependencies>
......@@ -157,5 +158,10 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -48,8 +48,8 @@ public class ImageController {
// 人脸动态检索接口接口
@OperLog(message = "人脸动态检索接口",operation = OperationType.QUERY)
@ApiOperation(value = "人脸动态检索接口")
@PostMapping(value = "/getFaceImageByUploadImage",consumes = "multipart/*",headers = "content-type=multipart/form-data")
public MapRestResult getFaceIdsByUploadImage(@RequestParam(value = "files",required = true) MultipartFile[] files, FaceSearchParam faceSearchParam) {
@PostMapping(value = "/getFaceImageByUploadImage")
public MapRestResult getFaceIdsByUploadImage(@RequestPart(value = "files",required = true) MultipartFile[] files, FaceSearchParam faceSearchParam) {
long startTime=new Date().getTime();
MapRestResult result=imageService.getFaceImageByUploadImage(files,faceSearchParam);
long endTime=new Date().getTime();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment