yujian
2019-11-27 e915a40b79552686b8d8a8cfc48a341fa2c0f518
订单统计 + 资金明细
20个文件已修改
2个文件已添加
805 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java 335 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/money/UserMoneyDetailMapper.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/money/UserMoneyDetailMapper.xml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/money/UserMoneyDetailService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/money/extract/ExtractService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/order/OrderCountVO.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -1117,7 +1117,8 @@
    @RequestMapping(value = "downAutoExtractTxt")
    public void downAutoExtractTxt(String callback, HttpServletResponse response, PrintWriter out) {
        try {
            List<String> list = extractService.getAutoExtractOpenIds();
            //List<String> list = extractService.getAutoExtractOpenIds();
            List<String> list = extractService.getAutoExtractOpenIdsTo1212();
            if (list == null || list.size() <= 1) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
                return;
@@ -1195,7 +1196,8 @@
    @RequestMapping(value = "preAutoUser")
    public void preAutoUser(String callback, Integer pageIndex, PrintWriter out) {
        try {
            List<UserInfo> list = extractService.preAutoUser();
            //List<UserInfo> list = extractService.preAutoUser();
            List<UserInfo> list = extractService.preAutoUserTo1212();
            if (list == null || list.isEmpty()) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
                return;
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java
@@ -110,8 +110,8 @@
            date = new Date(ca.getTimeInMillis() - 1);
        }
        List<UserMoneyDetailHistoryVO> list = userMoneyDetailService.listUserMoneyDetailForClient(uid, index, 0, date);
        long count = userMoneyDetailService.countUserMoneyDetailForClient(uid, index, 0, date);
        List<UserMoneyDetailHistoryVO> list = userMoneyDetailService.listUserMoneyDetailForClient(uid, index, type, date);
        long count = userMoneyDetailService.countUserMoneyDetailForClient(uid, index, type, date);
        GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
        gsonBuilder.registerTypeAdapter(UserMoneyDetailTypeEnum.class, new TypeAdapter<UserMoneyDetailTypeEnum>() {
            @Override
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
New file
@@ -0,0 +1,335 @@
package com.yeshi.fanli.controller.client.v2;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.exception.order.CommonOrderException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
import com.yeshi.fanli.vo.user.UserInfoExtraVO;
import com.yeshi.fanli.vo.user.UserSettingsVO;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("api/v2/user/order")
public class UserOrderControllerV2 {
    @Resource
    private ConfigService configService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private CommonOrderService commonOrderService;
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
    @Resource
    private RedisManager redisManager;
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    /**
     * 订单列表
     *
     * @param acceptData
     * @param page
     * @param uid
     * @param state
     *            状态:0全部 1-未到账 2-已到账 3-已失效 4已收货
     * @param type
     *            类型:1-返利订单 2-分享订单 3-邀请订单
     * @param orderState
     *            1有效订单 2 维权订单 3失效订单
     * @param orderNo
     *            订单号
     * @param startTime
     *            起始时间
     * @param endTime
     *            结束时间
     * @param slotTime
     *            时间段:1-最近三天 2-最近七天 3最近半月 4本月 5近三月 6近半年
     * @param dateType
     *            1-今日 2-昨天 3-本月 4-上个月 |
     * @param needCount
     * @param out
     */
    @RequestMapping(value = "getOrderList", method = RequestMethod.POST)
    public void getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, String type,
            Integer orderState, String orderNo,    String startTime, String endTime, Integer slotTime,
            Integer dateType, Integer goodsType, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        // 转换状态
        if (state != null) {
            if (state == 0) {
                state = null; // 所有
            } else if (state == 4) {
                state = null;
                orderState = 4; // 已收货
            } else if (state == 5) {
                state = null;
                orderState = 2; // 已维权
            }
        }
        if (state != null && orderState != null && (orderState == 2 || orderState == 3)) {
            state = null;
        }
        // 订单类型
        Integer orderType = null;
        if (StringUtil.isNullOrEmpty(type)) {
            orderType = null;
        } else if ("0".equalsIgnoreCase(type)){
            orderType = Integer.parseInt(type);
        }
        // 筛选时间
        if (slotTime != null) {
            SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
            try {
                endTime = sd.format(new Date());
                startTime = convertDate(slotTime, endTime);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (endTime != null && endTime.trim().length() > 0) {
            endTime += " 23:59:59";
        }
        try {
            // 筛选结果顶部统计
            String validMoney = "0.00";
            String invalidMoney = "0.00";
            if (dateType != null) {
                BigDecimal predictMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, orderType, 1);
                if (predictMoney != null)
                    validMoney = predictMoney.setScale(2, BigDecimal.ROUND_DOWN).toString();
                BigDecimal postSaleMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, orderType, 2);
                if (postSaleMoney != null)
                    invalidMoney = postSaleMoney.setScale(2, BigDecimal.ROUND_DOWN).toString();
                if (dateType == 4)
                    dateType = 5; // 新版查询本月到账
            }
            // 查询列表
            List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, orderState,
                    orderNo, startTime, endTime, dateType, goodsType);
            // 统计总数
            long count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo, startTime,
                    endTime, dateType, goodsType);
            // 判断是否需要显示订单找回提示   8秒内请求3次触发
            String orderFindUrl = null;
            if (state ==null && page == 1) {
                if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 8, 4)||count==0L) {
                    orderFindUrl = configService.get("order_find_notify_url");
                }
            }
            JSONObject data = new JSONObject();
            data.put("count", count);
            data.put("result_list", JsonUtil.getApiCommonGson().toJson(list));
            data.put("helpUrl", configService.get("order_list_help"));
            data.put("validMoney", validMoney);
            data.put("invalidMoney", invalidMoney);
            data.put("findOrderHelpUrl", orderFindUrl);
            out.print(JsonUtil.loadTrueResult(data));
        } catch (CommonOrderException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult(1, "查询失败"));
            e.printStackTrace();
            LogHelper.errorDetailInfo(e);
        }
    }
    /**
     * 时间转换
     *
     * @param slotTime
     * @param startTime
     * @return
     * @throws Exception
     */
    private String convertDate(Integer slotTime, String endTime) throws Exception {
        String startTime = null;
        switch (slotTime) {
        case 1: // 最近三天
            startTime = DateUtil.reduceDay(2, endTime);
            break;
        case 2: // 最近七天
            startTime = DateUtil.reduceDay(6, endTime);
            break;
        case 3: // 最近15天 (半月)
            startTime = DateUtil.reduceDay(14, endTime);
            break;
        case 4: // 最近三十天 (本月)
            startTime = DateUtil.reduceDay(29, endTime);
            break;
        case 5: // 最近九十天(近三月)
            startTime = DateUtil.reduceDay(3 * 30 - 1, endTime);
            break;
        case 6: // 最近一百八十天(近半年)
            startTime = DateUtil.reduceDay(6 * 30 - 1, endTime);
            break;
        default:
            break;
        }
        return startTime;
    }
    /**
     * 用户订单统计
     *
     * @param acceptData
     * @param uid
     *            用户id
     * @param out
     */
    @RequestMapping(value = "getOrderCount", method = RequestMethod.POST)
    public void getOrderCount(AcceptData acceptData, Long uid, Integer type, PrintWriter out) {
        if (uid == null || type == null) {
            out.print(JsonUtil.loadFalseResult(1, "请求参数不正确"));
            return;
        }
        try {
            UserInfo user = userInfoService.selectByPKey(uid);
            if (user == null) {
                out.print(JsonUtil.loadFalseResult(1, "用户不存在"));
                return;
            }
            UserInfo userInfo = UserUtil.filterForClientUser(user);
            UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());
            if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
                userInfo.setRankIcon(userInfoExtra.getUserRank().getIcon());
                userInfo.setRankNamePicture(userInfoExtra.getUserRank().getPicture());
            }
            JSONObject data = new JSONObject();
            data.put("userInfo", userInfo);
            if (type == 0) {
                OrderCountVO total = commonOrderService.getOrderCount(uid, 1, type);
                data.put("total", total.getSelf() + total.getShared() + total.getInvite());
                data.put("self", total.getSelf());
                data.put("shared", total.getShared());
                data.put("invite", total.getInvite());
            } else {
                data.put("total", 0);
                data.put("self", 0);
                data.put("shared", 0);
                data.put("invite", 0);
            }
            // 今天
            OrderCountVO today = commonOrderService.getOrderCount(uid, 1, type);
            today.setTotal(today.getSelf() + today.getShared() + today.getInvite());
            // 昨天
            OrderCountVO yesterday = commonOrderService.getOrderCount(uid, 2, type);
            yesterday.setTotal(yesterday.getSelf() + yesterday.getShared() + yesterday.getInvite());
            // 本月
            OrderCountVO thisMonth = commonOrderService.getOrderCount(uid, 3, type);
            thisMonth.setTotal(thisMonth.getSelf() + thisMonth.getShared() + thisMonth.getInvite());
            // 上月
            OrderCountVO lastMonth = commonOrderService.getOrderCount(uid, 4, type);
            lastMonth.setTotal(lastMonth.getSelf() + lastMonth.getShared() + lastMonth.getInvite());
            data.put("today", today);
            data.put("yesterday", yesterday);
            data.put("thisMonth", thisMonth);
            data.put("lastMonth", lastMonth);
            out.print(JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult(1, "获取信息失败"));
            e.printStackTrace();
        }
    }
    /**
     * 统计奖金
     * @param acceptData
     * @param uid
     * @param dateType  1-今日 2-昨天 3-本月 4-上个月
     * @param out
     */
    @RequestMapping(value = "getBonusCount", method = RequestMethod.POST)
    public void getBonusCount(AcceptData acceptData, Long uid, Integer dateType, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        boolean show = false;
        UserSettingsVO settings = null;
        try {
            settings = userCustomSettingsService.getMySettings(uid);
        } catch (Exception e) {
        }
        // 验证是否显示模块
        if (settings != null && settings.getNoBonusCount()!= null) {
            if(settings.getNoBonusCount() == 1) {
                show = false;
            } else if(settings.getNoBonusCount() == 0) {
                show = true;
            }
        } else {
            show = hongBaoV2CountService.getHongBaoCount(uid, null) > 0;
        }
        BigDecimal selfMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, 1, null);
        BigDecimal shareMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, 2, null);
        BigDecimal inviteMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, 3, null);
        JSONObject data = new JSONObject();
        data.put("show", show);
        data.put("selfMoney", selfMoney.setScale(2,BigDecimal.ROUND_DOWN).toString());
        data.put("shareMoney", shareMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
        data.put("inviteMoney", inviteMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
        out.print(JsonUtil.loadTrueResult(data));
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java
@@ -101,6 +101,10 @@
    // 累计提成订单数量(包含无效订单)
    int getTotalTiChengCount(Long uid);
    // 累计提成红包数量(包含无效)
    long getHongBaoCount(@Param("uid") Long uid, @Param("type") Integer type);
    /**
     * 统计未失效订单数量
@@ -205,5 +209,17 @@
     */
    long countValidOrderTeamUserByUid(@Param("uid") Long uid, @Param("date") String date,
            @Param("payment") BigDecimal payment);
    /**
     * 查询用户个类型预计奖金
     * @param uid
     * @param dateType 日期类型
     * @param hbType   红包类型
     * @return
     */
    BigDecimal getRewardMoneyByDate(@Param("uid") Long uid, @Param("day")Integer dateType,
            @Param("type") Integer hbType, @Param("orderState") Integer orderState);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
@@ -208,4 +208,13 @@
     */
    List<UserInfo> getAutoExtractUser(@Param("start") int start, @Param("count") int count, @Param("money") BigDecimal money,
            @Param("beganDate") String beganDate, @Param("endDate") String endDate);
    /**
     * 查询满足自动提现用户
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> getAutoExtractUserTo1212(@Param("start") int start, @Param("count") int count);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/money/UserMoneyDetailMapper.java
@@ -21,7 +21,7 @@
     * @return
     */
    List<UserMoneyDetail> selectByUidWithIndexId(@Param("uid") Long uid, @Param("id") Long id,
            @Param("count") int count);
            @Param("count") int count, @Param("type") Integer type);
    /**
     * 获取用户总共有多少记录数据
@@ -29,7 +29,7 @@
     * @param uid
     * @return
     */
    Long selectCountByUid(@Param("uid") Long uid);
    Long selectCountByUid(@Param("uid") Long uid, @Param("type") Integer type);
    /**
     * 按最大的创建时间和用户ID检索列表
@@ -39,7 +39,7 @@
     * @return
     */
    List<UserMoneyDetail> selectByMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date,
            @Param("count") int count);
            @Param("count") int count, @Param("type") Integer type);
    /**
     * 按最大的创建时间和用户ID检索数量
@@ -48,7 +48,7 @@
     * @param date
     * @return
     */
    Long selectCountByUidAndMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date);
    Long selectCountByUidAndMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date, @Param("type") Integer type);
    /**
     * 按用户ID和最大时间检索月份的数量
@@ -57,7 +57,7 @@
     * @param maxDate
     * @return
     */
    int selectMonthCountByUid(@Param("uid") Long uid, @Param("date") Date maxDate);
    int selectMonthCountByUid(@Param("uid") Long uid, @Param("date") Date maxDate, @Param("type") Integer type);
    /**
     * 统计某个月份的收入与支出
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java
@@ -10,6 +10,7 @@
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
public interface CommonOrderMapper extends BaseMapper<CommonOrder> {
@@ -79,6 +80,14 @@
    Map<String, BigDecimal> countHistoryOrder(@Param("uid") Long uid, @Param("day") Integer day,
            @Param("source") Integer source);
    /**
     * 统计有效订单数量
     * @param uid
     * @return
     */
    OrderCountVO getOrderCount(@Param("uid") Long uid, @Param("day")Integer day, @Param("source") Integer source);
    /**
     * 昨日总订单-根据红包类型 自购 邀请 分享
     * 
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -711,5 +711,18 @@
            AND u.`wx_open_id` NOT LIKE 'o_b9%'
        LIMIT #{start},#{count}
    </select>
    <select id="getAutoExtractUserTo1212" resultMap="BaseResultMap">
        SELECT u.* FROM (SELECT v2.`hb_uid` FROM `yeshi_ec_hongbao_v2` v2
        WHERE <![CDATA[v2.`hb_create_time` > '2019-01-01' AND v2.`hb_create_time` < '2019-06-18']]>
        GROUP BY hb_uid)h
        LEFT JOIN `yeshi_ec_user_info_extra` t ON t.`uie_uid` = h.hb_uid
        LEFT JOIN  `yeshi_ec_user` u ON u.`id` = t.`uie_uid`
        WHERE <![CDATA[ t.uie_active_time < '2019-06-19']]> AND (t.`uie_mark` IS NULL OR t.`uie_mark` = '')
            AND u.`state` = 0 AND u.`my_hongBao`<![CDATA[> 1]]>
            AND u.`wx_open_id` IS NOT NULL AND <![CDATA[LENGTH(TRIM(u.`wx_open_id`)) > 0]]>
            AND u.`wx_open_id` NOT LIKE 'o_b9%'
        LIMIT #{start},#{count}
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -196,6 +196,21 @@
        OR h.`hb_type`=6
        OR h.`hb_type`=7)
    </select>
    <select id="getHongBaoCount" resultType="Long">
        SELECT IFNULL(count(v2.`hb_id`),0) FROM `yeshi_ec_hongbao_v2` v
        WHERE v.`hb_uid`=#{uid}
        <if test="type == 1"> <!-- 自购订单 -->
            AND (v.hb_type =1 or v.hb_type =2)
        </if>
        <if test="type == 2"> <!-- 分享订单 -->
            AND v.`hb_type` = 20
        </if>
        <if test="type == 3"> <!-- 邀请订单 -->
            AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22)
        </if>
    </select>
    <select id="countValidNumberByUid" resultType="java.lang.Long">
        <!--统计有效订单数量 -->
@@ -396,5 +411,50 @@
            AND v2.`hb_create_time` > #{date}
            AND (t2.`hb_type` = 1 OR t2.`hb_type` = 20))A
    </select>
    <select id="getRewardMoneyByDate" resultType="BigDecimal">
        SELECT COALESCE(SUM(v2.`hb_money`),0)AS totalmoney FROM (
            SELECT * FROM yeshi_ec_hongbao_v2 v
            WHERE v.hb_state <![CDATA[<>]]> 4 AND v.`hb_uid`= 389677
            <if test="type == 1"> <!-- 自购订单 -->
                AND (v.hb_type =1 or v.hb_type =2)
            </if>
            <if test="type == 2"> <!-- 分享订单 -->
                AND v.`hb_type` = 20
            </if>
            <if test="type == 3"> <!-- 邀请订单 -->
                AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22)
            </if>
            <if test="type == 2 and day == 4"> <!-- 本月月将要到账 -->
                AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v.`hb_pre_get_time`, '%Y%m')) = 1
            </if>
            <if test="type == 3 and day == 4"> <!-- 本月将要到账 -->
                AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v.`hb_pre_get_time`, '%Y%m')) = 1
            </if>
        )v2
        LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id`
        WHERE co.`co_state`<![CDATA[<>]]> 4
        <if test="day == 1"> <!-- 今天产生-->
            AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW())
        </if>
        <if test="day == 2"> <!-- 昨天产生-->
            AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1
        </if>
        <if test="day == 3"> <!-- 本月产生 -->
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="day == 4 and type == 1"> <!-- 上月产生自购 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1
        </if>
        <if test="orderState ==  1"> <!-- 有效订单: 整个订单有效 -->
            AND <![CDATA[co.`co_state` <> 3]]>
            AND (co.co_state_whole_order = 1 or co.co_state_whole_order = 2)
        </if>
        <if test="orderState ==  2"> <!-- 维权订单 -->
            AND co.co_state = 3
        </if>
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/money/UserMoneyDetailMapper.xml
@@ -47,32 +47,39 @@
            <=
        ]]>
        (SELECT d.`umd_createtime` FROM yeshi_ec_user_money_detail d WHERE
        d.`umd_id`=#{id}) and d.umd_uid=#{uid}  and d.umd_show=1 order by d.`umd_createtime`
        d.`umd_id`=#{id}) and d.umd_uid=#{uid}  and d.umd_show=1
        <if test="type == 1">and d.umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and d.umd_money<![CDATA[<=]]>0</if>
        order by d.`umd_createtime`
        desc,d.umd_id desc limit #{count}
    </select>
    <select id="selectCountByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">SELECT count(umd_id) FROM yeshi_ec_user_money_detail
        where umd_uid=#{uid} and umd_show=1 </select>
        where umd_uid=#{uid} and umd_show=1
        <if test="type == 1">and umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and umd_money<![CDATA[<=]]>0</if>
    </select>
    <select id="selectByMaxCreateTime" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_user_money_detail d WHERE d.umd_uid=#{uid} and d.umd_show=1 and
        d.`umd_createtime`<![CDATA[
            <=
        ]]>
        #{date} order by d.`umd_createtime` desc,d.umd_id desc limit #{count}
        FROM yeshi_ec_user_money_detail d WHERE d.umd_uid=#{uid} and d.umd_show=1 and d.`umd_createtime`<![CDATA[<=]]>#{date}
        <if test="type == 1">and d.umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and d.umd_money<![CDATA[<=]]>0</if>
        order by d.`umd_createtime` desc,d.umd_id desc limit ${count}
    </select>
    <select id="selectCountByUidAndMaxCreateTime" resultType="java.lang.Long">SELECT
        count(umd_id) FROM yeshi_ec_user_money_detail where umd_uid=#{uid}  and umd_show=1  and
        `umd_createtime`<![CDATA[
            <=
        ]]>
        #{date}
        `umd_createtime`<![CDATA[<=]]>#{date}
        <if test="type == 1">and umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and umd_money<![CDATA[<=]]>0</if>
    </select>
    <select id="selectMonthCountByUid" resultType="java.lang.Integer">SELECT
        COUNT(*) FROM (SELECT * FROM yeshi_ec_user_money_detail d WHERE
        d.`umd_uid`=#{uid} and d.umd_show=1  and d.`umd_createtime` <![CDATA[<=]]>
        #{date} group by DATE_FORMAT(d.`umd_createtime`,'%y-%m')) a
        #{date}
        <if test="type == 1">and d.umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and d.umd_money<![CDATA[<=]]>0</if>
        group by DATE_FORMAT(d.`umd_createtime`,'%y-%m')) a
    </select>
    <select id="selectMonthMoneyByUid" resultMap="UserMonthMoneyMap">
        <foreach collection="dateFormat" index="index" item="item"
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -159,6 +159,12 @@
            select="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.selectByPrimaryKey" />
    </resultMap>
    <resultMap id="OrderCountMap" type="com.yeshi.fanli.vo.order.OrderCountVO" >
        <result column="self" property="self" jdbcType="BIGINT" />
        <result column="shared" property="shared" jdbcType="BIGINT" />
        <result column="invite" property="invite" jdbcType="BIGINT" />
    </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,co_trade_id,co_state_desc
    </sql>
    
@@ -390,28 +396,28 @@
        </if>
        <if test="day != null and day == 3">
            <!-- 本月 -->
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') =
            DATE_FORMAT(CURDATE(),'%Y%m')
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="day != null and day == 4">
            <!-- 上月 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),
            DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),    DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
        </if>
    </sql>
    <sql id="SELECT_PARAM_HONGBAO_TYPE">
        <if test="type != null and type == 1">
            <!-- 自购订单 -->
        <if test="type != null and type == 1"> <!-- 自购订单 -->
            AND (v2.hb_type =1 or v2.hb_type =2)
        </if>
        <if test="type != null and type == 2">
            <!-- 分享订单 -->
        <if test="type != null and type == 2"> <!-- 分享订单 -->
            AND v2.`hb_type` = 20
        </if>
        <if test="type != null and type == 3">
            <!-- 邀请订单 -->
            AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR
            v2.`hb_type` = 21 OR v2.`hb_type` = 22)
        <if test="type != null and type == 3"> <!-- 邀请订单 -->
            AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR v2.`hb_type` = 21 OR v2.`hb_type` = 22)
        </if>
        <if test="type == 2 and day == 5"> <!-- 本月月将要到账 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_pre_get_time`, '%Y%m')) = 1
        </if>
        <if test="type == 3 and day == 5"> <!-- 本月将要到账 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_pre_get_time`, '%Y%m')) = 1
        </if>
    </sql>
    <sql id="SELECT_PARAM_HONGBAO_STATE">
@@ -604,6 +610,53 @@
        GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A
    </select>
    <sql id="OrderCountQuery">
        WHERE co.`co_state_whole_order`<![CDATA[<>]]>3
        <if test="day == 1"> <!-- 今天 -->
            AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW())
        </if>
        <if test="day == 2"> <!-- 昨天 -->
            AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1
        </if>
        <if test="day == 3"> <!-- 本月 -->
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="day == 4"> <!-- 上月 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
        </if>
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
    </sql>
    <select id="getOrderCount" resultMap="OrderCountMap">
        SELECT sum(self) as self,sum(shared) as shared,sum(invite) as invite from
        (
            SELECT IFNULL(COUNT(co_order_no),0)AS self,0 AS shared,0 AS invite FROM
                (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND v.`hb_type` = 1)v2
                LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
                LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id`
                <include refid="OrderCountQuery"></include>
                GROUP BY co.`co_order_no`,co.`co_source_type`)A
            UNION ALL
            SELECT 0 AS self,IFNULL(COUNT(co_order_no),0)AS shared,0 AS invite FROM
                (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND v.`hb_type` = 20)v2
                LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
                LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id`
                <include refid="OrderCountQuery"></include>
                GROUP BY co.`co_order_no`,co.`co_source_type`)A
            UNION ALL
            SELECT 0 AS self,0 AS shared,IFNULL(COUNT(co_order_no),0)AS invite FROM
                (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v
                     WHERE v.`hb_uid`= ${uid}
                     AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22))v2
                LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
                LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id`
                <include refid="OrderCountQuery"></include>
                GROUP BY co.`co_order_no`,co.`co_source_type`)A
        )B
    </select>
    <select id="countUserOrderToApp" resultType="Long">
            <!-- 有效订单 -->
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -238,6 +238,11 @@
    public int getTotalTiChengCount(Long uid) {
        return hongBaoV2CountMapper.getTotalTiChengCount(uid);
    }
    @Override
    public long getHongBaoCount(Long uid,Integer type) {
        return hongBaoV2CountMapper.getHongBaoCount(uid, type);
    }
    @Override
    public long countValidNumberByUid(Long uid, Integer dateType) {
@@ -337,4 +342,10 @@
    public long countValidOrderTeamUserByUid(Long uid, String date, BigDecimal payment) {
        return hongBaoV2CountMapper.countValidOrderTeamUserByUid(uid, date, payment);
    }
    @Override
    public BigDecimal getRewardMoneyByDate(Long uid, Integer dateType, Integer hbType, Integer orderState) {
        return hongBaoV2CountMapper.getRewardMoneyByDate(uid, dateType, hbType, orderState);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java
@@ -39,17 +39,18 @@
    }
    @Override
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,int type, Date maxTime) {
        //TODO 增加type筛选
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Integer type, Date maxTime) {
        List<UserMoneyDetailHistoryVO> finalList = new ArrayList<>();
        List<UserMoneyDetail> list = null;
        if (userMoneyDetailId == null) {// 首次请求
            if (maxTime == null)// 没有筛选时间
            {
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid,
                        new Date(System.currentTimeMillis() + 1000 * 60 * 60L), 20);
                Date date = new Date(System.currentTimeMillis() + 1000 * 60 * 60L);
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid,    date, 20, type);
                System.out.println("maxTime == null");
            } else {// 筛选了时间
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid, maxTime, 20);
                System.out.println("maxTime != null");
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid, maxTime, 20, type);
            }
            if (list != null && list.size() > 0) {
@@ -73,7 +74,7 @@
        } else {// 二次请求
            int size = 21;
            List<UserMoneyDetail> tempList = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size);
            List<UserMoneyDetail> tempList = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size, type);
            Set<Date> dateSet = new HashSet<>();// 用于储存是否在同一时间上面(精确到秒)
            if (tempList.size() > 0) {
                for (UserMoneyDetail umd : tempList) {
@@ -84,7 +85,7 @@
                while (dateSet.size() == 1 && tempList2.size() != tempList.size() && size < 40) {// 只有一个时间点的数据
                    tempList = tempList2;
                    size += 10;
                    tempList2 = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size);
                    tempList2 = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size, type);
                    dateSet.clear();
                    for (UserMoneyDetail umd : tempList2) {
                        dateSet.add(umd.getCreateTime());
@@ -192,19 +193,19 @@
    }
    @Override
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,int type, Date maxTime) {
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,Integer type, Date maxTime) {
        //TODO 增加type筛选
        long monthCount = 0L;
        long detailCount = 0L;
        // 未通过时间筛选,查询所有
        if (maxTime == null) {
            detailCount = userMoneyDetailMapper.selectCountByUid(uid);
            detailCount = userMoneyDetailMapper.selectCountByUid(uid, type);
            // 用于表示当前所有
            monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid,
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60L), type);
        } else {// 通过时间筛选了的,需要查询所有
            detailCount = userMoneyDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime);
            monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid, maxTime);
            detailCount = userMoneyDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime, type);
            monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid, maxTime, type);
        }
        return monthCount + detailCount;
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java
@@ -1086,6 +1086,114 @@
        }
        return listOpendIDs;
    }
    @Override
    public List<UserInfo> preAutoUserTo1212() throws Exception {
        int page = 0;
        int pageSize = 100;
        int maxSize = 300;
        Date nowDate = new Date();
        // 条件3:距离上一次成功领取微信红包已经超过了30天时间,可在第31天再次下发;
        String receivedDate = DateUtil.reduceDayTostring(30, nowDate);
        // 条件4:距离上一次未成功领取微信红包已经超过了15天时间,可在第16天再次下发;
        String refundDate = DateUtil.reduceDayTostring(15, nowDate);
        // 余额最低限制
        List<UserInfo> list = new ArrayList<UserInfo>();
        while (true) {
            // 查询满足条件 1、2 的uid
            List<UserInfo> listUser = userInfoService.getAutoExtractUserTo1212(page * pageSize, pageSize);
            if (listUser == null || listUser.isEmpty())
                break;
            List<Long> listId = new ArrayList<Long>();
            for (UserInfo userInfo : listUser) {
                listId.add(userInfo.getId());
            }
            // 查询记录是否满足
            List<Long> listValid = extractWeiXinRecordService.getValidUsers(listId, receivedDate, refundDate);
            if (listValid == null || listValid.isEmpty()) {
                page++;
                continue;
            }
            for (Long uid : listValid) {
                if (list.size() >= maxSize)
                    break;
                for (UserInfo userInfo : listUser) {
                    if (list.size() >= maxSize)
                        break;
                    if (userInfo.getId().longValue() == uid.longValue()) {
                        list.add(userInfo);
                        break;
                    }
                }
            }
            if (list.size() >= maxSize)
                break;
            page++;
        }
        return list;
    }
    @Override
    public List<String> getAutoExtractOpenIdsTo1212() throws Exception {
        int page = 0;
        int pageSize = 100;
        int maxSize = 301; // appId + 实际openid300个
        Date nowDate = new Date();
        // 条件3:距离上一次成功领取微信红包已经超过了30天时间,可在第31天再次下发;
        String receivedDate = DateUtil.reduceDayTostring(30, nowDate);
        // 条件4:距离上一次未成功领取微信红包已经超过了15天时间,可在第16天再次下发;
        String refundDate = DateUtil.reduceDayTostring(15, nowDate);
        // 提现金额
        BigDecimal money = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MONEY);
        // 余额最低限制
        BigDecimal minSurplus = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MIN_SURPLUS);
        List<String> listOpendIDs = new ArrayList<String>();
        // 首行appID
        listOpendIDs.add(Constant.getWXAccount(null, null).getAppId());
        while (true) {
            // 查询满足条件 1、2 的uid
            List<UserInfo> listUser = userInfoService.getAutoExtractUserTo1212(page * pageSize, pageSize);
            if (listUser == null || listUser.isEmpty())
                break;
            List<Long> listId = new ArrayList<Long>();
            for (UserInfo userInfo : listUser) {
                listId.add(userInfo.getId());
            }
            // 查询记录是否满足
            List<Long> listValid = extractWeiXinRecordService.getValidUsers(listId, receivedDate, refundDate);
            if (listValid == null || listValid.isEmpty()) {
                page++;
                continue;
            }
            for (Long uid : listValid) {
                UserInfo userInfo = subHongBaoByUid(uid, money, minSurplus);
                if (userInfo != null) {
                    listOpendIDs.add(userInfo.getWxOpenId());
                    if (listOpendIDs.size() >= maxSize)
                        break;
                }
            }
            if (listOpendIDs.size() >= maxSize)
                break;
            page++;
        }
        return listOpendIDs;
    }
    @Transactional(rollbackFor = Exception.class)
    private UserInfo subHongBaoByUid(Long uid, BigDecimal money, BigDecimal minSurplus) {
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -72,6 +72,7 @@
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.order.CommonOrderGoodsVO;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
import com.yeshi.fanli.vo.order.WeiQuanInfo;
import net.sf.json.JSONObject;
@@ -798,6 +799,11 @@
    public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) {
        return commonOrderMapper.countHistoryOrder(uid, day, source);
    }
    @Override
    public OrderCountVO getOrderCount(Long uid, Integer day, Integer source) {
        return commonOrderMapper.getOrderCount(uid, day, source);
    }
    @Override
    public long countBonusOrderNumber(Long uid, Integer type, Integer day, String startTime, String endTime,
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java
@@ -656,4 +656,10 @@
        return userInfoMapper.getAutoExtractUser(start, count, minSurplus, beganDate, endDate);
    }
    @Override
    public List<UserInfo> getAutoExtractUserTo1212(int start, int count) {
        return userInfoMapper.getAutoExtractUserTo1212(start, count);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
@@ -229,6 +229,23 @@
     * @param payment
     * @return
     */
    public long countValidOrderTeamUserByUid(Long uid, String date, BigDecimal payment);
    public long countValidOrderTeamUserByUid(Long uid, String date, BigDecimal payment);
    /**
     * 统计不同时间:奖励
     * @param uid
     * @param dateType
     * @param hbType
     * @return
     */
    public BigDecimal getRewardMoneyByDate(Long uid, Integer dateType, Integer hbType, Integer orderState);
    /**
     * 统计红包个数
     * @param uid
     * @param type 红包类型
     * @return
     */
    public long getHongBaoCount(Long uid, Integer type);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/money/UserMoneyDetailService.java
