Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RuoYi-Vue-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
AI算法平台
RuoYi-Vue-master
Commits
4db1c305
Commit
4db1c305
authored
Apr 08, 2024
by
baoxiaode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ai数据传输
parent
f84476aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
32 deletions
+104
-32
ruoyi-admin/src/main/java/com/ruoyi/algorithm/controller/AlgorithmCameraBaseController.java
...i/algorithm/controller/AlgorithmCameraBaseController.java
+101
-30
ruoyi-admin/src/main/resources/application.yml
ruoyi-admin/src/main/resources/application.yml
+2
-2
ruoyi-admin/src/main/resources/mapper/system/AlgorithmCameraBaseMapper.xml
...ain/resources/mapper/system/AlgorithmCameraBaseMapper.xml
+1
-0
No files found.
ruoyi-admin/src/main/java/com/ruoyi/algorithm/controller/AlgorithmCameraBaseController.java
View file @
4db1c305
package
com
.
ruoyi
.
algorithm
.
controller
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.Executors
;
import
javax.servlet.http.HttpServletResponse
;
import
cn.hutool.core.lang.hash.Hash
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.algorithm.domain.dto.AlgorithmCameraListDto
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.http.HttpUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
...
...
@@ -33,6 +42,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author ruoyi
* @date 2023-04-26
*/
@Slf4j
@RestController
@RequestMapping
(
"/system/algorithm/camera/base"
)
public
class
AlgorithmCameraBaseController
extends
BaseController
...
...
@@ -86,21 +96,50 @@ public class AlgorithmCameraBaseController extends BaseController
{
algorithmCameraBase
.
setCreateBy
(
getUsername
());
algorithmCameraBaseService
.
insertAlgorithmCameraBase
(
algorithmCameraBase
);
//算法平台通知
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"AllAlgorithmPtype"
,
""
);
JSONArray
cameraList
=
new
JSONArray
();
JSONObject
camera
=
new
JSONObject
();
camera
.
put
(
"inputDataPath"
,
algorithmCameraBase
.
getRtsp
());
camera
.
put
(
"selectalgorithmPtype"
,
algorithmCameraBase
.
getAlgorithmType
());
camera
.
put
(
"cameraName"
,
algorithmCameraBase
.
getCameraNo
());
cameraList
.
add
(
camera
);
param
.
put
(
"cameraList"
,
cameraList
);
try
{
HttpUtil
.
createGet
(
aiCameraUrl
).
body
(
param
.
toJSONString
());
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
String
belong
=
algorithmCameraBase
.
getBelong
();
//查询该矿下所有信息
AlgorithmCameraBase
algorithmCameraBaseReq
=
new
AlgorithmCameraBase
();
algorithmCameraBaseReq
.
setBelong
(
belong
);
List
<
AlgorithmCameraBase
>
list
=
algorithmCameraBaseService
.
selectAlgorithmCameraBaseList
(
algorithmCameraBaseReq
);
Executors
.
newFixedThreadPool
(
1
).
execute
(()
->{
//算法平台通知
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"AllAlgorithmPtype"
,
""
);
JSONArray
cameraList
=
new
JSONArray
();
if
(!
CollectionUtils
.
isEmpty
(
list
)){
list
.
forEach
(
base
->{
if
(!
StringUtils
.
isEmpty
(
base
.
getRtsp
())){
JSONObject
camera
=
new
JSONObject
();
camera
.
put
(
"inputDataPath"
,
base
.
getRtsp
());
camera
.
put
(
"selectalgorithmPtype"
,
base
.
getAlgorithmType
());
camera
.
put
(
"cameraName"
,
base
.
getCameraNo
());
cameraList
.
add
(
camera
);
}
});
}
JSONObject
camera
=
new
JSONObject
();
camera
.
put
(
"inputDataPath"
,
algorithmCameraBase
.
getRtsp
());
camera
.
put
(
"selectalgorithmPtype"
,
algorithmCameraBase
.
getAlgorithmType
());
camera
.
put
(
"cameraName"
,
algorithmCameraBase
.
getCameraNo
());
cameraList
.
add
(
camera
);
param
.
put
(
"cameraList"
,
cameraList
);
try
{
String
apiUrl
=
""
;
if
(
"乌海矿"
.
equals
(
belong
)){
apiUrl
=
aiCameraUrl
.
split
(
","
)[
1
];
}
if
(
"海南矿"
.
equals
(
belong
)){
apiUrl
=
aiCameraUrl
.
split
(
","
)[
0
];
}
if
(!
StringUtils
.
isEmpty
(
apiUrl
)){
log
.
info
(
"发起通信"
);
String
result
=
HttpUtil
.
post
(
apiUrl
,
param
.
toJSONString
());
log
.
info
(
"通信完成"
+
result
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
});
return
AjaxResult
.
success
();
}
...
...
@@ -113,21 +152,53 @@ public class AlgorithmCameraBaseController extends BaseController
public
AjaxResult
edit
(
@RequestBody
AlgorithmCameraBase
algorithmCameraBase
)
{
algorithmCameraBase
.
setUpdateBy
(
getUsername
());
//算法平台通知
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"AllAlgorithmPtype"
,
""
);
JSONArray
cameraList
=
new
JSONArray
();
JSONObject
camera
=
new
JSONObject
();
camera
.
put
(
"inputDataPath"
,
algorithmCameraBase
.
getRtsp
());
camera
.
put
(
"selectalgorithmPtype"
,
algorithmCameraBase
.
getAlgorithmType
());
camera
.
put
(
"cameraName"
,
algorithmCameraBase
.
getCameraNo
());
cameraList
.
add
(
camera
);
param
.
put
(
"cameraList"
,
cameraList
);
try
{
HttpUtil
.
createGet
(
aiCameraUrl
).
body
(
param
.
toJSONString
());
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
String
belong
=
algorithmCameraBase
.
getBelong
();
//查询该矿下所有信息
AlgorithmCameraBase
algorithmCameraBaseReq
=
new
AlgorithmCameraBase
();
algorithmCameraBaseReq
.
setBelong
(
belong
);
List
<
AlgorithmCameraBase
>
list
=
algorithmCameraBaseService
.
selectAlgorithmCameraBaseList
(
algorithmCameraBaseReq
);
Executors
.
newFixedThreadPool
(
1
).
execute
(()
->{
//算法平台通知
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"AllAlgorithmPtype"
,
""
);
JSONArray
cameraList
=
new
JSONArray
();
if
(!
CollectionUtils
.
isEmpty
(
list
)){
list
.
forEach
(
base
->{
if
(
algorithmCameraBase
.
getId
().
equals
(
base
.
getId
())){
return
;
}
if
(!
StringUtils
.
isEmpty
(
base
.
getRtsp
())){
JSONObject
camera
=
new
JSONObject
();
camera
.
put
(
"inputDataPath"
,
base
.
getRtsp
());
camera
.
put
(
"selectalgorithmPtype"
,
base
.
getAlgorithmType
());
camera
.
put
(
"cameraName"
,
base
.
getCameraNo
());
cameraList
.
add
(
camera
);
}
});
}
JSONObject
camera
=
new
JSONObject
();
camera
.
put
(
"inputDataPath"
,
algorithmCameraBase
.
getRtsp
());
camera
.
put
(
"selectalgorithmPtype"
,
algorithmCameraBase
.
getAlgorithmType
());
camera
.
put
(
"cameraName"
,
algorithmCameraBase
.
getCameraNo
());
cameraList
.
add
(
camera
);
param
.
put
(
"cameraList"
,
cameraList
);
try
{
String
apiUrl
=
""
;
if
(
"乌海矿"
.
equals
(
belong
)){
apiUrl
=
aiCameraUrl
.
split
(
","
)[
1
];
}
if
(
"海南矿"
.
equals
(
belong
)){
apiUrl
=
aiCameraUrl
.
split
(
","
)[
0
];
}
if
(!
StringUtils
.
isEmpty
(
apiUrl
)){
log
.
info
(
"发起通信"
);
String
result
=
HttpUtil
.
post
(
apiUrl
,
param
.
toJSONString
());
log
.
info
(
"通信完成"
+
result
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
});
return
toAjax
(
algorithmCameraBaseService
.
updateAlgorithmCameraBase
(
algorithmCameraBase
));
}
...
...
ruoyi-admin/src/main/resources/application.yml
View file @
4db1c305
...
...
@@ -152,8 +152,8 @@ airestapi:
#Ai向摄像头发送地址
ai
:
camera
:
url
:
http://172.16.121.2:8000
/conf
# 海南:http://172.16.121.3:8001/conf 乌海:http://172.16.21.3:8001
/conf
url
:
http://172.16.121.2:8000/conf,http://172.16.21.3:8001/conf
#大华ICC视频配置
icc
:
sdk
:
...
...
ruoyi-admin/src/main/resources/mapper/system/AlgorithmCameraBaseMapper.xml
View file @
4db1c305
...
...
@@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"sort != null "
>
and sort = #{sort}
</if>
<if
test=
"status != null and status != ''"
>
and status = #{status}
</if>
<if
test=
"cameraNo != null and cameraNo != ''"
>
and camera_no = #{cameraNo}
</if>
<if
test=
"belong != null and belong != ''"
>
and belong = #{belong}
</if>
<if
test=
"algorithmType != null and algorithmType != ''"
>
and algorithm_type = #{algorithmType}
</if>
</where>
</select>
...
...
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