admin
2019-09-25 66c70566b5437babca6d01b6c476c7b839aa83ff
修复淘宝授权bug,修复我的页面分享奖金与邀请奖金统计
10个文件已修改
450 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoOrder.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeOrderApiUtil.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java
@@ -66,7 +66,6 @@
    @RequestMapping(value = "tb")
    public void tb(String code, String state, HttpServletRequest request, HttpServletResponse response) {
        LogHelper.test("淘宝授权回调:" + code + ":" + state);
        if (StringUtil.isNullOrEmpty(code) || StringUtil.isNullOrEmpty(state)) {
            LogHelper.error("淘宝授权回调出错");
@@ -77,6 +76,7 @@
            }
            return;
        }
        try {
            String key = StringUtil.Md5("taobao-code-" + code);
            if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key)))
@@ -85,19 +85,40 @@
        } catch (Exception e) {
        }
        LogHelper.userErrorInfo("淘宝授权回调state:"+state);
        String stateStr = AESUtil.decrypt(state, Constant.UIDAESKEY);
        LogHelper.userErrorInfo("淘宝授权回调解密:"+stateStr);
        String stateStr = null;
        Long time = null;
        Long uid = null;
        String source = null;
        try {
            stateStr = AESUtil.decrypt(state, Constant.UIDAESKEY);
            JSONObject json = JSONObject.fromObject(stateStr);
            time = json.optLong("t");
            uid = json.optLong("u");
            source = json.optString("s");
        } catch (Exception e) {
            try {
                state = URLDecoder.decode(state, "UTF-8");
            } catch (UnsupportedEncodingException e1) {
                e1.printStackTrace();
            }
            stateStr = AESUtil.decrypt(state, Constant.UIDAESKEY);
            JSONObject json = JSONObject.fromObject(stateStr);
            time = json.optLong("t");
            uid = json.optLong("u");
            source = json.optString("s");
        }
        LogHelper.userErrorInfo("淘宝授权回调state:" + state);
        LogHelper.userErrorInfo("淘宝授权回调解密:" + stateStr);
        int errCode = 0;
        if (StringUtil.isNullOrEmpty(stateStr)) {
            // 解密错误
            errCode = 1;
        }
        JSONObject json = JSONObject.fromObject(stateStr);
        Long time = json.optLong("t");
        Long uid = json.optLong("u");
        String source = json.optString("s");
        if (System.currentTimeMillis() - time > 1000 * 60 * 10L) {
            // 过时
            errCode = 2;
@@ -146,6 +167,7 @@
                final String relationId2 = relationId;
                // 异步申请会员ID
                final Long fuid=uid;
                ThreadUtil.run(new Runnable() {
                    @Override
@@ -159,12 +181,12 @@
                        }
                        if (StringUtil.isNullOrEmpty(specialId))
                            LogHelper.test(uid + "会员备案失败");
                            LogHelper.test(fuid + "会员备案失败");
                        try {
                            userExtraTaoBaoInfoService.addSpecialId(uid, specialId, taoBaoUid, name, true);
                            userExtraTaoBaoInfoService.addSpecialId(fuid, specialId, taoBaoUid, name, true);
                            if (!StringUtil.isNullOrEmpty(specialId) && !StringUtil.isNullOrEmpty(relationId2))
                                userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindTaoBao, taoBaoUid);
                                userInfoModifyRecordService.addModifyRecord(fuid, ModifyTypeEnum.bindTaoBao, taoBaoUid);
                        } catch (UserExtraTaoBaoInfoException e) {
                            LogHelper.test(e.getMsg());
                        }
@@ -192,6 +214,7 @@
                    LogHelper.test(e.getMsg());
                    errCode = 5;
                }
                final Long fuid=uid;
                final String specialId2 = specialId;
                // 异步申请渠道ID
