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
c9e2b923
Commit
c9e2b923
authored
Mar 07, 2023
by
zhangyingbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ugp同步tzs企业注册
parent
148227f3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
297 additions
and
99 deletions
+297
-99
UgpServiceFeignClient.java
.../boot/module/tzs/flc/api/feign/UgpServiceFeignClient.java
+26
-0
RegUnitInfoServiceImpl.java
...dule/tzs/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+40
-2
OrgEnum.java
...va/com/yeejoin/amos/boot/module/ugp/api/Enum/OrgEnum.java
+20
-13
CompanyController.java
...mos/boot/module/ugp/biz/controller/CompanyController.java
+20
-0
CompanyServiceImpl.java
.../boot/module/ugp/biz/service/impl/CompanyServiceImpl.java
+171
-82
OrgServiceImpl.java
...amos/boot/module/ugp/biz/service/impl/OrgServiceImpl.java
+15
-2
pom.xml
amos-boot-system-ugp/pom.xml
+5
-0
No files found.
amos-boot-system-tzs/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/feign/UgpServiceFeignClient.java
0 → 100644
View file @
c9e2b923
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.Map
;
@FeignClient
(
name
=
"UGP-ZYB"
,
path
=
"/ugp"
,
configuration
=
{
MultipartSupportConfig
.
class
})
public
interface
UgpServiceFeignClient
{
/**
* 调用ugp的接口
* @param object 公司信息
* @return
*/
@RequestMapping
(
value
=
"/company/syncCompany"
,
method
=
RequestMethod
.
POST
)
ResponseModel
<
Boolean
>
syncCompany
(
@RequestBody
Object
object
);
}
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 @
c9e2b923
...
@@ -11,16 +11,21 @@ import java.util.LinkedHashMap;
...
@@ -11,16 +11,21 @@ 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
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.FutureTask
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.feign.UgpServiceFeignClient
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
@@ -53,6 +58,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
...
@@ -53,6 +58,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
/**
/**
* 单位注册信息表服务实现类
* 单位注册信息表服务实现类
...
@@ -87,6 +93,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -87,6 +93,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Autowired
@Autowired
AccessFeignService
accessFeignService
;
AccessFeignService
accessFeignService
;
@Autowired
UgpServiceFeignClient
ugpServiceFeignClient
;
@Autowired
@Autowired
StartPlatformTokenService
startPlatformTokenService
;
StartPlatformTokenService
startPlatformTokenService
;
...
@@ -123,6 +132,28 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -123,6 +132,28 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
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
(),
","
));
// 3.2 自动创建:调用平台进行创建单位、用户信息
this
.
createCompanyAndUser
(
regUnitInfo
);
//多线程同步ugp信息
String
token
=
RequestContext
.
getToken
();
String
appKey
=
RequestContext
.
getAppKey
();
String
product
=
RequestContext
.
getProduct
();
Callable
callable
=
new
Callable
(){
@Override
public
Object
call
()
throws
Exception
{
RequestContext
.
setToken
(
token
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
//同步企业至ugp,成功返回true,失败返回false
return
ugpServiceFeignClient
.
syncCompany
(
model
);
}
};
FutureTask
<
ResponseModel
<
Boolean
>>
future
=
new
FutureTask
(
callable
);
Thread
thread
=
new
Thread
(
future
);
thread
.
start
();
// 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
->
{
...
@@ -145,8 +176,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -145,8 +176,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// if (UnitReviewStateEnum.NO_NEED_REVIEW.getCode().equals(model.getState())) {
// if (UnitReviewStateEnum.NO_NEED_REVIEW.getCode().equals(model.getState())) {
// 3.1 创建企业信息
// 3.1 创建企业信息
this
.
createBaseEnterpriseInfo
(
model
);
this
.
createBaseEnterpriseInfo
(
model
);
// 3.2 自动创建:调用平台进行创建单位、用户信息
this
.
createCompanyAndUser
(
regUnitInfo
);
// }
// }
// 4.插入注册单位基本信息表:tz_flc_reg_unit_info
// 4.插入注册单位基本信息表:tz_flc_reg_unit_info
this
.
save
(
regUnitInfo
);
this
.
save
(
regUnitInfo
);
...
@@ -157,6 +188,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -157,6 +188,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
model
.
setUnitLicences
(
Bean
.
toModels
(
baseUnitLicences
,
BaseUnitLicenceDto
.
class
));
model
.
setUnitLicences
(
Bean
.
toModels
(
baseUnitLicences
,
BaseUnitLicenceDto
.
class
));
// 5.3工商信息
// 5.3工商信息
model
.
setRegUnitIc
(
Bean
.
toModel
(
regUnitIc
,
new
RegUnitIcDto
()));
model
.
setRegUnitIc
(
Bean
.
toModel
(
regUnitIc
,
new
RegUnitIcDto
()));
//获取多线程执行结果 true成功 false失败
if
(!
future
.
get
().
getResult
()){
throw
new
Exception
(
"UGP信息同步失败"
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
// 失败后回滚:删除已经创建的企业信息
// 失败后回滚:删除已经创建的企业信息
...
@@ -180,6 +217,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -180,6 +217,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
return
model
;
return
model
;
}
}
public
void
createBaseEnterpriseInfo
(
RegUnitInfoDto
regUnitInfo
)
{
public
void
createBaseEnterpriseInfo
(
RegUnitInfoDto
regUnitInfo
)
{
// 1.查询管辖公司的信息
// 1.查询管辖公司的信息
FeignClientResult
<
CompanyModel
>
feignClientResult
=
Privilege
.
companyClient
FeignClientResult
<
CompanyModel
>
feignClientResult
=
Privilege
.
companyClient
...
...
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/Enum/OrgEnum.java
View file @
c9e2b923
...
@@ -9,19 +9,19 @@ import java.util.HashMap;
...
@@ -9,19 +9,19 @@ import java.util.HashMap;
@Getter
@Getter
@AllArgsConstructor
@AllArgsConstructor
public
enum
OrgEnum
{
public
enum
OrgEnum
{
公司
(
"COMPANY"
,
"244"
,
"公司"
,
1
,
"studio_normalapp_4403119"
),
公司
(
"COMPANY"
,
"244"
,
"公司"
,
1
,
"studio_normalapp_4403119"
,
""
),
部门
(
"DEPARTMENT"
,
"245"
,
"部门"
,
2
,
"studio_normalapp_4403119"
),
部门
(
"DEPARTMENT"
,
"245"
,
"部门"
,
2
,
"studio_normalapp_4403119"
,
""
),
普通人员
(
"PERSON"
,
"246"
,
"普通人员"
,
3
,
"studio_normalapp_4403119"
),
普通人员
(
"PERSON"
,
"246"
,
"普通人员"
,
3
,
"studio_normalapp_4403119"
,
""
),
焊工
(
"WELDER"
,
"247"
,
"焊工"
,
3
,
"studio_normalapp_4403119"
),
焊工
(
"WELDER"
,
"247"
,
"焊工"
,
3
,
"studio_normalapp_4403119"
,
""
),
管理员
(
"USER"
,
"945"
,
"管理员"
,
3
,
"ddd"
),
管理员
(
"USER"
,
"945"
,
"管理员"
,
3
,
"ddd"
,
""
),
建设单位负责人
(
"CHARGE"
,
"254"
,
"建设单位负责人"
,
3
,
"studio_normalapp_4403119"
),
建设单位负责人
(
"CHARGE"
,
"254"
,
"建设单位负责人"
,
3
,
"studio_normalapp_4403119"
,
""
),
企业管理员
(
"ADMIN"
,
"248"
,
"企业管理员"
,
3
,
"studio_normalapp_4403119"
),
企业管理员
(
"ADMIN"
,
"248"
,
"企业管理员"
,
3
,
"studio_normalapp_4403119"
,
""
),
建设单位
(
"CONSTRUCTION"
,
"249"
,
"建设单位"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4760213"
),
建设单位
(
"CONSTRUCTION"
,
"249"
,
"建设单位"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4760213"
,
"1232"
),
安装单位
(
"INSTALL"
,
"250"
,
"安装单位"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4760213"
),
安装单位
(
"INSTALL"
,
"250"
,
"安装单位"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4760213"
,
"1234"
),
设计单位
(
"DESIGN"
,
"251"
,
"设计单位"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4760213"
),
设计单位
(
"DESIGN"
,
"251"
,
"设计单位"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4760213"
,
"1235"
),
监察部门
(
"SUPERVISION"
,
"252"
,
"监察部门"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4761616"
),
监察部门
(
"SUPERVISION"
,
"252"
,
"监察部门"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4761616"
,
""
),
监检机构
(
"MONITORING"
,
"253"
,
"监检机构"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4761616"
),
监检机构
(
"MONITORING"
,
"253"
,
"监检机构"
,
1
,
"studio_normalapp_4403119,studio_normalapp_4761616"
,
"1233"
),
监理单位
(
"SUPERVISOR"
,
"254"
,
"监理单位"
,
1
,
""
);
监理单位
(
"SUPERVISOR"
,
"254"
,
"监理单位"
,
1
,
""
,
"1237"
);
private
String
key
;
private
String
key
;
private
String
code
;
private
String
code
;
...
@@ -31,13 +31,20 @@ public enum OrgEnum {
...
@@ -31,13 +31,20 @@ public enum OrgEnum {
*/
*/
private
Integer
type
;
private
Integer
type
;
private
String
appCode
;
private
String
appCode
;
/**
* tzs服务字典对应code
*/
private
String
dictionaryCode
;
public
static
HashMap
<
String
,
String
>
map
=
new
HashMap
();
public
static
HashMap
<
String
,
String
>
map
=
new
HashMap
();
public
static
HashMap
<
String
,
String
>
codeMap
=
new
HashMap
();
public
static
HashMap
<
String
,
String
>
codeMap
=
new
HashMap
();
public
static
HashMap
<
String
,
String
>
dictionaryCodeMap
=
new
HashMap
();
static
{
static
{
for
(
OrgEnum
orgPersonEnum:
OrgEnum
.
values
()){
for
(
OrgEnum
orgPersonEnum:
OrgEnum
.
values
()){
map
.
put
(
orgPersonEnum
.
getKey
(),
orgPersonEnum
.
getName
());
map
.
put
(
orgPersonEnum
.
getKey
(),
orgPersonEnum
.
getName
());
codeMap
.
put
(
orgPersonEnum
.
getKey
(),
orgPersonEnum
.
getAppCode
());
codeMap
.
put
(
orgPersonEnum
.
getKey
(),
orgPersonEnum
.
getAppCode
());
dictionaryCodeMap
.
put
(
orgPersonEnum
.
getDictionaryCode
(),
orgPersonEnum
.
getKey
());
}
}
}
}
}
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/controller/CompanyController.java
View file @
c9e2b923
...
@@ -106,6 +106,26 @@ public class CompanyController extends BaseController {
...
@@ -106,6 +106,26 @@ public class CompanyController extends BaseController {
@Autowired
@Autowired
SuperviseRuleServiceImpl
superviseRuleService
;
SuperviseRuleServiceImpl
superviseRuleService
;
/**
* tzs注册时同步ugp库
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/syncCompany"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"tzs注册时同步ugp库"
,
notes
=
"tzs注册时同步ugp库"
)
public
ResponseModel
<
Boolean
>
syncCompany
(
@RequestBody
Object
object
)
{
Boolean
bool
=
true
;
try
{
companyServiceImpl
.
syncCompany
(
object
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
bool
=
false
;
}
return
ResponseHelper
.
buildResponse
(
bool
);
}
/**
/**
* 新增企业信息表
* 新增企业信息表
...
...
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/CompanyServiceImpl.java
View file @
c9e2b923
...
@@ -9,7 +9,6 @@ import com.google.common.collect.Lists;
...
@@ -9,7 +9,6 @@ import com.google.common.collect.Lists;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.CompanyExamineEnum
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.CompanyExamineEnum
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Company
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Company
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.UnitLicence
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.UnitLicence
;
...
@@ -19,15 +18,16 @@ import com.yeejoin.amos.boot.module.ugp.api.mapper.UnitLicenceMapper;
...
@@ -19,15 +18,16 @@ import com.yeejoin.amos.boot.module.ugp.api.mapper.UnitLicenceMapper;
import
com.yeejoin.amos.boot.module.ugp.api.service.ICompanyService
;
import
com.yeejoin.amos.boot.module.ugp.api.service.ICompanyService
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.CompanyDto
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.CompanyDto
;
import
com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify
;
import
com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.privilege.model.*
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.ehcache.shadow.org.terracotta.offheapstore.HashingMap
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -76,6 +76,9 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
...
@@ -76,6 +76,9 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
@Autowired
@Autowired
UnitLicenceMapper
unitLicenceMapper
;
UnitLicenceMapper
unitLicenceMapper
;
@Autowired
AmosRequestContext
requestContext
;
/**
/**
* 列表查询 示例
* 列表查询 示例
*/
*/
...
@@ -201,64 +204,78 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
...
@@ -201,64 +204,78 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
company
.
setApproved
(
model
.
getApproved
());
company
.
setApproved
(
model
.
getApproved
());
if
(!
ValidationUtil
.
isEmpty
(
company
))
{
if
(!
ValidationUtil
.
isEmpty
(
company
))
{
if
(
"已审核"
.
equals
(
company
.
getApproved
())){
if
(
"已审核"
.
equals
(
company
.
getApproved
())){
final
CompanyModel
companyModel
=
new
CompanyModel
();
// final CompanyModel companyModel = new CompanyModel();
AgencyUserModel
agencyUserModel
=
new
AgencyUserModel
();
//设置用户信息
String
adminName
=
company
.
getAdminName
();
//创建平台企业
String
adminLoginName
=
company
.
getAdminLoginName
();
companyModel
.
setCompanyName
(
company
.
getName
());
String
adminPhone
=
company
.
getAdminTel
();
companyModel
.
setCompanyCode
(
company
.
getCreditCode
());
String
adminPassword
=
company
.
getAdminLoginPwd
();
companyModel
.
setAddress
(
company
.
getAddress
());
List
<
AgencyUserModel
>
agencyUserModels
=
Privilege
.
agencyUserClient
.
list
(
adminName
,
adminLoginName
).
getResult
();
companyModel
.
setParentId
(
0L
);
if
(
agencyUserModels
.
size
()
!=
1
){
companyModel
.
setLevel
(
"headquarter"
);
throw
new
Exception
(
"匹配到多个用户名,清重新输入用户名!"
);
companyModel
.
setAgencyCode
(
"ugp"
);
}
CompanyModel
companyModelFeignClient
=
Privilege
.
companyClient
.
create
(
companyModel
).
getResult
();
AgencyUserModel
agencyUserModel
=
agencyUserModels
.
iterator
().
next
();
agencyUserModel
=
Privilege
.
agencyUserClient
.
queryByUserId
(
agencyUserModel
.
getUserId
()).
getResult
();
//创建平台用户
//创建平台企业 (tzs已创建)
// companyModel.setCompanyName(company.getName());
// companyModel.setCompanyCode(company.getCreditCode());
// companyModel.setAddress(company.getAddress());
// companyModel.setParentId(0L);
// companyModel.setLevel("headquarter");
// companyModel.setAgencyCode("ugp");
CompanyModel
companyModelFeignClient
=
Privilege
.
companyClient
.
queryByCompanyName
(
model
.
getName
()).
getResult
();
//创建平台用户(tzs已创建,但需要新增ugp的角色)
//设置用户角色
//设置用户角色
List
<
RoleModel
>
allRoleList
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
).
getResult
();
List
<
RoleModel
>
allRoleList
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
).
getResult
();
String
[]
unitTypeCodes
=
company
.
getType
().
split
(
","
);
String
[]
unitTypeCodes
=
company
.
getType
().
split
(
","
);
for
(
String
code
:
unitTypeCodes
)
{
for
(
String
code
:
unitTypeCodes
)
{
roleNameSet
.
add
(
OrgEnum
.
map
.
get
(
code
));
roleNameSet
.
add
(
OrgEnum
.
map
.
get
(
code
));
if
(!
ValidationUtil
.
isEmpty
(
OrgEnum
.
codeMap
.
get
(
code
))){
String
[]
codes
=
OrgEnum
.
codeMap
.
get
(
code
).
split
(
","
);
for
(
int
i
=
0
;
i
<
codes
.
length
;
i
++){
if
(!
appCodeSet
.
contains
(
codes
[
i
])){
appCodeSet
.
add
(
codes
[
i
]);
}
}
}
}
}
Iterator
iterator
=
roleNameSet
.
iterator
();
// if(!ValidationUtil.isEmpty(OrgEnum.codeMap.get(code))){
// String[] codes = OrgEnum.codeMap.get(code).split(",");
// for(int i = 0;i <codes.length; i++){
// if(!appCodeSet.contains(codes[i])){
// appCodeSet.add(codes[i]);
// }
// }
// }
// }
// Iterator iterator = roleNameSet.iterator();
//将用户原来的角色与ugp中的角色合并
roleIds
.
addAll
(
agencyUserModel
.
getOrgRoleSeqs
().
get
(
companyModelFeignClient
.
getSequenceNbr
()));
userRoleList
.
addAll
(
agencyUserModel
.
getOrgRoles
().
get
(
companyModelFeignClient
.
getSequenceNbr
()));
allRoleList
.
stream
().
forEach
(
r
->
{
allRoleList
.
stream
().
forEach
(
r
->
{
if
(
roleNameSet
.
contains
(
r
.
getRoleName
())){
if
(
roleNameSet
.
contains
(
r
.
getRoleName
())){
userRoleList
.
add
(
r
);
if
(!
userRoleList
.
contains
(
r
))
{
userRoleList
.
add
(
r
);
}
}
}
});
});
userRoleList
.
stream
().
forEach
(
r
->
{
userRoleList
.
stream
().
forEach
(
r
->
{
roleIds
.
add
(
r
.
getSequenceNbr
());
if
(!
roleIds
.
contains
(
r
.
getSequenceNbr
()))
{
roleIds
.
add
(
r
.
getSequenceNbr
());
}
});
});
roleSeqsMap
.
put
(
companyModelFeignClient
.
getSequenceNbr
(),
roleIds
);
roleSeqsMap
.
put
(
companyModelFeignClient
.
getSequenceNbr
(),
roleIds
);
orgRoles
.
put
(
companyModelFeignClient
.
getSequenceNbr
(),
userRoleList
);
orgRoles
.
put
(
companyModelFeignClient
.
getSequenceNbr
(),
userRoleList
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqsMap
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqsMap
);
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoles
(
orgRoles
);
//设置用户信息
String
adminName
=
company
.
getAdminName
();
String
adminLoginName
=
company
.
getAdminLoginName
();
String
adminPhone
=
company
.
getAdminTel
();
String
adminPassword
=
company
.
getAdminLoginPwd
();
agencyUserModel
.
setRealName
(
adminName
);
agencyUserModel
.
setAgencyCode
(
"ugp"
);
agencyUserModel
.
setLockStatus
(
"UNLOCK"
);
agencyUserModel
.
setMobile
(
adminPhone
);
agencyUserModel
.
setCreateTime
(
new
Date
());
agencyUserModel
.
setUserName
(
adminLoginName
);
agencyUserModel
.
setPassword
(
DesUtil
.
encode
(
adminPassword
,
secretKey
));
agencyUserModel
.
setRePassword
(
DesUtil
.
encode
(
adminPassword
,
secretKey
));
List
<
String
>
appCodes
=
new
ArrayList
<>(
appCodeSet
);
agencyUserModel
.
setAppCodes
(
appCodes
);
agencyUserModel
=
Privilege
.
agencyUserClient
.
create
(
agencyUserModel
).
getResult
();
//tzs已经存在这些信息,不需要重复
// agencyUserModel.setRealName(adminName);
// agencyUserModel.setAgencyCode("ugp");
// agencyUserModel.setLockStatus("UNLOCK");
// agencyUserModel.setMobile(adminPhone);
// agencyUserModel.setCreateTime(new Date());
// agencyUserModel.setUserName(adminLoginName);
// agencyUserModel.setPassword(DesUtil.encode(adminPassword, secretKey));
// agencyUserModel.setRePassword(DesUtil.encode(adminPassword, secretKey));
// List<String> appCodes = new ArrayList<>(appCodeSet);
// agencyUserModel.setAppCodes(appCodes);
agencyUserModel
=
Privilege
.
agencyUserClient
.
update
(
agencyUserModel
,
agencyUserModel
.
getUserId
()).
getResult
();
//
//企业动态表单存储
//企业动态表单存储
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
company
));
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
company
));
jsonObject
.
put
(
"amosOrgId"
,
companyModelFeignClient
.
getSequenceNbr
());
jsonObject
.
put
(
"amosOrgId"
,
companyModelFeignClient
.
getSequenceNbr
());
...
@@ -275,22 +292,23 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
...
@@ -275,22 +292,23 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
}
}
}
}
//获取当前注册企业的区域规则
// //获取当前注册企业的区域规则 (不需要任务)
String
regionCode
=
model
.
getRegionCode
();
//
String regionCode = model.getRegionCode();
if
(
regionCode
.
contains
(
"#"
)){
//
if(regionCode.contains("#")){
String
[]
regionCodes
=
regionCode
.
split
(
"#"
);
//
String[] regionCodes = regionCode.split("#");
regionCode
=
regionCodes
[
0
];
//
regionCode = regionCodes[0];
}
//
}
SuperviseRule
superviseRule
=
superviseRuleService
.
getOne
(
new
LambdaQueryWrapper
<
SuperviseRule
>().
eq
(
SuperviseRule:
:
getAdminRegionCode
,
regionCode
));
//
SuperviseRule superviseRule = superviseRuleService.getOne(new LambdaQueryWrapper<SuperviseRule>().eq(SuperviseRule::getAdminRegionCode,regionCode));
List
<
Long
>
unitIds
=
new
ArrayList
<>();
//
List<Long> unitIds = new ArrayList<>();
if
(!
ValidationUtil
.
isEmpty
(
superviseRule
))
{
//
if(!ValidationUtil.isEmpty(superviseRule)) {
unitIds
.
add
(
superviseRule
.
getSuperviseDeptId
());
//
unitIds.add(superviseRule.getSuperviseDeptId());
unitIds
.
add
(
superviseRule
.
getInspectionUnitId
());
//
unitIds.add(superviseRule.getInspectionUnitId());
}
//
}
//新增企业审核任务信息
//
//新增企业审核任务信息
taskService
.
saveOrUpdateTask
(
null
,
true
,
TaskTypeEnum
.
企业审核
.
getKey
(),
new
Date
(),
model
.
getSequenceNbr
(),
TaskTypeEnum
.
企业审核
.
getKey
(),
unitIds
,
null
);
//
taskService.saveOrUpdateTask(null, true, TaskTypeEnum.企业审核.getKey(), new Date(), model.getSequenceNbr(), TaskTypeEnum.企业审核.getKey(), unitIds,null);
return
this
.
updateById
(
company
);
return
this
.
updateById
(
company
);
}
}
public
CompanyDto
queryBySeq1
(
Long
sequenceNbr
)
{
public
CompanyDto
queryBySeq1
(
Long
sequenceNbr
)
{
return
companyMapper
.
queryBySeq1
(
sequenceNbr
);
return
companyMapper
.
queryBySeq1
(
sequenceNbr
);
}
}
...
@@ -299,13 +317,15 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
...
@@ -299,13 +317,15 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
JSONArray
jsonArray
=
model
.
getLincensePicUrl
();
JSONArray
jsonArray
=
model
.
getLincensePicUrl
();
List
<
String
>
adminLincensePic
=
new
ArrayList
<>();
List
<
String
>
adminLincensePic
=
new
ArrayList
<>();
Company
companys
=
new
Company
();
Company
companys
=
new
Company
();
for
(
Object
o
:
jsonArray
){
if
(!
ValidationUtil
.
isEmpty
(
jsonArray
))
{
JSONObject
object
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
o
));
for
(
Object
o
:
jsonArray
)
{
String
url
=
object
.
getString
(
"url"
);
JSONObject
object
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
o
));
adminLincensePic
.
add
(
url
);
String
url
=
object
.
getString
(
"url"
);
adminLincensePic
.
add
(
url
);
}
model
.
setAdminLincensePic
(
JSON
.
toJSONString
(
adminLincensePic
));
}
}
model
.
setApproved
(
CompanyExamineEnum
.
企业审核
.
getNo
());
model
.
setApproved
(
CompanyExamineEnum
.
企业审核
.
getNo
());
model
.
setAdminLincensePic
(
JSON
.
toJSONString
(
adminLincensePic
));
model
.
setRecDate
(
new
Date
());
model
.
setRecDate
(
new
Date
());
...
@@ -340,24 +360,92 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
...
@@ -340,24 +360,92 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
//存入数据
//存入数据
model
=
companyServiceImpl
.
createWithModel
(
model
);
model
=
companyServiceImpl
.
createWithModel
(
model
);
//浅拷贝
// //浅拷贝
BeanUtils
.
copyProperties
(
model
,
companys
);
// BeanUtils.copyProperties(model,companys);
//获取当前注册企业的区域规则
// //获取当前注册企业的区域规则
String
recgionCode
=
model
.
getRegionCode
().
substring
(
0
,
6
);
// String recgionCode = model.getRegionCode().substring(0,6);
SuperviseRule
superviseRule
=
superviseRuleService
.
getOne
(
new
LambdaQueryWrapper
<
SuperviseRule
>().
likeRight
(
SuperviseRule:
:
getAdminRegionCode
,
recgionCode
));
// SuperviseRule superviseRule = superviseRuleService.getOne(new LambdaQueryWrapper<SuperviseRule>().likeRight(SuperviseRule::getAdminRegionCode,recgionCode));
List
<
Long
>
unitIds
=
new
ArrayList
<>();
// List<Long> unitIds = new ArrayList<>();
//当区域规则表没有时,更新unitid为区域code
// //当区域规则表没有时,更新unitid为区域code
if
(
ValidationUtil
.
isEmpty
(
superviseRule
)){
// if (ValidationUtil.isEmpty(superviseRule)){
unitIds
.
add
(
Long
.
valueOf
(
model
.
getRegionCode
()));
// unitIds.add(Long.valueOf(model.getRegionCode()));
unitIds
.
add
(
Long
.
valueOf
(
model
.
getRegionCode
()));
// unitIds.add(Long.valueOf(model.getRegionCode()));
}
else
{
// }else {
unitIds
.
add
(
superviseRule
.
getSuperviseDeptId
());
// unitIds.add(superviseRule.getSuperviseDeptId());
unitIds
.
add
(
superviseRule
.
getInspectionUnitId
());
// unitIds.add(superviseRule.getInspectionUnitId());
// }
//
// //新增企业审核任务信息
// taskService.saveOrUpdateTask(null, false, TaskTypeEnum.企业审核.getKey(), new Date(), model.getSequenceNbr(), TaskTypeEnum.企业审核.getKey(), unitIds,null);
return
model
;
}
public
void
getRegionTree
(
Collection
col
){
}
public
void
syncCompany
(
Object
object
)
throws
Exception
{
// ugpAuthServiceImpl.setRequestContext();
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
RequestContext
.
setToken
(
requestContext
.
getToken
());
String
type
=
""
;
String
jsonString
=
JSON
.
toJSONString
(
object
);
CompanyDto
model
=
JSON
.
parseObject
(
jsonString
,
CompanyDto
.
class
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
jsonString
);
for
(
Object
obj
:
jsonObject
.
getJSONArray
(
"unitTypeCodeList"
)){
if
(!
ValidationUtil
.
isEmpty
(
OrgEnum
.
dictionaryCodeMap
.
get
(
obj
.
toString
())))
{
if
(!
ValidationUtil
.
isEmpty
(
type
))
{
type
=
type
+
","
+
OrgEnum
.
dictionaryCodeMap
.
get
(
obj
.
toString
());
}
else
{
type
=
OrgEnum
.
dictionaryCodeMap
.
get
(
obj
.
toString
());
}
}
}
}
Collection
<
RegionModel
>
regionModels
=
Systemctl
.
regionClient
.
queryForTree
(
jsonObject
.
getString
(
"district"
)).
getResult
();
RegionModel
provence
=
regionModels
.
iterator
().
next
();
RegionModel
city
=
provence
.
getChildren
().
iterator
().
next
();
RegionModel
district
=
city
.
getChildren
().
iterator
().
next
();
int
regionCodeD
=
district
.
getRegionCode
();
int
regionCodeC
=
city
.
getRegionCode
();
int
regionCodeP
=
provence
.
getRegionCode
();
model
.
setRegionCode
(
String
.
valueOf
(
regionCodeD
));
model
.
setRegionCodeD
(
String
.
valueOf
(
regionCodeD
));
model
.
setRegionCodeC
(
String
.
valueOf
(
regionCodeC
));
model
.
setRegionCodeP
(
String
.
valueOf
(
regionCodeP
));
model
.
setType
(
type
);
model
.
setCreditCode
(
jsonObject
.
getString
(
"unitCode"
));
model
.
setContact
(
jsonObject
.
getString
(
"adminName"
));
model
.
setContactPhone
(
jsonObject
.
getString
(
"adminTel"
));
try
{
this
.
save
(
model
);
//自动审核企业
model
.
setApproved
(
"已审核"
);
this
.
companyCheck
(
model
,
model
.
getSequenceNbr
(),
OrgEnum
.
公司
.
getKey
());
}
catch
(
Exception
e
)
{
//删除企业表数据
if
(!
ValidationUtil
.
isEmpty
(
this
.
getById
(
model
.
getSequenceNbr
())))
{
this
.
deleteBySeq
(
model
.
getSequenceNbr
());
}
//新增企业审核任务信息
//先删除动态表单的人员信息
taskService
.
saveOrUpdateTask
(
null
,
false
,
TaskTypeEnum
.
企业审核
.
getKey
(),
new
Date
(),
model
.
getSequenceNbr
(),
TaskTypeEnum
.
企业审核
.
getKey
(),
unitIds
,
null
);
if
(!
ValidationUtil
.
isEmpty
(
orgService
.
getInfoByName
(
model
.
getAdminName
())))
{
String
orgUsrId
=
String
.
valueOf
(
orgService
.
getInfoByName
(
model
.
getAdminName
()).
getSequenceNbr
());
if
(!
ValidationUtil
.
isEmpty
(
orgService
.
getOrgUsrById
(
orgUsrId
)))
{
orgService
.
delectInfo
(
orgUsrId
);
}
}
return
model
;
//再删除动态表单的企业信息
if
(!
ValidationUtil
.
isEmpty
(
orgService
.
getOrgUsrById
(
String
.
valueOf
(
model
.
getSequenceNbr
()))))
{
orgService
.
delectInfo
(
String
.
valueOf
(
model
.
getSequenceNbr
()));
}
throw
new
Exception
(
"同步失败,已删除同步内容"
);
}
}
}
}
}
\ No newline at end of file
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/OrgServiceImpl.java
View file @
c9e2b923
...
@@ -249,7 +249,11 @@ public class OrgServiceImpl {
...
@@ -249,7 +249,11 @@ public class OrgServiceImpl {
* 用户单位信息redis获取
* 用户单位信息redis获取
**/
**/
public
ReginParams
getReginParams
()
{
public
ReginParams
getReginParams
()
{
return
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
try
{
return
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
}
/**
/**
...
@@ -542,7 +546,16 @@ public class OrgServiceImpl {
...
@@ -542,7 +546,16 @@ public class OrgServiceImpl {
orgUsrServiceImpl
.
deleteBySeq
(
Long
.
valueOf
(
sequencenNbr
));
orgUsrServiceImpl
.
deleteBySeq
(
Long
.
valueOf
(
sequencenNbr
));
}
}
/**
* 根据OrgUsr表的bizOrgName 查询
* @param bizOrgName
* @return
*/
public
OrgUsr
getInfoByName
(
String
bizOrgName
)
{
LambdaQueryWrapper
<
OrgUsr
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
OrgUsr
::
getBizOrgName
,
bizOrgName
);
return
orgUsrServiceImpl
.
getOne
(
wrapper
);
}
/**
/**
...
...
amos-boot-system-ugp/pom.xml
View file @
c9e2b923
...
@@ -24,6 +24,11 @@
...
@@ -24,6 +24,11 @@
<artifactId>
amos-feign-workflow
</artifactId>
<artifactId>
amos-feign-workflow
</artifactId>
<version>
1.7.9-SNAPSHOT
</version>
<version>
1.7.9-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-feign-privilege
</artifactId>
<version>
1.8.5-SNAPSHOT
</version>
</dependency>
<dependency>
<dependency>
<groupId>
fakepath
</groupId>
<groupId>
fakepath
</groupId>
...
...
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