yujian
2019-01-05 4220ceb661146c58d1d6855f14dcdcc3d8c7bb24
Merge branch 'div1'
18个文件已修改
4个文件已添加
1351 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java 229 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ExtractAuditRecordMapper.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserActiveLogMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ExtractAuditRecordMapper.xml 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/ExtractServiceCountImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 218 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserInfoCountServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractAuditRecordServiceImpl.java 222 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/UserInfoCountService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/ExtractAuditRecordService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserActiveLogService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -15,6 +15,8 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -40,7 +42,9 @@
import com.yeshi.fanli.exception.ObjectStateException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.AdminUserService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.ExtractCountService;
import com.yeshi.fanli.service.inter.count.UserInfoCountService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
import com.yeshi.fanli.service.inter.order.OrderItemServcie;
import com.yeshi.fanli.service.inter.order.PidOrderService;
@@ -57,14 +61,18 @@
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("admin/new/api/v1/extract")
public class ExtractAdminController {
    @Resource
    private ExtractService extractService;
    @Resource
    private ConfigService configService;
    @Resource
    private UserInfoCountService userInfoCountService;
    @Resource
    private ExtractCountService extractCountService;
@@ -1415,4 +1423,185 @@
        }
    }
    /**
     * 统计审核次数
     * @param callback
     * @param state 审核状态:所有-空值或者不传  通过-1  拒绝- 2
     * @param type 统计类型  1-24小时  2-所有
     * @param dateType 类型  1日  2月  3年
     * @param year 2018
     * @param startTime 2018-12-01
     * @param endTime   2018-12-01
     * @param out
     */
    @RequestMapping(value = "getAuditTotal")
    public void getAuditTotal(String callback,Integer state, Integer shwoType, String year,
            String startTime, String endTime, PrintWriter out) {
        String validateMsg = validateParams(shwoType, startTime, endTime);
        if (validateMsg != null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
            return;
        }
        if (shwoType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
            startTime = null;
            endTime = null;
        }
        try {
            List<Map<String, Object>> resultList = extractAuditRecordService.countAuditTotal(state, shwoType,
                    year, startTime, endTime);
            JSONObject data = new JSONObject();
            data.put("result_list", resultList);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 统计提现申请总额
     * @param callback
     * @param state 所有-空值或者不传   待审核-0 通过-1  拒绝- 2
     * @param type 统计类型  1-24小时  2-所有
     * @param dateType 类型  1日  2月  3年
     * @param year 2018
     * @param startTime 2018-12-01
     * @param endTime   2018-12-01
     * @param out
     */
    @RequestMapping(value = "getExtractMoney")
    public void getExtractMoney(String callback,Integer state, Integer shwoType, String year,
            String startTime, String endTime, PrintWriter out) {
        String validateMsg = validateParams(shwoType, startTime, endTime);
        if (validateMsg != null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
            return;
        }
        if (shwoType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
            startTime = null;
            endTime = null;
        }
        try {
            List<Map<String, Object>> resultList = extractAuditRecordService.countExtractMoney(state, shwoType,
                    year, startTime, endTime);
            JSONObject data = new JSONObject();
            data.put("result_list", resultList);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 统计提现申请总次数
     * @param callback
     * @param state 所有-空值或者不传   待审核-0 通过-1  拒绝- 2
     * @param type 统计类型  1-24小时  2-所有
     * @param dateType 类型  1日  2月  3年
     * @param year 2018
     * @param startTime 2018-12-01
     * @param endTime   2018-12-01
     * @param out
     */
    @RequestMapping(value = "getExtractApplyNumber")
    public void getExtractApplyNumber(String callback,Integer state, Integer shwoType, String year,
            String startTime, String endTime, PrintWriter out) {
        String validateMsg = validateParams(shwoType, startTime, endTime);
        if (validateMsg != null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
            return;
        }
        if (shwoType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
            startTime = null;
            endTime = null;
        }
        try {
            List<Map<String, Object>> resultList = extractAuditRecordService.countExtractApplyNumber(state, shwoType,
                    year, startTime, endTime);
            JSONObject data = new JSONObject();
            data.put("result_list", resultList);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 统计资金信息
     *
     * @param out
     */
    @RequestMapping(value = "getMoneynfo")
    public void getHistoryInfo(String callback, PrintWriter out) {
        // 累计已提现金额总计:已提现成功的总额
        Map<String, Object> resultData = extractCountService.countTotalSuccess();
        // 当前用户余额总计:所有用户总余额
        BigDecimal amountMoney = userInfoCountService.countAllMoney(null);
        // 可提现金额限制
        String minMoney = configService.get(Constant.EXTRACT_MIN_MONEY);
        if (minMoney == null){
            minMoney = "0";
        }
        // 当前可提现金额总计: 超过最低提现金额---计入统计
        BigDecimal extractApply = userInfoCountService.countAllMoney(Double.parseDouble(minMoney));
        JSONObject data = new JSONObject();
        data.put("amountMoney", amountMoney);
        data.put("extractApply", extractApply);
        data.put("extractMoney", resultData.get("totalmoney"));
        out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
    }
    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;
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java
@@ -3,6 +3,7 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@@ -17,6 +18,7 @@
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.entity.admin.OrderAdmin;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
import com.yeshi.fanli.service.inter.order.OrderService;
import com.yeshi.fanli.tag.PageEntity;
@@ -26,86 +28,94 @@
@Controller
@RequestMapping("admin/new/api/v1/order")
public class OrderAdminController {
    @Resource
    private OrderService orderService;
    @Resource
    private HongBaoService hongBaoService;
    @RequestMapping(value ="getOrderList",method=RequestMethod.POST)
    public void getOrderList(int pageIndex,String key,PrintWriter out){
        List<OrderAdmin> orderAdminList = hongBaoService.getOrderAdminList(pageIndex,key);
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
    @RequestMapping(value = "getOrderList", method = RequestMethod.POST)
    public void getOrderList(int pageIndex, String key, PrintWriter out) {
        List<OrderAdmin> orderAdminList = hongBaoService.getOrderAdminList(pageIndex, key);
        int count = orderService.getCount(key);
        int totalPage = count % Constant.PAGE_SIZE == 0 ? count
                / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1;
        PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count,
                totalPage);
        int totalPage = count % Constant.PAGE_SIZE == 0 ? count / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1;
        PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count, totalPage);
        JSONObject data = new JSONObject();
        data.put("pe", pe);
        data.put("orderList",  JsonUtil.getSimpleGsonWithDateAndSerialization().toJson(orderAdminList));
        data.put("orderList", JsonUtil.getSimpleGsonWithDateAndSerialization().toJson(orderAdminList));
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 统计历史渠道产生订单的金额
     *
     * @param callback
     * @param channelArray 名字数组
     * @param type 统计类型  1-24小时  2-所有
     * @param dateType 类型  1日  2月  3年
     * @param year 2018
     * @param startTime 2018-12-01
     * @param endTime   2018-12-01
     * @param channelArray
     *            名字数组
     * @param type
     *            统计类型 1-24小时 2-所有
     * @param dateType
     *            类型 1日 2月 3年
     * @param year
     *            2018
     * @param startTime
     *            2018-12-01
     * @param endTime
     *            2018-12-01
     * @param out
     */
    @RequestMapping(value = "getHistoryOderByChannel")
    public void getHistoryOderByChannel(String callback, String channelArray, Integer dateType,
            Integer type, String year, String startTime, String endTime, PrintWriter out) {
    public void getHistoryOderByChannel(String callback, String channelArray, Integer dateType, Integer type,
            String year, String startTime, String endTime, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(channelArray)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择统计对应名称"));
            return;
        }
        if (dateType == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择排列方式"));
            return;
        }
        if (dateType == 1 && (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime))) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择时间区间"));
            return;
        }
        if (!StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选结束日期"));
            return;
        }
        if (StringUtil.isNullOrEmpty(startTime) && !StringUtil.isNullOrEmpty(endTime)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选起始日期"));
            return;
        }
        if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
            startTime = null;
            endTime = null;
        }
        try {
            Gson gson = new Gson();
            List<String> list = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType());
            List<String> list = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {
            }.getType());
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数格式不正确"));
                return;
            }
            JSONArray array = new JSONArray();
            for (String channel: list) {
            for (String channel : list) {
                JSONObject channelData = new JSONObject();
                List<Object> resultList = null;
                if (type == 1) {
@@ -114,8 +124,7 @@
                } else if (type == 2) {
                    resultList = hongBaoService.countHistoryOderByChannel(channel, dateType, year, startTime, endTime);
                }
                if (resultList == null) {
                    resultList = new ArrayList<Object>();
                }
@@ -123,7 +132,7 @@
                channelData.put("infos", resultList);
                array.add(channelData);
            }
            JSONObject data = new JSONObject();
            data.put("result_list", array);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
@@ -132,7 +141,161 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 验证统计信息参数
     * @param shwoType
     * @param startTime
     * @param endTime
     * @return
     */
    public String validateParams(Integer shwoType, String startTime, String endTime) {
        if (shwoType == null) {
            return "请选择视图类型";
        }
        if (shwoType == 1 && (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime))) {
            return "请选择时间区间";
        }
        if (!StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) {
            return "请选结束日期";
        }
        if (StringUtil.isNullOrEmpty(startTime) && !StringUtil.isNullOrEmpty(endTime)) {
            return "请选起始日期";
        }
        return null;
    }
    
    /**
     * 统计提现申请总次数
     * @param callback
     * @param channelArray 渠道名 为空是统计所有
     * @param dateType     显示视图:日-1 、月-2、 年-3
     * @param state 状态:  1-未到账 2-已到账  3-已失效
     * @param year
     * @param startTime
     * @param endTime
     * @param out
     */
    @RequestMapping(value = "getHongBaoNum")
    public void getHongBaoNum(String callback,String channelArray, Integer dateType, Integer state,
            String year, String startTime, String endTime, PrintWriter out) {
        String validateMsg = validateParams(dateType, startTime, endTime);
        if (validateMsg != null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
            return;
        }
        try {
            JSONObject data = countHongBao(channelArray, dateType, state, year, startTime,  endTime, 1);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
            e.printStackTrace();
        }
    }
    /**
     * 统计提现申请总金额
     * @param callback
     * @param channelArray 渠道名 为空是统计所有
     * @param dateType     显示视图:日-1 、月-2、 年-3
     * @param state 状态:  1-未到账 2-已到账  3-已失效
     * @param year
     * @param startTime
     * @param endTime
     * @param out
     */
    @RequestMapping(value = "getHongBaoMoney")
    public void getHongBaoMoney(String callback,String channelArray, Integer dateType, Integer state,
            String year, String startTime, String endTime, PrintWriter out) {
        String validateMsg = validateParams(dateType, startTime, endTime);
        if (validateMsg != null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
            return;
        }
        try {
            JSONObject data = countHongBao( channelArray, dateType, state, year, startTime, endTime, 2);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
            e.printStackTrace();
        }
    }
    /**
     * 统计红包信息
     * @param channelArray
     * @param dateType
     * @param state
     * @param year
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public JSONObject countHongBao(String channelArray, Integer dateType, Integer state, String year, String startTime,
            String endTime, int countType) throws Exception {
        if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
            startTime = null;
            endTime = null;
        }
        List<String> channelList = null;
        if (channelArray != null && channelArray.trim().length() > 0) {
            Gson gson = new Gson();
            channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType());
        }
        if (channelList == null || channelList.size() == 0) {
            channelList = new ArrayList<String>();
            channelList.add("all");
        }
        JSONArray array = new JSONArray();
        for (String channel : channelList) {
            JSONObject channelData = new JSONObject();
            List<Map<String, Object>> resultList = null;
            if (countType == 1 ) {
                resultList = hongBaoV2CountService.countHongBaoNum(channel, dateType, state, year,
                        startTime, endTime);
            } else if (countType == 2) {
                resultList = hongBaoV2CountService.countHongBaoMoney(channel, dateType, state, year,
                        startTime, endTime);
            }
            if (resultList == null) {
                resultList = new ArrayList<Map<String, Object>>();
            }
            if ("all".equalsIgnoreCase(channel)) {
                channel = "总计";
            }
            channelData.put("name", channel);
            channelData.put("infos", resultList);
            array.add(channelData);
        }
        JSONObject data = new JSONObject();
        data.put("result_list", array);
        return data;
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -4,6 +4,7 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -706,7 +707,7 @@
            long countGold = userInfoCountService.countRank(3);
            
            // 统计所有总金额
            double countTotalMoney = userInfoCountService.countAllMoney(null);
            BigDecimal countTotalMoney = userInfoCountService.countAllMoney(null);
            
            // 统计所有可提现金额
            String minMoney = configService.get(Constant.EXTRACT_MIN_MONEY);
@@ -714,7 +715,7 @@
                minMoney = "20";
                
            double min = Double.parseDouble(minMoney);
            double countCanAssets = userInfoCountService.countAllMoney(min);
            BigDecimal countCanAssets = userInfoCountService.countAllMoney(min);
            
            JSONObject data = new JSONObject();
            data.put("countTotal", countTotal);
@@ -1244,7 +1245,7 @@
     */
    @RequestMapping(value = "getBuyProportion")
    public void getBuyProportion(String callback, String channelArray, Integer dateType, 
         String year, String startTime, String endTime, PrintWriter out) {
         String year, String startTime, String endTime, Integer orderNum, PrintWriter out) {
        
        validateParams(callback, channelArray, dateType,year,startTime,endTime,out);
        
@@ -1267,7 +1268,7 @@
            for (String channel: list) {
                JSONObject channelData = new JSONObject();
                List<Object> resultList = userActiveLogService.getBuyProportion(channel, dateType, year, startTime, endTime);
                List<Object> resultList = userActiveLogService.getBuyProportion(channel, dateType, year, startTime, endTime, orderNum);
                if (resultList == null) {
                    resultList = new ArrayList<Object>();
                }
@@ -1286,6 +1287,11 @@
        }
    }
    
    /**
     * 用户统计 :总用户、流失用户数量、累计有购买用户数
     * @param callback
     * @param out
     */
    @RequestMapping(value = "countUser")
    public void countUser(String callback, PrintWriter out) {
        try {
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ExtractAuditRecordMapper.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.dao.mybatis;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
@@ -136,6 +137,41 @@
     */
    int getByUidCount(@Param("uid") Long uid);
    
    /**
     * 统计审核次数
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countAuditTotal(@Param("state")Integer state, @Param("type")Integer type,
        @Param("years")String years, @Param("startTime")String startTime, @Param("endTime")String endTime);
    /**
     * 统计申请提的现总金额
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countExtractMoney(@Param("state")Integer state, @Param("type")Integer type,
        @Param("years")String years, @Param("startTime")String startTime, @Param("endTime")String endTime);
    /**
     * 统计申请提的现总次数
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countExtractApplyNumber(@Param("state")Integer state, @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/HongBaoV2CountMapper.java
New file
@@ -0,0 +1,39 @@
package com.yeshi.fanli.dao.mybatis;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
public interface HongBaoV2CountMapper {
    /**
     * 统计总金额
     * @param channel 渠道
     * @param type
     * @param state
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countHongBaoMoney(@Param("channel")String channel, @Param("dateType")Integer dateType,
            @Param("state") Integer state, @Param("year") String year,
            @Param("startTime")String startTime, @Param("endTime")String endTime);
    /**
     * 统计总个数
     * @param channel 渠道
     * @param type
     * @param state
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countHongBaoNum(@Param("channel")String channel, @Param("dateType")Integer dateType,
            @Param("state") Integer state, @Param("year") String year,
            @Param("startTime")String startTime, @Param("endTime")String endTime);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
@@ -110,7 +110,7 @@
     * @param minMoney
     * @return
     */
    double countAllMoney(@Param("minMoney") Double minMoney);
    BigDecimal countAllMoney(@Param("minMoney") Double minMoney);
    
    
    /**
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserActiveLogMapper.java
@@ -40,4 +40,14 @@
    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);
    /**
     * 根据渠道   统计当日新增用户有购买行为的订单数量大于3
     * @param channel
     * @return
     */
    List<Map<String, Object>> countSameDayAndBuyGoodsByChannelAndBuyNum(@Param("channel")String channel,
            @Param("type")Integer type, @Param("years") String years,
            @Param("startTime")String startTime, @Param("endTime")String endTime,
            @Param("orderNum")Integer orderNum);
}
fanli/src/main/java/com/yeshi/fanli/mapping/ExtractAuditRecordMapper.xml
@@ -243,4 +243,120 @@
       WHERE ex.uid = ${uid} <![CDATA[and ar.auditTime > 0 and ar.auditTime is not null ]]>
    </select>
     
    <select id="countAuditTotal" resultType="java.util.HashMap">
        SELECT COALESCE(COUNT(tr.id),0) AS 'total',
            <if test="type == 1">
                 FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(tr.`auditTime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(tr.`auditTime`/1000,'%Y') AS 'showDate'
            </if>
        FROM `yeshi_ec_extract_audit_record` tr
         <if test="state != null and state != 0">
            LEFT JOIN `yeshi_ec_extract` t ON t.`id` = tr.`extractId`
         </if>
        WHERE tr.`auditTime` IS NOT NULL
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y') = '${years}'
            </if>
            <if test="state != null and state != 0">
                 AND t.`state` = ${state}
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y')
        </if>
        ORDER BY tr.`auditTime`
    </select>
    <select id="countExtractMoney" resultType="java.util.HashMap">
        SELECT CAST(SUM(t.`money`)AS DECIMAL(19,2)) AS total,
            <if test="type == 1">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%Y') AS 'showDate'
            </if>
        FROM `yeshi_ec_extract` t
        WHERE t.`extractTime` IS NOT NULL
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y') = '${years}'
            </if>
            <if test="state != null">
                 AND t.`state` = ${state}
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y')
        </if>
        ORDER BY t.`extractTime`
    </select>
    <select id="countExtractApplyNumber" resultType="java.util.HashMap">
        SELECT COUNT(t.id) AS total,
            <if test="type == 1">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%Y') AS 'showDate'
            </if>
        FROM `yeshi_ec_extract` t
        WHERE t.`extractTime` IS NOT NULL
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y') = '${years}'
            </if>
            <if test="state != null">
                 AND t.`state` = ${state}
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y')
        </if>
        ORDER BY t.`extractTime`
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml
@@ -275,9 +275,9 @@
    <select id="countTotalSuccess" resultType="java.util.HashMap">
        <!-- 提现成功 次数、总金额 -->
        SELECT IFNULL(ROUND(SUM(money),2),0) AS totalmoney,
        IFNULL(COUNT(et.id),0) AS totalamount FROM yeshi_ec_extract et WHERE
        et.state=1
        SELECT CAST(SUM(et.money)AS DECIMAL(19,2)) AS totalmoney,
        IFNULL(COUNT(et.id),0) AS totalamount FROM yeshi_ec_extract et
        WHERE et.state=1
    </select>
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -339,9 +339,9 @@
           SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` WHERE rank = #{rank}
    </select>
    
    <select id="countAllMoney" resultType="java.lang.Double">
    <select id="countAllMoney" resultType="java.math.BigDecimal">
       <!--  金额统计 -->
           SELECT COALESCE(sum(my_hongBao),0) FROM `yeshi_ec_user`
           SELECT CAST(SUM(my_hongBao)AS DECIMAL(19,2)) FROM `yeshi_ec_user`
           WHERE 1=1 
               <if test="minMoney != null">
              AND <![CDATA[ my_hongBao >= #{minMoney}]]> 
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
New file
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.HongBaoV2CountMapper">
    <sql id="Column_DateType">
        <if test="dateType == 1">
            DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d') AS 'showDate'
        </if>
        <if test="dateType == 2">
            DATE_FORMAT(t.`hb_create_time`,'%m') AS 'showDate'
        </if>
        <if test="dateType == 3">
            DATE_FORMAT(t.`hb_create_time`,'%Y') AS 'showDate'
        </if>
    </sql>
    <sql id="Count_Select_DateType">
        <if test="startTime != null and startTime != '' ">
            AND DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
        </if>
        <if test="endTime != null and endTime != '' ">
            AND DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
        </if>
        <if test="year != null and year != '' ">
            AND DATE_FORMAT(t.`hb_create_time`,'%Y') = '${year}'
        </if>
    </sql>
    <sql id="Count_Group_DateType">
        <if test="dateType == 1">
            GROUP BY DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d')
        </if>
        <if test="dateType == 2">
            GROUP BY DATE_FORMAT(t.`hb_create_time`,'%Y-%m')
        </if>
        <if test="dateType == 3">
            GROUP BY DATE_FORMAT(t.`hb_create_time`,'%Y')
        </if>
    </sql>
    <sql id="Count_Select_State">
        <if test="state != null and state == 1">  <!-- 未到账 -->
            AND (th.hb_state = 1 or th.hb_state = 2)
        </if>
        <if test="state != null and state == 2"> <!-- 已到账 -->
            AND th.hb_state = 3
        </if>
        <if test="state != null and state == 3">  <!-- 红包已失效 -->
            AND th.hb_state =4
        </if>
    </sql>
    <select id="countHongBaoMoney" resultType="java.util.HashMap">
        SELECT CAST(SUM(t.`hb_money`)AS DECIMAL(19,2)) AS total,<include refid="Column_DateType"/>
        FROM yeshi_ec_hongbao_v2 t
        <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"/>
            <include refid="Count_Select_State"/>
        <include refid="Count_Group_DateType"/>
        ORDER BY t.`hb_create_time`
    </select>
    <select id="countHongBaoNum" resultType="java.util.HashMap">
        SELECT COUNT(t.`hb_id`)AS total,<include refid="Column_DateType"/>
        FROM yeshi_ec_hongbao_v2 t
        <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"/>
            <include refid="Count_Select_State"/>
        <include refid="Count_Group_DateType"/>
        ORDER BY t.`hb_create_time`
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml
@@ -169,4 +169,43 @@
        
        ORDER BY u.`createtime`
    </select>
    <select id="countSameDayAndBuyGoodsByChannelAndBuyNum" resultType="java.util.HashMap">
        SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'sameDayNum',
            <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 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
        LEFT JOIN (SELECT COUNT(DISTINCT h.`order_id`) AS count_num,h.uid,h.`createtime` FROM yeshi_ec_hongbao h
                    WHERE h.`type`=1 OR h.`type`=20
                    GROUP BY h.`createtime`,h.uid   HAVING count_num>= ${orderNum})hb     ON hb.`uid`= u.`id`
        WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = FROM_UNIXTIME(hb.createtime/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>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/count/ExtractServiceCountImpl.java
@@ -1,7 +1,6 @@
package com.yeshi.fanli.service.impl.count;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
New file
@@ -0,0 +1,218 @@
package com.yeshi.fanli.service.impl.count;
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.HongBaoV2CountMapper;
import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper;
import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
import com.yeshi.fanli.dao.mybatis.order.OrderItemMapper;
import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
@Service
public class HongBaoV2CountServiceImpl implements HongBaoV2CountService {
    @Resource
    private HongBaoV2CountMapper hongBaoV2CountMapper;
    @Resource
    private HongBaoMapper hongBaoMapper;
    @Resource
    private TaoBaoOrderMapper taoBaoOrderMapper;
    @Resource
    private OrderItemMapper orderItemMapper;
    @Resource
    private CommonOrderMapper commonOrderMapper;
    @Resource
    private CommonOrderGoodsMapper commonOrderGoodsMapper;
    @Resource
    private HongBaoOrderMapper hongBaoOrderMapper;
    @Resource
    private OrderMapper orderMapper;
    @Resource
    private CommonOrderService commonOrderService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private TaoBaoWeiQuanOrderMapper taoBaoWeiQuanOrderMapper;
    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("total");
            if (total == null) {
                map.put("total", 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("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("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;
    }
    @Override
    public List<Map<String, Object>> countHongBaoMoney(String channel, Integer dateType, Integer state,
            String year, String startTime, String endTime) throws Exception {
        List<Map<String, Object>> list = hongBaoV2CountMapper.countHongBaoMoney(channel, dateType, state, 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;
        }
    }
    @Override
    public List<Map<String, Object>> countHongBaoNum(String channel, Integer dateType, Integer state,
            String year, String startTime, String endTime) throws Exception {
        List<Map<String, Object>> list = hongBaoV2CountMapper.countHongBaoNum(channel, dateType, state, 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;
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserInfoCountServiceImpl.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.service.impl.count;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -34,7 +35,7 @@
    }
    
    @Override
    public double countAllMoney(Double rank) {
    public BigDecimal countAllMoney(Double rank) {
        return userInfoMapper.countAllMoney(rank);
    }
    
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -174,7 +174,8 @@
                    Integer hongBaoType = order.getHongBaoType();
                    // 邀请订单信息保护
                    if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
                            || HongBaoV2.TYPE_ERJI == hongBaoType) {
                            || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
                            || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
                        Map<String, String> titleMap = new HashMap<String, String>();
                        titleMap.put("content", "为保障用户隐私,商品信息已隐藏!");
                        titleMap.put("fontColor", "#888888");
@@ -277,14 +278,14 @@
                hongbaoInfo = "返利";
                order.setOrderOrigin("1");
                order.setHongBaoTypePic(CommonOrder.TYPE_FANLI);
            } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
                    || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
            } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) {
                // 分享
                hongbaoInfo = "奖金";
                order.setOrderOrigin("2");
                order.setHongBaoTypePic(CommonOrder.TYPE_SHARE);
            } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
                    || HongBaoV2.TYPE_ERJI == hongBaoType) {
                    || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
                    || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
                // 邀请
                hongbaoInfo = "奖金";
                order.setOrderOrigin("3");
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractAuditRecordServiceImpl.java
@@ -1,10 +1,16 @@
package com.yeshi.fanli.service.impl.user;
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.ExtractAuditRecordMapper;
import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
@@ -12,81 +18,247 @@
@Service
public class ExtractAuditRecordServiceImpl implements ExtractAuditRecordService {
    @Resource
    private ExtractAuditRecordMapper extractAuditRecordMapper;
    @Override
    public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key,
            String startTime, String endTime) {
    public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key, String startTime, String endTime) {
        return extractAuditRecordMapper.getList((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime);
    }
    @Override
    public int getCount (String key, String startTime, String endTime) {
    public int getCount(String key, String startTime, String endTime) {
        return extractAuditRecordMapper.getCount(key, startTime, endTime);
    }
    @Override
    public List<ExtractAuditRecord> getMyAuditedAllList(int pageIndex, int pageSize,
            String key,    Integer state, Long adminId) {
    public List<ExtractAuditRecord> getMyAuditedAllList(int pageIndex, int pageSize, String key, Integer state,
            Long adminId) {
        return extractAuditRecordMapper.getMyAuditedAllList((pageIndex - 1) * pageSize, pageSize, key, state, adminId);
    }
    @Override
    public int getMyAuditedAllCount(String key, Integer state, Long adminId) {
        return extractAuditRecordMapper.getMyAuditedAllCount(key, state, adminId);
    }
    @Override
    public List<ExtractAuditRecord> getMyAuditedTimeSlotList(int pageIndex, int pageSize,
            String key,    Integer state, Long adminId, Integer days) {
        return extractAuditRecordMapper.getMyAuditedTimeSlotList((pageIndex - 1) * pageSize, pageSize, key, state, adminId, days);
    public List<ExtractAuditRecord> getMyAuditedTimeSlotList(int pageIndex, int pageSize, String key, Integer state,
            Long adminId, Integer days) {
        return extractAuditRecordMapper.getMyAuditedTimeSlotList((pageIndex - 1) * pageSize, pageSize, key, state,
                adminId, days);
    }
    @Override
    public int getMyAuditedTimeSlotCount(String key, Integer state, Long adminId, Integer days) {
        return extractAuditRecordMapper.getMyAuditedTimeSlotCount(key, state, adminId, days);
    }
    @Override
    public int getMyAuditedCountWeek(Long adminId) {
        return extractAuditRecordMapper.getMyAuditedCountWeek(adminId);
    }
    @Override
    public int getMyAuditedCountMonth(Long adminId) {
        return extractAuditRecordMapper.getMyAuditedCountMonth(adminId);
    }
    @Override
    public int getMyAuditedCountToday(Long adminId) {
        return extractAuditRecordMapper.getMyAuditedCountToday(adminId);
    }
    @Override
    public List<ExtractAuditRecord> getByUidList(int pageIndex, int pageSize, Long uid) {
        return extractAuditRecordMapper.getByUidList((pageIndex - 1) * pageSize, pageSize, uid);
    }
    @Override
    public int getByUidCount(Long key) {
        return extractAuditRecordMapper.getByUidCount(key);
    }
    @Override
    public List<ExtractAuditRecord> getListbyExtractId(Long extractId) {
        return extractAuditRecordMapper.getListbyExtractId(extractId);
    }
    @Override
    public List<ExtractAuditRecord> getbyExtractId(Long extractId) {
        return extractAuditRecordMapper.getbyExtractId(extractId);
    }
    @Override
    public List<Map<String, Object>> countAuditTotal(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception{
        List<Map<String, Object>> list = extractAuditRecordMapper.countAuditTotal(state, type, years, startTime, endTime);
        if (list == null || list.size() == 0) {
            return list =  new ArrayList<Map<String, Object>>();
        }
        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>> countExtractMoney(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception{
        List<Map<String, Object>> list = extractAuditRecordMapper.countExtractMoney(state, type, years, startTime, endTime);
        if (list == null || list.size() == 0) {
            return list =  new ArrayList<Map<String, Object>>();
        }
        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>> countExtractApplyNumber(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception{
        List<Map<String, Object>> list = extractAuditRecordMapper.countExtractApplyNumber(state, type, years, startTime, endTime);
        if (list == null || list.size() == 0) {
            return list =  new ArrayList<Map<String, Object>>();
        }
        switch (type){
            case 1: // 按天处理
                return dayFactory(startTime, endTime, list);
            case 2: // 按月处理
                return monthFactory(list);
            case 3:
                return yearFactory(list);
            default:
                return null;
        }
    }
    
    
    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("total");
            if (total == null) {
                map.put("total", 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("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("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/user/UserActiveLogServiceImpl.java
@@ -89,18 +89,51 @@
        }
    }
    
    @Override
    public List<Object> countSameDayAndBuyGoodsByChannelAndBuyNum(String channel, Integer type, String years,
            String startTime, String endTime, Integer orderNum) throws Exception {
        List<Map<String, Object>> list = userActiveLogMapper.countSameDayAndBuyGoodsByChannelAndBuyNum(channel, type, years,
                startTime, endTime, orderNum);
        if (list == null || list.size() == 0) {
            return null;
        }
        switch (type){
            case 1: // 按天处理
                return dayFactory(startTime, endTime, list);
            case 2: // 按月处理
                return monthFactory(list);
            case 3:
                return yearFactory(list);
            default:
                return null;
        }
    }
    
    @Override
    public List<Object> getBuyProportion(String channel, Integer type, String years,
            String startTime, String endTime) throws Exception{
            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= countSameDayAndBuyGoodsByChannel(channel, type, years, startTime, endTime);
        // 统计渠道当日新增用户存在下单的用户数量
        List<Object> countListBuy=  null;
        if (orderNum <= 1){
            countListBuy = countSameDayAndBuyGoodsByChannel(channel, type, years, startTime, endTime);
        } else {
            countListBuy = countSameDayAndBuyGoodsByChannelAndBuyNum(channel, type, years, startTime, endTime, orderNum);
        }
        if (countListBuy == null){
            new ArrayList<Object>();
        }
        
        List<Object> listObject = new ArrayList<Object>();
    
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
New file
@@ -0,0 +1,34 @@
package com.yeshi.fanli.service.inter.count;
import java.util.List;
import java.util.Map;
public interface HongBaoV2CountService {
    /**
     * 统计总金额
     * @param channel 渠道
     * @param dateType 日期格式  日-1 月-2 年-3
     * @param state  状态
     * @param years  年份
     * @param startTime  开始时间
     * @param endTime      结束时间
     * @return
     */
    List<Map<String, Object>> countHongBaoMoney(String channel, Integer dateType, Integer state, String year,
            String startTime, String endTime) throws Exception;
    /**
     * 统计总金额
     * @param channel 渠道
     * @param dateType 日期格式  日-1 月-2 年-3
     * @param state  状态
     * @param years  年份
     * @param startTime  开始时间
     * @param endTime      结束时间
     * @return
     */
    List<Map<String, Object>> countHongBaoNum(String channel, Integer dateType, Integer state, String year,
            String startTime, String endTime) throws Exception;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/count/UserInfoCountService.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.inter.count;
import java.math.BigDecimal;
import java.util.List;
@@ -27,7 +28,7 @@
     * @param minMoney
     * @return
     */
    public double countAllMoney(Double minMoney);
    public BigDecimal countAllMoney(Double minMoney);
    /**
     * 统计流失用户数量:( num 天未使用登录并且无任何资金流动的账号数量)
fanli/src/main/java/com/yeshi/fanli/service/inter/user/ExtractAuditRecordService.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.service.inter.user;
import java.util.List;
import java.util.Map;
import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
@@ -109,4 +110,44 @@
    public List<ExtractAuditRecord> getListbyExtractId(Long extractId);
    public List<ExtractAuditRecord> getbyExtractId(Long extractId);
    /**
     * 统计审核次数
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String, Object>> countAuditTotal(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception;
    /**
     * 统计申请提的现总金额
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String, Object>> countExtractMoney(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception;
    /**
     * 统计申请提的现总次数
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String, Object>> countExtractApplyNumber(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserActiveLogService.java
@@ -51,7 +51,21 @@
     * @return
     * @throws Exception
     */
    public List<Object> getBuyProportion(String channel, Integer type, String years, String startTime, String endTime)
    public List<Object> getBuyProportion(String channel, Integer type, String years, String startTime, String endTime,Integer orderNum)
            throws Exception;
    /**
     * 根据渠道   统计当日新增用户有购买行为的订单数量大于3
     * @param channel
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @param orderNum
     * @return
     * @throws Exception
     */
    public List<Object> countSameDayAndBuyGoodsByChannelAndBuyNum(String channel, Integer type, String years,
            String startTime, String endTime, Integer orderNum) throws Exception;
}