@@ -206,12 +229,12 @@
                        } catch (TaoBaoAuthException e1) {
                        } // 渠道ID
                        if (StringUtil.isNullOrEmpty(relationId))
                            LogHelper.test(uid + "渠道备案失败");
                            LogHelper.test(fuid + "渠道备案失败");
                        try {
                            userExtraTaoBaoInfoService.addRelationId(uid, relationId, taoBaoUid, name, true);
                            userExtraTaoBaoInfoService.addRelationId(fuid, relationId, taoBaoUid, name, true);
                            if (!StringUtil.isNullOrEmpty(specialId2) && !StringUtil.isNullOrEmpty(relationId))
                                userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindTaoBao, taoBaoUid);
                                userInfoModifyRecordService.addModifyRecord(fuid, ModifyTypeEnum.bindTaoBao, taoBaoUid);
                        } catch (UserExtraTaoBaoInfoException e) {
                            LogHelper.test(e.getMsg());
                        }
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java
@@ -3,6 +3,9 @@
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -21,6 +24,7 @@
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.LostOrder;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
@@ -42,6 +46,7 @@
import com.yeshi.fanli.util.CMQManager;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.vo.order.CommonOrderVO;
@@ -110,21 +115,22 @@
     */
    @RequestMapping(value = "getorder", method = RequestMethod.POST)
    public void getOrder(AcceptData acceptData, Integer page, Long uid, Integer state,
            @RequestParam(name = "type",required = false) String type1, Integer orderState, String orderNo, String startTime, String endTime,
            Integer slotTime, Boolean needCount, Integer dateType, Integer goodsType, PrintWriter out) {
            @RequestParam(name = "type", required = false) String type1, Integer orderState, String orderNo,
            String startTime, String endTime, Integer slotTime, Boolean needCount, Integer dateType, Integer goodsType,
            PrintWriter out) {
        Integer type = null;
        if (StringUtil.isNullOrEmpty(type1)) {
            type = null;
        } else {
            type = Integer.parseInt(type1);
        }
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (needCount == null)
            needCount = false;
@@ -147,20 +153,20 @@
            orderState = 2; // 已维权
            state = null; // 清空
        }
        if (type != null && type == 0) {
            type = null; // 所有类型订单
        }
        Integer tempState = state;
        // 转换状态
        if (state != null && orderState != null && (orderState == 2|| orderState == 3)) {
        if (state != null && orderState != null && (orderState == 2 || orderState == 3)) {
            state = null; // 清空
        }
        if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
            goodsType = Constant.SOURCE_TYPE_TAOBAO;
        } else if (goodsType != null && goodsType == 0){
        } else if (goodsType != null && goodsType == 0) {
            goodsType = null; // 所有平台订单
        }
@@ -187,8 +193,8 @@
            BigDecimal todayMoney = null;
            // 查询列表
            List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, type, orderState, orderNo,
                    startTime, endTime, dateType, goodsType);
            List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, type, orderState,
                    orderNo, startTime, endTime, dateType, goodsType);
            if (list != null && list.size() > 0) {
                // 统计总数
@@ -199,21 +205,23 @@
            // 需要统计筛选信息 :未失效的总金额 以及订单
            if (needCount && page == 1) {
                todayMoney = commonOrderService.countBonusOrderMoney(uid, type, dateType, startTime, endTime, goodsType);
                todayMoney = commonOrderService.countBonusOrderMoney(uid, type, dateType, startTime, endTime,
                        goodsType);
                todayTotal = commonOrderService.countBonusOrderNumber(uid, type, dateType, startTime, endTime, goodsType);
                todayTotal = commonOrderService.countBonusOrderNumber(uid, type, dateType, startTime, endTime,
                        goodsType);
                // 有效订单
                totalValid = commonOrderService.countUserOrderToApp(uid, type, startTime,
                        endTime, dateType, goodsType, tempState, 1);
                totalValid = commonOrderService.countUserOrderToApp(uid, type, startTime, endTime, dateType, goodsType,
                        tempState, 1);
                // 维权订单
                totalProces = commonOrderService.countUserOrderToApp(uid, type, startTime,
                        endTime, dateType, goodsType, null, 2);
                totalProces = commonOrderService.countUserOrderToApp(uid, type, startTime, endTime, dateType, goodsType,
                        null, 2);
                // 失效订单
                totalInvite = commonOrderService.countUserOrderToApp(uid, type, startTime,
                        endTime, dateType, goodsType, null, 3);
                totalInvite = commonOrderService.countUserOrderToApp(uid, type, startTime, endTime, dateType, goodsType,
                        null, 3);
            }
            if (todayMoney == null) {
@@ -306,8 +314,8 @@
            Integer goodsType = null; // 版本区分
            if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
                goodsType = Constant.SOURCE_TYPE_TAOBAO;
            }
            }
            /* 总订单统计 */
            Map<String, BigDecimal> countOrder = commonOrderService.countHistoryOrder(uid, null, goodsType);
            int self = 0;
