yujian
2019-12-03 54c250656c2e471ad48ecaa8ccce16ec9d7eb8bd
Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
30个文件已修改
1个文件已添加
717 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareStorageControllerV2.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5RecommendController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/web/ShareHotGoodsController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/integral/CodePublishRecordMapper.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfo.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/integral/CodePublishRecord.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/integral/CodePublishRecordMapper.xml 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsRecordServiceImpl.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/CodePublishRecordServiceImpl.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserGoodsStorageService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserShareGoodsRecordService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/integral/CodePublishRecordService.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/CommonGoodsFactory.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/goods/ShareInfoVO.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/mongo.properties 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/redis.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/rocketmq.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/rocketmq.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/TaoKeTest.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -3,7 +3,9 @@
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@@ -15,6 +17,7 @@
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.taobao.TbImgUtil;
import com.google.gson.Gson;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.jd.JDCategoryInfo;
import com.yeshi.fanli.dto.jd.JDCouponInfo;
@@ -26,6 +29,7 @@
import com.yeshi.fanli.entity.bus.user.ShamUser;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.jd.JDGoodsClass;
import com.yeshi.fanli.entity.system.BusinessSystem;
@@ -648,7 +652,8 @@
        if (couponInfo != null) {
            // 券链接处理
            String materialId = "https://item.jd.com/" + id + ".html";
            String url = JDApiUtil.convertLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "", null);
            String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(),
                    JDApiUtil.POSITION_COUPON + "", null);
            couponInfo.setLink(url);
        }
@@ -1123,9 +1128,11 @@
            if (couponInfo != null) {
                couponUrl = couponInfo.getLink();
            }
            jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
                    uid + "");
        } else {
            jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
                    uid + "");
        }
        JSONObject data = new JSONObject();
@@ -1151,7 +1158,7 @@
        String jumpLink = null;
        String materialId = "https://item.jd.com/" + id + ".html";
        jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null + "");
        jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null);
        JSONObject data = new JSONObject();
        data.put("native", true);
@@ -1260,4 +1267,92 @@
        }
        out.print(JsonUtil.loadTrueResult(data));
    }
    @RequestMapping(value = "listSimpleGoods", method = RequestMethod.POST)
    public void listSimpleGoods(AcceptData acceptData, String goodsInfo, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(goodsInfo)) {
            out.print(JsonUtil.loadFalseResult(1, "商品信息为空"));
            return;
        }
        net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(goodsInfo);
        List<CommonGoods> commonGoodsList = new ArrayList<>();
        for (int i = 0; i < array.size(); i++) {
            JSONObject obj = array.optJSONObject(i);
            CommonGoods cg = new CommonGoods();
            cg.setGoodsId(obj.optLong("goodsId"));
            cg.setGoodsType(obj.optInt("goodsType"));
            commonGoodsList.add(cg);
        }
        if (commonGoodsList.size() > 9) {
            out.print(JsonUtil.loadFalseResult(1, "最多同时获取9条数据"));
            return;
        }
        // 分离各个平台的商品信息
        List<Long> tbGoodsList = new ArrayList<>();
        List<Long> jdGoodsList = new ArrayList<>();
        List<Long> pddGoodsList = new ArrayList<>();
        List<String> keyList = new ArrayList<>();
        for (CommonGoods cg : commonGoodsList) {
            keyList.add(cg.getGoodsId() + "-" + cg.getGoodsType());
            if (cg.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
                tbGoodsList.add(cg.getGoodsId());
            } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_JD) {
                jdGoodsList.add(cg.getGoodsId());
            } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
                pddGoodsList.add(cg.getGoodsId());
            }
        }
        Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>();
        ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
                hongBaoManageService.getShareRate(), new BigDecimal(80));
        if (tbGoodsList.size() > 0) {
            List<TaoBaoGoodsBrief> goodsList = null;
            try {
                goodsList = TaoKeApiUtil.getBatchGoodsInfo(tbGoodsList);
            } catch (TaobaoGoodsDownException e) {
                e.printStackTrace();
            } catch (TaoKeApiException e) {
                e.printStackTrace();
            }
            if (goodsList != null)
                for (TaoBaoGoodsBrief goods : goodsList) {
                    goods.setTkRate(new BigDecimal(0));
                    tempGoodsList.put(goods.getAuctionId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
                            GoodsDetailVOFactory.convertTaoBao(goods, params));
                }
        }
        if (jdGoodsList.size() > 0) {
            List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList);
            for (JDGoods goods : goodsList) {
                tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
                        GoodsDetailVOFactory.convertJDGoods(goods, params));
            }
        }
        if (pddGoodsList.size() > 0) {
            List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList);
            for (PDDGoodsDetail goods : goodsList) {
                tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
                        GoodsDetailVOFactory.convertPDDGoods(goods, params));
            }
        }
        List<GoodsDetailVO> voList = new ArrayList<>();
        Gson gson = JsonUtil.getApiCommonGson();
        for (String key : keyList) {
            GoodsDetailVO vo = tempGoodsList.get(key);
            if (vo != null) {
                voList.add(vo);
            }
        }
        out.print(JsonUtil.loadTrueResult(gson.toJson(voList)));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -158,17 +158,22 @@
    private UserTaoLiJinRecordService userTaoLiJinRecordService;
    /**
     * 获取淘宝的分享链接
     * 
     * @param acceptData
     * @param uid
     *            -用户ID
     * @param auctionId-商品ID
     * @param goodsId-商品ID
     * @param source
     * @param totalNum
     * @param goodsType
     * @param needGoods
     *            -是否需要商品信息
     * @param request
     * @param out
     */
    @RequestMapping(value = "createShareInfo")
    public void createShareInfo(AcceptData acceptData, Long uid, Long goodsId, String source, Integer totalNum,
            Integer goodsType, HttpServletRequest request, PrintWriter out) {
            Integer goodsType, Boolean needGoods, HttpServletRequest request, PrintWriter out) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
            return;
@@ -194,19 +199,19 @@
        // 淘宝
        if (goodsType == null || goodsType == Constant.SOURCE_TYPE_TAOBAO) {
            createTaoBaoShare(acceptData, uid, goodsId, totalNum, source, request, out);
            createTaoBaoShare(acceptData, uid, goodsId, totalNum, source, needGoods, request, out);
            return;
        }
        // 京东
        if (goodsType == Constant.SOURCE_TYPE_JD) {
            createJDShare(acceptData, uid, goodsId, source, out);
            createJDShare(acceptData, uid, goodsId, source, needGoods, out);
            return;
        }
        // 拼多多
        if (goodsType == Constant.SOURCE_TYPE_PDD) {
            createPDDShare(acceptData, uid, goodsId, source, out);
            createPDDShare(acceptData, uid, goodsId, source, needGoods, out);
            return;
        }
    }
