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
61be3867
Commit
61be3867
authored
Apr 25, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加同步平台
parent
28cc3f92
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
23 deletions
+111
-23
ExDataSourcesImpl.java
...boot/module/jxiop/biz/service/impl/ExDataSourcesImpl.java
+50
-21
ExcelServiceImpl.java
.../boot/module/jxiop/biz/service/impl/ExcelServiceImpl.java
+26
-1
StationBasicServiceImpl.java
...odule/jxiop/biz/service/impl/StationBasicServiceImpl.java
+35
-1
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/ExDataSourcesImpl.java
View file @
61be3867
...
...
@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.biz.common.excel.DataSources;
import
com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.ListCompanyModel
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
...
...
@@ -52,39 +53,67 @@ public class ExDataSourcesImpl implements DataSources {
private
String
[]
getArea
()
{
//获取当前登录人单位
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
Long
companyId
=
reginParams
.
getCompany
().
getSequenceNbr
();
FeignClientResult
<
Collection
<
UserOrgTreeModel
>>
de
=
Privilege
.
companyClient
.
queryOrgTree
(
companyId
);
Collection
<
UserOrgTreeModel
>
listco
=
new
ArrayList
<>();
String
[]
str
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
de
))
{
if
(
de
.
getStatus
()
==
200
)
{
listco
=
de
.
getResult
();
List
<
String
>
collect
=
new
ArrayList
<>();
this
.
getCompanyModel
(
listco
,
collect
);
str
=
collect
.
toArray
(
new
String
[
collect
.
size
()]);
}
else
{
throw
new
RuntimeException
(
de
.
getMessage
());
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
Long
companyId
=
reginParams
.
getCompany
().
getSequenceNbr
();
List
<
ListCompanyModel
>
date
=
new
ArrayList
();
if
(
"area"
.
equals
(
reginParams
.
getCompany
().
getLevel
())){
ListCompanyModel
companyModel
=
new
ListCompanyModel
();
companyModel
.
setSequenceNbr
(
companyId
);
companyModel
.
setCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
date
.
add
(
companyModel
);
}
else
if
(
"headquarter"
.
equals
(
reginParams
.
getCompany
().
getLevel
())){
FeignClientResult
<
Collection
<
CompanyModel
>>
de
=
Privilege
.
companyClient
.
querySubAgencyTree
(
companyId
);
Collection
<
CompanyModel
>
dated
=
de
.
getResult
();
for
(
CompanyModel
companyModel
:
dated
)
{
if
(
"area"
.
equals
(
companyModel
.
getLevel
())){
ListCompanyModel
companyModeld
=
new
ListCompanyModel
();
companyModeld
.
setSequenceNbr
(
companyModel
.
getSequenceNbr
());
companyModeld
.
setCompanyName
(
companyModel
.
getCompanyName
());
date
.
add
(
companyModeld
);
}
}
}
String
[]
str
=
null
;
List
<
String
>
collect
=
new
ArrayList
<>();
this
.
getCompanyModel
(
date
,
collect
);
str
=
collect
.
toArray
(
new
String
[
collect
.
size
()]);
// //获取当前登录人单位
// ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
//
// Long companyId=reginParams.getCompany().getSequenceNbr();
//
// FeignClientResult<Collection<UserOrgTreeModel>> de =Privilege.companyClient.queryOrgTree(companyId);
//
// Collection<UserOrgTreeModel> listco = new ArrayList<>();
// String[] str = null;
// if (!ObjectUtils.isEmpty(de)) {
// if (de.getStatus() == 200) {
// listco = de.getResult();
// List<String> collect=new ArrayList<>();
// this.getCompanyModel(listco,collect);
// str = collect.toArray(new String[collect.size()]);
// } else {
// throw new RuntimeException(de.getMessage());
// }
// }
return
str
;
}
public
List
<
String
>
getCompanyModel
(
Collection
<
UserOrgTreeModel
>
data
,
List
<
String
>
datas
)
{
public
List
<
String
>
getCompanyModel
(
List
<
ListCompanyModel
>
data
,
List
<
String
>
datas
)
{
if
(!
data
.
isEmpty
())
{
for
(
UserOrgTree
Model
datum
:
data
)
{
datas
.
add
(
datum
.
get
Id
()
+
"@"
+
datum
.
getName
());
if
(
datum
.
getChildren
()
!=
null
)
{
this
.
getCompanyModel
(
datum
.
getChildren
(),
datas
);
}
for
(
ListCompany
Model
datum
:
data
)
{
datas
.
add
(
datum
.
get
CompanyName
()
+
"@"
+
datum
.
getSequenceNbr
());
//
if (datum.getChildren() != null) {
//
this.getCompanyModel(datum.getChildren(),datas);
//
}
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/ExcelServiceImpl.java
View file @
61be3867
...
...
@@ -8,7 +8,10 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.ExStationBasicDto;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.*
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -130,7 +133,15 @@ public class ExcelServiceImpl {
fireChemical
.
setProjectOrgCode
(
companyModel
.
getOrgCode
());
}
//平台增加场站
CompanyModel
companyModeldata
=
new
CompanyModel
();
companyModeldata
.
setCompanyName
(
fireChemical
.
getStationName
());
companyModeldata
.
setCompanyType
(
"company"
);
companyModeldata
.
setLevel
(
"station"
);
companyModeldata
.
setParentId
(
Long
.
valueOf
(
fireChemical
.
getArea
()));
companyModeldata
.
setCompanyCode
(
fireChemical
.
getStationCode
());
companyModeldata
=
this
.
addCompanyModel
(
companyModeldata
);
fireChemical
.
setPlatformStationId
(
companyModeldata
.
getSequenceNbr
().
toString
());
excelEntityList
.
add
(
fireChemical
);
});
stationBasicServiceImpl
.
saveBatch
(
excelEntityList
);
...
...
@@ -158,6 +169,20 @@ public class ExcelServiceImpl {
return
listdata
;
}
private
CompanyModel
addCompanyModel
(
CompanyModel
companyModel
)
{
FeignClientResult
<
CompanyModel
>
Model
=
Privilege
.
companyClient
.
create
(
companyModel
);
CompanyModel
user
=
new
CompanyModel
();
if
(!
ObjectUtils
.
isEmpty
(
Model
))
{
if
(
Model
.
getStatus
()==
200
){
user
=
Model
.
getResult
();
}
else
{
throw
new
RuntimeException
(
Model
.
getMessage
());
}
}
return
user
;
}
//人员导入更新
private
void
updateEXPersonUser
(
MultipartFile
multipartFile
)
throws
Exception
{
List
<
EXPersonUser
>
excelDtoList
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
EXPersonUser
.
class
,
1
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/StationBasicServiceImpl.java
View file @
61be3867
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.StationCoordinateDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.StationInfoDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccount
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationCoordinate
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
...
...
@@ -93,6 +94,7 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
companyModeldata
.
setCompanyType
(
"company"
);
companyModeldata
.
setLevel
(
"station"
);
companyModeldata
.
setParentId
(
Long
.
valueOf
(
stationBasic
.
getArea
()));
companyModeldata
.
setCompanyCode
(
stationBasic
.
getStationCode
());
companyModeldata
=
this
.
addCompanyModel
(
companyModeldata
);
//场站坐标信息
...
...
@@ -106,6 +108,7 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
companyModel
=
personBasicServiceImpl
.
getCompanyModel
(
Long
.
parseLong
(
stationBasic
.
getArea
()));
stationBasic
.
setAreaName
(
companyModel
.
getCompanyName
());
stationBasic
.
setProjectOrgCode
(
companyModeldata
.
getOrgCode
());
stationBasic
.
setPlatformStationId
(
companyModeldata
.
getSequenceNbr
().
toString
());
//场站基本信息
this
.
save
(
stationBasic
);
...
...
@@ -135,6 +138,24 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
return
user
;
}
private
void
deleteCompany
(
String
ids
)
{
FeignClientResult
Model
=
Privilege
.
companyClient
.
deleteCompany
(
ids
);
CompanyModel
user
=
new
CompanyModel
();
if
(!
ObjectUtils
.
isEmpty
(
Model
))
{
if
(
Model
.
getStatus
()!=
200
){
throw
new
RuntimeException
(
Model
.
getMessage
());
}
}
}
private
CompanyModel
updateCompanyModel
(
CompanyModel
companyModel
,
Long
sequenceNbr
)
{
FeignClientResult
<
CompanyModel
>
Model
=
Privilege
.
companyClient
.
update
(
companyModel
,
sequenceNbr
);
CompanyModel
user
=
new
CompanyModel
();
...
...
@@ -161,7 +182,8 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
companyModeldata
.
setCompanyType
(
"company"
);
companyModeldata
.
setLevel
(
"station"
);
companyModeldata
.
setParentId
(
Long
.
valueOf
(
stationBasic
.
getArea
()));
companyModeldata
=
this
.
updateCompanyModel
(
companyModeldata
,);
companyModeldata
.
setCompanyCode
(
stationBasic
.
getStationCode
());
companyModeldata
=
this
.
updateCompanyModel
(
companyModeldata
,
Long
.
valueOf
(
stationBasic
.
getPlatformStationId
()));
//场站坐标信息
...
...
@@ -175,6 +197,7 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
companyModel
=
personBasicServiceImpl
.
getCompanyModel
(
Long
.
parseLong
(
stationBasic
.
getArea
()));
stationBasic
.
setAreaName
(
companyModel
.
getCompanyName
());
stationBasic
.
setProjectOrgCode
(
companyModel
.
getOrgCode
());
stationBasic
.
setPlatformStationId
(
companyModeldata
.
getSequenceNbr
().
toString
());
//场站基本信息
stationBasicMapper
.
updateById
(
stationBasic
);
...
...
@@ -190,6 +213,17 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
public
int
deleteList
(
String
[]
ids
){
QueryWrapper
<
StationBasic
>
wrapper
=
new
QueryWrapper
();
wrapper
.
in
(
"sequence_nbr"
,
ids
);
List
<
StationBasic
>
list
=
this
.
list
(
wrapper
);
List
<
String
>
idscom
=
new
ArrayList
<>();
for
(
StationBasic
personAccount
:
list
)
{
idscom
.
add
(
personAccount
.
getPlatformStationId
());
}
//删除平台
this
.
deleteCompany
(
String
.
join
(
","
,
idscom
));
return
stationBasicMapper
.
deleteList
(
ids
);
}
...
...
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