yujian
2020-06-28 1e28ac69827ff7578a418a79bd95aff2c6637f5c
2.1.3
40个文件已修改
1913 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/h5/AppH5CouponController.java 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserRankingsMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/redpack/RedPackWinInviteMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/SMSHistory.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/redpack/RedPackDetail.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/redpack/RedPackWinInvite.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/taobao/dataoke/DaTaoKeDetailV2.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/UserRankingsJob.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/UserRankingsMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackWinInviteMapper.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/SMSServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 211 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserRankingsServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackWinInviteService.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/QrCodeService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/SMSService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserAccountService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserRankingsService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/FilePathEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java 219 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/RedisKeyEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/TaoBaoGoodsFactory.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/redpack/RedPackMessageListener.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/HaoDanKuApiUtil.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/goods/OtherInfo.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java
@@ -194,4 +194,69 @@
            e.printStackTrace();
        }
    }
    /**
     * 注销账户短信验证
     * @param acceptData
     * @param uid
     * @param phone
     * @param out
     */
    @RequestMapping(value = "sendMSMRemove")
    public void sendMSMRemove(String callback, AcceptData acceptData, Long uid, String phone, PrintWriter out) {
        if (Constant.IS_TEST) {
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("发送成功"));
            return;
        }
        if (uid == null || uid <= 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (phone == null || !StringUtil.isMobile(phone.replaceAll(" ", ""))) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "请输入正确手机号"));
            return;
        }
        phone = phone.replaceAll(" ", "").trim();
        UserInfo userInfo = userInfoService.selectAvailableByPrimaryKey(uid);
        if (userInfo == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户不存在"));
            return;
        }
        if (!phone.equals(userInfo.getPhone())) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "请输入正确手机号"));
            return;
        }
        try {
            int count = 0;
            String cachekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSBindRemove, phone + "");
            String cacheValue = redisManager.getCommonString(cachekey);
            if (!StringUtil.isNullOrEmpty(cacheValue)) {
                count = Integer.parseInt(cacheValue);
                // 限制3次
                if (count >= 3) {
                    JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "验证码次数超限,请稍后再试"));
                    return;
                }
            }
            // 缓存一个小时
            count++;
            redisManager.cacheCommonString(cachekey, count + "", 60 * 60);
            // 发送验证码
            smsService.sendRemoveVCode(phone, 4);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("发送成功"));
        } catch (SMSException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "发送失败"));
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
@@ -34,6 +34,7 @@
import com.yeshi.fanli.exception.user.AlipayAccountException;
import com.yeshi.fanli.exception.user.AlipayTransferException;
import com.yeshi.fanli.exception.user.UserAccountException;
import com.yeshi.fanli.exception.user.UserInfoException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.ConfigService;
@@ -1337,5 +1338,5 @@
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java
@@ -1,8 +1,10 @@
package com.yeshi.fanli.controller.client.v1;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@@ -12,9 +14,13 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.user.UserSystemCouponException;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemCouponService;
@@ -26,6 +32,13 @@
import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
import com.yeshi.fanli.util.jd.JDUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.vo.homemodule.BannerVO;
import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
import com.yeshi.fanli.vo.user.UserSystemCouponVO;
@@ -74,7 +87,20 @@
    
    @Resource
    private UserInviteService userInviteService;
    @Resource
    private RedisManager redisManager;
    @Resource
    private JDGoodsCacheUtil jdGoodsCacheUtil;
    @Resource
    private PinDuoDuoCacheUtil pinDuoDuoCacheUtil;
    /**
     * 用户券列表查询
     * 
@@ -172,7 +198,6 @@
        try {
            List<UserSystemCouponVO> resultList = UserSystemCouponService.getGoodsCouponList(uid, auctionId);
            if (resultList == null) {
                resultList = new ArrayList<UserSystemCouponVO>();
            }
@@ -186,9 +211,7 @@
            data.put("tip", dataTip);
            data.put("count", resultList.size());
            data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
            out.print(JsonUtil.loadTrueResult(data));
        } catch (UserSystemCouponException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        } catch (Exception e) {
@@ -197,6 +220,9 @@
        }
    }
    /**
     * 免单券使用记录 以及状态修改
     * 
@@ -353,5 +379,113 @@
        }
    }
    
    /**
     * 查询免单券
     * @param acceptData
     * @param uid
     * @param auctionId
     * @param out
     */
    @RequestMapping(value = "getFreeCouponList", method = RequestMethod.POST)
    public void getFreeCouponList(AcceptData acceptData, Long uid, String goodsId, Integer goodsType, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult("用户未登录"));
            return;
        }
        if (goodsType == null || StringUtil.isNullOrEmpty(goodsId)) {
            out.print(JsonUtil.loadFalseResult("参数不完整"));
            return;
        }
        List<UserSystemCouponVO> list = UserSystemCouponService.getFreeCouponList(uid);
        if (list == null)
            list = new ArrayList<>();
        if (list.size() > 0) {
             boolean state = false;
             BigDecimal  priceLimit = BigDecimal.valueOf(9.9);
             switch(goodsType) {
                 case Constant.SOURCE_TYPE_TAOBAO:
                     state = checkCanUsedTB(Long.parseLong(goodsId), priceLimit);
                     break;
                 case Constant.SOURCE_TYPE_JD:
                     state = checkCanUsedTB(Long.parseLong(goodsId), priceLimit);
                     break;
                 case Constant.SOURCE_TYPE_PDD:
                     state = checkCanUsedTB(Long.parseLong(goodsId), priceLimit);
                     break;
                 default:
                     break;
             }
             // 不能使用
             if (!state) {
                 for (UserSystemCouponVO userCouponVO : list) {
                    userCouponVO.setState(0);
                    userCouponVO.setCouponPicture(userCouponVO.getCouponPictureInvalid());
                    Map<String, Object> map = userCouponVO.getRemainDays();
                    if (map != null) {
                        map.put("fontColor", "#CCCCCC");
                    }
                    userCouponVO.setRemainDays(map);
                }
             }
        }
        JSONObject dataTip = new JSONObject();
        dataTip.put("content", configService.get(ConfigKeyEnum.freeCouponTip.getKey()));
        dataTip.put("fontColor", "#F14242");
        JSONObject data = new JSONObject();
        data.put("helpLink", configService.get(ConfigKeyEnum.freeCouponHelp.getKey()));
        data.put("tip", dataTip);
        data.put("count", list.size());
        data.put("list", JsonUtil.getApiCommonGson().toJson(list));
        out.print(JsonUtil.loadTrueResult(data));
    }
    private boolean checkCanUsedTB(Long goodsId, BigDecimal priceLimit) {
        try {
            TaoBaoGoodsBrief goods = redisManager.getTaoBaoGoodsBrief(goodsId);
            if (goods == null)
                return false;
            BigDecimal quanPrice = TaoBaoUtil.getAfterUseCouplePrice(goods);
            if (quanPrice.compareTo(priceLimit) <= 0)
                return true;
        } catch (TaobaoGoodsDownException e) {
            e.printStackTrace();
        }
        return false;
    }
    private boolean checkCanUsedJD(Long goodsId, BigDecimal priceLimit) {
        JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
        if (goods == null)
            return false;
        BigDecimal quanPrice = JDUtil.getQuanPrice(goods);
        if (quanPrice.compareTo(priceLimit) <= 0)
            return true;
        return false;
    }
    private boolean checkCanUsedPDD(Long goodsId, BigDecimal priceLimit) {
        PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
        if (goods == null)
            return false;
        BigDecimal quanPrice = PinDuoDuoUtil.getQuanPrice(goods);
        if (quanPrice.compareTo(priceLimit) <= 0)
            return true;
        return false;
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/h5/AppH5CouponController.java
@@ -18,21 +18,26 @@
import com.yeshi.fanli.entity.bus.lable.QualityFactory;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
import com.yeshi.fanli.entity.goods.FreeGoodsCoupon;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.service.inter.goods.FreeGoodsCouponService;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.service.inter.user.vip.TearcherService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.goods.OtherInfo;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -58,6 +63,12 @@
    @Resource
    private UserVIPInfoService userVIPInfoService;
    @Resource
    private FreeGoodsCouponService freeGoodsCouponService;
    @Resource
    private TearcherService tearcherService;
    @RequestMapping("getMianDanGoodsList")
    public void getMianDanGoodsList(AcceptData acceptData, PrintWriter out, int page, int pageSize, String callback) {
@@ -93,7 +104,7 @@
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        ConfigParamsDTO configParamsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                acceptData.getVersion(),UserLevelEnum.daRen);
                acceptData.getVersion(), UserLevelEnum.daRen);
        /* 遍历列表数据 */
        for (QualityFactory selectionGoods : listQuery) {
@@ -193,4 +204,77 @@
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
    /**
     * 新版免单商品列表
     *
     * @param acceptData
     * @param callback
     * @param page
     * @param goodsType
     * @param out
     */
    @RequestMapping("getFreeGoodsList")
    public void getFreeGoodsList(AcceptData acceptData, String callback, Long uid, int page, int goodsType,
            PrintWriter out) {
        if (uid == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
            return;
        }
        // 获取用户信息
        UserInfo user = userInfoService.getUserById(uid);
        if (user == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户不存在"));
            return;
        }
        String tearcherWX = null;
        TearcherInfo tearcherInfo = tearcherService.selectByUid(uid);
        if (tearcherInfo != null) {
            tearcherWX = tearcherInfo.getWxID();
        }
        // 获取免单券数量
        long couponNum = userSystemCouponService.countUsableFreeCouponForBuy(uid);
        JSONArray array = new JSONArray();
        List<FreeGoodsCoupon> list = freeGoodsCouponService.listByType((page - 1) * Constant.PAGE_SIZE,
                Constant.PAGE_SIZE, goodsType);
        if (list != null && list.size() > 0) {
            Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
            for (FreeGoodsCoupon freeGoods : list) {
                GoodsDetailVO goods = freeGoods.getGoods();
                if (goods == null)
                    continue;
                // 实付款0
                OtherInfo otherInfo = goods.getOtherInfo();
                if (otherInfo == null)
                    otherInfo = new OtherInfo();
                otherInfo.setActualPay(BigDecimal.ZERO);
                // 补齐金额
                if (goods.isHasCoupon()) {
                    otherInfo.setMendMoney(goods.getCouponPrice());
                } else {
                    otherInfo.setMendMoney(goods.getZkPrice());
                }
                goods.setOtherInfo(otherInfo);
                array.add(gson.toJson(goods));
            }
        }
        JSONObject userJson = new JSONObject();
        userJson.put("nickName", user.getNickName());
        userJson.put("portrait", user.getPortrait());
        userJson.put("couponNum", couponNum);
        userJson.put("tearcherWX", tearcherWX);
        JSONObject data = new JSONObject();
        data.put("user", userJson);
        data.put("count", freeGoodsCouponService.countByType(goodsType));
        data.put("list", array);
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -25,11 +25,13 @@
import com.google.gson.JsonSerializer;
import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
import com.yeshi.fanli.entity.bus.user.SMSHistory;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
@@ -86,6 +88,7 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.util.user.UserLevelUtil;
@@ -293,6 +296,13 @@
                object.put("code", errorCode);
                object.put("data", data);
                out.print(object.toString());
            } else if (errorCode == 102) { // 需要绑定微信号
                JSONObject data = new JSONObject();
                data.put("key", e.getMsg());
                JSONObject object = new JSONObject();
                object.put("code", errorCode);
                object.put("data", data);
                out.print(object.toString());
            } else {
                out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
                try {
@@ -370,6 +380,50 @@
        }
    }
    /**
     * 绑定微信V2.1.3 电话号码 登录
     *
     * @param acceptData
     * @param vcode
     * @param phone
     * @param out
     */
    @RequestSerializableByKey(key = "'bindWXLogin-'+#code")
    @RequestMapping(value = "bindWXLogin")
    public void bindWXLogin(AcceptData acceptData, Long uid, String code, String key, HttpServletRequest request,
            PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                acceptData.getPackages());
        if (system == null) {
            out.print(JsonUtil.loadFalseResult("系统不存在"));
            return;
        }
        if (StringUtil.isNullOrEmpty(code)) {
            out.print(JsonUtil.loadFalseResult("请上传code"));
            return;
        }
        if (StringUtil.isNullOrEmpty(key)) {
            out.print(JsonUtil.loadFalseResult("key值不能为空"));
            return;
        }
        try {
            UserInfo userInfo = userAccountService.bindWXToLogin(request, acceptData, code, system.getAppid(), key);
            JSONObject data = new JSONObject();
            data.put("userInfo", UserUtil.filterForClientUser(userInfo));
            out.print(JsonUtil.loadTrueResult(data));
        } catch (UserAccountException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        }
    }
    /**
     * 绑定电话号码 V2.0.1 微信登录
     * 
@@ -815,4 +869,62 @@
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
    /**
     * 账户注销
     * @param acceptData
     * @param callback
     * @param uid
     * @param out
     */
    @RequestMapping("accountRemove")
    public void accountRemove(AcceptData acceptData, String callback, Long uid, String vcode, PrintWriter out) {
        if (uid == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
            return;
        }
        if (StringUtil.isNullOrEmpty(vcode)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请输入验证码"));
            return;
        }
        UserInfo userInfo = userInfoService.selectByPKey(uid);
        if (userInfo == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户不存在"));
            return;
        }
        if (userInfo.getState() == UserInfo.STATE_FORBIDDEN) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
            return;
        }
        if (userInfo.getState() == UserInfo.STATE_DELETE || userInfo.getState() == UserInfo.STATE_DELETE_OUT_OF_DATE) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, "帐户已被注销,请重新登录"));
            return;
        }
        String phone = userInfo.getPhone();
        if (StringUtil.isNullOrEmpty(phone)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未绑定有效电话号码"));
            return;
        }
        if (!Constant.IS_TEST) {
            String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_REMVOE);
            if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("验证码错误,重新输入"));
                return;
            }
            redisManager.clearSMSVCode(phone, SMSHistory.TYPE_REMVOE);
        }
        UserInfo user = new UserInfo(uid);
        user.setState(UserInfo.STATE_DELETE);
        user.setStateDesc("用户主动注销账户");
        userInfoService.updateByPrimaryKeySelective(user);
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("注销成功"));
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserRankingsMapper.java
@@ -44,12 +44,21 @@
     */
    void updateClearTradeState();
    
    /**
     * 清空
     */
    void clearShareReward();
    // 根据名称查询
    List<UserRankings> selectByNickName(String nickName);
    
    // 根据展示ID查询
    List<UserRankings> selectByShowId(String showId);
        
    // 查询列表
    List<UserRankings> getRankList(@Param("start") long start, @Param("count") int count);
        
    // 查询列表
    List<UserRankings> query(@Param("start") long start, @Param("count") int count, @Param("key") String key,
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java
@@ -303,6 +303,15 @@
     * @return
     */
    List<CommonOrder> getByOrderNo(@Param("uid") Long uid, @Param("orderNo") String orderNo);
    /**
     * 根据订单号查询
     *
     * @param orderNO
     * @return
     */
    List<CommonOrder> getByOrderNoAndSourceType(@Param("uid") Long uid, @Param("orderNo") String orderNo,
            @Param("sourceType") int sourceType);
    
    /**
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/redpack/RedPackWinInviteMapper.java
@@ -35,6 +35,16 @@
     */
    RedPackWinInvite getByUidAndTeamUidAndType(@Param("uid")Long uid,@Param("teamUid")Long teamUid, @Param("type")String type); 
    
    /**
     * 统计用户、下级、类型的数量
     * @param uid
     * @param type
     * @return
     */
    RedPackWinInvite getByUidAndTeamUid(@Param("uid")Long uid,@Param("teamUid")Long teamUid);
    
    /**
     * 统计用户、下级、类型的数量
@@ -99,5 +109,32 @@
    List<RedPackWinInvite> query(@Param("start")long start, @Param("count")int count, @Param("key")String key, @Param("type")String type);
    Long count(@Param("key")String key, @Param("type")String type);
    /**
     * 查询上个月
     * @param uid
     * @param type
     * @return
     */
    List<RedPackWinInvite> listLastMonthByUid(@Param("start")long start, @Param("count")int count, @Param("uid")Long uid);
    /**
     * 统计上月条数
     * @param uid
     * @return
     */
    Long countLastMonthByUid(@Param("uid")Long uid);
    /**
     * 查询上个月有邀请的用户
     * @param uid
     * @param type
     * @return
     */
    List<Long> listWinUid(@Param("start")long start, @Param("count")int count);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/SMSHistory.java
@@ -18,6 +18,7 @@
    public final static int TYPE_LOGIN = 1;// 登录
    public final static int TYPE_BIND = 2;// 绑定
    public final static int TYPE_EXTRACT = 3;// 提现
    public final static int TYPE_REMVOE = 4;// 绑定
    @Column(name = "sh_id")
    private Long id;
fanli/src/main/java/com/yeshi/fanli/entity/redpack/RedPackDetail.java
@@ -32,7 +32,8 @@
        shopOrderDrawBack("商城订单退回", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
        redExchange("红包提现中", "http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png"),
        redExchangePass("红包提现成功", "http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png"),
        redExchangeReject("红包提现失败", "http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png");
        redExchangeReject("红包提现失败", "http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png"),
        redMonthly("月结红包", "http://img.flqapp.com/img/tlj/icon_tlj.png");
        private final String desc;
        private final String picture;
fanli/src/main/java/com/yeshi/fanli/entity/redpack/RedPackWinInvite.java
@@ -21,7 +21,8 @@
        zeroStageReward("邀请关系确定"), 
        oneStageReward("成功邀请好友立得现金"),
        twoStageReward("完成分享订单递增奖励"), 
        threeStageReward("完成分享订单连续奖励");
        threeStageReward("完成分享订单连续奖励"),
        inviteDownOrder("拉新红包奖励");
        private final String desc;
fanli/src/main/java/com/yeshi/fanli/entity/taobao/dataoke/DaTaoKeDetailV2.java
@@ -112,6 +112,10 @@
    private String circleText;// 朋友圈文案,需要url解码后使用
    
    private String imgs; // 图片信息
    private Integer freeshipRemoteDistrict; // 偏远地区包邮,0.不包邮,1.包邮
    public Integer getCommission() {
        return commission;
@@ -488,4 +492,12 @@
    public void setImgs(String imgs) {
        this.imgs = imgs;
    }
    public Integer getFreeshipRemoteDistrict() {
        return freeshipRemoteDistrict;
    }
    public void setFreeshipRemoteDistrict(Integer freeshipRemoteDistrict) {
        this.freeshipRemoteDistrict = freeshipRemoteDistrict;
    }
}
fanli/src/main/java/com/yeshi/fanli/job/UserRankingsJob.java
@@ -12,6 +12,7 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.entity.bus.user.UserRankings;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
@@ -46,89 +47,69 @@
    private UserInfoExtraService userInfoExtraService;
    
    // 1加,2减
    private static int ADD = 1;
    // 前端显示个数
    private static int SHOW_NUM = 50;
    // 每天00点10执行 : 更改排行榜上的奖金
    @Scheduled(cron = "0 5 0 * * ? ")
    @Scheduled(cron = "0 15 0 * * ? ")
    public void updateReward() {
        if (!Constant.IS_TASK) {
            return;
        }
//        if (!Constant.IS_TASK) {
//            return;
//        }
        // 更新人数
        int showNum = 15;
        // 每日增幅
        double rangeAmount = 100;
        try {
            LogHelper.test("------执行中--updateReward---------");
            List<UserRankings> listExist = null;
            // 每月1号归0
            int currentDate = DateUtil.getCurrentDate();
            if (currentDate != 1)
                listExist = userRankingsService.getRankList(0, showNum);
            
            // 清理数据
            userRankingsService.updateClearTradeState();
            userRankingsService.clearShareReward();
            
            // 系统总条数
            // 假用户数量
            int count = (int) userRankingsService.queryCount(null, null, null);
            // 随机显示新的人
            Random random = new Random();
            // 随机将显示的50个人信息
            List<Long> listId = new ArrayList<Long>();
            while (listId.size() < SHOW_NUM) {
            while (listId.size() < showNum) {
                long id = random.nextInt(count);
                if (!listId.contains(id)) {
                    listId.add(id);
                }
            }
            // 显示新的人
            List<UserRankings> listNew = userRankingsService.listQueryByIds(listId);
            Calendar cal=Calendar.getInstance();
            cal.add(Calendar.DATE,-1);
            Date time=cal.getTime();
            
            // 昨日预计总收益
            double countEstimate = taoBaoOrderService.countEstimate(new SimpleDateFormat("yyyy-MM-dd").format(time));
            if (countEstimate == 0) {
                countEstimate = 600;
            }
            // 均值:总预计收益*50%
            double avgAmount = countEstimate * 0.5;
            // 上下 浮动金额范围
            double rangeAmount = 100;
            String range = configService.get(ConfigKeyEnum.rewardRankRange.getKey());
            if (!StringUtil.isNullOrEmpty(range)) {
                rangeAmount = Double.parseDouble(range);
            }
            for (UserRankings userRankings : listNew) {
                // 状态
                userRankings.setTradeState(1);
                userRankings.setTradeTime(new Date());
                // 浮动金额
                double amount = Math.random() * rangeAmount;
                int[] arr = { 1, 2 };
                int index = random.nextInt(arr.length);
                if (ADD == arr[index]) {
                    userRankings.setTradeReward(new BigDecimal(avgAmount + amount));
                } else {
                    while (amount > avgAmount) {
                        amount = Math.random() * rangeAmount;
            if (listExist == null || listExist.size() == 0) {
                for (UserRankings user : listNew) {
                    // 浮动金额
                    double amount = Math.random() * rangeAmount;
                    if (amount < 0.5) {
                        amount = 0.5;
                    }
                    userRankings.setTradeReward(new BigDecimal(avgAmount - amount));
                    user.setShareReward(new BigDecimal(amount));
                }
            } else {
                for (int i = 0; i < listNew.size(); i ++) {
                    UserRankings user = listNew.get(i);
                    // 浮动金额
                    BigDecimal shareReward = null;
                    if (i < listExist.size()) {
                        shareReward = listExist.get(i).getShareReward();
                    }
                    if (shareReward == null)
                        shareReward = BigDecimal.ZERO;
                    // 浮动金额
                    double amount = Math.random() * rangeAmount;
                    user.setShareReward(shareReward.add(BigDecimal.valueOf(amount)));
                }
            }
            // 批量更新昨日数据-移除排行榜
            userRankingsService.updateBatchSelective(listNew);
        } catch (Exception e) {
            e.printStackTrace();
        }
fanli/src/main/java/com/yeshi/fanli/mapping/UserRankingsMapper.xml
@@ -86,6 +86,11 @@
        WHERE  r_trade_state = 1
  </update>
  
   <update id="clearShareReward" >
       update yeshi_ec_rankings_record set r_share_reward = 0
       WHERE r_share_reward > 0
  </update>
   <select id="query" resultMap="BaseResultMap">
      <!-- 根据条件查询所有标签 -->
    SELECT  <include refid="Base_Column_List" />  FROM  yeshi_ec_rankings_record    
@@ -282,5 +287,13 @@
        </foreach>
   </select>
   
   <select id="getRankList" resultMap="BaseResultMap">
          SELECT *  FROM  yeshi_ec_rankings_record
          where r_share_reward > 0
        ORDER BY  r_share_reward desc
        LIMIT ${start},${count}
   </select>
  
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -1036,6 +1036,12 @@
        yeshi_ec_common_order co WHERE co_uid = #{uid} AND
        co_order_no=#{orderNo}
    </select>
    <select id="getByOrderNoAndSourceType" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_common_order co
        WHERE co_uid = #{uid} AND co_order_no=#{orderNo} AND co_source_type = #{sourceType}
    </select>
    <select id="listByUid" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_common_order co WHERE co_uid = #{uid}
        <if test="stateList!=null">
fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackWinInviteMapper.xml
@@ -84,6 +84,13 @@
  </select>
  
  
  <select id="getByUidAndTeamUid" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_red_pack_win_invite d
    WHERE d.`rwr_uid` = #{uid} AND d.`rwr_team_uid` = #{teamUid}
    LIMIT 1
  </select>
  <select id="getRewardList" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_red_pack_win_invite d
    WHERE d.`rwr_uid` = #{uid}
@@ -142,4 +149,26 @@
        <if test="type != null">AND d.`rwr_type`= #{type}</if>
  </select>
  
  <select id="listWinUid"  resultType="Long">
      SELECT d.`rwr_uid` FROM `yeshi_ec_red_pack_win_invite` d
      WHERE d.`rwr_type`= 'inviteDownOrder' AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(d.rwr_create_time, '%Y%m')) =1
    GROUP BY d.`rwr_uid`
    LIMIT #{start},#{count}
  </select>
  <select id="countLastMonthByUid" resultType="Long">
      SELECT count( d.`rwr_id`) FROM `yeshi_ec_red_pack_win_invite` d
      WHERE d.`rwr_type`= 'inviteDownOrder' AND d.`rwr_uid` = #{uid}
          AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(d.rwr_create_time, '%Y%m')) =1
  </select>
  <select id="listLastMonthByUid" resultMap="BaseResultMap">
      SELECT * FROM `yeshi_ec_red_pack_win_invite` d
      WHERE d.`rwr_type`= 'inviteDownOrder' AND d.`rwr_uid` = #{uid}
          AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(d.rwr_create_time, '%Y%m')) =1
    LIMIT #{start},#{count}
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -1854,6 +1854,13 @@
        return commonOrderMapper.getByOrderNo(uid, orderNO);
    }
    @Override
    public List<CommonOrder> getByOrderNoAndSourceType(Long uid, String orderNO, int sourceType) {
        return commonOrderMapper.getByOrderNoAndSourceType(uid, orderNO, sourceType);
    }
    @Override
    public CommonOrder selectLatestValidByUid(Long uid) {
        List<Integer> stateList = new ArrayList<>();
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java
@@ -19,17 +19,22 @@
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite.RedPackWinInviteTypeEnum;
import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
import com.yeshi.fanli.exception.user.UserSystemCouponException;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.order.CommonOrderGoodsService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService;
import com.yeshi.fanli.service.inter.user.UserActiveLogService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
@@ -78,6 +83,13 @@
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
    @Resource
    private CommonOrderGoodsService commonOrderGoodsService;
    @Resource
    private UserSystemCouponService userSystemCouponService;
    @Override
    public List<RedPackWinInvite> getRewardList(int start, int count, Long uid) {
@@ -444,4 +456,126 @@
        }
        return count;
    }
    @Override
    @RequestSerializableByKeyService(key = "#orderUid")
    @Transactional(rollbackFor = Exception.class)
    public void winRedPackByOrder(Long orderUid, String orderNo, Integer source) {
        if (orderUid == null || StringUtil.isNullOrEmpty(orderNo)) {
            return;
        }
        // 是否存在上下级关系
        ThreeSale threeSale = threeSaleSerivce.getByWorkerId(orderUid);
        if (threeSale == null)
            return;
        Long bossId = threeSale.getBoss().getId();
        if (bossId == null)
            return;
        // 该邀请是否已领取
        RedPackWinInvite threeStage = redPackWinInviteMapper.getByUidAndTeamUid(bossId, orderUid);
        if (threeStage != null)
            return;
        // 查询订单
        List<CommonOrder> list = commonOrderService.getByOrderNo(orderUid, orderNo);
        if (list == null || list.size() ==0) {
            return;
        }
        // 48小时内订单
        long spaceTime = 1000 * 60 * 48;
        Long succeedTime = threeSale.getSucceedTime();
        Date thirdCreateTime = list.get(0).getThirdCreateTime();
        if (thirdCreateTime == null || thirdCreateTime.getTime() > succeedTime + spaceTime) {
            return;
        }
        // 商品比例限制
        BigDecimal limitRate = new BigDecimal(redPackConfigService.getValueByKey("goods_reate_limit"));
        BigDecimal limitPayMent = new BigDecimal(redPackConfigService.getValueByKey("goods_pay_ment_limit"));
        boolean satisfy = false;
        // 遍历是否存在符合相应商品
        for (CommonOrder commonOrder: list) {
            // 付款金额限制
            BigDecimal payment = commonOrder.getPayment();
            if (payment == null || payment.compareTo(limitPayMent) < 0)
                continue;
            // 商品佣金比例限制
            BigDecimal eIncome = commonOrder.geteIncome();
            BigDecimal settlement = commonOrder.getSettlement();
            if(eIncome == null || settlement == null) {
                continue;
            }
            BigDecimal rete = MoneyBigDecimalUtil.div(eIncome, settlement);
            if (rete.compareTo(limitRate) >= 0) {
                satisfy = true;
                break;
            }
        }
        if (!satisfy) {
            return;
        }
        // 获得红包记录
        RedPackWinInvite winInvite = new RedPackWinInvite();
        winInvite.setUid(bossId);
        winInvite.setTeamUid(orderUid);
        winInvite.setMoney(null);
        winInvite.setSource(source);
        winInvite.setOrderNo(orderNo);
        winInvite.setCreateTime(new Date());
        winInvite.setUpdateTime(new Date());
        winInvite.setType(RedPackWinInviteTypeEnum.inviteDownOrder);
        winInvite.setIdentifyCode(StringUtil.Md5(RedPackWinInviteTypeEnum.inviteDownOrder.name() + ":" + orderUid));
        redPackWinInviteMapper.insertSelective(winInvite);
        // 赠送购买者一张免单券
        try {
            userSystemCouponService.freeCouponWinBySystem(orderUid, CouponTypeEnum.freeCouponBuy, UserSystemCoupon.SOURCE_EXCHANGE,
                    1, true, 2);
        } catch (UserSystemCouponException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Override
    public List<Long> listWinUid(int start, int count) {
        return redPackWinInviteMapper.listWinUid(start, count);
    }
    @Override
    public List<RedPackWinInvite> listLastMonthByUid(int start, int count, Long uid) {
        return redPackWinInviteMapper.listLastMonthByUid(start, count, uid);
    }
    @Override
    public long countLastMonthByUid(Long uid) {
        Long count = redPackWinInviteMapper.countLastMonthByUid(uid);
        if (count == null)
            count = 0L;
        return count;
    }
//    @Override
//    public void arriveMoney(Long uid, ) {
//        // 4、增加红包
//        redPackBalanceService.addRedPack(bossId, money, RedPackDetailFactory.createSeriesReward(winInvite));
//    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java
@@ -17,6 +17,7 @@
import com.yeshi.fanli.dao.mybatis.share.ShareMapper;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.user.QrCodeService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.util.Constant;
@@ -26,6 +27,7 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.UserInviteUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.user.PullNewRuleVO;
@Service
public class QrCodeServiceImpl implements QrCodeService {
@@ -419,4 +421,34 @@
        return COSManager.getInstance().uploadInputStream(drawStream, upPath);
    }
    @Override
    public String drawPullNewPoster(Long uid, String portrait, String inviteCode, PullNewRuleVO rule) {
        // 头像流
        InputStream portraitStream = HttpUtil.getAsInputStream(portrait);
        // 生成二维码
        String erCode = UserInviteUtil.getShareUrl(uid);
        InputStream erCodeStream = null;
        try {
            erCodeStream = QRCodeUtil.getInstance(250).encodeDeleteWhite(erCode);
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        if (erCodeStream == null)
            return null;
        // 画图
        InputStream drawStream = ImageUtil.drawPullNewPoster(erCodeStream,portraitStream, inviteCode, rule);
        if (drawStream == null)
            return null;
        // 上传位置
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String upPath = FilePathEnum.ercodeActivity.getPath() + uuid + "_" +uid + "_" + System.currentTimeMillis() + ".png";
        // 上传文件
        FileUploadResult result = COSManager.getInstance().uploadInputStream(drawStream, upPath);
        if (result == null)
            return null;
        return result.getUrl();
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/SMSServiceImpl.java
@@ -94,6 +94,31 @@
    }
    @Override
    public void sendRemoveVCode(String phone, int codeLength) throws SMSException {
        boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_REMVOE);
        if (limit)
            throw new SMSException(1001, "请过60秒再试");
        String msgCode = StringUtil.getVerifyCode(codeLength);
        // 验证码模板
        String msg = Constant.smsConfig.getSmsBind().replace("[签名]", Constant.smsConfig.getSmsSign()).replace("[验证码]",
                msgCode);
        // 发送短信
        TencentSMSUtil.sendSingleMsg(phone, msg);
        // 缓存
        redisManager.sendSms(phone, SMSHistory.TYPE_REMVOE);
        redisManager.saveSMSVCode(phone, SMSHistory.TYPE_REMVOE, msgCode);
        SMSHistory smsHistory = new SMSHistory();
        smsHistory.setContent(msg);
        smsHistory.setCreateTime(new Date());
        smsHistory.setPhone(phone);
        smsHistory.setType(SMSHistory.TYPE_REMVOE);
        smsHistoryMapper.insertSelective(smsHistory);
    }
    @Override
    public void sendExtractVCode(String phone) throws SMSException {
        boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_EXTRACT);
        if (limit)
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -887,10 +887,8 @@
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    userInfoModifyRecordService.addModifyRecord(userInfo.getId(), ModifyTypeEnum.bindPhone, phone);
                }
                return userInfo;
            }
        } catch (Exception e) {
@@ -903,6 +901,92 @@
        throw new UserAccountException(10, "请稍后再试");
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UserInfo loginPhoneNew(HttpServletRequest request, int loginType, String vcode, String phone, String appId)
            throws UserAccountException {
        // 空额清理
        if (phone == null || phone.trim().length() == 0) {
            throw new UserAccountException(1, "请输入手机号码");
        }
        phone = phone.replaceAll(" ", "");
        // 苹果应用商店上线测试号码
        if ("17316780233".equalsIgnoreCase(phone) && "2581".equalsIgnoreCase(vcode)) {
            ;
        } else {
            if (StringUtil.isNullOrEmpty(vcode)) {
                throw new UserAccountException(1, "请输入验证码");
            }
            String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_LOGIN);
            LogHelper.test("----------------------登录验证码: " + oldVcode);
            if (!Constant.IS_TEST)
                if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
                    throw new UserAccountException(1, "验证码错误,重新输入");
                } else {// 验证码输入正确
                    redisManager.clearSMSVCode(phone, SMSHistory.TYPE_LOGIN);
                }
        }
        JSONObject logInfo = new JSONObject();
        logInfo.put("appId", appId);
        logInfo.put("phone", phone);
        logInfo.put("loginType", loginType);
        LogHelper.lgoinInfo(logInfo.toString());
        // 判断手机号码是否被封禁
        ForbiddenUserIdentifyCode identifyCode1 = forbiddenUserIdentifyCodeService
                .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone);
        if (identifyCode1 != null && identifyCode1.getEffective() != null && identifyCode1.getEffective()) {
            throw new UserAccountException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
        }
        // 清空限制
        redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
        // 清理次数
        String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLoginCount, phone);
        redisManager.removeCommonString(key);
        // 采用redis事务防止一个手机号多次注册问题
        String watchKey = StringUtil.Md5("REGISTER:" + phone);
        Jedis jedis = jedisPool.getResource();
        try {
            jedis.watch(watchKey);
            if (jedis.get(watchKey) != null && Integer.parseInt(jedis.get(watchKey)) > 1)
                throw new UserAccountException(10, "请稍后再试");
            Transaction tran = jedis.multi();
            tran.incr(watchKey);
            List<Object> exec = tran.exec();
            if (exec == null || exec.size() == 0) {
                throw new UserAccountException(10, "请稍后再试");
            } else {
                // 查询是否存在该电话历史用户
                UserInfo userInfo = userInfoMapper.getEffectiveUserInfoByPhone(phone);
                if (userInfo != null) {
                    // 更新账户登录信息
                    updateLonginInfo(userInfo, loginType, request);
                } else {
                    // 绑定微信
                    String keylogin = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("phoneLogin:" + phone));
                    redisManager.cacheCommonString(keylogin, phone, 60 * 20);
                    throw new UserAccountException(102, keylogin);
                }
                return userInfo;
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            jedis.del(watchKey);
            jedis.unwatch();
            jedis.close();
        }
        throw new UserAccountException(10, "请稍后再试");
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UserInfo loginWinXin(HttpServletRequest request, AcceptData acceptData, int loginType, String code,
@@ -1311,6 +1395,129 @@
        return userInfo;
    }
    @Override
    public UserInfo bindWXToLogin(HttpServletRequest request, AcceptData acceptData, String code, String appId, String key) throws UserAccountException {
        // 日志信息
        JSONObject logInfo = new JSONObject();
        logInfo.put("appId", appId);
        logInfo.put("code", code);
        logInfo.put("loginType", 2);
        LogHelper.lgoinInfo(logInfo.toString());
        // 通过Code换取信息
        WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion());
        WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
        if (weiXinUser == null) {
            throw new UserAccountException(1, "微信帐号授权失败");
        }
        LogHelper.test("微信授权用户信息:" + new Gson().toJson(weiXinUser));
        // 判断微信unionid是否被封禁
        ForbiddenUserIdentifyCode identifyCode = forbiddenUserIdentifyCodeService
                .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.wxUnionId, weiXinUser.getUnionid());
        if (identifyCode != null && identifyCode.getEffective() != null && identifyCode.getEffective()) {
            throw new UserAccountException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
        }
        String phone = redisManager.getCommonString(key);
        if (StringUtil.isNullOrEmpty(phone))
            throw new UserAccountException(1, "手机号登录失效,请使发送短信登录");
        // 采用redis事务防止一个微信号多次注册问题
        String watchKey = StringUtil.Md5("REGISTER:" + weiXinUser.getUnionid());
        Jedis jedis = jedisPool.getResource();
        try {
            jedis.watch(watchKey);
            if (jedis.get(watchKey) != null && Integer.parseInt(jedis.get(watchKey)) > 1)
                throw new UserAccountException(10, "请稍后再试");
            Transaction tran = jedis.multi();
            tran.incr(watchKey);
            List<Object> exec = tran.exec();
            if (exec == null || exec.size() == 0) {
                throw new UserAccountException(10, "请稍后再试");
            } else {
                UserInfo userInfo = userInfoMapper.getEffectiveUserInfoByWXUnionId(weiXinUser.getUnionid());
                // 直接用的微信登录
                if (userInfo != null) {
                    // 绑定微信
                    if (!StringUtil.isNullOrEmpty(userInfo.getPhone()) && !phone.equals(userInfo.getPhone().trim())) {
                        throw new UserAccountException(1, "该微信已被绑定");
                    }
                    // 删除邀请分享图
                    //spreadUserImgService.deleteImgUrl(userInfo.getId());
                } else {
                    LogHelper.test("微信unionID不存在:" + weiXinUser.getUnionid());
                    String portrait = null;
                    if (!StringUtil.isNullOrEmpty(weiXinUser.getHeadimgurl())) {
                        InputStream asInputStream = HttpUtil.getAsInputStream(weiXinUser.getHeadimgurl());
                        if (asInputStream != null) {
                            FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream,
                                    String.format(FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg",
                                            weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
                            if (result != null && !StringUtil.isNullOrEmpty(result.getUrl()))
                                portrait = result.getUrl();
                        } else {
                            portrait = weiXinUser.getHeadimgurl();
                        }
                    }
                    if (StringUtil.isNullOrEmpty(portrait))
                        portrait = Constant.systemCommonConfig.getDefaultPortrait();
                    // 创建新账户
                    userInfo = new UserInfo();
                    userInfo.setPhone(phone);
                    userInfo.setPortrait(portrait);
                    userInfo.setAppId(appId);
                    userInfo.setNickName(weiXinUser.getNickname());
                    userInfo.setWxName(weiXinUser.getNickname());
                    userInfo.setWxOpenId(weiXinUser.getOpenid());
                    userInfo.setWxUnionId(weiXinUser.getUnionid());
                    userInfo.setWxPic(weiXinUser.getHeadimgurl());
                    userInfo.setLastLoginTime(System.currentTimeMillis());
                    userInfo.setLoginType(2);
                    userInfo.setLastLoginIp(request.getRemoteHost());
                    userInfo.setState(UserInfo.STATE_NORMAL);
                    addUser(userInfo);
                    Long uid = userInfo.getId();
                    ThreadUtil.run(new Runnable() {
                        public void run() {
                            try {
                                // 第一次登录时创建用户额外信息
                                userInfoExtraService.createUserInfoExtra(uid);
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            // 加入绑定记录
                            UserAccountBindingHistory history = new UserAccountBindingHistory();
                            history.setContent(phone);
                            history.setType(UserAccountBindingHistory.TYPE_PHONE);
                            history.setUid(uid);
                            history.setFirst(true);
                            userAccountBindingHistoryService.addUserAccountBindingHistory(history);
                            userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindPhone, phone);
                            userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, weiXinUser.getUnionid());
                        }
                    });
                }
                return userInfo;
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            jedis.del(watchKey);
            jedis.unwatch();
            jedis.close();
        }
        throw new UserAccountException(10, "请稍后再试");
    }
    @Override
    public void forbiddenUserAll(Long uid, String reason) {
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserRankingsServiceImpl.java
@@ -74,6 +74,12 @@
        userRankingsMapper.updateClearTradeState();
    }
    @Override
    public void clearShareReward() {
        userRankingsMapper.clearShareReward();
    }
    @Override
    @Transactional(rollbackFor=Exception.class)
@@ -163,8 +169,7 @@
    }
    @Override
    public List<UserRankings> query(long start, int count, String key, Integer tradeState, Integer shareState, Integer sort)
            throws UserRankingsException {
    public List<UserRankings> query(long start, int count, String key, Integer tradeState, Integer shareState, Integer sort) {
        return userRankingsMapper.query(start, count, key, tradeState, shareState, sort);
    }
@@ -334,6 +339,13 @@
    public List<UserRankings> listQueryByIds(List<Long> ids) throws UserRankingsException {
        return userRankingsMapper.listQueryByIds(ids);
    }
    @Override
    public List<UserRankings> getRankList(long start, int count) {
        return userRankingsMapper.getRankList(start, count);
    }
    @Override
    public List<InviteGetMoney> getRank(long start, int count) {
@@ -342,8 +354,6 @@
        
        List<InviteGetMoney> rankingsList = new ArrayList<InviteGetMoney>();
        
        try {
             List<UserRankings> userRankingsList = query(0, count, null, 1, null, 2);
            for (UserRankings userRankings : userRankingsList) {
@@ -445,14 +455,7 @@
                resultList.get(i).setId(n);
            }
            
        } catch (UserRankingsException e) {
            e.printStackTrace();
        }
        return resultList;
    }
    public List<InviteGetMoney> listSort(List<InviteGetMoney> list) {
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.service.impl.user;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -317,6 +318,97 @@
        return userSystemCoupon;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public UserSystemCoupon freeCouponWinBySystem(Long uid, CouponTypeEnum typeEnum, String source, int num, boolean notify,
            Integer expiryDay) throws UserSystemCouponException, Exception {
        if (typeEnum == null || uid == null || StringUtil.isNullOrEmpty(source) || num < 1) {
            throw new UserSystemCouponException(1, "参数不正确");
        }
        SystemCoupon coupon = systemCouponService.getCouponByType(typeEnum.name());
        if (coupon == null) {
            throw new UserSystemCouponException(1, "券类型不正确");
        }
        // 激活状态
        int stateActivated = 0;
        // 自购免单券、赠送免单券可直接使用
        if (coupon.getType() == CouponTypeEnum.freeCouponBuy || coupon.getType() == CouponTypeEnum.freeCouponGive) {
            stateActivated = 1;
        }
        // 有效时长
        if (expiryDay == null) {
            if (stateActivated == 0)
                expiryDay = coupon.getActivateDay();
            if (expiryDay == null || expiryDay == 0)
                expiryDay = coupon.getExpiryDay();
        }
        // 计算结束日期
        Date nowTime = new Date();
        String endDay = DateUtil.plusDay(expiryDay - 1, nowTime);
        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 userSystemCoupon = null;
        for (int i = 0; i < num; i++) {
            UserSystemCoupon userCoupon = new UserSystemCoupon();
            userCoupon.setUid(uid);
            userCoupon.setSource(source);
            userCoupon.setSystemCoupon(coupon);
            userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
            userCoupon.setStateActivated(stateActivated);
            userCoupon.setStartTime(nowTime);
            userCoupon.setEndTime(endTime);
            userCoupon.setCreateTime(nowTime);
            userCoupon.setUpdateTime(nowTime);
            userSystemCouponMapper.insertSelective(userCoupon);
            // 需要激活券
            if (typeEnum == CouponTypeEnum.freeCoupon) {
                userSystemCouponActivateService.addActivateRecord(userCoupon.getId());
            }
            if (num == 1) {
                userSystemCoupon = userCoupon;
            }
        }
        executor.execute(new Runnable() {
            @Override
            public void run() {
                if (notify) { // 消息推送
                    try {
                        userOtherMsgNotificationService.freeCouponWinMsg(uid, typeEnum.getDesc(), source, num, "成功获得",
                                nowTime, endTime);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                // 福利中心红点
                UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
                if (extra != null) {
                    UserInfoExtra updateExtra = new UserInfoExtra();
                    updateExtra.setId(extra.getId());
                    if (extra.getCouponNews() == null) {
                        updateExtra.setCouponNews(1);
                    } else {
                        updateExtra.setCouponNews(extra.getCouponNews() + 1);
                    }
                    userInfoExtraService.updateByPrimaryKeySelective(updateExtra);
                }
            }
        });
        return userSystemCoupon;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public UserSystemCoupon rewardCouponWin(Long uid, String source, int num, boolean notify, BigDecimal percent)
@@ -550,27 +642,24 @@
    }
    @Override
    public List<UserSystemCouponVO> getEnableListByCouponId(Long uid, Integer activated, List<SystemCoupon> couponList)
            throws UserSystemCouponException, Exception {
    public List<UserSystemCouponVO> getEnableListByCouponId(Long uid, Integer activated, List<SystemCoupon> couponList) {
        List<Long> listCouponId = new ArrayList<Long>();
        for (SystemCoupon systemCoupon : couponList) {
            listCouponId.add(systemCoupon.getId());
        }
        List<UserSystemCouponVO> listVO = userSystemCouponMapper.getEnableListByCouponId(uid, activated, listCouponId);
        if (listVO == null || listVO.size() == 0) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
        for (UserSystemCouponVO userCouponVO : listVO) {
            SystemCoupon systemCoupon = userCouponVO.getSystemCoupon();
            if (systemCoupon == null) {
                continue; // 券信息不完整
            }
            for (SystemCoupon coupon : couponList) {
                if (coupon.getId().equals(systemCoupon.getId()) || coupon.getId() == systemCoupon.getId()) {
                    systemCoupon = coupon;
@@ -596,11 +685,15 @@
            Date startTime = userCouponVO.getStartTime();
            Date endTime = userCouponVO.getEndTime();
            if (endTime != null && startTime != null) {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
                couponTerm = couponTerm + sdf.format(startTime) + "-" + sdf.format(endTime);
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
                differentDays = DateUtil.daysBetween(sdf2.format(new Date()), sdf2.format(endTime)) + 1;
                try {
                    differentDays = DateUtil.daysBetween(sdf2.format(new Date()), sdf2.format(endTime)) + 1;
                } catch (ParseException e) {
                    e.printStackTrace();
                }
                if (differentDays < 0) {
                    differentDays = 0;
                }
@@ -679,6 +772,24 @@
    @Transactional(rollbackFor = Exception.class)
    @Override
    public List<UserSystemCouponVO> getFreeCouponList(Long uid) {
        // 过期券
        updateInvalidSate(uid);
        // 退回券
        sendBackTimeOutCoupon(uid);
        // 商品相关的券
        List<SystemCoupon> couponList = systemCouponService.getGoodsCouponList();
        if (couponList == null || couponList.size() == 0) {
            return null;
        }
        return getEnableListByCouponId(uid, null, couponList);
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public List<UserSystemCouponVO> getGoodsCouponList(Long uid, Long auctionId)
            throws UserSystemCouponException, Exception {
@@ -728,7 +839,7 @@
        return list;
    }
    @Override
    public long countUsableFreeCouponForBuy(Long uid) {
        if (uid == null)
@@ -2493,4 +2604,5 @@
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java
@@ -480,4 +480,13 @@
     */
    public List<CommonOrder> listByOrderNo(String orderNo);
    /**
     * 根据订单类型+ 订单号查询
     * @param uid
     * @param orderNO
     * @param sourceType
     * @return
     */
    public List<CommonOrder> getByOrderNoAndSourceType(Long uid, String orderNO, int sourceType);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackWinInviteService.java
@@ -91,5 +91,40 @@
    public List<RedPackWinInvite> query(long page, int count, String key,  String type);
    public long count(String key, String type);
    /**
     * 创建
     * @param orderUid
     * @param orderNo
     * @param source
     */
    public void winRedPackByOrder(Long orderUid, String orderNo, Integer source);
    /**
     * 查询上月用户id
     * @param start
     * @param count
     * @return
     */
    public List<Long> listWinUid(int start, int count);
    /**
     * 查询上月数据
     * @param start
     * @param count
     * @return
     */
    long countLastMonthByUid(Long uid);
    /**
     * 查询上月数据
     * @param start
     * @param count
     * @return
     */
    List<RedPackWinInvite> listLastMonthByUid(int start, int count, Long uid);
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/QrCodeService.java
@@ -8,6 +8,7 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.user.PullNewRuleVO;
public interface QrCodeService {
@@ -103,4 +104,15 @@
     */
    public FileUploadResult drawGoodsQuickhShare(String erCodeUrl, String portrait, String inviteCode, String mainPic,
            GoodsDetailVO goods);
    /**
     * 拉新活动分享图
     * @param uid
     * @param portrait
     * @param inviteCode
     * @param rule
     * @return
     */
    public String drawPullNewPoster(Long uid, String portrait, String inviteCode, PullNewRuleVO rule);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/SMSService.java
@@ -51,4 +51,12 @@
     * @param money
     */
    public void sendExtractFailMsg(String phone, BigDecimal money) throws SMSException;
    /**
     * 账户注销
     * @param phone
     * @param codeLength
     * @throws SMSException
     */
    public void sendRemoveVCode(String phone, int codeLength) throws SMSException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserAccountService.java
@@ -262,4 +262,31 @@
    public UserInfo bindPhoneToLogin(String phone, String key, String appId, HttpServletRequest request)
            throws UserAccountException;
    /**
     * 手机登录需要绑定微信
     * @param request
     * @param loginType
     * @param vcode
     * @param phone
     * @param appId
     * @return
     * @throws UserAccountException
     */
    public UserInfo loginPhoneNew(HttpServletRequest request, int loginType, String vcode, String phone, String appId)
            throws UserAccountException;
    /**
     * 绑定微信登录 + 手机号key
     * @param request
     * @param acceptData
     * @param loginType
     * @param code
     * @param appId
     * @param key
     * @return
     * @throws UserAccountException
     */
    public UserInfo bindWXToLogin(HttpServletRequest request, AcceptData acceptData, String code, String appId,
            String key) throws UserAccountException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserRankingsService.java
@@ -109,7 +109,7 @@
     * @return
     * @throws UserRankingsException
     */
    public List<UserRankings> query(long start, int count, String key, Integer tradeState, Integer shareState, Integer sort) throws UserRankingsException;
    public List<UserRankings> query(long start, int count, String key, Integer tradeState, Integer shareState, Integer sort) ;
    public long queryCount(String key, Integer tradeState, Integer shareState) throws UserRankingsException;
@@ -177,5 +177,14 @@
     */
    public void updateClearTradeState() throws UserRankingsException;
    public List<UserRankings> getRankList(long start, int count);
    /**
     * 清空金额
     */
    public void clearShareReward();
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java
@@ -67,14 +67,6 @@
     */
    public List<UserSystemCouponVO> getOrderCouponList(Long uid) throws UserSystemCouponException, Exception;
    /**
     * 查询商品使用相关券
     * @param uid
     * @return
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public List<UserSystemCouponVO> getGoodsCouponList(Long uid, Long auctionId) throws UserSystemCouponException, Exception;
    /**
     * 更新券使用记录
@@ -324,4 +316,28 @@
    public UserSystemCoupon rewardCouponWin(Long uid, String source, int num, boolean notify,
            BigDecimal percent) throws UserSystemCouponException, Exception;
    /**
     * 免单券获得
     * @param uid
     * @param typeEnum
     * @param source
     * @param num
     * @param notify
     * @param expiryDay
     * @return
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public UserSystemCoupon freeCouponWinBySystem(Long uid, CouponTypeEnum typeEnum, String source, int num, boolean notify,
            Integer expiryDay) throws UserSystemCouponException, Exception;
    /**
     * 获取有效免单券列表
     * @param uid
     * @return
     */
    public List<UserSystemCouponVO> getFreeCouponList(Long uid);
    public List<UserSystemCouponVO> getGoodsCouponList(Long uid, Long auctionId) throws UserSystemCouponException, Exception;
}
fanli/src/main/java/com/yeshi/fanli/util/FilePathEnum.java
@@ -9,6 +9,7 @@
    userComplaint("/user/img/user_complaint/", "用户吐槽图片"),
    activityUserPortrait("/user/img/dynamic/portrait/", "动态用户头像"),
    ercode("/user/img/invite/", "分享邀请图二维码图片"),
    ercodeActivity("/user/img/invite/activity", "分享活动邀请图二维码图片"),
    shareGoods("/user/img/sharegoods/", "分享商品图片"),
    shareXCX("/user/img/sharegoods_xcx/", "分享小程序图片"),
    vipApply("/usr/img/vip/apply/","会员申请用户上传图片"),
fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java
@@ -40,6 +40,8 @@
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.user.PullNewRuleNumVO;
import com.yeshi.fanli.vo.user.PullNewRuleVO;
public class ImageUtil {
@@ -3009,4 +3011,221 @@
        }
    }
    /**
     * 拉新海报
     * @param qrcode
     * @param portraitStream
     * @param code
     * @param rule
     * @return
     */
    public static InputStream drawPullNewPoster(InputStream qrcode, InputStream portraitStream, String code, PullNewRuleVO rule) {
        try {
            String fontPath = "/usr/share/fonts/yahei.ttf";
            String fontBoldPath = "/usr/share/fonts/yahei_bold.ttf";
            String os = System.getProperty("os.name");
            if (os.toLowerCase().startsWith("win")) {
                fontPath = "D:/yahei.ttf";
                fontBoldPath = "D:/yahei_bold.ttf";
            }
            Font font24 = Font.createFont(Font.PLAIN, new File(fontPath)).deriveFont(24.0f);
            Font font34 = Font.createFont(Font.PLAIN, new File(fontPath)).deriveFont(34.0f);
            Font boldFont24 = Font.createFont(Font.PLAIN, new File(fontBoldPath)).deriveFont(24.0f);
            int px = 750; // 图片宽度
            int topPicH = 529;
            int ruleheight = getRuleHeight(boldFont24, rule);
            int py = topPicH + ruleheight + +226 + 27 * 2;
            final BufferedImage targetImg = new BufferedImage(px, py, BufferedImage.TYPE_INT_RGB);
            HashMap<Key, Object> mapH = new HashMap<Key, Object>();
            mapH.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);// 抗锯齿 (抗锯齿总开关)  
            mapH.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);// 文字抗锯齿 
            final Graphics2D g2d = (Graphics2D) targetImg.getGraphics();
            g2d.setRenderingHints(mapH);
            g2d.setColor(new Color(255, 54, 104));
            g2d.fillRect(0, 0, px, py);
            // 顶部图片
            InputStream headStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/invite/pull_new.png");
            g2d.drawImage(ImageIO.read(headStream), 0, 0, px, 529, null);
            // 规则白色背景 562
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setColor(new Color(255, 255, 255));
            g2d.fillRoundRect(20, 529, 710, ruleheight, 50, 50);
            // 六月活动规则
            g2d.setFont(font34);
            g2d.setColor(new Color(51, 51, 51));
            g2d.drawString(rule.getRuleName(), 306 - 20, topPicH + 56);
            int y_line = topPicH + 86;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setColor(new Color(224, 224, 224));
            // 笔画的轮廓(画笔宽度/线宽为1px)
            BasicStroke bs1 = new BasicStroke(1);
            g2d.setStroke(bs1);
            g2d.drawLine(22, y_line, 728, y_line);
            // 右边距
            int spacing = 43 + 20;
            // 文字间距
            int fontH = 24;
            int spacingH = 14;
            // 新人奖励红色文字
            int y_temp = topPicH + 110 + fontH;
            g2d.setFont(boldFont24);
            g2d.setColor(new Color(229, 0, 92));
            g2d.drawString(rule.getNewRule(), spacing, y_temp);
            // 新人奖励规则
            g2d.setFont(font24);
            g2d.setColor(new Color(51, 51, 51));
            int fontNum = 10;
            int maxWidth = 590;
            String newTitle = rule.getNewTitle();
            while (newTitle.length() > 0) {
                y_temp += spacingH + fontH;
                int lengthNew = ImageUtil.getTextLengthByWidth(g2d, font24, newTitle, maxWidth, fontNum);
                g2d.drawString(newTitle.substring(0, lengthNew), spacing, y_temp);
                newTitle = newTitle.substring(lengthNew);
            }
            y_temp = y_temp + fontH + 50;
            g2d.setFont(boldFont24);
            g2d.setColor(new Color(229, 0, 92));
            g2d.drawString(rule.getInviterRule(), spacing, y_temp);
            g2d.setFont(font24);
            g2d.setColor(new Color(51, 51, 51));
            String inviterTitle = rule.getInviterTitle();
            while (inviterTitle.length() > 0) {
                y_temp += spacingH + fontH;
                int lengthNew = ImageUtil.getTextLengthByWidth(g2d, font24, inviterTitle, maxWidth, fontNum);
                g2d.drawString(inviterTitle.substring(0, lengthNew), spacing, y_temp);
                inviterTitle = inviterTitle.substring(lengthNew);
            }
            FontMetrics fm = g2d.getFontMetrics(font24);
            List<PullNewRuleNumVO> list = rule.getList();
            for (int i = 0; i < list.size(); i++) {
                if (i == 0) {
                    y_temp += fontH + 38;
                } else {
                    y_temp += fontH + spacingH;
                }
                PullNewRuleNumVO numVO = list.get(i);
                int codeLength = fm.stringWidth(numVO.getRewardDesc());
                g2d.drawString(numVO.getNumRange(), 75, y_temp);
                g2d.drawString(numVO.getRewardDesc(), px - 78 - codeLength, y_temp);
            }
            // 底部内容
            y_temp += 27 + 27;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setColor(new Color(255, 255, 255));
            g2d.fillRoundRect(20, y_temp, 710, 226, 50, 50);
            InputStream bottomStream = ImageUtil.class.getClassLoader()
                    .getResourceAsStream("image/invite/blks_ico.png");
            g2d.drawImage(ImageIO.read(bottomStream), 98, y_temp + 53, 315, 71, null);
            Font font26 = Font.createFont(Font.PLAIN, new File(fontPath)).deriveFont(26.28f);
            FontMetrics fmcode = g2d.getFontMetrics(font26);
            String inviteCode = "邀请码:" + code;
            int codeLength = fmcode.stringWidth(inviteCode);
            // 背景色
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setColor(new Color(229, 0, 92));
            g2d.fillRoundRect(98 + 157 - codeLength / 2, y_temp + 138, codeLength + 10, 37, 10, 10);
            // 邀请码
            g2d.setColor(new Color(255, 255, 255));
            g2d.drawString(inviteCode, 98 + 157 - codeLength / 2 + 10, y_temp + 138 + 27);
            // 二维码图框
            InputStream codeFrame = ImageUtil.class.getClassLoader()
                    .getResourceAsStream("image/invite/qr_code_frame.png");
            g2d.drawImage(ImageIO.read(codeFrame), 497 + 20, y_temp + 15, 200, 203, null);
            // 画二维码
            int codeSize = 175;
            int pX = 497 + 26;
            int pY = y_temp + 20;
            g2d.drawImage(ImageIO.read(qrcode), pX + 8, pY + 8, codeSize, codeSize, null);
            int portraitSize = 200 * 5 / 23 - 5;
            int pPX = pX + codeSize / 2 - portraitSize / 2 + 10;
            int pPY = pY + codeSize / 2 - portraitSize / 2;
            // 头像白色边框
            g2d.setColor(Color.WHITE);
            g2d.fillRoundRect(pPX - 2, pPY - 2, portraitSize + 4, portraitSize + 4, 5, 5);
            g2d.setRenderingHints(mapH);
            // 画头像
            BufferedImage portraitImg = ImageIO.read(portraitStream);
            portraitImg = ImageUtil.zoomInImage(portraitImg, portraitSize, portraitSize);
            portraitImg = ImageUtil.roundImage(portraitImg, 10);
            g2d.drawImage(portraitImg, pPX, pPY, portraitSize, portraitSize, null);
            // 结束画图
            g2d.dispose();
            ByteArrayOutputStream aos = new ByteArrayOutputStream();
            ImageIO.write(targetImg, "JPEG", aos);
            return new ByteArrayInputStream(aos.toByteArray());
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        return null;
    }
    private static int getRuleHeight(Font font24, PullNewRuleVO rule) {
        int px = 200; // 图片宽度
        int py = 200; // 图片高度
        BufferedImage targetImg = new BufferedImage(px, py, BufferedImage.TYPE_INT_RGB);
        final Graphics2D g2d = (Graphics2D) targetImg.getGraphics();
        // 文字间距
        int fontH = 24;
        int spacingH = 14;
        int height = 110 + fontH;
        // 新人奖励规则
        int fontNum = 10;
        int maxWidth = 590;
        String newTitle = rule.getNewTitle();
        while (newTitle.length() > 0) {
            height += spacingH + fontH;
            int lengthNew = ImageUtil.getTextLengthByWidth(g2d, font24, newTitle, maxWidth, fontNum);
            newTitle = newTitle.substring(lengthNew);
       }
        // 邀请人奖励红字
        height = height + fontH+ 50;
        String inviterTitle = rule.getInviterTitle();
        while (inviterTitle.length() > 0) {
            height += spacingH + fontH;
            int lengthNew = ImageUtil.getTextLengthByWidth(g2d, font24, inviterTitle, maxWidth, fontNum);
            inviterTitle = inviterTitle.substring(lengthNew);
       }
        // 奖励方式
        List<PullNewRuleNumVO> list = rule.getList();
        for (int i = 0; i < list.size();i ++) {
            if (i == 0) {
                height += fontH + 38;
            } else {
                height += fontH + spacingH;
            }
        }
        // 底部空白
        height += 25;
        return height;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/RedisKeyEnum.java
@@ -7,6 +7,7 @@
    SMSStateAlipay("smsstate-alipay-", "支付宝短信验证码"),
    SMSLoginCount("sendMSNLoginCount", "登录发送短信次数统计"),
    SMSBindCount("sendMSNBindCount", "绑定手机号发送短信次数统计"),
    SMSBindRemove("sendMSNRemoveCount", "注销手机号发送短信次数统计"),
    wxmpUserLogin("wxmp-user-login-", "小程序登录"),
    frequencyLimit("frequency-", "频率限制"),
    inviteShortLink("invite-shortlink-", "短连接"),
fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java
@@ -122,6 +122,14 @@
            return false;
    }
    
    public static boolean greaterThan_2_1_3(String platform, String versionCode) {
        if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 59))
                || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 83)))
            return true;
        else
            return false;
    }
    public static boolean smallerThan_1_5_1(String platform, String versionCode) {
        if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) < 36))
                || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) < 44)))
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java
@@ -730,7 +730,7 @@
    }
    
    /**
     *
     * 朋友圈
     * @param pageId
     * @return
     */
@@ -766,4 +766,44 @@
        return daTaoKeGoodsResult;
    }
    
    /**
     * 9.9包邮精选
     * @param pageId
     * @return
     */
    public static DaTaoKeGoodsResult getNineGoodsList(Integer pageId, int pageSize) {
        DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
        TaoKeAppInfo app = getRandomApp();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.2.2");
        params.put("appKey", app.getAppKey());
        params.put("pageSize", pageSize + "");
        params.put("nineCid", "-1");
        if (pageId != null)
            params.put("pageId", pageId + "");
        params.put("sign", getSign(params, app.getAppSecret()));
        String result = null;
        try {
            result = HttpUtil.get("https://openapi.dataoke.com/api/goods/nine/op-goods-list", params, new HashMap<>());
        } catch (Exception e) {
            result = HttpUtil.get("https://openapi.dataoke.com/api/goods/nine/op-goods-list", params, new HashMap<>());
        }
        JSONObject json = JSONObject.fromObject(result);
        JSONObject dataJson = json.optJSONObject("data");
        if (dataJson != null) {
            JSONArray array = dataJson.optJSONArray("list");
            if (array != null) {
                List<DaTaoKeDetailV2> list = parseDaTaoKeDetailV2List(array);
                daTaoKeGoodsResult.setGoodsList(list);
            }
            daTaoKeGoodsResult.setPageId(dataJson.optString("pageId"));
            daTaoKeGoodsResult.setTotalCount(dataJson.optLong("totalNum"));
        }
        return daTaoKeGoodsResult;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/TaoBaoGoodsFactory.java
@@ -5,6 +5,7 @@
import org.yeshi.utils.taobao.TbImgUtil;
import com.yeshi.fanli.entity.goods.PullNewGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.haodanku.HDKGoodsDetail;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@@ -65,5 +66,59 @@
        return goods;
    }
 
    /**
     * 好单库商品转换
     * @param hdkGoods
     * @return
     */
    public static TaoBaoGoodsBrief create(PullNewGoods hdkGoods) {
        if (hdkGoods == null)
            return null;
        TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
        goods.setAuctionId(hdkGoods.getItemid());
        goods.setTitle(hdkGoods.getItemtitle());
        goods.setPictUrl(TbImgUtil.getTBSize320Img((hdkGoods.getItempic())));
        goods.setZkPrice(new BigDecimal(hdkGoods.getItemprice() + ""));
        goods.setBiz30day(hdkGoods.getItemsale());
        goods.setTkRate(BigDecimal.valueOf(hdkGoods.getTkrates()));
        goods.setState(0);
        // 图片列表
        String taobao_image = hdkGoods.getTaobao_image();
        if (!StringUtil.isNullOrEmpty(taobao_image)) {
            goods.setImgList(Arrays.asList(taobao_image.split(",")));
        }
        // 券信息
        if (hdkGoods.getCouponmoney() != null && hdkGoods.getCouponmoney() > 0) {
            goods.setCouponAmount(BigDecimal.valueOf(hdkGoods.getCouponmoney()));
            if (hdkGoods.getCoupon_condition() != null) {
                BigDecimal couponCondition = new BigDecimal(hdkGoods.getCoupon_condition());
                goods.setCouponStartFee(couponCondition);
                if (couponCondition.compareTo(new BigDecimal(0)) > 0)
                    goods.setCouponInfo(String.format("满%s元减%s元", MoneyBigDecimalUtil.getWithNoZera(couponCondition)+ "",
                            MoneyBigDecimalUtil.getWithNoZera(goods.getCouponAmount())+ ""));
                else
                    goods.setCouponInfo(String.format("%s元无条件券", goods.getCouponAmount() + ""));
            }
            goods.setCouponLink(hdkGoods.getCouponurl());
            goods.setCouponLeftCount(hdkGoods.getCouponsurplus());
            goods.setCouponTotalCount(hdkGoods.getCouponnum());
        }
        // 店铺
        goods.setShopTitle(hdkGoods.getShopname());
        if ("B".equalsIgnoreCase(hdkGoods.getShoptype()))
            goods.setUserType(1); // 天猫
        else
            goods.setUserType(0); // 淘宝
        return goods;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/redpack/RedPackMessageListener.java
@@ -11,18 +11,11 @@
import com.aliyun.openservices.ons.api.Producer;
import com.google.gson.Gson;
import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserRedPackGiftMQMsg;
import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.redpack.RedPackGiveRecordService;
import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.rocketmq.MQTopicName;
/**
@@ -52,97 +45,15 @@
                new String(message.getBody()));
        String tag = message.getTag();
        if (tag == null)
            tag = "";
        if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
            if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())) {// 订单统计
                OrderMQMsg orderMQMsg = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
                // 发送24小时延时消息
                // 测试时发送
                int hour = 24;
                if (Constant.IS_TEST) {
                    hour = 1;
                }
                orderMQMsg.setDelayHour(hour);
                Message msg = new Message(message.getTopic(), OrderTopicTagEnum.orderStatisticDelay.name(),
                        new Gson().toJson(orderMQMsg).getBytes());
                if (orderMQMsg.getStaticticDate().getTime() + 1000 * 60 * 60L * hour > System.currentTimeMillis())// 时间是否已经过了
                    msg.setStartDeliverTime(orderMQMsg.getStaticticDate().getTime() + 1000 * 60 * 60L * hour);
                else
                    msg.setStartDeliverTime(System.currentTimeMillis() + 1000 * 60);
                producer.send(msg);
            if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderConfirm.name())) {// 订单确认收货
                OrderConfirmMQMsg mqMsg = new Gson().fromJson(new String(message.getBody()),
                        OrderConfirmMQMsg.class);
                redPackWinInviteService.winRedPackByOrder(mqMsg.getSourceUid(), mqMsg.getOrderNo(), mqMsg.getSourceType());
                return Action.CommitMessage;
            } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatisticDelay.name())) {// 订单统计
                OrderMQMsg orderMQMsg = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
                int hour = 24;
                if (Constant.IS_TEST) {
                    hour = 1;
                }
                if (orderMQMsg.getDelayHour() == hour) {
                    try {// 邀请奖励
                        redPackWinInviteService.inviteSucceedReward(orderMQMsg.getUid());
                    } catch (Exception e) {
                        LogHelper.errorDetailInfo(e);
                        return Action.ReconsumeLater;
                    }
                }
                return Action.CommitMessage;
            } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiSeparateByOrderNo.name())) {// 订单到账(按订单号处理)
                OrderMoneyRecievedMQMsg orderMoneyRecievedMQMsg = new Gson().fromJson(new String(message.getBody()),
                        OrderMoneyRecievedMQMsg.class);
                if (orderMoneyRecievedMQMsg.getType() == OrderMoneyRecievedMQMsg.TYPE_INVITE) {
                    if (!StringUtil.isNullOrEmpty(orderMoneyRecievedMQMsg.getOrderId())
                            && orderMoneyRecievedMQMsg.getUid() != null) {
                        try {
                            redPackWinInviteService.inviteOrderArriveReward(orderMoneyRecievedMQMsg.getUid(),
                                    orderMoneyRecievedMQMsg.getSourceType(), orderMoneyRecievedMQMsg.getOrderId());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
                return Action.CommitMessage;
            }
        } else if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
            boolean inviteSucceedReward = false;
            Long uid = null;
            if (tag.equalsIgnoreCase(UserTopicTagEnum.userAccountBinding.name())) {// 账号绑定
                UserAccountBindingMQMsg userAccountBindingMQMsg = new Gson().fromJson(new String(message.getBody()),
                        UserAccountBindingMQMsg.class);
                Integer type = userAccountBindingMQMsg.getType();
                if (type == UserAccountBindingMQMsg.TYPE_PHONE || type == UserAccountBindingMQMsg.TYPE_WX
                        || type == UserAccountBindingMQMsg.TYPE_TAOBAO) {
                    inviteSucceedReward = true;
                    uid = userAccountBindingMQMsg.getUid();
                }
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {// 邀请成功
                UserInviteMQMsg userInviteMQMsg = new Gson().fromJson(new String(message.getBody()),
                        UserInviteMQMsg.class);
                inviteSucceedReward = true;
                uid = userInviteMQMsg.getWorkerId();
                redPackWinInviteService.initCreateRedPackWin(userInviteMQMsg.getBossId(),
                        userInviteMQMsg.getWorkerId());
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.redPackGiftDrawback.name())) {// 红包赠送
                UserRedPackGiftMQMsg userRedPackGiftMQMsg = new Gson().fromJson(new String(message.getBody()),
                        UserRedPackGiftMQMsg.class);
                try { // 红包赠送到期未领取
                    redPackGiveRecordService.overdueByPrimaryKey(userRedPackGiftMQMsg.getId());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return Action.CommitMessage;
            }
            if (inviteSucceedReward) {
                try {// 邀请奖励
                    redPackWinInviteService.inviteSucceedReward(uid);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return Action.CommitMessage;
fanli/src/main/java/com/yeshi/fanli/util/taobao/HaoDanKuApiUtil.java
@@ -306,7 +306,11 @@
        return null;
    }
    
    /**
     * 单品详情API
     * @param itemid
     * @return
     */
    public HDKGoodsDetail getItemDetail(String itemid) {
        List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>();
        params.add(new ParamsKeyValue("itemid", itemid));
@@ -320,4 +324,62 @@
        }
        return null;
    }
    /**
     * 精选低价包邮专区API
     * @param minId
     * @param pageSize
     * @return
     */
    public HDKGoodsListResultDTO getLowPricePinkageData(Integer minId, int pageSize, Integer typeNum) {
        if (minId == null)
            minId = 1;
        List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>();
        params.add(new ParamsKeyValue("min_id", minId +""));
        params.add(new ParamsKeyValue("back", pageSize + ""));
        params.add(new ParamsKeyValue("type", typeNum + ""));
        String result = baseGetRequest("low_price_Pinkage_data", params);
        JSONObject resultData = JSONObject.fromObject(result);
        if (resultData.optInt("code") == 1) {
            Integer newMinId = resultData.optInt("min_id");
            Type type = new TypeToken<ArrayList<HDKGoodsDetail>>() {
            }.getType();
            List<HDKGoodsDetail> list = new Gson().fromJson(resultData.optJSONArray("data").toString(), type);
            return new HDKGoodsListResultDTO(list, newMinId);
        }
        return null;
    }
    /**
     * 高佣专场商品API
     * @param minId
     * @param pageSize
     * @return
     */
    public HDKGoodsListResultDTO getHighitems(Integer minId, int pageSize, Integer catId) {
        if (minId == null)
            minId = 1;
        List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>();
        params.add(new ParamsKeyValue("min_id", minId +""));
        params.add(new ParamsKeyValue("back", pageSize + ""));
        if (catId != null)
            params.add(new ParamsKeyValue("cat_id", catId +""));
        String result = baseGetRequest("get_highitems", params);
        JSONObject resultData = JSONObject.fromObject(result);
        if (resultData.optInt("code") == 200) {
            Integer newMinId = resultData.optInt("min_id");
            Type type = new TypeToken<ArrayList<HDKGoodsDetail>>() {
            }.getType();
            List<HDKGoodsDetail> list = new Gson().fromJson(resultData.optJSONArray("data").toString(), type);
            return new HDKGoodsListResultDTO(list, newMinId);
        }
        return null;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -266,10 +266,10 @@
     */
    public static List<TaoBaoGoodsBrief> getBatchGoodsInfos(String ids) throws TaobaoGoodsDownException {
        List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.item.info.get");
        map.put("num_iids", ids + "");
        String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
        JSONObject data = JSONObject.fromObject(resultStr);
        // 商品下架
@@ -292,6 +292,63 @@
        }
        return goodsList;
    }
    public static List<TaoBaoGoodsBrief> getBatchGoodsInfo(List<Long> listId, String ip )
            throws TaoKeApiException, TaobaoGoodsDownException {
        if (listId == null || listId.size() == 0) {
            throw new TaobaoGoodsDownException(1, "淘宝商品ID不能为空");
        }
        if (listId.size() > 40) {
            throw new TaobaoGoodsDownException(1, "淘宝商品ID不能超过40个");
        }
        StringBuffer ids = new StringBuffer();
        for (Long id : listId) {
            ids.append(id + ",");
        }
        return getBatchGoodsInfos(ids.substring(0, ids.length() - 1), ip);
    }
    /**
     * 获取商品详情,简版
     *
     * @param id
     * @return
     */
    public static List<TaoBaoGoodsBrief> getBatchGoodsInfos(String ids, String ip) throws TaobaoGoodsDownException {
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.item.info.get");
        map.put("num_iids", ids + "");
        if (!StringUtil.isNullOrEmpty(ip)) {
            map.put("ip", ip);
        }
        String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
        JSONObject data = JSONObject.fromObject(resultStr);
        // 商品下架
        if (data.optJSONObject("error_response") != null && data.optJSONObject("error_response").optInt("code") == 15
                && data.optJSONObject("error_response").optInt("sub_code") == 50001) {
            throw new TaobaoGoodsDownException(data.optJSONObject("error_response").optInt("code"), "商品下架");
        }
        if (data.optJSONObject("tbk_item_info_get_response") == null)
            return null;
        List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
        JSONArray array = data.optJSONObject("tbk_item_info_get_response").optJSONObject("results")
                .optJSONArray("n_tbk_item");
        if (array != null && array.size() > 0) {
            for (int i = 0; i < array.size(); i++) {
                JSONObject item = array.optJSONObject(i);
                goodsList.add(parseSimpleGoodsInfo(item));
            }
        }
        return goodsList;
    }
    /**
     * 搜索商品详情-详细
fanli/src/main/java/com/yeshi/fanli/vo/goods/OtherInfo.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.vo.goods;
import java.io.Serializable;
import java.math.BigDecimal;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.vo.tlj.ReduceHongBao;
@@ -30,7 +31,14 @@
    @Expose
    private String fanliMoneyPlus;
    @Expose // 实付款金额
    private BigDecimal actualPay;
    @Expose // 补齐金额
    private BigDecimal mendMoney;
    public RewardCouponVO getRewardCoupon() {
        return rewardCoupon;
    }
@@ -63,4 +71,20 @@
        this.fanliMoneyPlus = fanliMoneyPlus;
    }
    public BigDecimal getActualPay() {
        return actualPay;
    }
    public void setActualPay(BigDecimal actualPay) {
        this.actualPay = actualPay;
    }
    public BigDecimal getMendMoney() {
        return mendMoney;
    }
    public void setMendMoney(BigDecimal mendMoney) {
        this.mendMoney = mendMoney;
    }
}