|
1 | 1 | package com.changyu.foryou.controller; |
2 | 2 |
|
3 | 3 | import java.text.DecimalFormat; |
| 4 | +import java.text.ParseException; |
| 5 | +import java.text.SimpleDateFormat; |
4 | 6 | import java.util.ArrayList; |
5 | 7 | import java.util.Calendar; |
6 | 8 | import java.util.Date; |
@@ -186,10 +188,11 @@ public void setOrderService(OrderService orderService) { |
186 | 188 | paramMap.put("limit", limit); |
187 | 189 | paramMap.put("offset", (page - 1) * limit); |
188 | 190 | } |
| 191 | + paramMap.put("status", status); |
189 | 192 | List<String> togetherIds = orderService.getTogetherId(paramMap); |
190 | 193 |
|
191 | | - System.out.println(JSON.toJSONString(togetherIds)); |
192 | | - |
| 194 | + //System.out.println(JSON.toJSONString(togetherIds)); |
| 195 | + |
193 | 196 | if (togetherIds.size() != 0) { |
194 | 197 |
|
195 | 198 | for (String togetherId : togetherIds) { |
@@ -1510,16 +1513,35 @@ public String getIpAddr(HttpServletRequest request){ |
1510 | 1513 | */ |
1511 | 1514 | @RequestMapping("getSalesInfoByCampusId") |
1512 | 1515 | @ResponseBody |
1513 | | - public JSONArray getSalesByDate(Integer campusId){ |
| 1516 | + public JSONArray getSalesByDate(@RequestParam Integer campusId, String month){ |
1514 | 1517 | Map<String,Object> paramMap=new HashMap<String,Object>(); |
1515 | 1518 |
|
1516 | 1519 | Date dateStart; |
1517 | 1520 | Date dateEnd; |
1518 | 1521 | List<TradeInfo> tradeList = new ArrayList<TradeInfo>(); |
1519 | 1522 |
|
1520 | 1523 | paramMap.put("campusId", campusId); |
| 1524 | + //System.out.println("month="+month); |
| 1525 | + //如果month不为空,说明切换了月份;但是注意month为本月的时候,此时是下面的情况 |
| 1526 | + if(month!=null&&!month.equals(null)&&!month.equals("")&&!CalendarTool.checkIsThisMonth(month)){ |
| 1527 | + Map<String,Date> dateMap = CalendarTool.getFirstAndLastDayOfMonth(month); |
| 1528 | + dateStart = dateMap.get("monthStart"); |
| 1529 | + dateEnd = dateMap.get("monthEnd"); |
| 1530 | + paramMap.put("dateStart", dateStart); |
| 1531 | + paramMap.put("dateEnd", dateEnd); |
| 1532 | + TradeInfo monthInfo = new TradeInfo(); |
| 1533 | + monthInfo.setInfoDateType("当月"); |
| 1534 | + monthInfo.setOrderCount(orderService.getSalesInfoByCampusId(paramMap));//获取指定时间段和指定校区的订单总数 |
| 1535 | + monthInfo.setTradeVolume(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段和指定校区的订单交易额 |
| 1536 | + paramMap.put("payWay", 1); //payWay:0,没有; 1,支付宝; 2,微信 |
| 1537 | + monthInfo.setTradeVolumeAliPay(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段、指定校区和指定支付方式的订单交易额 |
| 1538 | + paramMap.put("payWay", 2); |
| 1539 | + monthInfo.setTradeVolumeWeChatPay(orderService.getTradeVolumeByCampusId(paramMap));//获取指定时间段、指定校区、指定支付方式的订单交易额 |
| 1540 | + tradeList.add(monthInfo); |
| 1541 | + return (JSONArray)JSON.toJSON(tradeList); |
| 1542 | + } |
1521 | 1543 |
|
1522 | | - //当天订单数、销售额 |
| 1544 | + //当天订单数、销售额- |
1523 | 1545 | dateStart = CalendarTool.getTodayStart(); |
1524 | 1546 | dateEnd = CalendarTool.getTodayEnd(); |
1525 | 1547 | paramMap.put("dateStart", dateStart); |
|
0 commit comments