Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a44aca0c
authored
Aug 04, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp2jpa
1 parent
15683bbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
28 deletions
project-order/src/main/java/com/dituhui/pea/order/dao/MapLayerCustomizeDao.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessLayerServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dao/MapLayerCustomizeDao.java
View file @
a44aca0
package
com
.
dituhui
.
pea
.
order
.
dao
;
package
com
.
dituhui
.
pea
.
order
.
dao
;
import
com.dituhui.pea.order.entity.MapBlockInfoEntity
;
import
com.dituhui.pea.order.entity.MapLayerCustomizeEntity
;
import
com.dituhui.pea.order.entity.MapLayerCustomizeEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessLayerServiceImpl.java
View file @
a44aca0
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.alibaba.nacos.common.utils.CollectionUtils
;
import
com.alibaba.nacos.common.utils.CollectionUtils
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.ResultEnum
;
import
com.dituhui.pea.common.ResultEnum
;
...
@@ -14,7 +13,6 @@ import com.dituhui.pea.order.feign.ISaaSRemoteService;
...
@@ -14,7 +13,6 @@ import com.dituhui.pea.order.feign.ISaaSRemoteService;
import
com.dituhui.pea.order.service.BusinessLayerService
;
import
com.dituhui.pea.order.service.BusinessLayerService
;
import
com.dituhui.pea.order.utils.TypeUtils
;
import
com.dituhui.pea.order.utils.TypeUtils
;
import
com.google.gson.internal.LinkedTreeMap
;
import
com.google.gson.internal.LinkedTreeMap
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
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
;
...
@@ -40,7 +38,7 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
...
@@ -40,7 +38,7 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
@Autowired
@Autowired
private
MapLayerCustomizeDao
mapLayerCustomizeDao
;
private
MapLayerCustomizeDao
mapLayerCustomizeDao
;
@Autowired
@Autowired
private
MapLayerCustomizeSkill
MPDao
mapLayerCustomizeSkillMP
Dao
;
private
MapLayerCustomizeSkill
Dao
mapLayerCustomizeSkill
Dao
;
@Autowired
@Autowired
private
OrgGroupDao
orgGroupDao
;
private
OrgGroupDao
orgGroupDao
;
@Autowired
@Autowired
...
@@ -83,9 +81,9 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
...
@@ -83,9 +81,9 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
//获取分页列表
//获取分页列表
Specification
<
MapLayerCustomizeEntity
>
specification
=
(
root
,
query
,
criteriaBuilder
)
->
{
Specification
<
MapLayerCustomizeEntity
>
specification
=
(
root
,
query
,
criteriaBuilder
)
->
{
Predicate
statusPredicate
=
criteriaBuilder
.
equal
(
root
.
get
(
"status"
),
1
);
Predicate
statusPredicate
=
criteriaBuilder
.
equal
(
root
.
get
(
"status"
),
1
);
Predicate
branchIdPredicate
=
root
.
get
(
"branchId"
).
in
(
branchIds
);
Predicate
branchIdPredicate
=
root
.
get
(
"branchId"
).
in
(
branchIds
);
return
criteriaBuilder
.
and
(
statusPredicate
,
branchIdPredicate
);
return
criteriaBuilder
.
and
(
statusPredicate
,
branchIdPredicate
);
};
};
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
asc
(
"layerId"
));
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
asc
(
"layerId"
));
PageRequest
pageRequest
=
PageRequest
.
of
(
page
-
1
,
size
,
sort
);
PageRequest
pageRequest
=
PageRequest
.
of
(
page
-
1
,
size
,
sort
);
...
@@ -134,9 +132,9 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
...
@@ -134,9 +132,9 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
}
}
// 获取技能code列表
// 获取技能code列表
List
<
MapLayerCustomizeSkill
>
skills
=
mapLayerCustomizeSkillMPDao
.
select
ByLayerId
(
layerId
);
List
<
MapLayerCustomizeSkill
Entity
>
skills
=
mapLayerCustomizeSkillDao
.
find
ByLayerId
(
layerId
);
List
<
String
>
skillCodes
=
skills
.
stream
().
filter
(
s
->
s
.
getStatus
()
==
1
).
map
(
List
<
String
>
skillCodes
=
skills
.
stream
().
filter
(
s
->
s
.
getStatus
()
==
1
).
map
(
MapLayerCustomizeSkill:
:
getSkillCode
).
collect
(
Collectors
.
toList
());
MapLayerCustomizeSkill
Entity
:
:
getSkillCode
).
collect
(
Collectors
.
toList
());
// 获取branchName
// 获取branchName
String
branchName
=
""
;
String
branchName
=
""
;
...
@@ -217,13 +215,13 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
...
@@ -217,13 +215,13 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
if
(
layer
==
null
)
{
if
(
layer
==
null
)
{
throw
new
BusinessException
(
"图层不存在"
);
throw
new
BusinessException
(
"图层不存在"
);
}
}
// 检查下面是否还有区块
// 检查下面是否还有区块
List
<
MapBlockInfoEntity
>
blocks
=
mapBlockInfoDao
.
findByLayerId
(
layerId
);
List
<
MapBlockInfoEntity
>
blocks
=
mapBlockInfoDao
.
findByLayerId
(
layerId
);
if
(
CollectionUtils
.
isNotEmpty
(
blocks
))
{
if
(
CollectionUtils
.
isNotEmpty
(
blocks
))
{
return
Result
.
failure
(
"该图层下面还有区块"
);
return
Result
.
failure
(
"该图层下面还有区块"
);
}
}
// 同步删除saas图层
// 同步删除saas图层
String
result
=
saasRemoteService
.
deleteLayer
(
ak
,
layer
.
getSaasLayerId
());
String
result
=
saasRemoteService
.
deleteLayer
(
ak
,
layer
.
getSaasLayerId
());
log
.
info
(
"deleteLayer params:{} result:{}"
,
layerId
,
result
);
log
.
info
(
"deleteLayer params:{} result:{}"
,
layerId
,
result
);
...
@@ -243,37 +241,29 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
...
@@ -243,37 +241,29 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
// 更新技能信息
// 更新技能信息
// 更新状态为0
// 更新状态为0
LambdaUpdateWrapper
<
MapLayerCustomizeSkill
>
wrapper
=
new
LambdaUpdateWrapper
<>();
mapLayerCustomizeSkillDao
.
updateStatusByLayerId
(
0
,
layerId
);
wrapper
.
set
(
MapLayerCustomizeSkill:
:
getStatus
,
0
);
wrapper
.
eq
(
MapLayerCustomizeSkill:
:
getLayerId
,
layerId
);
mapLayerCustomizeSkillMPDao
.
update
(
null
,
wrapper
);
List
<
MapLayerCustomizeSkill
>
skills
=
mapLayerCustomizeSkillMPDao
.
select
ByLayerId
(
layerId
);
List
<
MapLayerCustomizeSkill
Entity
>
skills
=
mapLayerCustomizeSkillDao
.
find
ByLayerId
(
layerId
);
Set
<
String
>
db
=
skills
.
stream
().
map
(
MapLayerCustomizeSkill:
:
getSkillCode
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
db
=
skills
.
stream
().
map
(
MapLayerCustomizeSkill
Entity
:
:
getSkillCode
).
collect
(
Collectors
.
toSet
());
// 需要更新为有效的
// 需要更新为有效的
Set
<
String
>
updates
=
new
HashSet
<>(
db
);
Set
<
String
>
updates
=
new
HashSet
<>(
db
);
updates
.
retainAll
(
skillCodes
);
updates
.
retainAll
(
skillCodes
);
if
(!
updates
.
isEmpty
())
{
if
(!
updates
.
isEmpty
())
{
mapLayerCustomizeSkillDao
.
updateStatusByLayerIdAndSkillCodeIn
(
1
,
layerId
,
new
ArrayList
<>(
updates
));
LambdaUpdateWrapper
<
MapLayerCustomizeSkill
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
set
(
MapLayerCustomizeSkill:
:
getStatus
,
1
);
updateWrapper
.
eq
(
MapLayerCustomizeSkill:
:
getLayerId
,
layerId
);
updateWrapper
.
in
(
MapLayerCustomizeSkill:
:
getSkillCode
,
new
ArrayList
<>(
updates
));
mapLayerCustomizeSkillMPDao
.
update
(
null
,
updateWrapper
);
}
}
// 需要新增插入的
// 需要新增插入的
Set
<
String
>
adds
=
new
HashSet
<>(
skillCodes
);
Set
<
String
>
adds
=
new
HashSet
<>(
skillCodes
);
adds
.
removeAll
(
db
);
adds
.
removeAll
(
db
);
for
(
String
skillCode
:
adds
)
{
for
(
String
skillCode
:
adds
)
{
MapLayerCustomizeSkill
c
=
new
MapLayerCustomizeSkill
();
MapLayerCustomizeSkill
Entity
c
=
new
MapLayerCustomizeSkillEntity
();
c
.
setLayerId
(
layerId
);
c
.
setLayerId
(
layerId
);
c
.
setSkillCode
(
skillCode
);
c
.
setSkillCode
(
skillCode
);
c
.
setStatus
(
1
);
c
.
setStatus
(
1
);
c
.
setMemo
(
""
);
c
.
setMemo
(
""
);
c
.
setCreateTime
(
LocalDateTime
.
now
());
c
.
setCreateTime
(
LocalDateTime
.
now
());
mapLayerCustomizeSkillMPDao
.
inser
t
(
c
);
entityManager
.
persis
t
(
c
);
}
}
}
}
...
@@ -284,8 +274,8 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
...
@@ -284,8 +274,8 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
Map
<
String
,
String
>
skillMap
=
skills
.
stream
().
collect
(
Collectors
.
toMap
(
Map
<
String
,
String
>
skillMap
=
skills
.
stream
().
collect
(
Collectors
.
toMap
(
SkillInfoEntity:
:
getSkillCode
,
SkillInfoEntity:
:
getSkill
));
SkillInfoEntity:
:
getSkillCode
,
SkillInfoEntity:
:
getSkill
));
List
<
MapLayerCustomizeSkill
>
laySkills
=
mapLayerCustomizeSkillMPDao
.
select
ByLayerId
(
layerId
);
List
<
MapLayerCustomizeSkill
Entity
>
laySkills
=
mapLayerCustomizeSkillDao
.
find
ByLayerId
(
layerId
);
for
(
MapLayerCustomizeSkill
s
:
laySkills
)
{
for
(
MapLayerCustomizeSkill
Entity
s
:
laySkills
)
{
if
(
s
.
getStatus
()
==
0
)
{
if
(
s
.
getStatus
()
==
0
)
{
continue
;
continue
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment