|
|
|
@ -7,6 +7,7 @@ import cn.chjyj.szwh.service.IndexService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Date; |
|
|
|
@ -23,7 +24,7 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
private OrderGoodsDetailMapper orderGoodsDetailMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> getCountSys() { |
|
|
|
public Map<String, Object> getCountSys(String dateFlag) { |
|
|
|
// 拼装查询结果
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
@ -31,8 +32,8 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
// 统计商品数量
|
|
|
|
gmap.put("is_deleted",0); |
|
|
|
int goodsCount= goodsMapper.goodsCount(gmap); |
|
|
|
gmap.clear(); |
|
|
|
result.put("goods_count",goodsCount); |
|
|
|
|
|
|
|
// 待付款数量
|
|
|
|
Integer awaitpayCount=orderMapper.countOrderByStatus(1); |
|
|
|
result.put("awaitpay_count",awaitpayCount); |
|
|
|
@ -56,20 +57,70 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
String yesterday=sdf.format(calendar.getTime()); |
|
|
|
String yesterday_start = yesterday+"00:00:00"; |
|
|
|
String yesterday_end = yesterday+"23:59:59"; |
|
|
|
// 现在时刻
|
|
|
|
String nowtime=sdf.format(System.currentTimeMillis()); |
|
|
|
|
|
|
|
//交易数量
|
|
|
|
Integer dealGoodsCount=orderGoodsDetailMapper.countOrderGoodsDetailByTimeSection(yesterday_start,yesterday_end); |
|
|
|
result.put("deal_goods_count",dealGoodsCount); |
|
|
|
|
|
|
|
//交易总额
|
|
|
|
result.put("deal_money",goodsCount); |
|
|
|
String swhere ="(paymenttime between "+yesterday_start+" and "+yesterday_end+") " + |
|
|
|
"and pay_status=2"; |
|
|
|
Map xmap =new HashMap(); |
|
|
|
xmap.put("field","total_money"); |
|
|
|
xmap.put("wherestr",swhere); |
|
|
|
BigDecimal dealMoney = orderMapper.sumOrderByMap(xmap); |
|
|
|
result.put("deal_money",dealMoney==null?"0.00":dealMoney); |
|
|
|
|
|
|
|
//订单总额
|
|
|
|
result.put("order_money",goodsCount); |
|
|
|
Map xomap = new HashMap(); |
|
|
|
xomap.put("field","total_service_charge"); |
|
|
|
xomap.put("wherestr",swhere); |
|
|
|
BigDecimal orderMoney = orderMapper.sumOrderByMap(xomap); |
|
|
|
result.put("order_money",orderMoney==null?"0.00":orderMoney); |
|
|
|
|
|
|
|
result.put("shelf_count",goodsCount); |
|
|
|
//上架数量
|
|
|
|
Map xgmap = new HashMap(); |
|
|
|
xgmap.put("goods_status","1"); |
|
|
|
xgmap.put("createtime","between "+yesterday_start+" and "+yesterday_end); |
|
|
|
Integer shelfCount=goodsMapper.goodsCount(xgmap); |
|
|
|
result.put("shelf_count",shelfCount); |
|
|
|
|
|
|
|
//下架数量
|
|
|
|
Map ogmap = new HashMap(); |
|
|
|
ogmap.put("goods_status","2"); |
|
|
|
ogmap.put("canceltime","between "+yesterday_start+" and "+yesterday_end); |
|
|
|
Integer outCount= goodsMapper.goodsCount(ogmap); |
|
|
|
result.put("out_count",goodsCount); |
|
|
|
result.put("yester_order_count",goodsCount); |
|
|
|
result.put("yester_complete_count",goodsCount); |
|
|
|
|
|
|
|
//新增订单
|
|
|
|
Integer yesterOrderCount = orderMapper.countOrderTimeSection("createtime",yesterday_start,yesterday_end); |
|
|
|
result.put("yester_order_count",yesterOrderCount); |
|
|
|
|
|
|
|
//完成订单
|
|
|
|
Integer yesterCompleteCount=orderMapper.countOrderTimeSection("completetime",yesterday_start,yesterday_end); |
|
|
|
result.put("yester_complete_count",yesterCompleteCount); |
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH,-1); |
|
|
|
// 上个月
|
|
|
|
String lastMonth=sdf.format(calendar.getTime()); |
|
|
|
// 过去5年
|
|
|
|
calendar.add(Calendar.YEAR,-5); |
|
|
|
String last5years=sdf.format(calendar.getTime()); |
|
|
|
// 过去一年
|
|
|
|
calendar.add(Calendar.YEAR,-1); |
|
|
|
String lastyear = sdf.format(calendar.getTime()); |
|
|
|
// 时刻跨度
|
|
|
|
String dtzone = ""; |
|
|
|
switch (dateFlag){ |
|
|
|
case "year":dtzone=last5years+" and "+nowtime;break; |
|
|
|
case "month":dtzone=lastyear+" and "+nowtime;break; |
|
|
|
default:dtzone=lastMonth+ " and "+nowtime;break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//委托方排名
|
|
|
|
result.put("entrust_ranking",goodsCount); |
|
|
|
result.put("entrust_sale_ranking",goodsCount); |
|
|
|
result.put("treeMap",goodsCount); |
|
|
|
|