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
85d79a97
Commit
85d79a97
authored
Sep 04, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(tcm): 重构企业信息处理逻辑
- 优化了企业信息处理流程,修复了部分企业缺少 appId 的问题 - 为个人主体和已有企业信息的企业生成 appId
parent
5b2bfd9f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
153 additions
and
57 deletions
+153
-57
CommonVideoDto.java
.../com/yeejoin/amos/boot/biz/common/dto/CommonVideoDto.java
+4
-0
BaseEnterpriseVideoServiceImpl.java
...mmon/biz/service/impl/BaseEnterpriseVideoServiceImpl.java
+12
-14
TzBaseEnterpriseInfoMapper.java
...oot/module/tcm/api/mapper/TzBaseEnterpriseInfoMapper.java
+4
-0
TzBaseEnterpriseInfoMapper.xml
.../src/main/resources/mapper/TzBaseEnterpriseInfoMapper.xml
+18
-0
HistoryDataDealController.java
.../module/tcm/biz/controller/HistoryDataDealController.java
+6
-0
HistoryDataDealServiceImpl.java
...dule/tcm/biz/service/impl/HistoryDataDealServiceImpl.java
+82
-1
TzsBaseIndividualityServiceImpl.java
...tcm/biz/service/impl/TzsBaseIndividualityServiceImpl.java
+1
-0
TzsBaseInstitutionServiceImpl.java
...e/tcm/biz/service/impl/TzsBaseInstitutionServiceImpl.java
+1
-16
RegUnitInfoServiceImpl.java
...dule/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+25
-26
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/dto/CommonVideoDto.java
View file @
85d79a97
...
...
@@ -40,4 +40,8 @@ public class CommonVideoDto {
*/
private
Integer
quality
;
/**
* 设备所属使用登记证编号
*/
private
String
useRegistrationCode
;
}
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/BaseEnterpriseVideoServiceImpl.java
View file @
85d79a97
...
...
@@ -78,7 +78,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
videoList
.
forEach
(
video
->
{
List
<
CommonVideoDto
>
commonVideoDtos
=
new
ArrayList
<>();
try
{
Map
<
String
,
Object
>
artemisInfo
=
initArtemisConfigAndPath
(
baseEnterpriseVideo
);
Map
<
String
,
Object
>
artemisInfo
=
initArtemisConfigAndPath
(
baseEnterpriseVideo
,
baseEnterpriseVideo
.
getUrl
()
);
ArtemisConfig
config
=
(
ArtemisConfig
)
artemisInfo
.
get
(
"config"
);
Map
<
String
,
String
>
path
=
(
Map
<
String
,
String
>)
artemisInfo
.
get
(
"path"
);
...
...
@@ -136,11 +136,11 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
* 初始化Artemis配置和路径信息
*
* @param baseEnterpriseVideo 视频设备信息
* @param apiUrl
* @return 包含 ArtemisConfig、请求路径和协议的Map
*/
private
Map
<
String
,
Object
>
initArtemisConfigAndPath
(
BaseEnterpriseVideo
baseEnterpriseVideo
)
throws
URISyntaxException
{
String
getCamerasUrl
=
baseEnterpriseVideo
.
getUrl
();
// 或 getTokenUrl(),根据具体方法传入
Map
<
String
,
String
>
uriInfo
=
parseUri
(
getCamerasUrl
);
private
Map
<
String
,
Object
>
initArtemisConfigAndPath
(
BaseEnterpriseVideo
baseEnterpriseVideo
,
String
apiUrl
)
throws
URISyntaxException
{
Map
<
String
,
String
>
uriInfo
=
parseUri
(
apiUrl
);
String
protocol
=
uriInfo
.
get
(
"protocol"
);
String
hostPort
=
uriInfo
.
get
(
"hostPort"
);
String
urlPath
=
uriInfo
.
get
(
"urlPath"
);
...
...
@@ -194,15 +194,9 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
String
dataS
=
videoJsonObject
.
get
(
"data"
).
toString
();
JSONObject
dd
=
JSON
.
parseObject
(
dataS
);
String
url
=
dd
.
get
(
"url"
).
toString
();
CommonVideoDto
commonVideoDto
=
new
CommonVideoDto
();
commonVideoDto
.
setUrl
(
url
);
commonVideoDto
.
setKey
(
channelNo
.
getKey
());
commonVideoDto
.
setType
(
CommonVideoEnum
.
getEnum
(
video
.
getProtocol
()).
getName
());
commonVideoDto
.
setTitle
(
channelNo
.
getTitle
());
commonVideoDto
.
setThumb
(
channelNo
.
getThumb
());
commonVideoDto
.
setQuality
(
channelNo
.
getQuality
());
commonVideoDto
.
setSupportH265
(
channelNo
.
getSupportH265
());
result
.
add
(
commonVideoDto
);
channelNo
.
setUrl
(
url
);
channelNo
.
setType
(
CommonVideoEnum
.
getEnum
(
video
.
getProtocol
()).
getName
());
result
.
add
(
channelNo
);
}
else
{
String
errorMsg
=
"code:"
+
codeVideo
+
"msg:"
+
msgVideo
+
"appKey:"
+
video
.
getAppKey
()
+
"appSecret:"
+
video
.
getAppSecret
()
+
"accessToken:"
+
accessToken
;
log
.
info
(
"视频地址获取失败errorMsg:{}"
,
errorMsg
);
...
...
@@ -269,7 +263,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
List
<
CommonVideoDto
>
commonVideoDtos
=
new
ArrayList
<>();
BaseEnterpriseVideo
baseEnterpriseVideo
=
iSecureCenterVideoList
.
get
(
0
);
try
{
Map
<
String
,
Object
>
artemisInfo
=
initArtemisConfigAndPath
(
baseEnterpriseVideo
);
Map
<
String
,
Object
>
artemisInfo
=
initArtemisConfigAndPath
(
baseEnterpriseVideo
,
baseEnterpriseVideo
.
getTokenUrl
()
);
ArtemisConfig
config
=
(
ArtemisConfig
)
artemisInfo
.
get
(
"config"
);
Map
<
String
,
String
>
path
=
(
Map
<
String
,
String
>)
artemisInfo
.
get
(
"path"
);
...
...
@@ -299,10 +293,14 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
dataList
.
forEach
(
data
->
{
CommonVideoDto
commonVideoDto
=
new
CommonVideoDto
();
JSONObject
dataJson
=
(
JSONObject
)
data
;
/* dataJson返回结果样例
{"regionIndexCode":"cac9325d1ac74415b064a621595f6e09","capabilitySetName":"GPS事件能力,视频事件能力,IO能力,视频能力,录像能力,视频设备远程获取能力,设备维护能力,客流统计事件能力,状态能力","channelNo":"3","latitude":"34.4765399909899","channelType":"digital","cameraIndexCode":"9215c9a92f574a7da23523ef6894c5a2","recordLocation":"1","cameraTypeName":"xres.query.camera.type.qj","recordLocationName":"xres.query.device.store","channelTypeName":"xres.query.camera.digital","transTypeName":"TCP","cameraName":"迂回站上车区","longitude":"108.9768070075236","installLocation":"索12陕J00001(21)","updateTime":"2025-08-20T10:44:56.273+08:00","gbIndexCode":"61000000001310257002","cameraType":0,"transType":1,"createTime":"2025-04-07T11:16:01.258+08:00","capabilitySet":"event_gps,event_vss,io,vss,record,remote_vss,maintenance,event_pdc,status","encodeDevIndexCode":"94dddc8ed1124f8c9cd9537beb12ef72"}
*/
commonVideoDto
.
setKey
(
dataJson
.
getString
(
"cameraIndexCode"
));
commonVideoDto
.
setLabel
(
dataJson
.
getString
(
"cameraName"
));
commonVideoDto
.
setTitle
(
dataJson
.
getString
(
"cameraName"
));
commonVideoDto
.
setParent
(
baseEnterpriseVideo
.
getUseUnitCode
());
commonVideoDto
.
setUseRegistrationCode
(
dataJson
.
getString
(
"installLocation"
));
commonVideoDtos
.
add
(
commonVideoDto
);
});
return
commonVideoDtos
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/mapper/TzBaseEnterpriseInfoMapper.java
View file @
85d79a97
...
...
@@ -102,4 +102,8 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
void
updateRedundantSupervisionOrgCodeStatistics
(
String
newOrgCode
,
String
oldOrgCode
);
void
updateEquipmentSupervisionOrgCode
(
String
newOrgCode
,
String
newSupervisionName
,
List
<
String
>
equipmentList
);
List
<
Map
<
String
,
String
>>
getIndividualUserId
();
List
<
Map
<
String
,
String
>>
selectOnlyHasBaseInfoAppId
();
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/resources/mapper/TzBaseEnterpriseInfoMapper.xml
View file @
85d79a97
...
...
@@ -456,4 +456,22 @@
#{record}
</foreach>
</update>
<select
id=
"getIndividualUserId"
resultType=
"java.util.Map"
>
SELECT
pc.company_code companyCode, uor.user_id adminUserId
FROM
privilege_company pc
LEFT JOIN privilege_user_org_role uor ON uor.company_seq = pc.sequence_nbr
WHERE
pc.is_deleted = 0
AND pc.company_code IN ( SELECT use_code FROM "tz_base_enterprise_info" WHERE unit_type = '个人主体' AND is_delete = 0 AND app_id is null)
AND uor.role_seq = 1697171841505849345
</select>
<select
id=
"selectOnlyHasBaseInfoAppId"
resultType=
"java.util.Map"
>
select use_unit_code useUnitCode, app_id appId from tz_base_enterprise_info WHERE app_id is not null
except
select unit_code useUnitCode, app_id appId from tz_flc_reg_unit_info WHERE app_id is not null
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/controller/HistoryDataDealController.java
View file @
85d79a97
...
...
@@ -55,4 +55,10 @@ public class HistoryDataDealController {
return
ResponseHelper
.
buildResponse
(
historyDataDealService
.
handleCompanyHisOrgCode
(
orgCodeMap
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/handleCompanyAppId"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修复未生成appId的旧企业数据"
,
notes
=
"修复未生成appId的旧企业数据"
)
public
ResponseModel
<
String
>
handleCompanyAppId
(
@RequestBody
(
required
=
false
)
List
<
String
>
useUnitCodes
)
{
return
ResponseHelper
.
buildResponse
(
historyDataDealService
.
handleCompanyAppId
(
useUnitCodes
));
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/HistoryDataDealServiceImpl.java
View file @
85d79a97
...
...
@@ -9,7 +9,11 @@ import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import
com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.UnitTypeEnum
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.entity.RegUnitInfo
;
import
com.yeejoin.amos.boot.module.tcm.flc.biz.service.impl.RegUnitInfoServiceImpl
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
...
...
@@ -18,6 +22,7 @@ import org.springframework.util.StopWatch;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @author Administrator
...
...
@@ -32,10 +37,13 @@ public class HistoryDataDealServiceImpl {
private
TzBaseEnterpriseInfoServiceImpl
baseEnterpriseInfoService
;
public
HistoryDataDealServiceImpl
(
TzsUserInfoServiceImpl
userInfoService
,
TzsUserPermissionServiceImpl
userPermissionService
,
TzBaseEnterpriseInfoServiceImpl
baseEnterpriseInfoService
)
{
private
RegUnitInfoServiceImpl
regUnitInfoService
;
public
HistoryDataDealServiceImpl
(
TzsUserInfoServiceImpl
userInfoService
,
TzsUserPermissionServiceImpl
userPermissionService
,
TzBaseEnterpriseInfoServiceImpl
baseEnterpriseInfoService
,
RegUnitInfoServiceImpl
regUnitInfoService
)
{
this
.
userInfoService
=
userInfoService
;
this
.
userPermissionService
=
userPermissionService
;
this
.
baseEnterpriseInfoService
=
baseEnterpriseInfoService
;
this
.
regUnitInfoService
=
regUnitInfoService
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -153,4 +161,77 @@ public class HistoryDataDealServiceImpl {
});
return
"success"
;
}
public
String
handleCompanyAppId
(
List
<
String
>
useUnitCodes
)
{
log
.
info
(
"为没有appId的企业生成appId开始"
);
List
<
TzBaseEnterpriseInfo
>
unitListWithOutAppId
;
if
(!
ValidationUtil
.
isEmpty
(
useUnitCodes
))
{
unitListWithOutAppId
=
baseEnterpriseInfoService
.
getBaseMapper
().
selectList
(
new
LambdaQueryWrapper
<
TzBaseEnterpriseInfo
>().
in
(
TzBaseEnterpriseInfo:
:
getUseUnitCode
,
useUnitCodes
).
isNull
(
TzBaseEnterpriseInfo:
:
getAppId
));
}
else
{
unitListWithOutAppId
=
baseEnterpriseInfoService
.
getBaseMapper
().
selectList
(
new
LambdaQueryWrapper
<
TzBaseEnterpriseInfo
>().
isNull
(
TzBaseEnterpriseInfo:
:
getAppId
));
}
if
(!
ValidationUtil
.
isEmpty
(
unitListWithOutAppId
))
{
// 处理企业未生成appId
List
<
TzBaseEnterpriseInfo
>
companyListWithOutAppId
;
companyListWithOutAppId
=
unitListWithOutAppId
.
stream
().
filter
(
unit
->
!
UnitTypeEnum
.
grzt
.
getName
().
equals
(
unit
.
getUnitType
())).
collect
(
Collectors
.
toList
());
if
(!
ValidationUtil
.
isEmpty
(
companyListWithOutAppId
))
{
List
<
RegUnitInfo
>
regUnitInfoList
=
regUnitInfoService
.
list
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
in
(
RegUnitInfo:
:
getUnitCode
,
companyListWithOutAppId
.
stream
().
map
(
TzBaseEnterpriseInfo:
:
getUseUnitCode
).
collect
(
Collectors
.
toList
())));
if
(!
ValidationUtil
.
isEmpty
(
regUnitInfoList
))
{
regUnitInfoList
.
forEach
(
regUnitInfo
->
{
if
(
ValidationUtil
.
isEmpty
(
regUnitInfo
.
getAppId
()))
{
AgencyUserModel
user
=
new
AgencyUserModel
();
user
.
setUserId
(
regUnitInfo
.
getAdminUserId
());
try
{
regUnitInfo
.
setAppId
(
regUnitInfoService
.
createAppId
(
user
));
}
catch
(
Exception
e
)
{
log
.
error
(
"为没有appId的企业生成appId异常"
,
e
);
throw
new
RuntimeException
(
e
);
}
}
companyListWithOutAppId
.
stream
().
filter
(
company
->
company
.
getUseUnitCode
().
equals
(
regUnitInfo
.
getUnitCode
())).
forEach
(
company
->
company
.
setAppId
(
regUnitInfo
.
getAppId
()));
});
baseEnterpriseInfoService
.
updateBatchById
(
companyListWithOutAppId
);
regUnitInfoService
.
updateBatchById
(
regUnitInfoList
);
}
}
List
<
TzBaseEnterpriseInfo
>
individualListWithOutAppId
=
unitListWithOutAppId
.
stream
().
filter
(
unit
->
UnitTypeEnum
.
grzt
.
getName
().
equals
(
unit
.
getUnitType
())).
collect
(
Collectors
.
toList
());;
// 处理个人主体未生成appId
List
<
Map
<
String
,
String
>>
individualUserId
=
baseEnterpriseInfoService
.
getBaseMapper
().
getIndividualUserId
();
if
(!
ValidationUtil
.
isEmpty
(
individualUserId
))
{
individualUserId
.
forEach
(
map
->
{
AgencyUserModel
user
=
new
AgencyUserModel
();
user
.
setUserId
(
map
.
get
(
"adminUserId"
));
try
{
map
.
put
(
"appId"
,
regUnitInfoService
.
createAppId
(
user
));
}
catch
(
Exception
e
)
{
log
.
error
(
"为没有appId的企业生成appId异常"
,
e
);
throw
new
RuntimeException
(
e
);
}
});
}
if
(!
ValidationUtil
.
isEmpty
(
individualListWithOutAppId
))
{
individualListWithOutAppId
.
forEach
(
individual
->
{
Optional
<
Map
<
String
,
String
>>
firstMap
=
individualUserId
.
stream
().
filter
(
map
->
map
.
get
(
"companyCode"
).
equals
(
individual
.
getUseCode
())).
findFirst
();
firstMap
.
ifPresent
(
stringMap
->
individual
.
setAppId
(
stringMap
.
get
(
"appId"
)));
});
baseEnterpriseInfoService
.
updateBatchById
(
individualListWithOutAppId
);
}
}
// 处理baseInfo表有appId,但是regUnitInfo表没有appId的
List
<
Map
<
String
,
String
>>
onlyHasBaseInfoAppId
=
baseEnterpriseInfoService
.
getBaseMapper
().
selectOnlyHasBaseInfoAppId
();
if
(!
ValidationUtil
.
isEmpty
(
onlyHasBaseInfoAppId
))
{
List
<
RegUnitInfo
>
regUnitInfoList
=
regUnitInfoService
.
list
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
isNull
(
RegUnitInfo:
:
getAppId
).
in
(
RegUnitInfo:
:
getUnitCode
,
onlyHasBaseInfoAppId
.
stream
().
map
(
e
->
e
.
get
(
"useUnitCode"
)).
collect
(
Collectors
.
toList
())));
if
(!
ValidationUtil
.
isEmpty
(
regUnitInfoList
))
{
regUnitInfoList
.
forEach
(
regUnitInfo
->
{
Optional
<
Map
<
String
,
String
>>
firstMap
=
onlyHasBaseInfoAppId
.
stream
().
filter
(
map
->
map
.
get
(
"useUnitCode"
).
equals
(
regUnitInfo
.
getUnitCode
())).
findFirst
();
firstMap
.
ifPresent
(
stringMap
->
regUnitInfo
.
setAppId
(
stringMap
.
get
(
"appId"
)));
});
regUnitInfoService
.
updateBatchById
(
regUnitInfoList
);
}
}
log
.
info
(
"为没有appId的企业生成appId结束"
);
return
"success"
;
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzsBaseIndividualityServiceImpl.java
View file @
85d79a97
...
...
@@ -101,6 +101,7 @@ public class TzsBaseIndividualityServiceImpl extends BaseService<TzsBaseIndividu
dto
.
setAdminUserId
(
user
.
getUserId
());
RegUnitInfoDto
regUnitInfoDto
=
new
RegUnitInfoDto
();
BeanUtils
.
copyProperties
(
dto
,
regUnitInfoDto
);
regUnitInfoDto
.
setAppId
(
regUnitInfoService
.
createAppId
(
user
));
baseEnterpriseInfo
=
regUnitInfoService
.
createBaseEnterpriseInfo
(
regUnitInfoDto
,
EnterpriseEnums
.
GR_ZT
.
getType
());
TzsBaseIndividuality
tzsBaseIndividuality
=
new
TzsBaseIndividuality
();
BeanUtils
.
copyProperties
(
dto
,
tzsBaseIndividuality
);
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzsBaseInstitutionServiceImpl.java
View file @
85d79a97
...
...
@@ -20,7 +20,6 @@ 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.util.DesUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -38,9 +37,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
flc
.
biz
.
service
.
impl
.
RegUnitInfoServiceImpl
.
DEFAULT_PASSWORD
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
flc
.
biz
.
service
.
impl
.
RegUnitInfoServiceImpl
.
SECRETKEY
;
/**
* 服务实现类
*
...
...
@@ -118,7 +114,7 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio
dto
.
setAdminUserId
(
user
.
getUserId
());
RegUnitInfoDto
regUnitInfoDto
=
new
RegUnitInfoDto
();
BeanUtils
.
copyProperties
(
dto
,
regUnitInfoDto
);
this
.
createAppId
(
user
,
regUnitInfoDto
);
regUnitInfoDto
.
setAppId
(
regUnitInfoService
.
createAppId
(
user
)
);
baseEnterpriseInfo
=
regUnitInfoService
.
createBaseEnterpriseInfo
(
regUnitInfoDto
,
EnterpriseEnums
.
SY_DW
.
getType
());
TzsBaseInstitution
tzsBaseInstitution
=
new
TzsBaseInstitution
();
BeanUtils
.
copyProperties
(
dto
.
getRegUnitMessage
(),
tzsBaseInstitution
);
...
...
@@ -182,17 +178,6 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio
publisher
.
publish
(
new
DataRefreshEvent
(
this
,
Collections
.
singletonList
(
baseEnterpriseInfo
.
getSequenceNbr
()
+
""
),
DataRefreshEvent
.
DataType
.
enterprise
.
name
(),
DataRefreshEvent
.
Operation
.
INSERT
));
}
private
void
createAppId
(
AgencyUserModel
user
,
RegUnitInfoDto
regUnitInfoDto
)
throws
Exception
{
AgencyUserModel
shadowUser
=
new
AgencyUserModel
();
shadowUser
.
setUserId
(
user
.
getUserId
());
String
appId
=
DesUtil
.
encode
(
user
.
getUserId
(),
SECRETKEY
);
shadowUser
.
setUserName
(
appId
);
shadowUser
.
setPassword
(
DEFAULT_PASSWORD
);
Privilege
.
agencyUserClient
.
createLoginInfoAppId
(
shadowUser
);
regUnitInfoDto
.
setAppId
(
appId
);
}
private
String
dealNull2EmptyString
(
String
t
)
{
return
StringUtils
.
isEmpty
(
t
)
?
""
:
t
;
}
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
View file @
85d79a97
...
...
@@ -51,6 +51,7 @@ 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.LoginInfoModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
...
...
@@ -841,36 +842,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
if
(
userResult
==
null
||
userResult
.
getResult
()
==
null
)
{
throw
new
BadRequest
(
"单位注册失败"
);
}
// //同步创建为当前注册管理员添加两员配备人员信息
// if (userResult.getStatus() == 200) {
// TzsUserInfo tzsUserInfo = new TzsUserInfo();
// tzsUserInfo.setName(regUnitInfo.getAdminName());
// tzsUserInfo.setCertificateType("344");
// tzsUserInfo.setLockStatus("UNLOCK");
// tzsUserInfo.setCertificateNum(regUnitInfo.getAdminIdNumber());
// tzsUserInfo.setUnitName(regUnitInfo.getName());
// tzsUserInfo.setUnitCode(regUnitInfo.getUnitCode());
// tzsUserInfo.setPhone(regUnitInfo.getAdminTel());
// tzsUserInfo.setAmosUserId(userResult.getResult().getUserId());
// tzsUserInfo.setAmosUserName(regUnitInfo.getAdminLoginName());
// tzsUserInfoService.save(tzsUserInfo);
// }
// 生成用户id
String
adminUserId
=
userResult
.
getResult
().
getUserId
();
// 省内充装单位1231:生成对接数据账号
// if (Arrays.asList(units).contains(FILLING_UNIT_TYPE) && (ValidationUtil.isEmpty(regUnitInfo.getIsNationwide()) || "0".equals(regUnitInfo.getIsNationwide()))) {
// 20250701 改为全部企业类型生成对接数据账号@tianbo
// if (ValidationUtil.isEmpty(regUnitInfo.getIsNationwide()) || "0".equals(regUnitInfo.getIsNationwide())) {
AgencyUserModel
shadowUser
=
new
AgencyUserModel
();
shadowUser
.
setUserId
(
adminUserId
);
String
appId
=
DesUtil
.
encode
(
adminUserId
,
SECRETKEY
);
shadowUser
.
setUserName
(
appId
);
shadowUser
.
setPassword
(
DEFAULT_PASSWORD
);
Privilege
.
agencyUserClient
.
createLoginInfoAppId
(
shadowUser
);
regUnitInfo
.
setAppId
(
appId
);
// }
// 所有企业均生成appId
regUnitInfo
.
setAppId
(
this
.
createAppId
(
userResult
.
getResult
()));
regUnitInfo
.
setAdminUserId
(
adminUserId
);
regUnitInfo
.
setAmosCompanySeq
(
companyInfo
.
getSequenceNbr
().
toString
());
...
...
@@ -1195,4 +1172,25 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
public
void
updateBySeq
(
RegUnitInfo
regUnitInfo
)
{
this
.
updateById
(
regUnitInfo
);
}
public
String
createAppId
(
AgencyUserModel
user
)
throws
Exception
{
AgencyUserModel
shadowUser
=
new
AgencyUserModel
();
shadowUser
.
setUserId
(
user
.
getUserId
());
String
appId
=
DesUtil
.
encode
(
user
.
getUserId
(),
SECRETKEY
);
FeignClientResult
<
LoginInfoModel
>
result
=
Privilege
.
agencyUserClient
.
getLoginInfo
(
appId
);
// 如果已经存在appId登录方式则用查询到的appId直接返回
if
(!
ValidationUtil
.
isEmpty
(
result
)
&&
!
ValidationUtil
.
isEmpty
(
result
.
getResult
()))
{
appId
=
result
.
getResult
().
getLoginId
();
return
appId
;
}
shadowUser
.
setUserName
(
appId
);
shadowUser
.
setPassword
(
DEFAULT_PASSWORD
);
// 查询有没有为该userId创建过账号,没有则跳过。历史错误数据会执行
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
user
.
getUserId
());
if
(
ValidationUtil
.
isEmpty
(
userResult
)
||
ValidationUtil
.
isEmpty
(
userResult
.
getResult
()))
{
return
null
;
}
Privilege
.
agencyUserClient
.
createLoginInfoAppId
(
shadowUser
);
return
appId
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment