Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jgjy
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
jgjy
Commits
c5fe5187
提交
c5fe5187
authored
11月 16, 2020
作者:
zhouzhigang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
redis地址变更
上级
02368e6f
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
93 行增加
和
20 行删除
+93
-20
SuperviseController.java
...x/bg/member/controller/supervise/SuperviseController.java
+58
-13
SuperviseService.java
...om/zrqx/bg/member/service/supervise/SuperviseService.java
+2
-0
SuperviseServiceimpl.java
...rqx/bg/member/service/supervise/SuperviseServiceimpl.java
+9
-6
Supervise.java
.../java/com/zrqx/core/model/member/supervise/Supervise.java
+7
-1
SuperviseVo.java
...n/java/com/zrqx/core/vo/member/supervise/SuperviseVo.java
+17
-0
没有找到文件。
com.zrqx.bg.member/src/main/java/com/zrqx/bg/member/controller/supervise/SuperviseController.java
浏览文件 @
c5fe5187
package
com
.
zrqx
.
bg
.
member
.
controller
.
supervise
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.github.pagehelper.PageHelper
;
import
com.zrqx.bg.member.service.supervise.SuperviseService
;
import
com.zrqx.core.constant.member.MemberRequestPath
;
import
com.zrqx.core.model.member.school.School
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.enums.resource.diytype.DiyTypeStatusEnum
;
import
com.zrqx.core.model.member.supervise.Supervise
;
import
com.zrqx.core.model.resource.diytype.DiyType
;
import
com.zrqx.core.util.bean.Copy
;
import
com.zrqx.core.util.datatype.ArrayUtils
;
import
com.zrqx.core.util.datatype.UUIDUtil
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.util.response.CallBack
;
import
com.zrqx.core.vo.member.
role.RoleMember
Vo
;
import
com.zrqx.core.vo.member.
supervise.Supervise
Vo
;
import
com.zrqx.core.vo.resource.bg.diytype.DiyTypeVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
@RestController
@RequestMapping
(
MemberRequestPath
.
BG
+
MemberRequestPath
.
SUPERVISE
)
...
...
@@ -29,7 +30,32 @@ public class SuperviseController {
@Autowired
private
SuperviseService
superviseService
;
@ApiOperation
(
value
=
"查询全部省监管tree"
,
notes
=
"查询列表"
)
@GetMapping
(
value
=
ResourceRequestPath
.
TREE
)
public
CallBack
<
List
<
SuperviseVo
>>
tree
()
{
Example
example
=
superviseService
.
createExample
();
example
.
createCriteria
().
andEqualTo
(
"status"
,
DiyTypeStatusEnum
.
STATUS_1
.
getCode
());
PageHelper
.
orderBy
(
" createTime desc "
);
List
<
Supervise
>
list
=
superviseService
.
selectByExample
(
example
);
List
<
SuperviseVo
>
voList
=
Copy
.
copyList
(
list
,
SuperviseVo
.
class
,
obj
->
obj
.
getParentId
().
intValue
()
==
0
);
tree
(
list
,
voList
);
return
CallBack
.
success
(
voList
);
}
public
List
<
SuperviseVo
>
tree
(
List
<
Supervise
>
list
,
List
<
SuperviseVo
>
voList
){
voList
.
forEach
(
entity
->{
//第一次设置 一级分类的子类 后续递归设置 子类的子类
entity
.
setList
(
Copy
.
copyList
(
list
,
SuperviseVo
.
class
,
obj
->
obj
.
getParentId
().
intValue
()
==
entity
.
getId
().
intValue
()));
//当前分类存在子类 开始递归子类
if
(
entity
.
getList
().
size
()
>
0
){
tree
(
list
,
entity
.
getList
());
}
});
return
voList
;
}
@ApiOperation
(
value
=
"省监管列表"
,
notes
=
"分页查询省监管列表"
)
@GetMapping
(
MemberRequestPath
.
PAGE
)
...
...
@@ -40,6 +66,25 @@ public class SuperviseController {
@ApiOperation
(
value
=
"新增"
,
notes
=
"新增"
)
@PostMapping
(
value
=
MemberRequestPath
.
SAVE
)
public
CallBack
<
Boolean
>
save
(
@RequestBody
Supervise
form
)
throws
Exception
{
Example
example
=
superviseService
.
createExample
();
//分页排序查询当前子分类最大code值
example
.
createCriteria
().
andEqualTo
(
"parentId"
,
form
.
getParentId
());
PageParam
pageParam
=
new
PageParam
();
pageParam
.
setPageSize
(
1
);
pageParam
.
setOrderBy
(
"code desc"
);
PageInfo
<
Supervise
>
page
=
superviseService
.
queryExample
(
pageParam
,
example
);
if
(
page
.
getList
()
!=
null
&&
page
.
getList
().
size
()
>
0
){
//查询到子分类,获取最大code生成新的code
String
code
=
page
.
getList
().
get
(
0
).
getCode
();
form
.
setCode
(
UUIDUtil
.
newCode
(
code
));
}
else
{
//没有查询到子分类,获取父类code 拼接 01
if
(
form
.
getParentId
()!=
0
){
form
.
setCode
(
superviseService
.
selectByPrimaryKey
(
form
.
getParentId
()).
getCode
()+
"01"
);
}
else
{
form
.
setCode
(
"01"
);
}
}
return
superviseService
.
save
(
form
)
?
CallBack
.
success
(
true
)
:
CallBack
.
fail
();
}
...
...
com.zrqx.bg.member/src/main/java/com/zrqx/bg/member/service/supervise/SuperviseService.java
浏览文件 @
c5fe5187
...
...
@@ -65,4 +65,6 @@ public interface SuperviseService extends BaseService<Supervise,Integer>{
*/
Supervise
queryInfo
(
String
province
);
}
com.zrqx.bg.member/src/main/java/com/zrqx/bg/member/service/supervise/SuperviseServiceimpl.java
浏览文件 @
c5fe5187
...
...
@@ -3,6 +3,9 @@ package com.zrqx.bg.member.service.supervise;
import
java.util.Date
;
import
java.util.List
;
import
com.zrqx.core.enums.resource.diytype.DiyTypeStatusEnum
;
import
com.zrqx.core.model.resource.diytype.DiyType
;
import
com.zrqx.core.util.datatype.UUIDUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -22,6 +25,7 @@ import com.zrqx.core.service.BaseModelServiceImpl;
import
com.zrqx.core.util.encry.MD5Util
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
tk.mybatis.mapper.entity.Example
;
@Service
public
class
SuperviseServiceimpl
extends
BaseModelServiceImpl
<
Supervise
,
Integer
>
implements
SuperviseService
{
...
...
@@ -97,7 +101,7 @@ public class SuperviseServiceimpl extends BaseModelServiceImpl<Supervise,Integer
form
.
setUpdateTime
(
new
Date
());
form
.
setUpdaterName
(
redis
.
getOpName
());
super
.
updateByPrimaryKey
(
form
);
//修改
经销商
的超管信息
//修改
省监管
的超管信息
memberManage
.
updateSupervise
(
form
);
return
1
;
...
...
@@ -116,8 +120,8 @@ public class SuperviseServiceimpl extends BaseModelServiceImpl<Supervise,Integer
s
.
setProvince
(
form
.
getProvince
());
Integer
count
=
superviseMapper
.
selectCount
(
s
);
if
(
count
>
0
){
log
.
info
(
"SuperviseServiceimpl#isExistName name: "
+
form
.
getProvince
()
+
"
省份
已存在"
);
throw
new
BusinessValidateException
(
"省份: "
+
form
.
getProvince
()
+
"
省份
已存在"
);
log
.
info
(
"SuperviseServiceimpl#isExistName name: "
+
form
.
getProvince
()
+
"已存在"
);
throw
new
BusinessValidateException
(
"省份: "
+
form
.
getProvince
()
+
"已存在"
);
}
return
true
;
}
...
...
@@ -163,8 +167,7 @@ public class SuperviseServiceimpl extends BaseModelServiceImpl<Supervise,Integer
});
return
supervise
;
}
}
com.zrqx.core/src/main/java/com/zrqx/core/model/member/supervise/Supervise.java
浏览文件 @
c5fe5187
...
...
@@ -22,8 +22,14 @@ public class Supervise extends BaseModel{
@ApiModelProperty
(
value
=
"ID"
)
private
Integer
id
;
@ApiModelProperty
(
"省份"
)
@ApiModelProperty
(
"省
/市
份"
)
private
String
province
;
@ApiModelProperty
(
value
=
"父类id"
,
required
=
true
)
private
Integer
parentId
;
@ApiModelProperty
(
value
=
"编号"
,
required
=
true
)
private
String
code
;
@ApiModelProperty
(
"超级管理员用户名"
)
private
String
userName
;
...
...
com.zrqx.core/src/main/java/com/zrqx/core/vo/member/supervise/SuperviseVo.java
0 → 100644
浏览文件 @
c5fe5187
package
com
.
zrqx
.
core
.
vo
.
member
.
supervise
;
import
com.zrqx.core.model.member.supervise.Supervise
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
@ApiModel
(
value
=
"SuperviseVo"
,
description
=
"省监管树状列表vo"
)
public
class
SuperviseVo
extends
Supervise
{
@ApiModelProperty
(
value
=
"子级"
)
private
List
<
SuperviseVo
>
list
=
new
ArrayList
<
SuperviseVo
>();
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论