| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | | import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/order")
|
| | |
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderService taoBaoOrderService;
|
| | |
|
| | | |
| | |
|
| | | @RequestMapping(value = "getOrderList", method = RequestMethod.POST)
|
| | | public void getOrderList(int pageIndex, String key, PrintWriter out) {
|
| | |
| | | data.put("pe", pe);
|
| | | data.put("orderList", JsonUtil.getSimpleGsonWithDateAndSerialization().toJson(orderAdminList));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 淘宝订单
|
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param uid
|
| | | * @param state
|
| | | * @param type
|
| | | * @param orderState
|
| | | * @param orderNo
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTBOrder")
|
| | | public void getTBOrder(String callback, Integer pageIndex, Integer keyType,
|
| | | String key, Integer state, String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | | |
| | | if (state != null && state == 0) {
|
| | | state = null;// 所有状态
|
| | | }
|
| | | |
| | | if (endTime != null && endTime.trim().length() > 0) {
|
| | | endTime += " 23:59:59";
|
| | | }
|
| | |
|
| | | try {
|
| | | |
| | | long count = 0;
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | List<TaoBaoOrderVO> listVO = null;
|
| | | |
| | | if (key != null && key.trim().length() > 0 && keyType == 2) {
|
| | | |
| | | // 查询列表
|
| | | List<CommonOrderVO> list = commonOrderService.listQueryByUid((pageIndex - 1) * pageSize, pageSize , |
| | | Long.parseLong(key), state, null, null, null, startTime, endTime, null);
|
| | | |
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | // 统计总数
|
| | | count = commonOrderService.countQueryByUid(Long.parseLong(key), state, null, null, null, startTime, endTime, null);
|
| | | |
| | | } else {
|
| | | |
| | | List<TaoBaoOrderVO> listQuery = taoBaoOrderService.listQuery((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime, state);
|
| | | |
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | count= taoBaoOrderService.countQuery(key, startTime, endTime, state);
|
| | | |
| | | }
|
| | |
|
| | | |
| | | |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", listVO);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (CommonOrderException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
| | |
|
| | | if (type != null && type == 0) {
|
| | | type = null; // 所有类型订单
|
| | | }
|
| | | |
| | | if (endTime != null && endTime.trim().length() > 0) {
|
| | | endTime += " 23:59:59";
|
| | | }
|
| | |
|
| | | try {
|
| | |
| | | * 2018-12-01
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHistoryOderByChannel")
|
| | | public void getHistoryOderByChannel(String callback, String channelArray, Integer dateType, Integer type,
|
| | | @RequestMapping(value = "getOderChannelCharts")
|
| | | public void getOderChannelCharts(String callback, String channelArray, Integer dateType, Integer type,
|
| | | String year, String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(channelArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择统计对应名称"));
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (dateType == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择排列方式"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (dateType == 1 && (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime))) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择时间区间"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选结束日期"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(startTime) && !StringUtil.isNullOrEmpty(endTime)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选起始日期"));
|
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | |
| | | List<String> channelList = null;
|
| | | if (channelArray != null && channelArray.trim().length() > 0) {
|
| | | Gson gson = new Gson();
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | }
|
| | |
|
| | | if (channelList == null || channelList.size() == 0) {
|
| | | channelList = new ArrayList<String>();
|
| | | channelList.add("all");
|
| | | }
|
| | |
|
| | | |
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | }
|
| | | |
| | | try {
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<String> list = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数格式不正确"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | |
|
| | | for (String channel : list) {
|
| | | JSONObject channelData = new JSONObject();
|
| | | List<Object> resultList = null;
|
| | | JSONArray line_list = new JSONArray();
|
| | | for (String channel : channelList) {
|
| | | List<Map<String, Object>> list = null;
|
| | | if (type == 1) {
|
| | | resultList = hongBaoService.count24HOderByChannel(channel, dateType, year, startTime, endTime);
|
| | | list = hongBaoService.count24HOderByChannel(channel, dateType, year, startTime, endTime);
|
| | |
|
| | | } else if (type == 2) {
|
| | | resultList = hongBaoService.countHistoryOderByChannel(channel, dateType, year, startTime, endTime);
|
| | | list = hongBaoService.countHistoryOderByChannel(channel, dateType, year, startTime, endTime);
|
| | | }
|
| | | |
| | | if ("all".equalsIgnoreCase(channel)) {
|
| | | channel = "总计";
|
| | | }
|
| | | |
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", channel);
|
| | |
|
| | | if (resultList == null) {
|
| | | resultList = new ArrayList<Object>();
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | channelData.put("name", channel);
|
| | | channelData.put("data_list", resultList);
|
| | | array.add(channelData);
|
| | | |
| | | line_list.add(innerList);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result_list", array);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | | |
| | | data.put("line_list", line_list);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 验证统计信息参数
|
| | | * @param shwoType
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public String validateParams(Integer shwoType, String startTime, String endTime) {
|
| | |
|
| | | if (shwoType == null) {
|
| | | return "请选择视图类型";
|
| | | }
|
| | |
|
| | | if (shwoType == 1 && (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime))) {
|
| | | return "请选择时间区间";
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) {
|
| | | return "请选结束日期";
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(startTime) && !StringUtil.isNullOrEmpty(endTime)) {
|
| | | return "请选起始日期";
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计提现申请总次数
|
| | |
| | | public void getHongBaoNum(String callback,String channelArray, Integer dateType, Integer state,
|
| | | String year, String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = validateParams(dateType, startTime, endTime);
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | |
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, Integer keyType,
|
| | | String key, String startTime, String endTime, Integer state, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | if (pageSize == null || pageSize < 1)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1)
|
| | | pageIndex = 1;
|
| | |
|
| | | List<TaoBaoOrderVO> listQuery = taoBaoOrderService.listQuery((pageIndex - 1) * pageSize, pageSize, keyType, key, startTime, endTime, state);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | long count= taoBaoOrderService.countQuery(keyType, key, startTime, endTime, state);
|
| | | |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); // 重点
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(listQuery));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | @RequestMapping(value = "countByType")
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | // TODO Auto-generated catch block
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils;
|
| | | import com.yeshi.fanli.entity.admin.UserInfoAdmin;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | |
| | | public void getSameDayUserByChannel(String callback, String channelArray, Integer dateType,
|
| | | String year, String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | validateParams(callback, channelArray, dateType,year,startTime,endTime,out);
|
| | | |
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | List<String> channelList = null;
|
| | | if (channelArray != null && channelArray.trim().length() > 0) {
|
| | | Gson gson = new Gson();
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | }
|
| | |
|
| | | if (channelList == null || channelList.size() == 0) {
|
| | | channelList = new ArrayList<String>();
|
| | | channelList.add("all");
|
| | | }
|
| | |
|
| | | |
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | }
|
| | | |
| | | |
| | | try {
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<String> list = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType());
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数格式不正确"));
|
| | | return;
|
| | | }
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | |
|
| | | for (String channel: list) {
|
| | | JSONObject channelData = new JSONObject();
|
| | | List<Object> resultList = userActiveLogService.countSameDayByChannel(channel, dateType, year, startTime, endTime);
|
| | | if (resultList == null) {
|
| | | resultList = new ArrayList<Object>();
|
| | | JSONArray line_list = new JSONArray();
|
| | | for (String channel : channelList) {
|
| | | |
| | | List<Map<String, Object>> list = userActiveLogService.countSameDayByChannel(channel, |
| | | dateType, year, startTime, endTime);
|
| | | |
| | | if ("all".equalsIgnoreCase(channel)) {
|
| | | channel = "总计";
|
| | | }
|
| | | channelData.put("name", channel);
|
| | | channelData.put("data_list", resultList);
|
| | | array.add(channelData);
|
| | | |
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", channel);
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | |
| | | line_list.add(innerList);
|
| | | }
|
| | |
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result_list", array);
|
| | | data.put("line_list", line_list);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | @RequestMapping(value = "getBuyProportion")
|
| | | public void getBuyProportion(String callback, String channelArray, Integer dateType,
|
| | | String year, String startTime, String endTime, Integer orderNum, PrintWriter out) {
|
| | | |
| | | validateParams(callback, channelArray, dateType,year,startTime,endTime,out);
|
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | |
| | | * @param endTime 2018-12-01
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHistoryNewUser")
|
| | | public void getHistoryNewUser(String callback, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | | |
| | | if (dateType == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择显示方式"));
|
| | | @RequestMapping(value = "getNewUserCharts")
|
| | | public void getNewUserCharts(String callback, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | | |
| | | if (dateType == 1 && (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime))) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择时间区间"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选结束日期"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(startTime) && !StringUtil.isNullOrEmpty(endTime)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选起始日期"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | | |
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | List<Object> resultList = userInfoCountService.countNewUserByDate(dateType, year, startTime, endTime);
|
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | if (resultList == null) {
|
| | | resultList = new ArrayList<Object>();
|
| | | }
|
| | | |
| | | JSONArray line_list = new JSONArray();
|
| | |
|
| | | List<Map<String, Object>> list = userInfoCountService
|
| | | .countNewUserByDate(dateType, year, startTime, endTime);
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "数量");
|
| | | innerList.put("data_list", resultList);
|
| | | |
| | | JSONArray outList = new JSONArray();
|
| | | outList.add(innerList);
|
| | | |
| | | innerList.put("name", "总计");
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | |
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result_list", outList);
|
| | | |
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | |
|
| | | data.put("line_list", line_list);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void validateParams(String callback, String channelArray, Integer dateType, |
| | | String year, String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(channelArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择统计对应名称"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (dateType == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择排列方式"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (dateType == 1 && (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime))) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择时间区间"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选结束日期"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(startTime) && !StringUtil.isNullOrEmpty(endTime)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选起始日期"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (endTime != null && endTime.trim().length() > 0) {
|
| | | endTime += " 23:59:59";
|
| | | }
|
| | |
|
| | | try {
|
| | | long count = 0;
|
| | |
| | | int totalInvite = 0;
|
| | | long todayTotal = 0;
|
| | | BigDecimal todayMoney = null;
|
| | | |
| | |
|
| | | // 查询列表
|
| | | List<CommonOrderVO> list = commonOrderService.getOrderByUid(page, uid, state, type, orderState,
|
| | |
| | |
|
| | | switch (slotTime) {
|
| | | case 1: // 最近三天
|
| | | startTime = DateUtil.reduceDay(3, endTime);
|
| | | startTime = DateUtil.reduceDay(2, endTime);
|
| | | break;
|
| | | case 2: // 最近七天
|
| | | startTime = DateUtil.reduceDay(7, endTime);
|
| | | startTime = DateUtil.reduceDay(6, endTime);
|
| | | break;
|
| | | case 3: // 最近15天 (半月)
|
| | | startTime = DateUtil.reduceDay(15, endTime);
|
| | | startTime = DateUtil.reduceDay(14, endTime);
|
| | | break;
|
| | | case 4: // 最近三十天 (本月)
|
| | | startTime = DateUtil.reduceDay(30, endTime);
|
| | | startTime = DateUtil.reduceDay(29, endTime);
|
| | | break;
|
| | | case 5: // 最近九十天(近三月)
|
| | | startTime = DateUtil.reduceDay(3*30, endTime);
|
| | | startTime = DateUtil.reduceDay(3*30-1, endTime);
|
| | | break;
|
| | | case 6: // 最近一百八十天(近半年)
|
| | | startTime = DateUtil.reduceDay(6*30, endTime);
|
| | | startTime = DateUtil.reduceDay(6*30-1, endTime);
|
| | | break;
|
| | | default:
|
| | | break;
|
| | |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | |
| | | List<TaoBaoOrderVO> listQuery(@Param("start")long start, @Param("count") int count, |
| | | @Param("keyType")Integer keyType, @Param("key") String key, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime, |
| | | @Param("state")Integer state); |
| | | List<TaoBaoOrderVO> listQuery(@Param("start")long start, @Param("count") int count, @Param("key") String key, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("state")Integer state); |
| | | |
| | | long countQuery(@Param("keyType")Integer keyType, @Param("key") String key, |
| | | @Param("startTime") String startTime,@Param("endTime") String endTime, |
| | | long countQuery(@Param("key") String key, @Param("startTime") String startTime,@Param("endTime") String endTime, |
| | | @Param("state")Integer state); |
| | | |
| | | } |
| | |
| | | |
| | | <select id="listUserOrder" resultMap="ResultMap"> |
| | | <!-- 查询用户订单 --> |
| | | SELECT COALESCE(SUM(IF(hb.hb_id IS NULL,hbp.`hb_money`,hb.`hb_money`)),0)AS totalMoney, |
| | | IF(hb.hb_id IS NULL,hbp.`hb_state`,hb.hb_state) AS hongBaoState, |
| | | IF(hb.hb_id IS NULL,hbp.`hb_type`,hb.`hb_type`) AS hongBaoType, |
| | | IF(hb.hb_id IS NULL,hbp.`hb_get_time`,hb.`hb_get_time`) AS accountTime, |
| | | IF(hb.hb_id IS NULL,hbp.`hb_pre_get_time`,hb.`hb_pre_get_time`) AS preAccountTime, |
| | | SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, |
| | | hb.hb_state AS hongBaoState, |
| | | hb.`hb_type` AS hongBaoType, |
| | | hb.`hb_get_time` AS accountTime, |
| | | hb.`hb_pre_get_time`AS preAccountTime, |
| | | co.* |
| | | FROM yeshi_ec_hongbao_order ho |
| | | |
| | |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 --> |
| | | )hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 --> |
| | | )hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_STATE"/> <!-- 订单状态 --> |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME"/> <!-- 订单时间 --> |
| | | <if test="orderNo != null and orderNo !='' "> |
| | |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 --> |
| | | )hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 --> |
| | | )hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_STATE"/> <!-- 订单状态 --> |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME"/> <!-- 订单时间 --> |
| | | <if test="orderNo != null and orderNo !='' "> |
| | |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} AND (v2.`hb_type` = 1 OR v2.`hb_type` = 2) |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} AND (v2.`hb_type` = 1 OR v2.`hb_type` = 2) |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` <!-- 自购订单 --> |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} AND v2.`hb_type` = 20 |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} AND v2.`hb_type` = 20 |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` <!-- 分享订单 --> |
| | | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | |
| | | WHERE v2.`hb_uid`= ${uid} |
| | | AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 |
| | | OR v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} |
| | | AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 |
| | | OR v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hbp.hb_id IS NOT NULL |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <![CDATA[AND co.`co_state` <> 3]]> |
| | | AND (co.`co_state_whole_order` =1 OR co.`co_state_whole_order` = 2) |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | AND co.`co_state` = 3 |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)WQ |
| | |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | AND co.`co_state_whole_order` = 3 |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)SX |
| | |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | |
| | | ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` |
| | | )A |
| | |
| | | |
| | | <select id="countBonusOrderMoney" resultType="java.math.BigDecimal"> |
| | | <!-- 奖金统计:订单总返利金额 去掉已失效 --> |
| | | SELECT COALESCE(SUM(IF(hb.hb_id IS NULL,hbp.`hb_money`,hb.`hb_money`)),0)AS totalmoney |
| | | SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalmoney |
| | | FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <if test="day != null and day == 4"> |
| | | AND co.`co_state` = 2 <!-- 上月 :统计已收货 --> |
| | |
| | | </select> |
| | | |
| | | <select id="countBonusOrderMoneyAndNumber" resultType="java.util.HashMap"> |
| | | <!-- 奖金统计有效订单:订单总金额 / 总订单数 --> |
| | | SELECT COUNT(ho.`ho_id`) AS totalNum, |
| | | CAST(SUM(IF(hb.hb_id IS NULL,hbp.`hb_money`,hb.`hb_money`))AS DECIMAL(19,2)) AS totalmoney |
| | | FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <if test="day != null and day == 4"> |
| | | AND co.`co_state` = 2 <!-- 上月 :统计已收货 --> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` |
| | | SELECT COUNT(*) AS totalNum, CAST(SUM(moneys) AS DECIMAL(19,2)) AS totalmoney FROM |
| | | (SELECT CAST(SUM(hb.`hb_money`) AS DECIMAL(19,2))AS moneys |
| | | FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`=${uid} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) |
| | | ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <if test="day == null"> |
| | | AND <![CDATA[co.`co_state` <> 2]]> <!-- 统计有效的 --> |
| | | </if> |
| | | <if test="day != null and day == 4"> |
| | | AND co.`co_state` = 2 <!-- 上月 :统计已收货 --> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` |
| | | )A |
| | | </select> |
| | | |
| | | <select id="listQueryByUid" resultMap="ResultMap"> |
| | | <!-- 查询用户订单 --> |
| | | SELECT IF(hb.hb_id IS NULL,hbp.`hb_money`,hb.`hb_money`) AS totalMoney, |
| | | IF(hb.hb_id IS NULL,hbp.`hb_state`,hb.hb_state) AS hongBaoState, |
| | | IF(hb.hb_id IS NULL,hbp.`hb_type`,hb.`hb_type`) AS hongBaoType, |
| | | IF(hb.hb_id IS NULL,hbp.`hb_get_time`,hb.`hb_get_time`) AS accountTime, |
| | | IF(hb.hb_id IS NULL,hbp.`hb_pre_get_time`,hb.`hb_pre_get_time`) AS preAccountTime, |
| | | SELECT hb.`hb_money` AS totalMoney, |
| | | hb.hb_state AS hongBaoState, |
| | | hb.`hb_type` AS hongBaoType, |
| | | hb.`hb_get_time` AS accountTime, |
| | | hb.`hb_pre_get_time` AS preAccountTime, |
| | | co.*,cog.* |
| | | FROM yeshi_ec_hongbao_order ho |
| | | |
| | |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 --> |
| | | )hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 --> |
| | | )hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | LEFT JOIN yeshi_ec_common_order_goods cog ON cog.`cog_id`= co.`co_order_goods_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_STATE"/> <!-- 订单状态 --> |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME"/> <!-- 订单时间 --> |
| | | <if test="orderNo != null and orderNo !='' "> |
| | |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 --> |
| | | )hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 --> |
| | | )hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_STATE"/> <!-- 订单状态 --> |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME"/> <!-- 订单时间 --> |
| | | <if test="orderNo != null and orderNo !='' "> |
| | |
| | | |
| | | |
| | | <select id="listQuery" resultMap="VoResultMap"> |
| | | SELECT tb.*,cg.`cog_picture` AS picture, |
| | | co.`co_uid` AS userId,u.`nick_name` AS userName,u.`portrait` AS userPortrait, |
| | | v2.`hb_money` AS userMoney,v2.`hb_state` AS userMoneyState,v2.`hb_get_time` AS userMoneyDate, |
| | | V2.hb_type AS userHongBaoType, |
| | | pv2.`hb_uid` AS levelOneId, pv2.`hb_money` AS levelOneMoney, |
| | | ppv2.`hb_uid` AS levelTwoId, ppv2.`hb_money` AS levelTwoMoney |
| | | |
| | | FROM `yeshi_ec_taobao_order` tb |
| | | LEFT JOIN `yeshi_ec_common_order` co ON (tb.`to_order_id` = co.`co_order_no` AND tb.`to_orderby` = co.`co_order_by`) |
| | | LEFT JOIN yeshi_ec_common_order_goods cg ON cg.`cog_id` = co.`co_order_goods_id` |
| | | LEFT JOIN `yeshi_ec_hongbao_order` ho ON ho.`ho_order_id` = co.`co_id` |
| | | LEFT JOIN `yeshi_ec_hongbao_v2` v2 ON v2.`hb_id` = ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 pv2 ON v2.`hb_id` = pv2.`hb_pid` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 ppv2 ON pv2.`hb_id` = ppv2.`hb_pid` |
| | | LEFT JOIN `yeshi_ec_user` u ON u.`id` = co.`co_uid` |
| | | |
| | | SELECT * FROM `yeshi_ec_taobao_order` tb |
| | | WHERE 1=1 |
| | | <!-- 搜索条件 --> |
| | | <if test='key != null and key != ""'> |
| | | <if test='keyType == 1'> |
| | | AND tb.`to_order_id` like '%${key}%' <!-- 订单号 --> |
| | | </if> |
| | | <if test='keyType == 2'> |
| | | AND co.`co_uid` like '%${key}%' <!-- 用户id --> |
| | | </if> |
| | | </if> |
| | | |
| | | <if test='startTime != null and startTime != ""'> |
| | |
| | | <select id="countQuery" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(tb.to_id),0) |
| | | FROM `yeshi_ec_taobao_order` tb |
| | | <if test='key != null and key != ""'> |
| | | <if test='keyType == 2'> |
| | | LEFT JOIN `yeshi_ec_common_order` co |
| | | ON (tb.`to_order_id` = co.`co_order_no` AND tb.`to_orderby` = co.`co_order_by`) |
| | | </if> |
| | | </if> |
| | | WHERE 1=1 |
| | | <!-- 搜索条件 --> |
| | | <if test='key != null and key != ""'> |
| | | <if test='keyType == 1'> |
| | | AND tb.`to_order_id` like '%${key}%' <!-- 订单号 --> |
| | | </if> |
| | | <if test='keyType == 2'> |
| | | AND co.`co_uid` like '%${key}%' <!-- 用户id --> |
| | | </if> |
| | | AND tb.`to_order_id` like '%${key}%' <!-- 订单号 --> |
| | | </if> |
| | | |
| | | <if test='startTime != null and startTime != ""'> |
| | |
| | | return userInfoMapper.countHasOrderUser();
|
| | | }
|
| | |
|
| | | public List<Object> countNewUserByDate(Integer type,String years, String startTime, |
| | | public List<Map<String, Object>> countNewUserByDate(Integer type,String years, String startTime, |
| | | String endTime) throws Exception {
|
| | | List<Map<String, Object>> list = userInfoMapper.countNewUserByDate(type, years, startTime, endTime);
|
| | | return userInfoMapper.countNewUserByDate(type, years, startTime, endTime);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | return null;
|
| | | } |
| | | |
| | | switch (type){
|
| | | case 1: // 按天处理
|
| | | return dayFactory(startTime, endTime, list);
|
| | | case 2: // 按月处理
|
| | | return monthFactory(list);
|
| | | case 3: |
| | | return yearFactory(list);
|
| | | default: |
| | | return null;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public List<Object> count24HOderByChannel(String channel, Integer type, String years,
|
| | | public List<Map<String, Object>> count24HOderByChannel(String channel, Integer type, String years,
|
| | | String startTime, String endTime) throws Exception{
|
| | | List<Map<String, Object>> list = hongBaoMapper.count24HOderByChannel(channel, type, years, |
| | | startTime, endTime);
|
| | | |
| | | if (list == null || list.size() == 0) {
|
| | | return null;
|
| | | } |
| | | |
| | | switch (type){
|
| | | case 1: // 按天处理
|
| | | return dayFactory(startTime, endTime, list);
|
| | | case 2: // 按月处理
|
| | | return monthFactory(list);
|
| | | case 3: |
| | | return yearFactory(list);
|
| | | default: |
| | | return null;
|
| | | }
|
| | | |
| | | return hongBaoMapper.count24HOderByChannel(channel, type, years, startTime, endTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Object> countHistoryOderByChannel(String channel, Integer type, String years,
|
| | | public List<Map<String, Object>> countHistoryOderByChannel(String channel, Integer type, String years,
|
| | | String startTime, String endTime) throws Exception{
|
| | |
|
| | | List<Map<String, Object>> list = hongBaoMapper.countHistoryOderByChannel(channel, type, years, |
| | | return hongBaoMapper.countHistoryOderByChannel(channel, type, years, |
| | | startTime, endTime);
|
| | | |
| | | if (list == null || list.size() == 0) {
|
| | | return null;
|
| | | } |
| | | |
| | | switch (type){
|
| | | case 1: // 按天处理
|
| | | return dayFactory(startTime, endTime, list);
|
| | | case 2: // 按月处理
|
| | | return monthFactory(list);
|
| | | case 3: |
| | | return yearFactory(list);
|
| | | default: |
| | | return null;
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | |
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoOrderVO> listQuery(int start, int count,Integer keyType, String key, |
| | | public List<TaoBaoOrderVO> listQuery(int start, int count, String key, |
| | | String startTime, String endTime, Integer state) throws Exception {
|
| | |
|
| | | List<TaoBaoOrderVO> listData = taoBaoOrderMapper.listQuery(start, count, keyType, key, startTime, endTime, state);
|
| | | List<TaoBaoOrderVO> listData = taoBaoOrderMapper.listQuery(start, count, key, startTime, endTime, state);
|
| | |
|
| | | for (TaoBaoOrderVO taoBaoOrderVO : listData) {
|
| | |
|
| | |
| | | } else if ("订单失效".equals(orderState)) {
|
| | | taoBaoOrderVO.setOrderState("3");
|
| | | }
|
| | | |
| | | /* 到账状态 */
|
| | | String moneyState = taoBaoOrderVO.getUserMoneyState();
|
| | | if ((HongBaoV2.STATE_BUKELINGQU+"").equals(moneyState) |
| | | || (HongBaoV2.STATE_KELINGQU+"").equals(moneyState)) {
|
| | | taoBaoOrderVO.setUserMoneyState("1"); // 未到账
|
| | | } else if ((HongBaoV2.STATE_YILINGQU + "").equals(moneyState)) {
|
| | | taoBaoOrderVO.setUserMoneyState("2"); // 已到账
|
| | | } else {
|
| | | taoBaoOrderVO.setUserMoneyState("3"); // 已失效
|
| | | }
|
| | | |
| | | String userHongBaoType = taoBaoOrderVO.getUserHongBaoType();
|
| | | if ((HongBaoV2.TYPE_ZIGOU+"").equals(userHongBaoType)) {
|
| | | taoBaoOrderVO.setUserHongBaoType("1"); // 自购
|
| | | } else if ((HongBaoV2.TYPE_SHARE_GOODS + "").equals(userHongBaoType)) {
|
| | | taoBaoOrderVO.setUserHongBaoType("2"); // 分享
|
| | | } else {
|
| | | taoBaoOrderVO.setUserHongBaoType("3"); // 邀请
|
| | | }
|
| | | }
|
| | |
|
| | | return listData;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countQuery(Integer keyType, String key, String startTime, String endTime, |
| | | public long countQuery(String key, String startTime, String endTime, |
| | | Integer state) throws Exception {
|
| | | return taoBaoOrderMapper.countQuery(keyType, key, startTime, endTime, state);
|
| | | return taoBaoOrderMapper.countQuery(key, startTime, endTime, state);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.DecimalFormat;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | |
| | |
|
| | | @Override
|
| | | public UserActiveLog getUserLatestActiveInfo(Long uid) {
|
| | |
|
| | | return userActiveLogMapper.selectLatestByUid(uid);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<Object> countSameDayByChannel(String channel, Integer type, String years,
|
| | | public List<Map<String, Object>> countSameDayByChannel(String channel, Integer type, String years,
|
| | | String startTime, String endTime) throws Exception{
|
| | | List<Map<String, Object>> list = userActiveLogMapper.countSameDayByChannel(channel, type, years, |
| | | startTime, endTime);
|
| | | |
| | | if (list == null || list.size() == 0) {
|
| | | return null;
|
| | | } |
| | | |
| | | switch (type){
|
| | | case 1: // 按天处理
|
| | | return dayFactory(startTime, endTime, list);
|
| | | case 2: // 按月处理
|
| | | return monthFactory(list);
|
| | | case 3: |
| | | return yearFactory(list);
|
| | | default: |
| | | return null;
|
| | | }
|
| | | return userActiveLogMapper.countSameDayByChannel(channel, type, years, startTime, endTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | @Override
|
| | | public List<Object> getBuyProportion(String channel, Integer type, String years,
|
| | | String startTime, String endTime, Integer orderNum) throws Exception{
|
| | | |
| | | // 统计渠道当日新增用户
|
| | | List<Object> countList = countSameDayByChannel(channel, type, years, startTime, endTime);
|
| | | |
| | | if (countList == null || countList.size() == 0) {
|
| | | return null;
|
| | | } |
| | | |
| | | // 统计渠道当日新增用户存在下单的用户数量
|
| | | List<Object> countListBuy= null;
|
| | | if (orderNum <= 1){
|
| | | countListBuy = countSameDayAndBuyGoodsByChannel(channel, type, years, startTime, endTime);
|
| | | } |
| | | |
| | | if (countListBuy == null){
|
| | | new ArrayList<Object>();
|
| | | }
|
| | | |
| | | List<Object> listObject = new ArrayList<Object>();
|
| | | |
| | | for (Object object: countList) {
|
| | | |
| | | float rate = 0;
|
| | | |
| | | Map<String, Object> mapObject = new HashMap<String, Object>();
|
| | | |
| | | Map<String, Object> map = (Map<String, Object>) object;
|
| | | Object createDate = map.get("showDate");
|
| | | Object sameDayNum = map.get("showValue");
|
| | | |
| | | long totle = Long.parseLong(sameDayNum.toString());
|
| | | if (totle > 0 && countListBuy != null && countListBuy.size() > 0) {
|
| | | for (int j = 0; j < countListBuy.size(); j++) {
|
| | | Map<String, Object> mapBuy = (Map<String, Object>) countListBuy.get(j);
|
| | | Object createDate2 = mapBuy.get("showDate");
|
| | | if (createDate.toString().equals(createDate2.toString())) {
|
| | | Object buyNum = mapBuy.get("showValue");
|
| | | long totleBuy = Long.parseLong(buyNum.toString());
|
| | | rate = (float)totleBuy/totle;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | DecimalFormat df = new DecimalFormat("0.00");//格式化小数
|
| | | mapObject.put("showValue", df.format(rate*100));
|
| | | mapObject.put("showDate", createDate);
|
| | | listObject.add(mapObject);
|
| | | }
|
| | | |
| | | return listObject;
|
| | | // |
| | | // // 统计渠道当日新增用户
|
| | | // List<Object> countList = countSameDayByChannel(channel, type, years, startTime, endTime);
|
| | | // |
| | | // if (countList == null || countList.size() == 0) {
|
| | | // return null;
|
| | | // } |
| | | // |
| | | // // 统计渠道当日新增用户存在下单的用户数量
|
| | | // List<Object> countListBuy= null;
|
| | | // if (orderNum <= 1){
|
| | | // countListBuy = countSameDayAndBuyGoodsByChannel(channel, type, years, startTime, endTime);
|
| | | // } |
| | | // |
| | | // if (countListBuy == null){
|
| | | // new ArrayList<Object>();
|
| | | // }
|
| | | // |
| | | // List<Object> listObject = new ArrayList<Object>();
|
| | | // |
| | | // for (Object object: countList) {
|
| | | // |
| | | // float rate = 0;
|
| | | // |
| | | // Map<String, Object> mapObject = new HashMap<String, Object>();
|
| | | // |
| | | // Map<String, Object> map = (Map<String, Object>) object;
|
| | | // Object createDate = map.get("showDate");
|
| | | // Object sameDayNum = map.get("showValue");
|
| | | // |
| | | // long totle = Long.parseLong(sameDayNum.toString());
|
| | | // if (totle > 0 && countListBuy != null && countListBuy.size() > 0) {
|
| | | // for (int j = 0; j < countListBuy.size(); j++) {
|
| | | // Map<String, Object> mapBuy = (Map<String, Object>) countListBuy.get(j);
|
| | | // Object createDate2 = mapBuy.get("showDate");
|
| | | // if (createDate.toString().equals(createDate2.toString())) {
|
| | | // Object buyNum = mapBuy.get("showValue");
|
| | | // long totleBuy = Long.parseLong(buyNum.toString());
|
| | | // rate = (float)totleBuy/totle;
|
| | | // break;
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // |
| | | // DecimalFormat df = new DecimalFormat("0.00");//格式化小数
|
| | | // mapObject.put("showValue", df.format(rate*100));
|
| | | // mapObject.put("showDate", createDate);
|
| | | // listObject.add(mapObject);
|
| | | // }
|
| | | // |
| | | // return listObject;
|
| | | return null;
|
| | | }
|
| | |
|
| | |
|
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
|
| | |
|
| | |
| | | * 统计新增用户
|
| | | * @return
|
| | | */
|
| | | public List<Object> countNewUserByDate(Integer type,String years, String startTime, String endTime) throws Exception;
|
| | | public List<Map<String, Object>> countNewUserByDate(Integer type,String years, String startTime, String endTime) throws Exception;
|
| | | }
|
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.OrderAdmin;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | |
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | public List<Object> countHistoryOderByChannel(String channelArray, Integer type, String year,
|
| | | public List<Map<String, Object>> countHistoryOderByChannel(String channelArray, Integer type, String year,
|
| | | String startTime, String endTime) throws Exception;
|
| | |
|
| | | /**
|
| | |
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | public List<Object> count24HOderByChannel(String channel, Integer type, String years,
|
| | | public List<Map<String, Object>> count24HOderByChannel(String channel, Integer type, String years,
|
| | | String startTime, String endTime) throws Exception;
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public List<TaoBaoOrderVO> listQuery(int start, int count, Integer keyType, String key, String startTime, String endTime,
|
| | | public List<TaoBaoOrderVO> listQuery(int start, int count, String key, String startTime, String endTime,
|
| | | Integer state) throws Exception;
|
| | |
|
| | | public long countQuery(Integer keyType, String key, String startTime, String endTime, Integer state) throws Exception;
|
| | | public long countQuery(String key, String startTime, String endTime, Integer state) throws Exception;
|
| | |
|
| | | }
|
| | |
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | public List<Object> countSameDayByChannel(String channel, Integer type, String years, String startTime, String endTime)
|
| | | throws Exception;
|
| | | public List<Map<String, Object>> countSameDayByChannel(String channel, Integer type, String years, |
| | | String startTime, String endTime) throws Exception;
|
| | | /**
|
| | | * 根据渠道 统计当日新增用户有购买行为的数量
|
| | | * @param channel
|