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
3ad93e20
Commit
3ad93e20
authored
Nov 09, 2021
by
季圣华
Browse files
优化首页统计
parent
a923700c
Changes
8
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
3ad93e20
...
...
@@ -345,34 +345,48 @@ public class DepotHeadController {
}
/**
* 统计今日
销售
额、今日
进货
额、本月销售额、
本月进货
额
* 统计今日
采购额、本月采购
额、今日
销售
额、本月销售额、
今日零售额、本月零售
额
* @param request
* @return
*/
@GetMapping
(
value
=
"/getBuyAndSaleStatistics"
)
@ApiOperation
(
value
=
"统计今日
销售
额、今日
进货
额、本月销售额、
本月进货
额"
)
@ApiOperation
(
value
=
"统计今日
采购额、本月采购
额、今日
销售
额、本月销售额、
今日零售额、本月零售
额"
)
public
BaseResponseInfo
getBuyAndSaleStatistics
(
HttpServletRequest
request
)
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
try
{
String
today
=
Tools
.
getNow
()
+
BusinessConstants
.
DAY_FIRST_TIME
;
String
firstDay
=
Tools
.
firstDayOfMonth
(
Tools
.
getCurrentMonth
())
+
BusinessConstants
.
DAY_FIRST_TIME
;
BigDecimal
todayBuy
=
depotHeadService
.
getBuyAndSaleStatistics
(
"入库"
,
"采购"
,
1
,
today
,
getNow3
());
//今日采购入库
BigDecimal
todayBuyBack
=
depotHeadService
.
getBuyAndSaleStatistics
(
"出库"
,
"采购退货"
,
1
,
today
,
getNow3
());
//今日采购退货
BigDecimal
todaySale
=
depotHeadService
.
getBuyAndSaleStatistics
(
"出库"
,
"销售"
,
1
,
today
,
getNow3
());
//今日销售出库
BigDecimal
todaySaleBack
=
depotHeadService
.
getBuyAndSaleStatistics
(
"入库"
,
"销售退货"
,
1
,
today
,
getNow3
());
//今日销售退货
BigDecimal
todayRetailSale
=
depotHeadService
.
getBuyAndSaleRetailStatistics
(
"出库"
,
"零售"
,
0
,
today
,
getNow3
());
//今日零售出库
BigDecimal
todayBuy
=
depotHeadService
.
getBuyAndSaleStatistics
(
"入库"
,
"采购"
,
1
,
today
,
getNow3
());
//今日采购入库
today
,
getNow3
());
//今日零售出库
BigDecimal
todayRetailSaleBack
=
depotHeadService
.
getBuyAndSaleRetailStatistics
(
"入库"
,
"零售退货"
,
today
,
getNow3
());
//今日零售退货
BigDecimal
monthBuy
=
depotHeadService
.
getBuyAndSaleStatistics
(
"入库"
,
"采购"
,
1
,
firstDay
,
getNow3
());
//本月采购入库
BigDecimal
monthBuyBack
=
depotHeadService
.
getBuyAndSaleStatistics
(
"出库"
,
"采购退货"
,
1
,
firstDay
,
getNow3
());
//本月采购退货
BigDecimal
monthSale
=
depotHeadService
.
getBuyAndSaleStatistics
(
"出库"
,
"销售"
,
1
,
firstDay
,
getNow3
());
//本月销售出库
BigDecimal
monthSaleBack
=
depotHeadService
.
getBuyAndSaleStatistics
(
"入库"
,
"销售退货"
,
1
,
firstDay
,
getNow3
());
//本月销售退货
BigDecimal
monthRetailSale
=
depotHeadService
.
getBuyAndSaleRetailStatistics
(
"出库"
,
"零售"
,
0
,
firstDay
,
getNow3
());
//本月零售出库
BigDecimal
monthBuy
=
depotHeadService
.
getBuyAndSaleStatistics
(
"入库"
,
"采购"
,
1
,
firstDay
,
getNow3
());
//本月采购入库
map
.
put
(
"todaySale"
,
todaySale
.
add
(
todayRetailSale
));
map
.
put
(
"todayBuy"
,
todayBuy
);
map
.
put
(
"thisMonthSale"
,
monthSale
.
add
(
monthRetailSale
));
map
.
put
(
"thisMonthBuy"
,
monthBuy
);
firstDay
,
getNow3
());
//本月零售出库
BigDecimal
monthRetailSaleBack
=
depotHeadService
.
getBuyAndSaleRetailStatistics
(
"入库"
,
"零售退货"
,
firstDay
,
getNow3
());
//本月零售退货
map
.
put
(
"todayBuy"
,
todayBuy
.
subtract
(
todayBuyBack
));
map
.
put
(
"todaySale"
,
todaySale
.
subtract
(
todaySaleBack
));
map
.
put
(
"todayRetailSale"
,
todayRetailSale
.
subtract
(
todayRetailSaleBack
));
map
.
put
(
"monthBuy"
,
monthBuy
.
subtract
(
monthBuyBack
));
map
.
put
(
"monthSale"
,
monthSale
.
subtract
(
monthSaleBack
));
map
.
put
(
"monthRetailSale"
,
monthRetailSale
.
subtract
(
monthRetailSaleBack
));
res
.
code
=
200
;
res
.
data
=
map
;
}
catch
(
Exception
e
){
...
...
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
3ad93e20
...
...
@@ -597,14 +597,14 @@ public class DepotItemController {
}
/**
* 统计采购
或销
售的总金额
* 统计采购
、销售、零
售的总金额
* @param request
* @param response
* @return
* @throws Exception
*/
@GetMapping
(
value
=
"/buyOrSalePrice"
)
@ApiOperation
(
value
=
"统计采购
或销
售的总金额"
)
@ApiOperation
(
value
=
"统计采购
、销售、零
售的总金额"
)
public
BaseResponseInfo
buyOrSalePrice
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -631,6 +631,16 @@ public class DepotItemController {
salePriceList
.
add
(
obj
);
}
map
.
put
(
"salePriceList"
,
salePriceList
);
JSONArray
retailPriceList
=
new
JSONArray
();
for
(
String
month:
list
)
{
JSONObject
obj
=
new
JSONObject
();
BigDecimal
outPrice
=
depotItemService
.
inOrOutRetailPrice
(
"出库"
,
"零售"
,
month
);
BigDecimal
inPrice
=
depotItemService
.
inOrOutRetailPrice
(
"入库"
,
"零售退货"
,
month
);
obj
.
put
(
"x"
,
month
);
obj
.
put
(
"y"
,
outPrice
.
subtract
(
inPrice
));
retailPriceList
.
add
(
obj
);
}
map
.
put
(
"retailPriceList"
,
retailPriceList
);
res
.
code
=
200
;
res
.
data
=
map
;
}
catch
(
Exception
e
)
{
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
View file @
3ad93e20
...
...
@@ -155,7 +155,6 @@ public interface DepotHeadMapperEx {
BigDecimal
getBuyAndSaleRetailStatistics
(
@Param
(
"type"
)
String
type
,
@Param
(
"subType"
)
String
subType
,
@Param
(
"hasSupplier"
)
Integer
hasSupplier
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
);
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java
View file @
3ad93e20
...
...
@@ -72,6 +72,12 @@ public interface DepotItemMapperEx {
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
);
BigDecimal
inOrOutRetailPrice
(
@Param
(
"type"
)
String
type
,
@Param
(
"subType"
)
String
subType
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
);
BigDecimal
getStockCheckSum
(
@Param
(
"depotId"
)
Long
depotId
,
@Param
(
"mId"
)
Long
mId
,
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
3ad93e20
...
...
@@ -796,8 +796,8 @@ public class DepotHeadService {
return
depotHeadMapperEx
.
getBuyAndSaleStatistics
(
type
,
subType
,
hasSupplier
,
beginTime
,
endTime
);
}
public
BigDecimal
getBuyAndSaleRetailStatistics
(
String
type
,
String
subType
,
Integer
hasSupplier
,
String
beginTime
,
String
endTime
)
{
return
depotHeadMapperEx
.
getBuyAndSaleRetailStatistics
(
type
,
subType
,
hasSupplier
,
beginTime
,
endTime
);
public
BigDecimal
getBuyAndSaleRetailStatistics
(
String
type
,
String
subType
,
String
beginTime
,
String
endTime
)
{
return
depotHeadMapperEx
.
getBuyAndSaleRetailStatistics
(
type
,
subType
,
beginTime
,
endTime
)
.
abs
()
;
}
public
DepotHead
getDepotHead
(
String
number
)
throws
Exception
{
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
3ad93e20
...
...
@@ -298,6 +298,27 @@ public class DepotItemService {
return
result
;
}
/**
* 统计零售的总金额
* @param type
* @param subType
* @param month
* @return
* @throws Exception
*/
public
BigDecimal
inOrOutRetailPrice
(
String
type
,
String
subType
,
String
month
)
throws
Exception
{
BigDecimal
result
=
BigDecimal
.
ZERO
;
try
{
String
beginTime
=
Tools
.
firstDayOfMonth
(
month
)
+
BusinessConstants
.
DAY_FIRST_TIME
;
String
endTime
=
Tools
.
lastDayOfMonth
(
month
)
+
BusinessConstants
.
DAY_LAST_TIME
;
result
=
depotItemMapperEx
.
inOrOutRetailPrice
(
type
,
subType
,
beginTime
,
endTime
);
result
=
result
.
abs
();
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
saveDetials
(
String
rows
,
Long
headerId
,
HttpServletRequest
request
)
throws
Exception
{
//查询单据主表信息
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapperEx.xml
View file @
3ad93e20
...
...
@@ -518,12 +518,6 @@
<if
test=
"subType != null"
>
and sub_type=#{subType}
</if>
<if
test=
"hasSupplier == 1"
>
and organ_id is not null
</if>
<if
test=
"hasSupplier == 0"
>
and organ_id is null
</if>
<if
test=
"beginTime != null"
>
and oper_time >= #{beginTime}
</if>
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
3ad93e20
...
...
@@ -269,6 +269,15 @@
and ifnull(dh.delete_flag,'0') !='1'
</select>
<select
id=
"inOrOutRetailPrice"
resultType=
"java.math.BigDecimal"
>
select ifnull(sum(total_price),0) as allMoney from jsh_depot_head dh
where 1=1
and dh.type=#{type} and dh.sub_type=#{subType}
and dh.oper_time
>
= #{beginTime}
and dh.oper_time
<
= #{endTime}
and ifnull(dh.delete_flag,'0') !='1'
</select>
<select
id=
"getStockCheckSum"
resultType=
"java.math.BigDecimal"
>
select ifnull(sum(di.basic_number),0) stockCheckSum from jsh_depot_head dh
left JOIN jsh_depot_item di on dh.id=di.header_id
...
...
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