package com.yeshi.fanli.controller.admin;
|
|
import java.io.PrintWriter;
|
import java.util.Map;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
|
import net.sf.json.JSONObject;
|
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.yeshi.utils.JsonUtil;
|
|
import com.yeshi.fanli.service.inter.count.TaoBaoOrderCountService;
|
import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
import com.yeshi.fanli.service.inter.user.UserInfoService;
|
import com.yeshi.fanli.util.RedisManager;
|
|
@Controller
|
@RequestMapping("admin/new/api/v1/taoBaoOrder")
|
public class TaoBaoOrderAdminController {
|
|
@Resource
|
private TaoBaoOrderService taoBaoOrderService;
|
|
@Resource
|
private TaoBaoOrderCountService taoBaoOrderCountService;
|
|
@Resource
|
private HongBaoService hongBaoService;
|
|
@Resource
|
private RedisManager redisManager;
|
@Resource
|
private UserInfoService userInfoService;
|
|
|
|
@RequestMapping(value = "countByType")
|
public void countByType(String callback, HttpServletRequest request, PrintWriter out) {
|
|
try {
|
Map<String, Object> countByOdrerType = taoBaoOrderCountService.countByOdrerType();
|
|
JSONObject data = new JSONObject();
|
data.put("countType", countByOdrerType);
|
|
JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
|
} catch (Exception e) {
|
JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
e.printStackTrace();
|
}
|
}
|
|
@RequestMapping(value = "countByDays")
|
public void countByDays(String callback, HttpServletRequest request, PrintWriter out) {
|
|
try {
|
// 统计今日 未失效订单数量 相同订单号合并为一单
|
int countToday = taoBaoOrderCountService.countToday();
|
// 统计昨日 未失效订单数量 相同订单号合并为一单
|
int countYesterday = taoBaoOrderCountService.countYesterday();
|
|
JSONObject data = new JSONObject();
|
data.put("countToday", countToday);
|
data.put("countYesterday", countYesterday);
|
|
JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
|
} catch (Exception e) {
|
// TODO Auto-generated catch block
|
JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
e.printStackTrace();
|
}
|
}
|
|
|
}
|