@@ -392,10 +400,10 @@
            e.printStackTrace();
        }
    }
    /**
     * 统计各个平台数据
     *
     * @param acceptData
     * @param uid
     * @param goodsType
@@ -413,7 +421,7 @@
            out.print(JsonUtil.loadFalseResult(1, "平台类型缺失或不正确"));
            return;
        }
        /* 今日订单统计 */
        Map<String, BigDecimal> countToday = commonOrderService.countHistoryOrder(uid, 1, goodsType);
@@ -469,8 +477,7 @@
        data.put("yesterday", yesterdaydata);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 统计奖金
     * 
@@ -480,50 +487,74 @@
     */
    @RequestMapping(value = "countBonus", method = RequestMethod.POST)
    public void countBonus(AcceptData acceptData, Long uid, Integer dateType, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        try {
        long nowTime = System.currentTimeMillis();
        long recievedTime = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(nowTime, "yyyy-MM") + "-25 10",
                "yyyy-MM-dd HH");
        try {
            Object shareCount = 0;
            BigDecimal sharemoney = new BigDecimal(0.00);
            Object inviteCount = 0;
            BigDecimal inviteMoney = new BigDecimal(0.00);
            Integer goodsType = null; // 版本区分
            if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
                goodsType = Constant.SOURCE_TYPE_TAOBAO;
            }
            Map<String, Object> shareMap = commonOrderService.countBonusOrderMoneyAndNumber(uid, 2, dateType, null,
                    null, goodsType);
            if (shareMap != null) {
                Object totalNum = shareMap.get("totalNum");
                if (totalNum != null) {
                    shareCount = totalNum;
            if (nowTime > recievedTime && dateType == 4) {// 实际到账
                List<Integer> inviteTypes = new ArrayList<>();
                inviteTypes.add(HongBaoV2.TYPE_YIJI);
                inviteTypes.add(HongBaoV2.TYPE_ERJI);
                inviteTypes.add(HongBaoV2.TYPE_SHARE_YIJI);
                inviteTypes.add(HongBaoV2.TYPE_SHARE_ERJI);
                List<Integer> shareTypes = new ArrayList<>();
                shareTypes.add(HongBaoV2.TYPE_SHARE_GOODS);
                Date minGetTime = new Date(
                        TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(nowTime, "yyyy-MM") + "-25", "yyyy-MM-dd"));
                Date maxGetTime = new Date(nowTime);
                inviteMoney = hongBaoV2CountService.sumAlreadyGetMoneyByUid(uid, inviteTypes, minGetTime, maxGetTime);
                inviteCount = hongBaoV2CountService.countAlreadyGetMoneyByUid(uid, inviteTypes, minGetTime, maxGetTime);
                sharemoney = hongBaoV2CountService.sumAlreadyGetMoneyByUid(uid, shareTypes, minGetTime, maxGetTime);
                shareCount = hongBaoV2CountService.countAlreadyGetMoneyByUid(uid, shareTypes, minGetTime, maxGetTime);
            } else {// 预估到账
                Integer goodsType = null; // 版本区分
                if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
                    goodsType = Constant.SOURCE_TYPE_TAOBAO;
                }
                Map<String, Object> shareMap = commonOrderService.countBonusOrderMoneyAndNumber(uid, 2, dateType, null,
                        null, goodsType);
                if (shareMap != null) {
                    Object totalNum = shareMap.get("totalNum");
                    if (totalNum != null) {
                        shareCount = totalNum;
                    }
                    Object totalmoney = shareMap.get("totalmoney");
                    if (totalmoney != null) {
                        sharemoney = (BigDecimal) totalmoney;
                    }
                }
                Object totalmoney = shareMap.get("totalmoney");
                if (totalmoney != null) {
                    sharemoney = (BigDecimal) totalmoney;
                }
            }
                // 邀请统计
            // 邀请统计
            Map<String, Object> inviteMap = commonOrderService.countBonusOrderMoneyAndNumber(uid, 3, dateType, null,
                    null, goodsType);
            if (inviteMap != null) {
                Object totalNum = inviteMap.get("totalNum");
                if (totalNum != null) {
                    inviteCount = totalNum;
                }
                Map<String, Object> inviteMap = commonOrderService.countBonusOrderMoneyAndNumber(uid, 3, dateType, null,
                        null, goodsType);
                if (inviteMap != null) {
                    Object totalNum = inviteMap.get("totalNum");
                    if (totalNum != null) {
                        inviteCount = totalNum;
                    }
                Object totalmoney = inviteMap.get("totalmoney");
                if (totalmoney != null) {
                    inviteMoney = (BigDecimal) totalmoney;
                    Object totalmoney = inviteMap.get("totalmoney");
                    if (totalmoney != null) {
                        inviteMoney = (BigDecimal) totalmoney;
                    }
                }
            }
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java
@@ -11,109 +11,116 @@
public interface HongBaoV2CountMapper {
    /**
     * 统计历史总到账金额
     * @param uid
     * @param state
     *
     * @param uid
     * @param state
     * @return
     */
    BigDecimal countMoneyByUidAndState(@Param("uid")Long uid, @Param("state") Integer state);
    BigDecimal countMoneyByUidAndState(@Param("uid") Long uid, @Param("state") Integer state);
    /**
     * 统计历史红包数量
     * @param uid
     * @param state
     *
     * @param uid
     * @param state
     * @return
     */
    Integer countNumberByUidAndState(@Param("uid")Long uid, @Param("state") Integer state);
    Integer countNumberByUidAndState(@Param("uid") Long uid, @Param("state") Integer state);
    /**
     * 统计用户总的红包数量
     *
     * @param uid
     * @return
     */
    Long countNumberByUid(@Param("uid")Long uid);
    Long countNumberByUid(@Param("uid") Long uid);
    /**
     * 统计总金额
     * @param channel 渠道
     * @param type
     *
     * @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);
    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 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);
    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);
    /**
     * 统计总个数
     * @param channel 渠道
     * @param type
     *
     * @param channel
     *            渠道
     * @param type
     * @param state
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countHongBaoType(@Param("dateType")Integer dateType,
            @Param("type") Integer type, @Param("year") String year,
            @Param("startTime")String startTime, @Param("endTime")String endTime);
    List<Map<String, Object>> countHongBaoType(@Param("dateType") Integer dateType, @Param("type") Integer type,
            @Param("year") String year, @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计总个数
     * @param channel 渠道
     * @param type
     *
     * @param channel
     *            渠道
     * @param type
     * @param state
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countHongBaoTotalNum(@Param("dateType")Integer dateType, @Param("year") String year,
            @Param("startTime")String startTime, @Param("endTime")String endTime);
    List<Map<String, Object>> countHongBaoTotalNum(@Param("dateType") Integer dateType, @Param("year") String year,
            @Param("startTime") String startTime, @Param("endTime") String endTime);
    // 累计提成订单数量(包含无效订单)
    int getTotalTiChengCount(Long uid);
    /**
     * 统计未失效订单数量
     *
     * @param uid
     * @param dateType
     * @return
     */
    long countValidNumberByUid(@Param("uid") Long uid, @Param("dateType")Integer dateType);
    long countValidNumberByUid(@Param("uid") Long uid, @Param("dateType") Integer dateType);
    /**
     * 统计未到账
     *
     * @param uid
     * @return
     */
    BigDecimal countWillGetMoneyByUid(@Param("uid") Long uid);
    Date getLastHongBaoTime(@Param("uid") Long uid);
    /**
     * 根据渠道 统计新增用户24小时内产生的订单数量
     * 
@@ -122,16 +129,30 @@
     */
    List<Map<String, Object>> count24HOderByChannel(@Param("channel") String channel, @Param("type") Integer type,
            @Param("years") String years, @Param("startTime") String startTime, @Param("endTime") String endTime);
    List<HongBaoV2VO> listShareAndInviteMoney(@Param("start") long start, @Param("count") int count,
            @Param("date") String date);
    /**
     * 统计奖励券总金额
     *
     * @return
     */
    BigDecimal countRebateCouponMoney();
    /**
     * 统计用户已到账
     *
     * @param uid
     * @param typeList
     * @param minGetTime
     * @param maxGetTime
     * @return
     */
    BigDecimal sumAlreadyGetMoneyByUid(@Param("uid") Long uid, @Param("typeList") List<Integer> typeList,
            @Param("minGetTime") Date minGetTime, @Param("maxGetTime") Date maxGetTime);
    long countAlreadyGetMoneyByUid(@Param("uid") Long uid, @Param("typeList") List<Integer> typeList,
            @Param("minGetTime") Date minGetTime, @Param("maxGetTime") Date maxGetTime);
}
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoOrder.java
@@ -15,6 +15,8 @@
    private String createTime; // 创建时间
    @Column(name = "to_click_time")
    private String clickTime; // 点击时间
    @Column(name = "to_pay_time")
    private String payTime;// 支付时间
    @Column(name = "to_title")
    private String title; // 商品名称
    @Column(name = "to_auction_id")
@@ -82,7 +84,7 @@
    @Column(name = "to_relation_id")
    private String relationId;
    @Column(name = "to_trade_id")
    private String tradeId;//交易ID
    private String tradeId;// 交易ID
    public String getTradeId() {
        return tradeId;
@@ -380,4 +382,12 @@
        this.adPositionName = adPositionName;
    }
    public String getPayTime() {
        return payTime;
    }
    public void setPayTime(String payTime) {
        this.payTime = payTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -11,13 +11,14 @@
        <result column="hb_state" property="state" jdbcType="INTEGER" />
        <result column="hb_version" property="version" jdbcType="INTEGER" />
        <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR" />
        <result column="hb_pre_get_time" property="preGetTime" jdbcType="TIMESTAMP" />
        <result column="hb_pre_get_time" property="preGetTime"
            jdbcType="TIMESTAMP" />
        <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP" />
        <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="totalMoney" property="totalMoney" jdbcType="DECIMAL" />
        <association property="userInfo" column="hb_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="hb_uid" property="id" jdbcType="BIGINT" />
@@ -132,7 +133,8 @@
    </select>
    <select id="countNumberByUid" resultType="java.lang.Long">
        select count(hb_id) from yeshi_ec_hongbao_v2 where hb_uid=#{0}
        select count(hb_id)
        from yeshi_ec_hongbao_v2 where hb_uid=#{0}
    </select>
@@ -153,7 +155,8 @@
        SELECT COUNT(t.`hb_id`)AS showValue,
        <include refid="Column_DateType" />
        FROM yeshi_ec_hongbao_v2 t
        WHERE t.`hb_uid` IS NOT NULL AND t.`hb_type` not in(1,3,4)
        WHERE t.`hb_uid` IS NOT NULL AND t.`hb_type`
        not in(1,3,4)
        <include refid="Count_Select_DateType" />
        <include refid="Count_Group_DateType" />
        ORDER BY t.`hb_create_time`
@@ -162,7 +165,8 @@
    <select id="countMoneyByUidAndState" resultType="java.math.BigDecimal">
        SELECT CAST(SUM(hb.`hb_money`)AS DECIMAL(19,2))
        FROM `yeshi_ec_hongbao_v2` hb
        FROM
        `yeshi_ec_hongbao_v2` hb
        WHERE hb.`hb_uid` = #{uid}
        <if test="state != null">
            AND hb.`hb_state` = #{state}
@@ -184,7 +188,8 @@
        SELECT count(*) FROM `yeshi_ec_hongbao_v2` h
        WHERE
        h.`hb_uid`=#{0}
        AND (h.`hb_type`=20 OR h.`hb_type`=21 OR h.`hb_type`=22 OR h.`hb_type`=6
        AND (h.`hb_type`=20 OR h.`hb_type`=21 OR h.`hb_type`=22
        OR h.`hb_type`=6
        OR h.`hb_type`=7)
    </select>
@@ -203,12 +208,14 @@
        <if test="dateType != null and dateType == 2">
            AND DATE_FORMAT(
            FROM_UNIXTIME(hb.`hb_create_time`/1000),'%Y%m' ) =
            DATE_FORMAT( CURDATE( ) , '%Y%m' )
            DATE_FORMAT(
            CURDATE( ) , '%Y%m' )
        </if>
    </select>
    <select id="countWillGetMoneyByUid" resultType="java.math.BigDecimal">
        SELECT CAST(SUM(hb.`hb_money`)AS DECIMAL(19,2))
        SELECT
        CAST(SUM(hb.`hb_money`)AS DECIMAL(19,2))
        FROM `yeshi_ec_hongbao_v2` hb
        WHERE hb.`hb_uid` = #{uid} AND hb.`hb_state`
        in (1,2)
@@ -241,9 +248,12 @@
        FROM
        (
        SELECT h.* FROM yeshi_ec_hongbao_v2 h
        LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a
        WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
        ON a.uid=h.`hb_uid` WHERE a.uid IS NOT NULL AND (h.`hb_type`=1 OR
        LEFT JOIN (SELECT
        a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a
        WHERE
        a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
        ON
        a.uid=h.`hb_uid` WHERE a.uid IS NOT NULL AND (h.`hb_type`=1 OR
        h.`hb_type`=20)
        ) b
        LEFT JOIN yeshi_ec_user u ON u.`id`=b.hb_uid
@@ -285,11 +295,52 @@
        totalMoney DESC
        LIMIT ${start},${count}
    </select>
    <select id="countRebateCouponMoney" resultType="java.math.BigDecimal">
        SELECT IFNULL(SUM(h.`hb_money`),0) FROM `yeshi_ec_hongbao_v2` h
        SELECT
        IFNULL(SUM(h.`hb_money`),0) FROM `yeshi_ec_hongbao_v2` h
        where h.`hb_type` = 10
    </select>
    <select id="sumAlreadyGetMoneyByUid" resultType="java.math.BigDecimal">
        SELECT IFNULL(SUM(h.`hb_money`),0) FROM `yeshi_ec_hongbao_v2` h
        where h.`hb_uid` = #{uid}
        <if test="typeList!=null">
            <foreach collection="typeList" item="type" open=" and ("
                separator=" or " close=")">
                h.hb_type=#{type}
            </foreach>
        </if>
        <if test="minGetTime!=null">
            and h.hb_get_time>=#{minGetTime}
        </if>
        <if test="maxGetTime!=null">
            and #{maxGetTime}>h.hb_get_time
        </if>
    </select>
    <select id="countAlreadyGetMoneyByUid" resultType="java.lang.Long">
        SELECT count(h.hb_id) FROM `yeshi_ec_hongbao_v2` h
        where h.`hb_uid` = #{uid}
        <if test="typeList!=null">
            <foreach collection="typeList" item="type" open=" and ("
                separator=" or " close=")">
                h.hb_type=#{type}
            </foreach>
        </if>
        <if test="minGetTime!=null">
            and h.hb_get_time>=#{minGetTime}
        </if>
        <if test="maxGetTime!=null">
            and #{maxGetTime}>h.hb_get_time
        </if>
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml
@@ -6,6 +6,7 @@
        <id column="to_id" property="id" jdbcType="BIGINT" />
        <result column="to_create_time" property="createTime" jdbcType="VARCHAR" />
        <result column="to_click_time" property="clickTime" jdbcType="VARCHAR" />
        <result column="to_pay_time" property="payTime" jdbcType="VARCHAR" />
        <result column="to_title" property="title" jdbcType="VARCHAR" />
        <result column="to_auction_id" property="auctionId" jdbcType="BIGINT" />
        <result column="to_manager_wangwang" property="managerWangWang"
@@ -53,7 +54,7 @@
        <result column="to_special_id" property="specialId" jdbcType="VARCHAR" />
        <result column="to_trade_id" property="tradeId" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">to_id,to_create_time,to_click_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby,to_relation_id,to_special_id,to_trade_id
    <sql id="Base_Column_List">to_id,to_create_time,to_click_time,to_pay_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby,to_relation_id,to_special_id,to_trade_id
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
@@ -156,9 +157,9 @@
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_order
        (to_id,to_create_time,to_click_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby,to_relation_id,to_special_id,to_trade_id)
        (to_id,to_create_time,to_click_time,to_pay_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby,to_relation_id,to_special_id,to_trade_id)
        values
        (#{id,jdbcType=BIGINT},#{createTime,jdbcType=VARCHAR},#{clickTime,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{auctionId,jdbcType=BIGINT},#{managerWangWang,jdbcType=VARCHAR},#{shop,jdbcType=VARCHAR},#{count,jdbcType=INTEGER},#{price,jdbcType=DECIMAL},#{orderState,jdbcType=VARCHAR},#{orderType,jdbcType=VARCHAR},#{iRatio,jdbcType=DECIMAL},#{sRatio,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{estimate,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{settlementTime,jdbcType=VARCHAR},#{tkRate,jdbcType=DECIMAL},#{tkMoney,jdbcType=DECIMAL},#{technologySupportPercent,jdbcType=DECIMAL},#{subsidyRatio,jdbcType=DECIMAL},#{subsidy,jdbcType=DECIMAL},#{subsidyType,jdbcType=VARCHAR},#{transactionPlatform,jdbcType=VARCHAR},#{thirdService,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{className,jdbcType=VARCHAR},#{sourceMediaId,jdbcType=VARCHAR},#{sourceMediaName,jdbcType=VARCHAR},#{adPositionId,jdbcType=VARCHAR},#{adPositionName,jdbcType=VARCHAR},
        (#{id,jdbcType=BIGINT},#{createTime,jdbcType=VARCHAR},#{clickTime,jdbcType=VARCHAR},#{payTime,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{auctionId,jdbcType=BIGINT},#{managerWangWang,jdbcType=VARCHAR},#{shop,jdbcType=VARCHAR},#{count,jdbcType=INTEGER},#{price,jdbcType=DECIMAL},#{orderState,jdbcType=VARCHAR},#{orderType,jdbcType=VARCHAR},#{iRatio,jdbcType=DECIMAL},#{sRatio,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{estimate,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{settlementTime,jdbcType=VARCHAR},#{tkRate,jdbcType=DECIMAL},#{tkMoney,jdbcType=DECIMAL},#{technologySupportPercent,jdbcType=DECIMAL},#{subsidyRatio,jdbcType=DECIMAL},#{subsidy,jdbcType=DECIMAL},#{subsidyType,jdbcType=VARCHAR},#{transactionPlatform,jdbcType=VARCHAR},#{thirdService,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{className,jdbcType=VARCHAR},#{sourceMediaId,jdbcType=VARCHAR},#{sourceMediaName,jdbcType=VARCHAR},#{adPositionId,jdbcType=VARCHAR},#{adPositionName,jdbcType=VARCHAR},
        #{latestUpdateTime,jdbcType=TIMESTAMP},#{orderBy,jdbcType=INTEGER},
        #{relationId,jdbcType=VARCHAR},#{specialId,jdbcType=VARCHAR}
        ,#{tradeId,jdbcType=VARCHAR})
@@ -170,6 +171,7 @@
            <if test="id != null">to_id,</if>
            <if test="createTime != null">to_create_time,</if>
            <if test="clickTime != null">to_click_time,</if>
            <if test="payTime != null">to_pay_time,</if>
            <if test="title != null">to_title,</if>
            <if test="auctionId != null">to_auction_id,</if>
            <if test="managerWangWang != null">to_manager_wangwang,</if>
@@ -210,6 +212,7 @@
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=VARCHAR},</if>
            <if test="clickTime != null">#{clickTime,jdbcType=VARCHAR},</if>
            <if test="payTime != null">#{payTime,jdbcType=VARCHAR},</if>
            <if test="title != null">#{title,jdbcType=VARCHAR},</if>
            <if test="auctionId != null">#{auctionId,jdbcType=BIGINT},</if>
            <if test="managerWangWang != null">#{managerWangWang,jdbcType=VARCHAR},</if>
@@ -249,7 +252,8 @@
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder">update
        yeshi_ec_taobao_order set to_create_time =
        #{createTime,jdbcType=VARCHAR},to_click_time =
        #{clickTime,jdbcType=VARCHAR},to_title =
        #{clickTime,jdbcType=VARCHAR},to_pay_time =
        #{payTime,jdbcType=VARCHAR},to_title =
        #{title,jdbcType=VARCHAR},to_auction_id =
        #{auctionId,jdbcType=BIGINT},to_manager_wangwang =
        #{managerWangWang,jdbcType=VARCHAR},to_shop =
@@ -289,6 +293,7 @@
        <set>
            <if test="createTime != null">to_create_time=#{createTime,jdbcType=VARCHAR},</if>
            <if test="clickTime != null">to_click_time=#{clickTime,jdbcType=VARCHAR},</if>
            <if test="payTime != null">to_pay_time=#{payTime,jdbcType=VARCHAR},</if>
            <if test="title != null">to_title=#{title,jdbcType=VARCHAR},</if>
            <if test="auctionId != null">to_auction_id=#{auctionId,jdbcType=BIGINT},</if>
            <if test="managerWangWang != null">to_manager_wangwang=#{managerWangWang,jdbcType=VARCHAR},
@@ -339,6 +344,7 @@
        <id column="to_id" property="tboid" jdbcType="BIGINT" />
        <result column="to_create_time" property="createTime" jdbcType="VARCHAR" />
        <result column="to_click_time" property="clickTime" jdbcType="VARCHAR" />
        <result column="to_pay_time" property="payTime" jdbcType="VARCHAR" />
        <result column="to_title" property="title" jdbcType="VARCHAR" />
        <result column="to_auction_id" property="auctionId" jdbcType="BIGINT" />
        <result column="to_manager_wangwang" property="managerWangWang"
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -290,10 +290,20 @@
        long count = hongBaoV2CountMapper.countNumberByUid(uid);
        return (int) count;
    }
    @Override
    public BigDecimal countRebateCouponMoney() {
        return hongBaoV2CountMapper.countRebateCouponMoney();
    }
    @Override
    public BigDecimal sumAlreadyGetMoneyByUid(Long uid, List<Integer> typeList, Date minGetTime, Date maxGetTime) {
        return hongBaoV2CountMapper.sumAlreadyGetMoneyByUid(uid, typeList, minGetTime, maxGetTime);
    }
    @Override
    public long countAlreadyGetMoneyByUid(Long uid, List<Integer> typeList, Date minGetTime, Date maxGetTime) {
        return hongBaoV2CountMapper.countAlreadyGetMoneyByUid(uid, typeList, minGetTime, maxGetTime);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
@@ -29,6 +29,7 @@
    /**
     * 统计用户红包数量
     *
     * @param uid
     * @return
     */
@@ -151,8 +152,22 @@
    /**
     * 奖励券金额
     *
     * @return
     */
    public BigDecimal countRebateCouponMoney();
    /**
     * 统计已到账
     *
     * @param uid
     * @param typeList
     * @param minGetTime
     * @param maxGetTime
     * @return
     */
    public BigDecimal sumAlreadyGetMoneyByUid(Long uid, List<Integer> typeList, Date minGetTime, Date maxGetTime);
    public long countAlreadyGetMoneyByUid(Long uid, List<Integer> typeList, Date minGetTime, Date maxGetTime);
}
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -174,7 +174,7 @@
            doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
            doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
//            doPlaceOrderIntegralJob();// 下单赠送金币任务
            doDouYinDeviceActiveJob();// 抖音设备激活广告监测
//            doDouYinDeviceActiveJob();// 抖音设备激活广告监测
        }
    }
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeOrderApiUtil.java
@@ -274,6 +274,7 @@
                    taoBaoOrder.setAuctionId(item.optLong("item_id"));
                    taoBaoOrder.setClassName(item.optString("item_category_name"));
                    taoBaoOrder.setClickTime(item.optString("click_time"));
                    taoBaoOrder.setPayTime(item.optString("tb_paid_time"));
                    taoBaoOrder.setCount(item.optInt("item_num"));
                    taoBaoOrder.setCreateTime(item.optString("tk_create_time"));
                    if (!StringUtil.isNullOrEmpty(item.optString("total_commission_fee")))