@@ -238,7 +243,10 @@
     * @param out
     */
    public void createTaoBaoShare(AcceptData acceptData, Long uid, Long goodsId, Integer totalNum, String source,
            HttpServletRequest request, PrintWriter out) {
            Boolean needGoods, HttpServletRequest request, PrintWriter out) {
        if (needGoods == null)
            needGoods = false;
        UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByUid(uid);
        UserInfoExtra userExtraInfo = userInfoExtraService.getUserInfoExtra(uid);
        String inviteCode = null;
@@ -267,6 +275,13 @@
            // 测试
            TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId);
            if (taoBaoLink != null && taoBaoLink.getGoods() != null && needGoods) {
                ConfigParamsDTO dto = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
                        hongBaoManageService.getShareRate(), new BigDecimal(80));
                GoodsDetailVO goodsInfo = GoodsDetailVOFactory.convertTaoBao(taoBaoLink.getGoods(), dto);
                shareInfo.setGoodsInfo(goodsInfo);
            }
            String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
                    Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
@@ -598,7 +613,8 @@
     * @param request
     * @param out
     */
    public void createJDShare(AcceptData acceptData, Long uid, Long goodsId, String source, PrintWriter out) {
    public void createJDShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods,
            PrintWriter out) {
        JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
        if (jdGoods == null) {
            out.print(JsonUtil.loadFalseResult(1, "该商品已下架"));
@@ -617,7 +633,8 @@
            couponUrl = couponInfo.getLink();
        }
        String materialId = "https://item.jd.com/" + goodsId + ".html";
        String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
        String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
                uid + "");
        ShareInfoVO shareInfo = new ShareInfoVO();
        shareInfo.setClickUrl(jumpLink);
@@ -625,6 +642,10 @@
        shareInfo.setRule(configService.get("share_rule_link_jd"));
        shareInfo.setPictUrl(jdGoods.getPicUrl());
        shareInfo.setCommentTexts(new ArrayList<>());
        if (needGoods)
            shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods, new ConfigParamsDTO(
                    hongBaoManageService.getFanLiRate(), hongBaoManageService.getShareRate(), new BigDecimal(80))));
        String shareText = "";
        boolean hasCoupon = false;
@@ -716,7 +737,8 @@
     * @param source
     * @param out
     */
    public void createPDDShare(AcceptData acceptData, Long uid, Long goodsId, String source, PrintWriter out) {
    public void createPDDShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods,
            PrintWriter out) {
        PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
        if (goods == null) {
            out.print(JsonUtil.loadFalseResult(1, "该商品已下架"));
@@ -737,6 +759,10 @@
        shareInfo.setCommentTexts(new ArrayList<>());
        shareInfo.setRule(configService.get("share_rule_link_pdd"));
        shareInfo.setPictUrl(goods.getGoodsImageUrl());
        if (needGoods) {
            shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertPDDGoods(goods, new ConfigParamsDTO(
                    hongBaoManageService.getFanLiRate(), hongBaoManageService.getShareRate(), new BigDecimal(80))));
        }
        String template = "";
        boolean hasCoupon = false;
@@ -1020,7 +1046,8 @@
            couponUrl = couponInfo.getLink();
        }
        String materialId = "https://item.jd.com/" + goodsId + ".html";
        String shortLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
        String shortLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
                uid + "");
        String content = shareGoodsTextTemplateService.createContentByTemplateJD(template, uid, goods, shortLink,
                hasCoupon);
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareStorageControllerV2.java
@@ -31,6 +31,7 @@
import com.yeshi.fanli.service.inter.user.UserGoodsStorageService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
@@ -56,8 +57,6 @@
    @Resource
    private UserGoodsStorageService userGoodsStorageService;
    /**
     *  单个商品加入选品库
@@ -106,8 +105,10 @@
     * 批量添加选品库
     * 
     * @param acceptData
     * @param uid        用户id
     * @param ids        简版商品id
     * @param uid
     *            用户id
     * @param ids
     *            简版商品id
     * @param out
     */
    @RequestMapping(value = "addStorage", method = RequestMethod.POST)
@@ -132,8 +133,10 @@
     * 查询用户选品库数据
     * 
     * @param acceptData
     * @param page       页码 初始值 1
     * @param uid        用户id
     * @param page
     *            页码 初始值 1
     * @param uid
     *            用户id
     * @param out
     */
    @RequestMapping(value = "getlist", method = RequestMethod.POST)
@@ -252,7 +255,6 @@
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 分享商品返回二维码图片
     * 
@@ -276,7 +278,11 @@
        try {
            Gson gson = new Gson();
            List<Long> listStorageID = gson.fromJson(storageIds, new TypeToken<ArrayList<Long>>() {}.getType());
            List<Long> listStorageID = gson.fromJson(storageIds, new TypeToken<ArrayList<Long>>() {
            }.getType());
            if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
            if (listStorageID == null || listStorageID.size() < 9) {
                out.print(JsonUtil.loadFalseResult("分享商品数量不足"));
                return;
@@ -287,8 +293,13 @@
                return;
            }
            JSONObject data = userGoodsStorageService.createShareV2(uid, listStorageID);
                JSONObject data = userGoodsStorageService.createShareV2(uid, listStorageID, true);
            out.print(JsonUtil.loadTrueResult(data));
            } else {
                JSONObject data = userGoodsStorageService.createShareV2(uid, listStorageID, false);
                out.print(JsonUtil.loadTrueResult(data));
            }
        } catch (UserGoodsStorageException e) {
            out.print(JsonUtil.loadFalseResult("分享失败"));
            e.printStackTrace();
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5RecommendController.java
@@ -463,7 +463,7 @@
        }
        String materialId = "https://item.jd.com/" + id + ".html";
        String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid);
        String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid);
        int priceType = 1;
        BigDecimal price = jdGoods.getPrice();
fanli/src/main/java/com/yeshi/fanli/controller/web/ShareHotGoodsController.java
@@ -59,6 +59,11 @@
            array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, "100", null)));
        }
        out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array)));
    }
    /**
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
@@ -199,16 +199,27 @@
    long countAvaiableUser();
    
    /**
     * 查询满足自动提现用户
     *
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> getAutoExtractUser(@Param("start") int start, @Param("count") int count, @Param("money") BigDecimal money,
            @Param("beganDate") String beganDate, @Param("endDate") String endDate);
    
    List<UserInfo> getAutoExtractUser(@Param("start") int start, @Param("count") int count,
            @Param("money") BigDecimal money, @Param("beganDate") String beganDate, @Param("endDate") String endDate);
    /**
     * 根据type检索
     * @param type
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> listByType(@Param("type")int type,@Param("start") long start, @Param("count")int count);
    long countByType(int type);
    
    /**
     * 查询满足自动提现用户
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/integral/CodePublishRecordMapper.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.dao.mybatis.integral;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
@@ -11,13 +12,23 @@
    
    /**
     * 查询近3天发布记录
     *
     * @return
     */
    List<CodePublishRecord> listValid(@Param("start") long start, @Param("count") int count, @Param("validTime")long validTime);
    List<CodePublishRecord> listValid(@Param("start") long start, @Param("count") int count,
            @Param("validTime") long validTime);
    
    /**
     * 根据最小时间查询
     * @param start
     * @param count
     * @param minTime
     * @return
     */
    List<CodePublishRecord> listByMinTime(@Param("start") long start, @Param("count") int count,
            @Param("minTime") Date minTime);
    
    long countValid(@Param("validTime") long validTime);
    
    long countValidRecord(@Param("uid") long uid, @Param("validTime") long validTime);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfo.java
@@ -79,9 +79,9 @@
    @Expose
    private String lastLoginIp;// 最近一次登录IP
    @Column(name = "tuiguang_code")
    @Column(name = "type")
    @Expose
    private String tuiGuangCode;// 推广码
    private Integer type;// 用户类型 0-普通用户 1-虚拟用户
    @Column(name = "appid")
    @Expose
@@ -126,7 +126,6 @@
    @Expose
    private String rankIcon;// 等级图标
    
    // 性别: 1-女  2-男
    @Transient
    @Expose
@@ -152,7 +151,6 @@
    @Transient
    @Expose
    private boolean vip;
    
    public boolean isVip() {
        return vip;
@@ -293,14 +291,6 @@
        this.appId = appId;
    }
    public String getTuiGuangCode() {
        return tuiGuangCode;
    }
    public void setTuiGuangCode(String tuiGuangCode) {
        this.tuiGuangCode = tuiGuangCode;
    }
    public Long getId() {
        return id;
    }
@@ -437,6 +427,14 @@
        this.weiXinTip = weiXinTip;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
fanli/src/main/java/com/yeshi/fanli/entity/integral/CodePublishRecord.java
@@ -19,7 +19,7 @@
    private static final long serialVersionUID = 1L;
    
    // 发布有效时间
    // 发布有效时间 3天
    public static final long VALIDTIME  = 3*24*60*60;
    @Expose
fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java
New file
@@ -0,0 +1,79 @@
package com.yeshi.fanli.job;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.integral.CodePublishRecord;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.TimeUtil;
/**
 * 邀请码发布
 *
 * @author Administrator
 *
 */
@Component
public class ShameUserInviteCodePublishJOB {
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private CodePublishRecordService codePublishRecordService;
    // 7点到23点每10分钟执行一次
    @Scheduled(cron = "0 0/10 7-23 * * ? ")
    public void publish() {
        if (!Constant.IS_TASK)
            return;
        long time = System.currentTimeMillis();
        int day = TimeUtil.getDayDifferenceCount(new Date(TimeUtil.convertToTimeTemp("2019-11-28", "yyyy-MM-dd")),
                new Date());
        int count = (day + 1) * 3;
        if (count > 33)
            count = 33;
        List<CodePublishRecord> list = codePublishRecordService.listByMinTime(0, 200,
                new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(time, "yyyyMMdd"), "yyyyMMddd")));
        int shameCount = 0;
        for (CodePublishRecord record : list) {
            UserInfo user = userInfoService.selectByPKey(record.getUid());
            if (user != null && user.getType() == 1)
                shameCount++;
        }
        if (shameCount > 33) {// 不再添加
            return;
        }
        int leftCount = count - shameCount;
        if (leftCount <= 0)
            return;
        long publishLeftCount = (TimeUtil
                .convertToTimeTemp(TimeUtil.getGernalTime(time + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMddd") - time)
                / (1000 * 60 * 10L);
        // 今天还剩下的分钟数
        if (leftCount > count * publishLeftCount / 102) {
            // 计算本次是否发布
            int start = (int) (Math.random() * 1000);
            List<UserInfo> userList = userInfoService.listByType(1, start, 1);
            try {
                Thread.sleep((int) (Math.random() * 1000 * 60 * 3L));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if (userList != null && userList.size() > 0) {
                codePublishRecordService.publishInviteCode(userList.get(0).getId());
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -18,8 +18,7 @@
        <result column="last_logintime" property="lastLoginTime"
            jdbcType="BIGINT" />
        <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
        <result column="tuiguang_code" property="tuiGuangCode"
            jdbcType="VARCHAR" />
        <result column="type" property="type" jdbcType="INTEGER" />
        <result column="appid" property="appId" jdbcType="VARCHAR" />
        <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
        <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
@@ -48,8 +47,7 @@
        <result column="last_logintime" property="lastLoginTime"
            jdbcType="BIGINT" />
        <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
        <result column="tuiguang_code" property="tuiGuangCode"
            jdbcType="VARCHAR" />
        <result column="type" property="type" jdbcType="INTEGER" />
        <result column="appid" property="appId" jdbcType="VARCHAR" />
        <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
        <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
@@ -88,7 +86,7 @@
        <result column="showValue" property="showValue" jdbcType="VARCHAR" />
    </resultMap>
    
    <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc
    <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc
    </sql>
    <!-- 不能查询缓存 -->
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
@@ -117,9 +115,9 @@
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user
        (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc)
        (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc)
        values
        (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{tuiGuangCode,jdbcType=VARCHAR},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system.id,jdbcType=BIGINT},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR})
        (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system.id,jdbcType=BIGINT},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
        useGeneratedKeys="true" keyProperty="id">
@@ -139,7 +137,7 @@
            <if test="createtime != null">createtime,</if>
            <if test="lastLoginTime != null">last_logintime,</if>
            <if test="lastLoginIp != null">loginip,</if>
            <if test="tuiGuangCode != null">tuiguang_code,</if>
            <if test="type != null">type,</if>
            <if test="appId != null">appid,</if>
            <if test="myHongBao != null">my_hongBao,</if>
            <if test="payPassword != null">pay_password,</if>
@@ -165,7 +163,7 @@
            <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if>
            <if test="lastLoginTime != null">#{lastLoginTime,jdbcType=BIGINT},</if>
            <if test="lastLoginIp != null">#{lastLoginIp,jdbcType=VARCHAR},</if>
            <if test="tuiGuangCode != null">#{tuiGuangCode,jdbcType=VARCHAR},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="appId != null">#{appId,jdbcType=VARCHAR},</if>
            <if test="myHongBao != null">#{myHongBao,jdbcType=DECIMAL},</if>
            <if test="payPassword != null">#{payPassword,jdbcType=VARCHAR},</if>
@@ -187,8 +185,8 @@
        #{portrait,jdbcType=VARCHAR},createtime =
        #{createtime,jdbcType=BIGINT},last_logintime =
        #{lastLoginTime,jdbcType=BIGINT},loginip =
        #{lastLoginIp,jdbcType=VARCHAR},tuiguang_code =
        #{tuiGuangCode,jdbcType=VARCHAR},appid =
        #{lastLoginIp,jdbcType=VARCHAR},type =
        #{type,jdbcType=INTEGER},appid =
        #{appId,jdbcType=VARCHAR},my_hongBao =
        #{myHongBao,jdbcType=DECIMAL},pay_password =
        #{payPassword,jdbcType=VARCHAR},sid =
@@ -213,7 +211,7 @@
            <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if>
            <if test="lastLoginTime != null">last_logintime=#{lastLoginTime,jdbcType=BIGINT},</if>
            <if test="lastLoginIp != null">loginip=#{lastLoginIp,jdbcType=VARCHAR},</if>
            <if test="tuiGuangCode != null">tuiguang_code=#{tuiGuangCode,jdbcType=VARCHAR},</if>
            <if test="type != null">type=#{type,jdbcType=INTEGER},</if>
            <if test="appId != null">appid=#{appId,jdbcType=VARCHAR},</if>
            <if test="myHongBao != null">my_hongBao=#{myHongBao,jdbcType=DECIMAL},</if>
            <if test="payPassword != null">pay_password=#{payPassword,jdbcType=VARCHAR},</if>
@@ -703,11 +701,19 @@
    
    <select id="getAutoExtractUser" resultMap="BaseResultMap">
        SELECT u.* FROM `yeshi_ec_user_info_extra` t
        LEFT JOIN  `yeshi_ec_user` u ON u.`id` = t.`uie_uid`
        WHERE t.`uie_auto_extract` = 1 AND t.uie_active_time <![CDATA[>=]]> #{beganDate} AND  t.uie_active_time <![CDATA[<]]> #{endDate}
        LEFT JOIN `yeshi_ec_user`
        u ON u.`id` = t.`uie_uid`
        WHERE t.`uie_auto_extract` = 1 AND
        t.uie_active_time <![CDATA[>=]]>
        #{beganDate} AND t.uie_active_time <![CDATA[<]]>
        #{endDate}
            AND (t.`uie_mark` IS NULL OR t.`uie_mark` = '') 
            AND u.`state` = 0 AND u.`my_hongBao` <![CDATA[>=]]> #{money}
            AND u.`wx_open_id` IS NOT NULL AND LENGTH(TRIM(u.`wx_open_id`)) <![CDATA[>]]> 0
        AND u.`state`
        = 0 AND u.`my_hongBao` <![CDATA[>=]]>
        #{money}
        AND u.`wx_open_id` IS NOT NULL AND
        LENGTH(TRIM(u.`wx_open_id`)) <![CDATA[>]]>
        0
            AND u.`wx_open_id` NOT LIKE 'o_b9%'
        LIMIT #{start},#{count}
    </select>
@@ -725,4 +731,16 @@
        LIMIT #{start},#{count}
    </select>
    <select id="listByType" resultMap="BaseResultMap">
        select * from yeshi_ec_user u
        where u.type=#{type} limit #{start},#{count}
    </select>
    <select id="countByType" resultType="java.lang.Long"
        parameterType="java.lang.Integer">
        select count(*) from
        yeshi_ec_user u where u.type=#{0}
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/integral/CodePublishRecordMapper.xml
@@ -2,64 +2,97 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.integral.CodePublishRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.integral.CodePublishRecord">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.integral.CodePublishRecord">
    <id column="pr_id" property="id" jdbcType="BIGINT"/>
    <result column="pr_uid" property="uid" jdbcType="BIGINT"/>
    <result column="pr_create_time" property="createTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  
  <resultMap id="BaseResultVOMap" type="com.yeshi.fanli.entity.integral.CodePublishRecord">
    <resultMap id="BaseResultVOMap"
        type="com.yeshi.fanli.entity.integral.CodePublishRecord">
    <id column="pr_id" property="id" jdbcType="BIGINT"/>
    <result column="pr_uid" property="uid" jdbcType="BIGINT"/>
    <result column="pr_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
    <result column="portrait" property="portrait" jdbcType="VARCHAR"/>
    <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
        <result column="uie_invite_code" property="inviteCode"
            jdbcType="VARCHAR" />
  </resultMap>
  
  <sql id="Base_Column_List">pr_id,pr_uid,pr_create_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_code_publish_record where pr_id = #{id,jdbcType=BIGINT}
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_code_publish_record where pr_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_code_publish_record where pr_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_code_publish_record (pr_id,pr_uid,pr_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_code_publish_record
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_code_publish_record where pr_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_code_publish_record (pr_id,pr_uid,pr_create_time) values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_code_publish_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">pr_id,</if>
      <if test="uid != null">pr_uid,</if>
      <if test="createTime != null">pr_create_time,</if>
    </trim>values
        </trim>
        values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord">update yeshi_ec_code_publish_record set pr_uid = #{uid,jdbcType=BIGINT},pr_create_time = #{createTime,jdbcType=TIMESTAMP} where pr_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord">update yeshi_ec_code_publish_record
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord">update
        yeshi_ec_code_publish_record set pr_uid =
        #{uid,jdbcType=BIGINT},pr_create_time =
        #{createTime,jdbcType=TIMESTAMP} where pr_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord">
        update yeshi_ec_code_publish_record
    <set>
      <if test="uid != null">pr_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="createTime != null">pr_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
    </set> where pr_id = #{id,jdbcType=BIGINT}
        </set>
        where pr_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="listValid" resultMap="BaseResultVOMap">
   SELECT p.*,u.`nick_name`,u.`portrait`,e.`uie_invite_code`  FROM yeshi_ec_code_publish_record p
        SELECT p.*,u.`nick_name`,u.`portrait`,e.`uie_invite_code` FROM
        yeshi_ec_code_publish_record p
   LEFT JOIN `yeshi_ec_user` u ON u.`id` = p.`pr_uid`
   LEFT JOIN `yeshi_ec_user_info_extra` e ON e.`uie_uid` = p.`pr_uid`
   WHERE TIMESTAMPDIFF(SECOND,p.`pr_create_time`,NOW())<![CDATA[<]]> #{validTime}
        WHERE TIMESTAMPDIFF(SECOND,p.`pr_create_time`,NOW())<![CDATA[<]]>
        #{validTime}
        ORDER BY p.`pr_create_time` DESC
        LIMIT #{start},#{count}
    </select>
    <select id="listByMinTime" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_code_publish_record p where p.`pr_create_time` >=
        #{minTime}
   ORDER BY p.`pr_create_time` DESC
   LIMIT #{start},#{count}
  </select>
  
  <select id="countValid" resultType="Long">
   SELECT IFNULL(COUNT(pr_id),0) FROM yeshi_ec_code_publish_record
   WHERE TIMESTAMPDIFF(SECOND,`pr_create_time`,NOW())<![CDATA[<]]> #{validTime}
        WHERE TIMESTAMPDIFF(SECOND,`pr_create_time`,NOW())<![CDATA[<]]>
        #{validTime}
  </select>
  
  <select id="countValidRecord" resultType="Long">
   SELECT IFNULL(COUNT(pr_id),0) FROM yeshi_ec_code_publish_record
   WHERE  pr_uid = #{uid} AND TIMESTAMPDIFF(SECOND,`pr_create_time`,NOW())<![CDATA[<]]> #{validTime}
        WHERE pr_uid = #{uid} AND TIMESTAMPDIFF(SECOND,`pr_create_time`,NOW())<![CDATA[<]]>
        #{validTime}
  </select>
  
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -20,7 +20,6 @@
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.Producer;
import com.aliyun.openservices.ons.api.SendResult;
import com.aliyun.openservices.ons.api.transaction.LocalTransactionExecuter;
import com.aliyun.openservices.ons.api.transaction.TransactionProducer;
import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
@@ -89,7 +88,6 @@
import com.yeshi.fanli.util.jd.JDApiUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
import com.yeshi.fanli.util.rocketmq.MQTagConstant;
import com.yeshi.fanli.util.rocketmq.MQTopicName;
@Service
@@ -740,7 +738,11 @@
        if (order.getValidCode() == 2)
            return;
        // 根据ext1与subUnionId跟单
        String uidStr = order.getExt1();
        if (StringUtil.isNullOrEmpty(uidStr))
            uidStr = order.getOrderItemList().get(0).getSubUnionId();
        Long uid = null;
        if (!StringUtil.isNullOrEmpty(uidStr) && NumberUtil.isNumeric(uidStr))
            uid = Long.parseLong(uidStr);
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -670,6 +670,7 @@
        userInfoMapper.updateByPrimaryKeySelective(userInfo);
    }
    @Transactional
    @Override
    public void register(UserInfo userInfo) throws UserAccountException {
        if (!StringUtil.isNullOrEmpty(userInfo.getPhone())) {
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java
@@ -115,6 +115,7 @@
    
    /**
     * 根据主键 、uid 批量删除
     *
     * @param list
     * @return
     */
@@ -184,7 +185,6 @@
                }
            }
            
            if (commonGoods != null) {
                try {
                    commonGoodsService.addOrUpdateCommonGoods(commonGoods);
@@ -204,7 +204,8 @@
                    userGoodsStorageMapper.updateByPrimaryKeySelective(goodsStorage);
                } else {
                    goodsStorage = new UserGoodsStorage();
                    goodsStorage.setUid(uid);;
                    goodsStorage.setUid(uid);
                    ;
                    goodsStorage.setState(UserGoodsStorage.STATE_NORMAL);
                    goodsStorage.setCommonGoods(commonGoods);
                    goodsStorage.setCreateTime(new Date());
@@ -214,7 +215,6 @@
            }
        }
    }
    
    @Override
    @Transactional
@@ -240,7 +240,8 @@
                    userGoodsStorageMapper.updateByPrimaryKeySelective(goodsStorage);
                } else {
                    goodsStorage = new UserGoodsStorage();
                    goodsStorage.setUid(uid);;
                    goodsStorage.setUid(uid);
                    ;
                    goodsStorage.setState(UserGoodsStorage.STATE_NORMAL);
                    goodsStorage.setCommonGoods(commonGoods);
                    goodsStorage.setCreateTime(new Date());
@@ -250,7 +251,6 @@
            }
        }
    }
    
    @Override
    public JSONArray getMyStorage(int page, int pageSize, Long uid, Integer source) throws UserGoodsStorageException {
@@ -289,7 +289,6 @@
            }
        }
        
        BigDecimal  rate = manageService.getFanLiRate();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
@@ -300,12 +299,11 @@
                continue;
            }
            
            int state = 0;
            Integer goodsType = commonGoods.getGoodsType();
            
            if (listTaoKeGoods != null && listTaoKeGoods.size() > 0
                    && goodsType != null && goodsType == Constant.SOURCE_TYPE_TAOBAO) {
            if (listTaoKeGoods != null && listTaoKeGoods.size() > 0 && goodsType != null
                    && goodsType == Constant.SOURCE_TYPE_TAOBAO) {
                state = 1;  // 默认停售
                Long goodsId = commonGoods.getGoodsId();
                for (TaoBaoGoodsBrief taoKeGoods: listTaoKeGoods) {
@@ -338,7 +336,6 @@
        
        return array;
    }
    
    @Override
    public boolean isExistStorage(Long uid, Long auctionId, Integer goodType) {
@@ -385,7 +382,8 @@
            totalMoney = MoneyBigDecimalUtil.add(totalMoney, money);
        }
        
        ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorage(uid, listGoodsBrief, listStorageID);
        ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorage(uid, listGoodsBrief,
                listStorageID);
        FileUploadResult uploadResult = new FileUploadResult();
        uploadResult.setUrl(shareRecord.getSharePictureUrl());
        
@@ -397,10 +395,9 @@
        return data;
    }
    
    @Override
    public JSONObject createShareV2(Long uid, List<Long> listStorageID) throws UserGoodsStorageException, UserShareGoodsRecordException {
    public JSONObject createShareV2(Long uid, List<Long> listStorageID, boolean needDrawPicture)
            throws UserGoodsStorageException, UserShareGoodsRecordException {
        List<UserGoodsStorage> listStorage = userGoodsStorageMapper.listQueryByIds(listStorageID);
        if (listStorage == null || listStorage.size() == 0) {
            throw new UserGoodsStorageException(1, "选品库商品不存在");
@@ -434,7 +431,8 @@
            }
        }
        
        ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorageV2(uid, listCommonGoods, listStorageID);
        ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorageV2(uid, listCommonGoods,
                listStorageID, needDrawPicture);
        FileUploadResult uploadResult = new FileUploadResult();
        uploadResult.setUrl(shareRecord.getSharePictureUrl());
        
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java
@@ -650,12 +650,21 @@
        userInfoMapper.updateByPrimaryKeySelective(userInfo);
    }
    
    @Override
    public List<UserInfo> getAutoExtractUser(int start, int count, BigDecimal minSurplus, String beganDate,String endDate) {
    public List<UserInfo> getAutoExtractUser(int start, int count, BigDecimal minSurplus, String beganDate,
            String endDate) {
        return userInfoMapper.getAutoExtractUser(start, count, minSurplus, beganDate, endDate);
    }
    @Override
    public List<UserInfo> listByType(int type, int page, int count) {
        return userInfoMapper.listByType(type, (page - 1) * count, count);
    }
    @Override
    public long countByType(int type) {
        return userInfoMapper.countByType(type);
    }
    
    @Override
    public List<UserInfo> getAutoExtractUserTo1212(int start, int count) {
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsRecordServiceImpl.java
@@ -96,8 +96,6 @@
    @Resource
    private IntegralGetService integralGetService;
    
    @Override
    public int insert(UserShareGoodsRecord record) {
        return userShareGoodsRecordMapper.insert(record);
@@ -241,8 +239,7 @@
    }
    @Override
    public void saveSingleShareRecord(Long uid, Long goodsId, Integer goodsType)
            throws UserShareGoodsRecordException {
    public void saveSingleShareRecord(Long uid, Long goodsId, Integer goodsType) throws UserShareGoodsRecordException {
        if (goodsId == null) {
            throw new UserShareGoodsRecordException(1, "分享商品不能为空");
        }
@@ -426,9 +423,12 @@
    /**
     * 生成分享图
     * 
     * @param uid       用户id
     * @param shareId   分享记录id
     * @param source    来源
     * @param uid
     *            用户id
     * @param shareId
     *            分享记录id
     * @param source
     *            来源
     * @param listGoods
     * @return
     * @throws UserShareGoodsRecordException
@@ -661,7 +661,8 @@
    }
    @Override
    public ShareGoodsRecordDTO addRecordGoodsDetail(Long uid, Long auctionId, Integer goodsType, boolean isTaolijin) throws UserShareGoodsRecordException {
    public ShareGoodsRecordDTO addRecordGoodsDetail(Long uid, Long auctionId, Integer goodsType, boolean isTaolijin)
            throws UserShareGoodsRecordException {
        if (auctionId == null || uid == null || uid <= 0) {
            throw new UserShareGoodsRecordException(1, "传递参数不正确");
        }
@@ -682,8 +683,8 @@
    }
    @Override
    public ShareGoodsRecordDTO addRecordGoodsStorage(Long uid, List<TaoBaoGoodsBrief> listGoodsBrief, List<Long> listStorageID)
            throws UserShareGoodsRecordException {
    public ShareGoodsRecordDTO addRecordGoodsStorage(Long uid, List<TaoBaoGoodsBrief> listGoodsBrief,
            List<Long> listStorageID) throws UserShareGoodsRecordException {
        if (uid == null || uid <= 0 || listGoodsBrief == null || listGoodsBrief.size() == 0) {
            throw new UserShareGoodsRecordException(1, "传递参数不正确");
        }
@@ -700,7 +701,6 @@
        for (TaoBaoGoodsBrief goodsBrief: listGoodsBrief) {
            listCommonGoods.add(CommonGoodsFactory.create(goodsBrief));
        }
        
        Long id = record.getId();
        // 分享链接
@@ -727,8 +727,8 @@
    }
    
    @Override
    public ShareGoodsRecordDTO addRecordGoodsStorageV2(Long uid, List<CommonGoods> listGoods, List<Long> listStorageID)
            throws UserShareGoodsRecordException {
    public ShareGoodsRecordDTO addRecordGoodsStorageV2(Long uid, List<CommonGoods> listGoods, List<Long> listStorageID,
            boolean needDrawPicture) throws UserShareGoodsRecordException {
        if (uid == null || uid <= 0 || listGoods == null || listGoods.size() == 0) {
            throw new UserShareGoodsRecordException(1, "传递参数不正确");
        }
@@ -745,7 +745,6 @@
        // 分享链接
        String shareUrl = getShareUrlV2(record);
        // 分享二维码链接
        FileUploadResult uploadResult = drawingSharePicture(uid, id, shareUrl, listGoods);
        ShareGoodsRecordDTO recordDTO = new ShareGoodsRecordDTO();
        recordDTO.setUid(uid);
@@ -753,7 +752,10 @@
        recordDTO.setShareUrl(shareUrl);
        recordDTO.setListId(listStorageID);
        recordDTO.setListGoods(listGoods);
        if (needDrawPicture) {
            FileUploadResult uploadResult = drawingSharePicture(uid, id, shareUrl, listGoods);
        recordDTO.setSharePictureUrl(uploadResult.getUrl());
        }
        recordDTO.setSource(ShareSourceTypeEnum.storage);
        // 缓存分享商品信息
@@ -948,7 +950,6 @@
        return url;
    }
    
    /**
     * 分享链接
     * 
@@ -959,8 +960,8 @@
        Long uid = shareRecord.getUid();
        Long shareId = shareRecord.getId();
        String url = String.format("http://%s/share_mushGoods_1.6.0.html?uid=%s&shareId=%s",
                configService.getH5Host(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), shareId + "");
        String url = String.format("http://%s/share_mushGoods_1.6.0.html?uid=%s&shareId=%s", configService.getH5Host(),
                AESUtil.encrypt(uid + "", Constant.UIDAESKEY), shareId + "");
        String shortLink = HttpUtil.getShortLink(url);
        if (!StringUtil.isNullOrEmpty(shortLink)) {
@@ -972,9 +973,12 @@
    /**
     * 生成分享图
     * 
     * @param uid       用户id
     * @param shareId   分享记录id
     * @param source    来源
     * @param uid
     *            用户id
     * @param shareId
     *            分享记录id
     * @param source
     *            来源
     * @param listGoods
     * @return
     * @throws UserShareGoodsRecordException
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/CodePublishRecordServiceImpl.java
@@ -8,7 +8,9 @@
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.integral.CodePublishRecordMapper;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.integral.CodePublishRecord;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.util.StringUtil;
@@ -21,6 +23,9 @@
    
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserInfoService userInfoService;
    @Override
    public CodePublishRecord selectByPrimaryKey(Long id) {
@@ -40,11 +45,11 @@
        return codePublishRecordMapper.countValidRecord(uid, CodePublishRecord.VALIDTIME);
    }
    
    @Override
    public List<CodePublishRecord> listValid(long start, int count) {
        
        List<CodePublishRecord> listValid = codePublishRecordMapper.listValid(start, count, CodePublishRecord.VALIDTIME);
        List<CodePublishRecord> listValid = codePublishRecordMapper.listValid(start, count,
                CodePublishRecord.VALIDTIME);
        if (listValid == null || listValid.size() == 0) {
            return listValid;
        }
@@ -76,19 +81,29 @@
            }
            codePublishRecord.setNickName(nickName);
            
            UserInfo user = userInfoService.selectByPKey(codePublishRecord.getUid());
            long firstTeam = threeSaleSerivce.countFirstTeam(codePublishRecord.getUid(), 1);
            long secondTeam = threeSaleSerivce.countSecondTeam(codePublishRecord.getUid(), 1);
            codePublishRecord.setTeam(firstTeam + secondTeam);
            if (user != null && user.getType() == 1) {// 假用户
                long s = Integer
                        .parseInt((206 * (6365705L - codePublishRecord.getUid()) / (6365705L - 6315822L) + 82) + "");
                codePublishRecord.setTeam(s + codePublishRecord.getTeam());
            }
        }
        
        return listValid;
    }
    @Override
    public List<CodePublishRecord> listByMinTime(long start, int count, Date minTime) {
        return codePublishRecordMapper.listByMinTime(start, count, minTime);
    }
    @Override
    public long countValid() {
        return codePublishRecordMapper.countValid(CodePublishRecord.VALIDTIME);
    }
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserGoodsStorageService.java
@@ -105,11 +105,12 @@
     * 创建分享
     * @param uid
     * @param listStorageID
     * @param needDrawPicture是否需要绘图
     * @return
     * @throws UserGoodsStorageException
     * @throws UserShareGoodsRecordException
     */
    public JSONObject createShareV2(Long uid, List<Long> listStorageID)
    public JSONObject createShareV2(Long uid, List<Long> listStorageID,boolean needDrawPicture)
            throws UserGoodsStorageException, UserShareGoodsRecordException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java
@@ -182,13 +182,32 @@
     */
    public void saveUserInfo(String nickName, Long uid) throws UserInfoException;
    /**
     * 获取可提现用户列表
     *
     * @param page
     * @param count
     */
    public List<UserInfo> getAutoExtractUser(int page, int count, BigDecimal minSurplus, String beganDate,String endDate);
    public List<UserInfo> getAutoExtractUser(int page, int count, BigDecimal minSurplus, String beganDate,
            String endDate);
    /**
     * 根据类型获取
     *
     * @param type
     * @param page
     * @param count
     * @return
     */
    public List<UserInfo> listByType(int type, int page, int count);
    /**
     * 根据类型计数
     *
     * @param type
     * @return
     */
    public long countByType(int type);
    /**
     * 双12预售开启时,开启对休眠老用户的唤醒工作,在2019.1.1到2019.6.18期间产生过订单,并且2019.6.18号后未再活跃,并且账户余额大于1元,并且绑定了微信的用户有2468人
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserShareGoodsRecordService.java
@@ -146,6 +146,6 @@
    public List<UserShareGoodsGroup> listByRecordId(Long shareId);
    public ShareGoodsRecordDTO addRecordGoodsStorageV2(Long uid, List<CommonGoods> listCommonGoods,
            List<Long> listStorageID) throws UserShareGoodsRecordException;
            List<Long> listStorageID,boolean needDrawPicture) throws UserShareGoodsRecordException;
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/integral/CodePublishRecordService.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.inter.user.integral;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.integral.CodePublishRecord;
@@ -8,24 +9,32 @@
    /**
     * 查询近3天发布记录
     *
     * @return
     */
    public List<CodePublishRecord> listValid(long start, int count);
    
    /**
     * 根据最小时间查询
     *
     * @param start
     * @param count
     * @param minTime
     * @return
     */
    public List<CodePublishRecord> listByMinTime(long start, int count, Date minTime);
    
    public long countValid();
    public CodePublishRecord selectByPrimaryKey(Long id);
    /**
     * 发布
     *
     * @param uid
     * @return
     */
    public void publishInviteCode(Long uid);
    public long countValidRecord(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/util/factory/CommonGoodsFactory.java
@@ -81,6 +81,8 @@
            } else {
                cg.setCouponAmount(new BigDecimal(0));
            }
            cg.setCouponLeftCount(1);
            cg.setCouponTotalCount(1);
        }
        
        JDCommissionInfo commissionInfo = goods.getCommissionInfo();
fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java
@@ -114,7 +114,7 @@
     * 
     * @return
     */
    public static String convertLink(String materialId, String couponUrl, String positionId, String ext1) {
    public static String convertLink1(String materialId, String couponUrl, String positionId, String ext1) {
        JSONObject json = new JSONObject();
        json.put("materialId", materialId);
        json.put("siteId", APP_ID);
@@ -142,23 +142,37 @@
        return resultJson.optJSONObject("data").optString("clickURL");
    }
    /**
     * 转链接-短连接
     *
     * @param materialId
     * @param couponUrl
     * @param positionId
     * @param ext1
     * @return
     */
    public static String convertShortLink(String materialId, String couponUrl, String positionId, String ext1) {
        String url = convertLink(materialId, couponUrl, positionId, ext1);
        // 暂时注释
        // if (!StringUtil.isNullOrEmpty(url)) {
        // url = HttpUtil.getShortLink(url);
        // }
        return url;
    public static String convertLinkWithSubUnionId(String materialId, String couponUrl, String positionId,
            String subUnionId) {
        JSONObject json = new JSONObject();
        json.put("materialId", materialId);
        json.put("siteId", APP_ID);
        json.put("positionId", positionId);
        if (!StringUtil.isNullOrEmpty(couponUrl))
            json.put("couponUrl", couponUrl);
        if (!StringUtil.isNullOrEmpty(subUnionId))
            json.put("subUnionId", subUnionId);
        //1:长链, 2 :短链 ,3: 长链+短链
        json.put("chainType", 3);
        JSONObject root = new JSONObject();
        root.put("promotionCodeReq", json);
        String result = baseRequest2("jd.union.open.promotion.bysubunionid.get", null, root);
        JSONObject resultJson = JSONObject.fromObject(result);
        result = resultJson.optJSONObject("jd_union_open_promotion_bysubunionid_get_response").optString("result");
        System.out.println(result);
        if (result == null) {
            return null;
    }
        resultJson = JSONObject.fromObject(result);
        return resultJson.optJSONObject("data").optString("shortURL");
    }
    public static JDGoods queryGoodsDetail(Long skuId) {
        List<Long> skuIdList = new ArrayList<>();
@@ -420,7 +434,9 @@
//                if (couponInfoList.size() > 0) {
//                    // 设置券信息为最接近的一个
//                    for (int i = couponInfoList.size() - 1; i >= 0; i--) {
//                        if (couponInfoList.get(i).getQuota().compareTo(goods.getPrice()) <= 0) {
                // if
                // (couponInfoList.get(i).getQuota().compareTo(goods.getPrice())
                // <= 0) {
//                            goods.setCouponInfo(couponInfoList.get(i));
//                            break;
//                        }
@@ -679,4 +695,14 @@
        return null;
    }
    public static void test() {
        JSONObject json = new JSONObject();
        json.put("materialId", "https://item.jd.com/32376790478.html");
        json.put("ext1", "437032");
        JSONObject root = new JSONObject();
        root.put("promotionCodeReq", json);
        String result = baseRequest2("jd.union.open.promotion.bysubunionid.get", null, root);
        System.out.println(result);
    }
}
fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java
@@ -124,6 +124,17 @@
        return new PDDGoodsResult(totalCount, goodsList);
    }
    public static List<PDDGoodsDetail> listGoodsDetail(List<Long> goodsIds) {
        PDDSearchFilter filter = new PDDSearchFilter();
        Long[] ids = new Long[goodsIds.size()];
        goodsIds.toArray(ids);
        filter.setGoodsIdList(ids);
        PDDGoodsResult result = searchGoods(filter);
        if (result != null)
            return result.getGoodsList();
        return null;
    }
    /**
     * 运营频道商品查询API
     * 
@@ -435,7 +446,6 @@
        return null;
    }
    /**
     * 获取商品详情
     * 
@@ -464,7 +474,8 @@
            int totalCount = root.optInt("total");
            
            JSONArray array = root.optJSONArray("mall_search_info_vo_list");
            Type type = new TypeToken<List<PDDShopDetail>>() {}.getType();
            Type type = new TypeToken<List<PDDShopDetail>>() {
            }.getType();
            List<PDDShopDetail> listShop = new Gson().fromJson(array.toString(), type);
            return new PDDShopResult(totalCount, listShop);
        }
fanli/src/main/java/com/yeshi/fanli/vo/goods/ShareInfoVO.java
@@ -76,6 +76,17 @@
    @Expose
    private String wxErCode;// 微信二维码内容
    @Expose
    private GoodsDetailVO goodsInfo;
    public GoodsDetailVO getGoodsInfo() {
        return goodsInfo;
    }
    public void setGoodsInfo(GoodsDetailVO goodsInfo) {
        this.goodsInfo = goodsInfo;
    }
    public List<String> getCommentTexts() {
        return commentTexts;
fanli/src/main/resource/env-dev/mongo.properties
@@ -1,13 +1,13 @@
mongo.dbname=flq
mongo.port=27017
mongo.port=27016
#开发环境
mongo.host=192.168.1.253
mongo.username=admin
mongo.password=123456
#mongo.host=192.168.1.253
#mongo.username=admin
#mongo.password=123456
#mongo.host=193.112.35.168
#mongo.username=yeshi
#mongo.password=Yeshi2016@
mongo.host=193.112.35.168
mongo.username=yeshi
mongo.password=Yeshi2016@
mongo.connectionsPerHost=8
mongo.threadsAllowedToBlockForConnectionMultiplier=4
fanli/src/main/resource/env-dev/redis.properties
@@ -1,4 +1,4 @@
redis.addr=193.112.34.40
redis.addr=192.168.1.253
redis.port=6379
redis.auth=123456
redis.max_total=1024
fanli/src/main/resource/env-dev/rocketmq.properties
@@ -2,6 +2,6 @@
rocketmq.SecretKey=ixWg90QbYFKP6ae5xpAo2P1qwIyll5
#测试  http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80
#正式 http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80
rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
fanli/src/main/resource/env-dev/rocketmq.xml
@@ -2,8 +2,10 @@
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <!--
    <import resource="classpath:/rocket/consumer.xml" />
    <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
     -->
    <import resource="classpath:/rocket/producer.xml" />
    <import resource="classpath:/rocket/transactionProducer.xml" />
</beans>
fanli/src/test/java/org/fanli/TaoKeTest.java
@@ -49,11 +49,20 @@
    @Test
    public void test1() {
//        List<TaoBaoGoodsBrief> list=    TaoKeApiUtil.guessLikeByAuctionId(550439753563L,6);
        // List<TaoBaoGoodsBrief> list=
        // TaoKeApiUtil.guessLikeByAuctionId(550439753563L,6);
//        System.out.println(list);
     TaoBaoUtil.getTBDetailImageWithSize(597016140493L);
        // TaoBaoUtil.getTBDetailImageWithSize(597016140493L);
//        System.out.println(goods);
//        DaTaoKeApiUtil.getGoodsDetailByGoodsId(558195316187L);
        try {
            TaoKeApiUtil.specialConvertCoupon(608512721647L, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                    TaoBaoConstant.TAOBAO_AUTH_APPSECRET, TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    @Test