Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
ac0a35f2
Commit
ac0a35f2
authored
Aug 05, 2025
by
hcing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(tzs): 人员列表调整数据源,从es查询
parent
4df63d57
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
375 additions
and
115 deletions
+375
-115
EsUserInfo.java
...eejoin/amos/boot/module/common/api/entity/EsUserInfo.java
+20
-0
TZSCommonServiceImpl.java
.../module/common/biz/service/impl/TZSCommonServiceImpl.java
+123
-0
CommonMapper.java
.../yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
+10
-0
DataHandlerServiceImpl.java
...ot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
+9
-3
ComprehensiveStatisticalAnalysisServiceImpl.java
...ice/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
+4
-92
TzsUserInfoMapper.java
...in/amos/boot/module/tcm/api/mapper/TzsUserInfoMapper.java
+10
-0
ITzsUserInfoService.java
...amos/boot/module/tcm/api/service/ITzsUserInfoService.java
+3
-0
TzsUserInfoController.java
...boot/module/tcm/biz/controller/TzsUserInfoController.java
+11
-1
CommonRefreshService.java
...mos/boot/module/tcm/biz/refresh/CommonRefreshService.java
+7
-0
UserRefreshHandler.java
...ot/module/tcm/biz/refresh/handler/UserRefreshHandler.java
+2
-0
TzsUserInfoServiceImpl.java
...t/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
+176
-19
No files found.
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/entity/EsUserInfo.java
View file @
ac0a35f2
...
...
@@ -195,6 +195,26 @@ public class EsUserInfo {
@Field
(
type
=
FieldType
.
Date
,
format
=
DateFormat
.
date
)
private
LocalDate
licenseMinExpiryDate
;
/**
* 绑定设备状态
* 已绑定 : "1"
* 未绑定 : "0"
*/
@Field
(
type
=
FieldType
.
Keyword
)
private
String
bindEquStatus
;
/**
* 绑定的平台账号用户id
*/
@Field
(
type
=
FieldType
.
Keyword
)
private
String
amosUserId
;
/**
* 绑定的平台账号用户名称
*/
@Field
(
type
=
FieldType
.
Text
)
private
String
amosUserName
;
@Data
public
static
class
License
{
...
...
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/TZSCommonServiceImpl.java
0 → 100644
View file @
ac0a35f2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
javax.annotation.PostConstruct
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Service
public
class
TZSCommonServiceImpl
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
public
static
final
String
overdue
=
"overdue"
;
public
static
final
String
near
=
"near"
;
public
static
final
String
normal
=
"normal"
;
public
static
final
String
none
=
"none"
;
public
static
final
String
noLicense
=
"noLicense"
;
public
static
final
String
noLicenseReq
=
"noLicenseReq"
;
public
static
final
Map
<
String
,
String
>
licensesStatusMap
=
new
HashMap
<>(
6
);
public
static
final
Map
<
String
,
String
>
permitStatusMap
=
new
HashMap
<>(
4
);
public
static
final
Map
<
String
,
String
>
inspectionStatusMap
=
new
HashMap
<>(
4
);
@PostConstruct
public
void
init
()
{
permitStatusMap
.
put
(
overdue
,
"许可超期"
);
permitStatusMap
.
put
(
near
,
"许可临期"
);
permitStatusMap
.
put
(
normal
,
"许可正常"
);
permitStatusMap
.
put
(
none
,
"无有效期"
);
inspectionStatusMap
.
put
(
overdue
,
"检验超期"
);
inspectionStatusMap
.
put
(
near
,
"检验临期"
);
inspectionStatusMap
.
put
(
normal
,
"检验正常"
);
inspectionStatusMap
.
put
(
none
,
"无下次检验日期"
);
licensesStatusMap
.
put
(
overdue
,
"资质超期"
);
licensesStatusMap
.
put
(
near
,
"资质临期"
);
licensesStatusMap
.
put
(
normal
,
"资质正常"
);
licensesStatusMap
.
put
(
none
,
"无有效期"
);
licensesStatusMap
.
put
(
noLicense
,
"无资质"
);
licensesStatusMap
.
put
(
noLicenseReq
,
"无资质要求"
);
}
/**
* 获取用户的资质状态-从统计服务-综合统计迁移而来
*
* @param esUserInfoJson es中的用户数据
* @return 用户的资质状态
*/
public
String
getLicensesStatusWithEsUserInfo
(
JSONObject
esUserInfoJson
,
String
licensesStatusStr
)
{
String
licensesStatus
=
null
;
if
(
esUserInfoJson
.
containsKey
(
"licenses"
))
{
// 以下人员类型有资质要求
// 人员类型(newPost):检验人员:66151、检测人员:66152
// 人员子类型(subPost): 持证人员:6713、持证人员(P):6764、持证人员(R2):6765
String
newPost
=
ObjectUtils
.
isEmpty
(
esUserInfoJson
.
getString
(
"newPost"
))
?
""
:
esUserInfoJson
.
getString
(
"newPost"
);
String
subPost
=
ObjectUtils
.
isEmpty
(
esUserInfoJson
.
getString
(
"subPost"
))
?
""
:
esUserInfoJson
.
getString
(
"subPost"
);
if
(
newPost
.
contains
(
"66151"
)
||
newPost
.
contains
(
"66152"
)
||
subPost
.
contains
(
"6713"
)
||
subPost
.
contains
(
"6764"
)
||
subPost
.
contains
(
"6765"
))
{
JSONArray
licenses
=
esUserInfoJson
.
getJSONArray
(
"licenses"
);
String
overdueStr
=
licensesStatusMap
.
get
(
overdue
);
String
nearStr
=
licensesStatusMap
.
get
(
near
);
String
normalStr
=
licensesStatusMap
.
get
(
normal
);
String
noneStr
=
licensesStatusMap
.
get
(
none
);
if
(!
ObjectUtils
.
isEmpty
(
licenses
))
{
if
(!
""
.
equals
(
licensesStatusStr
))
{
licensesStatus
=
licensesStatusMap
.
get
(
licensesStatusStr
);
}
else
{
List
<
String
>
permissionStatusList
=
new
ArrayList
<>();
for
(
Object
object
:
licenses
)
{
JSONObject
json
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
object
));
if
(!
json
.
containsKey
(
"expiryDate"
))
{
permissionStatusList
.
add
(
noneStr
);
continue
;
}
String
expiryDate
=
json
.
getString
(
"expiryDate"
);
if
(!
ObjectUtils
.
isEmpty
(
expiryDate
))
{
long
daysBetween
=
ChronoUnit
.
DAYS
.
between
(
LocalDate
.
now
(),
LocalDate
.
parse
(
expiryDate
,
formatter
));
if
(
daysBetween
<
0
)
{
permissionStatusList
.
add
(
overdueStr
);
}
else
if
(
daysBetween
<=
30
)
{
permissionStatusList
.
add
(
nearStr
);
}
else
{
permissionStatusList
.
add
(
normalStr
);
}
}
}
long
cq
=
permissionStatusList
.
stream
().
filter
(
e
->
e
.
equals
(
overdueStr
)).
count
();
long
lq
=
permissionStatusList
.
stream
().
filter
(
e
->
e
.
equals
(
nearStr
)).
count
();
long
no
=
permissionStatusList
.
stream
().
filter
(
e
->
e
.
equals
(
noneStr
)).
count
();
long
zc
=
permissionStatusList
.
stream
().
filter
(
e
->
e
.
equals
(
normalStr
)).
count
();
// 需按照资质严重顺序进行判断,先判断超期,再判断临期,再判断无有效期,最后判断正常
if
(
cq
>
0
)
{
licensesStatus
=
overdueStr
;
}
else
if
(
lq
>
0
)
{
licensesStatus
=
nearStr
;
}
else
if
(
no
>
0
)
{
licensesStatus
=
noneStr
;
}
else
if
(
zc
>
0
)
{
licensesStatus
=
normalStr
;
}
}
}
else
{
licensesStatus
=
licensesStatusMap
.
get
(
noLicense
);
}
}
else
{
licensesStatus
=
!
""
.
equals
(
licensesStatusStr
)
?
licensesStatusMap
.
get
(
licensesStatusStr
)
:
licensesStatusMap
.
get
(
noLicenseReq
);
}
}
return
licensesStatus
;
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
View file @
ac0a35f2
...
...
@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.EquipmentClassifyDto;
import
com.yeejoin.amos.boot.module.jg.api.dto.ReportAnalysisSearchDTO
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -326,5 +327,14 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
List
<
CountDto
>
countBizNumAfterUseRegBatchProjectContraption
(
@Param
(
"projectContraptionIds"
)
List
<
Long
>
projectContraptionIds
);
List
<
Map
<
String
,
String
>>
gdEquOnJgServiceOperationRecords
(
@Param
(
"record"
)
String
record
);
/**
* 用户绑定设备数量
*
* @param userSeq 用户userId
* @return 数量
*/
@Select
(
"SELECT count(1) from tzs_user_equip where user_seq = #{userSeq}"
)
Integer
queryUserBindEquNum
(
@Param
(
"userSeq"
)
String
userSeq
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
View file @
ac0a35f2
...
...
@@ -30,13 +30,13 @@ import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import
com.yeejoin.amos.boot.module.common.api.entity.EsBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.common.api.entity.EsUserInfo
;
import
com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission
;
import
com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum
;
import
com.yeejoin.amos.boot.module.common.biz.refresh.cm.RefreshCmService
;
import
com.yeejoin.amos.boot.module.common.biz.utils.RefreshDataUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
...
...
@@ -1486,6 +1486,8 @@ public class DataHandlerServiceImpl {
esUserInfo
.
setSubPost
(
RefreshDataUtils
.
castStrList2String
(
u
.
getSubPost
()));
esUserInfo
.
setEquipType
(
RefreshDataUtils
.
castStrList2String
(
u
.
getEquipType
()));
esUserInfo
.
setEquipTypeName
(
RefreshDataUtils
.
castEquCategory2Name
(
esUserInfo
.
getEquipType
()));
// 绑定设备状态
esUserInfo
.
setBindEquStatus
(
this
.
queryUserBindEquStatus
(
u
.
getSequenceNbr
()));
// 人员类型暂时取esBaseEnterpriseInfo按照资质分开后的,等检验和检测分开后,按照实际情况取就即可:useCodeEnterpriseMap.getOrDefault(u.getUnitCode(), new TzBaseEnterpriseInfo()).getUnitType()
String
unitType
=
esUseCodeEnterpriseMap
.
getOrDefault
(
u
.
getUnitCode
(),
useCodeEnterpriseMap
.
getOrDefault
(
u
.
getUnitCode
(),
new
TzBaseEnterpriseInfo
()).
getUnitType
());
esUserInfo
.
setUnitType
(
unitType
);
...
...
@@ -1502,6 +1504,10 @@ public class DataHandlerServiceImpl {
return
units
.
size
();
}
private
String
queryUserBindEquStatus
(
Long
sequenceNbr
)
{
return
commonMapper
.
queryUserBindEquNum
(
sequenceNbr
.
toString
())
>
0
?
"1"
:
"0"
;
}
private
List
<
EsUserInfo
.
License
>
buildUserLicenses
(
Long
sequenceNbr
)
{
List
<
TzsUserPermission
>
permissions
=
userPermissionMapper
.
selectList
(
new
LambdaQueryWrapper
<
TzsUserPermission
>().
eq
(
TzsUserPermission:
:
getUserSeq
,
sequenceNbr
));
return
permissions
.
stream
().
map
(
p
->
{
...
...
@@ -1625,7 +1631,7 @@ public class DataHandlerServiceImpl {
Page
<
String
>
refreshRecords
=
useInfoService
.
getBaseMapper
().
selectAddDataRecords
(
recordDtoPage
);
if
(!
ObjectUtils
.
isEmpty
(
refreshRecords
)&&
refreshRecords
.
getRecords
().
size
()
>
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
refreshRecords
)
&&
refreshRecords
.
getRecords
().
size
()
>
0
)
{
List
<
String
>
records
=
refreshRecords
.
getRecords
();
StopWatch
watch0
=
new
StopWatch
();
watch0
.
start
();
...
...
@@ -1752,7 +1758,7 @@ public class DataHandlerServiceImpl {
Page
<
String
>
refreshRecords
=
useInfoService
.
getBaseMapper
().
selectPiPeRecords
(
recordDtoPage
);
if
(!
ObjectUtils
.
isEmpty
(
refreshRecords
)&&
refreshRecords
.
getRecords
().
size
()
>
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
refreshRecords
)
&&
refreshRecords
.
getRecords
().
size
()
>
0
)
{
List
<
String
>
records
=
refreshRecords
.
getRecords
();
StopWatch
watch0
=
new
StopWatch
();
watch0
.
start
();
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
View file @
ac0a35f2
...
...
@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import
com.yeejoin.amos.boot.biz.common.utils.RequestContextWrapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.TechParamItem
;
import
com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.TZSCommonServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.utils.TechParamUtil
;
import
com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils
;
import
com.yeejoin.amos.boot.module.statistcs.biz.utils.MinioUtils
;
...
...
@@ -67,7 +68,6 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import
org.typroject.tyboot.core.foundation.exception.BaseException
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
javax.annotation.PostConstruct
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.nio.charset.StandardCharsets
;
...
...
@@ -84,6 +84,7 @@ import java.util.function.BiConsumer;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
.
TZSCommonServiceImpl
.*;
import
static
org
.
elasticsearch
.
index
.
query
.
QueryBuilders
.
existsQuery
;
/**
...
...
@@ -107,6 +108,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
private
final
DataDictionaryServiceImpl
dataDictionaryService
;
private
final
DataDictionaryMapper
dataDictionaryMapper
;
private
final
EmqKeeper
emqKeeper
;
private
final
TZSCommonServiceImpl
tzsCommonService
;
private
final
RestHighLevelClient
restHighLevelClient
;
private
final
String
DOWN_LOAD_START_TEMP
=
"{\"id\":\"%s\",\"status\":\"starting\",\"fileName\":\"%s\",\"time\":\"%s\"}"
;
...
...
@@ -134,38 +136,6 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
private
static
final
Map
<
String
,
String
>
permitStatusMap
=
new
HashMap
<>(
4
);
private
static
final
Map
<
String
,
String
>
licensesStatusMap
=
new
HashMap
<>(
6
);
private
static
final
Map
<
String
,
String
>
inspectionStatusMap
=
new
HashMap
<>(
4
);
private
static
final
String
overdue
=
"overdue"
;
private
static
final
String
near
=
"near"
;
private
static
final
String
normal
=
"normal"
;
private
static
final
String
none
=
"none"
;
private
static
final
String
noLicense
=
"noLicense"
;
private
static
final
String
noLicenseReq
=
"noLicenseReq"
;
@PostConstruct
public
void
init
()
{
permitStatusMap
.
put
(
overdue
,
"许可超期"
);
permitStatusMap
.
put
(
near
,
"许可临期"
);
permitStatusMap
.
put
(
normal
,
"许可正常"
);
permitStatusMap
.
put
(
none
,
"无有效期"
);
inspectionStatusMap
.
put
(
overdue
,
"检验超期"
);
inspectionStatusMap
.
put
(
near
,
"检验临期"
);
inspectionStatusMap
.
put
(
normal
,
"检验正常"
);
inspectionStatusMap
.
put
(
none
,
"无下次检验日期"
);
licensesStatusMap
.
put
(
overdue
,
"资质超期"
);
licensesStatusMap
.
put
(
near
,
"资质临期"
);
licensesStatusMap
.
put
(
normal
,
"资质正常"
);
licensesStatusMap
.
put
(
none
,
"无有效期"
);
licensesStatusMap
.
put
(
noLicense
,
"无资质"
);
licensesStatusMap
.
put
(
noLicenseReq
,
"无资质要求"
);
}
public
List
<
Map
<
String
,
Object
>>
queryEquipmentCategory
(
String
key
)
{
List
<
Map
<
String
,
Object
>>
list
;
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
resourceJson
=
JsonUtils
.
getResourceJson
(
equipCategory
);
...
...
@@ -373,65 +343,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
dto
.
put
(
"equipType"
,
equipTypes
.
substring
(
0
,
equipTypes
.
length
()
-
1
));
}
String
licensesStatus
=
null
;
if
(
dto
.
containsKey
(
"licenses"
))
{
// 以下人员类型有资质要求
// 人员类型(newPost):检验人员:66151、检测人员:66152
// 人员子类型(subPost): 持证人员:6713、持证人员(P):6764、持证人员(R2):6765
String
newPost
=
ObjectUtils
.
isEmpty
(
dto
.
getString
(
"newPost"
))
?
""
:
dto
.
getString
(
"newPost"
);
String
subPost
=
ObjectUtils
.
isEmpty
(
dto
.
getString
(
"subPost"
))
?
""
:
dto
.
getString
(
"subPost"
);
if
(
newPost
.
contains
(
"66151"
)
||
newPost
.
contains
(
"66152"
)
||
subPost
.
contains
(
"6713"
)
||
subPost
.
contains
(
"6764"
)
||
subPost
.
contains
(
"6765"
))
{
JSONArray
licenses
=
dto
.
getJSONArray
(
"licenses"
);
String
overdueStr
=
licensesStatusMap
.
get
(
overdue
);
String
nearStr
=
licensesStatusMap
.
get
(
near
);
String
normalStr
=
licensesStatusMap
.
get
(
normal
);
String
noneStr
=
licensesStatusMap
.
get
(
none
);
if
(!
ObjectUtils
.
isEmpty
(
licenses
))
{
if
(!
""
.
equals
(
licensesStatusStr
))
{
licensesStatus
=
licensesStatusMap
.
get
(
licensesStatusStr
);
}
else
{
List
<
String
>
permissionStatusList
=
new
ArrayList
<>();
for
(
Object
object
:
licenses
)
{
JSONObject
json
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
object
));
if
(!
json
.
containsKey
(
"expiryDate"
))
{
permissionStatusList
.
add
(
noneStr
);
continue
;
}
String
expiryDate
=
json
.
getString
(
"expiryDate"
);
if
(!
ObjectUtils
.
isEmpty
(
expiryDate
))
{
long
daysBetween
=
ChronoUnit
.
DAYS
.
between
(
LocalDate
.
now
(),
LocalDate
.
parse
(
expiryDate
,
formatter
));
if
(
daysBetween
<
0
)
{
permissionStatusList
.
add
(
overdueStr
);
}
else
if
(
daysBetween
<=
30
)
{
permissionStatusList
.
add
(
nearStr
);
}
else
{
permissionStatusList
.
add
(
normalStr
);
}
}
}
long
cq
=
permissionStatusList
.
stream
().
filter
(
e
->
e
.
equals
(
overdueStr
)).
count
();
long
lq
=
permissionStatusList
.
stream
().
filter
(
e
->
e
.
equals
(
nearStr
)).
count
();
long
no
=
permissionStatusList
.
stream
().
filter
(
e
->
e
.
equals
(
noneStr
)).
count
();
long
zc
=
permissionStatusList
.
stream
().
filter
(
e
->
e
.
equals
(
normalStr
)).
count
();
// 需按照资质严重顺序进行判断,先判断超期,再判断临期,再判断无有效期,最后判断正常
if
(
cq
>
0
)
{
licensesStatus
=
overdueStr
;
}
else
if
(
lq
>
0
)
{
licensesStatus
=
nearStr
;
}
else
if
(
no
>
0
)
{
licensesStatus
=
noneStr
;
}
else
if
(
zc
>
0
)
{
licensesStatus
=
normalStr
;
}
}
}
else
{
licensesStatus
=
licensesStatusMap
.
get
(
noLicense
);
}
}
else
{
licensesStatus
=
!
""
.
equals
(
licensesStatusStr
)
?
licensesStatusMap
.
get
(
licensesStatusStr
)
:
licensesStatusMap
.
get
(
noLicenseReq
);
}
}
dto
.
put
(
"licensesStatus"
,
licensesStatus
);
dto
.
put
(
"licensesStatus"
,
tzsCommonService
.
getLicensesStatusWithEsUserInfo
(
dto
,
licensesStatusStr
));
list
.
add
(
dto
);
}
totle
=
Objects
.
requireNonNull
(
response
.
getInternalResponse
().
hits
().
getTotalHits
()).
value
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/mapper/TzsUserInfoMapper.java
View file @
ac0a35f2
...
...
@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import
com.yeejoin.amos.boot.module.tcm.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.tcm.api.vo.UserInfoVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -61,4 +62,13 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
* @return 对象列表
*/
List
<
UserPermissionDto
>
queryUserByPermissionOfOneCompany
(
@Param
(
"filter"
)
UserPermissionDto
filter
);
/**
* 用户绑定设备数量
*
* @param userSeq 用户userId
* @return 数量
*/
@Select
(
"SELECT count(1) from tzs_user_equip where user_seq = #{userSeq}"
)
Integer
queryUserBindEquNum
(
@Param
(
"userSeq"
)
String
userSeq
);
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/service/ITzsUserInfoService.java
View file @
ac0a35f2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
api
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
...
...
@@ -102,4 +103,6 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
TzIndividualityDto
individualityByCompanyCode
(
String
companyCode
);
TzIndividualityDto
personalInfoUpdateById
(
Map
<
String
,
Object
>
map
);
IPage
<
JSONObject
>
queryESForPage
(
ReginParams
reginParams
,
String
current
,
String
size
,
String
sort
,
Map
<
String
,
String
>
map
);
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/controller/TzsUserInfoController.java
View file @
ac0a35f2
...
...
@@ -143,6 +143,16 @@ public class TzsUserInfoController extends BaseController {
return
ResponseHelper
.
buildResponse
(
tzsUserInfoService
.
page
(
dto
,
page
,
sort
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/queryESForPage"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"人员信息列表,从ES中获取数据"
,
notes
=
"人员信息列表,替换掉原先的从数据库查询的接口,用于监管和企业的人员管理列表"
)
public
ResponseModel
<
IPage
<
JSONObject
>>
queryESForPage
(
@RequestParam
(
value
=
"current"
)
String
current
,
@RequestParam
(
value
=
"size"
)
String
size
,
@RequestParam
(
value
=
"sort"
,
required
=
false
)
String
sort
,
@RequestParam
Map
<
String
,
String
>
map
)
{
return
ResponseHelper
.
buildResponse
(
tzsUserInfoService
.
queryESForPage
(
getSelectedOrgInfo
(),
current
,
size
,
sort
,
map
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/createUnitPerson"
)
...
...
@@ -328,7 +338,7 @@ public class TzsUserInfoController extends BaseController {
filter
.
setOrgCode
(
getSelectedOrgInfo
().
getCompany
().
getOrgCode
());
filter
.
setCityCode
(
getSelectedOrgInfo
().
getCompany
().
getCompanyCode
());
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
if
(!
ValidationUtil
.
isEmpty
(
map
.
get
(
"createDateRange"
))){
if
(!
ValidationUtil
.
isEmpty
(
map
.
get
(
"createDateRange"
)))
{
String
createDateRangeObj
=
Objects
.
toString
(
map
.
get
(
"createDateRange"
));
String
[]
split
=
createDateRangeObj
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
split
(
","
);
String
startDateStr
=
split
[
0
];
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/refresh/CommonRefreshService.java
View file @
ac0a35f2
...
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.yeejoin.amos.boot.module.common.api.entity.EsUserInfo
;
import
com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission
;
import
com.yeejoin.amos.boot.module.common.biz.utils.RefreshDataUtils
;
import
com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper
;
import
com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserPermissionMapper
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
...
...
@@ -16,6 +17,8 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public
class
CommonRefreshService
{
private
final
TzsUserInfoMapper
userInfoMapper
;
private
final
TzsUserPermissionMapper
userPermissionMapper
;
public
List
<
EsUserInfo
.
License
>
buildUserLicenses
(
Long
sequenceNbr
)
{
...
...
@@ -28,4 +31,8 @@ public class CommonRefreshService {
return
license
;
}).
collect
(
Collectors
.
toList
());
}
public
String
queryUserBindEquStatus
(
Long
userSeq
)
{
return
userInfoMapper
.
queryUserBindEquNum
(
userSeq
.
toString
())
>
0
?
"1"
:
"0"
;
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/refresh/handler/UserRefreshHandler.java
View file @
ac0a35f2
...
...
@@ -69,6 +69,8 @@ public class UserRefreshHandler implements IDataRefreshHandler {
esUserInfo
.
setSubPost
(
RefreshDataUtils
.
castStrList2String
(
userInfo
.
getSubPost
()));
esUserInfo
.
setEquipType
(
RefreshDataUtils
.
castStrList2String
(
userInfo
.
getEquipType
()));
esUserInfo
.
setEquipTypeName
(
RefreshDataUtils
.
castEquCategory2Name
(
esUserInfo
.
getEquipType
()));
// 绑定设备状态
esUserInfo
.
setBindEquStatus
(
commonRefreshService
.
queryUserBindEquStatus
(
userInfo
.
getSequenceNbr
()));
Optional
<
EsBaseEnterpriseInfo
>
esBaseEnterpriseInfo
=
esBaseEnterpriseInfoDao
.
findById
(
unit
.
getSequenceNbr
()
+
""
);
// 人员类型暂时取esBaseEnterpriseInfo按照资质分开后的,等检验和检测分开后,按照实际情况取就即可:unit.getUnitType()
String
unitType
=
esBaseEnterpriseInfo
.
map
(
EsBaseEnterpriseInfo:
:
getUnitType
).
orElse
(
unit
.
getUnitType
());
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
View file @
ac0a35f2
...
...
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
@@ -22,6 +23,7 @@ import com.google.common.collect.Lists;
import
com.google.common.collect.Sets
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
...
...
@@ -32,6 +34,7 @@ import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import
com.yeejoin.amos.boot.module.common.api.dto.UserPermissionDto
;
import
com.yeejoin.amos.boot.module.common.biz.event.CommonPublisher
;
import
com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.TZSCommonServiceImpl
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.*
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.*
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.EquipmentClassifityEnum
;
...
...
@@ -60,6 +63,16 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.ehcache.impl.internal.concurrent.ConcurrentHashMap
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.Operator
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -89,6 +102,8 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -138,6 +153,12 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
@Autowired
private
CommonPublisher
publisher
;
@Autowired
private
RestHighLevelClient
restHighLevelClient
;
@Autowired
private
TZSCommonServiceImpl
tzsCommonService
;
private
static
Map
<
String
,
String
>
statusColorMap
=
new
HashMap
<>();
static
{
...
...
@@ -330,7 +351,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
deleteGroupAndPersonRelation
(
userInfo
.
getPostName
(),
userInfo
.
getAmosUserId
());
}
}
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
ids
,
DataRefreshEvent
.
DataType
.
user
.
name
(),
DataRefreshEvent
.
Operation
.
DELETE
));
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
ids
,
DataRefreshEvent
.
DataType
.
user
.
name
(),
DataRefreshEvent
.
Operation
.
DELETE
));
}
...
...
@@ -666,6 +687,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
equipBind
(
String
type
,
String
userSeq
,
String
creditCode
,
Map
<
String
,
Object
>
map
)
{
Object
recordList
=
map
.
get
(
"ids"
);
List
<
String
>
ids
=
(
List
<
String
>)
recordList
;
...
...
@@ -684,6 +706,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
int
num
=
tzsUserEquipMapper
.
delete
(
new
QueryWrapper
<
TzsUserEquip
>().
eq
(
"user_seq"
,
userSeq
).
in
(
"equip_id"
,
ids
));
flag
=
num
>
0
?
true
:
flag
;
}
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
userSeq
),
DataRefreshEvent
.
DataType
.
user
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
));
return
flag
;
}
...
...
@@ -856,7 +879,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
Optional
.
of
(
deleteUserIds
)
.
filter
(
ids
->
!
ObjectUtils
.
isEmpty
(
ids
))
.
ifPresent
(
ids
->
Privilege
.
agencyUserClient
.
multDeleteUser
(
ids
));
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Lists
.
transform
(
seqNbrs
,
Functions
.
toStringFunction
()),
DataRefreshEvent
.
DataType
.
user
.
name
(),
DataRefreshEvent
.
Operation
.
DELETE
));
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Lists
.
transform
(
seqNbrs
,
Functions
.
toStringFunction
()),
DataRefreshEvent
.
DataType
.
user
.
name
(),
DataRefreshEvent
.
Operation
.
DELETE
));
return
Boolean
.
TRUE
;
}
...
...
@@ -988,7 +1011,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
Privilege
.
agencyUserClient
.
modifyMobile
(
userModel
,
userModel
.
getUserId
());
}
}
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
individualityDto
.
getEnterpriseId
()
+
""
),
DataRefreshEvent
.
DataType
.
enterprise
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
));
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
individualityDto
.
getEnterpriseId
()
+
""
),
DataRefreshEvent
.
DataType
.
enterprise
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
));
return
individualityDto
;
}
...
...
@@ -1139,7 +1162,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
tzsUserInfo
=
this
.
createWithModel
(
tzsUserInfo
);
// 保存资质
tzsUserPermissionServiceImpl
.
savePermissionData
(
tzsUserInfo
);
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
tzsUserInfo
.
getSequenceNbr
()
+
""
),
DataRefreshEvent
.
DataType
.
user
.
name
(),
DataRefreshEvent
.
Operation
.
INSERT
));
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
tzsUserInfo
.
getSequenceNbr
()
+
""
),
DataRefreshEvent
.
DataType
.
user
.
name
(),
DataRefreshEvent
.
Operation
.
INSERT
));
return
tzsUserInfo
;
}
...
...
@@ -1289,7 +1312,6 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
this
.
updateWithModel
(
tzsUserInfoDto
);
// 更新人员信息同步平台
syncNewPost
(
tzsUserInfoDto
);
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
rowId
+
""
),
DataRefreshEvent
.
DataType
.
user
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
));
return
tzsUserInfoDto
;
}
...
...
@@ -1389,6 +1411,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
log
.
error
(
e
.
getMessage
());
}
}
/**
* 发送主题消息,给企业推送excel 结束下载提醒
*
...
...
@@ -1575,7 +1598,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
.
select
(
TzsUserInfo:
:
getSequenceNbr
)
.
eq
(
TzsUserInfo:
:
getPhone
,
userItems
.
getPhone
())
.
eq
(
TzsUserInfo:
:
getUnitCode
,
company
.
getCompanyCode
())
.
eq
(
TzsUserInfo:
:
getIsDelete
,
Boolean
.
FALSE
)).
isEmpty
())
{
//2.2 本单位人员比较
.
eq
(
TzsUserInfo:
:
getIsDelete
,
Boolean
.
FALSE
)).
isEmpty
())
{
//
2.2 本单位人员比较
errors
.
add
(
"第"
+
excelRowNum
+
"行,错误信息->"
+
"手机号已经绑定本单位人员"
);
}
else
{
phoneOnly
.
put
(
key
,
userItems
.
getPhone
());
...
...
@@ -1588,7 +1611,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
.
select
(
TzsUserInfo:
:
getSequenceNbr
)
.
eq
(
TzsUserInfo:
:
getCertificateNum
,
userItems
.
getCertificateNum
())
.
eq
(
TzsUserInfo:
:
getUnitCode
,
company
.
getCompanyCode
())
.
eq
(
TzsUserInfo:
:
getIsDelete
,
Boolean
.
FALSE
)).
isEmpty
())
{
//2.2 本单位人员比较
.
eq
(
TzsUserInfo:
:
getIsDelete
,
Boolean
.
FALSE
)).
isEmpty
())
{
//
2.2 本单位人员比较
errors
.
add
(
"第"
+
excelRowNum
+
"行,错误信息->"
+
"证件编号已经绑定本单位人员"
);
}
else
{
certificateNumOnly
.
put
(
userItems
.
getCertificateNum
(),
userItems
.
getName
());
...
...
@@ -1597,7 +1620,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
Map
<
String
,
String
>
allPostNames
=
this
.
postByUnitType
(
company
).
stream
().
collect
(
Collectors
.
toMap
(
DataDictionary:
:
getName
,
DataDictionary:
:
getCode
));
String
postNameStr
=
userItems
.
getPost
();
if
(!
ValidationUtil
.
isEmpty
(
postNameStr
))
{
List
<
String
>
postNameList
=
Arrays
.
asList
(
postNameStr
.
replace
(
","
,
","
).
replace
(
"-"
,
","
).
replace
(
"\n"
,
""
).
split
(
","
));
List
<
String
>
postNameList
=
Arrays
.
asList
(
postNameStr
.
replace
(
","
,
","
).
replace
(
"-"
,
","
).
replace
(
"\n"
,
""
).
split
(
","
));
// postNameList 中,不存在于 allPostNames 中的元素
List
<
String
>
notExistPosts
=
postNameList
.
stream
()
.
filter
(
p
->
!
allPostNames
.
containsKey
(
p
))
...
...
@@ -1617,7 +1640,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
// 5.人员类型和人员子类型的匹配
String
subPost
=
userItems
.
getSubPost
();
if
(!
ValidationUtil
.
isEmpty
(
subPost
))
{
String
subPostStr
=
subPost
.
replace
(
","
,
","
).
replace
(
"-"
,
","
).
replace
(
"\n"
,
""
);
String
subPostStr
=
subPost
.
replace
(
","
,
","
).
replace
(
"-"
,
","
).
replace
(
"\n"
,
""
);
List
<
String
>
subPostList
=
Arrays
.
asList
(
subPostStr
.
split
(
","
));
String
postCode
=
this
.
postByUnitType
(
company
).
stream
().
filter
(
item
->
item
.
getName
().
equals
(
postName
)).
map
(
DataDictionary:
:
getCode
).
findFirst
().
orElse
(
""
);
Map
<
String
,
String
>
allSubPostNames
=
this
.
subPostByUnitType
(
company
,
postCode
).
stream
().
collect
(
Collectors
.
toMap
(
DataDictionary:
:
getName
,
DataDictionary:
:
getCode
));
...
...
@@ -1727,10 +1750,10 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
OperatorQua
.
setJobItem
(
objects
);
JSONObject
itemCode
=
new
JSONObject
();
if
(!
ValidationUtil
.
isEmpty
(
OperatorQua
.
getFJSHJCZItemCode
()))
{
itemCode
.
fluentPut
(
"FJSHJCZItemCode"
,
OperatorQua
.
getFJSHJCZItemCode
());
itemCode
.
fluentPut
(
"FJSHJCZItemCode"
,
OperatorQua
.
getFJSHJCZItemCode
());
}
if
(!
ValidationUtil
.
isEmpty
(
OperatorQua
.
getJSHJCZItemCode
()))
{
itemCode
.
fluentPut
(
"JSHJCZItemCode"
,
OperatorQua
.
getJSHJCZItemCode
());
itemCode
.
fluentPut
(
"JSHJCZItemCode"
,
OperatorQua
.
getJSHJCZItemCode
());
}
OperatorQua
.
setItemCode
(
itemCode
);
permissionData6552
.
add
(
OperatorQua
);
...
...
@@ -2226,9 +2249,9 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
String
postCode
=
entry
.
getKey
();
// 主岗位
JsonNode
subPostCode
=
entry
.
getValue
();
// 子岗位
// 确保最大范围包含子类型
if
(
subPostCode
.
isEmpty
()){
if
(
subPostCode
.
isEmpty
())
{
allPostUnderTheUnit
.
put
(
postCode
,
subPostCode
);
}
else
{
}
else
{
allPostUnderTheUnit
.
putIfAbsent
(
postCode
,
subPostCode
);
}
}
...
...
@@ -2276,7 +2299,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
return
individuality
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
TzIndividualityDto
personalInfoUpdateById
(
Map
<
String
,
Object
>
map
)
{
TzsBaseIndividuality
individuality
=
individualityMapper
.
selectById
(
Long
.
valueOf
(
map
.
get
(
"sequenceNbr"
).
toString
()));
...
...
@@ -2298,14 +2321,14 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
TzIndividualityDto
individualityDto
=
new
TzIndividualityDto
();
BeanUtils
.
copyProperties
(
individuality
,
individualityDto
);
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
individualityDto
.
getEnterpriseId
()
+
""
),
DataRefreshEvent
.
DataType
.
enterprise
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
));
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
individualityDto
.
getEnterpriseId
()
+
""
),
DataRefreshEvent
.
DataType
.
enterprise
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
));
return
individualityDto
;
}
private
void
syncNewPost
(
TzsUserInfoDto
tzsUserInfoDto
)
{
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
ObjectUtils
.
isEmpty
(
reginParams
))
{
return
;
return
;
}
Long
companySeq
=
reginParams
.
getCompany
().
getSequenceNbr
();
List
<
String
>
appCodesSet
=
reginParams
.
getUserModel
().
getAppCodes
();
...
...
@@ -2324,8 +2347,8 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
List
<
DataDictionary
>
dataDictionaries
=
iDataDictionaryService
.
lambdaQuery
()
.
in
(
DataDictionary:
:
getType
,
Arrays
.
asList
(
"QYRYJS"
,
"QYRYYHZ"
))
.
eq
(
DataDictionary:
:
getIsDelete
,
false
).
list
();
.
in
(
DataDictionary:
:
getType
,
Arrays
.
asList
(
"QYRYJS"
,
"QYRYYHZ"
))
.
eq
(
DataDictionary:
:
getIsDelete
,
false
).
list
();
List
<
DataDictionary
>
qyrygwList
=
dataDictionaries
.
stream
().
filter
(
item
->
"QYRYJS"
.
equals
(
item
.
getType
())).
collect
(
Collectors
.
toList
());
List
<
DataDictionary
>
qyryyhzList
=
dataDictionaries
.
stream
().
filter
(
item
->
"QYRYYHZ"
.
equals
(
item
.
getType
())).
collect
(
Collectors
.
toList
());
...
...
@@ -2431,7 +2454,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
String
[]
appCodes
=
appCode
.
split
(
","
);
Collections
.
addAll
(
appCodesSet
,
appCodes
);
userRoleList
.
addAll
(
roleModels
.
stream
()
.
filter
(
r
->
unitType
.
getExtend
().
contains
(
r
.
getSequenceNbr
().
toString
())).
collect
(
Collectors
.
toList
()));
.
filter
(
r
->
unitType
.
getExtend
().
contains
(
r
.
getSequenceNbr
().
toString
())).
collect
(
Collectors
.
toList
()));
userRoleList
.
forEach
(
r
->
{
if
(!
roleIds
.
contains
(
r
.
getSequenceNbr
()))
{
roleIds
.
add
(
r
.
getSequenceNbr
());
...
...
@@ -2497,4 +2520,138 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
}
}
@Override
public
IPage
<
JSONObject
>
queryESForPage
(
ReginParams
reginParams
,
String
current
,
String
size
,
String
sort
,
Map
<
String
,
String
>
map
)
{
int
pageNumber
=
ObjectUtils
.
isEmpty
(
current
)
?
1
:
Integer
.
parseInt
(
current
);
int
pageSize
=
ObjectUtils
.
isEmpty
(
size
)
?
20
:
Integer
.
parseInt
(
size
);
Page
<
JSONObject
>
result
=
new
Page
<>(
pageNumber
,
pageSize
);
String
licensesStatusStr
=
""
;
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
"idx_biz_user_info"
);
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
trackTotalHits
(
true
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
CompanyBo
company
=
reginParams
.
getCompany
();
String
companyType
=
company
.
getCompanyType
();
String
companyLevel
=
company
.
getLevel
();
// 监管查询自己单位下 + 管辖辖区下的数据
if
(
companyLevel
.
equals
(
BaseController
.
COMPANY_TYPE_SUPERVISION
))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
should
(
QueryBuilders
.
termQuery
(
"unitCode"
,
company
.
getCompanyCode
()));
meBuilder
.
should
(
QueryBuilders
.
prefixQuery
(
"superviseOrgCode"
,
company
.
getOrgCode
()));
meBuilder
.
minimumShouldMatch
(
1
);
boolMust
.
must
(
meBuilder
);
}
// 企业只查询自己单位下的
if
(
companyLevel
.
equals
(
BaseController
.
COMPANY_TYPE_COMPANY
))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
termQuery
(
"unitCode"
,
company
.
getCompanyCode
()));
boolMust
.
must
(
meBuilder
);
}
// 系统账号
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"amosUserName"
)))
{
String
amosUserName
=
map
.
get
(
"amosUserName"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchQuery
(
"amosUserName"
,
amosUserName
).
operator
(
Operator
.
AND
));
boolMust
.
must
(
meBuilder
);
}
// 证件编号
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"certificateNum"
)))
{
String
certificateNum
=
map
.
get
(
"certificateNum"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"certificateNum"
,
"*"
+
certificateNum
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
// 姓名
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"name"
)))
{
String
name
=
map
.
get
(
"name"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"name"
,
"*"
+
name
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
// 联系电话
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"phone"
)))
{
String
phone
=
map
.
get
(
"phone"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"phone"
,
"*"
+
phone
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
// 人员类型
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"newPost"
)))
{
String
newPost
=
map
.
get
(
"newPost"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"newPost"
,
"*"
+
newPost
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
// 人员子类型
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"subPost"
)))
{
String
subPost
=
map
.
get
(
"subPost"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"subPost"
,
"*"
+
subPost
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
// 企业名称
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"unitName"
)))
{
String
unitName
=
map
.
get
(
"unitName"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"unitName"
,
"*"
+
unitName
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
// 设备绑定状态
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"bindEquStatus"
)))
{
String
bindEquStatus
=
map
.
get
(
"bindEquStatus"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
termQuery
(
"bindEquStatus"
,
bindEquStatus
));
boolMust
.
must
(
meBuilder
);
}
builder
.
query
(
boolMust
);
builder
.
sort
(
"createDate"
,
SortOrder
.
DESC
);
builder
.
from
((
pageNumber
-
1
)
*
pageSize
);
builder
.
size
(
pageSize
);
request
.
source
(
builder
);
List
<
JSONObject
>
esUserInfoList
=
new
ArrayList
<>();
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
for
(
SearchHit
hit
:
response
.
getHits
().
getHits
())
{
JSONObject
esUserInfo
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
hit
.
getSourceAsMap
()));
// 设备绑定状态
esUserInfo
.
put
(
"bindEquStatus"
,
Optional
.
ofNullable
(
esUserInfo
.
get
(
"bindEquStatus"
))
.
map
(
String:
:
valueOf
)
.
map
(
"1"
::
equals
)
.
map
(
b
->
b
?
"是"
:
"否"
)
.
orElse
(
"否"
));
// 创建时间格式转化
esUserInfo
.
put
(
"createDate"
,
LocalDateTime
.
parse
(
esUserInfo
.
getString
(
"createDate"
),
DateTimeFormatter
.
ISO_LOCAL_DATE_TIME
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
// 资质状态
esUserInfo
.
put
(
"licensesStatus"
,
tzsCommonService
.
getLicensesStatusWithEsUserInfo
(
esUserInfo
,
""
));
esUserInfoList
.
add
(
esUserInfo
);
}
result
.
setTotal
(
Objects
.
requireNonNull
(
response
.
getHits
().
getTotalHits
()).
value
);
result
.
setRecords
(
esUserInfoList
);
}
catch
(
Exception
ex
)
{
throw
new
RuntimeException
(
ex
);
}
return
result
;
}
}
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