Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
825e1c7a
Commit
825e1c7a
authored
Oct 25, 2020
by
季圣华
Committed by
Gitee
Oct 25, 2020
Browse files
!67 首页获取前6个月日期代码调整
Merge pull request !67 from manager/master
parents
4ac640c5
65c08982
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
825e1c7a
...
...
@@ -704,10 +704,7 @@ public class DepotItemController {
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
String
message
=
"成功"
;
try
{
Date
date
=
new
Date
();
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM"
);
String
dateString
=
formatter
.
format
(
date
);
List
<
String
>
list
=
Tools
.
getSixMonth
(
dateString
);
List
<
String
>
list
=
Tools
.
getLastMonths
(
6
);
map
.
put
(
"monthList"
,
list
);
List
<
BigDecimal
>
buyPriceList
=
new
ArrayList
<
BigDecimal
>();
for
(
String
month:
list
)
{
...
...
src/main/java/com/jsh/erp/utils/Tools.java
View file @
825e1c7a
...
...
@@ -155,6 +155,27 @@ public class Tools {
return
new
SimpleDateFormat
(
"yyyy-MM"
).
format
(
cal
.
getTime
());
}
/**
* 获取当前月份的前6个月(含当前月)
* @param size 月数
* @return
*/
public
static
List
<
String
>
getLastMonths
(
int
size
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM"
);
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
new
Date
());
List
<
String
>
list
=
new
ArrayList
(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
c
.
setTime
(
new
Date
());
c
.
add
(
Calendar
.
MONTH
,
-
i
);
Date
m
=
c
.
getTime
();
list
.
add
(
sdf
.
format
(
m
));
}
Collections
.
reverse
(
list
);
return
list
;
}
/**
* 获取当前月份的前6个月(含当前月)
* @param date
...
...
Write
Preview
Supports
Markdown
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