yj
2020-03-13 9a38f81e7e7c817aa539416a41d33856209c7fe1
有效粉丝统计bug
13个文件已修改
208 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/UserAccountController.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/dynamic/CommentInfo.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -25,6 +25,7 @@
import com.google.gson.JsonSerializer;
import com.yeshi.fanli.entity.accept.AcceptData;
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.vip.UserVIPInfo;
@@ -447,8 +448,27 @@
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        vo.setFinishGoldCoin(Long.parseLong(integralDetailService.getCumulativeMoney(uid).setScale(0).toString()));
        vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney));
//        vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
//                , payMoney));
        int finishTeam = 0;
        long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
        List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
        if (listThreeSale != null && listThreeSale.size() > 0) {
            for (ThreeSale three: listThreeSale) {
                UserInfo worker = three.getWorker();
                if (worker == null || worker.getId() == null) {
                    continue;
                }
                // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
                long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
                if (countValid > 0) {
                    finishTeam ++;
                }
            }
        }
        vo.setFinishTeam(finishTeam);
        vo.setFinishHongBao(banLiShopOrderService.countByUidAndState(uid, list));
        // 区分老用户和新用户
@@ -521,8 +541,27 @@
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        BigDecimal finishGoldCoin = integralDetailService.getCumulativeMoney(uid);
        long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
//        long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
//                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
//
        long finishTeam = 0L;
        long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
        List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
        if (listThreeSale != null && listThreeSale.size() > 0) {
            for (ThreeSale three: listThreeSale) {
                UserInfo worker = three.getWorker();
                if (worker == null || worker.getId() == null) {
                    continue;
                }
                // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
                long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
                if (countValid > 0) {
                    finishTeam ++;
                }
            }
        }
        long finishHongBao = banLiShopOrderService.countByUidAndState(uid, list);
        BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/UserAccountController.java
