|
27 | 27 | import com.changyu.foryou.model.CartGood; |
28 | 28 | import com.changyu.foryou.model.DeliverChildOrder; |
29 | 29 | import com.changyu.foryou.model.DeliverOrder; |
30 | | -import com.changyu.foryou.model.MiniOrder; |
31 | 30 | import com.changyu.foryou.model.Order; |
32 | 31 | import com.changyu.foryou.model.PCOrder; |
33 | 32 | import com.changyu.foryou.model.Preferential; |
34 | 33 | import com.changyu.foryou.model.Receiver; |
35 | 34 | import com.changyu.foryou.model.SmallOrder; |
36 | 35 | import com.changyu.foryou.model.SuperAdminOrder; |
37 | 36 | import com.changyu.foryou.model.TogetherOrder; |
| 37 | +import com.changyu.foryou.model.TradeInfo; |
38 | 38 | import com.changyu.foryou.payment.ChargeInterface; |
39 | 39 | import com.changyu.foryou.service.CampusService; |
40 | 40 | import com.changyu.foryou.service.FoodService; |
|
43 | 43 | import com.changyu.foryou.service.PushService; |
44 | 44 | import com.changyu.foryou.service.ReceiverService; |
45 | 45 | import com.changyu.foryou.service.UserService; |
| 46 | +import com.changyu.foryou.tools.CalendarTool; |
46 | 47 | import com.changyu.foryou.tools.Constants; |
47 | 48 | import com.pingplusplus.model.Charge; |
48 | 49 | import com.pingplusplus.model.Refund; |
@@ -206,17 +207,41 @@ public void setOrderService(OrderService orderService) { |
206 | 207 | togetherOrdersList.add(togetherOrder); |
207 | 208 | } |
208 | 209 |
|
209 | | - List<MiniOrder> statusList = new ArrayList<MiniOrder>(); |
210 | | - |
211 | 210 | //根据phoneId获取各个状态订单数量 |
212 | 211 | for (int i = 1; i <= 5; i++) { |
213 | | - MiniOrder order = new MiniOrder(); |
214 | | - order.setStatus(Short.parseShort(i+"")); |
215 | | - paramMap.put("status", i); |
216 | | - order.setOrderCount(orderService.getMiniOrderByPhone(paramMap)); |
217 | | - statusList.add(order); |
| 212 | + int count = 0; |
| 213 | + if(i!=5&&i!=4){ |
| 214 | + paramMap.put("status", i); |
| 215 | + count = orderService.getMiniOrderByPhone(paramMap); |
| 216 | + } |
| 217 | + switch (i) { |
| 218 | + case 1: |
| 219 | + //代付款 |
| 220 | + map.put("waitPayOrder", count); |
| 221 | + break; |
| 222 | + case 2: |
| 223 | + //待确认 |
| 224 | + map.put("waitMakeSureOrder", count); |
| 225 | + break; |
| 226 | + case 3: |
| 227 | + //配送中 |
| 228 | + map.put("distribution", count); |
| 229 | + break; |
| 230 | + case 4: |
| 231 | + //待评价 |
| 232 | + paramMap.put("status", 4); |
| 233 | + paramMap.put("isRemarked", 0); |
| 234 | + map.put("waitCommmentOrder", count); |
| 235 | + break; |
| 236 | + case 5: |
| 237 | + //已完成 |
| 238 | + paramMap.put("status", 4); |
| 239 | + paramMap.put("isRemarked", 1); |
| 240 | + map.put("doneOrder", orderService.getMiniOrderByPhone(paramMap)); |
| 241 | + break; |
| 242 | + } |
218 | 243 | } |
219 | | - map.put("statusList", statusList); |
| 244 | + |
220 | 245 | map.put(Constants.STATUS, Constants.SUCCESS); |
221 | 246 | map.put(Constants.MESSAGE, "获取订单成功"); |
222 | 247 | map.put("orderList", JSON.parse(JSON |
@@ -1478,4 +1503,70 @@ public String getIpAddr(HttpServletRequest request){ |
1478 | 1503 | return resultMap; |
1479 | 1504 | } |
1480 | 1505 |
|
| 1506 | + /** |
| 1507 | + * 获取销量和销售额 |
| 1508 | + * @param campusId |
| 1509 | + * @return |
| 1510 | + */ |
| 1511 | + @RequestMapping("getSalesInfoByCampusId") |
| 1512 | + @ResponseBody |
| 1513 | + public JSONArray getSalesByDate(Integer campusId){ |
| 1514 | + Map<String,Object> paramMap=new HashMap<String,Object>(); |
| 1515 | + |
| 1516 | + Date dateStart; |
| 1517 | + Date dateEnd; |
| 1518 | + List<TradeInfo> tradeList = new ArrayList<TradeInfo>(); |
| 1519 | + |
| 1520 | + paramMap.put("campusId", campusId); |
| 1521 | + |
| 1522 | + //当天订单数、销售额 |
| 1523 | + dateStart = CalendarTool.getTodayStart(); |
| 1524 | + dateEnd = CalendarTool.getTodayEnd(); |
| 1525 | + paramMap.put("dateStart", dateStart); |
| 1526 | + paramMap.put("dateEnd", dateEnd); |
| 1527 | + TradeInfo todayInfo = new TradeInfo(); |
| 1528 | + todayInfo.setInfoDateType("当天"); |
| 1529 | + todayInfo.setOrderCount(orderService.getSalesInfoByCampusId(paramMap)); //获取指定时间段和指定校区的订单总数 |
| 1530 | + todayInfo.setTradeVolume(orderService.getTradeVolumeByCampusId(paramMap)); //获取指定时间段和指定校区的订单交易额 |
| 1531 | + paramMap.put("payWay", 1); //payWay:0,没有; 1,支付宝; 2,微信 |
| 1532 | + todayInfo.setTradeVolumeAliPay(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段、指定校区、指定支付方式的订单交易额 |
| 1533 | + paramMap.put("payWay", 2); |
| 1534 | + todayInfo.setTradeVolumeWeChatPay(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段、指定校区、指定支付方式的订单交易额 |
| 1535 | + tradeList.add(todayInfo); |
| 1536 | + paramMap.remove("payWay"); |
| 1537 | + |
| 1538 | + //本周订单数、销售额 |
| 1539 | + dateStart = CalendarTool.getMondayOfThisWeek(); |
| 1540 | + dateEnd = CalendarTool.getSundayOfThisWeek(); |
| 1541 | + paramMap.put("dateStart", dateStart); |
| 1542 | + paramMap.put("dateEnd", dateEnd); |
| 1543 | + TradeInfo weekInfo = new TradeInfo(); |
| 1544 | + weekInfo.setInfoDateType("当周"); |
| 1545 | + weekInfo.setOrderCount(orderService.getSalesInfoByCampusId(paramMap));//获取指定时间段和指定校区的订单总数 |
| 1546 | + weekInfo.setTradeVolume(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段和指定校区的订单交易额 |
| 1547 | + paramMap.put("payWay", 1); //payWay:0,没有; 1,支付宝; 2,微信 |
| 1548 | + weekInfo.setTradeVolumeAliPay(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段、指定校区和指定支付方式的订单交易额 |
| 1549 | + paramMap.put("payWay", 2); |
| 1550 | + weekInfo.setTradeVolumeWeChatPay(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段、指定校区、指定支付方式的订单交易额 |
| 1551 | + tradeList.add(weekInfo); |
| 1552 | + paramMap.remove("payWay"); |
| 1553 | + |
| 1554 | + //本月订单数、销售额 |
| 1555 | + dateStart = CalendarTool.getFirstDayOfThisMonth(); |
| 1556 | + dateEnd = CalendarTool.getLastDayOfThisMonth(); |
| 1557 | + paramMap.put("dateStart", dateStart); |
| 1558 | + paramMap.put("dateEnd", dateEnd); |
| 1559 | + TradeInfo monthInfo = new TradeInfo(); |
| 1560 | + monthInfo.setInfoDateType("当月"); |
| 1561 | + monthInfo.setOrderCount(orderService.getSalesInfoByCampusId(paramMap));//获取指定时间段和指定校区的订单总数 |
| 1562 | + monthInfo.setTradeVolume(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段和指定校区的订单交易额 |
| 1563 | + paramMap.put("payWay", 1); //payWay:0,没有; 1,支付宝; 2,微信 |
| 1564 | + monthInfo.setTradeVolumeAliPay(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段、指定校区和指定支付方式的订单交易额 |
| 1565 | + paramMap.put("payWay", 2); |
| 1566 | + monthInfo.setTradeVolumeWeChatPay(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段、指定校区、指定支付方式的订单交易额 |
| 1567 | + tradeList.add(monthInfo); |
| 1568 | + |
| 1569 | + return (JSONArray)JSON.toJSON(tradeList); |
| 1570 | + } |
| 1571 | + |
1481 | 1572 | } |
0 commit comments