Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-data-cloud
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
base_platform_enterprise
gic-data-cloud
Commits
88879a82
Commit
88879a82
authored
Jul 08, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
功能下拉接口
parent
2e28a5f9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
29 deletions
+98
-29
FunctionEnum.java
...i/src/main/java/com/gic/cloud/constants/FunctionEnum.java
+14
-17
FunctionApiService.java
...c/main/java/com/gic/cloud/service/FunctionApiService.java
+4
-0
FunctionService.java
.../src/main/java/com/gic/cloud/service/FunctionService.java
+4
-0
FunctionServiceImpl.java
.../java/com/gic/cloud/service/impl/FunctionServiceImpl.java
+5
-0
FunctionApiServiceImpl.java
.../gic/cloud/service/outer/impl/FunctionApiServiceImpl.java
+12
-10
UserController.java
...ain/java/com/gic/cloud/web/controller/UserController.java
+24
-2
FunctionListVO.java
...eb/src/main/java/com/gic/cloud/web/vo/FunctionListVO.java
+35
-0
No files found.
gic-data-cloud-api/src/main/java/com/gic/cloud/constants/FunctionEnum.java
View file @
88879a82
...
...
@@ -7,40 +7,37 @@ package com.gic.cloud.constants;
* @date 2020/7/7 4:15 PM
*/
public
enum
FunctionEnum
{
RANK_LIST
(
1
,
"排行榜"
),
MEMBER_PROFILE
(
2
,
"会员概况"
),
RECRUITMENT_ANALYSIS
(
3
,
"招募分析"
),
MEMBER_PORTRAIT
(
4
,
"会员画像"
),
PERFORMANCE_OVERVIEW
(
5
,
"业绩概览"
),
CONSUME_COMPOSITION
(
6
,
"消费构成"
),
ITEM_RANK
(
7
,
"单品排行"
),
BASIC_PERFORMANCE
(
8
,
"基础业绩"
);
RANK_LIST
(
"FUC001"
,
"排行榜"
),
MEMBER_PROFILE
(
"FUC002"
,
"会员概况"
),
RECRUITMENT_ANALYSIS
(
"FUC003"
,
"招募分析"
),
MEMBER_PORTRAIT
(
"FUC004"
,
"会员画像"
),
PERFORMANCE_OVERVIEW
(
"FUC005"
,
"业绩概览"
),
CONSUME_COMPOSITION
(
"FUC006"
,
"消费构成"
),
ITEM_RANK
(
"FUC007"
,
"单品排行"
),
BASIC_PERFORMANCE
(
"FUC008"
,
"基础业绩"
);
private
int
code
;
private
String
code
;
private
String
name
;
private
FunctionEnum
(
int
code
,
String
name
)
{
private
FunctionEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
boolean
isRightCode
(
Integer
code
)
{
if
(
code
==
null
)
{
return
false
;
}
public
static
boolean
isRightCode
(
String
code
)
{
for
(
FunctionEnum
functionEnum
:
values
())
{
if
(
code
.
intValue
()
==
functionEnum
.
getCode
(
))
{
if
(
functionEnum
.
getCode
().
equals
(
code
))
{
return
true
;
}
}
return
false
;
}
public
int
getCode
()
{
public
String
getCode
()
{
return
code
;
}
public
FunctionEnum
setCode
(
int
code
)
{
public
FunctionEnum
setCode
(
String
code
)
{
this
.
code
=
code
;
return
this
;
}
...
...
gic-data-cloud-api/src/main/java/com/gic/cloud/service/FunctionApiService.java
View file @
88879a82
...
...
@@ -4,6 +4,8 @@ import com.gic.api.base.commons.Page;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.cloud.dto.FunctionDTO
;
import
java.util.List
;
public
interface
FunctionApiService
{
/**
* 新增功能权限集
...
...
@@ -20,4 +22,6 @@ public interface FunctionApiService {
ServiceResponse
<
Void
>
deleteFunction
(
Integer
functionId
);
ServiceResponse
<
Page
<
FunctionDTO
>>
pageFunction
(
Integer
enterpriseId
,
String
functionName
,
Integer
currentPage
,
Integer
pageSize
);
ServiceResponse
<
List
<
FunctionDTO
>>
listFunction
(
Integer
enterpriseId
,
String
functionName
);
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/FunctionService.java
View file @
88879a82
...
...
@@ -4,6 +4,8 @@ import com.gic.cloud.dto.FunctionDTO;
import
com.gic.cloud.entity.TabSysFunction
;
import
com.github.pagehelper.Page
;
import
java.util.List
;
public
interface
FunctionService
{
Integer
saveFunction
(
FunctionDTO
dto
);
...
...
@@ -17,4 +19,6 @@ public interface FunctionService {
Page
<
TabSysFunction
>
pageFunction
(
Integer
enterpriseId
,
String
functionName
,
Integer
currentPage
,
Integer
pageSize
);
List
<
TabSysFunction
>
listFunction
(
Integer
enterpriseId
,
String
functionName
);
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/impl/FunctionServiceImpl.java
View file @
88879a82
...
...
@@ -66,4 +66,9 @@ public class FunctionServiceImpl implements FunctionService{
List
<
TabSysFunction
>
list
=
tabSysFunctionMapper
.
listFunction
(
enterpriseId
,
functionName
);
return
(
Page
<
TabSysFunction
>)
list
;
}
@Override
public
List
<
TabSysFunction
>
listFunction
(
Integer
enterpriseId
,
String
functionName
)
{
return
tabSysFunctionMapper
.
listFunction
(
enterpriseId
,
functionName
);
}
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/outer/impl/FunctionApiServiceImpl.java
View file @
88879a82
...
...
@@ -9,6 +9,7 @@ import com.gic.cloud.entity.TabSysFunction;
import
com.gic.cloud.service.FunctionApiService
;
import
com.gic.cloud.service.FunctionService
;
import
com.gic.cloud.service.UserService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.error.ErrorCode
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -16,9 +17,7 @@ import org.apache.commons.lang.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -79,6 +78,13 @@ public class FunctionApiServiceImpl implements FunctionApiService{
return
ServiceResponse
.
success
(
new
Page
<>());
}
@Override
public
ServiceResponse
<
List
<
FunctionDTO
>>
listFunction
(
Integer
enterpriseId
,
String
functionName
)
{
return
ServiceResponse
.
success
(
Optional
.
ofNullable
(
EntityUtil
.
changeEntityListNew
(
FunctionDTO
.
class
,
functionService
.
listFunction
(
enterpriseId
,
functionName
)))
.
orElse
(
Collections
.
EMPTY_LIST
));
}
private
ServiceResponse
<
Void
>
validParam
(
FunctionDTO
dto
)
{
if
(
dto
.
getFunctionId
()
!=
null
)
{
TabSysFunction
record
=
functionService
.
getFunction
(
dto
.
getFunctionId
());
...
...
@@ -104,16 +110,12 @@ public class FunctionApiServiceImpl implements FunctionApiService{
}
//一个流只能用一次
Stream
<
String
>
stream
=
Arrays
.
stream
(
functionComponent
.
split
(
","
));
Stream
<
String
>
stream2
=
Arrays
.
stream
(
functionComponent
.
split
(
","
));
Stream
<
String
>
stream3
=
Arrays
.
stream
(
functionComponent
.
split
(
","
));
if
(
stream
.
anyMatch
(
e
->
!
StringUtils
.
isNumeric
(
e
)))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"功能组件值非法"
);
}
if
(
stream2
.
anyMatch
(
e
->
!
FunctionEnum
.
isRightCode
(
Integer
.
parseInt
(
e
))))
{
Stream
<
String
>
stream1
=
Arrays
.
stream
(
functionComponent
.
split
(
","
));
if
(
stream
.
anyMatch
(
e
->
!
FunctionEnum
.
isRightCode
(
e
)))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"功能组件值非法"
);
}
StringBuilder
temp
=
new
StringBuilder
(
"_"
);
stream
3
.
mapToInt
(
e
->
Integer
.
parseInt
(
e
)).
boxed
()
.
sorted
().
forEach
(
e
->
{
stream
1
.
sorted
().
forEach
(
e
->
{
temp
.
append
(
e
).
append
(
"_"
);
});
dto
.
setFunctionComponent
(
temp
.
toString
());
...
...
gic-data-cloud-web/src/main/java/com/gic/cloud/web/controller/UserController.java
View file @
88879a82
package
com
.
gic
.
cloud
.
web
.
controller
;
import
com.gic.cloud.constants.FunctionEnum
;
import
com.gic.cloud.dto.AccountGroupDTO
;
import
com.gic.cloud.dto.UserDTO
;
import
com.gic.cloud.qo.UserQO
;
import
com.gic.cloud.service.AccountGroupApiService
;
import
com.gic.cloud.service.FunctionApiService
;
import
com.gic.cloud.service.UserApiService
;
import
com.gic.cloud.web.vo.AccountGroupVO
;
import
com.gic.cloud.web.vo.FunctionListVO
;
import
com.gic.cloud.web.vo.UserVO
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
...
...
@@ -17,8 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
...
...
@@ -30,6 +32,8 @@ public class UserController {
private
AccountGroupApiService
accountGroupApiService
;
@Autowired
private
UserApiService
userApiService
;
@Autowired
private
FunctionApiService
functionApiService
;
@RequestMapping
(
"/save-account-group"
)
public
RestResponse
saveAccountGroup
(
AccountGroupDTO
dto
)
{
...
...
@@ -74,8 +78,26 @@ public class UserController {
return
ResultControllerUtils
.
commonResult
(
userApiService
.
deleteUser
(
userId
));
}
@RequestMapping
(
"/list-function-component"
)
public
RestResponse
listFunctionComponent
()
{
List
<
Map
<
String
,
String
>>
list
=
new
ArrayList
<>(
8
);
for
(
FunctionEnum
functionEnum
:
FunctionEnum
.
values
())
{
Map
<
String
,
String
>
map
=
new
HashMap
<>(
2
);
map
.
put
(
functionEnum
.
getCode
(),
functionEnum
.
getName
());
list
.
add
(
map
);
}
return
RestResponse
.
success
(
list
);
}
@RequestMapping
(
"/list-function"
)
public
RestResponse
listFunction
(
String
functionName
)
{
return
ResultControllerUtils
.
commonResult
(
functionApiService
.
listFunction
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
functionName
),
FunctionListVO
.
class
);
}
@RequestMapping
(
"/page-user"
)
public
RestResponse
pageUser
(
UserQO
userQO
)
{
userQO
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
return
ResultControllerUtils
.
commonPageResult
(
userApiService
.
pageUser
(
userQO
),
UserVO
.
class
);
}
...
...
gic-data-cloud-web/src/main/java/com/gic/cloud/web/vo/FunctionListVO.java
0 → 100644
View file @
88879a82
package
com
.
gic
.
cloud
.
web
.
vo
;
import
java.io.Serializable
;
public
class
FunctionListVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
855201859340536651L
;
/**
* ID
*/
private
Integer
functionId
;
/**
* 名称
*/
private
String
functionName
;
public
Integer
getFunctionId
()
{
return
functionId
;
}
public
FunctionListVO
setFunctionId
(
Integer
functionId
)
{
this
.
functionId
=
functionId
;
return
this
;
}
public
String
getFunctionName
()
{
return
functionName
;
}
public
FunctionListVO
setFunctionName
(
String
functionName
)
{
this
.
functionName
=
functionName
;
return
this
;
}
}
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