@@ -33,6 +33,7 @@
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
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.WeiXinUser;
@@ -52,6 +53,7 @@
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
import com.yeshi.fanli.service.inter.user.wx.WXMPUserLoginService;
@@ -107,6 +109,11 @@
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    /**
     * 通过邀请码获取用户信息
@@ -545,8 +552,27 @@
        list.add(BanLiShopOrder.STATE_SUCCESS);
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney));
//        vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
//                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney));
        int finishTeam = 0;
        long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
        List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
        if (listThreeSale != null && listThreeSale.size() > 0) {
            for (ThreeSale three: listThreeSale) {
                UserInfo worker = three.getWorker();
                if (worker == null || worker.getId() == null) {
                    continue;
                }
                // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
                long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
                if (countValid > 0) {
                    finishTeam ++;
                }
            }
        }
        vo.setFinishTeam(finishTeam);
        vo.setFinishHongBao(banLiShopOrderService.countByUidAndState(uid, list));
        // 区分老用户和新用户
@@ -621,8 +647,28 @@
        list.add(BanLiShopOrder.STATE_SUCCESS);
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
//        long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
//                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
        long finishTeam = 0L;
        long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
        List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
        if (listThreeSale != null && listThreeSale.size() > 0) {
            for (ThreeSale three: listThreeSale) {
                UserInfo worker = three.getWorker();
                if (worker == null || worker.getId() == null) {
                    continue;
                }
                // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
                long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
                if (countValid > 0) {
                    finishTeam ++;
                }
            }
        }
        long finishHongBao = banLiShopOrderService.countByUidAndState(uid, list);
        BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java
@@ -207,7 +207,7 @@
     * @param list 类型
     * @return
     */
    long countValidOrderTeamUserByUid(@Param("uid") Long uid, @Param("time") Long time,
    Long countValidOrderByUidAndTime(@Param("uid") Long uid, @Param("limitTime") long limitTime,
            @Param("payment") BigDecimal payment);
    
    
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java
@@ -289,4 +289,14 @@
     * @return
     */
    long getTeamOrderNumByWorkerId(@Param("workerId") Long workerId);
    /**
     * 有效粉丝uid
     * @param bossId
     * @param limitTime
     * @return
     */
    List<ThreeSale> getValidWorkerIdsByTime(@Param("uid") Long uid,@Param("limitTime") long limitTime);
}
fanli/src/main/java/com/yeshi/fanli/entity/dynamic/CommentInfo.java
@@ -2,10 +2,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
@@ -521,4 +521,10 @@
        WHERE d.`id` <![CDATA[<=]]>t.id AND d.`state` = 1 
    </select>
    
    <select id="getValidWorkerIdsByTime" resultMap="BaseResultMap">
        SELECT * FROM `yeshi_ec_threesale` tr
        WHERE tr.`state` = 1 AND tr.`boss_id` = #{uid} AND tr.`succeedTime` <![CDATA[>=]]> #{limitTime}
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -402,18 +402,12 @@
        </if>
    </select>
        
    <select id="countValidOrderTeamUserByUid" resultType="Long">
    SELECT IFNULL(COUNT(*),0) FROM
    (
        SELECT DISTINCT co.`co_uid` FROM `yeshi_ec_common_order` co
        LEFT JOIN `yeshi_ec_hongbao_order` ho  ON co.`co_id` = ho.`ho_order_id`
        LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.`hb_pid` = ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_hongbao_v2 t2 ON t2.`hb_id` = v2.`hb_pid`
        WHERE v2.`hb_uid` = ${uid} AND co.`co_payment`<![CDATA[>=]]> #{payment} AND t2.`hb_state` = 3
        AND (t2.`hb_type` = 1 OR t2.`hb_type` = 20)
        AND t2.`hb_uid` IN (SELECT tr.`worker_id` FROM `yeshi_ec_threesale` tr
                            WHERE tr.`state` = 1 AND tr.`boss_id` = ${uid} AND tr.`succeedTime` <![CDATA[>=]]> #{time})
     )A
    <select id="countValidOrderByUidAndTime" resultType="Long">
    SELECT COUNT(co.`co_id`) FROM yeshi_ec_hongbao_v2 v2
    LEFT JOIN yeshi_ec_hongbao_order h ON v2.`hb_id` = h.`ho_hongbao_id`
    LEFT JOIN yeshi_ec_common_order co ON h.`ho_order_id` = co.`co_id`
    WHERE v2.`hb_uid` = #{uid} AND (v2.`hb_type` = 1 OR v2.`hb_type` = 20)  AND v2.`hb_state` = 3
            AND co.`co_payment` >= #{payment} AND co.`co_third_create_time` >= #{limitTime}
    </select>
    
    
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -349,8 +349,12 @@
    }
    
    @Override
    public long countValidOrderTeamUserByUid(Long uid, Long time, BigDecimal payment) {
        return hongBaoV2CountMapper.countValidOrderTeamUserByUid(uid, time, payment);
    public long countValidOrderByUidAndTime(Long uid, Long time, BigDecimal payment) {
        Long count = hongBaoV2CountMapper.countValidOrderByUidAndTime(uid, time, payment);
        if (count == null) {
            count = 0L;
        }
        return count;
    }
    
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -166,6 +166,7 @@
            record.setId(id);
            record.setShareNumReal(0);
            record.setCreateTime(new Date());
            record.setUpdateTime(new Date());
            goodsEvaluateDao.save(record);
        } else {
            GoodsEvaluate resultObj = goodsEvaluateDao.getById(id);
@@ -179,6 +180,7 @@
            resultObj.setStartTime(record.getStartTime());
            resultObj.setEndTime(record.getEndTime());
            resultObj.setTitle(tilte);
            resultObj.setUpdateTime(new Date());
            goodsEvaluateDao.save(resultObj);
        }
        return id;
@@ -513,6 +515,7 @@
            commentsNew.add(commentInfo);
            resultObj.setComments(commentsNew);
        }
        resultObj.setUpdateTime(new Date());
        goodsEvaluateDao.save(resultObj);
        // 删除图片
@@ -845,6 +848,7 @@
        }
        resultObj.setComments(comments);
        resultObj.setUpdateTime(new Date());
        goodsEvaluateDao.save(resultObj);
    }
@@ -1552,6 +1556,8 @@
                EvaluateEnum typeEnum = evaluateNew.getType();
                List<CommentInfo> commentNew = new ArrayList<>();
                boolean singleCoupn = true;
                boolean currencyCoupon = true;
                for (CommentInfo commentInfo : comments) {
                    if (StringUtil.isNullOrEmpty(commentInfo.getContent())
                            && StringUtil.isNullOrEmpty(commentInfo.getCoupon())) {
@@ -1575,6 +1581,7 @@
                                if (goods.isHasCoupon()) {
                                    content = content.replace("[券后价]",MoneyBigDecimalUtil.getWithNoZera(goods.getCouponPrice())+"");
                                } else {
                                    singleCoupn = false;
                                    content = content.replace("领券抢购", "抢购");
                                    content = content.replace("【券后价】[券后价]元", "");
                                }
@@ -1584,8 +1591,6 @@
                        }
                    }
                    
                    comment++;
                    CommentInfoEnum typeComment = commentInfoNew.getTypeEnum();
                    if (typeComment != null && typeComment == CommentInfoEnum.goodsCoupon) {
                        GoodsDetailVO goods = evaluateNew.getGoods();
@@ -1616,9 +1621,11 @@
                                commentNew.add(commentInfoNew);
                                continue;
                            } else {
                                currencyCoupon = false;
                                continue;
                            }
                        } else {
                            currencyCoupon = false;
                            continue;
                        }
                    }
@@ -1628,11 +1635,11 @@
                evaluateNew.setComments(commentNew);
                if (typeEnum != null && typeEnum == EvaluateEnum.single) {
                    if (comment > 0 && commentNew.size() == 0) { // 所有券评论下架
                    if (!currencyCoupon && !singleCoupn) { // 所有券评论下架
                        GoodsDetailVO goods = evaluateNew.getGoods();
                        if (goods != null) {
                            goods.setState(1); // 评论不存在 下架
                            LogHelper.test("获取列表商品下架1");
                            evaluateNew.setRemarks("评论验证下架");
                        }
                        List<ImgInfo> imgList = evaluateNew.getImgList();
@@ -1641,7 +1648,7 @@
                                SimpleGoods simpleGoods = imgInfo.getGoods();
                                if (simpleGoods != null) {
                                    simpleGoods.setState(1);
                                    LogHelper.test("获取列表商品下架2");
                                    simpleGoods.setRemarks("评论验证下架");
                                }
                            }
@@ -1727,6 +1734,7 @@
                    if (goodsNew != null) {
                        goodsEvaluate.setGoods(goodsNew);
                    } else {
                        goodsEvaluate.setRemarks("更新-位置找到商品信息");
                        goodsEvaluate.setState(0); // 已商品下架
                        goods.setState(1);
                        goodsEvaluate.setGoods(goods);
@@ -1759,6 +1767,7 @@
                        imgInfo.setGoods(simpleGoods);
                        imgInfo.setGoodsVO(goodsDetailVO);
                    } else {
                        simpleGoods.setRemarks("更新-位置找到商品信息");
                        simpleGoods.setState(1);
                        imgInfo.setGoods(simpleGoods);
                        GoodsDetailVO goodsVO = imgInfo.getGoodsVO();
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -631,4 +631,10 @@
        return threeSaleMapper.getTeamOrderNumByWorkerId(workerId);
    }
    @Override
    public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime) {
        return threeSaleMapper.getValidWorkerIdsByTime(bossId, limitTime);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
@@ -299,8 +299,29 @@
        // 1、直接粉丝(从 2020 年 1 月 1 日起直接粉丝产生有效订单)
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
//        long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
//                TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
        long teamNum = 0L;
        long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
        List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
        if (listThreeSale != null && listThreeSale.size() > 0) {
            for (ThreeSale three: listThreeSale) {
                UserInfo worker = three.getWorker();
                if (worker == null || worker.getId() == null) {
                    continue;
                }
                // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
                long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
                if (countValid > 0) {
                    teamNum ++;
                }
            }
        }
        // 区分老用户和新用户
        String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
@@ -229,7 +229,7 @@
     * @param payment
     * @return
     */
    public long countValidOrderTeamUserByUid(Long uid, Long time, BigDecimal payment);
    public long countValidOrderByUidAndTime(Long uid, Long time, BigDecimal payment);
    /**
     * 统计不同时间:奖励
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java
@@ -320,4 +320,12 @@
     */
    public ThreeSale getNearRelationByBossIdAndWorkerId(Long bossId, Long workerId);
    /**
     * 根据时间筛选出有效粉丝
     * @param bossId
     * @param limitTime
     * @return
     */
    public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime);
}