admin
2019-01-15 233b0814bbb73b5c791ebe3643f4bd91ba2fa959
Merge remote-tracking branch 'origin/master'
1个文件已删除
28个文件已修改
2350 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/LostOrderAdminController.java 219 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java 202 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoOrderAdminController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java 109 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoOrderMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserActiveLogMapper.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml 199 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserInfoCountServiceImpl.java 120 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/LostOrderServiceImpl.java 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java 282 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/UserInfoCountService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoOrderService.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserActiveLogService.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/order/CommonOrderVO.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/order/TaoBaoOrderVO.java 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -1498,7 +1498,7 @@
                        year, startTime, endTime);
                
                if (dateType != 3) {
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType,dateList, list)));
                } else {
                    // 年视图
                    Map<String, Object> map = AdminUtils.yearsDataFactory(list);
@@ -1585,7 +1585,7 @@
                    year, startTime, endTime);
            
            if (dateType != 3) {
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
            } else {
                // 年视图
                Map<String, Object> map = AdminUtils.yearsDataFactory(list);
@@ -1672,7 +1672,7 @@
                    year, startTime, endTime);
            
            if (dateType != 3) {
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
            } else {
                // 年视图
                Map<String, Object> map = AdminUtils.yearsDataFactory(list);
fanli/src/main/java/com/yeshi/fanli/controller/admin/LostOrderAdminController.java
@@ -16,6 +16,8 @@
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.bus.user.LostOrder;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -219,34 +221,6 @@
    }
    
    
    /**
     * 验证统计信息参数
     * @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;
    }
    /**
     * 统计提现申请总次数
@@ -259,45 +233,107 @@
     * @param out
     */
    @RequestMapping(value = "getLostNum")
    public void getLostNum(String callback, Integer dateType, Integer state, String year, String startTime,
            String endTime, PrintWriter out) {
    public void getLostNum(String callback, Integer dateType, String stateArray, 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;
        }
        if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
            startTime = null;
            endTime = null;
        }
        List<Integer> channelList = null;
        if (stateArray != null && stateArray.trim().length() > 0) {
            Gson gson = new Gson();
            channelList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {}.getType());
        }
        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;
        }
        Gson gson = new Gson();
        Object objectDate = null;
        List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
        try {
            
            if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
                startTime = null;
                endTime = null;
            JSONArray line_list = new JSONArray();
            if (channelList == null || channelList.size() == 0) {
            } else {
                for (Integer state : channelList) {
                    List<Map<String, Object>> list = lostOrderService.countLostNum(dateType, state, year,
                            startTime, endTime);
                    JSONObject innerList = new JSONObject();
                    if (state == 1) {
                        innerList.put("name", "未处理");
                    } else if (state == 2) {
                        innerList.put("name", "成功");
                    } else if (state == 3) {
                        innerList.put("name", "失败");
                    }
                    if (dateType != 3) {
                        innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, 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);
                }
            }
            List<Map<String, Object>> resultList =lostOrderService.countLostNum(dateType, state, year,
                    startTime, endTime);
            if (resultList == null) {
                resultList = new ArrayList<Map<String,Object>>();
            }
            JSONObject innerList = new JSONObject();
            innerList.put("name", "数量");
            innerList.put("data_list", resultList);
            JSONArray outList = new JSONArray();
            outList.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) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    
    /**
@@ -313,38 +349,81 @@
    public void getAppealMoney(String callback, Integer dateType, 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;
        }
        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;
        }
        Gson gson = new Gson();
        Object objectDate = null;
        List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
        try {
            if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
                startTime = null;
                endTime = null;
            }
            List<Map<String, Object>> resultList =lostOrderService.countAppealMoney(dateType, year, startTime, endTime);
            if (resultList == null) {
                resultList = new ArrayList<Map<String,Object>>();
            JSONArray line_list = new JSONArray();
            List<Map<String, Object>> list = lostOrderService.countAppealMoney(dateType, year, startTime, endTime);
            JSONObject innerList = new JSONObject();
                innerList.put("name", "总计");
            if (dateType != 3) {
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, 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")));
            }
            
            JSONObject innerList = new JSONObject();
            innerList.put("name", "金额");
            innerList.put("data_list", resultList);
            JSONArray outList = new JSONArray();
            outList.add(innerList);
            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) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java
@@ -30,7 +30,6 @@
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")
@@ -68,9 +67,8 @@
        out.print(JsonUtil.loadTrueResult(data));
    }
    
    /**
     * 淘宝订单
     * 查询所有用户订单列表
     * @param callback
     * @param pageIndex
     * @param pageSize
@@ -83,16 +81,25 @@
     * @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) {
    @RequestMapping(value = "getUserOrderList")
    public void getUserOrderList(String callback, Integer pageIndex, Integer pageSize, Integer keyType,
            String key, Integer state, Integer type, Integer orderState, String startTime, String endTime,
            PrintWriter out) {
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
        }
        
        if (pageSize == null)
            pageSize = Constant.PAGE_SIZE;
        if (state != null && state == 0) {
            state = null;// 所有状态
        }
        if (type != null && type == 0) {
            type = null; // 所有类型订单
        }
        
        if (endTime != null && endTime.trim().length() > 0) {
@@ -100,46 +107,24 @@
        }
        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);
            }
            // 查询列表
            List<CommonOrderVO> list = commonOrderService.listQuery((pageIndex - 1) * pageSize, pageSize,
                    keyType, key, state, type, orderState, startTime, endTime);
            if (list != null && list.size() > 0) {
                // 统计总数
                count = commonOrderService.countQuery(keyType, key, state, type, orderState, startTime, endTime);
            }
            
            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);
            data.put("result_list", list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
@@ -150,9 +135,23 @@
            e.printStackTrace();
        }
    }
    /**
     * 查询订单列表用户uid
     * @param callback
     * @param pageIndex
     * @param pageSize
     * @param uid
     * @param state
     * @param type
     * @param orderState
     * @param orderNo
     * @param startTime
     * @param endTime
     * @param out
     */
    @RequestMapping(value = "getHistoryOrder")
    public void getHistoryOrder(String callback, Integer pageIndex, Integer pageSize, Long uid, Integer state, Integer type, 
            Integer orderState,    String orderNo, String startTime, String endTime, PrintWriter out) {
@@ -229,8 +228,8 @@
     *            2018-12-01
     * @param out
     */
    @RequestMapping(value = "getOderChannelCharts")
    public void getOderChannelCharts(String callback, String channelArray, Integer dateType, Integer type,
    @RequestMapping(value = "get24HOderChannelCharts")
    public void get24HOderChannelCharts(String callback, String channelArray, Integer dateType,
            String year, String startTime, String endTime, PrintWriter out) {
        String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
@@ -284,14 +283,10 @@
            List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
            JSONArray line_list = new JSONArray();
            for (String channel : channelList) {
                List<Map<String, Object>> list = null;
                if (type == 1) {
                    list = hongBaoService.count24HOderByChannel(channel, dateType, year, startTime, endTime);
                List<Map<String, Object>> list = hongBaoV2CountService.count24HOderByChannel(channel, dateType, year, startTime, endTime);
                } else if (type == 2) {
                    list = hongBaoService.countHistoryOderByChannel(channel, dateType, year, startTime, endTime);
                }
                
                if ("all".equalsIgnoreCase(channel)) {
                    channel = "总计";
@@ -301,7 +296,7 @@
                innerList.put("name", channel);
                if (dateType != 3) {
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
                } else {
                    // 年视图
                    Map<String, Object> map = AdminUtils.yearsDataFactory(list);
@@ -387,7 +382,7 @@
        
        try {
            
            JSONObject data = countHistoryHongBao(channelArray, dateType, state, year, startTime,  endTime, 1);
            JSONObject data = countHistoryHongBao(channelArray, dateType, state, year, startTime,  endTime, 2);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
@@ -477,7 +472,7 @@
            innerList.put("name", channel);
            if (dateType != 3) {
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
            } else {
                // 年视图
                Map<String, Object> map = AdminUtils.yearsDataFactory(list);
@@ -515,44 +510,101 @@
     * @param endTime
     * @param out
     */
    @RequestMapping(value = "getTypeRate")
    public void getTypeRate(String callback, Integer dateType, Integer type, String year,
    @RequestMapping(value = "getTypeNumber")
    public void getTypeNumber(String callback, Integer dateType, String typeArray, String year,
            String startTime, String endTime, PrintWriter out) {
        
        if (StringUtil.isNullOrEmpty(startTime) || StringUtil.isNullOrEmpty(endTime)) {
            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 (type == null || dateType ==null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("视图类型、订单类型不能为空"));
        if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
            startTime = null;
            endTime = null;
        }
        List<Integer> channelList = null;
        if (typeArray != null && typeArray.trim().length() > 0) {
            Gson gson = new Gson();
            channelList = gson.fromJson(typeArray, new TypeToken<ArrayList<Integer>>() {}.getType());
        }
        if (channelList == null || channelList.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("订单类型不能为空"));
            return;
        }
        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;
        }
        Gson gson = new Gson();
        Object objectDate = null;
        List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
        
        try {
            List<Map<String, Object>> resultList = hongBaoV2CountService.getProportionByType(dateType,
                    type, year, startTime, endTime);
            
            if (resultList == null) {
                resultList = new ArrayList<Map<String, Object>>();
            JSONArray line_list = new JSONArray();
            for (Integer type : channelList) {
                List<Map<String, Object>> list = hongBaoV2CountService.countHongBaoType(dateType,
                        type, year, startTime, endTime);
                JSONObject innerList = new JSONObject();
                if (type == 1) {
                    innerList.put("name", "返利订单");
                } else if (type == 2) {
                    innerList.put("name", "分享订单");
                } else if (type == 3) {
                    innerList.put("name", "邀请订单");
                }
                if (dateType != 3) {
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, 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 innerList = new JSONObject();
            if (type == 1) {
                innerList.put("name", "返利订单");
            } else if (type == 2) {
                innerList.put("name", "分享订单");
            } else if (type == 3) {
                innerList.put("name", "邀请订单");
            }
            innerList.put("data_list", resultList);
            JSONArray outList = new JSONArray();
            outList.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));
fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoOrderAdminController.java
@@ -1,14 +1,7 @@
package com.yeshi.fanli.controller.admin;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -16,27 +9,14 @@
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.util.Base64Utils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.entity.admin.ReslutOrder;
import com.yeshi.fanli.entity.bus.user.HongBao;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
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.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
import org.yeshi.utils.JsonUtil;
@Controller
@RequestMapping("admin/new/api/v1/taoBaoOrder")
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -1188,8 +1188,8 @@
     * @param endTime   2018-12-01 
     * @param out
     */
    @RequestMapping(value = "getSameDayUserByChannel")
    public void getSameDayUserByChannel(String callback, String channelArray, Integer dateType,
    @RequestMapping(value = "getNewUserCharts")
    public void getNewUserCharts(String callback, String channelArray, Integer dateType,
         String year, String startTime, String endTime, PrintWriter out) {
        
        
@@ -1246,7 +1246,7 @@
            JSONArray line_list = new JSONArray();
            for (String channel : channelList) {
                
                List<Map<String, Object>> list = userActiveLogService.countSameDayByChannel(channel,
                List<Map<String, Object>> list = userInfoCountService.countNewUserByDate(channel,
                        dateType, year, startTime, endTime);
                
                if ("all".equalsIgnoreCase(channel)) {
@@ -1257,7 +1257,7 @@
                innerList.put("name", channel);
                if (dateType != 3) {
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
                } else {
                    // 年视图
                    Map<String, Object> map = AdminUtils.yearsDataFactory(list);
@@ -1299,8 +1299,8 @@
     * @param endTime   2018-12-01 
     * @param out
     */
    @RequestMapping(value = "getBuyProportion")
    public void getBuyProportion(String callback, String channelArray, Integer dateType,
    @RequestMapping(value = "getTodayBuyRate")
    public void getTodayBuyRate(String callback, String channelArray, Integer dateType,
         String year, String startTime, String endTime, Integer orderNum, PrintWriter out) {
        
        if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
@@ -1322,7 +1322,9 @@
            for (String channel: list) {
                JSONObject channelData = new JSONObject();
                List<Object> resultList = userActiveLogService.getBuyProportion(channel, dateType, year, startTime, endTime, orderNum);
                List<Object> resultList = null;
                        //userActiveLogService.getBuyProportion(channel, dateType, year, startTime, endTime, orderNum);
                if (resultList == null) {
                    resultList = new ArrayList<Object>();
                }
@@ -1383,8 +1385,8 @@
                JSONObject channelData = new JSONObject();
                
                List<Map<String, Object>> resultList = userActiveLogService.countOneWeekUserInfo(channel,
                        startTime, endTime, orderNum);
                List<Map<String, Object>> resultList = null;
                        //userActiveLogService.countOneWeekUserInfo(channel,     startTime, endTime, orderNum);
                if (resultList == null) {
                    resultList = new ArrayList<Map<String, Object>>();
@@ -1434,95 +1436,6 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计异常"));
        }
        
    }
    /**
     * 统计历史新增用户
     * @param callback
     * @param dateType 类型  1日  2月  3年
     * @param year 2018
     * @param startTime 2018-12-01
     * @param endTime   2018-12-01
     * @param out
     */
    @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))) {
            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 {
            Gson gson = new Gson();
            Object objectDate = null;
            List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
            JSONArray line_list = new JSONArray();
            List<Map<String, Object>> list = userInfoCountService
                    .countNewUserByDate(dateType, year, startTime, endTime);
            JSONObject innerList = new JSONObject();
            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();
            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();
        }
    }
    
}
fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java
@@ -94,12 +94,14 @@
    
    
    public static List<Object> dayOrMonthDataFactory(List<String> listDate , List<Map<String, Object>> list) throws Exception {
    public static List<Object> dayOrMonthDataFactory(Integer dateType, List<String> listDate ,
            List<Map<String, Object>> list) throws Exception {
        List<Object> resultList = new ArrayList<Object>();
        
        if (list != null && list.size() > 0) {
            for (int i = 0; i < listDate.size(); i++) {
                Object showValue = null;
                if (list != null && list.size() > 0) {
                    // 日期匹配赋值
@@ -107,15 +109,21 @@
                        Map<String, Object> map = list.get(j);
                        
                        String showDate = listDate.get(i);
                        Object reslutDate = map.get("showDate");
                        String month = reslutDate.toString();
                        if (dateType == 2 && Integer.parseInt(showDate) < 10 ) {
                            showDate = "0" + showDate;
                        }
                        
                        if (showDate.equalsIgnoreCase(month)) {
                        Object reslutDate = map.get("showDate");
                        String reslutTime = reslutDate.toString();
                        if (showDate.equalsIgnoreCase(reslutTime)) {
                            showValue = map.get("showValue");
                            break;
                        }
                    }
                }
                
                if (showValue == null) {
                    showValue = 0;
@@ -150,7 +158,7 @@
        innerList.put("name", "总计");
        if (dateType != 3) {
            innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateList, list)));
            innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
        } else {
            // 年视图
            Map<String, Object> map = yearsDataFactory(list);
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java
@@ -104,4 +104,14 @@
    
    Date getLastHongBaoTime(@Param("uid") Long uid);
    
    /**
     * 根据渠道 统计新增用户24小时内产生的订单数量
     *
     * @param channel
     * @return
     */
    List<Map<String, Object>> count24HOderByChannel(@Param("channel") String channel, @Param("type") Integer type,
            @Param("years") String years, @Param("startTime") String startTime, @Param("endTime") String endTime);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
@@ -139,6 +139,15 @@
     * 统计新增用户
     * @return
     */
    List<Map<String, Object>> countNewUserByDate(@Param("type")Integer type, @Param("years") String years,
    List<Map<String, Object>> countNewUserByDate(@Param("channel")String channel,@Param("type")Integer type, @Param("years") String years,
            @Param("startTime")String startTime, @Param("endTime")String endTime);
    /**
     * 统计新增用户
     * @return
     */
    List<Map<String, Object>> getTodayHasOrder(@Param("channel")String channel,@Param("type")Integer type, @Param("years") String years,
            @Param("startTime")String startTime, @Param("endTime")String endTime);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java
@@ -154,5 +154,30 @@
            @Param("startTime") String startTime, @Param("endTime") String endTime,
            @Param("day") Integer day);
    /**
     * 订单列表查询
     * @param start
     * @param count
     * @param uid
     * @param state
     * @param type
     * @param orderState
     * @param startTime
     * @param endTime
     * @return
     */
    List<CommonOrderVO> listQuery(@Param("start") long start, @Param("count") int count,
            @Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state,
            @Param("type") Integer type, @Param("orderState") Integer orderState,
            @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计
     */
    long countQuery(@Param("keyType") Integer keyType, @Param("key") String key,
            @Param("state") Integer state, @Param("type") Integer type, @Param("orderState")Integer orderState,
            @Param("startTime") String startTime, @Param("endTime") String endTime);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoOrderMapper.java
@@ -5,9 +5,7 @@
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.entity.admin.ReslutOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
public interface TaoBaoOrderMapper {
@@ -29,13 +27,6 @@
    // 根据订单号删除数据
    int deleteByOrderId(String orderId);
    
    List<ReslutOrder> queryJoinHongBao(@Param("start") int start, @Param("count") int count, @Param("key") String key,
            @Param("startTime") String startTime, @Param("endTime") String endTime,
            @Param("type")Integer type,@Param("days") Integer days);
    int countQueryJoinHongBao( @Param("key") String key,@Param("startTime") String startTime,
            @Param("endTime") String endTime, @Param("type")Integer type,@Param("days") Integer days);
    
    /**
     * 统计--订单类型区分
@@ -81,10 +72,4 @@
            @Param("startTime")String startTime, @Param("endTime")String endTime);
    
    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("key") String key, @Param("startTime") String startTime,@Param("endTime") String endTime,
            @Param("state")Integer state);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserActiveLogMapper.java
@@ -1,11 +1,5 @@
package com.yeshi.fanli.dao.mybatis.user;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
public interface UserActiveLogMapper {
@@ -23,31 +17,4 @@
    int updateByPrimaryKeySelective(UserActiveLog record);
    int updateByPrimaryKey(UserActiveLog record);
    /**
     * 根据渠道   统计当日新增用户数量
     * @param channel
     * @return
     */
    List<Map<String, Object>> countSameDayByChannel(@Param("channel")String channel,
            @Param("type")Integer type, @Param("years") String years,
            @Param("startTime")String startTime, @Param("endTime")String endTime);
    /**
     * 根据渠道   统计当日新增用户有购买行为的数量
     * @param channel
     * @return
     */
    List<Map<String, Object>> countSameDayAndBuyGoodsByChannel(@Param("channel")String channel,
            @Param("type")Integer type, @Param("years") String years,
            @Param("startTime")String startTime, @Param("endTime")String endTime);
    /**
     * 统计
     * @param channel
     * @return
     */
    Map<String, BigDecimal> countOneWeekUserInfo(@Param("channel")String channel,
            @Param("startTime")String startTime, @Param("endTime")String endTime,
            @Param("orderNumber")Integer orderNumber);
}
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -376,26 +376,33 @@
    </select>
    
    <select id="countHasOrderUser" resultType="java.lang.Long">
        SELECT COUNT(DISTINCT h.`uid`) FROM yeshi_ec_hongbao_v2 h
        SELECT COUNT(DISTINCT h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h
        WHERE h.`hb_type`=1 or  h.`hb_type`=2
    </select>
    
    
    <select id="countNewUserByDate" resultType="java.util.HashMap">
        SELECT COUNT(h.`id`) AS total,
        SELECT COUNT(h.`id`) AS showValue,
            <if test="type == 1">
                 FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'createDate'
                 FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'createDate'
                 FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'createDate'
                 FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'showDate'
            </if>
        FROM yeshi_ec_user h 
            <if test="channel != null and  channel != 'all' ">
                left join (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
                WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`)a ON h.`id`=a.uid
            </if>
        WHERE 1=1
            <if test="channel != null and  channel != 'all' ">
                AND a.uid is not null
            </if>
            <if test="startTime != null and startTime != '' ">
             AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
                 AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
@@ -414,4 +421,90 @@
        </if>        
        ORDER BY h.`createtime`
    </select>
    <select id="getTodayHasOrder" resultType="java.util.HashMap">
        SELECT COALESCE(COUNT(u.`id`),0) AS 'showValue',
            <if test="type == 1">
                 FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
            </if>
        FROM  yeshi_ec_user u
        <if test="channel != null and channel != 'all' ">
            LEFT JOIN  (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
                WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid
        </if>
        LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id`
        WHERE (h.`hb_type`=1 OR h.`hb_type`=20)
            <if test="channel != null and  channel != 'all' ">
                AND a.uid is not null
            </if>
            <!-- 当日下单 -->
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = FROM_UNIXTIME(h.hb_create_time/1000,'%Y-%m-%d')
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
        </if>
        ORDER BY u.`createtime`
    </select>
    <select id="countWeekUserInfo" resultType="java.util.HashMap">
        SELECT COALESCE(SUM(w.total),0) AS totalUser,COALESCE(SUM(w.orderUser),0)AS orderUser FROM
                (
                    <!-- 统计总当日总数量 -->
                    SELECT COUNT(u.`id`)AS total,0 AS orderUser
                    FROM yeshi_ec_user u
                        <if test="channel != null and channel != 'all' ">
                     LEFT JOIN  (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
                            WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid
                    </if>
                 WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}'
                    <if test="channel != null and  channel != 'all' ">
                        AND a.uid is not null
                    </if>
            UNION
            SELECT 0 AS total, COUNT(u.`id`) AS orderUser
            FROM yeshi_ec_user u
            <if test="channel != null and channel != 'all' ">
                LEFT JOIN  (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
                    WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid
            </if>
            WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}'
                    AND u.id = ANY(SELECT hh.hb_uid  FROM (SELECT COUNT(t.`hb_id`) AS num,t.hb_uid
                              FROM yeshi_ec_hongbao_v2 t
                            WHERE  <![CDATA[DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d') >= '${startTime}']]>
                                AND <![CDATA[DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d') < '${endTime}']]>
                            GROUP BY t.hb_uid HAVING num >= ${orderNumber}
                        )hh
                    )
                <if test="channel != null and  channel != 'all' ">
                    AND a.uid is not null
                </if>
            )w
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -40,13 +40,13 @@
    </sql>
    <sql id="Count_Select_State">
        <if test="state != null and state == 1">  <!-- 未到账 -->
            AND (th.hb_state = 1 or th.hb_state = 2)
            AND (t.hb_state = 1 or t.hb_state = 2)
        </if>
        <if test="state != null and state == 2"> <!-- 已到账 -->
            AND th.hb_state = 3
            AND t.hb_state = 3
        </if>
        <if test="state != null and state == 3">  <!-- 红包已失效 -->
            AND th.hb_state =4
            AND t.hb_state =4
        </if>
    </sql>
    
@@ -68,8 +68,13 @@
        <if test="channel != null and  channel != 'all' ">
            LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON t.`hb_uid`=a.uid 
        </if>
        WHERE t.`hb_uid` IS NOT NULL AND (t.`hb_type`=1 OR t.`hb_type`=20) <include refid="Count_Select_DateType"/>
        WHERE t.`hb_uid` IS NOT NULL AND (t.`hb_type`=1 OR t.`hb_type`=20)
            <include refid="Count_Select_DateType"/>
            <include refid="Count_Select_State"/>
            <if test="channel != null and  channel != 'all' ">
                AND a.uid is not null
            </if>
        <include refid="Count_Group_DateType"/>
        ORDER BY t.`hb_create_time`
    </select>
@@ -80,8 +85,14 @@
        <if test="channel != null and  channel != 'all' ">
            LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON t.`hb_uid`=a.uid 
        </if>
        WHERE t.`hb_uid` IS NOT NULL AND (t.`hb_type`=1 OR h.`hb_type`=20) <include refid="Count_Select_DateType"/>
        WHERE t.`hb_uid` IS NOT NULL AND (t.`hb_type`=1 OR t.`hb_type`=20)
            <include refid="Count_Select_DateType"/>
            <include refid="Count_Select_State"/>
            <if test="channel != null and  channel != 'all' ">
                AND a.uid is not null
            </if>
        <include refid="Count_Group_DateType"/>
        ORDER BY t.`hb_create_time`
    </select>
@@ -105,87 +116,6 @@
        ORDER BY t.`hb_create_time`
    </select>
    
        <select id="count24HOderByChannel" resultType="java.util.HashMap">
        SELECT  COALESCE(SUM(b.money*2),0) AS 'commision',  COALESCE(COUNT(b.id),0) AS'countOrder',
             COALESCE(SUM(b.payMoney),0) AS 'payMoney',
             <if test="type == 1">
                 FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'createDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'createDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'createDate'
            </if>
        FROM
            (
            SELECT h.* FROM  yeshi_ec_hongbao_v2 h
            LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
                  WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
            ON a.uid=h.`uid` WHERE a.uid IS NOT NULL AND (h.`type`=1 OR h.`type`=20)
            ) b
        LEFT JOIN yeshi_ec_user u ON u.`id`=b.uid
        WHERE <![CDATA[b.createtime<u.`createtime`+1000*60*60*24 ]]>
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
        </if>
        ORDER BY u.`createtime`
    </select>
    <select id="countHistoryOderByChannel" resultType="java.util.HashMap">
        SELECT  COALESCE(SUM(h.`money`)*2,0) AS 'commision', COALESCE(COUNT(h.id),0) AS 'countOrder',
             COALESCE(SUM(h.payMoney),0) AS 'payMoney',
                <if test="type == 1">
                     FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'createDate'
                </if>
                <if test="type == 2">
                     FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'createDate'
                </if>
                <if test="type == 3">
                     FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'createDate'
                </if>
        FROM yeshi_ec_hongbao h
        LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
            WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON h.`uid`=a.uid
        WHERE  (h.`type`=1 OR h.`type`=20)  AND  a.uid IS NOT NULL
                <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
                </if>
                <if test="endTime != null and endTime != '' ">
                     AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
                </if>
                <if test="years != null and years != '' ">
                     AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}'
                </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y')
        </if>
        ORDER BY h.`createtime`
    </select>
    
    <select id="countMoneyByUidAndState" resultType="java.math.BigDecimal">
        SELECT CAST(SUM(hb.`hb_money`)AS DECIMAL(19,2)) 
@@ -241,4 +171,50 @@
        LIMIT 1;
    </select>
    
    <select id="count24HOderByChannel" resultType="java.util.HashMap">
        SELECT <!-- COALESCE(SUM(b.money*2),0) AS 'commision', -->
        COALESCE(COUNT(b.hb_id),0) AS 'showValue',
        <!-- COALESCE(SUM(b.payMoney),0) AS 'payMoney', -->
        <if test="type == 1">
            FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
        </if>
        <if test="type == 2">
            FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
        </if>
        <if test="type == 3">
            FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
        </if>
        FROM
            (
            SELECT h.* FROM yeshi_ec_hongbao_v2 h
            LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a
            WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
            ON a.uid=h.`hb_uid` WHERE a.uid IS NOT NULL AND (h.`hb_type`=1 OR h.`hb_type`=20)
            ) b
        LEFT JOIN yeshi_ec_user u ON u.`id`=b.hb_uid
        WHERE <![CDATA[ b.hb_create_time<FROM_UNIXTIME((u.`createtime`+1000*60*60*24)/1000,'%Y-%m-%d %h:%m:%s')]]>
        <if test="startTime != null and startTime != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
        </if>
        <if test="endTime != null and endTime != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
            '${endTime}'
        </if>
        <if test="years != null and years != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
        </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
        </if>
        ORDER BY u.`createtime`
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -95,6 +95,16 @@
        <result column="totalCount" property="totalCount" jdbcType="INTEGER" />
        <result column="totalSettlement" property="totalSettlement" jdbcType="DECIMAL" />
        <result column="totalPayment" property="totalPayment" jdbcType="DECIMAL" />
        <result column="userId" property="userId" jdbcType="VARCHAR" />
        <result column="userName" property="userName" jdbcType="VARCHAR" />
        <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" />
        <result column="levelOneId" property="levelOneId" jdbcType="VARCHAR" />
        <result column="levelOneMoney" property="levelOneMoney" jdbcType="VARCHAR" />
        <result column="levelTwoId" property="levelTwoId" jdbcType="VARCHAR" />
        <result column="levelTwoMoney" property="levelTwoMoney" jdbcType="VARCHAR" />
        <association property="userInfo" column="co_uid"
            resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap">
@@ -105,6 +115,7 @@
        </association>
    </resultMap>
    <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time
    </sql>
@@ -604,4 +615,83 @@
        )A
    </select>
    <select id="listQuery" resultMap="ResultMap">
        SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS userPortrait,
           pv2.`hb_uid` AS levelOneId,pv2.`hb_money` AS levelOneMoney,
           ppv2.`hb_uid` AS levelTwoId,ppv2.`hb_money` AS levelTwoMoney
        FROM  (SELECT  hb.hb_id,hb.hb_uid,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
            LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2
                       WHERE 1=1
                            <include refid="SELECT_PARAM_HONGBAO_TYPE"/>  <!-- 红包类型 -->
                            <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 -->
                    )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
                <include refid="SELECT_PARAM_ORDER_STATE"/>   <!-- 订单状态 -->
                <if test="startTime != null and startTime != '' ">
                    AND <![CDATA[co.co_third_create_time >= #{startTime}]]>
                </if>
                <if test="endTime != null and endTime != '' ">
                    AND <![CDATA[co.co_third_create_time <= #{endTime}]]>
                </if>
                <if test="key != null and key != '' ">
                    <if test="keyType == 1 ">
                        AND co.co_order_no = ${key}
                    </if>
                    <if test="keyType == 2 ">
                        AND hb.hb_uid like = ${key}
                    </if>
                </if>
            ORDER BY co.co_third_create_time DESC
            LIMIT ${start},${count}
        ) A
        LEFT JOIN  yeshi_ec_user u ON  u.id = A.hb_uid
        LEFT JOIN  yeshi_ec_hongbao_v2 pv2 ON pv2.`hb_pid` = A.hb_id
        LEFT JOIN  yeshi_ec_hongbao_v2 ppv2 ON ppv2.`hb_pid` = A.hb_id
    </select>
    <select id="countQuery" resultType="java.lang.Long">
        SELECT  count(ho.ho_id)
        FROM yeshi_ec_hongbao_order ho
        LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2
                   WHERE 1=1
                        <include refid="SELECT_PARAM_HONGBAO_TYPE"/>  <!-- 红包类型 -->
                        <include refid="SELECT_PARAM_HONGBAO_STATE"/> <!-- 红包状态 -->
                )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
            <include refid="SELECT_PARAM_ORDER_STATE"/>   <!-- 订单状态 -->
            <if test="startTime != null and startTime != '' ">
                AND <![CDATA[co.co_third_create_time >= #{startTime}]]>
            </if>
            <if test="endTime != null and endTime != '' ">
                AND <![CDATA[co.co_third_create_time <= #{endTime}]]>
            </if>
            <if test="key != null and key != '' ">
                <if test="keyType == 1 ">
                    AND co.co_order_no = ${key}
                </if>
                <if test="keyType == 2 ">
                    AND hb.hb_uid like = ${key}
                </if>
            </if>
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml
@@ -52,68 +52,7 @@
        <result column="to_orderby" property="orderBy" jdbcType="INTEGER" />
    </resultMap>
    
    <resultMap id="VoResultMap" type="com.yeshi.fanli.vo.order.TaoBaoOrderVO">
        <id column="to_id" property="id" jdbcType="BIGINT" />
        <result column="to_create_time" property="createTime" jdbcType="VARCHAR" />
        <result column="to_click_time" property="clickTime" jdbcType="VARCHAR" />
        <result column="to_title" property="title" jdbcType="VARCHAR" />
        <result column="to_auction_id" property="auctionId" jdbcType="BIGINT" />
        <result column="to_manager_wangwang" property="managerWangWang"
            jdbcType="VARCHAR" />
        <result column="to_shop" property="shop" jdbcType="VARCHAR" />
        <result column="to_count" property="count" jdbcType="INTEGER" />
        <result column="to_price" property="price" jdbcType="DECIMAL" />
        <result column="to_order_state" property="orderState" jdbcType="VARCHAR" />
        <result column="to_order_type" property="orderType" jdbcType="VARCHAR" />
        <result column="to_iratio" property="iRatio" jdbcType="DECIMAL" />
        <result column="to_sratio" property="sRatio" jdbcType="DECIMAL" />
        <result column="to_payment" property="payment" jdbcType="DECIMAL" />
        <result column="to_estimate" property="estimate" jdbcType="DECIMAL" />
        <result column="to_settlement" property="settlement" jdbcType="DECIMAL" />
        <result column="to_eIncome" property="eIncome" jdbcType="DECIMAL" />
        <result column="to_settlement_time" property="settlementTime"
            jdbcType="VARCHAR" />
        <result column="to_tk_rate" property="tkRate" jdbcType="DECIMAL" />
        <result column="to_tk_money" property="tkMoney" jdbcType="DECIMAL" />
        <result column="to_technology_support_percent" property="technologySupportPercent"
            jdbcType="DECIMAL" />
        <result column="to_subsidy_ratio" property="subsidyRatio"
            jdbcType="DECIMAL" />
        <result column="to_subsidy" property="subsidy" jdbcType="DECIMAL" />
        <result column="to_subsidy_type" property="subsidyType"
            jdbcType="VARCHAR" />
        <result column="to_transaction_platform" property="transactionPlatform"
            jdbcType="VARCHAR" />
        <result column="to_third_service" property="thirdService"
            jdbcType="VARCHAR" />
        <result column="to_order_id" property="orderId" jdbcType="VARCHAR" />
        <result column="to_class_name" property="className" jdbcType="VARCHAR" />
        <result column="to_source_media_id" property="sourceMediaId"
            jdbcType="VARCHAR" />
        <result column="to_source_media_name" property="sourceMediaName"
            jdbcType="VARCHAR" />
        <result column="to_ad_position_id" property="adPositionId"
            jdbcType="VARCHAR" />
        <result column="to_ad_position_name" property="adPositionName"
            jdbcType="VARCHAR" />
        <result column="to_latest_updatetime" property="latestUpdateTime"
            jdbcType="TIMESTAMP" />
        <result column="to_orderby" property="orderBy" jdbcType="INTEGER" />
        <result column="picture" property="picture" jdbcType="VARCHAR" />
        <result column="userId" property="userId" jdbcType="VARCHAR" />
        <result column="userName" property="userName" jdbcType="VARCHAR" />
        <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" />
        <result column="userMoney" property="userMoney" jdbcType="VARCHAR" />
        <result column="userMoneyState" property="userMoneyState" jdbcType="VARCHAR" />
        <result column="userMoneyDate" property="userMoneyDate" jdbcType="VARCHAR" />
        <result column="userHongBaoType" property="userHongBaoType" jdbcType="VARCHAR" />
        <result column="levelOneId" property="levelOneId" jdbcType="VARCHAR" />
        <result column="levelOneMoney" property="levelOneMoney" jdbcType="VARCHAR" />
        <result column="levelTwoId" property="levelTwoId" jdbcType="VARCHAR" />
        <result column="levelTwoMoney" property="levelTwoMoney" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">to_id,to_create_time,to_click_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby
    </sql>
@@ -377,85 +316,6 @@
        </association>
    </resultMap>
    <select id="queryJoinHongBao" resultMap="ResultMapExtral">
        SELECT *
        FROM (SELECT DISTINCT(to_id)AS id,hb.uid FROM `yeshi_ec_taobao_order` td
                 LEFT JOIN `yeshi_ec_hongbao` hb ON td.`to_order_id`= hb.`order_id`
             WHERE hb.`version` = 2 AND hb.`type` IN (1,2,20)
            <if test='key != null and key != ""'>
                AND (td.`to_order_id` like '%${key}%' OR hb.uid like '%${key}%')
            </if>
            <if test="days != null">
                <![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL ${days}  DAY) <= td.`to_create_time` ]]>
            </if>
            <if test='startTime != null and startTime != ""'>
                 <![CDATA[AND  td.to_create_time  >= #{startTime}]]>
            </if>
            <if test='endTime != null and endTime != ""'>
                  <![CDATA[AND  td.to_create_time  < #{endTime}]]>
            </if>
            <if test='type == 1'>
                AND (td.`to_order_state` = '订单结算' or td.`to_order_state` = '订单成功')
            </if>
            <if test='type == 2'>
                AND td.`to_order_state` = '订单付款'
            </if>
            <if test='type == 3'>
                AND td.`to_order_state` = '订单失效'
            </if>
        ORDER BY td.`to_create_time` DESC LIMIT ${start},${count} )A
        LEFT JOIN
        yeshi_ec_taobao_order tt ON A.id = tt.to_id
    </select>
    <select id="countQueryJoinHongBao" resultType="java.lang.Integer">
        SELECT count(tt.to_id) FROM (SELECT DISTINCT(to_id)AS id FROM
        `yeshi_ec_taobao_order` td
        LEFT JOIN `yeshi_ec_hongbao` hb ON
        td.`to_order_id`= hb.`order_id`
        WHERE hb.`version` = 2 AND hb.`type` IN
        (1,2,20)
        <if test='key != null and key != ""'>
            AND (td.`to_order_id` like '%${key}%' OR hb.uid like
            '%${key}%')
        </if>
        <if test="days != null">
                <![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL ${days}  DAY) <= td.`to_create_time` ]]>
        </if>
        <if test='startTime != null and startTime != ""'>
                <![CDATA[
                AND to_create_time  >= #{startTime}
                   ]]>
        </if>
        <if test='endTime != null and endTime != ""'>
                <![CDATA[
                AND to_create_time  < #{endTime}
                   ]]>
        </if>
        <if test='type == 1'>
            AND (td.`to_order_state` = '订单结算' or td.`to_order_state` =
            '订单成功')
        </if>
        <if test='type == 2'>
            AND td.`to_order_state` = '订单付款'
        </if>
        <if test='type == 3'>
            AND td.`to_order_state` = '订单失效'
        </if>
        )A LEFT JOIN yeshi_ec_taobao_order tt ON A.id = tt.to_id
    </select>
    <select id="countByOdrerType" resultType="java.util.HashMap">
        SELECT COUNT(to_id)AS
        countTotal ,IFNULL(SUM(CASE WHEN `to_order_state` = '订单结算' THEN 1 WHEN
@@ -538,62 +398,5 @@
        ORDER BY t.`to_create_time`
    </select>
    
    <select id="listQuery" resultMap="VoResultMap">
        SELECT * FROM `yeshi_ec_taobao_order` tb
        WHERE 1=1
            <!--  搜索条件  -->
             <if test='key != null and key != ""'>
                    AND tb.`to_order_id` like '%${key}%'  <!-- 订单号 -->
            </if>
            <if test='startTime != null and startTime != ""'>
                 <![CDATA[AND DATE_FORMAT(tb.to_create_time,'%Y-%m-%d') >= #{startTime}]]>
            </if>
            <if test='endTime != null and endTime != ""'>
                  <![CDATA[AND DATE_FORMAT(tb.to_create_time,'%Y-%m-%d') <= #{endTime}]]>
            </if>
            <if test='state == 1'>
                AND tb.`to_order_state` = '订单付款'
            </if>
            <if test='state == 2'>
                AND (tb.`to_order_state` = '订单结算' or tb.`to_order_state` = '订单成功')
            </if>
            <if test='state == 3'>
                AND tb.`to_order_state` = '订单失效'
            </if>
        ORDER BY tb.`to_create_time` DESC
        LIMIT ${start},${count}
    </select>
    <select id="countQuery" resultType="java.lang.Long">
        SELECT IFNULL(count(tb.to_id),0)
        FROM `yeshi_ec_taobao_order` tb
        WHERE 1=1
            <!--  搜索条件  -->
             <if test='key != null and key != ""'>
                AND tb.`to_order_id` like '%${key}%'  <!-- 订单号 -->
            </if>
            <if test='startTime != null and startTime != ""'>
                 <![CDATA[AND DATE_FORMAT(tb.to_create_time,'%Y-%m-%d') >= #{startTime}]]>
            </if>
            <if test='endTime != null and endTime != ""'>
                  <![CDATA[AND DATE_FORMAT(tb.to_create_time,'%Y-%m-%d') <= #{endTime}]]>
            </if>
            <if test='state == 1'>
                AND tb.`to_order_state` = '订单付款'
            </if>
            <if test='state == 2'>
                AND (tb.`to_order_state` = '订单结算' or tb.`to_order_state` = '订单成功')
            </if>
            <if test='state == 3'>
                AND tb.`to_order_state` = '订单失效'
            </if>
    </select>
    
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml
@@ -93,118 +93,4 @@
        </set>
        where lua_id = #{id,jdbcType=BIGINT}
    </update>
    <select id="countSameDayByChannel" resultType="java.util.HashMap">
        SELECT COALESCE(COUNT(*),0) AS 'showValue',
            <if test="type == 1">
                 FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
            </if>
        FROM  (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
                WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
        LEFT JOIN yeshi_ec_user u ON u.`id`=a.uid
        WHERE 1=1
            <if test="startTime != null and startTime != '' ">
             AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
        </if>
        ORDER BY u.`createtime`
    </select>
    <select id="countSameDayAndBuyGoodsByChannel" resultType="java.util.HashMap">
        SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'showValue',
            <if test="type == 1">
                 FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
            </if>
        FROM
        <if test="channel != null and channel != 'all' ">
            (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
                WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
        </if>
        LEFT JOIN yeshi_ec_user u     <if test="channel != null and channel != 'all' ">ON u.`id`=a.uid</if>
        LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id`
        WHERE (h.`hb_type`=1 OR h.`hb_type`=20)
            <!-- 当日下单 -->
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = FROM_UNIXTIME(h.hb_create_time/1000,'%Y-%m-%d')
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
        </if>
        ORDER BY u.`createtime`
    </select>
    <select id="countOneWeekUserInfo" resultType="java.util.HashMap">
        SELECT COALESCE(SUM(w.total),0) AS totalUser,COALESCE(SUM(w.orderUser),0)AS orderUser FROM
                (SELECT COUNT(u.`id`)AS total,0 AS orderUser
                FROM
                <if test="channel != null and channel != 'all' ">
                 (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
             LEFT JOIN
             </if>
             yeshi_ec_user u  <if test="channel != null and channel != 'all' "> ON u.`id`=a.uid </if>
             WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '2018-11-01'
            UNION
            SELECT 0 AS total, COUNT(u.`id`) AS orderUser
            FROM
             <if test="channel != null and channel != 'all' ">
                (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
            LEFT JOIN
             </if>
            yeshi_ec_user u  <if test="channel != null and channel != 'all' "> ON u.`id`=a.uid   </if>
            WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '2018-01-11'
                    AND u.id = ANY(SELECT hh.hb_uid  FROM (SELECT COUNT(t.`hb_id`) AS num,t.hb_uid
                              FROM yeshi_ec_hongbao_v2 t
                            WHERE  <![CDATA[DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d') >= '${startTime}']]>
                                AND <![CDATA[DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d') < '${endTime}']]>
                            GROUP BY t.hb_uid HAVING num >= ${orderNumber}
                        )hh
                    )
            )w
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -182,7 +182,12 @@
            String year, String startTime, String endTime) throws Exception {
        return hongBaoV2CountMapper.countHongBaoNum(channel, dateType, state, year, startTime, endTime);
    }
    @Override
    public List<Map<String, Object>> countHongBaoType(Integer dateType, Integer type, String year,
            String startTime, String endTime) throws Exception {
        return hongBaoV2CountMapper.countHongBaoType(dateType, type, year, startTime, endTime);
    }
    
    @Override
    public List<Map<String, Object>> getProportionByType(Integer dateType, Integer type, String year,
@@ -277,4 +282,11 @@
    public Date getLastHongBaoTime(Long uid) {
        return hongBaoV2CountMapper.getLastHongBaoTime(uid);
    }
    @Override
    public List<Map<String, Object>> count24HOderByChannel(String channel, Integer type, String years,
            String startTime, String endTime) throws Exception{
        return hongBaoV2CountMapper.count24HOderByChannel(channel, type, years, startTime, endTime);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserInfoCountServiceImpl.java
@@ -11,6 +11,7 @@
import javax.annotation.Resource;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.yeshi.utils.DateUtil;
@@ -50,120 +51,29 @@
        return userInfoMapper.countHasOrderUser();
    }
    
    public List<Map<String, Object>> countNewUserByDate(Integer type,String years, String startTime,
    @Override
    public List<Map<String, Object>> countNewUserByDate(String channel,Integer type,String years, String startTime,
            String endTime) throws Exception {
        return userInfoMapper.countNewUserByDate(type, years, startTime, endTime);
        return userInfoMapper.countNewUserByDate(channel, type, years, startTime, endTime);
        
    }
    public List<Object> dayFactory(String startTime, String endTime, List<Map<String, Object>> list) throws Exception {
        List<Object> listObject = new ArrayList<Object>();
        if (startTime.equals(endTime)) {
            Map<String, Object> map = list.get(0);
            Object total = map.get("total");
            if (total == null) {
                map.put("payMoney", 0);
            }
            listObject.add(map);
            return listObject;
        }
    @Override
    public List<Map<String, Object>> getTodayBuyRate(String channel,Integer type,String years, String startTime,
            String endTime) throws Exception {
        List<Map<String, Object>> todayNum =
                userInfoMapper.getTodayHasOrder(channel, type, years, startTime, endTime);
        
        
        String plusDay = "";
        for (int i = 0; i < 1000 ; i++) {
            if (i == 0) {
                plusDay = startTime;
            } else {
                plusDay = DateUtil.plusDay(i, startTime);
            }
            Map<String, Object> mapObject = new HashMap<String, Object>();
            Object total = null;
            for (int j = 0; j < list.size(); j++) {
                Map<String, Object> map = list.get(j);
                Object createDate = map.get("createDate");
                String month = createDate.toString();
                if (plusDay.equalsIgnoreCase(month)) {
                    total = map.get("total");
                    break;
                }
            }
            if (total == null) {
                total = 0;
            }
            mapObject.put("total", total);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
            Date parseDate = sdf.parse(plusDay.toString());
            mapObject.put("createDate", sdf2.format(parseDate));
            listObject.add(mapObject);
            if (plusDay.equals(endTime)) {
                break; // 时间结束
            }
        }
        
        return listObject;
        return todayNum;
    }
    
    
    public List<Object> monthFactory(List<Map<String, Object>> list) {
        List<Object> listObject = new ArrayList<Object>();
        // 12 个月处理
        for (int i = 1; i <= 12; i++) {
            Map<String, Object> mapObject = new HashMap<String, Object>();
            Object total = null;
            for (int j = 0; j < list.size(); j++) {
                Map<String, Object> map = list.get(j);
                Object createDate = map.get("createDate");
                String month = createDate.toString();
                if ((i+"").equalsIgnoreCase(month) || i == Integer.parseInt(month)) {
                    total = map.get("total");
                    break;
                }
            }
            if (total == null) {
                total = 0;
            }
            mapObject.put("total", total);
            mapObject.put("createDate", i + "月");
            listObject.add(mapObject);
        }
        return listObject;
    }
    public List<Object> yearFactory(List<Map<String, Object>> list) {
        List<Object> listObject = new ArrayList<Object>();
        for (int i = 0; i < list.size(); i++) {
            Map<String, Object> map = list.get(i);
            Object total =  map.get("total");
            if (total == null) {
                total = 0;
            }
            map.put("total", total);
            listObject.add(map);
        }
        return listObject;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -546,4 +546,88 @@
    }
    
    
    @Override
    public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state,
            Integer type, Integer orderState, String startTime, String endTime) throws CommonOrderException {
        List<CommonOrderVO> list = commonOrderMapper.listQuery(start, count,keyType, key, state, type,
                orderState, startTime, endTime);
        if (list == null) {
            list = new ArrayList<CommonOrderVO>();
        }
        if (list.size() == 0) {
            return list;
        }
        SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        for (CommonOrderVO order : list) {
            // 下单时间
            Date thirdCreateTime = order.getThirdCreateTime();
            if (thirdCreateTime != null) {
                order.setDownTime(format.format(thirdCreateTime));
            }
            // 收货时间
            Date settleTime = order.getSettleTime();
            if (settleTime != null) {
                order.setReceiveTime(format.format(settleTime));
            }
            // 到账时间
            Date accountTime = order.getAccountTime();
            if (accountTime != null) {
                order.setHongBaoDate(format.format(accountTime));
            }
            BigDecimal settlement = order.getSettlement();
            if (settlement != null && settlement.compareTo(new BigDecimal(0)) > 0) {
                order.setPayment(settlement); // 实际付款金额
            }
            /* 订单返利类型 转换 */
            Integer hongBaoType = order.getHongBaoType();
            if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) {
                // 自购
                order.setHongBaoType(1);
            } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) {
                // 分享
                order.setHongBaoType(2);
            } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
                    || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
                    || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
                // 邀请
                order.setHongBaoType(3);
            }
            Integer hongBaoState = order.getHongBaoState();
            if (HongBaoV2.STATE_KELINGQU == hongBaoState || HongBaoV2.STATE_BUKELINGQU == hongBaoState) {
                // 未到账
                order.setHongBaoState(1);
            } else if (HongBaoV2.STATE_YILINGQU == hongBaoState) {
                // 已到账
                order.setHongBaoState(2);
            } else if (HongBaoV2.STATE_SHIXIAO == hongBaoState) {
                // 已失效
                order.setHongBaoState(3);
            }
        }
        return list;
    }
    @Override
    public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState,
            String startTime, String endTime) throws CommonOrderException {
        return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/LostOrderServiceImpl.java
@@ -287,23 +287,7 @@
    @Override
    public List<Map<String, Object>> countLostNum( Integer dateType, Integer resultCode, 
            String year, String startTime, String endTime) throws Exception {
        List<Map<String, Object>> list = lostOrderMapper.countLostNum(dateType, resultCode, year, startTime, endTime);
        if (list == null || list.size() == 0) {
            return null;
        }
        switch (dateType){
            case 1: // 按天处理
                return dayFactory(startTime, endTime, list);
            case 2: // 按月处理
                return monthFactory(list);
            case 3:
                return yearFactory(list);
            default:
                return null;
        }
        return lostOrderMapper.countLostNum(dateType, resultCode, year, startTime, endTime);
    }
    
    
@@ -311,127 +295,7 @@
    public List<Map<String, Object>> countAppealMoney( Integer dateType, String year, String startTime, 
            String endTime) throws Exception {
        
        List<Map<String, Object>> list = lostOrderMapper.countAppealMoney(dateType, year, startTime, endTime);
        if (list == null || list.size() == 0) {
            return null;
        }
        switch (dateType){
            case 1: // 按天处理
                return dayFactory(startTime, endTime, list);
            case 2: // 按月处理
                return monthFactory(list);
            case 3:
                return yearFactory(list);
            default:
                return null;
        }
        return lostOrderMapper.countAppealMoney(dateType, year, startTime, endTime);
    }
    
    public List<Map<String, Object>> dayFactory(String startTime, String endTime, List<Map<String, Object>> list) throws Exception {
        List<Map<String, Object>> listObject = new ArrayList<Map<String, Object>>();
        if (startTime.equals(endTime)) {
            Map<String, Object> map = list.get(0);
            Object total = map.get("showValue");
            if (total == null) {
                map.put("showValue", 0);
            }
            listObject.add(map);
            return listObject;
        }
        String plusDay = "";
        for (int i = 0; i < 1000; i++) {
            if (i == 0) {
                plusDay = startTime;
            } else {
                plusDay = DateUtil.plusDay(i, startTime);
            }
            Map<String, Object> mapObject = new HashMap<String, Object>();
            Object total = null;
            for (int j = 0; j < list.size(); j++) {
                Map<String, Object> map = list.get(j);
                Object createDate = map.get("showDate");
                String month = createDate.toString();
                if (plusDay.equalsIgnoreCase(month)) {
                    total = map.get("showValue");
                    break;
                }
            }
            if (total == null) {
                total = 0;
            }
            mapObject.put("showValue", total);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
            Date parseDate = sdf.parse(plusDay.toString());
            mapObject.put("showDate", sdf2.format(parseDate));
            listObject.add(mapObject);
            if (plusDay.equals(endTime)) {
                break; // 时间结束
            }
        }
        return listObject;
    }
    public List<Map<String, Object>> monthFactory(List<Map<String, Object>> list) {
        List<Map<String, Object>> listObject = new ArrayList<Map<String, Object>>();
        // 12 个月处理
        for (int i = 1; i <= 12; i++) {
            Map<String, Object> mapObject = new HashMap<String, Object>();
            Object total = null;
            for (int j = 0; j < list.size(); j++) {
                Map<String, Object> map = list.get(j);
                Object createDate = map.get("showDate");
                String month = createDate.toString();
                if ((i + "").equalsIgnoreCase(month) || i == Integer.parseInt(month)) {
                    total = map.get("total");
                    break;
                }
            }
            if (total == null) {
                total = 0;
            }
            mapObject.put("total", total);
            mapObject.put("showDate", i + "月");
            listObject.add(mapObject);
        }
        return listObject;
    }
    public List<Map<String, Object>> yearFactory(List<Map<String, Object>> list) {
        List<Map<String, Object>> listObject = new ArrayList<Map<String, Object>>();
        for (int i = 0; i < list.size(); i++) {
            Map<String, Object> map = list.get(i);
            Object total = map.get("total");
            if (total == null) {
                total = 0;
            }
            map.put("total", total);
            listObject.add(map);
        }
        return listObject;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java
@@ -7,20 +7,16 @@
import javax.annotation.Resource;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
import com.yeshi.fanli.entity.admin.ReslutOrder;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
@Service
public class TaoBaoOrderServiceImpl implements TaoBaoOrderService {
@@ -95,54 +91,10 @@
        return taoBaoOrderMapper.selectTaoBaoOrderByOrderId(orderId);
    }
    @Override
    public List<ReslutOrder> queryJoinHongBao(int start, int count, String key, String startTime, String endTime,
            Integer type, Integer days) throws Exception {
        return taoBaoOrderMapper.queryJoinHongBao(start, count, key, startTime, endTime, type, days);
    }
    @Override
    public int countQueryJoinHongBao(String key, String startTime, String endTime, Integer type, Integer days)
            throws Exception {
        return taoBaoOrderMapper.countQueryJoinHongBao(key, startTime, endTime, type, days);
    }
    @Override
    public double countEstimate(String date) throws Exception {
        return taoBaoOrderMapper.countEstimate(date);
    }
    @Override
    public List<TaoBaoOrder> getStateByOrderIdAndPayment(String orderId, String payment) throws Exception {
        return taoBaoOrderMapper.getStateByOrderIdAndPayment(orderId, payment);
    }
    @Override
    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, key, startTime, endTime, state);
        for (TaoBaoOrderVO taoBaoOrderVO : listData) {
            String orderState = taoBaoOrderVO.getOrderState();
            if ("订单付款".equals(orderState)) {
                taoBaoOrderVO.setOrderState("1");
            }else if ("订单结算".equals(orderState) || "订单成功".equals(orderState)) {
                taoBaoOrderVO.setOrderState("2");
            } else if ("订单失效".equals(orderState)) {
                taoBaoOrderVO.setOrderState("3");
            }
        }
        return listData;
    }
    @Override
    public long countQuery(String key, String startTime, String endTime,
            Integer state) throws Exception {
        return taoBaoOrderMapper.countQuery(key, startTime, endTime, state);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java
@@ -1,22 +1,14 @@
package com.yeshi.fanli.service.impl.user;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.user.UserActiveLogMapper;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
import com.yeshi.fanli.service.inter.user.UserActiveLogService;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@Service
public class UserActiveLogServiceImpl implements UserActiveLogService {
@@ -45,281 +37,7 @@
    }
    
    @Override
    public List<Map<String, Object>> countSameDayByChannel(String channel, Integer type, String years,
            String startTime, String endTime) throws Exception{
        return userActiveLogMapper.countSameDayByChannel(channel, type, years, startTime, endTime);
    }
    @Override
    public List<Object> countSameDayAndBuyGoodsByChannel(String channel, Integer type, String years,
            String startTime, String endTime) throws Exception {
        List<Map<String, Object>> list = userActiveLogMapper.countSameDayAndBuyGoodsByChannel(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<Map<String, Object>> countOneWeekUserInfo(String channel, String startTime, String endTime,
            Integer orderNumber) throws Exception {
        // 时间列表
        List<String> dateList = new ArrayList<String>();
        // 结果列表
        List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
        String middleDay = "";
        for (int i = 0; i < 100 ; i++) {
            if (i == 0) {
                middleDay = startTime;
            } else {
                middleDay = DateUtil.plusDay(i, startTime);
            }
            dateList.add(middleDay);
            if (middleDay.equals(endTime)) {
                break; // 时间结束
            }
        }
        for (String nowDate: dateList) {
            // 加入7天
            String plusDay = DateUtil.plusDay(7, nowDate);
            // 执行查询 并返回结果
            Map<String, BigDecimal> map= userActiveLogMapper.countOneWeekUserInfo(channel, nowDate, plusDay, orderNumber);
            // 比例
            BigDecimal proportion = null;
            if (map != null) {
                // 新增用户
                BigDecimal totalUser = map.get("totalUser");
                // 存在订单的新增用户
                BigDecimal orderUser = map.get("orderUser");
                try {
                    proportion = MoneyBigDecimalUtil.sub(orderUser, totalUser);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            if (proportion == null) {
                proportion = new BigDecimal(0);
            }
            Map<String, Object> result = new HashMap<String, Object>();
            result.put("showValue", MoneyBigDecimalUtil.mul(proportion, new BigDecimal(100)));
            result.put("showDate", nowDate);
            resultList.add(result);
        }
        return resultList;
    }
    
    
    @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;
        return null;
    }
    /**
     * 天数格式
     * @param startTime
     * @param endTime
     * @param list
     * @return
     * @throws Exception
     */
    public List<Object> dayFactory(String startTime, String endTime, List<Map<String, Object>> list) throws Exception {
        List<Object> listObject = new ArrayList<Object>();
        if (startTime.equals(endTime)) {
            Map<String, Object> map = list.get(0);
            Object sameDayNum = map.get("showValue");
            if (sameDayNum == null) {
                map.put("showValue", 0);
            }
            listObject.add(map);
            return listObject;
        }
        String plusDay = "";
        for (int i = 0; i < 1000 ; i++) {
            if (i == 0) {
                plusDay = startTime;
            } else {
                plusDay = DateUtil.plusDay(i, startTime);
            }
            Map<String, Object> mapObject = new HashMap<String, Object>();
            Object sameDayNum = null;
            for (int j = 0; j < list.size(); j++) {
                Map<String, Object> map = list.get(j);
                Object createDate = map.get("showDate");
                String month = createDate.toString();
                if (plusDay.equalsIgnoreCase(month)) {
                    sameDayNum = map.get("showValue");
                    break;
                }
            }
            if (sameDayNum == null) {
                sameDayNum = 0;
            }
            mapObject.put("showValue", sameDayNum);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
            Date parseDate = sdf.parse(plusDay.toString());
            mapObject.put("showDate", sdf2.format(parseDate));
            listObject.add(mapObject);
            if (plusDay.equals(endTime)) {
                break; // 时间结束
            }
        }
        return listObject;
    }
    /**
     * 月份格式
     * @param list
     * @return
     */
    public List<Object> monthFactory(List<Map<String, Object>> list) {
        List<Object> listObject = new ArrayList<Object>();
        // 12 个月处理
        for (int i = 1; i <= 12; i++) {
            Map<String, Object> mapObject = new HashMap<String, Object>();
            Object sameDayNum = null;
            for (int j = 0; j < list.size(); j++) {
                Map<String, Object> map = list.get(j);
                Object createDate = map.get("showDate");
                String month = createDate.toString();
                if ((i+"").equalsIgnoreCase(month) || i == Integer.parseInt(month)) {
                    sameDayNum = map.get("showValue");
                    break;
                }
            }
            if (sameDayNum == null) {
                sameDayNum = 0;
            }
            mapObject.put("showValue", sameDayNum);
            mapObject.put("showDate", i + "月");
            listObject.add(mapObject);
        }
        return listObject;
    }
    /**
     * 年份格式
     * @param list
     * @return
     */
    public List<Object> yearFactory(List<Map<String, Object>> list) {
        List<Object> listObject = new ArrayList<Object>();
        for (int i = 0; i < list.size(); i++) {
            Map<String, Object> map = list.get(i);
            Object sameDayNum = map.get("showValue");
            Object createDate = map.get("showDate");
            if (sameDayNum == null) {
                sameDayNum = 0;
            }
            map.put("showValue", sameDayNum);
            map.put("showDate", createDate + "年");
            listObject.add(map);
        }
        return listObject;
    }
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
@@ -94,5 +94,21 @@
     * @return
     */
    public Date getLastHongBaoTime(Long uid);
    public List<Map<String, Object>> count24HOderByChannel(String channel, Integer type, String years, String startTime,
            String endTime) throws Exception;
    /**
     * 统计所有类型订单数量
     * @param dateType
     * @param type
     * @param year
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public List<Map<String, Object>> countHongBaoType(Integer dateType, Integer type, String year, String startTime,
            String endTime) throws Exception;
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/count/UserInfoCountService.java
@@ -49,5 +49,9 @@
     * 统计新增用户
     * @return
     */
    public List<Map<String, Object>> countNewUserByDate(Integer type,String years, String startTime, String endTime) throws Exception;
    public List<Map<String, Object>> countNewUserByDate(String channel,Integer type,String years, String startTime, String endTime) throws Exception;
    public List<Map<String, Object>> getTodayBuyRate(String channel, Integer type, String years, String startTime,
            String endTime) throws Exception;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java
@@ -174,4 +174,25 @@
    public long countQueryByUid(Long uid, Integer state, Integer type, Integer orderState, String orderNo, String startTime,
            String endTime, Integer dateType) throws CommonOrderException;
    /**
     * 查询所有用户订单
     * @param start
     * @param count
     * @param keyType
     * @param key
     * @param state
     * @param type
     * @param orderState
     * @param startTime
     * @param endTime
     * @return
     * @throws CommonOrderException
     */
    public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state, Integer type,
            Integer orderState, String startTime, String endTime) throws CommonOrderException;
    public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState, String startTime,
            String endTime) throws CommonOrderException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoOrderService.java
@@ -2,9 +2,7 @@
import java.util.List;
import com.yeshi.fanli.entity.admin.ReslutOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
/**
 * 淘宝订单服务
@@ -40,56 +38,11 @@
    public List<TaoBaoOrder> getTaoBaoOrderByOrderId(String orderId);
    
    /**
     * 查询订单--关联红包
     * @param start
     * @param count
     * @param key
     * @param startTime
     * @param endTime
     * @param type
     * @param days
     * @return
     */
    public List<ReslutOrder> queryJoinHongBao(int start, int count, String key, String startTime, String endTime, Integer type, Integer days) throws Exception;
    public int countQueryJoinHongBao(String key, String startTime, String endTime, Integer type, Integer days) throws Exception;
    /**
     * 统计当日预估收益
     * @param date  2018-09-01
     * @return
     */
    public double countEstimate(String date) throws Exception;
    /**
     * 根据订单号、金额查询订单状态
     * @param orderId
     * @param payment
     * @return
     * @throws Exception
     */
    public List<TaoBaoOrder> getStateByOrderIdAndPayment(String orderId, String payment) throws Exception;
    /**
     * 后端查询商品列表
     * @param start
     * @param count
     * @param keyType
     * @param key
     * @param startTime
     * @param endTime
     * @param state
     * @return
     * @throws Exception
     */
    public List<TaoBaoOrderVO> listQuery(int start, int count, String key, String startTime, String endTime,
            Integer state) throws Exception;
    public long countQuery(String key, String startTime, String endTime, Integer state) throws Exception;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserActiveLogService.java
@@ -1,8 +1,5 @@
package com.yeshi.fanli.service.inter.user;
import java.util.List;
import java.util.Map;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
/**
@@ -26,37 +23,5 @@
     * @return
     */
    public UserActiveLog getUserLatestActiveInfo(Long uid);
    /**
     * 根据渠道   统计当日新增用户数量
     * @param channel
     * @return
     */
    public List<Map<String, Object>> countSameDayByChannel(String channel, Integer type, String years,
            String startTime, String endTime) throws Exception;
    /**
     * 根据渠道   统计当日新增用户有购买行为的数量
     * @param channel
     * @return
     */
    public List<Object> countSameDayAndBuyGoodsByChannel(String channel, Integer type, String years, String startTime,
            String endTime) throws Exception;
    /**
     * 当日产生订单的新增用户 与 当日总新增用户比例
     * @param channel
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public List<Object> getBuyProportion(String channel, Integer type, String years, String startTime, String endTime,Integer orderNum)
            throws Exception;
    public List<Map<String, Object>> countOneWeekUserInfo(String channel, String startTime, String endTime, Integer orderNumber)
            throws Exception;
}
fanli/src/main/java/com/yeshi/fanli/vo/order/CommonOrderVO.java
@@ -74,7 +74,26 @@
    @Expose
    private List<CommonOrderGoodsVO> listOrderGoods = new ArrayList<CommonOrderGoodsVO>();
    // 直接收益人-ID
       private String userId;
       // 直接收益人-昵称
       private String userName;
    // 直接收益人-头像
       private String userPortrait; // 头像
    // 一级收益人-ID
     private String levelOneId;
     // 一级收益人-金额
     private String levelOneMoney;
     // 二级收益人-ID
     private String levelTwoId;
     // 二级收益人-金额
     private String levelTwoMoney;
    public Date getAccountTime() {
        return accountTime;
    }
@@ -229,5 +248,60 @@
        this.totalPayment = totalPayment;
    }
    public String getLevelOneId() {
        return levelOneId;
    }
    public void setLevelOneId(String levelOneId) {
        this.levelOneId = levelOneId;
    }
    public String getLevelOneMoney() {
        return levelOneMoney;
    }
    public void setLevelOneMoney(String levelOneMoney) {
        this.levelOneMoney = levelOneMoney;
    }
    public String getLevelTwoId() {
        return levelTwoId;
    }
    public void setLevelTwoId(String levelTwoId) {
        this.levelTwoId = levelTwoId;
    }
    public String getLevelTwoMoney() {
        return levelTwoMoney;
    }
    public void setLevelTwoMoney(String levelTwoMoney) {
        this.levelTwoMoney = levelTwoMoney;
    }
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getUserPortrait() {
        return userPortrait;
    }
    public void setUserPortrait(String userPortrait) {
        this.userPortrait = userPortrait;
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/order/TaoBaoOrderVO.java
File was deleted