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
2958c998
Commit
2958c998
authored
Nov 09, 2022
by
wanglong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决 删除不成功问题 增加项目资源条件判断
parent
a86a0682
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
18 deletions
+33
-18
ProjectResourceController.java
.../module/ugp/biz/controller/ProjectResourceController.java
+10
-3
ProjectResourceServiceImpl.java
...dule/ugp/biz/service/impl/ProjectResourceServiceImpl.java
+23
-15
No files found.
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/controller/ProjectResourceController.java
View file @
2958c998
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.ProjectMaterialDto
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.WelderEquipmentDto
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Equipment
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Project
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.MaterialServiceImpl
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -178,9 +182,12 @@ public class ProjectResourceController extends BaseController {
@DeleteMapping
(
value
=
"/welderDelete"
)
@ApiOperation
(
httpMethod
=
"Delete"
,
value
=
"项目设备删除"
,
notes
=
"项目设备删除"
)
public
ResponseModel
<
Boolean
>
welderDelete
(
@RequestParam
Stri
ng
ids
@RequestParam
Lo
ng
ids
){
this
.
projectResourceServiceImpl
.
welderDelete
(
ids
);
LambdaQueryWrapper
<
ProjectResource
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
ProjectResource:
:
getResourceId
,
ids
);
projectResourceMapper
.
delete
(
wrapper
);
return
ResponseHelper
.
buildResponse
(
true
);
}
...
...
@@ -192,7 +199,7 @@ public class ProjectResourceController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"绑定项目所用到的设备管材"
,
notes
=
"绑定项目所用到的设备管材"
)
@PostMapping
(
value
=
"/saveId"
)
public
ResponseModel
<
ProjectResource
>
saveId
(
@RequestBody
JSONObject
jsonObject
)
{
public
ResponseModel
<
ProjectResource
>
saveId
(
@RequestBody
JSONObject
jsonObject
)
throws
Exception
{
return
ResponseHelper
.
buildResponse
(
projectResourceServiceImpl
.
saveIds
(
jsonObject
));
}
...
...
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/ProjectResourceServiceImpl.java
View file @
2958c998
...
...
@@ -122,25 +122,25 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
projectResourceMapper
.
insert
(
projectResource
);
}
/**
* 项目设备删除
* @param ids
*/
@Transactional
public
void
welderDelete
(
String
ids
)
{
this
.
list
(
new
QueryWrapper
<
ProjectResource
>().
lambda
().
in
(
ProjectResource:
:
getSequenceNbr
,
Arrays
.
stream
(
ids
.
split
(
","
)).
map
(
Long:
:
valueOf
).
collect
(
Collectors
.
toList
()))
).
forEach
(
item
->
{
this
.
equipmentMapper
.
deleteById
(
item
.
getResourceId
());
this
.
projectResourceMapper
.
deleteById
(
item
.
getSequenceNbr
());
});
}
//
/**
//
* 项目设备删除
//
* @param ids
//
*/
//
@Transactional
//
public void welderDelete(String ids) {
//
this.list(new QueryWrapper<ProjectResource>().lambda().in(
//
ProjectResource::getSequenceNbr,
//
Arrays.stream(ids.split(",")).map(Long::valueOf).collect(Collectors.toList()))
//
).forEach(item -> {
//
this.equipmentMapper.deleteById(item.getResourceId());
//
this.projectResourceMapper.deleteById(item.getSequenceNbr());
//
});
//
}
/**
* 绑定项目所用到的设备管材
*/
public
ProjectResource
saveIds
(
JSONObject
jsonObject
)
{
public
ProjectResource
saveIds
(
JSONObject
jsonObject
)
throws
Exception
{
JSONArray
subForm
=
jsonObject
.
getJSONArray
(
"subForm"
);
ProjectResource
Resource
=
new
ProjectResource
();
...
...
@@ -151,6 +151,11 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
Long
SequenceNbr
=
Long
.
valueOf
(
jsonObject
.
getString
(
"sequenceNbr"
));
String
type
=
jsonObject
.
getString
(
"type"
);
LambdaQueryWrapper
<
ProjectResource
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
ProjectResource:
:
getResourceId
,
select
);
wrapper
.
eq
(
ProjectResource:
:
getProjectId
,
SequenceNbr
);
ProjectResource
projectResourceVerify
=
projectResourceMapper
.
selectOne
(
wrapper
);
if
(
ValidationUtil
.
isEmpty
(
projectResourceVerify
)){
//判断资源类型并插入
if
(
type
.
equals
(
设备资源
.
getName
()))
{
projectResource
.
setType
(
设备资源
.
getCode
());
...
...
@@ -172,6 +177,9 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
projectResource
.
setResourceId
(
Long
.
valueOf
(
select
));
BeanUtils
.
copyProperties
(
projectResource
,
Resource
);
this
.
save
(
projectResource
);
}
else
{
throw
new
Exception
(
"该资源已存在"
);
}
}
return
Resource
;
}
...
...
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