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
7ea85d4f
Commit
7ea85d4f
authored
Oct 24, 2019
by
季圣华
Browse files
给首页增加统计折线图的功能
parent
028b87a7
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
erp_web/home.html
View file @
7ea85d4f
This diff is collapsed.
Click to expand it.
erp_web/js/highcharts/exporting.js
View file @
7ea85d4f
This diff is collapsed.
Click to expand it.
erp_web/js/highcharts/highcharts-zh_CN.js
0 → 100644
View file @
7ea85d4f
(
function
(
factory
){
if
(
typeof
module
===
"
object
"
&&
module
.
exports
){
module
.
exports
=
factory
}
else
{
factory
(
Highcharts
)}})(
function
(
Highcharts
){
var
protocol
=
window
.
location
.
protocol
;
var
defaultOptionsZhCn
=
{
lang
:{
contextButtonTitle
:
"
图表导出菜单
"
,
decimalPoint
:
"
.
"
,
downloadJPEG
:
"
下载 JPEG 图片
"
,
downloadPDF
:
"
下载 PDF 文件
"
,
downloadPNG
:
"
下载 PNG 文件
"
,
downloadSVG
:
"
下载 SVG 文件
"
,
downloadXLS
:
"
下载 XLS 文件
"
,
openInCloud
:
"
在 Highcharts Cloud 中打开
"
,
drillUpText
:
"
返回 {series.name}
"
,
invalidDate
:
"
无效的时间
"
,
loading
:
"
加载中...
"
,
months
:[
"
一月
"
,
"
二月
"
,
"
三月
"
,
"
四月
"
,
"
五月
"
,
"
六月
"
,
"
七月
"
,
"
八月
"
,
"
九月
"
,
"
十月
"
,
"
十一月
"
,
"
十二月
"
],
noData
:
"
没有数据
"
,
numericSymbols
:
null
,
printChart
:
"
打印图表
"
,
resetZoom
:
"
重置缩放比例
"
,
resetZoomTitle
:
"
重置为原始大小
"
,
shortMonths
:[
"
一月
"
,
"
二月
"
,
"
三月
"
,
"
四月
"
,
"
五月
"
,
"
六月
"
,
"
七月
"
,
"
八月
"
,
"
九月
"
,
"
十月
"
,
"
十一月
"
,
"
十二月
"
],
thousandsSep
:
"
,
"
,
weekdays
:[
"
星期天
"
,
"
星期一
"
,
"
星期二
"
,
"
星期三
"
,
"
星期四
"
,
"
星期五
"
,
"
星期六
"
],
viewData
:
"
查看数据表格
"
,
rangeSelectorFrom
:
"
开始时间
"
,
rangeSelectorTo
:
"
结束时间
"
,
rangeSelectorZoom
:
"
范围
"
,
zoomIn
:
"
缩小
"
,
zoomOut
:
"
放大
"
},
global
:{
canvasToolsURL
:
protocol
+
"
//cdn.hcharts.cn/highcharts/modules/canvas-tools.js
"
,
VMLRadialGradientURL
:
protocol
+
+
"
//cdn.hcharts.cn/highcharts/gfx/vml-radial-gradient.png
"
},
title
:{
text
:
"
图表标题
"
},
tooltip
:{
dateTimeLabelFormats
:{
millisecond
:
"
%H:%M:%S.%L
"
,
second
:
"
%H:%M:%S
"
,
minute
:
"
%H:%M
"
,
hour
:
"
%H:%M
"
,
day
:
"
%Y-%m-%d
"
,
week
:
"
%Y-%m-%d
"
,
month
:
"
%Y-%m
"
,
year
:
"
%Y
"
},
split
:
false
},
exporting
:{
url
:
protocol
+
"
//export.highcharts.com.cn
"
},
credits
:{
text
:
"
Highcharts.com.cn
"
,
href
:
"
https://www.highcharts.com.cn
"
},
xAxis
:{
dateTimeLabelFormats
:{
millisecond
:
"
%H:%M:%S.%L
"
,
second
:
"
%H:%M:%S
"
,
minute
:
"
%H:%M
"
,
hour
:
"
%H:%M
"
,
day
:
"
%Y-%m-%d
"
,
week
:
"
%Y-%m
"
,
month
:
"
%Y-%m
"
,
year
:
"
%Y
"
}},
rangeSelector
:{
inputDateFormat
:
"
%Y-%m-%d
"
,
buttons
:[{
type
:
"
month
"
,
count
:
1
,
text
:
"
月
"
},{
type
:
"
month
"
,
count
:
3
,
text
:
"
季度
"
},{
type
:
"
month
"
,
count
:
6
,
text
:
"
半年
"
},{
type
:
"
ytd
"
,
text
:
"
YTD
"
},{
type
:
"
year
"
,
count
:
1
,
text
:
"
年
"
},{
type
:
"
all
"
,
text
:
"
所有
"
}]},
plotOptions
:{
series
:{
dataGrouping
:{
dateTimeLabelFormats
:{
millisecond
:[
"
%Y-%m-%d %H:%M:%S.%L
"
,
"
%Y-%m-%d %H:%M:%S.%L
"
,
"
~ %H:%M:%S.%L
"
],
second
:[
"
%Y-%m-%d %H:%M:%S
"
,
"
%Y-%m-%d %H:%M:%S
"
,
"
~ %H:%M:%S
"
],
minute
:[
"
%Y-%m-%d %H:%M
"
,
"
%Y-%m-%d %H:%M
"
,
"
~ %H:%M
"
],
hour
:[
"
%Y-%m-%d %H:%M
"
,
"
%Y-%m-%d %H:%M
"
,
"
~ %H:%M
"
],
day
:[
"
%Y-%m-%d
"
,
"
%Y-%m-%d
"
,
"
~ %Y-%m-%d
"
],
week
:[
"
%Y-%m-%d
"
,
"
%Y-%m-%d
"
,
"
~ %Y-%m-%d
"
],
month
:[
"
%Y-%m
"
,
"
%Y-%m
"
,
"
~ %Y-%m
"
],
year
:[
"
%Y
"
,
"
%Y
"
,
"
~ %Y
"
]}}},
ohlc
:{
tooltip
:{
split
:
false
,
pointFormat
:
'
<span style="color:{point.color}">●</span> <b> {series.name}</b><br/>
'
+
"
开盘:{point.open}<br/>
"
+
"
最高:{point.high}<br/>
"
+
"
最低:{point.low}<br/>
"
+
"
收盘:{point.close}<br/>
"
}},
candlestick
:{
tooltip
:{
split
:
false
,
pointFormat
:
'
<span style="color:{point.color}">●</span> <b> {series.name}</b><br/>
'
+
"
开盘:{point.open}<br/>
"
+
"
最高:{point.high}<br/>
"
+
"
最低:{point.low}<br/>
"
+
"
收盘:{point.close}<br/>
"
}}}};
Highcharts
.
setOptions
(
defaultOptionsZhCn
)});
\ No newline at end of file
erp_web/js/highcharts/highcharts.js
View file @
7ea85d4f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
erp_web/js/modules/msg/topMenuMsg.js
View file @
7ea85d4f
...
...
@@ -3,61 +3,61 @@
* @author jishenghua
*/
$
(
function
()
{
unreadMsg
()
//
unreadMsg()
});
function
unreadMsg
()
{
$
.
get
(
ctx
+
"
/msg/unreadMsg?__notUpdateSession=true&__t=
"
+
new
Date
().
getTime
(),
function
(
d
)
{
var
b
=
$
(
"
#msgList
"
).
empty
();
var
a
=
d
.
count
||
0
,
c
=
d
.
list
||
[];
for
(
i
=
0
;
i
<
c
.
length
;
i
++
)
{
b
.
append
(
js
.
template
(
"
msgListTpl
"
,
c
[
i
]))
}
$
(
"
#msgNum, #msgNum2
"
).
text
(
a
);
$
(
"
.timeago
"
).
timeago
();
pullPoolMsg
();
if
(
window
.
ppmInt
)
{
clearInterval
(
window
.
ppmInt
)
}
window
.
ppmInt
=
setInterval
(
pullPoolMsg
,
60
*
1000
)
})
}
function
pullPoolMsg
()
{
var
a
=
$
(
"
#msgList
"
);
var
b
=
a
.
attr
(
"
data-mergeMsgLimit
"
);
$
.
get
(
ctx
+
"
/msg/pullPoolMsg?__notUpdateSession=true&__t=
"
+
new
Date
().
getTime
(),
function
(
e
)
{
for
(
i
=
0
;
i
<
e
.
length
;
i
++
)
{
if
(
!
(
e
.
length
>
b
))
{
var
g
=
js
.
template
(
"
msgTipTpl
"
,
e
[
i
]);
js
.
showMessage
(
g
,
e
[
i
].
msgContentEntity
.
title
,
"
info
"
,
1000
*
60
);
doFlashTitle
()
}
if
(
e
[
i
].
id
&&
e
[
i
].
id
!=
""
)
{
a
.
prepend
(
js
.
template
(
"
msgListTpl
"
,
e
[
i
]))
}
}
if
(
e
.
length
>
b
)
{
var
f
=
{
msgContentEntity
:
{
title
:
a
.
attr
(
"
data-mergeMsgTitle
"
),
content
:
js
.
text
(
a
.
attr
(
"
data-mergeMsgContent
"
),
e
.
length
)
},
sendDate
:
""
,
sendUserName
:
""
,
id
:
""
};
var
g
=
js
.
template
(
"
msgTipTpl
"
,
f
);
js
.
showMessage
(
g
,
null
,
"
info
"
,
1000
*
60
);
doFlashTitle
()
}
var
c
=
parseInt
(
$
(
"
#msgNum
"
).
text
());
if
(
!
isNaN
(
c
))
{
c
+=
e
.
length
||
0
}
else
{
c
=
a
.
find
(
"
li
"
).
length
}
$
(
"
#msgNum, #msgNum2
"
).
text
(
c
);
$
(
"
.timeago
"
).
timeago
()
})
}
//
function unreadMsg() {
//
$.get(ctx + "/msg/unreadMsg?__notUpdateSession=true&__t=" + new Date().getTime(), function (d) {
//
var b = $("#msgList").empty();
//
var a = d.count || 0, c = d.list || [];
//
for (i = 0; i < c.length; i++) {
//
b.append(js.template("msgListTpl", c[i]))
//
}
//
$("#msgNum, #msgNum2").text(a);
//
$(".timeago").timeago();
//
pullPoolMsg();
//
if (window.ppmInt) {
//
clearInterval(window.ppmInt)
//
}
//
window.ppmInt = setInterval(pullPoolMsg, 60 * 1000)
//
})
//
}
//
//
function pullPoolMsg() {
//
var a = $("#msgList");
//
var b = a.attr("data-mergeMsgLimit");
//
$.get(ctx + "/msg/pullPoolMsg?__notUpdateSession=true&__t=" + new Date().getTime(), function (e) {
//
for (i = 0; i < e.length; i++) {
//
if (!(e.length > b)) {
//
var g = js.template("msgTipTpl", e[i]);
//
js.showMessage(g, e[i].msgContentEntity.title, "info", 1000 * 60);
//
doFlashTitle()
//
}
//
if (e[i].id && e[i].id != "") {
//
a.prepend(js.template("msgListTpl", e[i]))
//
}
//
}
//
if (e.length > b) {
//
var f = {
//
msgContentEntity: {
//
title: a.attr("data-mergeMsgTitle"),
//
content: js.text(a.attr("data-mergeMsgContent"), e.length)
//
}, sendDate: "", sendUserName: "", id: ""
//
};
//
var g = js.template("msgTipTpl", f);
//
js.showMessage(g, null, "info", 1000 * 60);
//
doFlashTitle()
//
}
//
var c = parseInt($("#msgNum").text());
//
if (!isNaN(c)) {
//
c += e.length || 0
//
} else {
//
c = a.find("li").length
//
}
//
$("#msgNum, #msgNum2").text(c);
//
$(".timeago").timeago()
//
})
//
}
function
readMsg
(
c
,
d
,
e
)
{
var
a
=
$
(
c
).
data
(
"
href
"
);
...
...
src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
7ea85d4f
...
...
@@ -21,10 +21,8 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.File
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
...
...
@@ -665,4 +663,46 @@ public class DepotItemController {
}
return
res
;
}
/**
* 统计采购或销售的总金额
* @param request
* @param response
* @return
* @throws Exception
*/
@GetMapping
(
value
=
"/buyOrSalePrice"
)
public
BaseResponseInfo
buyOrSalePrice
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
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
);
map
.
put
(
"monthList"
,
list
);
List
<
BigDecimal
>
buyPriceList
=
new
ArrayList
<
BigDecimal
>();
for
(
String
month:
list
)
{
BigDecimal
outPrice
=
depotItemService
.
inOrOutPrice
(
"入库"
,
"采购"
,
month
);
BigDecimal
inPrice
=
depotItemService
.
inOrOutPrice
(
"出库"
,
"采购退货"
,
month
);
buyPriceList
.
add
(
outPrice
.
subtract
(
inPrice
));
}
map
.
put
(
"buyPriceList"
,
buyPriceList
);
List
<
BigDecimal
>
salePriceList
=
new
ArrayList
<
BigDecimal
>();
for
(
String
month:
list
)
{
BigDecimal
outPrice
=
depotItemService
.
inOrOutPrice
(
"出库"
,
"销售"
,
month
);
BigDecimal
inPrice
=
depotItemService
.
inOrOutPrice
(
"入库"
,
"销售退货"
,
month
);
salePriceList
.
add
(
outPrice
.
subtract
(
inPrice
));
}
map
.
put
(
"salePriceList"
,
salePriceList
);
res
.
code
=
200
;
res
.
data
=
map
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
message
=
"统计失败"
;
res
.
code
=
500
;
}
return
res
;
}
}
src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java
View file @
7ea85d4f
...
...
@@ -63,6 +63,11 @@ public interface DepotItemMapperEx {
@Param
(
"MonthTime"
)
String
MonthTime
,
@Param
(
"sumType"
)
String
sumType
);
BigDecimal
inOrOutPrice
(
@Param
(
"type"
)
String
type
,
@Param
(
"subType"
)
String
subType
,
@Param
(
"MonthTime"
)
String
MonthTime
);
DepotItemVo4Stock
getStockByParam
(
@Param
(
"depotId"
)
Long
depotId
,
@Param
(
"mId"
)
Long
mId
,
...
...
src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
7ea85d4f
...
...
@@ -260,6 +260,24 @@ public class DepotItemService {
}
/**
* 统计采购或销售的总金额
* @param type
* @param subType
* @param MonthTime
* @return
* @throws Exception
*/
public
BigDecimal
inOrOutPrice
(
String
type
,
String
subType
,
String
MonthTime
)
throws
Exception
{
BigDecimal
result
=
BigDecimal
.
ZERO
;
try
{
result
=
depotItemMapperEx
.
inOrOutPrice
(
type
,
subType
,
MonthTime
);
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
return
result
;
}
/**
* 2019-02-02修改
* 我之前对操作数量的理解有偏差
...
...
src/main/java/com/jsh/erp/utils/Tools.java
View file @
7ea85d4f
...
...
@@ -156,6 +156,41 @@ public class Tools {
return
new
SimpleDateFormat
(
"yyyy-MM"
).
format
(
cal
.
getTime
());
}
/**
* 获取当前月份的前6个月(含当前月)
* @param date
* @return
*/
public
static
List
<
String
>
getSixMonth
(
String
date
)
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
int
month
=
Integer
.
parseInt
(
date
.
substring
(
5
,
7
));
int
year
=
Integer
.
parseInt
(
date
.
substring
(
0
,
4
));
for
(
int
i
=
5
;
i
>=
0
;
i
--)
{
if
(
month
>
6
)
{
if
(
month
-
i
>=
10
)
{
list
.
add
(
year
+
"-"
+
String
.
valueOf
(
month
-
i
));
}
else
{
list
.
add
(
year
+
"-0"
+
String
.
valueOf
(
month
-
i
));
}
}
else
{
if
(
month
-
i
<=
0
)
{
if
(
month
-
i
+
12
>=
10
)
{
list
.
add
(
String
.
valueOf
(
year
-
1
)
+
"-"
+
String
.
valueOf
(
month
-
i
+
12
));
}
else
{
list
.
add
(
String
.
valueOf
(
year
-
1
)
+
"-0"
+
String
.
valueOf
(
month
-
i
+
12
));
}
}
else
{
if
(
month
-
i
>=
10
)
{
list
.
add
(
String
.
valueOf
(
year
)
+
"-"
+
String
.
valueOf
(
month
-
i
));
}
else
{
list
.
add
(
String
.
valueOf
(
year
)
+
"-0"
+
String
.
valueOf
(
month
-
i
));
}
}
}
}
return
list
;
}
/**
* 截取字符串长度
*
...
...
src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
7ea85d4f
...
...
@@ -202,6 +202,15 @@
and ifnull(di.delete_Flag,'0') !='1'
</select>
<select
id=
"inOrOutPrice"
resultType=
"java.math.BigDecimal"
>
select ifnull(sum(DiscountLastMoney),0) as allMoney from jsh_depothead dh
where 1=1
and dh.type='${type}' and dh.subType='${subType}'
and dh.OperTime
>
= '${MonthTime}-01 00:00:00'
and dh.OperTime
<
= '${MonthTime}-31 23:59:59'
and ifnull(dh.delete_Flag,'0') !='1'
</select>
<select
id=
"getStockByParam"
resultMap=
"StockMap"
>
select ifnull((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal),0) as in_stock,
ifnull((curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal),0) out_stock
...
...
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