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
2f8e3a67
Commit
2f8e3a67
authored
Aug 31, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
58c43496
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
49 deletions
+79
-49
TzsBaseIndividuality.java
...amos/boot/module/tcm/api/entity/TzsBaseIndividuality.java
+1
-1
TzsBaseInstitution.java
...n/amos/boot/module/tcm/api/entity/TzsBaseInstitution.java
+1
-1
TzsBaseInstitutionServiceImpl.java
...e/tcm/biz/service/impl/TzsBaseInstitutionServiceImpl.java
+74
-45
RegUnitInfoServiceImpl.java
...dule/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+3
-2
No files found.
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/entity/TzsBaseIndividuality.java
View file @
2f8e3a67
...
...
@@ -17,7 +17,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tz
s
_base_individuality"
)
@TableName
(
"tz_base_individuality"
)
public
class
TzsBaseIndividuality
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/entity/TzsBaseInstitution.java
View file @
2f8e3a67
...
...
@@ -17,7 +17,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tz
s
_base_institution"
)
@TableName
(
"tz_base_institution"
)
public
class
TzsBaseInstitution
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
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 @
2f8e3a67
...
...
@@ -67,52 +67,81 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio
}
@Transactional
public
void
register
(
BaseInstitutionRegisterDto
dto
){
dto
.
setUnitCodeType
(
"1060"
);
dto
.
setUnitCodeTypeName
(
"营业执照"
);
String
unitType
=
StringUtils
.
join
(
dto
.
getUnitTypeList
(),
","
);
String
unitTypeCode
=
StringUtils
.
join
(
dto
.
getUnitTypeCodeList
(),
","
);
CompanyModel
companyInfo
=
new
CompanyModel
();
companyInfo
.
setAddress
(
dealNull2EmptyString
(
dto
.
getProvince
())
+
dealNull2EmptyString
(
dto
.
getCity
())
+
dealNull2EmptyString
(
dto
.
getDistrict
())
+
dealNull2EmptyString
(
dto
.
getStree
())
+
dealNull2EmptyString
(
dto
.
getCommunity
())
+
dealNull2EmptyString
(
dto
.
getAddress
()));
companyInfo
.
setAgencyCode
(
"tzs"
);
companyInfo
.
setParentId
(
Long
.
parseLong
(
dto
.
getManagementUnitId
()));
companyInfo
.
setLevel
(
"company"
);
companyInfo
.
setCompanyName
(
dto
.
getName
());
companyInfo
.
setCompanyCode
(
dto
.
getUnitCode
());
companyInfo
.
setContact
(
dto
.
getLegalPerson
());
companyInfo
.
setCompanyType
(
unitType
);
companyInfo
.
setLandlinePhone
(
dto
.
getLegalPersonTel
());
FeignClientResult
<
CompanyModel
>
companyResult
=
Privilege
.
companyClient
.
create
(
companyInfo
);
if
(
companyResult
==
null
||
companyResult
.
getResult
()
==
null
)
{
throw
new
BadRequest
(
"单位注册失败"
);
}
CompanyModel
company
=
companyResult
.
getResult
();
AccountDto
accountDto
=
new
AccountDto
();
accountDto
.
setCompanyId
(
company
.
getSequenceNbr
());
accountDto
.
setUnitTypeCode
(
unitTypeCode
);
regUnitInfoService
.
createUser
(
accountDto
);
RegUnitInfoDto
regUnitInfoDto
=
new
RegUnitInfoDto
();
BeanUtils
.
copyProperties
(
dto
,
regUnitInfoDto
);
TzBaseEnterpriseInfo
baseEnterpriseInfo
=
regUnitInfoService
.
createBaseEnterpriseInfo
(
regUnitInfoDto
);
TzsBaseInstitution
tzsBaseInstitution
=
new
TzsBaseInstitution
();
BeanUtils
.
copyProperties
(
dto
.
getRegUnitIc
(),
tzsBaseInstitution
);
tzsBaseInstitution
.
setEnterpriseId
(
baseEnterpriseInfo
.
getSequenceNbr
());
this
.
save
(
tzsBaseInstitution
);
// 3.插入单位注册许可信息表:tz_base_unit_licence
List
<
BaseUnitLicence
>
baseUnitLicences
=
dto
.
getUnitLicences
().
stream
().
map
(
s
->
{
s
.
setUnitCode
(
dto
.
getUnitCode
());
s
.
setUnitName
(
dto
.
getName
());
BaseUnitLicence
target
=
new
BaseUnitLicence
();
Bean
.
copyExistPropertis
(
s
,
target
);
return
target
;
}).
collect
(
Collectors
.
toList
());
if
(!
baseUnitLicences
.
isEmpty
())
{
baseUnitLicenceService
.
saveOrUpdateBatch
(
baseUnitLicences
);
public
void
register
(
BaseInstitutionRegisterDto
dto
)
{
try
{
dto
.
setUnitCodeType
(
"1060"
);
dto
.
setUnitCodeTypeName
(
"营业执照"
);
String
unitType
=
StringUtils
.
join
(
dto
.
getUnitTypeList
(),
","
);
String
unitTypeCode
=
StringUtils
.
join
(
dto
.
getUnitTypeCodeList
(),
","
);
CompanyModel
companyInfo
=
new
CompanyModel
();
companyInfo
.
setAddress
(
dealNull2EmptyString
(
dto
.
getProvince
())
+
dealNull2EmptyString
(
dto
.
getCity
())
+
dealNull2EmptyString
(
dto
.
getDistrict
())
+
dealNull2EmptyString
(
dto
.
getStree
())
+
dealNull2EmptyString
(
dto
.
getCommunity
())
+
dealNull2EmptyString
(
dto
.
getAddress
()));
companyInfo
.
setAgencyCode
(
"tzs"
);
companyInfo
.
setParentId
(
Long
.
parseLong
(
dto
.
getManagementUnitId
()));
companyInfo
.
setLevel
(
"company"
);
companyInfo
.
setCompanyName
(
dto
.
getName
());
companyInfo
.
setCompanyCode
(
dto
.
getUnitCode
());
companyInfo
.
setContact
(
dto
.
getLegalPerson
());
companyInfo
.
setCompanyType
(
unitType
);
companyInfo
.
setLandlinePhone
(
dto
.
getLegalPersonTel
());
FeignClientResult
<
CompanyModel
>
companyResult
=
Privilege
.
companyClient
.
create
(
companyInfo
);
if
(
companyResult
==
null
||
companyResult
.
getResult
()
==
null
)
{
throw
new
BadRequest
(
"单位注册失败"
);
}
CompanyModel
company
=
companyResult
.
getResult
();
dto
.
setAmosCompanySeq
(
company
.
getSequenceNbr
().
toString
());
AccountDto
accountDto
=
new
AccountDto
();
accountDto
.
setCompanyId
(
company
.
getSequenceNbr
());
accountDto
.
setUnitTypeCode
(
unitTypeCode
);
accountDto
.
setAdminTel
(
dto
.
getAdminTel
());
accountDto
.
setPwd
(
dto
.
getAdminLoginPwd
());
accountDto
.
setLoginName
(
dto
.
getAdminLoginName
());
accountDto
.
setAdminUserName
(
dto
.
getAdminName
());
AgencyUserModel
user
=
regUnitInfoService
.
createUser
(
accountDto
);
dto
.
setAdminUserId
(
user
.
getUserId
());
RegUnitInfoDto
regUnitInfoDto
=
new
RegUnitInfoDto
();
BeanUtils
.
copyProperties
(
dto
,
regUnitInfoDto
);
TzBaseEnterpriseInfo
baseEnterpriseInfo
=
regUnitInfoService
.
createBaseEnterpriseInfo
(
regUnitInfoDto
);
TzsBaseInstitution
tzsBaseInstitution
=
new
TzsBaseInstitution
();
BeanUtils
.
copyProperties
(
dto
.
getRegUnitIc
(),
tzsBaseInstitution
);
tzsBaseInstitution
.
setEnterpriseId
(
baseEnterpriseInfo
.
getSequenceNbr
());
this
.
save
(
tzsBaseInstitution
);
// 3.插入单位注册许可信息表:tz_base_unit_licence
List
<
BaseUnitLicence
>
baseUnitLicences
=
dto
.
getUnitLicences
().
stream
().
map
(
s
->
{
s
.
setUnitCode
(
dto
.
getUnitCode
());
s
.
setUnitName
(
dto
.
getName
());
BaseUnitLicence
target
=
new
BaseUnitLicence
();
Bean
.
copyExistPropertis
(
s
,
target
);
return
target
;
}).
collect
(
Collectors
.
toList
());
if
(!
baseUnitLicences
.
isEmpty
())
{
baseUnitLicenceService
.
saveOrUpdateBatch
(
baseUnitLicences
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
try
{
// 失败后回滚:删除已经创建的企业信息
if
(
StringUtils
.
isNotEmpty
(
dto
.
getAmosCompanySeq
()))
{
FeignClientResult
<
CompanyModel
>
feignClientResult
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
parseLong
(
dto
.
getAmosCompanySeq
()));
if
(
feignClientResult
!=
null
&&
feignClientResult
.
getResult
()
!=
null
)
{
Privilege
.
companyClient
.
deleteCompany
(
dto
.
getAmosCompanySeq
());
}
}
// 失败后回滚:删除已经创建的管理员账号
if
(
StringUtils
.
isNotEmpty
(
dto
.
getAdminUserId
()))
{
FeignClientResult
<
AgencyUserModel
>
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
dto
.
getAdminUserId
());
if
(
feignClientResult
!=
null
&&
feignClientResult
.
getResult
()
!=
null
)
{
Privilege
.
agencyUserClient
.
multDeleteUser
(
dto
.
getAdminUserId
());
}
}
}
catch
(
Exception
rollbackException
)
{
log
.
error
(
"回滚操作发生异常: {}"
,
rollbackException
.
getMessage
(),
rollbackException
);
}
throw
new
RuntimeException
(
"事业单位注册失败,请联系管理员!"
);
}
}
...
...
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 @
2f8e3a67
...
...
@@ -790,7 +790,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
}
}
public
void
createUser
(
AccountDto
dto
)
{
public
AgencyUserModel
createUser
(
AccountDto
dto
)
{
FeignClientResult
<
AgencyUserModel
>
userResult
=
null
;
try
{
List
<
RoleModel
>
allRoleList
=
startPlatformTokenService
.
getAllRole
();
...
...
@@ -842,6 +842,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
if
(
userResult
==
null
||
userResult
.
getResult
()
==
null
)
{
throw
new
BadRequest
(
"单位注册失败"
);
}
return
userResult
.
getResult
();
}
catch
(
Exception
e
)
{
// 删除已经创建的 企业信息
if
(
dto
.
getCompanyId
()
!=
null
)
{
...
...
@@ -851,7 +852,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
&&
StringUtils
.
isNotEmpty
(
userResult
.
getResult
().
getUserId
()))
{
Privilege
.
agencyUserClient
.
multDeleteUser
(
userResult
.
getResult
().
getUserId
());
}
log
ger
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
RuntimeException
(
e
.
getMessage
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment