Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
refined-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
refined-platform
Commits
178b82d7
Commit
178b82d7
authored
May 05, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加服务追踪
parent
8781c1a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
8 deletions
+139
-8
refined-manager/src/main/java/com/mortals/xhx/common/code/PlanStatusEnum.java
...main/java/com/mortals/xhx/common/code/PlanStatusEnum.java
+70
-0
refined-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/SubEventStartedService.java
...xhx/daemon/applicationservice/SubEventStartedService.java
+2
-1
refined-manager/src/main/java/com/mortals/xhx/module/face/service/impl/FacePlanServiceImpl.java
...als/xhx/module/face/service/impl/FacePlanServiceImpl.java
+35
-7
refined-manager/src/main/java/com/mortals/xhx/module/hik/event/model/req/callback/recognition/Snap.java
...module/hik/event/model/req/callback/recognition/Snap.java
+2
-0
refined-manager/src/main/java/com/mortals/xhx/module/hik/face/service/IHikPlanService.java
.../mortals/xhx/module/hik/face/service/IHikPlanService.java
+9
-0
refined-manager/src/main/java/com/mortals/xhx/module/hik/face/service/impl/HikPlanServiceImpl.java
.../xhx/module/hik/face/service/impl/HikPlanServiceImpl.java
+21
-0
No files found.
refined-manager/src/main/java/com/mortals/xhx/common/code/PlanStatusEnum.java
0 → 100644
View file @
178b82d7
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 海康计划执行状态
*
* @author zxfei
*/
public
enum
PlanStatusEnum
{
FAIL
(
"FAIL"
,
"下发失败"
),
PART_FAIL
(
"PART_FAIL"
,
"部分失败"
),
DELETE
(
"FAIL"
,
"已被删除"
),
RUNNING
(
"RUNNING"
,
"正在下发"
),
WAITING
(
"WAITING"
,
"等待下发"
),
PAUSE
(
"PAUSE"
,
"暂停"
),
SUCCESS
(
"SUCCESS"
,
"下发成功"
);
private
String
value
;
private
String
desc
;
PlanStatusEnum
(
String
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
String
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
PlanStatusEnum
getByValue
(
String
value
)
{
for
(
PlanStatusEnum
processStatusEnum
:
PlanStatusEnum
.
values
())
{
if
(
processStatusEnum
.
getValue
()
==
value
)
{
return
processStatusEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
String
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
PlanStatusEnum
item
:
PlanStatusEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
String
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
refined-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/SubEventStartedService.java
View file @
178b82d7
...
...
@@ -63,7 +63,8 @@ public class SubEventStartedService implements IApplicationStartedService {
public
void
start
()
{
ThreadPool
.
getInstance
().
init
(
20
);
log
.
info
(
"开始服务..[事件订阅服务]"
);
String
eventtypes
=
GlobalSysInfo
.
getParamValue
(
Constant
.
PARAM_EVENTTYPES
,
"131614,131659,1644175361,1644171265"
);
//String eventtypes = GlobalSysInfo.getParamValue(Constant.PARAM_EVENTTYPES, "131614,131659,1644175361,1644171265");
String
eventtypes
=
GlobalSysInfo
.
getParamValue
(
Constant
.
PARAM_EVENTTYPES
,
"131659,1644175361,1644171265"
);
List
<
Integer
>
eventTypes
=
StrUtil
.
split
(
eventtypes
,
","
.
charAt
(
0
),
-
1
,
false
,
Integer:
:
parseInt
);
EventSubReq
eventSubReq
=
new
EventSubReq
();
...
...
refined-manager/src/main/java/com/mortals/xhx/module/face/service/impl/FacePlanServiceImpl.java
View file @
178b82d7
package
com.mortals.xhx.module.face.service.impl
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.code.GenderEnum
;
import
com.mortals.xhx.common.code.RecognitionResourceEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.key.ParamKey
;
import
com.mortals.xhx.module.appointment.model.*
;
...
...
@@ -121,21 +120,35 @@ public class FacePlanServiceImpl extends AbstractCRUDServiceImpl<FacePlanDao, Fa
//设置监控点
List
<
String
>
cameraIndexCodes
=
deviceService
.
find
(
new
DeviceQuery
()).
stream
().
distinct
().
map
(
DeviceEntity:
:
getDeviceCode
).
collect
(
Collectors
.
toList
());
planRecognWhiteReq
.
setCameraIndexCodes
(
cameraIndexCodes
);
ArrayList
<
String
>
temp
=
new
ArrayList
<>();
temp
.
add
(
cameraIndexCodes
.
get
(
2
));
//planRecognWhiteReq.setCameraIndexCodes(cameraIndexCodes);
planRecognWhiteReq
.
setCameraIndexCodes
(
temp
);
//设置识别方式
planRecognWhiteReq
.
setRecognitionResourceType
(
RecognitionResourceEnum
.
SUPER_BRAIN
.
getValue
());
ResourceReq
resourceReq
=
new
ResourceReq
();
resourceReq
.
setRecognitionResourceType
(
RecognitionResourceEnum
.
SUPER_BRAIN
.
getValue
());
Rest
<
List
<
ResourceDataInfo
>>
resourceRecognition
=
hikFaceService
.
getResourceRecognition
(
resourceReq
);
if
(
resourceRecognition
.
getCode
()==
YesNoEnum
.
YES
.
getValue
()&&!
ObjectUtils
.
isEmpty
(
resourceRecognition
.
getData
()))
{
if
(
resourceRecognition
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
()
&&
!
ObjectUtils
.
isEmpty
(
resourceRecognition
.
getData
()))
{
ArrayList
<
String
>
recognitionResourceIndexCodes
=
new
ArrayList
<>();
recognitionResourceIndexCodes
.
add
(
resourceRecognition
.
getData
().
get
(
0
).
getIndexCode
());
planRecognWhiteReq
.
setRecognitionResourceIndexCodes
(
recognitionResourceIndexCodes
);
}
//设置时间段 默认全天候
List
<
TimeBlockListItem
>
timeBlockListItemList
=
new
ArrayList
<>();
TimeBlockListItem
timeBlockListItem
=
new
TimeBlockListItem
();
timeBlockListItem
.
setDayOfWeek
(
"7"
);
List
<
TimeRangeItem
>
timeRange
=
new
ArrayList
<>();
TimeRangeItem
timeRangeItem
=
new
TimeRangeItem
();
timeRangeItem
.
setStartTime
(
"06:00"
);
timeRangeItem
.
setEndTime
(
"18:00"
);
timeRange
.
add
(
timeRangeItem
);
timeBlockListItem
.
setTimeRange
(
timeRange
);
timeBlockListItemList
.
add
(
timeBlockListItem
);
planRecognWhiteReq
.
setTimeBlockList
(
timeBlockListItemList
);
if
(
ObjectUtils
.
isEmpty
(
planRecognWhiteInfo
))
{
Rest
<
String
>
planRecognWhiteAddRest
=
hikPlanService
.
planRecognWhiteAdd
(
planRecognWhiteReq
);
if
(
planRecognWhiteAddRest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
...
...
@@ -150,6 +163,21 @@ public class FacePlanServiceImpl extends AbstractCRUDServiceImpl<FacePlanDao, Fa
facePlanService
.
save
(
planEntity
);
}
}
else
{
//判断计划运行状态
if
(
PlanStatusEnum
.
FAIL
.
getValue
().
equals
(
planRecognWhiteInfo
.
getStatus
()))
{
//计划下发识别,重新下发当前计划
// facePlanService.re
PlanRecognReq
planRecognReq
=
new
PlanRecognReq
();
planRecognReq
.
setIndexCode
(
planRecognWhiteInfo
.
getIndexCode
());
Rest
<
Boolean
>
booleanRest
=
hikPlanService
.
planRecognWhiteReStart
(
planRecognReq
);
if
(
YesNoEnum
.
YES
.
getValue
()
==
booleanRest
.
getCode
())
{
return
Rest
.
ok
(
booleanRest
.
getMsg
());
}
else
{
return
Rest
.
fail
(
booleanRest
.
getMsg
());
}
}
else
if
(
PlanStatusEnum
.
RUNNING
.
getValue
().
equals
(
planRecognWhiteInfo
.
getStatus
()))
{
return
Rest
.
ok
(
PlanStatusEnum
.
RUNNING
.
getDesc
());
}
//更新计划
planRecognWhiteReq
.
setIndexCode
(
planRecognWhiteInfo
.
getIndexCode
());
Rest
<
Boolean
>
planRecognWhiteUpdateRest
=
hikPlanService
.
planRecognWhiteUpdate
(
planRecognWhiteReq
);
...
...
@@ -281,7 +309,7 @@ public class FacePlanServiceImpl extends AbstractCRUDServiceImpl<FacePlanDao, Fa
ResourceReq
resourceReq
=
new
ResourceReq
();
resourceReq
.
setRecognitionResourceType
(
RecognitionResourceEnum
.
SUPER_BRAIN
.
getValue
());
Rest
<
List
<
ResourceDataInfo
>>
resourceRecognition
=
hikFaceService
.
getResourceRecognition
(
resourceReq
);
if
(
resourceRecognition
.
getCode
()==
YesNoEnum
.
YES
.
getValue
()&&!
ObjectUtils
.
isEmpty
(
resourceRecognition
.
getData
()))
{
if
(
resourceRecognition
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
()
&&
!
ObjectUtils
.
isEmpty
(
resourceRecognition
.
getData
()))
{
ArrayList
<
String
>
recognitionResourceIndexCodes
=
new
ArrayList
<>();
recognitionResourceIndexCodes
.
add
(
resourceRecognition
.
getData
().
get
(
0
).
getIndexCode
());
planRecognBlackReq
.
setRecognitionResourceIndexCodes
(
recognitionResourceIndexCodes
);
...
...
refined-manager/src/main/java/com/mortals/xhx/module/hik/event/model/req/callback/recognition/Snap.java
View file @
178b82d7
package
com.mortals.xhx.module.hik.event.model.req.callback.recognition
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
import
java.util.Date
;
...
...
@@ -13,6 +14,7 @@ public class Snap{
/**
* 抓拍图片的时间
*/
@JSONField
(
format
=
"yyyy-MM-dd'T'HH:mm:ssXXX"
)
private
Date
faceTime
;
/**
* 是否戴眼镜
...
...
refined-manager/src/main/java/com/mortals/xhx/module/hik/face/service/IHikPlanService.java
View file @
178b82d7
...
...
@@ -74,4 +74,13 @@ public interface IHikPlanService {
*/
Rest
<
Boolean
>
planRecognWhiteDel
(
PlanRecognReq
planRecognReq
);
/**
* 陌生人监视计划重新下发
*
* @param planRecognReq
* @return
*/
Rest
<
Boolean
>
planRecognWhiteReStart
(
PlanRecognReq
planRecognReq
);
}
refined-manager/src/main/java/com/mortals/xhx/module/hik/face/service/impl/HikPlanServiceImpl.java
View file @
178b82d7
...
...
@@ -203,4 +203,25 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe
return
Rest
.
fail
(
e
.
getMessage
());
}
}
@Override
public
Rest
<
Boolean
>
planRecognWhiteReStart
(
PlanRecognReq
planRecognReq
)
{
ArtemisConfig
config
=
getArtemisConfig
();
String
getCamsApi
=
ARTEMIS_PATH
+
"/api/frs/v1/plan/recognition/white/restart"
;
path
.
put
(
protocol
,
getCamsApi
);
try
{
String
respJson
=
ArtemisHttpUtil
.
doPostStringArtemis
(
config
,
path
,
JSON
.
toJSONString
(
planRecognReq
),
null
,
null
,
"application/json"
);
HikApiRest
<
Boolean
>
rest
=
JSON
.
parseObject
(
respJson
,
new
TypeReference
<
HikApiRest
<
Boolean
>>()
{
});
if
(
"0"
.
equals
(
rest
.
getCode
()))
{
return
Rest
.
ok
(
rest
.
getData
());
}
else
{
log
.
info
(
"plan recognize white error restart resp=>{}"
,
respJson
);
return
Rest
.
fail
(
rest
.
getMsg
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"plan recognize white erstart error异常"
,
e
);
return
Rest
.
fail
(
e
.
getMessage
());
}
}
}
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