Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
map-parent
Commits
0c246e9a
Commit
0c246e9a
authored
Mar 23, 2021
by
chentian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
6a25b961
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
218 additions
and
201 deletions
+218
-201
common/common_utils/src/main/java/com/founder/commonutils/doc/imageurl.txt
+17
-0
serviceapi/imageapi/src/main/java/com/founder/imageapi/ImageApiApplication.java
+2
-1
serviceapi/imageapi/src/main/java/com/founder/imageapi/controller/ImageController.java
+22
-139
serviceapi/imageapi/src/main/java/com/founder/imageapi/mapper/CameraInfoMapper.java
+2
-3
serviceapi/imageapi/src/main/java/com/founder/imageapi/mapper/TbStAsjBzMapper.java
+0
-19
serviceapi/imageapi/src/main/java/com/founder/imageapi/mapper/xml/CameraInfoMapper.xml
+1
-1
serviceapi/imageapi/src/main/java/com/founder/imageapi/mapper/xml/TbStAsjBzMapper.xml
+0
-5
serviceapi/imageapi/src/main/java/com/founder/imageapi/service/ImageService.java
+7
-2
serviceapi/imageapi/src/main/java/com/founder/imageapi/service/impl/CommonService.java
+3
-3
serviceapi/imageapi/src/main/java/com/founder/imageapi/service/impl/ImageServiceImpl.java
+160
-16
serviceapi/imageapi/src/main/resources/bootstrap.properties
+4
-12
No files found.
common/common_utils/src/main/java/com/founder/commonutils/doc/imageurl.txt
0 → 100644
View file @
0c246e9a
#云天励飞(方正国际接口对接.pdf)
imageIp=http://26.3.12.56
imageUrl=http://26.3.12.56:8083
#4.2.1根据id获取图片信息(根据(imageid)获取完整的图片(image)信息)
imageByIdUrl=/api/intellif/image/
#4.2.2获取指定id的人脸信息(根据(faceid)获取完整的人脸小图(face)信息)
faceByIdUrl=/api/intellif/face/
#4.2.3根据小图获取大图信息(根据人脸编号(faceid)获取人脸所在的大图(image)的信息)
imageByFaceIdUrl=/api/intellif/image/face/
#4.2.4根据小图获取大图信息,返回人脸小图在大图中的位置(类似接口 4.2.3,差别在于多返回了 face 在 image 中的位置信息)
imageAndLocationByFaceIdUrl=/api/intellif/image/face/json/
#4.2.5根据大图获取小图(根据大图 id 获取所有小图信息,这里的 id 来自上传图片接口返回的 id)
imageByBigImageIdUrl=/api/intellif/face/image/
#4.1.1 图片文件传输方式地址 true-进行人脸检测 false-不进行人脸检测 0-检索上传 1-布控上传 2-红名单上传
imageIdsByUploadImageUrl =/api/intellif/image/upload/true?type=0
serviceapi/imageapi/src/main/java/com/founder/imageapi/ImageApiApplication.java
View file @
0c246e9a
package
com
.
founder
.
ytlf
;
package
com
.
founder
.
imageapi
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
...
...
serviceapi/imageapi/src/main/java/com/founder/imageapi/controller/ImageController.java
View file @
0c246e9a
package
com
.
founder
.
ytlf
.
controller
;
package
com
.
founder
.
imageapi
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.founder.commonutils.peopleEntity.FaceSearchParam
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.util.HttpClient
;
import
com.founder.commonutils.util.TokenUtils
;
import
com.founder.servicebase.logs.OperLog
;
import
com.founder.servicebase.logs.OperationType
;
import
com.founder.
ytlf.service.Ytlf
Service
;
import
com.founder.
imageapi.service.Image
Service
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* <p>
*
云天
接口管理 前端控制器
*
第三方图像
接口管理 前端控制器
* </p>
*
* @author yangyang
* @since 2021-03-18
*/
@Api
(
description
=
"
云天接口管理
"
)
@Api
(
description
=
"
第三方图像接口管理-云天励飞
"
)
@RestController
@RequestMapping
(
"/ytlf"
)
public
class
YtlfController
{
@RequestMapping
(
"/image"
)
@Component
public
class
ImageController
{
@Autowired
private
YtlfService
ytlfService
;
private
ImageService
imageService
;
@Value
(
"${image_url}"
)
private
String
image_url
;
@GetMapping
(
"/getvalue"
)
public
MapRestResult
getvalue
()
{
//获取token
//案件查询(存储reids)
return
MapRestResult
.
build
(
202
,
"测试"
,
image_url
);
}
//获取token
@OperLog
(
message
=
"token获取"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"token获取"
)
@PostMapping
(
"/token"
)
...
...
@@ -47,135 +52,13 @@ public class YtlfController {
return
MapRestResult
.
build
(
202
,
"成功获取token信息"
,
accessToken
);
}
@OperLog
(
message
=
"根据id获取图片信息"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"根据id获取图片信息"
)
@GetMapping
(
"/getPicById/{id}"
)
public
MapRestResult
getPicById_yunTian
(
@PathVariable
String
id
){
try
{
String
ytToken
=
TokenUtils
.
getYtgsToken
();
//url应该写在配置文件中
String
url
=
"http://26.3.12.56:8083/api/intellif/image/"
+
id
;
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
String
auth
=
"Bearer "
+
ytToken
;
String
result
=
""
;
Map
<
String
,
String
>
header
=
new
HashMap
<>();
header
.
put
(
"Authorization"
,
auth
);
try
{
result
=
HttpClient
.
doGet
(
url
,
header
,
null
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
//JSONObject jsonObject = JSONArray.parseObject(result);
return
MapRestResult
.
build
(
200
,
"查询结果为"
,
result
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
MapRestResult
.
build
(
500
,
"请求失败"
,
null
);
}
@OperLog
(
message
=
"获取指定id的人脸信息"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"获取指定id的人脸信息"
)
@GetMapping
(
"/getFaceByFaceId/{FaceId}"
)
public
MapRestResult
getFaceByFaceId
(
@PathVariable
Long
FaceId
){
try
{
String
accessToken
=
TokenUtils
.
getYtgsToken
();
String
url
=
"http://26.3.12.56:8083/api/intellif/face/"
+
FaceId
;
String
Authorization
=
"Bearer "
+
accessToken
;
Map
header
=
new
HashMap
<
String
,
String
>();
header
.
put
(
"Authorization"
,
Authorization
);
String
result
=
null
;
try
{
result
=
HttpClient
.
doGet
(
url
,
header
,
null
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
JSONObject
jsonObject
=
JSONArray
.
parseObject
(
result
);
return
MapRestResult
.
build
(
200
,
"成功获取指定id的人脸信息"
,
jsonObject
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
MapRestResult
.
build
(
500
,
"请求失败"
,
null
);
}
@OperLog
(
message
=
"根据小图获取大图信息"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"根据小图获取大图信息"
)
@GetMapping
(
"/getImageByFaceId/{FaceId}"
)
public
MapRestResult
getImageByFaceId
(
@PathVariable
Long
FaceId
){
try
{
String
accessToken
=
TokenUtils
.
getYtgsToken
();
String
url
=
"http://26.3.12.56:8083/api/intellif/image/face/"
+
FaceId
;
String
Authorization
=
"Bearer "
+
accessToken
;
Map
header
=
new
HashMap
<
String
,
String
>();
header
.
put
(
"Authorization"
,
Authorization
);
String
result
=
null
;
try
{
result
=
HttpClient
.
doGet
(
url
,
header
,
null
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
JSONObject
jsonObject
=
JSONArray
.
parseObject
(
result
);
return
MapRestResult
.
build
(
200
,
"成功根据小图获取大图信息"
,
jsonObject
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
MapRestResult
.
build
(
500
,
"请求失败"
,
null
);
}
@OperLog
(
message
=
"根据小图获取大图信息,返回人脸小图在大图中的位置"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"根据小图获取大图信息,返回人脸小图在大图中的位置"
)
@GetMapping
(
"/getImageAndLocationByFaceId/{FaceId}"
)
public
MapRestResult
getImageAndLocationByFaceId
(
@PathVariable
Long
FaceId
){
try
{
String
accessToken
=
TokenUtils
.
getYtgsToken
();
String
url
=
"http://26.3.12.56:8083/api/intellif/image/face/json/"
+
FaceId
;
String
Authorization
=
"Bearer "
+
accessToken
;
Map
header
=
new
HashMap
<
String
,
String
>();
header
.
put
(
"Authorization"
,
Authorization
);
String
result
=
null
;
try
{
result
=
HttpClient
.
doGet
(
url
,
header
,
null
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
JSONObject
jsonObject
=
JSONArray
.
parseObject
(
result
);
return
MapRestResult
.
build
(
200
,
"成功根据小图获取大图信息,返回人脸小图在大图中的位置"
,
jsonObject
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
MapRestResult
.
build
(
500
,
"请求失败"
,
null
);
}
@OperLog
(
message
=
"根据大图id获取所有小图信息,这里的id来自上传图片接口返回的id"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"根据大图id获取所有小图信息,这里的id来自上传图片接口返回的id"
)
@GetMapping
(
"/getImageByBigImageId/{BigImageId}"
)
public
MapRestResult
getImageByBigImageId
(
@PathVariable
Long
BigImageId
){
try
{
String
accessToken
=
TokenUtils
.
getYtgsToken
();
String
url
=
"http://26.3.12.56:8083/api/intellif/face/image/"
+
BigImageId
;
String
Authorization
=
"Bearer "
+
accessToken
;
Map
header
=
new
HashMap
<
String
,
String
>();
header
.
put
(
"Authorization"
,
Authorization
);
String
result
=
null
;
try
{
result
=
HttpClient
.
doGet
(
url
,
header
,
null
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
JSONObject
jsonObject
=
JSONArray
.
parseObject
(
result
);
return
MapRestResult
.
build
(
200
,
"成功根据大图id获取所有小图信息,这里的id来自上传图片接口返回的id"
,
jsonObject
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
MapRestResult
.
build
(
500
,
"请求失败"
,
null
);
}
// 人脸动态检索接口接口
@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
)
{
long
startTime
=
new
Date
().
getTime
();
MapRestResult
result
=
ytlf
Service
.
getFaceImageByUploadImage
(
files
,
faceSearchParam
);
MapRestResult
result
=
image
Service
.
getFaceImageByUploadImage
(
files
,
faceSearchParam
);
long
endTime
=
new
Date
().
getTime
();
long
timeDiffer
=
endTime
-
startTime
;
System
.
out
.
println
(
"人脸检索**请求时长**********"
+
timeDiffer
+
"毫秒"
);
...
...
serviceapi/imageapi/src/main/java/com/founder/
ytlf/mapper/CameraInfoDao
.java
→
serviceapi/imageapi/src/main/java/com/founder/
imageapi/mapper/CameraInfoMapper
.java
View file @
0c246e9a
package
com
.
founder
.
ytlf
.
mapper
;
package
com
.
founder
.
imageapi
.
mapper
;
import
com.founder.commonutils.peopleEntity.Camera
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -7,9 +7,8 @@ import org.springframework.stereotype.Component;
import
java.util.List
;
@Component
@Mapper
public
interface
CameraInfo
Dao
{
public
interface
CameraInfo
Mapper
{
List
<
Camera
>
getCameraInfoByIds
(
@Param
(
value
=
"cameraIds"
)
String
cameraIds
);
}
serviceapi/imageapi/src/main/java/com/founder/imageapi/mapper/TbStAsjBzMapper.java
deleted
100644 → 0
View file @
6a25b961
package
com
.
founder
.
imageapi
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.founder.commonutils.asjEntity.TbXwAsjbz
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* <p>
* 案事件标注Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-03-05
*/
@Mapper
public
interface
TbStAsjBzMapper
extends
BaseMapper
<
TbXwAsjbz
>
{
}
serviceapi/imageapi/src/main/java/com/founder/
ytlf
/mapper/xml/CameraInfoMapper.xml
→
serviceapi/imageapi/src/main/java/com/founder/
imageapi
/mapper/xml/CameraInfoMapper.xml
View file @
0c246e9a
<?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.founder.
ytlf.mapper.CameraInfoDao
"
>
<mapper
namespace=
"com.founder.
imageapi.mapper.CameraInfoMapper
"
>
<select
id=
"getCameraInfoByIds"
parameterType=
"java.lang.String"
resultType=
"com.founder.commonutils.peopleEntity.Camera"
>
select
...
...
serviceapi/imageapi/src/main/java/com/founder/imageapi/mapper/xml/TbStAsjBzMapper.xml
deleted
100644 → 0
View file @
6a25b961
<?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.founder.imageapi.mapper.TbStAsjBzMapper"
>
</mapper>
serviceapi/imageapi/src/main/java/com/founder/
ytlf/service/Ytlf
Service.java
→
serviceapi/imageapi/src/main/java/com/founder/
imageapi/service/Image
Service.java
View file @
0c246e9a
package
com
.
founder
.
ytlf
.
service
;
package
com
.
founder
.
imageapi
.
service
;
import
com.founder.commonutils.peopleEntity.FaceSearchParam
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
...
...
@@ -12,7 +12,12 @@ import org.springframework.web.multipart.MultipartFile;
* @author yangyang
* @since 2021-03-19
*/
public
interface
Ytlf
Service
{
public
interface
Image
Service
{
MapRestResult
getFaceImageByUploadImage
(
MultipartFile
[]
files
,
FaceSearchParam
faceSearchParam
);
MapRestResult
getImageById
(
Long
id
);
MapRestResult
getFaceById
(
Long
id
);
MapRestResult
getImageByFaceId
(
Long
faceId
);
/* MapRestResult getImageAndLocationByFaceId(Long faceId);*/
/* MapRestResult getImageByBigImageId(Long bigImageId);*/
}
serviceapi/imageapi/src/main/java/com/founder/
ytlf
/service/impl/CommonService.java
→
serviceapi/imageapi/src/main/java/com/founder/
imageapi
/service/impl/CommonService.java
View file @
0c246e9a
package
com
.
founder
.
ytlf
.
service
.
impl
;
package
com
.
founder
.
imageapi
.
service
.
impl
;
import
com.founder.commonutils.peopleEntity.Camera
;
import
com.founder.commonutils.util.DataUtil
;
import
com.founder.
ytlf.mapper.CameraInfoDao
;
import
com.founder.
imageapi.mapper.CameraInfoMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -16,7 +16,7 @@ import java.util.*;
@Component
public
class
CommonService
{
@Autowired
private
CameraInfo
Dao
cameraInfoDao
;
private
CameraInfo
Mapper
cameraInfoDao
;
public
Map
<
String
,
Object
>
getCameraInfoByIds
(
String
cameraId
)
{
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
...
...
serviceapi/imageapi/src/main/java/com/founder/
ytlf/service/impl/Ytlf
ServiceImpl.java
→
serviceapi/imageapi/src/main/java/com/founder/
imageapi/service/impl/Image
ServiceImpl.java
View file @
0c246e9a
This diff is collapsed.
Click to expand it.
serviceapi/imageapi/src/main/resources/bootstrap.properties
View file @
0c246e9a
...
...
@@ -10,17 +10,9 @@ 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=
eduport
.properties
#spring.cloud.nacos.config.ext-config[0].data-id=
image
.properties
# 开启动态刷新配置,否则配置文件修改,工程无法感知
#spring.cloud.nacos.config.ext-config[0].refresh=true
#############################云天接口访问地址开始#############################################
#4.4.1 图片文件传输方式地址 true-进行人脸检测 false-不进行人脸检测 0-检索上传 1-布控上传 2-红名单上传
ImageIdsByUploadImageUrl
=
http://26.3.12.56:8083/api/intellif/image/upload/true?type=0
#根据大图 id 获取所有小图信息,这里的 id 来自上传图片接口返回的 id
FaceIdByIdUrl
=
http://26.3.12.56:8083/api/intellif/face/image/
#4.2.4 根据小图获取大图,返回人脸小图在大图中的位置
FaceBigByIdUrl
=
http://26.3.12.56:8083/api/intellif/image/face/json/
#############################云天接口访问地址结束##############################################
\ No newline at end of file
spring.cloud.nacos.config.shared-dataids
=
image.properties
spring.cloud.nacos.config.refreshable-dataids
=
image.properties
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment