admin
2019-09-27 0b177e19cfc810ca12195c0b4e2d934566afb6b0
限时秒杀bug修改,淘宝成功订单状态处理
21个文件已修改
994 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoOrderMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateOrderJob.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/tb/TaoBaoOrderServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceActiveServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserLotteryRecordServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 602 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderProcessService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/tb/TaoBaoOrderService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
@@ -206,8 +206,10 @@
    }
    private JSONObject getSpikeGoodsContent(AcceptData acceptData) {
        List<String> dtoList = DaTaoKeUtil.getDingDongQiangTime();
        long nowTime = System.currentTimeMillis();
        Calendar calendar=    Calendar.getInstance();
        calendar.setTimeInMillis(nowTime);
        List<String> dtoList = DaTaoKeUtil.getDingDongQiangTime(calendar);
        int dateNum = Integer.parseInt(TimeUtil.getGernalTime(nowTime, "ddHH"));
        String timeStr = null;
        int nextPos = 0;
@@ -218,6 +220,7 @@
                break;
            }
        }
        if (timeStr == null)
            timeStr = dtoList.get(dtoList.size() - 1);
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoOrderMapper.java
@@ -121,4 +121,15 @@
     * @return
     */
    Long countBySettlementTime(@Param("minTime") Long minTime, @Param("maxTime") Long maxTime);
    /**
     * 根据状态与创建时间检索
     *
     * @param state
     * @param minCreateTime
     * @param maxCreateTime
     * @return
     */
    List<TaoBaoOrder> listByStateAndCreateTime(@Param("state") String state, @Param("minCreateTime") Long minCreateTime,
            @Param("maxCreateTime") Long maxCreateTime);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java
@@ -22,7 +22,7 @@
    public enum MsgTypeOtherTypeEnum {
        couponMianDan("免单券"), couponWelfareMianDan("福利免单券"), freeCouponBuy("自购免单券"), 
        freeCouponGive("赠送免单券"), couponReward("奖励券"), taoLiJin("推广红包"), give("赠送"), exchange("金币兑换")
        , couponActivate("免单券激活"), firstOrderReward("队员首单奖励邀请人金币");
        , couponActivate("免单券激活"), firstOrderReward("队员首单奖励邀请人金币"),systemGive("系统赠送");
        
        private final String desc;
fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateOrderJob.java
@@ -480,7 +480,6 @@
        Long endTime = System.currentTimeMillis() - 1000 * 60 * 10L;
        Long startTime = endTime - 1000 * 60 * 60 * 12L;
        updateLocalTaoBaoOrder(startTime, endTime, 1, 2000);
    }
    public void updateLocalTaoBaoOrder(Long startTime, Long endTime, int page, int count) {
@@ -513,6 +512,9 @@
        }
    }
    /**
     * 处理最近5天的本地订单
     */
    @Scheduled(cron = "30 13 3 * * ? ")
    public void doLatest5DayLocalTaoBaoOrder() {
        if (!Constant.IS_TASK)
@@ -527,4 +529,30 @@
        }
    }
    /**
     * 处理上月订单成功
     */
    @Scheduled(cron = "0 0 12 25 * ? ")
    public void doSellerNotPayOrder() {
        if (!Constant.IS_TASK)
            return;
        Calendar calender = Calendar.getInstance();
        long endTime = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(calender.getTimeInMillis(), "yyyy-MM"),
                "yyyy-MM");
        calender.add(Calendar.MONTH, -1);
        long startTime = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(calender.getTimeInMillis(), "yyyy-MM"),
                "yyyy-MM");
        // 商家未付款
        List<TaoBaoOrder> orderList = taoBaoOrderService.listByStateAndCreateTime("订单成功", new Date(startTime),
                new Date(endTime));
        if (orderList != null)
            for (TaoBaoOrder order : orderList)
                try {
                    orderProcessService.doTaoBaoSellerNotPaid(order);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml
@@ -145,9 +145,18 @@
        <if test="maxTime!=null">
          and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000
        </if>
    </select>
    
    <select id="listByStateAndCreateTime" resultMap="BaseResultMap">
        select * from yeshi_ec_taobao_order
        where to_order_state=#{state}
        <if test="minCreateTime!=null">
          and UNIX_TIMESTAMP(to_create_time)*1000>=#{minCreateTime}
        </if>
        <if test="maxCreateTime!=null">
          and #{maxCreateTime}>UNIX_TIMESTAMP(to_create_time)*1000
        </if>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_taobao_order where to_id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java
@@ -52,6 +52,9 @@
        } else if (detail.getType() == MsgTypeOtherTypeEnum.firstOrderReward) {
            msgOtherDetailMapper.insertSelective(detail);
            userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
        }else if (detail.getType() == MsgTypeOtherTypeEnum.systemGive) {
            msgOtherDetailMapper.insertSelective(detail);
            userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java
@@ -13,6 +13,7 @@
import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
@@ -433,4 +434,20 @@
            e.printStackTrace();
        }
    }
    @Override
    public void systemGiveRewardCoupon(Long uid, String beiZhu, MsgOtherSystemGiveDTO dto) {
        try {
            MsgOtherDetail detail = new MsgOtherDetail();
            detail.setBeiZhu(beiZhu);
            detail.setCreateTime(new Date());
            detail.setRead(false);
            detail.setUser(new UserInfo(uid));
            detail.setContent(new Gson().toJson(dto));
            detail.setType(MsgTypeOtherTypeEnum.systemGive);
            msgOtherDetailService.addMsgOtherDetail(detail);
        } catch (MsgOtherDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -1443,4 +1443,54 @@
            return false;
    }
    @Transactional(rollbackFor = Exception.class)
    public void invalidHongBaoV2AndGiveGodenCorn(Long hongBaoId, Long uid, String orderId, int sourceType,
            String beiZhu) throws Exception {
        HongBaoV2 v2 = new HongBaoV2(hongBaoId);
        v2.setState(HongBaoV2.STATE_SHIXIAO);
        v2.setBeizhu(beiZhu);
        v2.setUpdateTime(new Date());
        hongBaoV2Service.updateByPrimaryKeySelective(v2);
        List<HongBaoV2> children = hongBaoV2Service.listChildrenById(hongBaoId);
        if (children != null)
            for (HongBaoV2 child : children) {
                HongBaoV2 update = new HongBaoV2(child.getId());
                update.setState(HongBaoV2.STATE_SHIXIAO);
                update.setBeizhu(beiZhu);
                update.setUpdateTime(new Date());
                hongBaoV2Service.updateByPrimaryKeySelective(update);
            }
        userSystemCouponService.systemGiveRewardCoupon(uid, 1, orderId, sourceType, "因商家违约未能结算返利或商家已经关店");
    }
    @Transactional
    @Override
    public void doTaoBaoSellerNotPaid(TaoBaoOrder order) {
        // 根据交易ID查询
        if (!StringUtil.isNullOrEmpty(order.getTradeId())) {
            List<CommonOrder> commonOrderList = commonOrderService
                    .listBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId());
            if (commonOrderList != null)
                // 查询主订单
                for (CommonOrder commonOrder : commonOrderList) {
                // 查询主红包
                HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
                if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
                if (hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_BUKELINGQU) {
                // 订单失效,赠送金币
                try {
                invalidHongBaoV2AndGiveGodenCorn(hongBaoOrder.getHongBaoV2().getId(), hongBaoOrder.getHongBaoV2().getUserInfo().getId(), commonOrder.getOrderNo(), commonOrder.getSourceType(), "订单成功,商家未打款");
                } catch (Exception e) {
                e.printStackTrace();
                }
                }
                }
                }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/tb/TaoBaoOrderServiceImpl.java
@@ -211,4 +211,9 @@
        return taoBaoOrderMapper.countBySettlementTime(minTime, maxTime);
    }
    @Override
    public List<TaoBaoOrder> listByStateAndCreateTime(String state, Date minCreateTime, Date maxCreateTime) {
        return taoBaoOrderMapper.listByStateAndCreateTime(state, minCreateTime.getTime(), maxCreateTime.getTime());
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceActiveServiceImpl.java
@@ -60,7 +60,7 @@
            }
            if (StringUtil.isNullOrEmpty(da.getMac()))
                updateDeviceActive.setImei(deviceActive.getMac());
                updateDeviceActive.setMac(deviceActive.getMac());
            deviceActiveMapper.updateByPrimaryKeySelective(updateDeviceActive);
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -343,7 +343,7 @@
            UserSystemCoupon userSystemCoupon= null;
            try {
                userSystemCoupon = userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(),
                        UserSystemCoupon.SOURCE_GIVE, null);
                        UserSystemCoupon.SOURCE_GIVE, null,true);
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
                throw new TokenRecordException(1, "领取失败");
@@ -437,7 +437,7 @@
            UserSystemCoupon userSystemCoupon= null;
            try {
                userSystemCoupon = userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
                        UserSystemCoupon.SOURCE_GIVE, systemCoupon.getPercent());
                        UserSystemCoupon.SOURCE_GIVE, systemCoupon.getPercent(),true);
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
                throw new TokenRecordException(1, "领取失败");
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserLotteryRecordServiceImpl.java
@@ -196,7 +196,7 @@
            prize = "NoPrize";
        } else {
            try {
                userSystemCouponService.insertUserCoupon(uid, prize, UserSystemCoupon.SOURCE_NEWBIES, null);
                userSystemCouponService.insertUserCoupon(uid, prize, UserSystemCoupon.SOURCE_NEWBIES, null,true);
            } catch (UserSystemCouponException e) {
                e.printStackTrace();
            } catch (Exception e) {
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -20,6 +20,7 @@
import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
@@ -66,6 +67,7 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TokenUtil;
import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
import com.yeshi.fanli.util.factory.msg.MsgOtherSystemGiveDTOFactory;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.order.CommonOrderVO;
@@ -88,7 +90,7 @@
    @Resource
    private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
    @Resource
    private ConfigService configService;
@@ -137,18 +139,17 @@
    @Resource
    private CommonOrderCountService commonOrderCountService;
    @Resource
    @Lazy
    private PushCouponService pushCouponService;
    @Resource
    private PushCouponRecordService pushCouponRecordService;
    @Resource
    private TokenRecordService tokenRecordService;
    @Override
    public int insertSelective(UserSystemCoupon record) {
        return userSystemCouponMapper.insertSelective(record);
@@ -178,17 +179,17 @@
    public List<UserSystemCoupon> getUserCouponBySource(Long uid, String source) {
        return userSystemCouponMapper.getUserCouponBySource(uid, source);
    }
    @Override
    public int countTodatyUserCouponBySource(Long uid, String source) {
        return userSystemCouponMapper.countTodatyUserCouponBySource(uid, source);
    }
    @Override
    public long countCouponOld(Long uid) {
        return userSystemCouponMapper.countCouponOld(uid);
    }
    @Override
    public long countUserCouponList(Long uid) {
        return userSystemCouponMapper.countUserCouponList(uid);
@@ -196,16 +197,17 @@
    @Override
    @Transactional
    public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent)
            throws UserSystemCouponException, Exception {
    public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent,
            Boolean needNotify) throws UserSystemCouponException, Exception {
        if (couponType == null || uid == null) {
            throw new UserSystemCouponException(1, "参数不正确");
        }
        SystemCoupon coupon = null;
        if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name()) || couponType.equals(CouponTypeEnum.freeCoupon.name())
                | couponType.equals(CouponTypeEnum.freeCouponBuy.name())) {
        if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name())
                || couponType.equals(CouponTypeEnum.freeCoupon.name())
                        | couponType.equals(CouponTypeEnum.freeCouponBuy.name())) {
            // 免单券
            coupon = systemCouponService.getCouponByType(couponType);
        } else if (couponType.equals(CouponTypeEnum.rebatePercentCoupon.name())) {
@@ -213,11 +215,11 @@
            if (percent == null || percent.compareTo(new BigDecimal(0)) < 1) {
                randomRewardCoupon(1, uid, source);
                return null;
            }  else {
            } else {
                coupon = systemCouponService.getCouponByTypeAndPercent(couponType, percent);
            }
        }
        if (coupon == null) {
            throw new UserSystemCouponException(1, "券类型不正确");
        }
@@ -235,14 +237,14 @@
        }
        Integer expiryDay = null;
        if (stateActivated == 0)
        if (stateActivated == 0)
            expiryDay = coupon.getActivateDay();
        if (expiryDay == null || expiryDay == 0)
        if (expiryDay == null || expiryDay == 0)
            expiryDay = coupon.getExpiryDay();
        // 结束日期
        // 今天在内  减去一天
        // 今天在内 减去一天
        String endDay = DateUtil.plusDay(expiryDay - 1, new Date());
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (endDay != null && endDay.trim().length() > 0) {
@@ -286,23 +288,25 @@
        });
        // 消息推送
        try {
            if (coupon.getType() == CouponTypeEnum.welfareFreeCoupon) {
                userOtherMsgNotificationService.welfareCouponGet(userCoupon);
            } else if (coupon.getType() == CouponTypeEnum.freeCoupon) {
                userOtherMsgNotificationService.freeSheetCouponGet(userCoupon);
            } else if (coupon.getType() == CouponTypeEnum.rebatePercentCoupon) {
                userOtherMsgNotificationService.rewardCouponGet(userCoupon, coupon.getPercent().intValue());
            }
        } catch (Exception e) {
        if (needNotify) {
            try {
                LogHelper.errorDetailInfo(e);
            } catch (Exception e1) {
                e1.printStackTrace();
                if (coupon.getType() == CouponTypeEnum.welfareFreeCoupon) {
                    userOtherMsgNotificationService.welfareCouponGet(userCoupon);
                } else if (coupon.getType() == CouponTypeEnum.freeCoupon) {
                    userOtherMsgNotificationService.freeSheetCouponGet(userCoupon);
                } else if (coupon.getType() == CouponTypeEnum.rebatePercentCoupon) {
                    userOtherMsgNotificationService.rewardCouponGet(userCoupon, coupon.getPercent().intValue());
                }
            } catch (Exception e) {
                try {
                    LogHelper.errorDetailInfo(e);
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        }
        return userCoupon;
    }
@@ -317,10 +321,10 @@
        // 过期券
        updateInvalidSate(uid);
        // 退回券
        sendBackTimeOutCoupon(uid);
        List<UserSystemCouponVO> listVO = userSystemCouponMapper.getCouponListOld(start, count, uid);
        if (listVO == null || listVO.size() == 0) {
            return listVO;
@@ -344,7 +348,7 @@
        if (userInfoExtra != null) {
            inviteCode = userInfoExtra.getInviteCode();
        }
        for (UserSystemCouponVO userCouponVO : listVO) {
            SystemCoupon systemCoupon = userCouponVO.getSystemCoupon();
@@ -386,7 +390,7 @@
                }
                jumpBtn = new HashMap<String, Object>();
                // 福利券需要激活界面
                if (!changeJump) {
                    jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("invite"));
@@ -399,7 +403,7 @@
                        jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("invite_activate"));
                    }
                }
            } else if (stateActivated == 1) {
                // 显示规则
                userCouponVO.setCouponRule(systemCoupon.getRule());
@@ -500,7 +504,7 @@
            if (source != null && "奖励券天天抽".equals(source)) {
                source = "天天抽";
            }
            userCouponVO.setSource("来源:" + source);
            userCouponVO.setCouponName(systemCoupon.getName());
            userCouponVO.setCouponEffect(systemCoupon.getEffect());
@@ -548,7 +552,6 @@
        return listVO;
    }
    /**
     * 是否存在奖励券
     * 
@@ -576,14 +579,14 @@
    @Transactional
    @Override
    public List<UserSystemCouponVO> getOrderCouponList(Long uid) throws UserSystemCouponException, Exception {
        if (uid == null) {
            throw new UserSystemCouponException(1, "用户未登录");
        }
        // 过期券
        updateInvalidSate(uid);
        // 退回券
        sendBackTimeOutCoupon(uid);
@@ -611,10 +614,10 @@
        // 过期券
        updateInvalidSate(uid);
        // 退回券
        sendBackTimeOutCoupon(uid);
        // 商品相关的券
        List<SystemCoupon> couponList = systemCouponService.getGoodsCouponList();
        if (couponList == null || couponList.size() == 0) {
@@ -622,7 +625,7 @@
        }
        List<UserSystemCouponVO> list = getEnableListByCouponId(uid, null, couponList);
        // 获取商品详情
        TaoBaoGoodsBrief taoBaoGoodsBrief = redisManager.getTaoBaoGoodsBrief(auctionId);
        if (taoBaoGoodsBrief != null) {
@@ -647,47 +650,45 @@
        return list;
    }
    @Override
    public long countUsableFreeCouponForBuy (Long uid) {
        if (uid == null)
    public long countUsableFreeCouponForBuy(Long uid) {
        if (uid == null)
            return 0;
        List<SystemCoupon> couponList = systemCouponService.getGoodsCouponList();
        if (couponList == null || couponList.size() == 0)
            return 0;
        List<Long> listCouponId = new ArrayList<Long>();
        for (SystemCoupon systemCoupon : couponList) {
            listCouponId.add(systemCoupon.getId());
        }
        return userSystemCouponMapper.countUsableByUid(uid, listCouponId);
    }
    @Override
    public long countUsableRewardCoupon (Long uid) {
        if (uid == null)
    public long countUsableRewardCoupon(Long uid) {
        if (uid == null)
            return 0;
        List<SystemCoupon> couponList = systemCouponService.getOrderCouponList();
        if (couponList == null || couponList.size() == 0)
            return 0;
        List<Long> listCouponId = new ArrayList<Long>();
        for (SystemCoupon systemCoupon : couponList) {
            listCouponId.add(systemCoupon.getId());
        }
        return userSystemCouponMapper.countUsableByUid(uid, listCouponId);
    }
    @Transactional
    @Override
    public void useGoodsCoupon(Long uid, Long id, Long goodId, Integer sourceType) throws UserSystemCouponException, Exception {
    public void useGoodsCoupon(Long uid, Long id, Long goodId, Integer sourceType)
            throws UserSystemCouponException, Exception {
        if (uid == null) {
            throw new UserSystemCouponException(1, "用户未登录");
        }
@@ -700,7 +701,7 @@
        if (userSystemCoupon == null) {
            throw new UserSystemCouponException(1, "券数据不正确");
        }
        if (userSystemCoupon.getUid().longValue() != uid) {
            throw new UserSystemCouponException(1, "不属于该用户的券");
        }
@@ -763,16 +764,17 @@
    @Transactional
    @Override
    public void useOrderCoupon(Long uid, Long id, String orderNo, Integer sourceType) throws UserSystemCouponException, Exception {
    public void useOrderCoupon(Long uid, Long id, String orderNo, Integer sourceType)
            throws UserSystemCouponException, Exception {
        if (id == null) {
            throw new UserSystemCouponException(1, "券id不存在");
        }
        if (sourceType == null) {
            sourceType = Constant.SOURCE_TYPE_TAOBAO;
        }
        // 用户券
        UserSystemCoupon userSystemCoupon = selectByPrimaryKey(id);
        if (userSystemCoupon == null) {
@@ -807,7 +809,8 @@
        }
        // 订单
        CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(uid, orderNo, CommonOrder.STATE_JS, sourceType);
        CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(uid, orderNo, CommonOrder.STATE_JS,
                sourceType);
        if (orderVO == null) {
            throw new UserSystemCouponException(1, "订单信息获取失败");
        }
@@ -843,7 +846,7 @@
            hongBaoV2.setUserInfo(new UserInfo(uid));
            hongBaoV2.setPreGetTime(new Date());
            hongBaoV2.setGetTime(new Date());
            hongBaoV2Service.insertSelective(hongBaoV2);
            // 2.插入关联
@@ -890,7 +893,8 @@
    }
    @Override
    public UserSystemCouponRecordVO getRewardCouponRecord(String orderNo, Integer sourceType) throws UserSystemCouponException, Exception {
    public UserSystemCouponRecordVO getRewardCouponRecord(String orderNo, Integer sourceType)
            throws UserSystemCouponException, Exception {
        if (orderNo == null || orderNo.trim().length() == 0) {
            throw new UserSystemCouponException(1, "订单号不存在");
@@ -968,7 +972,8 @@
    }
    @Override
    public UserSystemCouponRecordVO getFreeCouponRecord(String orderNo, Integer sourceType) throws UserSystemCouponException, Exception {
    public UserSystemCouponRecordVO getFreeCouponRecord(String orderNo, Integer sourceType)
            throws UserSystemCouponException, Exception {
        if (orderNo == null || orderNo.trim().length() == 0) {
            throw new UserSystemCouponException(1, "订单号不存在");
@@ -996,7 +1001,8 @@
        }
        // 订单
        CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(userSystemCoupon.getUid(), orderNo, null, sourceType);
        CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(userSystemCoupon.getUid(), orderNo, null,
                sourceType);
        if (orderVO == null) {
            throw new UserSystemCouponException(1, "订单信息获取失败");
        }
@@ -1266,7 +1272,8 @@
        } else if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType())) {
            userOtherMsgNotificationService.freeSheetCouponUsed(record.getUserSystemCoupon(), orderNo);
        } else if (CouponTypeEnum.freeCouponBuy.name().equals(record.getCouponType())) {
            userOtherMsgNotificationService.couponUsedFreeSheet(record.getUserSystemCoupon(), orderNo, MsgTypeOtherTypeEnum.freeCouponBuy);
            userOtherMsgNotificationService.couponUsedFreeSheet(record.getUserSystemCoupon(), orderNo,
                    MsgTypeOtherTypeEnum.freeCouponBuy);
        }
    }
@@ -1274,8 +1281,7 @@
    public List<UserSystemCoupon> getCounponNowInvalid(int count) {
        return userSystemCouponMapper.getCounponNowInvalid(count);
    }
    @Transactional
    @Override
    public boolean updateCouponRecordUsed(Long uid, String orderNo, BigDecimal payment, Long auctionId)
@@ -1346,7 +1352,8 @@
                } else if (CouponTypeEnum.freeCoupon.name().equals(couponType)) {
                    userOtherMsgNotificationService.freeSheetCouponUsing(userSystemCoupon, orderNo, payment);
                } else if (CouponTypeEnum.freeCouponBuy.name().equals(couponType)) {
                    userOtherMsgNotificationService.couponUsingFreeSheet(userSystemCoupon, orderNo, payment, MsgTypeOtherTypeEnum.freeCouponBuy);
                    userOtherMsgNotificationService.couponUsingFreeSheet(userSystemCoupon, orderNo, payment,
                            MsgTypeOtherTypeEnum.freeCouponBuy);
                }
            }
        }
@@ -1354,20 +1361,18 @@
        return isfree;
    }
    @Override
    @Transactional
    public void copyLotteryPrize(Long uid, int platform, String device) throws Exception {
        return;
        /*
         * if (uid == null || device == null) { return; }
         * 
         * // 未登陆之前抽奖记录 List<DeviceLotteryRecord> list =
         * deviceLotteryRecordService.listByPlatformAndDevice(platform, device); if
         * (list == null || list.size() == 0) { return; }
         * deviceLotteryRecordService.listByPlatformAndDevice(platform, device);
         * if (list == null || list.size() == 0) { return; }
         * 
         * // 获取额外信息 UserInfoExtra userInfoExtra =
         * userInfoExtraService.getUserInfoExtra(uid);
@@ -1383,40 +1388,44 @@
         * for (DeviceLotteryRecord reviceLotteryRecord : list) {
         * 
         * // 删除记录
         * deviceLotteryRecordService.deleteByPrimaryKey(reviceLotteryRecord.getId());
         * deviceLotteryRecordService.deleteByPrimaryKey(reviceLotteryRecord.
         * getId());
         * 
         * Long systemCouponId = reviceLotteryRecord.getSystemCouponId(); if
         * (systemCouponId == null) { continue; } SystemCoupon systemCoupon =
         * systemCouponService.selectByPrimaryKey(systemCouponId); if (systemCoupon ==
         * null) { continue; }
         * systemCouponService.selectByPrimaryKey(systemCouponId); if
         * (systemCoupon == null) { continue; }
         * 
         * int stateActivated = 1; if (systemCoupon.getType() ==
         * CouponTypeEnum.welfareFreeCoupon) { // 福利券状态 long countSuccess =
         * threeSaleSerivce.countSuccessFirstTeam(uid); // 没有下级队员 --待激活 if (countSuccess
         * == 0) { stateActivated = 0; } }
         * threeSaleSerivce.countSuccessFirstTeam(uid); // 没有下级队员 --待激活 if
         * (countSuccess == 0) { stateActivated = 0; } }
         * 
         * // 结束日期 // 今天在内 减去一天 String endDay =
         * DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date());
         * SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if
         * (endDay != null && endDay.trim().length() > 0) { endDay += " 23:59:59"; }
         * Date endTime = format.parse(endDay);
         * SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"
         * ); if (endDay != null && endDay.trim().length() > 0) { endDay +=
         * " 23:59:59"; } Date endTime = format.parse(endDay);
         * 
         * UserSystemCoupon userCoupon = new UserSystemCoupon(); userCoupon.setUid(uid);
         * UserSystemCoupon userCoupon = new UserSystemCoupon();
         * userCoupon.setUid(uid);
         * userCoupon.setSource(UserSystemCoupon.SOURCE_NEWBIES);
         * userCoupon.setSystemCoupon(systemCoupon);
         * userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
         * userCoupon.setStateActivated(stateActivated); userCoupon.setStartTime(new
         * Date()); userCoupon.setEndTime(endTime); userCoupon.setCreateTime(new
         * Date()); userCoupon.setUpdateTime(new Date()); // 插入数据库
         * insertSelective(userCoupon);
         * userCoupon.setStateActivated(stateActivated);
         * userCoupon.setStartTime(new Date()); userCoupon.setEndTime(endTime);
         * userCoupon.setCreateTime(new Date()); userCoupon.setUpdateTime(new
         * Date()); // 插入数据库 insertSelective(userCoupon);
         * 
         * // 券数量 coupon++;
         * 
         * // 消息推送 try { if (systemCoupon.getType() == CouponTypeEnum.welfareFreeCoupon)
         * { userOtherMsgNotificationService.welfareCouponGet(userCoupon); } else if
         * (systemCoupon.getType() == CouponTypeEnum.freeCoupon) {
         * userOtherMsgNotificationService.freeSheetCouponGet(userCoupon); } else if
         * (systemCoupon.getType() == CouponTypeEnum.rebatePercentCoupon) {
         * // 消息推送 try { if (systemCoupon.getType() ==
         * CouponTypeEnum.welfareFreeCoupon) {
         * userOtherMsgNotificationService.welfareCouponGet(userCoupon); } else
         * if (systemCoupon.getType() == CouponTypeEnum.freeCoupon) {
         * userOtherMsgNotificationService.freeSheetCouponGet(userCoupon); }
         * else if (systemCoupon.getType() ==
         * CouponTypeEnum.rebatePercentCoupon) {
         * userOtherMsgNotificationService.rewardCouponGet(userCoupon,
         * systemCoupon.getPercent().intValue()); }
         * 
@@ -1434,34 +1443,33 @@
         */
    }
    @Override
    @Transactional
    public void randomRewardCoupon(int num, Long uid, String source) throws Exception {
        if (num < 1) {
            return;
        }
        for (int i = 0; i < num; i++) {
            // 返利比-随机
            BigDecimal percent = new BigDecimal(randomNum());
            // 查询奖励券
            SystemCoupon systemCoupon = systemCouponService.getCouponByTypeAndPercent(
                    CouponTypeEnum.rebatePercentCoupon.name(),percent);
            SystemCoupon systemCoupon = systemCouponService
                    .getCouponByTypeAndPercent(CouponTypeEnum.rebatePercentCoupon.name(), percent);
            if (systemCoupon == null) {
                return;
            }
            // 结束日期 今天在内  减去一天
            // 结束日期 今天在内 减去一天
            String endDay = DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date());
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            if (endDay != null && endDay.trim().length() > 0) {
                endDay += " 23:59:59";
            }
            Date endTime = format.parse(endDay);
            UserSystemCoupon userCoupon = new UserSystemCoupon();
            userCoupon.setUid(uid);
            userCoupon.setSource(source);
@@ -1474,11 +1482,11 @@
            userCoupon.setUpdateTime(new Date());
            // 插入数据库
            insertSelective(userCoupon);
            // 消息推送
            try {
                userOtherMsgNotificationService.rewardCouponGet(userCoupon,systemCoupon.getPercent().intValue());
            } catch(Exception e) {
                userOtherMsgNotificationService.rewardCouponGet(userCoupon, systemCoupon.getPercent().intValue());
            } catch (Exception e) {
                try {
                    LogHelper.errorDetailInfo(e);
                } catch (Exception e1) {
@@ -1486,7 +1494,7 @@
                }
            }
        }
        // 福利中心红点
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra == null) {
@@ -1500,15 +1508,28 @@
        }
        userInfoExtraService.saveUserInfoExtra(userInfoExtra);
    }
    @Override
    @Transactional(rollbackFor=Exception.class)
    public void systemGiveRewardCoupon(Long uid, int num, String orderId, Integer orderType, String reason)
            throws Exception {
        // 添加奖励券
        insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(), "系统赠送",
                new BigDecimal(configService.get("exchange_rebate_percent")),false);
        // 添加奖励券消息
        userOtherMsgNotificationService.systemGiveRewardCoupon(uid, null, MsgOtherSystemGiveDTOFactory
                .createRewardCouponGive(num, "请按照返利奖励券规则使用", "返利奖励券", orderId, orderType, reason));
    }
    /**
     * 随机券比例
     *
     * @return
     */
    public int randomNum() {
        int result = 1;
        List<RandomProportion> list = new ArrayList<RandomProportion>();
        list.add(new RandomProportion(1, 22));
        list.add(new RandomProportion(2, 22));
@@ -1529,40 +1550,41 @@
        int minRange = 0;
        int maxRange = 0;
        int randomNum = (int) (1 + Math.round(Math.random() * (199)));
        for (int i = 0; i < list.size(); i++) {
            RandomProportion proportion = list.get(i);
            int probability = proportion.probability;
            maxRange = maxRange + probability;
            minRange = maxRange - probability;
            if(randomNum > minRange && randomNum <= maxRange) {
            if (randomNum > minRange && randomNum <= maxRange) {
                result = proportion.num;
                break;
            }
        }
        return result;
    }
    class RandomProportion {
        public int num;//券值
        public int num;// 券值
        public int probability; // 概率
        RandomProportion () {}
        RandomProportion (int num, int probability) {
        RandomProportion() {
        }
        RandomProportion(int num, int probability) {
            this.num = num;
            this.probability = probability;
        }
    }
    @Override
    @Transactional
    public void exchangeCoupon(Long uid, String couponType, String source, BigDecimal percent) throws UserSystemCouponException, Exception {
    public void exchangeCoupon(Long uid, String couponType, String source, BigDecimal percent)
            throws UserSystemCouponException, Exception {
        if (couponType == null || uid == null) {
            throw new UserSystemCouponException(1, "参数不正确");
        }
@@ -1573,7 +1595,7 @@
        } else {
            coupon = systemCouponService.getCouponByType(couponType);
        }
        if (coupon == null) {
            throw new UserSystemCouponException(1, "券类型不正确");
        }
@@ -1581,20 +1603,19 @@
        int stateActivated = 1;
        if (couponType == CouponTypeEnum.freeCoupon.name()) {
            stateActivated = 0; //
        } else if (couponType == CouponTypeEnum.welfareFreeCoupon.name() && threeSaleSerivce.countSuccessFirstTeam(uid) <= 0) {
            stateActivated = 0;  // 无下级队员 --待激活
        }
        } else if (couponType == CouponTypeEnum.welfareFreeCoupon.name()
                && threeSaleSerivce.countSuccessFirstTeam(uid) <= 0) {
            stateActivated = 0; // 无下级队员 --待激活
        }
        Integer expiryDay = null;
        if (stateActivated == 0)
        if (stateActivated == 0)
            expiryDay = coupon.getActivateDay();
        if (expiryDay == null || expiryDay == 0)
        if (expiryDay == null || expiryDay == 0)
            expiryDay = coupon.getExpiryDay();
        //  计算结束日期:今天在内  减去一天
        // 计算结束日期:今天在内 减去一天
        String endDay = DateUtil.plusDay(expiryDay - 1, new Date());
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (endDay != null && endDay.trim().length() > 0) {
@@ -1613,26 +1634,24 @@
        userCoupon.setCreateTime(new Date());
        userCoupon.setUpdateTime(new Date());
        userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
        insertSelective(userCoupon);
    }
    @Transactional
    @Override
    public List<UserSystemCouponVO> getCouponList(long start, int count, Long uid)
            throws UserSystemCouponException, Exception {
        // 过期券
        updateInvalidSate(uid);
        // 退回券
        sendBackTimeOutCoupon(uid);
        // 赠送的退回
        sendBackGiveUser(uid);
        List<UserSystemCouponVO> listVO = userSystemCouponMapper.getUserCouponVOList(start, count, uid);
        if (listVO == null || listVO.size() == 0) {
            return listVO;
@@ -1659,7 +1678,7 @@
            if (source != null && "奖励券天天抽".equals(source)) {
                source = "天天抽";
            }
            userCouponVO.setSource("来源:" + source);
            userCouponVO.setCouponName(systemCoupon.getName());
            userCouponVO.setCouponEffect(systemCoupon.getEffect());
@@ -1716,7 +1735,7 @@
                        listTip.add("满足条件后,系统将自动激活,并在消息-其它消息中提醒。");
                        userCouponVO.setTips(listTip);
                        userCouponVO.setPopup(true);
                        // 验证是否已累计3单
                        executor.execute(new Runnable() {
                            @Override
@@ -1724,7 +1743,7 @@
                                freeCouponActivate(userCouponVO.getId(), uid, userCouponVO.getCreateTime());
                            }
                        });
                    } else if (CouponTypeEnum.welfareFreeCoupon == type) {
                        jumpBtn = new HashMap<String, Object>();
                        if (inviteCode != null && inviteCode.trim().length() > 0) {
@@ -1733,7 +1752,7 @@
                            jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("invite_activate"));
                        }
                    }
                }
                }
            }
            if (UserSystemCoupon.STATE_IN_USE == state && (CouponTypeEnum.freeCouponBuy == type
@@ -1750,9 +1769,9 @@
            if (give == null) {
                give = false;
            }
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
            if (UserSystemCoupon.STATE_CAN_USE == state) {
                Map<String, Object> jumpLink = new HashMap<String, Object>();
                if (CouponTypeEnum.freeCouponGive == type) {
@@ -1770,7 +1789,7 @@
                    // 订单列表
                    jumpLink.put("state", "2"); // 已收货
                    jumpLink.put("showNav", false); // 不显示上方统计信息
                    jumpLink.put("type", "1");  // 返利订单
                    jumpLink.put("type", "1"); // 返利订单
                    jumpLink.put("title", "返利订单"); // 标题名
                    jumpLink.put("goodsType", "0"); // 订单来源
                    jumpBtn = new HashMap<String, Object>();
@@ -1781,33 +1800,36 @@
                userCouponVO.setCouponEffect("赠送中");
                userCouponVO.setCouponRule(systemCoupon.getRemark());
                String tips = null;
                TokenTypeEnum tokenType = null;
                if (CouponTypeEnum.freeCouponGive == type) {
                    userCouponVO.setState(UserSystemCoupon.STATE_GIVE_IN);
                    tips = configService.get("give_free_coupon_tips");
                    tokenType = TokenTypeEnum.freeCoupon;
                }
                if (CouponTypeEnum.rebatePercentCoupon == type) {
                    userCouponVO.setState(UserSystemCoupon.STATE_GIVE_IN);
                    tips = configService.get("give_rebate_percent_coupon_tips");
                    tokenType = TokenTypeEnum.rebatePercentCoupon;
                }
                if (!StringUtil.isNullOrEmpty(tips) && tokenType != null) {
                    UserSystemCouponGiveRecord record = userSystemCouponGiveRecordService.getRecordByUidAndCouponId(uid, userCouponVO.getId());
                    UserSystemCouponGiveRecord record = userSystemCouponGiveRecordService.getRecordByUidAndCouponId(uid,
                            userCouponVO.getId());
                    if (record != null) {
                        TokenRecord tokenRecord = tokenRecordService.getNearByTypeAndIdentify(tokenType.name(), record.getId().toString());
                        TokenRecord tokenRecord = tokenRecordService.getNearByTypeAndIdentify(tokenType.name(),
                                record.getId().toString());
                        if (tokenRecord != null && !StringUtil.isNullOrEmpty(tokenRecord.getToken())) {
                            String projectChineseName = Constant.systemCommonConfig.getProjectChineseName();
                            while(tips.contains("{APP名称}")) {
                            while (tips.contains("{APP名称}")) {
                                tips = tips.replace("{APP名称}", projectChineseName);
                            }
                            tips = tips.replace("{口令}", tokenRecord.getToken()).replace("{下载链接}", configService.get("app_down_link"));
                            tips = tips.replace("{口令}", tokenRecord.getToken()).replace("{下载链接}",
                                    configService.get("app_down_link"));
                            userCouponVO.setGiveTips(tips);
                        }
                        Date endTimeGive = record.getEndTime();
                        if (endTimeGive != null) {
                            Map<String, Object> remainDays = new HashMap<String, Object>();
@@ -1815,21 +1837,21 @@
                            remainDays.put("fontColor", "#F14242");
                            userCouponVO.setRemainDays(remainDays);
                        }
                    }
                }
                    }
                }
            } else if (UserSystemCoupon.STATE_END_USE == state) {
                if (give) {
                    userCouponVO.setCouponRule(systemCoupon.getRemark());
                    if (CouponTypeEnum.freeCouponGive == type) {
                        userCouponVO.setCouponEffect("任性0元购");
                        userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
                    }
                    if (CouponTypeEnum.rebatePercentCoupon == type) {
                        userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
                    }
                    Date useTime = userCouponVO.getUseTime();
                    if (useTime != null) {
                        Map<String, Object> remainDays = new HashMap<String, Object>();
@@ -1846,79 +1868,77 @@
                        userCouponVO.setRemainDays(remainDays);
                    }
                }
            }else if (UserSystemCoupon.STATE_OVERDUE == state) {
            } else if (UserSystemCoupon.STATE_OVERDUE == state) {
                if (endTime != null) {
                    Map<String, Object> remainDays = new HashMap<String, Object>();
                    remainDays.put("content", "于" + sdf.format(endTime) + "过期");
                    remainDays.put("fontColor", "#CCCCCC");
                    userCouponVO.setRemainDays(remainDays);
                }
                if(give)
                if (give)
                    userCouponVO.setCouponRule(systemCoupon.getRemark());
            }
            userCouponVO.setJumpBtn(jumpBtn);
        }
        return listVO;
    }
    @Transactional
    @Override
    public UserSystemCouponVO giveCoupon(Long uid, Long id) throws UserSystemCouponException {
        UserSystemCoupon userSystemCoupon = userSystemCouponMapper.selectByPrimaryKey(id);
        if (userSystemCoupon == null)
            throw new UserSystemCouponException(1, "该券已不存在");
        SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
        if (systemCoupon == null)
            throw new UserSystemCouponException(1, "该券已不存在");
        systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
        if (systemCoupon == null)
            throw new UserSystemCouponException(1, "该券已失效");
        Integer state = userSystemCoupon.getState();
        if (state != UserSystemCoupon.STATE_CAN_USE)
        if (state != UserSystemCoupon.STATE_CAN_USE)
            throw new UserSystemCouponException(1, "该券已被使用或赠送");
        CouponTypeEnum type = systemCoupon.getType();
        if (type != CouponTypeEnum.freeCouponGive && type != CouponTypeEnum.rebatePercentCoupon )
        if (type != CouponTypeEnum.freeCouponGive && type != CouponTypeEnum.rebatePercentCoupon)
            throw new UserSystemCouponException(1, "该券不支持赠送");
        String tips = null;
        TokenTypeEnum tokenTypeEnum = null;
        if (type == CouponTypeEnum.freeCouponGive) {
            tokenTypeEnum = TokenTypeEnum.freeCoupon;
            tips = configService.get("give_free_coupon_tips");
        } else if (type == CouponTypeEnum.rebatePercentCoupon){
        } else if (type == CouponTypeEnum.rebatePercentCoupon) {
            tokenTypeEnum = TokenTypeEnum.rebatePercentCoupon;
            tips = configService.get("give_rebate_percent_coupon_tips");
        } else {
            throw new UserSystemCouponException(1, "该券不支持赠送");
        }
        if (StringUtil.isNullOrEmpty(tips))
            throw new UserSystemCouponException(1, "tips数据缺失");
        // 是否最近生成口令有效
        UserSystemCouponGiveRecord record = userSystemCouponGiveRecordService.getRecordByUidAndCouponId(uid, id);
        if (record != null) {
            TokenRecord tokenRecord = tokenRecordService.getNearByTypeAndIdentify(tokenTypeEnum.name(), id+"");
            TokenRecord tokenRecord = tokenRecordService.getNearByTypeAndIdentify(tokenTypeEnum.name(), id + "");
            if (tokenRecord != null && !StringUtil.isNullOrEmpty(tokenRecord.getToken())) {
                String projectChineseName = Constant.systemCommonConfig.getProjectChineseName();
                while(tips.contains("{APP名称}")) {
                while (tips.contains("{APP名称}")) {
                    tips = tips.replace("{APP名称}", projectChineseName);
                }
                tips = tips.replace("{口令}", tokenRecord.getToken()).replace("{下载链接}", configService.get("app_down_link"));
                tips = tips.replace("{口令}", tokenRecord.getToken()).replace("{下载链接}",
                        configService.get("app_down_link"));
                return createUserCouponVOo(userSystemCoupon, systemCoupon, record, tips);
            }
        }
        Date nowDate = new Date();
        // 插入赠送记录
        UserSystemCouponGiveRecord giveRecord = new UserSystemCouponGiveRecord();
@@ -1927,28 +1947,28 @@
        giveRecord.setGiveTime(nowDate);
        giveRecord.setEndTime(DateUtil.plusDayDate(Constant.GIVE_DAYS, nowDate));
        userSystemCouponGiveRecordService.insertSelective(giveRecord);
        // 创建记录
        TokenRecord tokenRecord = new TokenRecord();
        tokenRecord.setUid(uid);
        tokenRecord.setIdentify(giveRecord.getId()+"");
        tokenRecord.setIdentify(giveRecord.getId() + "");
        tokenRecord.setType(tokenTypeEnum);
        tokenRecord.setStartTime(nowDate);
        tokenRecord.setEndTime(DateUtil.plusDayDate(Constant.TOKEN_DAYS, nowDate));
        tokenRecord.setState(0);
        tokenRecordService.insertSelective(tokenRecord);
        // 创建口令
        String token = TokenUtil.createToken(tokenRecord.getId());
        tokenRecord.setToken(token);
        tokenRecordService.updateByPrimaryKeySelective(tokenRecord);
        // 券状态
        userSystemCoupon.setState(UserSystemCoupon.STATE_IN_USE);
        userSystemCoupon.setGive(true);
        userSystemCoupon.setUpdateTime(nowDate);
        userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
        // 插入使用券记录
        UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
        couponRecord.setState(UserSystemCouponRecord.STATE_GIVE_ON);
@@ -1957,18 +1977,17 @@
        couponRecord.setCreateTime(nowDate);
        couponRecord.setUpdateTime(nowDate);
        userSystemCouponRecordService.insertSelective(couponRecord);
        String projectChineseName = Constant.systemCommonConfig.getProjectChineseName();
        while(tips.contains("{APP名称}")) {
        while (tips.contains("{APP名称}")) {
            tips = tips.replace("{APP名称}", projectChineseName);
        }
        tips = tips.replace("{口令}", token).replace("{下载链接}", configService.get("app_down_link"));
        return createUserCouponVOo(userSystemCoupon, systemCoupon, giveRecord, tips);
    }
    private UserSystemCouponVO createUserCouponVOo(UserSystemCoupon userSystemCoupon, SystemCoupon systemCoupon,
    private UserSystemCouponVO createUserCouponVOo(UserSystemCoupon userSystemCoupon, SystemCoupon systemCoupon,
            UserSystemCouponGiveRecord record, String tips) {
        UserSystemCouponVO userCouponVO = new UserSystemCouponVO();
        userCouponVO.setId(userSystemCoupon.getId());
@@ -1981,7 +2000,7 @@
        userCouponVO.setCouponRuleLink(systemCoupon.getRuleLink());
        userCouponVO.setCouponPicture(systemCoupon.getPicture());
        userCouponVO.setGiveTips(tips);
        String couponTerm = "有效期:";
        Date startTime = userCouponVO.getStartTime();
        Date endTime = userCouponVO.getEndTime();
@@ -1990,57 +2009,55 @@
            couponTerm = couponTerm + sdf.format(startTime) + "-" + sdf.format(endTime);
        }
        userCouponVO.setCouponTerm(couponTerm);
        Map<String, Object> remainDays = new HashMap<String, Object>();
        remainDays.put("content", "剩余23时59分过期");
        remainDays.put("fontColor", "#F14242");
        userCouponVO.setRemainDays(remainDays);
        return userCouponVO;
    }
    /**
     * 免单券激活
     *
     * @param uid
     */
    public void freeCouponActivate(Long id,Long uid, Date date) {
    public void freeCouponActivate(Long id, Long uid, Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long count = commonOrderCountService.countValidOrderByDate(uid, sdf.format(date));
        String activateNum = configService.get("free_coupon_activate_num");
        int num = Integer.parseInt(activateNum);
        if (count >= num) {
            UserSystemCoupon coupon = userSystemCouponMapper.selectByPrimaryKey(id);
            if (coupon == null || coupon.getState() != UserSystemCoupon.STATE_CAN_USE
                    || coupon.getStateActivated() != 0)
                return;
            Date nowDate = new Date();
            Date endTime2 = coupon.getEndTime();
            if (endTime2 != null && endTime2.getTime() <= nowDate.getTime())
                return;
            SystemCoupon systemCoupon = coupon.getSystemCoupon();
            if (systemCoupon == null)
                return;
            systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
            if (systemCoupon == null || systemCoupon.getType() != CouponTypeEnum.freeCoupon)
                return;
            try {
                Integer expiryDay =  systemCoupon.getExpiryDay();
                Integer expiryDay = systemCoupon.getExpiryDay();
                String endDay = DateUtil.plusDay(expiryDay - 1, nowDate);
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                if (endDay != null && endDay.trim().length() > 0) {
                    endDay += " 23:59:59";
                }
                Date endTime = format.parse(endDay);
                UserSystemCoupon userCoupon = new UserSystemCoupon();
                userCoupon.setId(coupon.getId());
                userCoupon.setStateActivated(1);
@@ -2048,24 +2065,24 @@
                userCoupon.setStartTime(nowDate);
                userCoupon.setUpdateTime(new Date());
                userSystemCouponMapper.updateByPrimaryKeySelective(userCoupon);
                // 赠送记录
                UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService.getByReceiveId(id);
                if (giveRecord == null)
                if (giveRecord == null)
                    return;
                Long giveUid = giveRecord.getGiveUid();
                UserInfo userInfo = userInfoService.selectByPKey(giveUid);
                if (userInfo == null)
                if (userInfo == null)
                    return;
                String beiZhu = "请到我的-福利中心中查看";
                SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
                MsgOtherCouponActivateDTO msgOther = new MsgOtherCouponActivateDTO();
                msgOther.setTitle("免单券激活");
                msgOther.setType("免单券系统已自动激活");
                msgOther.setExplain("满足"+ systemCoupon.getActivateDay() +"天内产生"+ num +"笔已到账返利订单");
                msgOther.setGiveUser("昵称:"+ userInfo.getNickName() +" ID:" + giveUid);
                msgOther.setExplain("满足" + systemCoupon.getActivateDay() + "天内产生" + num + "笔已到账返利订单");
                msgOther.setGiveUser("昵称:" + userInfo.getNickName() + " ID:" + giveUid);
                msgOther.setReceiveTime(sd.format(giveRecord.getReceiveTime()));
                msgOther.setValidityTime(expiryDay + "天");
                userOtherMsgNotificationService.giveCouponActivateMsg(uid, beiZhu, msgOther);
@@ -2075,8 +2092,7 @@
            }
        }
    }
    @Transactional
    @Override
    public void updateInvalidSate(Long uid) {
@@ -2086,8 +2102,7 @@
        }
        updateCounponInvalid(list);
    }
    @Override
    public void updateCounponInvalid(List<UserSystemCoupon> list) {
        if (list == null || list.size() == 0) {
@@ -2104,7 +2119,7 @@
            if (baseCoupon == null) {
                continue;
            }
            baseCoupon = systemCouponService.selectByPrimaryKey(baseCoupon.getId());
            if (baseCoupon == null || baseCoupon.getId() == null) {
                continue;
@@ -2118,7 +2133,7 @@
                    userOtherMsgNotificationService.freeSheetCouponAlreadyOutOfDate(userSystemCoupon);
                } else if (baseCoupon.getType() == CouponTypeEnum.rebatePercentCoupon) {
                    userOtherMsgNotificationService.rewardCouponAlreadyOutOfDate(userSystemCoupon);
                }else if (baseCoupon.getType() == CouponTypeEnum.freeCouponBuy) {
                } else if (baseCoupon.getType() == CouponTypeEnum.freeCouponBuy) {
                    userOtherMsgNotificationService.outOfDate(userSystemCoupon, MsgTypeOtherTypeEnum.freeCouponBuy);
                } else if (baseCoupon.getType() == CouponTypeEnum.freeCouponGive) {
                    userOtherMsgNotificationService.outOfDate(userSystemCoupon, MsgTypeOtherTypeEnum.freeCouponGive);
@@ -2132,8 +2147,7 @@
            }
        }
    }
    /**
     * 退回券 初始数据
     * 
@@ -2142,11 +2156,11 @@
    public void sendBackCoupon(UserSystemCoupon userCoupon, UserSystemCouponRecord record) throws Exception {
        if (userCoupon == null)
            return;
        Integer state = userCoupon.getState();
        if (state != UserSystemCoupon.STATE_IN_USE)
        if (state != UserSystemCoupon.STATE_IN_USE)
            return;
        Date now = new Date();
        Date endTime = userCoupon.getEndTime();
        if (endTime != null && endTime.getTime() < now.getTime()) {
@@ -2156,7 +2170,7 @@
            updateCounponInvalid(list);
            return;
        }
        // 退回券
        UserSystemCoupon userSystemCoupon = new UserSystemCoupon();
        userSystemCoupon.setId(userCoupon.getId());
@@ -2165,20 +2179,20 @@
        userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
        userSystemCoupon.setUpdateTime(new Date());
        userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
        // 使用记录
        if  (record != null) {
        if (record != null) {
            if (CouponTypeEnum.welfareFreeCoupon.name().equals(record.getCouponType())) {
                userOtherMsgNotificationService.welfareCouponDrawBack(userSystemCoupon, record.getOrderNo());
            } else if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType())) {
                userOtherMsgNotificationService.freeSheetCouponDrawBack(userSystemCoupon, record.getOrderNo());
            } else if (CouponTypeEnum.freeCouponBuy.name().equals(record.getCouponType())) {
                userOtherMsgNotificationService.couponDrawBack(userSystemCoupon, record.getOrderNo(), MsgTypeOtherTypeEnum.freeCouponBuy);
                userOtherMsgNotificationService.couponDrawBack(userSystemCoupon, record.getOrderNo(),
                        MsgTypeOtherTypeEnum.freeCouponBuy);
            }
        }
    }
    @Async()
    @Transactional
    @Override
@@ -2190,11 +2204,11 @@
        }
        List<Long> list = new ArrayList<Long>();
        for (SystemCoupon systemCoupon: couponList) {
        for (SystemCoupon systemCoupon : couponList) {
            list.add(systemCoupon.getId());
        }
        // 超过10分钟   未被匹配的免单券
        // 超过10分钟 未被匹配的免单券
        List<UserSystemCoupon> listUserCoupon = userSystemCouponMapper.getCouponByUsingTimeOut(uid, list, 600L);
        if (listUserCoupon == null || listUserCoupon.size() == 0) {
            return;
@@ -2208,7 +2222,7 @@
            userSystemCoupon.setUseTime(null);
            userSystemCoupon.setUpdateTime(new Date());
            userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
            UserSystemCouponRecord record = userSystemCouponRecordService.getNearByUserCouponId(userCoupon.getId());
            if (record != null) {
                UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
@@ -2220,41 +2234,40 @@
        }
    }
    @Transactional
    @Override
    public void sendBackGiveUser(Long uid) {
        List<UserSystemCouponGiveRecord> list =userSystemCouponGiveRecordService.overdueListByUser(uid);
        List<UserSystemCouponGiveRecord> list = userSystemCouponGiveRecordService.overdueListByUser(uid);
        if (list == null || list.size() == 0) {
            return;
        }
        sendBackGiveCoupon(list);
    }
    @Override
    public void sendBackGiveCoupon(List<UserSystemCouponGiveRecord> overdueList) {
        for (UserSystemCouponGiveRecord record: overdueList) {
        for (UserSystemCouponGiveRecord record : overdueList) {
            // 更新赠送记录
            UserSystemCouponGiveRecord updateRecord = new UserSystemCouponGiveRecord();
            updateRecord.setId(record.getId());
            updateRecord.setState(UserSystemCouponGiveRecord.STATE_OVERDUE);
            userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateRecord);
            // 更新券信息
            Long couponId = record.getCouponId();
            if (couponId == null) {
                continue;
            }
            // 券列表
            UserSystemCoupon userCoupon = userSystemCouponMapper.selectByPrimaryKey(couponId);
            if (userCoupon == null)
                continue;
            Integer state = userCoupon.getState();
            if (state != UserSystemCoupon.STATE_IN_USE)
            if (state != UserSystemCoupon.STATE_IN_USE)
                return;
            Date now = new Date();
            Date endTime = userCoupon.getEndTime();
            if (endTime != null && endTime.getTime() < now.getTime()) {
@@ -2263,7 +2276,7 @@
                updateCounponInvalid(list);
                continue;
            }
            // 退回券
            UserSystemCoupon userSystemCoupon = new UserSystemCoupon();
            userSystemCoupon.setId(userCoupon.getId());
@@ -2272,25 +2285,24 @@
            userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
            userSystemCoupon.setUpdateTime(new Date());
            userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
            // 使用记录
            UserSystemCouponRecord useRecord = userSystemCouponRecordService.getNearByUserCouponId(couponId);
            if  (useRecord != null) {
            if (useRecord != null) {
                UserSystemCouponRecord useRecordUpdate = new UserSystemCouponRecord();
                useRecordUpdate.setId(useRecord.getId());
                useRecordUpdate.setState(UserSystemCouponRecord.STATE_WAIT_TIME_OUT);
                useRecordUpdate.setUpdateTime(new Date());
                userSystemCouponRecordService.updateByPrimaryKeySelective(useRecordUpdate);
            }
            SystemCoupon systemCoupon = userCoupon.getSystemCoupon();
            if (systemCoupon != null)
            if (systemCoupon != null)
                systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
            if (systemCoupon == null)
                continue;
            // 退回消息
            String couponName = systemCoupon.getName();
            if (CouponTypeEnum.freeCouponGive == systemCoupon.getType()) {
@@ -2298,63 +2310,63 @@
            } else if (CouponTypeEnum.rebatePercentCoupon == systemCoupon.getType()) {
                couponName = "奖励券";
            }
            String beiZhu = "请到我的-福利中心查看";
            SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
            MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
            msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
            msgOther.setTitle(couponName + "退回");
            msgOther.setGiveType("你赠送的"+ couponName + "未被成功领取");
            msgOther.setGiveType("你赠送的" + couponName + "未被成功领取");
            msgOther.setGiveTime(sd.format(record.getGiveTime()));
            msgOther.setReturnTime(sd.format(new Date()));
            userOtherMsgNotificationService.tokenGiveMsg(record.getGiveUid(), beiZhu, msgOther);
        }
    }
    @Override
    public boolean getIncludeExchange(Long uid) {
        // 过期券
        updateInvalidSate(uid);
        String percent = configService.get("exchange_rebate_percent");
        if (StringUtil.isNullOrEmpty(percent))
        if (StringUtil.isNullOrEmpty(percent))
            percent = "35";
        List<UserSystemCoupon> listCoupon = userSystemCouponMapper.getIncludeExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name());
        if (listCoupon == null || listCoupon.size() == 0)
            return false;
        return true;
    }
    @Override
    public boolean getIncludeNotExchange(Long uid) {
        // 过期券
        updateInvalidSate(uid);
        String percent = configService.get("exchange_rebate_percent");
        if (StringUtil.isNullOrEmpty(percent))
            percent = "35";
        List<UserSystemCouponVO> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name());
        List<UserSystemCoupon> listCoupon = userSystemCouponMapper.getIncludeExchange(uid, Integer.parseInt(percent),
                CouponTypeEnum.rebatePercentCoupon.name());
        if (listCoupon == null || listCoupon.size() == 0)
            return false;
        return true;
    }
    @Override
    public List<UserSystemCouponVO> listIncludeNotExchange(Long uid) throws Exception{
    public boolean getIncludeNotExchange(Long uid) {
        // 过期券
        updateInvalidSate(uid);
        String percent = configService.get("exchange_rebate_percent");
        if (StringUtil.isNullOrEmpty(percent))
            percent = "35";
        List<UserSystemCouponVO> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid,
                Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name());
        if (listCoupon == null || listCoupon.size() == 0)
            return false;
        return true;
    }
    @Override
    public List<UserSystemCouponVO> listIncludeNotExchange(Long uid) throws Exception {
        // 过期券
        updateInvalidSate(uid);
        // 退回券
        sendBackTimeOutCoupon(uid);
        String percent = configService.get("exchange_rebate_percent");
        if (StringUtil.isNullOrEmpty(percent))
        if (StringUtil.isNullOrEmpty(percent))
            percent = "35";
        List<UserSystemCouponVO> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name());
        List<UserSystemCouponVO> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid,
                Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name());
        if (listCoupon == null || listCoupon.size() == 0)
            return null;
@@ -2363,14 +2375,14 @@
            if (source != null && "奖励券天天抽".equals(source)) {
                source = "天天抽";
            }
            SystemCoupon systemCoupon = userCouponVO.getSystemCoupon();
            if (systemCoupon == null) {
                continue; // 券信息不完整
            }
            systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
            userCouponVO.setSource("来源:" + source);
            userCouponVO.setCouponName(systemCoupon.getName());
            userCouponVO.setCouponEffect(systemCoupon.getEffect());
@@ -2417,10 +2429,10 @@
        return listCoupon;
    }
    @Override
    public List<UserSystemCoupon> getFreeCouponByType(Long uid, String type) {
        return userSystemCouponMapper.getFreeCouponByType(uid, type);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java
@@ -6,6 +6,7 @@
import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -38,7 +39,7 @@
     * @param startTime
     * @param endTime
     */
    public void welfareCouponActive(UserSystemCoupon coupon,UserInfo worker);
    public void welfareCouponActive(UserSystemCoupon coupon, UserInfo worker);
    /**
     * 福利免单券使用中
@@ -46,7 +47,7 @@
     * @param startTime
     * @param endTime
     */
    public void welfareCouponUsing(UserSystemCoupon coupon,String orderId,BigDecimal money);
    public void welfareCouponUsing(UserSystemCoupon coupon, String orderId, BigDecimal money);
    /**
     * 福利免单券已被使用
@@ -55,7 +56,7 @@
     * @param startTime
     * @param endTime
     */
    public void welfareCouponUsed(UserSystemCoupon coupon,String orderId);
    public void welfareCouponUsed(UserSystemCoupon coupon, String orderId);
    /**
     * 福利免单券即将过期
@@ -72,13 +73,13 @@
     * @param coupon
     */
    public void welfareCouponAlreadyOutOfDate(UserSystemCoupon coupon);
    /**
     * 福利免单券已经退回
     *
     * @param coupon
     */
    public void welfareCouponDrawBack(UserSystemCoupon coupon,String orderId);
    public void welfareCouponDrawBack(UserSystemCoupon coupon, String orderId);
    // 免单券
@@ -99,7 +100,7 @@
     * @param startTime
     * @param endTime
     */
    public void freeSheetCouponUsing(UserSystemCoupon coupon,String orderId,BigDecimal money);
    public void freeSheetCouponUsing(UserSystemCoupon coupon, String orderId, BigDecimal money);
    /**
     * 免单券已经使用
@@ -109,7 +110,7 @@
     * @param startTime
     * @param endTime
     */
    public void freeSheetCouponUsed(UserSystemCoupon coupon,String orderId);
    public void freeSheetCouponUsed(UserSystemCoupon coupon, String orderId);
    /**
     * 免单券即将过期
@@ -129,31 +130,34 @@
     * @param endTime
     */
    public void freeSheetCouponAlreadyOutOfDate(UserSystemCoupon coupon);
    /**
     * 已退回
     *
     * @param coupon
     */
    public void freeSheetCouponDrawBack(UserSystemCoupon coupon,String orderId);
    public void freeSheetCouponDrawBack(UserSystemCoupon coupon, String orderId);
    // 奖励券
    /**
     *  奖励券获得
     * 奖励券获得
     *
     * @param coupon
     * @param percent -百分比
     * @param percent
     *            -百分比
     */
    public void rewardCouponGet(UserSystemCoupon coupon,int percent);
    public void rewardCouponGet(UserSystemCoupon coupon, int percent);
    /**
     * 奖励券使用成功
     *
     * @param coupon
     * @param oldFanLiMoney-原始返利金额
     * @param rewardMoney-奖励金额
     */
    public void rewardCouponUsed(UserSystemCoupon coupon,BigDecimal oldFanLiMoney,BigDecimal rewardMoney,String orderId);
    public void rewardCouponUsed(UserSystemCoupon coupon, BigDecimal oldFanLiMoney, BigDecimal rewardMoney,
            String orderId);
    /**
     * 奖励券即将过期
@@ -163,7 +167,7 @@
     * @param startTime
     * @param endTime
     */
    public void rewardCouponWillOutOfDate(UserSystemCoupon coupon,int percent);
    public void rewardCouponWillOutOfDate(UserSystemCoupon coupon, int percent);
    /**
     * 奖励券已经过期
@@ -174,18 +178,18 @@
     */
    public void rewardCouponAlreadyOutOfDate(UserSystemCoupon coupon);
    /**
     * 淘礼金消息
     *
     * @param uid
     * @param beiZhu
     * @param content
     */
    public void taoLiJinMsg(Long uid, String beiZhu, MsgOtherTaoLiJinContentDTO content);
    /**
     * 口令赠送领取
     *
     * @param uid
     * @param beiZhu
     * @param content
@@ -194,6 +198,7 @@
    /**
     * 兑换消息
     *
     * @param uid
     * @param beiZhu
     * @param content
@@ -202,6 +207,7 @@
    /**
     * 券退回
     *
     * @param coupon
     * @param orderId
     * @param type
@@ -210,6 +216,7 @@
    /**
     * 券
     *
     * @param coupon
     * @param type
     */
@@ -222,13 +229,14 @@
     * @param startTime
     * @param endTime
     */
    public void couponUsingFreeSheet(UserSystemCoupon coupon,String orderId,BigDecimal money, MsgTypeOtherTypeEnum type);
    public void couponUsingFreeSheet(UserSystemCoupon coupon, String orderId, BigDecimal money,
            MsgTypeOtherTypeEnum type);
    public void couponUsedFreeSheet(UserSystemCoupon coupon, String orderId, MsgTypeOtherTypeEnum type);
    /**
     * 赠送的免单券激活
     *
     * @param uid
     * @param beiZhu
     * @param content
@@ -237,10 +245,19 @@
    /**
     * 队员首单奖励邀请人
     *
     * @param uid
     * @param beiZhu
     * @param content
     */
    public void firstOrderRewardMsg(Long uid, String beiZhu, MsgOtherRewardIntegralDTO content);
    /**
     * 系统赠送的免单券
     * @param uid
     * @param beiZhu
     * @param dto
     */
    public void systemGiveRewardCoupon(Long uid, String beiZhu, MsgOtherSystemGiveDTO dto);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderProcessService.java
@@ -118,4 +118,9 @@
     */
    public boolean isShareOrder(CommonOrder commonOrder);
    /**
     * 处理淘宝商家未付款的情况
     */
    public void doTaoBaoSellerNotPaid(TaoBaoOrder order);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/tb/TaoBaoOrderService.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.inter.order.tb;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
@@ -105,4 +106,13 @@
     */
    public Long countBySettlementTime(Long minTime, Long maxTime);
    /**
     * 根据状态和创建时间检索
     *
     * @param state
     * @param minCreateTime
     * @param maxCreateTime
     * @return
     */
    public List<TaoBaoOrder> listByStateAndCreateTime(String state, Date minCreateTime, Date maxCreateTime);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java
@@ -134,7 +134,7 @@
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent) throws UserSystemCouponException, Exception;
    public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent,Boolean needNotify) throws UserSystemCouponException, Exception;
    /**
@@ -200,6 +200,22 @@
     * @throws Exception
     */
    public void randomRewardCoupon(int num, Long uid, String source) throws Exception;
    /**
     * 系统赠送奖励券
     * @param num
     * @param uid
     * @param source
     * @throws Exception
     */
    public void systemGiveRewardCoupon(Long uid,int num,String orderId,Integer orderType,String reason) throws Exception;
    /**
     * 添加券
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/factory/msg/UserMsgVOFactory.java
@@ -12,6 +12,7 @@
import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
@@ -65,12 +66,11 @@
        List<CommonMsgItemVO> items = new ArrayList<>();
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        if (msg.getType() == MsgTypeOrderTypeEnum.found) {
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("订单找回", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("类别", COLOR_TITLE), contentList));
@@ -98,7 +98,6 @@
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
            String orderId = msg.getOrderId();
            MsgTypeOrderTypeEnum type = msg.getType();
@@ -256,11 +255,11 @@
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现账号验证",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.fanli) {
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            // 返利到账
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
@@ -293,9 +292,9 @@
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            // 邀请奖金,分享奖金
            contentList.add(new ClientTextStyleVO(msg.getOrderCount() + "", COLOR_CONTENT));
@@ -338,9 +337,9 @@
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利订单", COLOR_TITLE), contentList));
@@ -367,10 +366,9 @@
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请订单", COLOR_TITLE), contentList));
@@ -398,9 +396,9 @@
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请订单", COLOR_TITLE), contentList));
@@ -428,9 +426,9 @@
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖励订单", COLOR_TITLE), contentList));
@@ -545,41 +543,38 @@
        if (msgType != null && msgType == MsgTypeInviteTypeEnum.receiveGift) {
            if (StringUtil.isNullOrEmpty(msg.getDesc()))
                return null;
            MsgInviteContentDTO dto = new Gson().fromJson(msg.getDesc(), MsgInviteContentDTO.class);
            if (dto == null)
                return null;
            List<CommonMsgItemVO> items = new ArrayList<>();
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            if (!StringUtil.isNullOrEmpty(dto.getState())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getState() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getCode())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getCode() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请码", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getInviter())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getInviter() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请人", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getMode())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getMode() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("激活方式", COLOR_TITLE), contentList));
            }
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
@@ -587,11 +582,11 @@
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", dto.getTitle(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }
        }
        if (msg.getInviteUser() == null || msg.getInviteUser().getWorker() == null)
            return null;
        List<CommonMsgItemVO> items = new ArrayList<>();
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        LogHelper.test("邀请消息:" + new Gson().toJson(msg));
@@ -679,7 +674,7 @@
            if (dto.getLeftDay() != null) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getLeftDay() + "", COLOR_HIGHLIGHT_CONTENT));
                if (msg.getType() == MsgTypeOtherTypeEnum.couponReward) {
                    contentList.add(new ClientTextStyleVO("天(未使用将会过期)", COLOR_CONTENT));
                } else if (msg.getType() == MsgTypeOtherTypeEnum.couponMianDan) {
@@ -687,7 +682,7 @@
                } else {
                    contentList.add(new ClientTextStyleVO("天", COLOR_CONTENT));
                }
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("剩余天数", COLOR_TITLE), contentList));
            }
@@ -761,15 +756,14 @@
                return null;
            String type = dto.getType();
            if (type == null)
            if (type == null)
                return null;
            if (MsgOtherGiveContentDTO.TYEP_COUPON.equalsIgnoreCase(type)) {
                icon = "http://img.flqapp.com/resource/msg/icon_msg_other_coupon.png";
            } else {
                icon = "http://img.flqapp.com/resource/msg/icon_msg_other_tlj.png";
            }
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getGiveType(), COLOR_CONTENT));
@@ -787,13 +781,12 @@
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("赠送时间", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getReceiveTime())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getReceiveTime() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("领取时间", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getReturnTime())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getReturnTime() + "", COLOR_CONTENT));
@@ -804,7 +797,7 @@
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(dto.getTitle());
@@ -820,7 +813,7 @@
                return null;
            icon = "http://img.flqapp.com/resource/msg/icon_msg_other_integral.png";
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getState(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
@@ -856,7 +849,7 @@
                return null;
            icon = "http://img.flqapp.com/resource/msg/icon_msg_other_coupon.png";
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getType(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("类别", COLOR_TITLE), contentList));
@@ -878,7 +871,7 @@
                contentList.add(new ClientTextStyleVO(dto.getReceiveTime() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("获赠时间", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getValidityTime())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getValidityTime() + "", COLOR_CONTENT));
@@ -889,7 +882,7 @@
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(dto.getTitle());
@@ -905,9 +898,9 @@
                return null;
            icon = "http://img.flqapp.com/resource/msg/icon_msg_other_integral.png";
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            if (!StringUtil.isNullOrEmpty(dto.getSource())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getSource() + "", COLOR_CONTENT));
@@ -925,7 +918,7 @@
                contentList.add(new ClientTextStyleVO(dto.getTotal() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("剩余", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getExplain())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getExplain() + "", COLOR_CONTENT));
@@ -936,15 +929,68 @@
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(dto.getTitle());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
            userMsgVO.setContentItems(items);
            return userMsgVO;
        }
        } else if (msg.getType() == MsgTypeOtherTypeEnum.systemGive) {
            if (StringUtil.isNullOrEmpty(msg.getContent()))
                return null;
            MsgOtherSystemGiveDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherSystemGiveDTO.class);
            if (dto == null)
                return null;
            icon = "http://img.flqapp.com/resource/msg/icon_msg_other_system_give.png";
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            if (!StringUtil.isNullOrEmpty(dto.getName())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getName() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("赠品", COLOR_TITLE), contentList));
            }
            if (dto.getCount() != null) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getCount() + "张", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("数量", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getReason())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getReason() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("原因", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getOrderId())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(
                        "[" + Constant.getSourceName(dto.getOrderType()) + "]" + dto.getOrderId() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getDesc())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getDesc(), COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("说明", COLOR_TITLE), contentList));
            }
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
            userMsgVO.setContentItems(items);
            return userMsgVO;
        }
        return new UserMsgVO(icon, msg.getType().getDesc(),
                msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java
@@ -6,6 +6,7 @@
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -579,14 +580,13 @@
        return detail;
    }
    public static List<String> getDingDongQiangTime() {
    public static List<String> getDingDongQiangTime(Calendar nowDate) {
        // 获取当前的小时数
        DingDongTime[] times = new DingDongTime[] { new DingDongTime("0", "00:00"), new DingDongTime("8", "08:00"),
                new DingDongTime("10", "10:00"), new DingDongTime("13", "13:00"), new DingDongTime("15", "15:00"),
                new DingDongTime("17", "17:00"), new DingDongTime("19", "19:00"), new DingDongTime("20", "20:00"),
                new DingDongTime("21", "21:00") };
        Calendar nowDate = Calendar.getInstance();
        Calendar preDate = Calendar.getInstance();
        preDate.setTimeInMillis(nowDate.getTimeInMillis() - 24 * 60 * 60 * 1000L);
@@ -601,7 +601,7 @@
                ? "0" + nowDate.get(Calendar.DAY_OF_MONTH) : nowDate.get(Calendar.DAY_OF_MONTH) + "";
        int hour = nowDate.get(Calendar.HOUR_OF_DAY);
        int pos = 0;
        int pos = times.length - 1;
        for (int i = 0; i < times.length - 1; i++) {
            if (hour >= Integer.parseInt(times[i].getKey()) && hour < Integer.parseInt(times[i + 1].getKey())) {
                pos = i;
@@ -611,6 +611,7 @@
        List<DingDongTime> list = new ArrayList<>();
        //获取当前时间之前的5个数据
        for (int i = 5; i >= 0; i--) {
            int p = pos - i < 0 ? (times.length + pos - i) : pos - i;
            DingDongTime itemData = new DingDongTime(times[p].getKey(), times[p].getValue());
@@ -623,6 +624,7 @@
            list.add(itemData);
        }
        //向后添加剩下的
        if (pos + 1 < times.length)
            for (int i = pos + 1; i < times.length; i++) {
                DingDongTime itemData = new DingDongTime(times[i].getKey(), times[i].getValue());
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -1502,9 +1502,13 @@
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.item.click.extract");
        map.put("click_url", link + "");
        TaoKeAppInfo app = new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
                TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
        JSONObject resultJSON = null;
        try {
            resultJSON = TaoKeBaseUtil.baseRequest(map, true);
            resultJSON = TaoKeBaseUtil.baseRequest(map, app);
            System.out.println(resultJSON);
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        }