Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rs-cloud-platform
Project
Project
Details
Activity
Releases
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
周健威
rs-cloud-platform
Commits
7300e48d
Commit
7300e48d
authored
Jun 27, 2024
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
66112688
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
5 deletions
+64
-5
GainDataController.java
...latform/rs/website/controller/web/GainDataController.java
+64
-5
No files found.
rs-website/rs-website-server/src/main/java/com/upyuns/platform/rs/website/controller/web/GainDataController.java
View file @
7300e48d
package
com
.
upyuns
.
platform
.
rs
.
website
.
controller
.
web
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
...
...
@@ -7,12 +9,14 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.upyuns.platform.rs.datacenter.entity.RscpImageDataTotal
;
import
com.upyuns.platform.rs.website.biz.DataMenuBiz
;
import
com.upyuns.platform.rs.website.biz.GainDataBiz
;
import
com.upyuns.platform.rs.website.dto.GainDataDTO
;
import
com.upyuns.platform.rs.website.entity.DataMenu
;
import
com.upyuns.platform.rs.website.entity.GainData
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -26,6 +30,9 @@ import java.awt.image.BufferedImage;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
...
...
@@ -40,12 +47,66 @@ public class GainDataController extends BaseController<GainDataBiz,GainData> {
@IgnoreUserToken
@RequestMapping
(
value
=
"/app/unauth/mapAll"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
List
<
GainData
>>
getPageList
(
GainDataDTO
dto
)
{
Example
example
=
initExample
(
dto
);
PageDataVO
pageDataVO
=
PageDataVO
.
pageInfo
(
dto
.
getPage
(),
dto
.
getLimit
(),
()->
baseBiz
.
selectByExample
(
example
));
return
ObjectRestResponse
.
succ
(
pageDataVO
);
}
@ApiModelProperty
(
"统计"
)
@IgnoreUserToken
@RequestMapping
(
value
=
"/app/unauth/statistics"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
List
<
GainData
>>
statistics
(
GainDataDTO
dto
)
{
Example
example
=
initExample
(
dto
);
List
<
GainData
>
list
=
baseBiz
.
selectByExample
(
example
);
List
<
DataMenu
>
dataMenuList
=
dataMenuBiz
.
selectListAll
();
List
<
GainDataVO
>
voList
=
Convert
.
toList
(
GainDataVO
.
class
,
list
);
Map
<
Integer
,
DataMenu
>
dataMenuMap
=
dataMenuList
.
parallelStream
().
collect
(
Collectors
.
toMap
(
DataMenu:
:
getId
,
Function
.
identity
()));
for
(
GainDataVO
gainDataVO
:
voList
)
{
if
(
null
!=
gainDataVO
.
getMenuId
())
{
DataMenu
topMenu
=
getTopMenu
(
dataMenuMap
,
dataMenuMap
.
get
(
gainDataVO
.
getMenuId
()));
if
(
null
!=
topMenu
)
{
gainDataVO
.
setTopMenuId
(
topMenu
.
getId
());
gainDataVO
.
setTopMenuName
(
topMenu
.
getTitle
());
}
}
}
Map
<
String
,
Long
>
map
=
list
.
parallelStream
().
filter
(
o
->
StrUtil
.
isNotBlank
(
o
.
getSupplier
())).
collect
(
Collectors
.
groupingBy
(
GainData:
:
getSupplier
,
Collectors
.
counting
()));
Map
<
String
,
Long
>
map2
=
voList
.
parallelStream
().
filter
(
o
->
(
null
!=
o
.
getMenuId
())).
collect
(
Collectors
.
groupingBy
(
GainDataVO:
:
getTopMenuName
,
Collectors
.
counting
()));
Map
<
String
,
Map
>
returnMap
=
CollUtil
.
newHashMap
();
returnMap
.
put
(
"按供应商统计"
,
map
);
returnMap
.
put
(
"按项目"
,
map2
);
return
ObjectRestResponse
.
succ
(
returnMap
);
}
@Data
static
public
class
GainDataVO
extends
GainData
{
Integer
topMenuId
;
String
topMenuName
;
}
private
DataMenu
getTopMenu
(
Map
<
Integer
,
DataMenu
>
dataMenuMap
,
DataMenu
dataMenu
){
if
(
dataMenu
!=
null
&&
dataMenu
.
getParentId
()
!=
null
&&
dataMenu
.
getParentId
()
!=
-
1
)
{
if
(
null
==
dataMenuMap
.
get
(
dataMenu
.
getParentId
()))
{
return
dataMenu
;
}
else
{
return
getTopMenu
(
dataMenuMap
,
dataMenuMap
.
get
(
dataMenu
.
getParentId
()));
}
}
else
{
return
dataMenu
;
}
}
private
Example
initExample
(
GainDataDTO
dto
)
{
Example
example
=
new
Example
(
GainData
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"isDel"
,
0
);
criteria
.
andEqualTo
(
"status"
,
2
);
if
(
StringUtils
.
isNotBlank
(
dto
.
getMenuId
())){
criteria
.
andEqualTo
(
"menuId"
,
dto
.
getMenuId
());
criteria
.
andEqualTo
(
"menuId"
,
dto
.
getMenuId
());
}
if
(
StrUtil
.
isNotBlank
(
dto
.
getTopMenuId
())){
...
...
@@ -53,7 +114,7 @@ public class GainDataController extends BaseController<GainDataBiz,GainData> {
}
if
(
StrUtil
.
isNotBlank
(
dto
.
getTime
())){
criteria
.
andEqualTo
(
"time"
,
dto
.
getTime
());
criteria
.
andEqualTo
(
"time"
,
dto
.
getTime
());
}
if
(
StrUtil
.
isNotBlank
(
dto
.
getSupplier
())){
criteria
.
andLike
(
"supplier"
,
"%"
+
dto
.
getSupplier
()
+
"%"
);
...
...
@@ -67,9 +128,7 @@ public class GainDataController extends BaseController<GainDataBiz,GainData> {
if
(
null
!=
dto
.
getCrtTimeEnd
()){
criteria
.
andLessThanOrEqualTo
(
"crtTime"
,
DateUtil
.
endOfDay
(
dto
.
getCrtTimeEnd
()));
}
PageDataVO
pageDataVO
=
PageDataVO
.
pageInfo
(
dto
.
getPage
(),
dto
.
getLimit
(),
()->
baseBiz
.
selectByExample
(
example
));
return
ObjectRestResponse
.
succ
(
pageDataVO
);
return
example
;
}
@ApiModelProperty
(
"查询详情"
)
...
...
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