Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
bd962c4b
Commit
bd962c4b
authored
Mar 01, 2021
by
田涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug-442\443修复
parent
8dd41241
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
16 deletions
+68
-16
PlanClassifyTreeController.java
...s/fas/business/controller/PlanClassifyTreeController.java
+4
-7
IPlanClassifyTreeDao.java
...mos/fas/business/dao/repository/IPlanClassifyTreeDao.java
+11
-1
IPlanDetailDao.java
...join/amos/fas/business/dao/repository/IPlanDetailDao.java
+2
-0
PlanClassifyTreeServiceImpl.java
...as/business/service/impl/PlanClassifyTreeServiceImpl.java
+46
-6
IPlanClassifyTreeService.java
.../fas/business/service/intfc/IPlanClassifyTreeService.java
+5
-2
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/PlanClassifyTreeController.java
View file @
bd962c4b
...
...
@@ -30,8 +30,7 @@ public class PlanClassifyTreeController extends BaseController {
String
compCode
=
getOrgCode
(
reginParams
);
model
.
setOrgCode
(
compCode
);
model
.
setCreator
(
user
.
getUserId
());
planClassifyTreeService
.
save
(
model
);
return
CommonResponseUtil2
.
success
(
model
);
return
CommonResponseUtil2
.
success
(
planClassifyTreeService
.
create
(
model
));
}
@ApiOperation
(
value
=
"修改分类"
)
...
...
@@ -42,19 +41,17 @@ public class PlanClassifyTreeController extends BaseController {
String
compCode
=
getOrgCode
(
reginParams
);
model
.
setOrgCode
(
compCode
);
model
.
setCreator
(
user
.
getUserId
());
planClassifyTreeService
.
save
(
model
);
return
CommonResponseUtil2
.
success
(
model
);
return
CommonResponseUtil2
.
success
(
planClassifyTreeService
.
update
(
model
));
}
@ApiOperation
(
value
=
"删除分类"
)
@RequestMapping
(
value
=
"/{ids}"
,
method
=
RequestMethod
.
DELETE
)
public
ResponseModel
delete
(
@PathVariable
(
"ids"
)
String
ids
)
{
planClassifyTreeService
.
delete
(
ids
);
return
CommonResponseUtil2
.
success
();
return
CommonResponseUtil2
.
success
(
planClassifyTreeService
.
delete
(
ids
));
}
@ApiOperation
(
value
=
"查询分类树"
)
@RequestMapping
(
value
=
"/tree"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/tree"
,
method
=
RequestMethod
.
GET
)
public
ResponseModel
getTree
()
{
Collection
<
PlanClassifyTreeVo
>
list
=
null
;
try
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPlanClassifyTreeDao.java
View file @
bd962c4b
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
import
com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo
;
import
com.yeejoin.amos.fas.dao.entity.PlanClassifyTree
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Set
;
@Repository
public
interface
IPlanClassifyTreeDao
extends
BaseDao
<
PlanClassifyTree
,
Long
>
{
...
...
@@ -16,4 +16,14 @@ public interface IPlanClassifyTreeDao extends BaseDao<PlanClassifyTree, Long> {
@Query
(
value
=
"select * from c_plan_classify_tree"
,
nativeQuery
=
true
)
List
<
PlanClassifyTree
>
getAll
();
/**
* 查询当统计目录下特定名称的个数
* @param classifyName 名称
* @param parentId 父ID
* @return
*/
int
countByClassifyNameAndParentId
(
String
classifyName
,
Long
parentId
);
int
deleteByIdIn
(
Set
<
Long
>
allIds
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPlanDetailDao.java
View file @
bd962c4b
...
...
@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
java.util.Collection
;
import
java.util.List
;
/**
...
...
@@ -20,4 +21,5 @@ public interface IPlanDetailDao extends BaseDao<PlanDetail, Long> {
List
<
PlanDetail
>
getPlanDetailsByIdInAndIsDelete
(
List
<
Long
>
idList
,
Boolean
isDelete
);
boolean
existsByClassifyIdInAndIsDelete
(
Collection
<
Long
>
classifyList
,
Boolean
isDelete
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanClassifyTreeServiceImpl.java
View file @
bd962c4b
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanClassifyTreeDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao
;
import
com.yeejoin.amos.fas.business.service.intfc.IPlanClassifyTreeService
;
import
com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo
;
import
com.yeejoin.amos.fas.dao.entity.PlanClassifyTree
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -26,6 +28,8 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
@Autowired
private
IPlanClassifyTreeDao
planClassifyTreeDao
;
@Autowired
private
IPlanDetailDao
planDetailDao
;
@Override
public
PlanClassifyTree
save
(
PlanClassifyTree
model
)
{
...
...
@@ -33,14 +37,21 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
}
@Override
public
void
delete
(
String
ids
)
{
public
Boolean
delete
(
String
ids
)
{
List
<
Long
>
seqs
=
StringUtil
.
String2LongList
(
ids
);
Set
<
Long
>
allIds
=
new
HashSet
<>(
seqs
);
for
(
Long
seq
:
seqs
)
{
Optional
<
PlanClassifyTree
>
PlanClassifyTreeOpt
=
planClassifyTreeDao
.
findById
(
seq
);
PlanClassifyTree
planClassifyTree
=
planClassifyTreeDao
.
findById
(
seq
).
orElse
(
null
);
//所有子分类
List
<
PlanClassifyTree
>
childGroupSequenceList
=
getChildSequenceList
(
PlanClassifyTreeOpt
.
get
());
planClassifyTreeDao
.
deleteAll
(
childGroupSequenceList
);
List
<
PlanClassifyTree
>
childGroupSequenceList
=
getChildSequenceList
(
planClassifyTree
);
allIds
.
addAll
(
new
HashSet
(
Bean
.
listToMap
(
childGroupSequenceList
,
"id"
,
"id"
,
PlanClassifyTree
.
class
).
keySet
()));
}
// 查询分类下是否有预案
if
(
planDetailDao
.
existsByClassifyIdInAndIsDelete
(
allIds
,
false
))
{
throw
new
YeeException
(
"目录下存在预案"
);
}
planClassifyTreeDao
.
deleteByIdIn
(
allIds
);
return
true
;
}
@Override
...
...
@@ -84,7 +95,6 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return
completeList
;
}
/**
* 预案分类的子id
*
...
...
@@ -102,7 +112,6 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return
childList
;
}
private
void
getAllChildList
(
PlanClassifyTree
currentPlanClassifyTree
,
List
<
PlanClassifyTree
>
resList
)
{
if
(
null
==
currentPlanClassifyTree
)
{
return
;
...
...
@@ -131,4 +140,34 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
}
return
treeList
;
}
@Override
public
PlanClassifyTree
create
(
PlanClassifyTree
model
)
{
if
(
ValidationUtil
.
isEmpty
(
model
.
getClassifyName
())
||
ValidationUtil
.
isEmpty
(
model
.
getParentId
()))
{
throw
new
YeeException
(
"参数有误"
);
}
if
(
classifyNameExist
(
model
.
getClassifyName
(),
model
.
getParentId
()))
{
throw
new
YeeException
(
"名称重复"
);
}
model
.
setId
(
0
);
return
planClassifyTreeDao
.
save
(
model
);
}
@Override
public
PlanClassifyTree
update
(
PlanClassifyTree
model
)
{
if
(
ValidationUtil
.
isEmpty
(
model
.
getId
())
||
ValidationUtil
.
isEmpty
(
model
.
getClassifyName
())
||
ValidationUtil
.
isEmpty
(
model
.
getParentId
()))
{
throw
new
YeeException
(
"参数有误"
);
}
if
(!
planClassifyTreeDao
.
existsById
(
model
.
getId
()))
{
throw
new
YeeException
(
"原数据不存在"
);
}
if
(
classifyNameExist
(
model
.
getClassifyName
(),
model
.
getParentId
()))
{
throw
new
YeeException
(
"名称重复"
);
}
return
planClassifyTreeDao
.
save
(
model
);
}
private
boolean
classifyNameExist
(
String
classifyName
,
Long
parentId
)
{
return
0
<
planClassifyTreeDao
.
countByClassifyNameAndParentId
(
classifyName
,
parentId
);
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IPlanClassifyTreeService.java
View file @
bd962c4b
...
...
@@ -4,7 +4,6 @@ import com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo;
import
com.yeejoin.amos.fas.dao.entity.PlanClassifyTree
;
import
java.util.Collection
;
import
java.util.List
;
/**
* @author wjk
...
...
@@ -15,7 +14,7 @@ public interface IPlanClassifyTreeService {
PlanClassifyTree
save
(
PlanClassifyTree
model
);
void
delete
(
String
ids
);
Boolean
delete
(
String
ids
);
Collection
<
PlanClassifyTreeVo
>
getTree
();
...
...
@@ -25,4 +24,8 @@ public interface IPlanClassifyTreeService {
* @return
*/
Collection
<
PlanClassifyTreeVo
>
getAllChildIncludeMe
(
Long
root
);
PlanClassifyTree
create
(
PlanClassifyTree
model
);
PlanClassifyTree
update
(
PlanClassifyTree
model
);
}
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