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 b3dacffe
authored
Jul 31, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
b5ec0fe7
0cfe55cb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
190 additions
and
35 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessLayerController.java
project-order/src/main/java/com/dituhui/pea/order/dao/MapLayerCustomizeSkillMPDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessCustomLayerAddReqDTO.java
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessCustomLayerUpdateReqDTO.java
project-order/src/main/java/com/dituhui/pea/order/service/BusinessLayerService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessLayerServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessLayerController.java
View file @
b3dacff
package
com
.
dituhui
.
pea
.
order
.
controller
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.BusinessCustomLayerAddReqDTO
;
import
com.dituhui.pea.order.dto.BusinessCustomLayerUpdateReqDTO
;
import
com.dituhui.pea.order.service.BusinessLayerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
@Controller
@RequestMapping
(
"/pea-order"
)
public
class
BusinessLayerController
{
@Autowired
private
BusinessLayerService
businessLayerService
;
/**
* 获取通用图层
...
...
@@ -19,7 +27,13 @@ public class BusinessLayerController {
@GetMapping
(
"/business/layer/universal"
)
public
Result
<?>
businessLayerUniversal
()
{
// 通用图层
return
null
;
Result
res
=
null
;
try
{
res
=
businessLayerService
.
businessLayerUniversal
();
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
/**
...
...
@@ -34,7 +48,13 @@ public class BusinessLayerController {
@GetMapping
(
"/business/layer/custom/list"
)
public
Result
<?>
businessCustomLayers
(
String
levelType
,
String
levelValue
,
long
page
,
long
size
)
{
// 自定义图层列表
return
null
;
Result
res
=
null
;
try
{
res
=
businessLayerService
.
businessCustomLayers
(
levelType
,
levelValue
,
page
,
size
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
/**
...
...
@@ -45,31 +65,55 @@ public class BusinessLayerController {
*/
@GetMapping
(
"/business/layer/custom/detail"
)
public
Result
<?>
businessCustomLayer
(
String
layerId
)
{
// 自定义图层详情
return
null
;
Result
res
=
null
;
try
{
res
=
businessLayerService
.
businessCustomLayer
(
layerId
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
/**
* 新增自定义图层
*
* @param reqDTO::branchId 分部ID
* @param reqDTO::layerName 图层名称
* @param reqDTO::layerDesc 图层描述
* @param reqDTO::skills 技能code列表
* @return
*/
@PostMapping
(
"/business/layer/custom/add"
)
public
Result
<?>
businessCustomLayerAdd
()
{
public
Result
<?>
businessCustomLayerAdd
(
@RequestBody
BusinessCustomLayerAddReqDTO
reqDTO
)
{
// 自定义图层新增
return
null
;
Result
res
=
null
;
try
{
res
=
businessLayerService
.
businessCustomLayerAdd
(
reqDTO
.
getBranchId
(),
reqDTO
.
getLayerName
(),
reqDTO
.
getLayerDesc
(),
reqDTO
.
getSkills
());
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
/**
* 修改自定义图层
*
* @param layerId 图层ID
* @param reqDTO::layerId 图层ID
* @param reqDTO::layerDesc 图层描述
* @param reqDTO::skills 技能code列表
* @return
*/
@PostMapping
(
"/business/layer/custom/update"
)
public
Result
<?>
businessCustomLayerUpdate
(
String
layerId
)
{
public
Result
<?>
businessCustomLayerUpdate
(
@RequestBody
BusinessCustomLayerUpdateReqDTO
reqDTO
)
{
// 自定义图层修改
return
null
;
Result
res
=
null
;
try
{
res
=
businessLayerService
.
businessCustomLayerUpdate
(
reqDTO
.
getLayerId
(),
reqDTO
.
getLayerDesc
(),
reqDTO
.
getSkills
());
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
/**
...
...
@@ -78,9 +122,15 @@ public class BusinessLayerController {
* @param layerId 图层ID
* @return
*/
@
Pos
tMapping
(
"/business/layer/custom/remove"
)
@
Ge
tMapping
(
"/business/layer/custom/remove"
)
public
Result
<?>
businessCustomLayerRemove
(
String
layerId
)
{
// 自定义图层删除
return
null
;
Result
res
=
null
;
try
{
res
=
businessLayerService
.
businessCustomLayerRemove
(
layerId
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
}
project-order/src/main/java/com/dituhui/pea/order/dao/MapLayerCustomizeSkillMPDao.java
View file @
b3dacff
...
...
@@ -3,7 +3,13 @@ package com.dituhui.pea.order.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.dituhui.pea.order.entity.MapLayerCustomizeSkill
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
@Mapper
public
interface
MapLayerCustomizeSkillMPDao
extends
BaseMapper
<
MapLayerCustomizeSkill
>
{
@Select
(
"select * from map_layer_customize_skill where layer_id=#{layerId};"
)
List
<
MapLayerCustomizeSkill
>
selectByLayerId
(
String
layerId
);
}
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessCustomLayerAddReqDTO.java
0 → 100644
View file @
b3dacff
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
BusinessCustomLayerAddReqDTO
{
private
String
branchId
;
private
String
layerName
;
private
String
layerDesc
;
private
List
<
String
>
skills
;
}
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessCustomLayerUpdateReqDTO.java
0 → 100644
View file @
b3dacff
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
BusinessCustomLayerUpdateReqDTO
{
private
String
layerId
;
private
String
layerDesc
;
private
List
<
String
>
skills
;
}
project-order/src/main/java/com/dituhui/pea/order/service/BusinessLayerService.java
View file @
b3dacff
...
...
@@ -3,18 +3,18 @@ package com.dituhui.pea.order.service;
import
com.dituhui.pea.common.Result
;
public
interface
BusinessLayerService
{
Result
<?>
businessLayers
();
import
java.util.List
;
public
interface
BusinessLayerService
{
Result
<?>
businessLayerUniversal
();
Result
<?>
businessCustomLayers
();
Result
<?>
businessCustomLayers
(
String
levelType
,
String
levelValue
,
long
page
,
long
size
);
Result
<?>
businessCustomLayer
();
Result
<?>
businessCustomLayer
(
String
layerId
);
Result
<?>
businessCustomLayerAdd
();
Result
<?>
businessCustomLayerAdd
(
String
branchId
,
String
layerName
,
String
layerDesc
,
List
<
String
>
skillCodes
);
Result
<?>
businessCustomLayerUpdate
();
Result
<?>
businessCustomLayerUpdate
(
String
layerId
,
String
layerDesc
,
List
<
String
>
skillCodes
);
Result
<?>
businessCustomLayerRemove
();
Result
<?>
businessCustomLayerRemove
(
String
layerId
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessLayerServiceImpl.java
View file @
b3dacff
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.ResultEnum
;
import
com.dituhui.pea.order.dao.MapLayerCustomizeMPDao
;
import
com.dituhui.pea.order.dao.MapLayerCustomizeSkillMPDao
;
import
com.dituhui.pea.order.entity.MapLayerCustomize
;
import
com.dituhui.pea.order.entity.MapLayerCustomizeSkill
;
import
com.dituhui.pea.order.feign.ISaaSRemoteService
;
import
com.dituhui.pea.order.feign.dto.LayerDTO
;
import
com.dituhui.pea.order.service.BusinessLayerService
;
...
...
@@ -9,13 +15,28 @@ import com.dituhui.pea.order.utils.TypeUtils;
import
lombok.extern.slf4j.Slf4j
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
public
class
BusinessLayerServiceImpl
implements
BusinessLayerService
{
@Autowired
private
MapLayerCustomizeMPDao
mapLayerCustomizeMPDao
;
@Autowired
private
MapLayerCustomizeSkillMPDao
mapLayerCustomizeSkillMPDao
;
@Autowired
private
ISaaSRemoteService
saasRemoteService
;
...
...
@@ -24,29 +45,24 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
String
ak
;
@Override
public
Result
<?>
businessLayers
()
{
return
null
;
}
@Override
public
Result
<?>
businessLayerUniversal
()
{
return
null
;
}
@Override
public
Result
<?>
businessCustomLayers
()
{
public
Result
<?>
businessCustomLayers
(
String
levelType
,
String
leveValue
,
long
page
,
long
size
)
{
return
null
;
}
@Override
public
Result
<?>
businessCustomLayer
()
{
public
Result
<?>
businessCustomLayer
(
String
layerId
)
{
return
null
;
}
@Transactional
@Override
public
Result
<?>
businessCustomLayerAdd
()
{
String
layerName
=
"上海大区苏州分部基础技能"
;
public
Result
<?>
businessCustomLayerAdd
(
String
branchId
,
String
layerName
,
String
layerDesc
,
List
<
String
>
skillCodes
)
{
// 同步创建saas图层,返回layerId
String
result
=
saasRemoteService
.
addLayer
(
ak
,
layerName
,
1
,
1
);
log
.
info
(
"addLayer params:{} result:{}"
,
layerName
,
result
);
...
...
@@ -59,15 +75,36 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
return
Result
.
success
(
null
);
}
@Transactional
@Override
public
Result
<?>
businessCustomLayerUpdate
()
{
return
null
;
public
Result
<?>
businessCustomLayerUpdate
(
String
layerId
,
String
layerDesc
,
List
<
String
>
skillCodes
)
throws
BusinessException
{
MapLayerCustomize
layer
=
mapLayerCustomizeMPDao
.
getByLayerId
(
layerId
);
if
(
layer
==
null
)
{
throw
new
BusinessException
(
"图层不存在"
);
}
// 更新描述信息
layer
.
setLayerDescribe
(
layerDesc
);
mapLayerCustomizeMPDao
.
updateById
(
layer
);
// 更新技能
this
.
updateLayerSkills
(
layerId
,
new
HashSet
<>(
skillCodes
));
return
Result
.
success
(
null
);
}
@Override
public
Result
<?>
businessCustomLayerRemove
()
{
String
layerId
=
""
;
public
Result
<?>
businessCustomLayerRemove
(
String
layerId
)
throws
BusinessException
{
MapLayerCustomize
layer
=
mapLayerCustomizeMPDao
.
getByLayerId
(
layerId
);
if
(
layer
==
null
)
{
throw
new
BusinessException
(
"图层不存在"
);
}
// 更新状态为删除状态
layer
.
setStatus
(
0
);
mapLayerCustomizeMPDao
.
updateById
(
layer
);
// 同步创建saas图层,返回layerId
String
result
=
saasRemoteService
.
deleteLayer
(
ak
,
layerId
);
log
.
info
(
"deleteLayer params:{} result:{}"
,
layerId
,
result
);
...
...
@@ -75,7 +112,44 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
if
(!
ResultEnum
.
SUCCESS
.
getCode
().
equals
(
saasResult
.
getCode
()))
{
return
Result
.
failure
(
saasResult
.
getMessage
());
}
return
null
;
return
Result
.
success
(
null
);
}
private
void
updateLayerSkills
(
String
layerId
,
Set
<
String
>
skillCodes
){
// 更新技能信息
// 更新状态为0
LambdaUpdateWrapper
<
MapLayerCustomizeSkill
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
set
(
MapLayerCustomizeSkill:
:
getStatus
,
0
);
wrapper
.
eq
(
MapLayerCustomizeSkill:
:
getLayerId
,
layerId
);
mapLayerCustomizeSkillMPDao
.
update
(
null
,
wrapper
);
List
<
MapLayerCustomizeSkill
>
skills
=
mapLayerCustomizeSkillMPDao
.
selectByLayerId
(
layerId
);
Set
<
String
>
db
=
skills
.
stream
().
map
(
MapLayerCustomizeSkill:
:
getSkillCode
).
collect
(
Collectors
.
toSet
());
// 需要更新为有效的
Set
<
String
>
updates
=
new
HashSet
<>(
db
);
updates
.
retainAll
(
skillCodes
);
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
);
adds
.
removeAll
(
db
);
for
(
String
skillCode:
adds
){
MapLayerCustomizeSkill
c
=
new
MapLayerCustomizeSkill
();
c
.
setLayerId
(
layerId
);
c
.
setSkillCode
(
skillCode
);
c
.
setStatus
(
1
);
c
.
setMemo
(
""
);
c
.
setCreateTime
(
LocalDateTime
.
now
());
mapLayerCustomizeSkillMPDao
.
insert
(
c
);
}
}
}
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