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
dc10ac1d
Commit
dc10ac1d
authored
Aug 31, 2022
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加orgcode过滤
parent
92744707
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
41 deletions
+80
-41
TzBaseEnterpriseInfoMapper.java
...oot/module/tzs/api/mapper/TzBaseEnterpriseInfoMapper.java
+4
-2
TzsJgMapper.java
.../yeejoin/amos/boot/module/tzs/api/mapper/TzsJgMapper.java
+2
-2
RegUnitInfoServiceImpl.java
...dule/tzs/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+74
-37
No files found.
amos-boot-system-tzs/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/mapper/TzBaseEnterpriseInfoMapper.java
View file @
dc10ac1d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.annotations.DataAuth
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.EquEnterDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.EquEnterDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.TzBaseEnterpriseInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.TzBaseEnterpriseInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo
;
import
java.util.List
;
/**
/**
* 企业数据信息 Mapper 接口
* 企业数据信息 Mapper 接口
*
*
...
@@ -40,5 +41,6 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
...
@@ -40,5 +41,6 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
*/
*/
TzBaseEnterpriseInfo
selectByUseUnit
(
String
useUnit
);
TzBaseEnterpriseInfo
selectByUseUnit
(
String
useUnit
);
@DataAuth
(
interfacePath
=
"enterprise"
)
IPage
<
TzBaseEnterpriseInfoDto
>
page
(
Page
<
TzBaseEnterpriseInfoDto
>
page
,
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
);
IPage
<
TzBaseEnterpriseInfoDto
>
page
(
Page
<
TzBaseEnterpriseInfoDto
>
page
,
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
);
}
}
amos-boot-system-tzs/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/mapper/TzsJgMapper.java
View file @
dc10ac1d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.annotations.DataAuth
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgBasicInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgBasicInfoDto
;
public
interface
TzsJgMapper
{
public
interface
TzsJgMapper
{
@DataAuth
(
interfacePath
=
"equipment"
)
IPage
<
TzsJgBasicInfoDto
>
page
(
Page
<
TzsJgBasicInfoDto
>
page
,
TzsJgBasicInfoDto
tzsJgBasicInfoDto
);
IPage
<
TzsJgBasicInfoDto
>
page
(
Page
<
TzsJgBasicInfoDto
>
page
,
TzsJgBasicInfoDto
tzsJgBasicInfoDto
);
}
}
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/RegUnitInfoServiceImpl.java
View file @
dc10ac1d
...
@@ -6,6 +6,7 @@ import java.util.Collections;
...
@@ -6,6 +6,7 @@ import java.util.Collections;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -54,7 +55,8 @@ import com.yeejoin.amos.feign.privilege.model.RoleModel;
...
@@ -54,7 +55,8 @@ import com.yeejoin.amos.feign.privilege.model.RoleModel;
* @date 2022-08-09
* @date 2022-08-09
*/
*/
@Service
@Service
public
class
RegUnitInfoServiceImpl
extends
BaseService
<
RegUnitInfoDto
,
RegUnitInfo
,
RegUnitInfoMapper
>
implements
IRegUnitInfoService
{
public
class
RegUnitInfoServiceImpl
extends
BaseService
<
RegUnitInfoDto
,
RegUnitInfo
,
RegUnitInfoMapper
>
implements
IRegUnitInfoService
{
@Autowired
@Autowired
BaseUnitLicenceServiceImpl
baseUnitLicenceService
;
BaseUnitLicenceServiceImpl
baseUnitLicenceService
;
...
@@ -87,7 +89,6 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -87,7 +89,6 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
*/
*/
private
static
String
DICT_TYPE_UNIT_TYPE
=
"UNIT_TYPE_NEW"
;
private
static
String
DICT_TYPE_UNIT_TYPE
=
"UNIT_TYPE_NEW"
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
RegUnitInfoDto
registerUnit
(
RegUnitInfoDto
model
)
{
public
RegUnitInfoDto
registerUnit
(
RegUnitInfoDto
model
)
{
...
@@ -98,8 +99,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -98,8 +99,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
model
.
setUnitCodeType
(
"1060"
);
model
.
setUnitCodeType
(
"1060"
);
model
.
setUnitCodeTypeName
(
"营业执照"
);
model
.
setUnitCodeTypeName
(
"营业执照"
);
Bean
.
copyExistPropertis
(
model
,
regUnitInfo
);
Bean
.
copyExistPropertis
(
model
,
regUnitInfo
);
regUnitInfo
.
setUnitType
(
StringUtils
.
join
(
model
.
getUnitTypeList
(),
","
));
regUnitInfo
.
setUnitType
(
StringUtils
.
join
(
model
.
getUnitTypeList
(),
","
));
regUnitInfo
.
setUnitTypeCode
(
StringUtils
.
join
(
model
.
getUnitTypeCodeList
(),
","
));
regUnitInfo
.
setUnitTypeCode
(
StringUtils
.
join
(
model
.
getUnitTypeCodeList
(),
","
));
// 1.插入单位注册许可信息表:tz_base_unit_licence
// 1.插入单位注册许可信息表:tz_base_unit_licence
List
<
BaseUnitLicenceDto
>
unitLicenceDtos
=
model
.
getUnitLicences
();
List
<
BaseUnitLicenceDto
>
unitLicenceDtos
=
model
.
getUnitLicences
();
List
<
BaseUnitLicence
>
baseUnitLicences
=
unitLicenceDtos
.
stream
().
map
(
s
->
{
List
<
BaseUnitLicence
>
baseUnitLicences
=
unitLicenceDtos
.
stream
().
map
(
s
->
{
...
@@ -109,7 +110,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -109,7 +110,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
Bean
.
copyExistPropertis
(
s
,
target
);
Bean
.
copyExistPropertis
(
s
,
target
);
return
target
;
return
target
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
if
(!
baseUnitLicences
.
isEmpty
())
{
if
(!
baseUnitLicences
.
isEmpty
())
{
baseUnitLicenceService
.
saveOrUpdateBatch
(
baseUnitLicences
);
baseUnitLicenceService
.
saveOrUpdateBatch
(
baseUnitLicences
);
}
}
// 2.插入工商单位信息表:tz_flc_reg_unit_ic
// 2.插入工商单位信息表:tz_flc_reg_unit_ic
...
@@ -135,17 +136,19 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -135,17 +136,19 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// 5.3工商信息
// 5.3工商信息
model
.
setRegUnitIc
(
Bean
.
toModel
(
regUnitIc
,
new
RegUnitIcDto
()));
model
.
setRegUnitIc
(
Bean
.
toModel
(
regUnitIc
,
new
RegUnitIcDto
()));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
// 失败后回滚:删除已经创建的企业信息
// 失败后回滚:删除已经创建的企业信息
if
(
StringUtils
.
isNotEmpty
(
regUnitInfo
.
getAmosCompanySeq
()))
{
if
(
StringUtils
.
isNotEmpty
(
regUnitInfo
.
getAmosCompanySeq
()))
{
FeignClientResult
<
CompanyModel
>
feignClientResult
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
parseLong
(
regUnitInfo
.
getAmosCompanySeq
()));
FeignClientResult
<
CompanyModel
>
feignClientResult
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
parseLong
(
regUnitInfo
.
getAmosCompanySeq
()));
if
(
feignClientResult
!=
null
)
{
if
(
feignClientResult
!=
null
)
{
Privilege
.
companyClient
.
deleteCompany
(
regUnitInfo
.
getAmosCompanySeq
());
Privilege
.
companyClient
.
deleteCompany
(
regUnitInfo
.
getAmosCompanySeq
());
}
}
}
}
// 失败后回滚:删除已经创建的管理员账号
// 失败后回滚:删除已经创建的管理员账号
if
(
StringUtils
.
isNotEmpty
(
regUnitInfo
.
getAdminUserId
()))
{
if
(
StringUtils
.
isNotEmpty
(
regUnitInfo
.
getAdminUserId
()))
{
FeignClientResult
<
AgencyUserModel
>
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
regUnitInfo
.
getAdminUserId
());
FeignClientResult
<
AgencyUserModel
>
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
regUnitInfo
.
getAdminUserId
());
if
(
feignClientResult
!=
null
)
{
if
(
feignClientResult
!=
null
)
{
Privilege
.
agencyUserClient
.
multDeleteUser
(
regUnitInfo
.
getAdminUserId
());
Privilege
.
agencyUserClient
.
multDeleteUser
(
regUnitInfo
.
getAdminUserId
());
}
}
...
@@ -157,12 +160,13 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -157,12 +160,13 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
public
void
createBaseEnterpriseInfo
(
RegUnitInfoDto
regUnitInfo
)
{
public
void
createBaseEnterpriseInfo
(
RegUnitInfoDto
regUnitInfo
)
{
// 1.查询管辖公司的信息
// 1.查询管辖公司的信息
FeignClientResult
<
CompanyModel
>
feignClientResult
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
parseLong
(
regUnitInfo
.
getManagementUnitId
()));
FeignClientResult
<
CompanyModel
>
feignClientResult
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
parseLong
(
regUnitInfo
.
getManagementUnitId
()));
CompanyModel
managementCompany
=
feignClientResult
.
getResult
();
CompanyModel
managementCompany
=
feignClientResult
.
getResult
();
// 2.填充数据
// 2.填充数据
TzBaseEnterpriseInfo
baseEnterpriseInfo
=
new
TzBaseEnterpriseInfo
();
TzBaseEnterpriseInfo
baseEnterpriseInfo
=
new
TzBaseEnterpriseInfo
();
baseEnterpriseInfo
.
setUseUnitCertificate
(
regUnitInfo
.
getUnitCodeTypeName
());
baseEnterpriseInfo
.
setUseUnitCertificate
(
regUnitInfo
.
getUnitCodeTypeName
());
baseEnterpriseInfo
.
setUnitType
(
StringUtils
.
join
(
regUnitInfo
.
getUnitTypeList
(),
"#"
));
baseEnterpriseInfo
.
setUnitType
(
StringUtils
.
join
(
regUnitInfo
.
getUnitTypeList
(),
"#"
));
baseEnterpriseInfo
.
setUseCode
(
regUnitInfo
.
getUnitCode
());
baseEnterpriseInfo
.
setUseCode
(
regUnitInfo
.
getUnitCode
());
baseEnterpriseInfo
.
setUseUnit
(
regUnitInfo
.
getName
());
baseEnterpriseInfo
.
setUseUnit
(
regUnitInfo
.
getName
());
baseEnterpriseInfo
.
setProvince
(
regUnitInfo
.
getProvince
());
baseEnterpriseInfo
.
setProvince
(
regUnitInfo
.
getProvince
());
...
@@ -196,7 +200,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -196,7 +200,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Override
@Override
public
RegUnitInfoDto
unitCheck
(
String
unitCode
,
String
unitType
)
{
public
RegUnitInfoDto
unitCheck
(
String
unitCode
,
String
unitType
)
{
// 1.校验重复性
// 1.校验重复性
RegUnitInfo
regUnitInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getUnitCode
,
unitCode
));
RegUnitInfo
regUnitInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getUnitCode
,
unitCode
));
if
(
regUnitInfo
!=
null
)
{
if
(
regUnitInfo
!=
null
)
{
throw
new
RuntimeException
(
"该单位已注册,请联系企业管理员!"
);
throw
new
RuntimeException
(
"该单位已注册,请联系企业管理员!"
);
}
}
...
@@ -204,9 +209,10 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -204,9 +209,10 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
RegUnitInfoDto
regUnitInfoDto
=
new
RegUnitInfoDto
();
RegUnitInfoDto
regUnitInfoDto
=
new
RegUnitInfoDto
();
if
(
USE_UNIT_TYPE_CODE
.
equals
(
unitType
))
{
if
(
USE_UNIT_TYPE_CODE
.
equals
(
unitType
))
{
// 本地库有的化 就不去其他系统查询
// 本地库有的化 就不去其他系统查询
RegUnitIc
regUnitIc
=
regUnitIcService
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitIc
>().
eq
(
RegUnitIc:
:
getUnitCode
,
unitCode
));
RegUnitIc
regUnitIc
=
regUnitIcService
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitIc
>().
eq
(
RegUnitIc:
:
getUnitCode
,
unitCode
));
regUnitInfoDto
.
setRegUnitIc
(
Bean
.
toModel
(
regUnitIc
,
new
RegUnitIcDto
()));
regUnitInfoDto
.
setRegUnitIc
(
Bean
.
toModel
(
regUnitIc
,
new
RegUnitIcDto
()));
if
(
regUnitIc
==
null
)
{
if
(
regUnitIc
==
null
)
{
// 2.1 使用单位调用行政许可系统接口进行查询工商信息
// 2.1 使用单位调用行政许可系统接口进行查询工商信息
// MultiValueMap<String, String> headers = new HttpHeaders();
// MultiValueMap<String, String> headers = new HttpHeaders();
// headers.add("header-1","v1");
// headers.add("header-1","v1");
...
@@ -223,11 +229,13 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -223,11 +229,13 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
}
}
}
else
{
}
else
{
RegUnitIc
regUnitIc
=
regUnitIcService
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitIc
>().
eq
(
RegUnitIc:
:
getUnitCode
,
unitCode
));
RegUnitIc
regUnitIc
=
regUnitIcService
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitIc
>().
eq
(
RegUnitIc:
:
getUnitCode
,
unitCode
));
regUnitInfoDto
.
setRegUnitIc
(
Bean
.
toModel
(
regUnitIc
,
new
RegUnitIcDto
()));
regUnitInfoDto
.
setRegUnitIc
(
Bean
.
toModel
(
regUnitIc
,
new
RegUnitIcDto
()));
}
}
// 2.3 许可信息组装
// 2.3 许可信息组装
List
<
BaseUnitLicence
>
unitLicences
=
baseUnitLicenceService
.
list
(
new
LambdaQueryWrapper
<
BaseUnitLicence
>().
eq
(
BaseUnitLicence:
:
getUnitCode
,
unitCode
));
List
<
BaseUnitLicence
>
unitLicences
=
baseUnitLicenceService
.
list
(
new
LambdaQueryWrapper
<
BaseUnitLicence
>().
eq
(
BaseUnitLicence:
:
getUnitCode
,
unitCode
));
regUnitInfoDto
.
setUnitLicences
(
Bean
.
toModels
(
unitLicences
,
BaseUnitLicenceDto
.
class
));
regUnitInfoDto
.
setUnitLicences
(
Bean
.
toModels
(
unitLicences
,
BaseUnitLicenceDto
.
class
));
return
regUnitInfoDto
;
return
regUnitInfoDto
;
}
}
...
@@ -242,33 +250,49 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -242,33 +250,49 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
tzsAuthServiceImpl
.
setRequestContext
();
tzsAuthServiceImpl
.
setRequestContext
();
// 组织架构中单位级别为:省级、地市级、区县级的单位
// 组织架构中单位级别为:省级、地市级、区县级的单位
List
<
CompanyModel
>
companyModels
=
new
ArrayList
<
CompanyModel
>();
List
<
CompanyModel
>
companyModels
=
new
ArrayList
<
CompanyModel
>();
if
(
StringUtils
.
isEmpty
(
orgCode
))
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
{
companyModels
=
(
List
<
CompanyModel
>)
Privilege
.
companyClient
.
queryAgencyTree
(
null
).
getResult
();
companyModels
=
(
List
<
CompanyModel
>)
Privilege
.
companyClient
.
queryAgencyTree
(
null
).
getResult
();
}
else
}
else
{
LinkedHashMap
<
Object
,
Object
>
l
=
(
LinkedHashMap
<
Object
,
Object
>)
Privilege
.
companyClient
.
queryByOrgcode
(
orgCode
).
getResult
();
for
(
Map
.
Entry
<
Object
,
Object
>
it
:
l
.
entrySet
())
{
Privilege
.
companyClient
.
queryByOrgcode
(
orgCode
).
getResult
();
CompanyModel
companyModel
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
it
.
getValue
()),
CompanyModel
.
class
);
if
(
companyModel
!=
null
)
{
{
companyModels
=
(
List
<
CompanyModel
>)
Privilege
.
companyClient
.
queryByOrgcode
(
orgCode
).
getResult
();
companyModels
=
(
List
<
CompanyModel
>)
Privilege
.
companyClient
.
querySubAgencyTree
(
companyModel
.
getSequenceNbr
()).
getResult
();
}
break
;
}
}
}
return
companyModels
.
stream
().
filter
(
c
->
"headquarter"
.
equals
(
c
.
getLevel
())
||
"prefecture-level"
.
equals
(
c
.
getLevel
())
||
"county"
.
equals
(
c
.
getLevel
())).
map
(
this
::
dealChildCompany
).
collect
(
Collectors
.
toList
());
return
companyModels
.
stream
().
filter
(
c
->
"headquarter"
.
equals
(
c
.
getLevel
())
||
"prefecture-level"
.
equals
(
c
.
getLevel
())
||
"county"
.
equals
(
c
.
getLevel
())).
map
(
this
::
dealChildCompany
)
.
collect
(
Collectors
.
toList
());
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
unitLogOut
(
String
unitCode
)
{
public
Boolean
unitLogOut
(
String
unitCode
)
{
RegUnitInfo
regUnitInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getUnitCode
,
unitCode
));
RegUnitInfo
regUnitInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getUnitCode
,
unitCode
));
if
(
regUnitInfo
==
null
)
{
if
(
regUnitInfo
==
null
)
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
}
try
{
try
{
// 1.删除已经创建的企业信息
// 1.删除已经创建的企业信息
if
(
StringUtils
.
isNotEmpty
(
regUnitInfo
.
getAmosCompanySeq
()))
{
if
(
StringUtils
.
isNotEmpty
(
regUnitInfo
.
getAmosCompanySeq
()))
{
CompanyModel
companyModel
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
parseLong
(
regUnitInfo
.
getAmosCompanySeq
())).
getResult
();
CompanyModel
companyModel
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
parseLong
(
regUnitInfo
.
getAmosCompanySeq
())).
getResult
();
if
(
companyModel
!=
null
)
{
if
(
companyModel
!=
null
)
{
Privilege
.
companyClient
.
deleteCompany
(
regUnitInfo
.
getAmosCompanySeq
());
Privilege
.
companyClient
.
deleteCompany
(
regUnitInfo
.
getAmosCompanySeq
());
}
}
}
}
// 2.删除已经创建的管理员账号
// 2.删除已经创建的管理员账号
FeignClientResult
<
AgencyUserModel
>
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
regUnitInfo
.
getAdminUserId
());
FeignClientResult
<
AgencyUserModel
>
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
regUnitInfo
.
getAdminUserId
());
if
(
feignClientResult
!=
null
)
{
if
(
feignClientResult
!=
null
)
{
Privilege
.
agencyUserClient
.
multDeleteUser
(
regUnitInfo
.
getAdminUserId
());
Privilege
.
agencyUserClient
.
multDeleteUser
(
regUnitInfo
.
getAdminUserId
());
}
}
...
@@ -280,29 +304,33 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -280,29 +304,33 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// 4.工商信息表删除
// 4.工商信息表删除
regUnitIcService
.
remove
(
new
LambdaQueryWrapper
<
RegUnitIc
>().
eq
(
RegUnitIc:
:
getUnitCode
,
unitCode
));
regUnitIcService
.
remove
(
new
LambdaQueryWrapper
<
RegUnitIc
>().
eq
(
RegUnitIc:
:
getUnitCode
,
unitCode
));
// 5.许可信息删除
// 5.许可信息删除
baseUnitLicenceService
.
remove
(
new
LambdaQueryWrapper
<
BaseUnitLicence
>().
eq
(
BaseUnitLicence:
:
getUnitCode
,
unitCode
));
baseUnitLicenceService
.
remove
(
new
LambdaQueryWrapper
<
BaseUnitLicence
>().
eq
(
BaseUnitLicence:
:
getUnitCode
,
unitCode
));
// 6.企业数据信息删除
// 6.企业数据信息删除
tzBaseEnterpriseInfoService
.
remove
(
new
LambdaQueryWrapper
<
TzBaseEnterpriseInfo
>().
eq
(
TzBaseEnterpriseInfo:
:
getUseCode
,
unitCode
));
tzBaseEnterpriseInfoService
.
remove
(
new
LambdaQueryWrapper
<
TzBaseEnterpriseInfo
>().
eq
(
TzBaseEnterpriseInfo:
:
getUseCode
,
unitCode
));
// 7.机场单位表信息删除
// 7.机场单位表信息删除
iOrgUsrService
.
remove
(
new
LambdaQueryWrapper
<
OrgUsr
>().
eq
(
OrgUsr:
:
getAmosOrgId
,
regUnitInfo
.
getAmosCompanySeq
()));
iOrgUsrService
.
remove
(
new
LambdaQueryWrapper
<
OrgUsr
>().
eq
(
OrgUsr:
:
getAmosOrgId
,
regUnitInfo
.
getAmosCompanySeq
()));
return
Boolean
.
TRUE
;
return
Boolean
.
TRUE
;
}
}
@Override
@Override
public
Boolean
checkRepeatAccount
(
String
userName
)
{
public
Boolean
checkRepeatAccount
(
String
userName
)
{
return
this
.
count
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getAdminLoginName
,
userName
))
>
0
;
return
this
.
count
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getAdminLoginName
,
userName
))
>
0
;
}
}
@Override
@Override
public
Boolean
checkRepeatPhone
(
String
phoneNo
)
{
public
Boolean
checkRepeatPhone
(
String
phoneNo
)
{
return
this
.
count
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getAdminTel
,
phoneNo
))
>
0
;
return
this
.
count
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getAdminTel
,
phoneNo
))
>
0
;
}
}
private
CompanyModel
dealChildCompany
(
CompanyModel
cm
)
{
private
CompanyModel
dealChildCompany
(
CompanyModel
cm
)
{
cm
.
setChildren
(
this
.
getFilterChild
(
cm
.
getChildren
()
!=
null
?
cm
.
getChildren
()
:
new
ArrayList
()));
cm
.
setChildren
(
this
.
getFilterChild
(
cm
.
getChildren
()
!=
null
?
cm
.
getChildren
()
:
new
ArrayList
()));
cm
.
getChildren
().
stream
().
filter
(
n
->
{
cm
.
getChildren
().
stream
().
filter
(
n
->
{
CompanyModel
c
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
n
),
CompanyModel
.
class
);
CompanyModel
c
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
n
),
CompanyModel
.
class
);
return
"headquarter"
.
equals
(
c
.
getLevel
())
||
"prefecture-level"
.
equals
(
c
.
getLevel
())
||
"county"
.
equals
(
c
.
getLevel
());
return
"headquarter"
.
equals
(
c
.
getLevel
())
||
"prefecture-level"
.
equals
(
c
.
getLevel
())
||
"county"
.
equals
(
c
.
getLevel
());
}).
map
(
n
->
{
}).
map
(
n
->
{
CompanyModel
c
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
n
),
CompanyModel
.
class
);
CompanyModel
c
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
n
),
CompanyModel
.
class
);
return
dealChildCompany
(
c
);
return
dealChildCompany
(
c
);
...
@@ -313,7 +341,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -313,7 +341,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
private
List
getFilterChild
(
Collection
children
)
{
private
List
getFilterChild
(
Collection
children
)
{
return
(
List
)
children
.
stream
().
filter
(
n
->
{
return
(
List
)
children
.
stream
().
filter
(
n
->
{
CompanyModel
c
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
n
),
CompanyModel
.
class
);
CompanyModel
c
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
n
),
CompanyModel
.
class
);
return
"headquarter"
.
equals
(
c
.
getLevel
())
||
"prefecture-level"
.
equals
(
c
.
getLevel
())
||
"county"
.
equals
(
c
.
getLevel
());
return
"headquarter"
.
equals
(
c
.
getLevel
())
||
"prefecture-level"
.
equals
(
c
.
getLevel
())
||
"county"
.
equals
(
c
.
getLevel
());
}).
map
(
s
->
{
}).
map
(
s
->
{
CompanyModel
c
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
s
),
CompanyModel
.
class
);
CompanyModel
c
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
s
),
CompanyModel
.
class
);
c
.
setChildren
(
this
.
getFilterChild
(
c
.
getChildren
()
!=
null
?
c
.
getChildren
()
:
new
ArrayList
()));
c
.
setChildren
(
this
.
getFilterChild
(
c
.
getChildren
()
!=
null
?
c
.
getChildren
()
:
new
ArrayList
()));
...
@@ -331,7 +360,10 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -331,7 +360,10 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
List
<
Long
>
roleIds
=
new
ArrayList
<>();
List
<
Long
>
roleIds
=
new
ArrayList
<>();
Set
<
String
>
roleNameSet
=
new
HashSet
<>();
Set
<
String
>
roleNameSet
=
new
HashSet
<>();
// 3.1创建公司
// 3.1创建公司
companyInfo
.
setAddress
(
dealNull2EmptyString
(
regUnitInfo
.
getProvince
())
+
dealNull2EmptyString
(
regUnitInfo
.
getCity
())
+
dealNull2EmptyString
(
regUnitInfo
.
getDistrict
())
+
dealNull2EmptyString
(
regUnitInfo
.
getStree
())
+
dealNull2EmptyString
(
regUnitInfo
.
getCommunity
())
+
dealNull2EmptyString
(
regUnitInfo
.
getAddress
()));
companyInfo
.
setAddress
(
dealNull2EmptyString
(
regUnitInfo
.
getProvince
())
+
dealNull2EmptyString
(
regUnitInfo
.
getCity
())
+
dealNull2EmptyString
(
regUnitInfo
.
getDistrict
())
+
dealNull2EmptyString
(
regUnitInfo
.
getStree
())
+
dealNull2EmptyString
(
regUnitInfo
.
getCommunity
())
+
dealNull2EmptyString
(
regUnitInfo
.
getAddress
()));
companyInfo
.
setAgencyCode
(
"tzs"
);
companyInfo
.
setAgencyCode
(
"tzs"
);
companyInfo
.
setParentId
(
Long
.
parseLong
(
regUnitInfo
.
getManagementUnitId
()));
companyInfo
.
setParentId
(
Long
.
parseLong
(
regUnitInfo
.
getManagementUnitId
()));
companyInfo
.
setLevel
(
"company"
);
companyInfo
.
setLevel
(
"company"
);
...
@@ -364,14 +396,17 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -364,14 +396,17 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
Set
<
String
>
appCodesSet
=
new
HashSet
<>();
Set
<
String
>
appCodesSet
=
new
HashSet
<>();
Map
<
Long
,
List
<
Long
>>
roleSeqMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
Long
>>
roleSeqMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
for
(
String
TypeCode:
units
)
{
for
(
String
TypeCode
:
units
)
{
DataDictionary
unitType
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
TypeCode
));
DataDictionary
unitType
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
TypeCode
));
String
appCode
=
unitType
.
getTypeDesc
()
!=
null
?
unitType
.
getTypeDesc
()
:
""
;
String
appCode
=
unitType
.
getTypeDesc
()
!=
null
?
unitType
.
getTypeDesc
()
:
""
;
String
[]
appCodes
=
appCode
.
split
(
","
);
String
[]
appCodes
=
appCode
.
split
(
","
);
Collections
.
addAll
(
appCodesSet
,
appCodes
);
Collections
.
addAll
(
appCodesSet
,
appCodes
);
roleNameSet
.
add
(
unitType
.
getName
());
roleNameSet
.
add
(
unitType
.
getName
());
userRoleList
=
allRoleList
.
stream
().
filter
(
r
->
r
.
getRoleName
().
equals
(
unitType
.
getName
())).
collect
(
Collectors
.
toList
());
userRoleList
=
allRoleList
.
stream
().
filter
(
r
->
r
.
getRoleName
().
equals
(
unitType
.
getName
()))
for
(
RoleModel
roleModel
:
allRoleList
.
stream
().
filter
(
r
->
r
.
getRoleName
().
equals
(
unitType
.
getExtend
())).
collect
(
Collectors
.
toList
())){
.
collect
(
Collectors
.
toList
());
for
(
RoleModel
roleModel
:
allRoleList
.
stream
()
.
filter
(
r
->
r
.
getRoleName
().
equals
(
unitType
.
getExtend
())).
collect
(
Collectors
.
toList
()))
{
userRoleList
.
add
(
roleModel
);
userRoleList
.
add
(
roleModel
);
}
}
userRoleList
.
forEach
(
r
->
roleIds
.
add
(
r
.
getSequenceNbr
()));
userRoleList
.
forEach
(
r
->
roleIds
.
add
(
r
.
getSequenceNbr
()));
...
@@ -403,7 +438,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -403,7 +438,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
if
(
companyInfo
!=
null
&&
companyInfo
.
getSequenceNbr
()
!=
null
)
{
if
(
companyInfo
!=
null
&&
companyInfo
.
getSequenceNbr
()
!=
null
)
{
Privilege
.
companyClient
.
deleteCompany
(
companyInfo
.
getSequenceNbr
()
+
""
);
Privilege
.
companyClient
.
deleteCompany
(
companyInfo
.
getSequenceNbr
()
+
""
);
}
}
if
(
userResult
!=
null
&&
userResult
.
getResult
()
!=
null
&&
StringUtils
.
isNotEmpty
(
userResult
.
getResult
().
getUserId
()))
{
if
(
userResult
!=
null
&&
userResult
.
getResult
()
!=
null
&&
StringUtils
.
isNotEmpty
(
userResult
.
getResult
().
getUserId
()))
{
Privilege
.
agencyUserClient
.
multDeleteUser
(
userResult
.
getResult
().
getUserId
());
Privilege
.
agencyUserClient
.
multDeleteUser
(
userResult
.
getResult
().
getUserId
());
}
}
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
...
@@ -411,7 +447,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -411,7 +447,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
}
}
}
}
private
String
dealNull2EmptyString
(
String
t
)
{
private
String
dealNull2EmptyString
(
String
t
)
{
return
StringUtils
.
isEmpty
(
t
)
?
""
:
t
;
return
StringUtils
.
isEmpty
(
t
)
?
""
:
t
;
}
}
}
}
\ 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