Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
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
haoban3.0
haoban-manage3.0
Commits
a4ef6182
Commit
a4ef6182
authored
Jul 11, 2022
by
songyinghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 分组参数校验
parent
b2dc2714
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
9 deletions
+25
-9
HaoBanErrCode.java
...om/gic/haoban/manage/service/errorcode/HaoBanErrCode.java
+2
-0
HmGroupApiServiceImpl.java
...ge/service/service/out/impl/hm/HmGroupApiServiceImpl.java
+9
-5
HmGroupController.java
...ic/haoban/manage/web/controller/hm/HmGroupController.java
+3
-3
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+8
-1
HmGroupSettingVO.java
...ava/com/gic/haoban/manage/web/vo/hm/HmGroupSettingVO.java
+3
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/errorcode/HaoBanErrCode.java
View file @
a4ef6182
...
...
@@ -8,6 +8,8 @@ public enum HaoBanErrCode {
ERR_0001
(
"10100001"
,
"参数没有传"
),
ERR_10012
(
"10012"
,
"企业微信不存在"
),
ERR_OTHER
(
"9999"
,
"业务异常"
),
ERR_100033
(
"100033"
,
"活码分组已经被关联,不可删除"
)
;
private
String
code
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmGroupApiServiceImpl.java
View file @
a4ef6182
...
...
@@ -9,6 +9,7 @@ import com.gic.haoban.manage.api.dto.hm.HmGroupDTO;
import
com.gic.haoban.manage.api.dto.hm.HmGroupQueryDTO
;
import
com.gic.haoban.manage.api.enums.hm.HmGroupStatus
;
import
com.gic.haoban.manage.api.service.hm.HmGroupApiService
;
import
com.gic.haoban.manage.service.errorcode.HaoBanErrCode
;
import
com.gic.haoban.manage.service.pojo.bo.hm.HmGroupSettingBO
;
import
com.gic.haoban.manage.service.pojo.qo.HmGroupInfoQO
;
import
com.gic.haoban.manage.service.service.hm.HmGroupService
;
...
...
@@ -43,11 +44,12 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
@Override
public
ServiceResponse
<
Long
>
saveOrUpdateHmGroupSetting
(
HmGroupDTO
hmGroupDTO
)
{
log
.
info
(
"[saveOrUpdateHmGroupSetting] params:{}"
,
JSON
.
toJSONString
(
hmGroupDTO
));
if
(
StringUtils
.
isBlank
(
hmGroupDTO
.
getGroupName
()))
{
return
ServiceResponse
.
failure
(
HaoBanErrCodeCommon
.
ERR_5
.
getCode
()
+
""
,
HaoBanErrCodeCommon
.
ERR_5
.
getMsg
());
}
if
(
StringUtils
.
equals
(
DEFAULT_GROUP_NAME
,
hmGroupDTO
.
getGroupName
()))
{
return
ServiceResponse
.
failure
(
HaoBanErrCodeCommon
.
ERR_
5
.
getCode
()
+
""
,
HaoBanErrCodeCommon
.
ERR_5
.
getMsg
());
return
ServiceResponse
.
failure
(
HaoBanErrCodeCommon
.
ERR_
9
.
getCode
()
+
""
,
HaoBanErrCodeCommon
.
ERR_9
.
getMsg
());
}
HmGroupInfoQO
groupInfoQo
=
new
HmGroupInfoQO
();
groupInfoQo
.
setGroupName
(
hmGroupDTO
.
getGroupName
());
...
...
@@ -97,7 +99,7 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
Page
<
HmGroupDTO
>
groupDtoPage
=
PageUtil
.
changeToCurrentPage
(
groupSettingPage
,
HmGroupDTO
.
class
);
List
<
HmGroupDTO
>
result
=
new
ArrayList
<>();
// todo query 活码 默认分组的总数
result
.
add
(
buildDefault
(
null
));
result
.
add
(
buildDefault
(
0
));
if
(
CollectionUtils
.
isNotEmpty
(
groupDtoPage
.
getResult
()))
{
groupDtoPage
.
getResult
().
forEach
(
item
->
item
.
setDefaultFlag
(
0
));
result
.
addAll
(
groupDtoPage
.
getResult
());
...
...
@@ -126,9 +128,11 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
}
HmGroupSettingBO
groupSettingBo
=
groupService
.
queryGroupSettingDetail
(
groupDTO
.
getGroupId
());
if
(
groupSettingBo
==
null
||
!
HmGroupStatus
.
ENABLE
.
getCode
().
equals
(
groupSettingBo
.
getStatus
())
||
groupSettingBo
.
getReferNum
()
!=
0
)
{
return
ServiceResponse
.
failure
(
HaoBanErrCodeCommon
.
ERR_5
.
getCode
()
+
""
,
HaoBanErrCodeCommon
.
ERR_5
.
getMsg
());
||
!
HmGroupStatus
.
ENABLE
.
getCode
().
equals
(
groupSettingBo
.
getStatus
())){
return
ServiceResponse
.
failure
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()
+
""
,
HaoBanErrCodeCommon
.
ERR_8
.
getMsg
());
}
if
(
groupSettingBo
.
getReferNum
()
!=
null
&&
groupSettingBo
.
getReferNum
()
>
0
){
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_100033
.
getCode
(),
HaoBanErrCode
.
ERR_100033
.
getMsg
());
}
groupService
.
deleteGroupSetting
(
groupDTO
);
return
ServiceResponse
.
success
(
Boolean
.
TRUE
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/hm/HmGroupController.java
View file @
a4ef6182
...
...
@@ -47,7 +47,7 @@ public class HmGroupController extends WebBaseController {
if
(
serviceResponse
.
isSuccess
()){
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
}
return
RestResponse
.
failure
(
serviceResponse
.
getCode
()
+
""
,
serviceResponse
.
getMessage
());
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
@RequestMapping
(
path
=
"/list"
)
...
...
@@ -80,7 +80,7 @@ public class HmGroupController extends WebBaseController {
if
(
serviceResponse
.
isSuccess
()){
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
}
return
RestResponse
.
failure
(
serviceResponse
.
getCode
()
+
""
,
serviceResponse
.
getMessage
());
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
@RequestMapping
(
path
=
"/delete"
,
method
=
RequestMethod
.
POST
)
...
...
@@ -97,7 +97,7 @@ public class HmGroupController extends WebBaseController {
if
(
serviceResponse
.
isSuccess
()){
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
}
return
RestResponse
.
failure
(
serviceResponse
.
getCode
()
+
""
,
serviceResponse
.
getMessage
());
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
@RequestMapping
(
path
=
"/refer/count"
)
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
a4ef6182
...
...
@@ -124,7 +124,14 @@ public enum HaoBanErrCode {
ERR_100032
(
100032
,
"代理不能设置导购编辑权限"
),
ERR_100007
(
100007
,
"无门店权限"
),
ERR_DEFINE
(-
888
,
"自定义错误"
),
ERR_OTHER
(-
999
,
"未知错误code"
);
ERR_OTHER
(-
999
,
"未知错误code"
),
/**
* 活码相关
*
*/
ERR_100033
(
100033
,
"分组被关联,不可删除"
),
;
private
int
code
;
private
String
msg
;
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/hm/HmGroupSettingVO.java
View file @
a4ef6182
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
.
hm
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.NotEmpty
;
import
java.io.Serializable
;
...
...
@@ -12,7 +13,9 @@ import java.io.Serializable;
**/
public
class
HmGroupSettingVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
371589430652512397L
;
@NotEmpty
(
message
=
"活码分组名字不能为空"
)
@Length
(
max
=
10
,
message
=
"分组名称最多10个字符"
)
private
String
groupName
;
private
Long
groupId
;
...
...
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