@@ -33,7 +33,7 @@
     * @param maxTime
     * @return
     */
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, int type, Date maxTime);
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Integer type, Date maxTime);
    /**
     * 客户端查询用户的资金记录的条数(计算月统计)
@@ -43,7 +43,7 @@
     * @param maxTime
     * @return
     */
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,int type, Date maxTime);
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,Integer type, Date maxTime);
    /**
     * 资金明细详情列表(老版本)
fanli/src/main/java/com/yeshi/fanli/service/inter/money/extract/ExtractService.java
@@ -134,5 +134,9 @@
     * @throws Exception
     */
    public List<UserInfo> preAutoUser() throws Exception;
    public List<String> getAutoExtractOpenIdsTo1212() throws Exception;
    public List<UserInfo> preAutoUserTo1212() throws Exception;
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java
@@ -13,6 +13,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.exception.order.CommonOrderException;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
import net.sf.json.JSONObject;
@@ -353,4 +354,13 @@
     */
    public long count24HValidOrderByUid(Long uid, Date minTime);
    /**
     * 订单统计有效数量
     * @param uid
     * @param day
     * @param source
     * @return
     */
    public OrderCountVO getOrderCount(Long uid, Integer day, Integer source);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java
@@ -190,4 +190,12 @@
     */
    public List<UserInfo> getAutoExtractUser(int page, int count, BigDecimal minSurplus, String beganDate,String endDate);
    /**
     * 双12预售开启时,开启对休眠老用户的唤醒工作,在2019.1.1到2019.6.18期间产生过订单,并且2019.6.18号后未再活跃,并且账户余额大于1元,并且绑定了微信的用户有2468人
     * @param start
     * @param count
     * @return
     */
    public List<UserInfo> getAutoExtractUserTo1212(int start, int count);
}
fanli/src/main/java/com/yeshi/fanli/vo/order/OrderCountVO.java
New file
@@ -0,0 +1,34 @@
package com.yeshi.fanli.vo.order;
public class OrderCountVO {
    // 总计
    private long total;
    private long self;
    private long shared;
    private long invite;
    public long getTotal() {
        return total;
    }
    public void setTotal(long total) {
        this.total = total;
    }
    public long getSelf() {
        return self;
    }
    public void setSelf(long self) {
        this.self = self;
    }
    public long getShared() {
        return shared;
    }
    public void setShared(long shared) {
        this.shared = shared;
    }
    public long getInvite() {
        return invite;
    }
    public void setInvite(long invite) {
        this.invite = invite;
    }
}