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
1b614da7
Commit
1b614da7
authored
Aug 23, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.机器人
parent
19c5eb98
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
301 additions
and
697 deletions
+301
-697
BaseEnterpriseMqTtlListener.java
...le/elevator/biz/listener/BaseEnterpriseMqTtlListener.java
+14
-28
CarcylUnitInspectMqTtlListener.java
...elevator/biz/listener/CarcylUnitInspectMqTtlListener.java
+5
-8
PlatformUserTopicMessage.java
...odule/elevator/biz/listener/PlatformUserTopicMessage.java
+5
-11
PrivilegeCompanyUpdateAddListener.java
...vator/biz/listener/PrivilegeCompanyUpdateAddListener.java
+22
-26
StartPlatformTokenService.java
.../elevator/biz/service/impl/StartPlatformTokenService.java
+5
-25
TzBaseEnterpriseInfoServiceImpl.java
...tor/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+33
-75
application.properties
...odule-96333-biz/src/main/resources/application.properties
+1
-5
StartPlatformTokenService.java
...odule/app/biz/service/impl/StartPlatformTokenService.java
+5
-16
TzBaseEnterpriseInfoServiceImpl.java
...app/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+6
-45
application.properties
...-module-app-biz/src/main/resources/application.properties
+1
-5
StartPlatformTokenService.java
.../cylinder/biz/service/impl/StartPlatformTokenService.java
+3
-22
TzBaseEnterpriseInfoServiceImpl.java
...der/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+34
-76
application.properties
...le-cylinder-biz/src/main/resources/application.properties
+1
-5
PrivilegeCompanyUpdateAddListener.java
.../jczs/biz/listener/PrivilegeCompanyUpdateAddListener.java
+4
-7
StartPlatformTokenService.java
...dule/jczs/biz/service/impl/StartPlatformTokenService.java
+5
-25
TzBaseEnterpriseInfoServiceImpl.java
...czs/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+31
-75
application.properties
...module-jczs-biz/src/main/resources/application.properties
+1
-5
BaseEnterpriseMqTtlListener.java
.../module/tcm/biz/listener/BaseEnterpriseMqTtlListener.java
+16
-30
CarcylUnitInspectMqTtlListener.java
...dule/tcm/biz/listener/CarcylUnitInspectMqTtlListener.java
+19
-25
PlatformUserTopicMessage.java
...oot/module/tcm/biz/listener/PlatformUserTopicMessage.java
+5
-11
PrivilegeCompanyUpdateAddListener.java
...e/tcm/biz/listener/PrivilegeCompanyUpdateAddListener.java
+22
-25
application.properties
...-module-tcm-biz/src/main/resources/application.properties
+1
-5
BaseEnterpriseMqTtlListener.java
.../module/ymt/biz/listener/BaseEnterpriseMqTtlListener.java
+5
-8
CarcylUnitInspectMqTtlListener.java
...dule/ymt/biz/listener/CarcylUnitInspectMqTtlListener.java
+19
-25
PlatformUserTopicMessage.java
...oot/module/ymt/biz/listener/PlatformUserTopicMessage.java
+5
-11
PrivilegeCompanyUpdateAddListener.java
...e/ymt/biz/listener/PrivilegeCompanyUpdateAddListener.java
+22
-26
StartPlatformTokenService.java
...odule/ymt/biz/service/impl/StartPlatformTokenService.java
+4
-24
TzBaseEnterpriseInfoServiceImpl.java
...ymt/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+6
-43
application.properties
...-module-ymt-biz/src/main/resources/application.properties
+1
-5
No files found.
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/listener/BaseEnterpriseMqTtlListener.java
View file @
1b614da7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
elevator
.
biz
.
listener
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.module.elevator.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.DesUtil
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
...
...
@@ -30,8 +13,15 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import
com.yeejoin.amos.feign.privilege.model.ApplicationModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @Description: mqtt监听服务
...
...
@@ -44,11 +34,6 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appkey
;
@Autowired
RedisUtil
redisUtil
;
...
...
@@ -58,6 +43,9 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
@Value
(
"${org.filter.group.seq}"
)
private
Long
groupSeq
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
System
.
out
.
println
(
message
);
...
...
@@ -67,9 +55,7 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
FeignClientResult
<
List
<
ApplicationModel
>>
aResult
=
Privilege
.
applicationClient
.
queryAgencyApplications
();
List
<
ApplicationModel
>
aList
=
aResult
.
getResult
();
// List<String> appCodes = aList.stream().filter(i -> "监管端,企业端".indexOf(i.getAppName()) != -1)
...
...
@@ -144,7 +130,7 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
userModel
.
setAppCodes
(
new
ArrayList
<>(
appCodesSet
));
userModel
.
setOrgRoleSeqs
(
roleSeqMap
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
create
(
userModel
);
String
[]
userIds
=
{
userResult
.
getResult
().
getUserId
()
};
String
[]
userIds
=
{
userResult
.
getResult
().
getUserId
()
};
// if (groupSeq != null) {
// Privilege.groupUserClient.create(groupSeq, Arrays.asList(userIds));
// }
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/listener/CarcylUnitInspectMqTtlListener.java
View file @
1b614da7
...
...
@@ -6,6 +6,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.boot.module.elevator.biz.service.impl.StartPlatformTokenService
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -36,17 +37,15 @@ public class CarcylUnitInspectMqTtlListener extends EmqxListener {
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appkey
;
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${org.filter.group.seq}"
)
private
Long
groupSeq
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
System
.
out
.
println
(
message
);
...
...
@@ -56,9 +55,7 @@ public class CarcylUnitInspectMqTtlListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
FeignClientResult
<
List
<
ApplicationModel
>>
aResult
=
Privilege
.
applicationClient
.
queryAgencyApplications
();
List
<
ApplicationModel
>
aList
=
aResult
.
getResult
();
List
<
String
>
appCodes
=
aList
.
stream
().
filter
(
i
->
"监管端,企业端"
.
indexOf
(
i
.
getAppName
())
!=
-
1
)
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/listener/PlatformUserTopicMessage.java
View file @
1b614da7
...
...
@@ -5,18 +5,16 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.elevator.api.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.elevator.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.elevator.flc.api.service.IRegUnitInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
@Component
...
...
@@ -40,11 +38,6 @@ public class PlatformUserTopicMessage extends EmqxListener {
@Autowired
RedisUtils
redisUtil
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appKey
;
@Autowired
IEquipmentCategoryService
equipmentCategoryService
;
...
...
@@ -52,11 +45,12 @@ public class PlatformUserTopicMessage extends EmqxListener {
@Autowired
IRegUnitInfoService
regUnitInfoService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
message
.
toString
());
JSONObject
result
=
jsonObject
.
getJSONObject
(
"result"
);
JSONObject
dataResult
=
result
.
getJSONObject
(
"result"
);
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/listener/PrivilegeCompanyUpdateAddListener.java
View file @
1b614da7
...
...
@@ -5,10 +5,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.elevator.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.elevator.biz.service.impl.TzBaseEnterpriseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.elevator.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -16,14 +16,15 @@ import org.eclipse.paho.client.mqttv3.MqttMessage;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.Map
;
@Component
@Slf4j
...
...
@@ -40,11 +41,8 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appKey
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
s
,
MqttMessage
message
)
throws
Exception
{
...
...
@@ -58,15 +56,13 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
//判断库中业务tz_base_enterprise_info是否存在
QueryWrapper
<
TzBaseEnterpriseInfo
>
queryWrapper
=
new
QueryWrapper
<
TzBaseEnterpriseInfo
>();
queryWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
queryWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
TzBaseEnterpriseInfo
tzBaseEnterprisePrivilegeInfo
=
tzBaseEnterpriseInfoService
.
getOne
(
queryWrapper
);
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
accessFeignService
.
updateSyncCompanyState
(
object
.
getString
(
"sequence_nbr"
));
return
;
}
...
...
@@ -95,14 +91,14 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
//业务表更新条件构造器
UpdateWrapper
<
TzBaseEnterpriseInfo
>
updateWrapper
=
new
UpdateWrapper
<>();
updateWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
updateWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
String
regCode
=
object
.
getString
(
"reg_code"
);
CompanyModel
supervisePrivilegeCompanyModel
;
if
(!
ValidationUtil
.
isEmpty
(
regCode
))
{
supervisePrivilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
regCode
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
supervisePrivilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
"610000"
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
...
...
@@ -120,37 +116,37 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
tzBaseEnterpriseInfo
.
setSuperviseOrgCode
(
supervisePrivilegeCompanyModel
.
getOrgCode
());
tzBaseEnterpriseInfo
.
setSuperviseOrgName
(
supervisePrivilegeCompanyModel
.
getCompanyName
());
if
(
ValidationUtil
.
isEmpty
(
tzBaseEnterpriseInfo
.
getUnitType
()))
{
if
(
ValidationUtil
.
isEmpty
(
tzBaseEnterpriseInfo
.
getUnitType
()))
{
tzBaseEnterpriseInfo
.
setUnitType
(
""
);
}
try
{
if
(
tzBaseEnterprisePrivilegeInfo
==
null
)
{
if
(
tzBaseEnterprisePrivilegeInfo
==
null
)
{
tzBaseEnterpriseInfoService
.
save
(
tzBaseEnterpriseInfo
);
accessFeignService
.
updateSyncCompanyState
(
object
.
getString
(
"sequence_nbr"
));
return
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"【"
+
object
.
getString
(
"unit_name"
)
+
"】许可信息同步【失败】:"
+
e
.
getMessage
());
}
}
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
return
map
;
}
Iterator
iter
=
companyModels
.
iterator
();
while
(
iter
.
hasNext
())
{
while
(
iter
.
hasNext
())
{
String
json
=
JSON
.
toJSONString
(
iter
.
next
());
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
String
code
=
companyModel
.
getCompanyCode
();
if
(
code
.
length
()
>=
6
)
{
if
(
code
.
length
()
>=
6
)
{
code
=
code
.
substring
(
0
,
6
);
}
map
.
put
(
code
,
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
map
.
put
(
code
,
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
}
return
map
;
}
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/StartPlatformTokenService.java
View file @
1b614da7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
elevator
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
@Service
public
class
StartPlatformTokenService
{
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Value
(
"${admin.user}"
)
String
user
;
@Value
(
"${admin.password}"
)
String
password
;
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Autowired
RedisUtil
redisUtil
;
...
...
@@ -32,13 +16,9 @@ public class StartPlatformTokenService {
@Autowired
AmosRequestContext
amosRequestContext
;
public
void
getToken
()
{
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appkey
);
String
token
=
amosRequestContext
.
getToken
();
System
.
out
.
println
(
"token:"
+
token
);
RequestContext
.
setToken
(
token
);
redisUtil
.
set
(
"platform_token"
,
token
);
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
}
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
1b614da7
...
...
@@ -11,8 +11,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl.RegUnitIcServiceImpl
;
import
com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl.RegUnitInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.BaseUnitLicenceDto
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.EquEnterDto
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.TzBaseEnterpriseInfoDto
;
...
...
@@ -21,7 +19,6 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.PageParam;
import
com.yeejoin.amos.boot.module.elevator.api.entity.SpeUseUnit
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.elevator.api.mapper.TzBaseEnterpriseInfoMapper
;
import
com.yeejoin.amos.boot.module.elevator.api.service.IBaseUnitLicenceService
;
import
com.yeejoin.amos.boot.module.elevator.api.service.ITzBaseEnterpriseInfoService
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.elevator.flc.api.dto.RegUnitIcDto
;
...
...
@@ -30,19 +27,18 @@ import com.yeejoin.amos.boot.module.elevator.flc.api.entity.RegUnitIc;
import
com.yeejoin.amos.boot.module.elevator.flc.api.entity.RegUnitInfo
;
import
com.yeejoin.amos.boot.module.elevator.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.boot.module.elevator.flc.api.mapper.RegUnitInfoMapper
;
import
com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl.RegUnitIcServiceImpl
;
import
com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl.RegUnitInfoServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
...
@@ -64,15 +60,6 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.product.web}"
)
String
webProduct
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Autowired
private
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
...
...
@@ -87,33 +74,20 @@ public class TzBaseEnterpriseInfoServiceImpl
RegUnitInfoServiceImpl
regUnitInfoService
;
@Autowired
private
IBaseUnitLicenceService
iBaseUnitLicenceService
;
@Autowired
private
SpeUseUnitServiceImpl
speUseUnitService
;
@Autowired
private
AccessFeignService
accessFeignService
;
@Autowired
private
ITzBaseEnterpriseInfoService
tzBaseEnterpriseInfoService
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Autowired
RegUnitInfoMapper
regUnitInfoMapper
;
@Value
(
"${tzs.admin.name:tzs_admin}"
)
private
String
tzsAdminName
;
@Value
(
"${tzs.admin.pwd:a1234567}"
)
private
String
tzsAdminPwd
;
@Value
(
"${redis.cache.failure.time}"
)
private
Long
redisRegionTimeSecond
;
/**机器人用户token缓存key */
public
static
final
String
TZS_USER_TOKEN
=
"TZS_USER_TOKEN"
;
/**
* 企业管理员变更缓存key前缀
...
...
@@ -122,6 +96,10 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
private
EquipmentCategoryServiceImpl
equipmentCategoryService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
List
<
EquEnterDto
>
getInfo
(
String
sequenceNbr
)
{
return
tzBaseEnterpriseInfoMapper
.
getInfo
(
sequenceNbr
);
...
...
@@ -148,7 +126,7 @@ public class TzBaseEnterpriseInfoServiceImpl
}
}
return
this
.
baseMapper
.
pageList
(
page
,
tzBaseEnterpriseInfoDto
,
orgCodeList
);
return
this
.
baseMapper
.
pageList
(
page
,
tzBaseEnterpriseInfoDto
,
orgCodeList
);
}
@Override
...
...
@@ -182,7 +160,7 @@ public class TzBaseEnterpriseInfoServiceImpl
if
(
regUnitInfo
!=
null
)
{
BeanUtils
.
copyProperties
(
regUnitInfo
,
regUnitInfoDto
);
}
regUnitInfoDto
.
setAdminIdCardPhoto
((
ValidationUtil
.
isEmpty
(
regUnitInfo
)||
ValidationUtil
.
isEmpty
(
regUnitInfo
.
getAdminIdCardPhoto
()))
?
new
ArrayList
()
:
JSON
.
parseArray
(
regUnitInfo
.
getAdminIdCardPhoto
()));
regUnitInfoDto
.
setAdminIdCardPhoto
((
ValidationUtil
.
isEmpty
(
regUnitInfo
)
||
ValidationUtil
.
isEmpty
(
regUnitInfo
.
getAdminIdCardPhoto
()))
?
new
ArrayList
()
:
JSON
.
parseArray
(
regUnitInfo
.
getAdminIdCardPhoto
()));
tzBaseEnterpriseInfoDto
.
setRegUnitInfoDto
(
regUnitInfoDto
);
// 工商信息
...
...
@@ -203,7 +181,7 @@ public class TzBaseEnterpriseInfoServiceImpl
return
ObjectUtils
.
isEmpty
(
tzBaseEnterpriseInfo
)
?
null
:
getDetail
(
tzBaseEnterpriseInfo
);
}
private
TzBaseEnterpriseInfoDto
getDetail
(
TzBaseEnterpriseInfo
tzBaseEnterpriseInfo
)
{
private
TzBaseEnterpriseInfoDto
getDetail
(
TzBaseEnterpriseInfo
tzBaseEnterpriseInfo
)
{
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
detail
(
tzBaseEnterpriseInfo
.
getSequenceNbr
());
RegUnitIcDto
regUnitIcDto
=
new
RegUnitIcDto
();
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
tzBaseEnterpriseInfoDto
.
getUseCode
()).
getResult
();
...
...
@@ -234,7 +212,7 @@ public class TzBaseEnterpriseInfoServiceImpl
regUnitIcDto
.
setUnitName
(
String
.
valueOf
(
resultMap
.
get
(
"unitName"
)));
regUnitIcDto
.
setRegisteredOrgan
(
String
.
valueOf
(
resultMap
.
get
(
"registration_authority"
)));
for
(
DataDictionary
djjg
:
iDataDictionaryService
.
getByType
(
"DJJG"
))
{
if
(
djjg
.
getName
().
equals
(
resultMap
.
get
(
"registration_authority"
)))
{
if
(
djjg
.
getName
().
equals
(
resultMap
.
get
(
"registration_authority"
)))
{
regUnitIcDto
.
setRegisteredOrganCode
(
djjg
.
getSequenceNbr
().
toString
());
}
}
...
...
@@ -280,7 +258,7 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
TzBaseEnterpriseInfoDto
selectByUseUnit
(
String
useUnit
)
{
if
(
ValidationUtil
.
isEmpty
(
useUnit
))
{
if
(
ValidationUtil
.
isEmpty
(
useUnit
))
{
return
new
TzBaseEnterpriseInfoDto
();
}
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
new
TzBaseEnterpriseInfoDto
();
...
...
@@ -315,23 +293,21 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
String
syncEnterpriseInfo
()
{
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
List
<
TzBaseEnterpriseInfo
>
baseEnterpriseInfoList
=
new
ArrayList
<>();
//获取平台企业表企业名称及sequence_code,并装入map中
Collection
<
CompanyModel
>
companyModels
=
Privilege
.
companyClient
.
queryAgencyTree
(
null
).
getResult
();
Map
<
String
,
CompanyModel
>
companyMap
=
new
HashMap
<>();
Map
<
String
,
CompanyModel
>
companyMap
=
new
HashMap
<>();
getCompanyInfoMap
(
companyModels
,
companyMap
);
getCompanyInfoMap
(
companyModels
,
companyMap
);
int
size
=
500
;
int
total
=
speUseUnitService
.
count
();
int
current
=
total
/
size
;
int
current
=
total
/
size
;
current
=
current
+
1
;
for
(
int
i
=
1
;
i
<=
current
;
i
++)
{
for
(
int
i
=
1
;
i
<=
current
;
i
++)
{
IPage
<
SpeUseUnit
>
page
=
new
Page
<>();
...
...
@@ -340,18 +316,18 @@ public class TzBaseEnterpriseInfoServiceImpl
List
<
SpeUseUnit
>
speUseUnitList
=
speUseUnitService
.
page
(
page
).
getRecords
();
for
(
SpeUseUnit
speUseUnit
:
speUseUnitList
)
{
if
(
speUseUnit
.
getSyncState
()
!=
3
)
{
if
(
speUseUnit
.
getSyncState
()
!=
3
)
{
CompanyModel
companyPrivilegeModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
speUseUnit
.
getCerCode
()).
getResult
();
QueryWrapper
<
TzBaseEnterpriseInfo
>
queryWrapper
=
new
QueryWrapper
<
TzBaseEnterpriseInfo
>();
queryWrapper
.
eq
(
"use_code"
,
speUseUnit
.
getCerCode
());
queryWrapper
.
eq
(
"use_code"
,
speUseUnit
.
getCerCode
());
TzBaseEnterpriseInfo
tzBaseEnterprisePrivilegeInfo
=
this
.
getOne
(
queryWrapper
);
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
speUseUnit
.
getCerCode
()).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
resultMap
))
{
if
(!
ValidationUtil
.
isEmpty
(
companyPrivilegeModel
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByCompanyId
(
companyPrivilegeModel
.
getSequenceNbr
(),
null
,
null
,
null
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
if
(
ValidationUtil
.
isEmpty
(
resultMap
))
{
if
(!
ValidationUtil
.
isEmpty
(
companyPrivilegeModel
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByCompanyId
(
companyPrivilegeModel
.
getSequenceNbr
(),
null
,
null
,
null
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
//spe表中的数据在工商查不到,且平台无用户,将删除企业数据
Privilege
.
companyClient
.
deleteCompany
(
String
.
valueOf
(
companyPrivilegeModel
.
getSequenceNbr
()));
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
...
...
@@ -362,7 +338,7 @@ public class TzBaseEnterpriseInfoServiceImpl
//spe表中的数据在工商查不到,设置spe表状态为1
speUseUnit
.
setSyncState
(
1
);
speUseUnitService
.
updateById
(
speUseUnit
);
}
else
{
}
else
{
CompanyModel
privilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyName
(
String
.
valueOf
(
resultMap
.
get
(
"registration_authority"
))).
getResult
();
CompanyModel
companyModel
=
new
CompanyModel
();
companyModel
.
setCompanyName
(
speUseUnit
.
getName
());
...
...
@@ -435,7 +411,7 @@ public class TzBaseEnterpriseInfoServiceImpl
this
.
updateById
(
tzBaseEnterprisePrivilegeInfo
);
}
}
setSpeUseUnitState
(
3
,
speUseUnit
);
setSpeUseUnitState
(
3
,
speUseUnit
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
//当报错时 设置状态为 2
...
...
@@ -540,16 +516,11 @@ public class TzBaseEnterpriseInfoServiceImpl
return
String
.
join
(
","
,
res
);
}
@Override
public
Map
<
String
,
Object
>
adminInfoUpdate
(
Map
<
String
,
Object
>
map
)
{
//每一个企业只有一个管理员,所以当前登录用户即管理员用户
AgencyUserModel
me
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
webProduct
);
//获取机器人的token,获取不到则去登录
if
(
ObjectUtils
.
isEmpty
(
redisUtil
.
get
(
TZS_USER_TOKEN
)))
{
loginCtiUser
();
}
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
TZS_USER_TOKEN
)));
platformTokenService
.
getToken
();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
me
))
{
RegUnitInfo
regUnitInfo
=
new
RegUnitInfo
();
...
...
@@ -574,35 +545,22 @@ public class TzBaseEnterpriseInfoServiceImpl
return
resultMap
;
}
//机器人用户登录
private
void
loginCtiUser
()
{
String
passwd
=
DesUtil
.
encode
(
tzsAdminPwd
,
"qaz"
);
IdPasswordAuthModel
loninData
=
new
IdPasswordAuthModel
();
loninData
.
setLoginId
(
tzsAdminName
);
loninData
.
setPassword
(
passwd
);
FeignClientResult
loginResult
=
Privilege
.
authClient
.
idpassword
(
loninData
);
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
redisUtil
.
set
(
TZS_USER_TOKEN
,
resultMap
.
get
(
"token"
).
toString
(),
redisRegionTimeSecond
);
}
}
public
void
setSpeUseUnitState
(
int
state
,
SpeUseUnit
speUseUnit
)
{
public
void
setSpeUseUnitState
(
int
state
,
SpeUseUnit
speUseUnit
)
{
speUseUnit
.
setSyncState
(
state
);
speUseUnitService
.
updateById
(
speUseUnit
);
}
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
return
map
;
}
Iterator
iter
=
companyModels
.
iterator
();
while
(
iter
.
hasNext
())
{
while
(
iter
.
hasNext
())
{
String
json
=
JSON
.
toJSONString
(
iter
.
next
());
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
map
.
put
(
companyModel
.
getCompanyName
(),
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
map
.
put
(
companyModel
.
getCompanyName
(),
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
}
return
map
;
}
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/resources/application.properties
View file @
1b614da7
...
...
@@ -124,11 +124,7 @@ tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## \uFFFD\uFFFD\uFFFD\u06BA\u0172\uFFFD\uFFFD\uFFFD\uFFFD\u00FB\uFFFDid\uFFFD\uFFFD\u01BD\u0328userId\uFFFD\uFFFD
tzs.wechat.test.userId
=
3393279
admin.product
=
AMOS-SERVICE-ADMIN
admin.appkey
=
AMOS_ADMIN
admin.user
=
admin_tzs
admin.password
=
a1234560
admin.product.web
=
AMOS-WEB-ADMIN
amos.secret.key
=
qazknife4j.production=false
knife4j.production
=
false
...
...
amos-boot-system-tzs/amos-boot-module-app/amos-boot-module-app-biz/src/main/java/com/yeejoin/amos/boot/module/app/biz/service/impl/StartPlatformTokenService.java
View file @
1b614da7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
app
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.app.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.yeejoin.amos.boot.module.app.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
@Service
public
class
StartPlatformTokenService
{
@Value
(
"${amos.system.user.product}"
)
String
product
;
@Value
(
"${amos.system.user.app-key}"
)
String
appkey
;
@Autowired
RedisUtil
redisUtil
;
...
...
@@ -24,11 +16,8 @@ public class StartPlatformTokenService {
AmosRequestContext
amosRequestContext
;
public
void
getToken
()
{
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appkey
);
String
token
=
amosRequestContext
.
getToken
();
System
.
out
.
println
(
"token:"
+
token
);
RequestContext
.
setToken
(
token
);
redisUtil
.
set
(
"platform_token"
,
token
);
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
}
}
amos-boot-system-tzs/amos-boot-module-app/amos-boot-module-app-biz/src/main/java/com/yeejoin/amos/boot/module/app/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
1b614da7
...
...
@@ -64,15 +64,6 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.product.web}"
)
String
webProduct
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Autowired
private
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
...
...
@@ -87,34 +78,20 @@ public class TzBaseEnterpriseInfoServiceImpl
RegUnitInfoServiceImpl
regUnitInfoService
;
@Autowired
private
IBaseUnitLicenceService
iBaseUnitLicenceService
;
@Autowired
private
SpeUseUnitServiceImpl
speUseUnitService
;
@Autowired
private
AccessFeignService
accessFeignService
;
@Autowired
private
ITzBaseEnterpriseInfoService
tzBaseEnterpriseInfoService
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Autowired
RegUnitInfoMapper
regUnitInfoMapper
;
@Value
(
"${tzs.admin.name:tzs_admin}"
)
private
String
tzsAdminName
;
@Value
(
"${tzs.admin.pwd:a1234567}"
)
private
String
tzsAdminPwd
;
@Value
(
"${redis.cache.failure.time}"
)
private
Long
redisRegionTimeSecond
;
/**机器人用户token缓存key */
public
static
final
String
TZS_USER_TOKEN
=
"TZS_USER_TOKEN"
;
/**
* 企业管理员变更缓存key前缀
*/
...
...
@@ -122,6 +99,9 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
private
EquipmentCategoryServiceImpl
equipmentCategoryService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
List
<
EquEnterDto
>
getInfo
(
String
sequenceNbr
)
{
return
tzBaseEnterpriseInfoMapper
.
getInfo
(
sequenceNbr
);
...
...
@@ -315,9 +295,7 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
String
syncEnterpriseInfo
()
{
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
List
<
TzBaseEnterpriseInfo
>
baseEnterpriseInfoList
=
new
ArrayList
<>();
...
...
@@ -540,16 +518,11 @@ public class TzBaseEnterpriseInfoServiceImpl
return
String
.
join
(
","
,
res
);
}
@Override
public
Map
<
String
,
Object
>
adminInfoUpdate
(
Map
<
String
,
Object
>
map
)
{
//每一个企业只有一个管理员,所以当前登录用户即管理员用户
AgencyUserModel
me
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
webProduct
);
//获取机器人的token,获取不到则去登录
if
(
ObjectUtils
.
isEmpty
(
redisUtil
.
get
(
TZS_USER_TOKEN
)))
{
loginCtiUser
();
}
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
TZS_USER_TOKEN
)));
platformTokenService
.
getToken
();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
me
))
{
RegUnitInfo
regUnitInfo
=
new
RegUnitInfo
();
...
...
@@ -574,18 +547,6 @@ public class TzBaseEnterpriseInfoServiceImpl
return
resultMap
;
}
//机器人用户登录
private
void
loginCtiUser
()
{
String
passwd
=
DesUtil
.
encode
(
tzsAdminPwd
,
"qaz"
);
IdPasswordAuthModel
loninData
=
new
IdPasswordAuthModel
();
loninData
.
setLoginId
(
tzsAdminName
);
loninData
.
setPassword
(
passwd
);
FeignClientResult
loginResult
=
Privilege
.
authClient
.
idpassword
(
loninData
);
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
redisUtil
.
set
(
TZS_USER_TOKEN
,
resultMap
.
get
(
"token"
).
toString
(),
redisRegionTimeSecond
);
}
}
public
void
setSpeUseUnitState
(
int
state
,
SpeUseUnit
speUseUnit
){
...
...
amos-boot-system-tzs/amos-boot-module-app/amos-boot-module-app-biz/src/main/resources/application.properties
View file @
1b614da7
...
...
@@ -124,11 +124,7 @@ tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## \uFFFD\uFFFD\uFFFD\u06BA\u0172\uFFFD\uFFFD\uFFFD\uFFFD\u00FB\uFFFDid\uFFFD\uFFFD\u01BD\u0328userId\uFFFD\uFFFD
tzs.wechat.test.userId
=
3393279
admin.product
=
AMOS-SERVICE-ADMIN
admin.appkey
=
AMOS_ADMIN
admin.user
=
admin_tzs
admin.password
=
a1234560
admin.product.web
=
AMOS-WEB-ADMIN
amos.secret.key
=
qazknife4j.production=false
knife4j.production
=
false
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/biz/service/impl/StartPlatformTokenService.java
View file @
1b614da7
...
...
@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.cylinder.biz.service.impl;
import
com.yeejoin.amos.boot.module.cylinder.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
...
...
@@ -11,21 +10,6 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
@Service
public
class
StartPlatformTokenService
{
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Value
(
"${admin.user}"
)
String
user
;
@Value
(
"${admin.password}"
)
String
password
;
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Autowired
RedisUtil
redisUtil
;
...
...
@@ -34,11 +18,8 @@ public class StartPlatformTokenService {
public
void
getToken
()
{
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appkey
);
String
token
=
amosRequestContext
.
getToken
();
System
.
out
.
println
(
"token:"
+
token
);
RequestContext
.
setToken
(
token
);
redisUtil
.
set
(
"platform_token"
,
token
);
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
}
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
1b614da7
...
...
@@ -11,9 +11,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.cylinder.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.RegUnitIcServiceImpl
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.RegUnitInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.BaseUnitLicenceDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.EquEnterDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.TzBaseEnterpriseInfoDto
;
...
...
@@ -22,26 +19,25 @@ import com.yeejoin.amos.boot.module.cylinder.api.entity.PageParam;
import
com.yeejoin.amos.boot.module.cylinder.api.entity.SpeUseUnit
;
import
com.yeejoin.amos.boot.module.cylinder.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.cylinder.api.mapper.TzBaseEnterpriseInfoMapper
;
import
com.yeejoin.amos.boot.module.cylinder.api.service.IBaseUnitLicenceService
;
import
com.yeejoin.amos.boot.module.cylinder.api.service.ITzBaseEnterpriseInfoService
;
import
com.yeejoin.amos.boot.module.cylinder.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.RegUnitIcDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.RegUnitInfoDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.RegUnitIc
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.RegUnitInfo
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.RegUnitInfoMapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.RegUnitIcServiceImpl
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.RegUnitInfoServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
...
@@ -63,15 +59,6 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.product.web}"
)
String
webProduct
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Autowired
private
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
...
...
@@ -84,8 +71,6 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
RegUnitInfoServiceImpl
regUnitInfoService
;
@Autowired
private
IBaseUnitLicenceService
iBaseUnitLicenceService
;
@Autowired
private
SpeUseUnitServiceImpl
speUseUnitService
;
...
...
@@ -94,32 +79,26 @@ public class TzBaseEnterpriseInfoServiceImpl
private
AccessFeignService
accessFeignService
;
@Autowired
private
ITzBaseEnterpriseInfoService
tzBaseEnterpriseInfoService
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Autowired
RegUnitInfoMapper
regUnitInfoMapper
;
@Value
(
"${tzs.admin.name:tzs_admin}"
)
private
String
tzsAdminName
;
@Value
(
"${tzs.admin.pwd:a1234567}"
)
private
String
tzsAdminPwd
;
@Value
(
"${redis.cache.failure.time}"
)
private
Long
redisRegionTimeSecond
;
/**机器人用户token缓存key */
public
static
final
String
TZS_USER_TOKEN
=
"TZS_USER_TOKEN"
;
/**
* 企业管理员变更缓存key前缀
*/
private
final
String
adminChange
=
"ADMIN_CHANGE_"
;
@Autowired
private
EquipmentCategoryServiceImpl
equipmentCategoryService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
List
<
EquEnterDto
>
getInfo
(
String
sequenceNbr
)
{
return
tzBaseEnterpriseInfoMapper
.
getInfo
(
sequenceNbr
);
...
...
@@ -146,7 +125,7 @@ public class TzBaseEnterpriseInfoServiceImpl
}
}
return
this
.
baseMapper
.
pageList
(
page
,
tzBaseEnterpriseInfoDto
,
orgCodeList
);
return
this
.
baseMapper
.
pageList
(
page
,
tzBaseEnterpriseInfoDto
,
orgCodeList
);
}
@Override
...
...
@@ -180,7 +159,7 @@ public class TzBaseEnterpriseInfoServiceImpl
if
(
regUnitInfo
!=
null
)
{
BeanUtils
.
copyProperties
(
regUnitInfo
,
regUnitInfoDto
);
}
regUnitInfoDto
.
setAdminIdCardPhoto
((
ValidationUtil
.
isEmpty
(
regUnitInfo
)||
ValidationUtil
.
isEmpty
(
regUnitInfo
.
getAdminIdCardPhoto
()))
?
new
ArrayList
()
:
JSON
.
parseArray
(
regUnitInfo
.
getAdminIdCardPhoto
()));
regUnitInfoDto
.
setAdminIdCardPhoto
((
ValidationUtil
.
isEmpty
(
regUnitInfo
)
||
ValidationUtil
.
isEmpty
(
regUnitInfo
.
getAdminIdCardPhoto
()))
?
new
ArrayList
()
:
JSON
.
parseArray
(
regUnitInfo
.
getAdminIdCardPhoto
()));
tzBaseEnterpriseInfoDto
.
setRegUnitInfoDto
(
regUnitInfoDto
);
// 工商信息
...
...
@@ -201,7 +180,7 @@ public class TzBaseEnterpriseInfoServiceImpl
return
ObjectUtils
.
isEmpty
(
tzBaseEnterpriseInfo
)
?
null
:
getDetail
(
tzBaseEnterpriseInfo
);
}
private
TzBaseEnterpriseInfoDto
getDetail
(
TzBaseEnterpriseInfo
tzBaseEnterpriseInfo
)
{
private
TzBaseEnterpriseInfoDto
getDetail
(
TzBaseEnterpriseInfo
tzBaseEnterpriseInfo
)
{
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
detail
(
tzBaseEnterpriseInfo
.
getSequenceNbr
());
RegUnitIcDto
regUnitIcDto
=
new
RegUnitIcDto
();
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
tzBaseEnterpriseInfoDto
.
getUseCode
()).
getResult
();
...
...
@@ -232,7 +211,7 @@ public class TzBaseEnterpriseInfoServiceImpl
regUnitIcDto
.
setUnitName
(
String
.
valueOf
(
resultMap
.
get
(
"unitName"
)));
regUnitIcDto
.
setRegisteredOrgan
(
String
.
valueOf
(
resultMap
.
get
(
"registration_authority"
)));
for
(
DataDictionary
djjg
:
iDataDictionaryService
.
getByType
(
"DJJG"
))
{
if
(
djjg
.
getName
().
equals
(
resultMap
.
get
(
"registration_authority"
)))
{
if
(
djjg
.
getName
().
equals
(
resultMap
.
get
(
"registration_authority"
)))
{
regUnitIcDto
.
setRegisteredOrganCode
(
djjg
.
getSequenceNbr
().
toString
());
}
}
...
...
@@ -278,7 +257,7 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
TzBaseEnterpriseInfoDto
selectByUseUnit
(
String
useUnit
)
{
if
(
ValidationUtil
.
isEmpty
(
useUnit
))
{
if
(
ValidationUtil
.
isEmpty
(
useUnit
))
{
return
new
TzBaseEnterpriseInfoDto
();
}
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
new
TzBaseEnterpriseInfoDto
();
...
...
@@ -313,23 +292,21 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
String
syncEnterpriseInfo
()
{
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
List
<
TzBaseEnterpriseInfo
>
baseEnterpriseInfoList
=
new
ArrayList
<>();
//获取平台企业表企业名称及sequence_code,并装入map中
Collection
<
CompanyModel
>
companyModels
=
Privilege
.
companyClient
.
queryAgencyTree
(
null
).
getResult
();
Map
<
String
,
CompanyModel
>
companyMap
=
new
HashMap
<>();
Map
<
String
,
CompanyModel
>
companyMap
=
new
HashMap
<>();
getCompanyInfoMap
(
companyModels
,
companyMap
);
getCompanyInfoMap
(
companyModels
,
companyMap
);
int
size
=
500
;
int
total
=
speUseUnitService
.
count
();
int
current
=
total
/
size
;
int
current
=
total
/
size
;
current
=
current
+
1
;
for
(
int
i
=
1
;
i
<=
current
;
i
++)
{
for
(
int
i
=
1
;
i
<=
current
;
i
++)
{
IPage
<
SpeUseUnit
>
page
=
new
Page
<>();
...
...
@@ -338,18 +315,18 @@ public class TzBaseEnterpriseInfoServiceImpl
List
<
SpeUseUnit
>
speUseUnitList
=
speUseUnitService
.
page
(
page
).
getRecords
();
for
(
SpeUseUnit
speUseUnit
:
speUseUnitList
)
{
if
(
speUseUnit
.
getSyncState
()
!=
3
)
{
if
(
speUseUnit
.
getSyncState
()
!=
3
)
{
CompanyModel
companyPrivilegeModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
speUseUnit
.
getCerCode
()).
getResult
();
QueryWrapper
<
TzBaseEnterpriseInfo
>
queryWrapper
=
new
QueryWrapper
<
TzBaseEnterpriseInfo
>();
queryWrapper
.
eq
(
"use_code"
,
speUseUnit
.
getCerCode
());
queryWrapper
.
eq
(
"use_code"
,
speUseUnit
.
getCerCode
());
TzBaseEnterpriseInfo
tzBaseEnterprisePrivilegeInfo
=
this
.
getOne
(
queryWrapper
);
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
speUseUnit
.
getCerCode
()).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
resultMap
))
{
if
(!
ValidationUtil
.
isEmpty
(
companyPrivilegeModel
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByCompanyId
(
companyPrivilegeModel
.
getSequenceNbr
(),
null
,
null
,
null
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
if
(
ValidationUtil
.
isEmpty
(
resultMap
))
{
if
(!
ValidationUtil
.
isEmpty
(
companyPrivilegeModel
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByCompanyId
(
companyPrivilegeModel
.
getSequenceNbr
(),
null
,
null
,
null
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
//spe表中的数据在工商查不到,且平台无用户,将删除企业数据
Privilege
.
companyClient
.
deleteCompany
(
String
.
valueOf
(
companyPrivilegeModel
.
getSequenceNbr
()));
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
...
...
@@ -360,7 +337,7 @@ public class TzBaseEnterpriseInfoServiceImpl
//spe表中的数据在工商查不到,设置spe表状态为1
speUseUnit
.
setSyncState
(
1
);
speUseUnitService
.
updateById
(
speUseUnit
);
}
else
{
}
else
{
CompanyModel
privilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyName
(
String
.
valueOf
(
resultMap
.
get
(
"registration_authority"
))).
getResult
();
CompanyModel
companyModel
=
new
CompanyModel
();
companyModel
.
setCompanyName
(
speUseUnit
.
getName
());
...
...
@@ -433,7 +410,7 @@ public class TzBaseEnterpriseInfoServiceImpl
this
.
updateById
(
tzBaseEnterprisePrivilegeInfo
);
}
}
setSpeUseUnitState
(
3
,
speUseUnit
);
setSpeUseUnitState
(
3
,
speUseUnit
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
//当报错时 设置状态为 2
...
...
@@ -538,16 +515,11 @@ public class TzBaseEnterpriseInfoServiceImpl
return
String
.
join
(
","
,
res
);
}
@Override
public
Map
<
String
,
Object
>
adminInfoUpdate
(
Map
<
String
,
Object
>
map
)
{
//每一个企业只有一个管理员,所以当前登录用户即管理员用户
AgencyUserModel
me
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
webProduct
);
//获取机器人的token,获取不到则去登录
if
(
ObjectUtils
.
isEmpty
(
redisUtil
.
get
(
TZS_USER_TOKEN
)))
{
loginCtiUser
();
}
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
TZS_USER_TOKEN
)));
platformTokenService
.
getToken
();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
me
))
{
RegUnitInfo
regUnitInfo
=
new
RegUnitInfo
();
...
...
@@ -572,35 +544,21 @@ public class TzBaseEnterpriseInfoServiceImpl
return
resultMap
;
}
//机器人用户登录
private
void
loginCtiUser
()
{
String
passwd
=
DesUtil
.
encode
(
tzsAdminPwd
,
"qaz"
);
IdPasswordAuthModel
loninData
=
new
IdPasswordAuthModel
();
loninData
.
setLoginId
(
tzsAdminName
);
loninData
.
setPassword
(
passwd
);
FeignClientResult
loginResult
=
Privilege
.
authClient
.
idpassword
(
loninData
);
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
redisUtil
.
set
(
TZS_USER_TOKEN
,
resultMap
.
get
(
"token"
).
toString
(),
redisRegionTimeSecond
);
}
}
public
void
setSpeUseUnitState
(
int
state
,
SpeUseUnit
speUseUnit
){
public
void
setSpeUseUnitState
(
int
state
,
SpeUseUnit
speUseUnit
)
{
speUseUnit
.
setSyncState
(
state
);
speUseUnitService
.
updateById
(
speUseUnit
);
}
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
return
map
;
}
Iterator
iter
=
companyModels
.
iterator
();
while
(
iter
.
hasNext
())
{
while
(
iter
.
hasNext
())
{
String
json
=
JSON
.
toJSONString
(
iter
.
next
());
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
map
.
put
(
companyModel
.
getCompanyName
(),
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
map
.
put
(
companyModel
.
getCompanyName
(),
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
}
return
map
;
}
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/resources/application.properties
View file @
1b614da7
...
...
@@ -124,11 +124,7 @@ tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## \uFFFD\uFFFD\uFFFD\u06BA\u0172\uFFFD\uFFFD\uFFFD\uFFFD\u00FB\uFFFDid\uFFFD\uFFFD\u01BD\u0328userId\uFFFD\uFFFD
tzs.wechat.test.userId
=
3393279
admin.product
=
AMOS-SERVICE-ADMIN
admin.appkey
=
AMOS_ADMIN
admin.user
=
admin_tzs
admin.password
=
a1234560
admin.product.web
=
AMOS-WEB-ADMIN
amos.secret.key
=
qazknife4j.production=false
knife4j.production
=
false
...
...
amos-boot-system-tzs/amos-boot-module-jczs/amos-boot-module-jczs-biz/src/main/java/com/yeejoin/amos/boot/module/jczs/biz/listener/PrivilegeCompanyUpdateAddListener.java
View file @
1b614da7
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.yeejoin.amos.boot.module.jczs.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.jczs.biz.service.impl.TzBaseEnterpriseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jczs.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.jczs.biz.utils.RedisUtil
;
...
...
@@ -40,11 +41,9 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@
Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
St
ring
appKey
;
@
Autowired
St
artPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
s
,
MqttMessage
message
)
throws
Exception
{
...
...
@@ -58,9 +57,7 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
//判断库中业务tz_base_enterprise_info是否存在
QueryWrapper
<
TzBaseEnterpriseInfo
>
queryWrapper
=
new
QueryWrapper
<
TzBaseEnterpriseInfo
>();
...
...
amos-boot-system-tzs/amos-boot-module-jczs/amos-boot-module-jczs-biz/src/main/java/com/yeejoin/amos/boot/module/jczs/biz/service/impl/StartPlatformTokenService.java
View file @
1b614da7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jczs
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.jczs.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.yeejoin.amos.boot.module.jczs.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
@Service
public
class
StartPlatformTokenService
{
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Value
(
"${admin.user}"
)
String
user
;
@Value
(
"${admin.password}"
)
String
password
;
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Autowired
RedisUtil
redisUtil
;
...
...
@@ -34,11 +17,8 @@ public class StartPlatformTokenService {
public
void
getToken
()
{
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appkey
);
String
token
=
amosRequestContext
.
getToken
();
System
.
out
.
println
(
"token:"
+
token
);
RequestContext
.
setToken
(
token
);
redisUtil
.
set
(
"platform_token"
,
token
);
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
}
}
amos-boot-system-tzs/amos-boot-module-jczs/amos-boot-module-jczs-biz/src/main/java/com/yeejoin/amos/boot/module/jczs/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
1b614da7
...
...
@@ -11,8 +11,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.jczs.flc.biz.service.impl.RegUnitIcServiceImpl
;
import
com.yeejoin.amos.boot.module.jczs.flc.biz.service.impl.RegUnitInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jczs.api.dto.BaseUnitLicenceDto
;
import
com.yeejoin.amos.boot.module.jczs.api.dto.EquEnterDto
;
import
com.yeejoin.amos.boot.module.jczs.api.dto.TzBaseEnterpriseInfoDto
;
...
...
@@ -21,7 +19,6 @@ import com.yeejoin.amos.boot.module.jczs.api.entity.PageParam;
import
com.yeejoin.amos.boot.module.jczs.api.entity.SpeUseUnit
;
import
com.yeejoin.amos.boot.module.jczs.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.jczs.api.mapper.TzBaseEnterpriseInfoMapper
;
import
com.yeejoin.amos.boot.module.jczs.api.service.IBaseUnitLicenceService
;
import
com.yeejoin.amos.boot.module.jczs.api.service.ITzBaseEnterpriseInfoService
;
import
com.yeejoin.amos.boot.module.jczs.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.jczs.flc.api.dto.RegUnitIcDto
;
...
...
@@ -30,12 +27,12 @@ import com.yeejoin.amos.boot.module.jczs.flc.api.entity.RegUnitIc;
import
com.yeejoin.amos.boot.module.jczs.flc.api.entity.RegUnitInfo
;
import
com.yeejoin.amos.boot.module.jczs.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.boot.module.jczs.flc.api.mapper.RegUnitInfoMapper
;
import
com.yeejoin.amos.boot.module.jczs.flc.biz.service.impl.RegUnitIcServiceImpl
;
import
com.yeejoin.amos.boot.module.jczs.flc.biz.service.impl.RegUnitInfoServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -63,15 +60,6 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.product.web}"
)
String
webProduct
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Autowired
private
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
...
...
@@ -85,33 +73,22 @@ public class TzBaseEnterpriseInfoServiceImpl
RegUnitInfoServiceImpl
regUnitInfoService
;
@Autowired
private
IBaseUnitLicenceService
iBaseUnitLicenceService
;
@Autowired
private
SpeUseUnitServiceImpl
speUseUnitService
;
@Autowired
private
AccessFeignService
accessFeignService
;
@Autowired
private
ITzBaseEnterpriseInfoService
tzBaseEnterpriseInfoService
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Autowired
RegUnitInfoMapper
regUnitInfoMapper
;
@Value
(
"${tzs.admin.name:tzs_admin}"
)
private
String
tzsAdminName
;
@Value
(
"${tzs.admin.pwd:a1234567}"
)
private
String
tzsAdminPwd
;
@Value
(
"${redis.cache.failure.time}"
)
private
Long
redisRegionTimeSecond
;
/**机器人用户token缓存key */
public
static
final
String
TZS_USER_TOKEN
=
"TZS_USER_TOKEN"
;
@Autowired
StartPlatformTokenService
platformTokenService
;
/**
* 企业管理员变更缓存key前缀
...
...
@@ -146,7 +123,7 @@ public class TzBaseEnterpriseInfoServiceImpl
}
}
return
this
.
baseMapper
.
pageList
(
page
,
tzBaseEnterpriseInfoDto
,
orgCodeList
);
return
this
.
baseMapper
.
pageList
(
page
,
tzBaseEnterpriseInfoDto
,
orgCodeList
);
}
@Override
...
...
@@ -180,7 +157,7 @@ public class TzBaseEnterpriseInfoServiceImpl
if
(
regUnitInfo
!=
null
)
{
BeanUtils
.
copyProperties
(
regUnitInfo
,
regUnitInfoDto
);
}
regUnitInfoDto
.
setAdminIdCardPhoto
((
ValidationUtil
.
isEmpty
(
regUnitInfo
)||
ValidationUtil
.
isEmpty
(
regUnitInfo
.
getAdminIdCardPhoto
()))
?
new
ArrayList
()
:
JSON
.
parseArray
(
regUnitInfo
.
getAdminIdCardPhoto
()));
regUnitInfoDto
.
setAdminIdCardPhoto
((
ValidationUtil
.
isEmpty
(
regUnitInfo
)
||
ValidationUtil
.
isEmpty
(
regUnitInfo
.
getAdminIdCardPhoto
()))
?
new
ArrayList
()
:
JSON
.
parseArray
(
regUnitInfo
.
getAdminIdCardPhoto
()));
tzBaseEnterpriseInfoDto
.
setRegUnitInfoDto
(
regUnitInfoDto
);
// 工商信息
...
...
@@ -201,7 +178,7 @@ public class TzBaseEnterpriseInfoServiceImpl
return
ObjectUtils
.
isEmpty
(
tzBaseEnterpriseInfo
)
?
null
:
getDetail
(
tzBaseEnterpriseInfo
);
}
private
TzBaseEnterpriseInfoDto
getDetail
(
TzBaseEnterpriseInfo
tzBaseEnterpriseInfo
)
{
private
TzBaseEnterpriseInfoDto
getDetail
(
TzBaseEnterpriseInfo
tzBaseEnterpriseInfo
)
{
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
detail
(
tzBaseEnterpriseInfo
.
getSequenceNbr
());
RegUnitIcDto
regUnitIcDto
=
new
RegUnitIcDto
();
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
tzBaseEnterpriseInfoDto
.
getUseCode
()).
getResult
();
...
...
@@ -232,7 +209,7 @@ public class TzBaseEnterpriseInfoServiceImpl
regUnitIcDto
.
setUnitName
(
String
.
valueOf
(
resultMap
.
get
(
"unitName"
)));
regUnitIcDto
.
setRegisteredOrgan
(
String
.
valueOf
(
resultMap
.
get
(
"registration_authority"
)));
for
(
DataDictionary
djjg
:
iDataDictionaryService
.
getByType
(
"DJJG"
))
{
if
(
djjg
.
getName
().
equals
(
resultMap
.
get
(
"registration_authority"
)))
{
if
(
djjg
.
getName
().
equals
(
resultMap
.
get
(
"registration_authority"
)))
{
regUnitIcDto
.
setRegisteredOrganCode
(
djjg
.
getSequenceNbr
().
toString
());
}
}
...
...
@@ -278,7 +255,7 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
TzBaseEnterpriseInfoDto
selectByUseUnit
(
String
useUnit
)
{
if
(
ValidationUtil
.
isEmpty
(
useUnit
))
{
if
(
ValidationUtil
.
isEmpty
(
useUnit
))
{
return
new
TzBaseEnterpriseInfoDto
();
}
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
new
TzBaseEnterpriseInfoDto
();
...
...
@@ -313,23 +290,20 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
String
syncEnterpriseInfo
()
{
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
List
<
TzBaseEnterpriseInfo
>
baseEnterpriseInfoList
=
new
ArrayList
<>();
//获取平台企业表企业名称及sequence_code,并装入map中
Collection
<
CompanyModel
>
companyModels
=
Privilege
.
companyClient
.
queryAgencyTree
(
null
).
getResult
();
Map
<
String
,
CompanyModel
>
companyMap
=
new
HashMap
<>();
Map
<
String
,
CompanyModel
>
companyMap
=
new
HashMap
<>();
getCompanyInfoMap
(
companyModels
,
companyMap
);
getCompanyInfoMap
(
companyModels
,
companyMap
);
int
size
=
500
;
int
total
=
speUseUnitService
.
count
();
int
current
=
total
/
size
;
int
current
=
total
/
size
;
current
=
current
+
1
;
for
(
int
i
=
1
;
i
<=
current
;
i
++)
{
for
(
int
i
=
1
;
i
<=
current
;
i
++)
{
IPage
<
SpeUseUnit
>
page
=
new
Page
<>();
...
...
@@ -338,18 +312,18 @@ public class TzBaseEnterpriseInfoServiceImpl
List
<
SpeUseUnit
>
speUseUnitList
=
speUseUnitService
.
page
(
page
).
getRecords
();
for
(
SpeUseUnit
speUseUnit
:
speUseUnitList
)
{
if
(
speUseUnit
.
getSyncState
()
!=
3
)
{
if
(
speUseUnit
.
getSyncState
()
!=
3
)
{
CompanyModel
companyPrivilegeModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
speUseUnit
.
getCerCode
()).
getResult
();
QueryWrapper
<
TzBaseEnterpriseInfo
>
queryWrapper
=
new
QueryWrapper
<
TzBaseEnterpriseInfo
>();
queryWrapper
.
eq
(
"use_code"
,
speUseUnit
.
getCerCode
());
queryWrapper
.
eq
(
"use_code"
,
speUseUnit
.
getCerCode
());
TzBaseEnterpriseInfo
tzBaseEnterprisePrivilegeInfo
=
this
.
getOne
(
queryWrapper
);
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
speUseUnit
.
getCerCode
()).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
resultMap
))
{
if
(!
ValidationUtil
.
isEmpty
(
companyPrivilegeModel
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByCompanyId
(
companyPrivilegeModel
.
getSequenceNbr
(),
null
,
null
,
null
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
if
(
ValidationUtil
.
isEmpty
(
resultMap
))
{
if
(!
ValidationUtil
.
isEmpty
(
companyPrivilegeModel
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByCompanyId
(
companyPrivilegeModel
.
getSequenceNbr
(),
null
,
null
,
null
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
//spe表中的数据在工商查不到,且平台无用户,将删除企业数据
Privilege
.
companyClient
.
deleteCompany
(
String
.
valueOf
(
companyPrivilegeModel
.
getSequenceNbr
()));
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
...
...
@@ -360,7 +334,7 @@ public class TzBaseEnterpriseInfoServiceImpl
//spe表中的数据在工商查不到,设置spe表状态为1
speUseUnit
.
setSyncState
(
1
);
speUseUnitService
.
updateById
(
speUseUnit
);
}
else
{
}
else
{
CompanyModel
privilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyName
(
String
.
valueOf
(
resultMap
.
get
(
"registration_authority"
))).
getResult
();
CompanyModel
companyModel
=
new
CompanyModel
();
companyModel
.
setCompanyName
(
speUseUnit
.
getName
());
...
...
@@ -433,7 +407,7 @@ public class TzBaseEnterpriseInfoServiceImpl
this
.
updateById
(
tzBaseEnterprisePrivilegeInfo
);
}
}
setSpeUseUnitState
(
3
,
speUseUnit
);
setSpeUseUnitState
(
3
,
speUseUnit
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
//当报错时 设置状态为 2
...
...
@@ -538,16 +512,11 @@ public class TzBaseEnterpriseInfoServiceImpl
return
String
.
join
(
","
,
res
);
}
@Override
public
Map
<
String
,
Object
>
adminInfoUpdate
(
Map
<
String
,
Object
>
map
)
{
//每一个企业只有一个管理员,所以当前登录用户即管理员用户
AgencyUserModel
me
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
webProduct
);
//获取机器人的token,获取不到则去登录
if
(
ObjectUtils
.
isEmpty
(
redisUtil
.
get
(
TZS_USER_TOKEN
)))
{
loginCtiUser
();
}
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
TZS_USER_TOKEN
)));
platformTokenService
.
getToken
();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
me
))
{
RegUnitInfo
regUnitInfo
=
new
RegUnitInfo
();
...
...
@@ -572,35 +541,22 @@ public class TzBaseEnterpriseInfoServiceImpl
return
resultMap
;
}
//机器人用户登录
private
void
loginCtiUser
()
{
String
passwd
=
DesUtil
.
encode
(
tzsAdminPwd
,
"qaz"
);
IdPasswordAuthModel
loninData
=
new
IdPasswordAuthModel
();
loninData
.
setLoginId
(
tzsAdminName
);
loninData
.
setPassword
(
passwd
);
FeignClientResult
loginResult
=
Privilege
.
authClient
.
idpassword
(
loninData
);
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
redisUtil
.
set
(
TZS_USER_TOKEN
,
resultMap
.
get
(
"token"
).
toString
(),
redisRegionTimeSecond
);
}
}
public
void
setSpeUseUnitState
(
int
state
,
SpeUseUnit
speUseUnit
)
{
public
void
setSpeUseUnitState
(
int
state
,
SpeUseUnit
speUseUnit
)
{
speUseUnit
.
setSyncState
(
state
);
speUseUnitService
.
updateById
(
speUseUnit
);
}
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
return
map
;
}
Iterator
iter
=
companyModels
.
iterator
();
while
(
iter
.
hasNext
())
{
while
(
iter
.
hasNext
())
{
String
json
=
JSON
.
toJSONString
(
iter
.
next
());
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
map
.
put
(
companyModel
.
getCompanyName
(),
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
map
.
put
(
companyModel
.
getCompanyName
(),
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
}
return
map
;
}
...
...
amos-boot-system-tzs/amos-boot-module-jczs/amos-boot-module-jczs-biz/src/main/resources/application.properties
View file @
1b614da7
...
...
@@ -122,11 +122,7 @@ tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## \uFFFD\uFFFD\uFFFD\u06BA\u0172\uFFFD\uFFFD\uFFFD\uFFFD\u00FB\uFFFDid\uFFFD\uFFFD\u01BD\u0328userId\uFFFD\uFFFD
tzs.wechat.test.userId
=
3393279
admin.product
=
AMOS-SERVICE-ADMIN
admin.appkey
=
AMOS_ADMIN
admin.user
=
admin_tzs
admin.password
=
a1234560
admin.product.web
=
AMOS-WEB-ADMIN
amos.secret.key
=
qazknife4j.production=false
knife4j.production
=
false
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/listener/BaseEnterpriseMqTtlListener.java
View file @
1b614da7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
listener
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.DesUtil
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.RedisUtil
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.DesUtil
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.ApplicationModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @Description: mqtt监听服务
...
...
@@ -44,11 +34,6 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appkey
;
@Autowired
RedisUtil
redisUtil
;
...
...
@@ -58,6 +43,9 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
@Value
(
"${org.filter.group.seq}"
)
private
Long
groupSeq
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
System
.
out
.
println
(
message
);
...
...
@@ -67,9 +55,7 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
setRequestContext
();
FeignClientResult
<
List
<
ApplicationModel
>>
aResult
=
Privilege
.
applicationClient
.
queryAgencyApplications
();
List
<
ApplicationModel
>
aList
=
aResult
.
getResult
();
// List<String> appCodes = aList.stream().filter(i -> "监管端,企业端".indexOf(i.getAppName()) != -1)
...
...
@@ -144,7 +130,7 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
userModel
.
setAppCodes
(
new
ArrayList
<>(
appCodesSet
));
userModel
.
setOrgRoleSeqs
(
roleSeqMap
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
create
(
userModel
);
String
[]
userIds
=
{
userResult
.
getResult
().
getUserId
()
};
String
[]
userIds
=
{
userResult
.
getResult
().
getUserId
()
};
// if (groupSeq != null) {
// Privilege.groupUserClient.create(groupSeq, Arrays.asList(userIds));
// }
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/listener/CarcylUnitInspectMqTtlListener.java
View file @
1b614da7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
listener
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.DesUtil
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.RedisUtil
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.ApplicationModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @Description: mqtt监听服务
...
...
@@ -36,17 +34,15 @@ public class CarcylUnitInspectMqTtlListener extends EmqxListener {
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appkey
;
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${org.filter.group.seq}"
)
private
Long
groupSeq
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
System
.
out
.
println
(
message
);
...
...
@@ -56,15 +52,13 @@ public class CarcylUnitInspectMqTtlListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
setRequestContext
();
FeignClientResult
<
List
<
ApplicationModel
>>
aResult
=
Privilege
.
applicationClient
.
queryAgencyApplications
();
List
<
ApplicationModel
>
aList
=
aResult
.
getResult
();
List
<
String
>
appCodes
=
aList
.
stream
().
filter
(
i
->
"监管端,企业端"
.
indexOf
(
i
.
getAppName
())
!=
-
1
)
.
map
(
i
->
i
.
getAppCode
()).
collect
(
Collectors
.
toList
());
String
uuid
=
object
.
getString
(
"id"
);
Long
id
=
Long
.
valueOf
(
uuid
.
replaceAll
(
"-"
,
""
).
hashCode
());
Long
id
=
Long
.
valueOf
(
uuid
.
replaceAll
(
"-"
,
""
).
hashCode
());
FeignClientResult
<
CompanyModel
>
cResult
=
Privilege
.
companyClient
.
seleteOne
(
id
);
if
(
cResult
.
getResult
()
==
null
)
{
...
...
@@ -100,7 +94,7 @@ public class CarcylUnitInspectMqTtlListener extends EmqxListener {
orgRoles
.
put
(
id
,
roleIds
);
userModel
.
setAppCodes
(
appCodes
);
userModel
.
setOrgRoleSeqs
(
orgRoles
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
create
(
userModel
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
create
(
userModel
);
String
[]
userIds
=
{
userResult
.
getResult
().
getUserId
()};
// if (groupSeq != null) {
// Privilege.groupUserClient.create(groupSeq, Arrays.asList(userIds));
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/listener/PlatformUserTopicMessage.java
View file @
1b614da7
...
...
@@ -5,16 +5,15 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tcm.api.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.service.IRegUnitInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
...
...
@@ -39,23 +38,18 @@ public class PlatformUserTopicMessage extends EmqxListener {
@Autowired
RedisUtils
redisUtil
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appKey
;
@Autowired
IEquipmentCategoryService
equipmentCategoryService
;
@Autowired
IRegUnitInfoService
regUnitInfoService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
setRequestContext
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
message
.
toString
());
JSONObject
result
=
jsonObject
.
getJSONObject
(
"result"
);
JSONObject
dataResult
=
result
.
getJSONObject
(
"result"
);
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/listener/PrivilegeCompanyUpdateAddListener.java
View file @
1b614da7
...
...
@@ -5,10 +5,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.TzBaseEnterpriseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -16,14 +16,16 @@ import org.eclipse.paho.client.mqttv3.MqttMessage;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.Map
;
@Component
@Slf4j
...
...
@@ -40,11 +42,8 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appKey
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
s
,
MqttMessage
message
)
throws
Exception
{
...
...
@@ -58,15 +57,13 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
setRequestContext
();
//判断库中业务tz_base_enterprise_info是否存在
QueryWrapper
<
TzBaseEnterpriseInfo
>
queryWrapper
=
new
QueryWrapper
<
TzBaseEnterpriseInfo
>();
queryWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
queryWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
TzBaseEnterpriseInfo
tzBaseEnterprisePrivilegeInfo
=
tzBaseEnterpriseInfoService
.
getOne
(
queryWrapper
);
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
accessFeignService
.
updateSyncCompanyState
(
object
.
getString
(
"sequence_nbr"
));
return
;
}
...
...
@@ -95,14 +92,14 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
//业务表更新条件构造器
UpdateWrapper
<
TzBaseEnterpriseInfo
>
updateWrapper
=
new
UpdateWrapper
<>();
updateWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
updateWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
String
regCode
=
object
.
getString
(
"reg_code"
);
CompanyModel
supervisePrivilegeCompanyModel
;
if
(!
ValidationUtil
.
isEmpty
(
regCode
))
{
supervisePrivilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
regCode
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
supervisePrivilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
"610000"
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
...
...
@@ -120,37 +117,37 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
tzBaseEnterpriseInfo
.
setSuperviseOrgCode
(
supervisePrivilegeCompanyModel
.
getOrgCode
());
tzBaseEnterpriseInfo
.
setSuperviseOrgName
(
supervisePrivilegeCompanyModel
.
getCompanyName
());
if
(
ValidationUtil
.
isEmpty
(
tzBaseEnterpriseInfo
.
getUnitType
()))
{
if
(
ValidationUtil
.
isEmpty
(
tzBaseEnterpriseInfo
.
getUnitType
()))
{
tzBaseEnterpriseInfo
.
setUnitType
(
""
);
}
try
{
if
(
tzBaseEnterprisePrivilegeInfo
==
null
)
{
if
(
tzBaseEnterprisePrivilegeInfo
==
null
)
{
tzBaseEnterpriseInfoService
.
save
(
tzBaseEnterpriseInfo
);
accessFeignService
.
updateSyncCompanyState
(
object
.
getString
(
"sequence_nbr"
));
return
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"【"
+
object
.
getString
(
"unit_name"
)
+
"】许可信息同步【失败】:"
+
e
.
getMessage
());
}
}
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
return
map
;
}
Iterator
iter
=
companyModels
.
iterator
();
while
(
iter
.
hasNext
())
{
while
(
iter
.
hasNext
())
{
String
json
=
JSON
.
toJSONString
(
iter
.
next
());
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
String
code
=
companyModel
.
getCompanyCode
();
if
(
code
.
length
()
>=
6
)
{
if
(
code
.
length
()
>=
6
)
{
code
=
code
.
substring
(
0
,
6
);
}
map
.
put
(
code
,
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
map
.
put
(
code
,
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
}
return
map
;
}
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/resources/application.properties
View file @
1b614da7
...
...
@@ -132,11 +132,7 @@ tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## \uFFFD\uFFFD\uFFFD\u06BA\u0172\uFFFD\uFFFD\uFFFD\uFFFD\u00FB\uFFFDid\uFFFD\uFFFD\u01BD\u0328userId\uFFFD\uFFFD
tzs.wechat.test.userId
=
3393279
admin.product
=
AMOS-SERVICE-ADMIN
admin.appkey
=
AMOS_ADMIN
admin.user
=
admin_tzs
admin.password
=
a1234560
admin.product.web
=
AMOS-WEB-ADMIN
amos.secret.key
=
qazknife4j.production=false
knife4j.production
=
false
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/listener/BaseEnterpriseMqTtlListener.java
View file @
1b614da7
...
...
@@ -11,6 +11,7 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.boot.module.ymt.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.DesUtil
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.RedisUtil
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
...
...
@@ -44,11 +45,6 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appkey
;
@Autowired
RedisUtil
redisUtil
;
...
...
@@ -58,6 +54,9 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
@Value
(
"${org.filter.group.seq}"
)
private
Long
groupSeq
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
System
.
out
.
println
(
message
);
...
...
@@ -67,9 +66,7 @@ public class BaseEnterpriseMqTtlListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
FeignClientResult
<
List
<
ApplicationModel
>>
aResult
=
Privilege
.
applicationClient
.
queryAgencyApplications
();
List
<
ApplicationModel
>
aList
=
aResult
.
getResult
();
// List<String> appCodes = aList.stream().filter(i -> "监管端,企业端".indexOf(i.getAppName()) != -1)
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/listener/CarcylUnitInspectMqTtlListener.java
View file @
1b614da7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
listener
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.ymt.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.DesUtil
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.RedisUtil
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.ApplicationModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @Description: mqtt监听服务
...
...
@@ -36,17 +34,15 @@ public class CarcylUnitInspectMqTtlListener extends EmqxListener {
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appkey
;
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${org.filter.group.seq}"
)
private
Long
groupSeq
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
System
.
out
.
println
(
message
);
...
...
@@ -56,15 +52,13 @@ public class CarcylUnitInspectMqTtlListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
FeignClientResult
<
List
<
ApplicationModel
>>
aResult
=
Privilege
.
applicationClient
.
queryAgencyApplications
();
List
<
ApplicationModel
>
aList
=
aResult
.
getResult
();
List
<
String
>
appCodes
=
aList
.
stream
().
filter
(
i
->
"监管端,企业端"
.
indexOf
(
i
.
getAppName
())
!=
-
1
)
.
map
(
i
->
i
.
getAppCode
()).
collect
(
Collectors
.
toList
());
String
uuid
=
object
.
getString
(
"id"
);
Long
id
=
Long
.
valueOf
(
uuid
.
replaceAll
(
"-"
,
""
).
hashCode
());
Long
id
=
Long
.
valueOf
(
uuid
.
replaceAll
(
"-"
,
""
).
hashCode
());
FeignClientResult
<
CompanyModel
>
cResult
=
Privilege
.
companyClient
.
seleteOne
(
id
);
if
(
cResult
.
getResult
()
==
null
)
{
...
...
@@ -100,7 +94,7 @@ public class CarcylUnitInspectMqTtlListener extends EmqxListener {
orgRoles
.
put
(
id
,
roleIds
);
userModel
.
setAppCodes
(
appCodes
);
userModel
.
setOrgRoleSeqs
(
orgRoles
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
create
(
userModel
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
create
(
userModel
);
String
[]
userIds
=
{
userResult
.
getResult
().
getUserId
()};
// if (groupSeq != null) {
// Privilege.groupUserClient.create(groupSeq, Arrays.asList(userIds));
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/listener/PlatformUserTopicMessage.java
View file @
1b614da7
...
...
@@ -5,16 +5,15 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.ymt.api.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.ymt.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.service.IRegUnitInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
...
...
@@ -39,23 +38,18 @@ public class PlatformUserTopicMessage extends EmqxListener {
@Autowired
RedisUtils
redisUtil
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appKey
;
@Autowired
IEquipmentCategoryService
equipmentCategoryService
;
@Autowired
IRegUnitInfoService
regUnitInfoService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
message
.
toString
());
JSONObject
result
=
jsonObject
.
getJSONObject
(
"result"
);
JSONObject
dataResult
=
result
.
getJSONObject
(
"result"
);
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/listener/PrivilegeCompanyUpdateAddListener.java
View file @
1b614da7
...
...
@@ -5,10 +5,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.ymt.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.ymt.biz.service.impl.TzBaseEnterpriseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -16,14 +16,15 @@ import org.eclipse.paho.client.mqttv3.MqttMessage;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.Map
;
@Component
@Slf4j
...
...
@@ -40,11 +41,8 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${amos.system.user.product:AMOS_STUDIO_WEB}"
)
String
product
;
@Value
(
"${amos.system.user.app-key:AMOS_STUDIO}"
)
String
appKey
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Override
public
void
processMessage
(
String
s
,
MqttMessage
message
)
throws
Exception
{
...
...
@@ -58,15 +56,13 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"公司同步消息解析失败"
);
}
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
//判断库中业务tz_base_enterprise_info是否存在
QueryWrapper
<
TzBaseEnterpriseInfo
>
queryWrapper
=
new
QueryWrapper
<
TzBaseEnterpriseInfo
>();
queryWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
queryWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
TzBaseEnterpriseInfo
tzBaseEnterprisePrivilegeInfo
=
tzBaseEnterpriseInfoService
.
getOne
(
queryWrapper
);
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
if
(!
ValidationUtil
.
isEmpty
(
tzBaseEnterprisePrivilegeInfo
))
{
accessFeignService
.
updateSyncCompanyState
(
object
.
getString
(
"sequence_nbr"
));
return
;
}
...
...
@@ -95,14 +91,14 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
//业务表更新条件构造器
UpdateWrapper
<
TzBaseEnterpriseInfo
>
updateWrapper
=
new
UpdateWrapper
<>();
updateWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
updateWrapper
.
eq
(
"use_code"
,
object
.
getString
(
"unit_code"
));
String
regCode
=
object
.
getString
(
"reg_code"
);
CompanyModel
supervisePrivilegeCompanyModel
;
if
(!
ValidationUtil
.
isEmpty
(
regCode
))
{
supervisePrivilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
regCode
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
supervisePrivilegeCompanyModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
"610000"
).
getResult
();
if
(
ValidationUtil
.
isEmpty
(
supervisePrivilegeCompanyModel
))
{
...
...
@@ -120,37 +116,37 @@ public class PrivilegeCompanyUpdateAddListener extends EmqxListener {
tzBaseEnterpriseInfo
.
setSuperviseOrgCode
(
supervisePrivilegeCompanyModel
.
getOrgCode
());
tzBaseEnterpriseInfo
.
setSuperviseOrgName
(
supervisePrivilegeCompanyModel
.
getCompanyName
());
if
(
ValidationUtil
.
isEmpty
(
tzBaseEnterpriseInfo
.
getUnitType
()))
{
if
(
ValidationUtil
.
isEmpty
(
tzBaseEnterpriseInfo
.
getUnitType
()))
{
tzBaseEnterpriseInfo
.
setUnitType
(
""
);
}
try
{
if
(
tzBaseEnterprisePrivilegeInfo
==
null
)
{
if
(
tzBaseEnterprisePrivilegeInfo
==
null
)
{
tzBaseEnterpriseInfoService
.
save
(
tzBaseEnterpriseInfo
);
accessFeignService
.
updateSyncCompanyState
(
object
.
getString
(
"sequence_nbr"
));
return
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"【"
+
object
.
getString
(
"unit_name"
)
+
"】许可信息同步【失败】:"
+
e
.
getMessage
());
}
}
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
public
Map
<
String
,
CompanyModel
>
getCompanyInfoMap
(
Collection
companyModels
,
Map
<
String
,
CompanyModel
>
map
)
{
if
(
companyModels
==
null
)
{
return
map
;
}
Iterator
iter
=
companyModels
.
iterator
();
while
(
iter
.
hasNext
())
{
while
(
iter
.
hasNext
())
{
String
json
=
JSON
.
toJSONString
(
iter
.
next
());
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
CompanyModel
companyModel
=
JSON
.
parseObject
(
json
,
CompanyModel
.
class
);
String
code
=
companyModel
.
getCompanyCode
();
if
(
code
.
length
()
>=
6
)
{
if
(
code
.
length
()
>=
6
)
{
code
=
code
.
substring
(
0
,
6
);
}
map
.
put
(
code
,
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
map
.
put
(
code
,
companyModel
);
getCompanyInfoMap
(
companyModel
.
getChildren
(),
map
);
}
return
map
;
}
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/StartPlatformTokenService.java
View file @
1b614da7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
@Service
public
class
StartPlatformTokenService
{
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Value
(
"${admin.user}"
)
String
user
;
@Value
(
"${admin.password}"
)
String
password
;
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
@Autowired
RedisUtil
redisUtil
;
...
...
@@ -34,11 +17,8 @@ public class StartPlatformTokenService {
public
void
getToken
()
{
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appkey
);
String
token
=
amosRequestContext
.
getToken
();
System
.
out
.
println
(
"token:"
+
token
);
RequestContext
.
setToken
(
token
);
redisUtil
.
set
(
"platform_token"
,
token
);
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
}
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
1b614da7
...
...
@@ -41,7 +41,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
...
@@ -63,15 +62,6 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${admin.product}"
)
String
product
;
@Value
(
"${admin.product.web}"
)
String
webProduct
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Autowired
private
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
...
...
@@ -84,8 +74,6 @@ public class TzBaseEnterpriseInfoServiceImpl
@Autowired
RegUnitInfoServiceImpl
regUnitInfoService
;
@Autowired
private
IBaseUnitLicenceService
iBaseUnitLicenceService
;
@Autowired
private
SpeUseUnitServiceImpl
speUseUnitService
;
...
...
@@ -94,29 +82,23 @@ public class TzBaseEnterpriseInfoServiceImpl
private
AccessFeignService
accessFeignService
;
@Autowired
private
ITzBaseEnterpriseInfoService
tzBaseEnterpriseInfoService
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Autowired
RegUnitInfoMapper
regUnitInfoMapper
;
@Value
(
"${tzs.admin.name:tzs_admin}"
)
private
String
tzsAdminName
;
@Value
(
"${tzs.admin.pwd:a1234567}"
)
private
String
tzsAdminPwd
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Value
(
"${redis.cache.failure.time}"
)
private
Long
redisRegionTimeSecond
;
/**机器人用户token缓存key */
public
static
final
String
TZS_USER_TOKEN
=
"TZS_USER_TOKEN"
;
/**
* 企业管理员变更缓存key前缀
*/
private
final
String
adminChange
=
"ADMIN_CHANGE_"
;
@Autowired
private
EquipmentCategoryServiceImpl
equipmentCategoryService
;
...
...
@@ -313,9 +295,7 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
String
syncEnterpriseInfo
()
{
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
"platform_token"
)));
platformTokenService
.
getToken
();
List
<
TzBaseEnterpriseInfo
>
baseEnterpriseInfoList
=
new
ArrayList
<>();
...
...
@@ -538,16 +518,11 @@ public class TzBaseEnterpriseInfoServiceImpl
return
String
.
join
(
","
,
res
);
}
@Override
public
Map
<
String
,
Object
>
adminInfoUpdate
(
Map
<
String
,
Object
>
map
)
{
//每一个企业只有一个管理员,所以当前登录用户即管理员用户
AgencyUserModel
me
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
RequestContext
.
setAppKey
(
appkey
);
RequestContext
.
setProduct
(
webProduct
);
//获取机器人的token,获取不到则去登录
if
(
ObjectUtils
.
isEmpty
(
redisUtil
.
get
(
TZS_USER_TOKEN
)))
{
loginCtiUser
();
}
RequestContext
.
setToken
(
String
.
valueOf
(
redisUtil
.
get
(
TZS_USER_TOKEN
)));
platformTokenService
.
getToken
();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
me
))
{
RegUnitInfo
regUnitInfo
=
new
RegUnitInfo
();
...
...
@@ -572,18 +547,6 @@ public class TzBaseEnterpriseInfoServiceImpl
return
resultMap
;
}
//机器人用户登录
private
void
loginCtiUser
()
{
String
passwd
=
DesUtil
.
encode
(
tzsAdminPwd
,
"qaz"
);
IdPasswordAuthModel
loninData
=
new
IdPasswordAuthModel
();
loninData
.
setLoginId
(
tzsAdminName
);
loninData
.
setPassword
(
passwd
);
FeignClientResult
loginResult
=
Privilege
.
authClient
.
idpassword
(
loninData
);
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
redisUtil
.
set
(
TZS_USER_TOKEN
,
resultMap
.
get
(
"token"
).
toString
(),
redisRegionTimeSecond
);
}
}
public
void
setSpeUseUnitState
(
int
state
,
SpeUseUnit
speUseUnit
){
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/resources/application.properties
View file @
1b614da7
...
...
@@ -122,11 +122,7 @@ tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## \uFFFD\uFFFD\uFFFD\u06BA\u0172\uFFFD\uFFFD\uFFFD\uFFFD\u00FB\uFFFDid\uFFFD\uFFFD\u01BD\u0328userId\uFFFD\uFFFD
tzs.wechat.test.userId
=
3393279
admin.product
=
AMOS-SERVICE-ADMIN
admin.appkey
=
AMOS_ADMIN
admin.user
=
admin_tzs
admin.password
=
a1234560
admin.product.web
=
AMOS-WEB-ADMIN
amos.secret.key
=
qazknife4j.production=false
knife4j.production
=
false
...
...
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