admin
2019-08-29 c3b33f84b6ce927b4be681a4f1e4080706d390a9
维权订单修改
10个文件已修改
179 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/HongBaoOrderMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/money/UserMoneyDetail.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/HongBaoV2Service.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java
@@ -206,5 +206,14 @@
     */
    long countByParentUidAndTypeAndState(@Param("uid") Long uid, @Param("typeList") List<Integer> typeList,
            @Param("stateList") List<Integer> stateList);
    /**
     * 根据订单来源类型与交易ID列表查询订单信息
     * @param sourceType
     * @param tradeId
     * @return
     */
    List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(@Param("sourceType") int sourceType, @Param("uid")long uid, @Param("tradeIdList") List<String> tradeIdList);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java
@@ -256,6 +256,17 @@
     * @return
     */
    List<CommonOrder> listBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId);
    /**
     * 根据来源和交易ID获取订单列表
     * @param sourceType
     * @param tradeIdList
     * @return
     */
    List<CommonOrder> listBySourceTypeAndTradeIdList(@Param("sourceType") int sourceType, @Param("tradeIdList") List<String> tradeIdList);
    /**
     * 
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/HongBaoOrderMapper.java
@@ -7,6 +7,8 @@
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.order.HongBaoOrder;
public interface HongBaoOrderMapper extends BaseMapper<HongBaoOrder> {
fanli/src/main/java/com/yeshi/fanli/entity/money/UserMoneyDetail.java
@@ -31,7 +31,7 @@
                        "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), weiQuan("售后订单扣款", "http://img.flqapp.com/resource/money_detail/icon_fanli.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), systemEqualize("系统补齐", "http://img.flqapp.com/resource/money_detail/icon_system.png", ""), scoreConvert("金币兑换", "http://img.flqapp.com/resource/money_detail/icon_score.png",
                                ""), hongbao("官方红包", "http://img.flqapp.com/resource/money_detail/icon_hongbao.png", ""), hongbaoDeduct("红包退款", "http://img.flqapp.com/resource/money_detail/icon_hongbao.png",
                                        ""), buyScore("购买积分", "http://img.flqapp.com/resource/money_detail/icon_score.png", ""), extract("提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png",
                                                ""), extractVerify("提现验证", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),orderReward("返利奖励","http://img.flqapp.com/resource/money_detail/icon_order_reward.png",""),repeatStatistic("重复统计返利/奖金扣除","http://img.flqapp.com/resource/money_detail/icon_fanli.png","");
                                                ""), extractVerify("提现验证", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),orderReward("返利奖励金","http://img.flqapp.com/resource/money_detail/icon_order_reward.png",""),repeatStatistic("重复统计返利/奖金扣除","http://img.flqapp.com/resource/money_detail/icon_fanli.png","");
        private final String desc;
        private final String picture;
        private final String helpUrl;
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml
@@ -223,11 +223,12 @@
        NOW()>=hb_pre_get_time limit
        #{start},#{count}
    </select>
    <select id="countCanBalanceHongBaoByTypeAndUid" resultType="java.lang.Long">
        select
        count(hb_id)
        from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and `hb_version`=2
        from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and
        `hb_version`=2
        <foreach collection="types" item="type" open=" and ("
            separator=" or " close=")">
@@ -241,7 +242,7 @@
        hb_pre_get_time>0 AND
        NOW()>=hb_pre_get_time
    </select>
    <select id="countInviteOrderCountByUidAndSettleTime" resultType="java.lang.Long">
        SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN
@@ -359,6 +360,26 @@
        </if>
    </select>
    <select id="listBySourceTypeAndTradeIdListAndUid" resultMap="BaseResultMap">
        SELECT a.* FROM
        (
            SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`=#{uid}
        ) a
        LEFT JOIN
        (
        SELECT ho.`ho_hongbao_id` AS hbId FROM yeshi_ec_hongbao_order ho LEFT JOIN
        yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE
        co.`co_source_type`=#{sourceType}
        <if test="tradeIdList!=null">
            <foreach collection="tradeIdList" open=" and (" close=")"
                separator=" or " item="tradeId">
                co.co_trade_id=#{tradeId}
            </foreach>
        </if>
        )
        b
        ON a.hb_id=b.hbId OR a.hb_pid=b.hbId WHERE b.hbId >0
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -193,6 +193,16 @@
    </select>
    
    
    <select id="listBySourceTypeAndTradeIdList" resultMap="BaseResultMap">SELECT *
        FROM
        yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType}
        <if test="tradeIdList!=null">
            <foreach collection="tradeIdList" item="tradeId" open=" and (" close=")" separator=" or ">
                co.co_trade_id=#{tradeId}
            </foreach>
        </if>
    </select>
    
    <select id="listBySourceTypeAndStateAndThirdCrateTime" resultMap="BaseResultMap">SELECT *
        FROM
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java
@@ -1092,4 +1092,11 @@
                }
        }
    }
    @Override
    public List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(int sourceType, long uid, List<String> tradeIdList) {
        if (tradeIdList == null || tradeIdList.size() == 0)
            return null;
        return hongBaoV2Mapper.listBySourceTypeAndTradeIdListAndUid(sourceType, uid, tradeIdList);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -221,6 +221,30 @@
        return commonOrderMapper.countByUidAndOrderState(uid, type, startTime, endTime, day, source);
    }
    private BigDecimal getWeiQuanMoney(List<TaoBaoWeiQuanOrder> listWQ, int sourceType, Long uid) {
        BigDecimal weiQuanMoney = new BigDecimal(0);
        if (listWQ != null && listWQ.size() > 0) {
            for (TaoBaoWeiQuanOrder weiQuanOrder : listWQ) {
                String tradeId = weiQuanOrder.getOrderItemId();
                // 查询红包
                List<String> tradeList = new ArrayList<>();
                tradeList.add(tradeId);
                List<HongBaoV2> hongBaoList = hongBaoV2Service.listBySourceTypeAndTradeIdListAndUid(sourceType, uid,
                        tradeList);
                if (hongBaoList != null && hongBaoList.size() > 0) {
                    CommonOrder commonOrder = commonOrderMapper.selectBySourceTypeAndTradeId(sourceType, tradeId);
                    if (commonOrder != null && commonOrder.getSettlement().compareTo(new BigDecimal(0)) > 0) {
                        BigDecimal wqMoney =
                                MoneyBigDecimalUtil.mul(hongBaoList.get(0).getMoney(), weiQuanOrder.getMoney())
                                        .divide(commonOrder.getSettlement(), 2, BigDecimal.ROUND_UP);
                        weiQuanMoney = weiQuanMoney.add(wqMoney);
                    }
                }
            }
        }
        return weiQuanMoney;
    }
    public void listDataFactory(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods,
            Long uid) {
@@ -329,7 +353,8 @@
        SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
        // 是否存在奖励券
        //boolean hasRewardCoupon = userSystemCouponService.hasRewardCoupon(uid);
        // boolean hasRewardCoupon =
        // userSystemCouponService.hasRewardCoupon(uid);
        boolean hasRewardCoupon = userSystemCouponService.getIncludeNotExchange(uid);
        boolean exchangeCoupon = userSystemCouponService.getIncludeExchange(uid);
@@ -409,21 +434,7 @@
                            .selectListByOrderIdAndState(order.getOrderNo(), "维权成功");
                    boolean isPart = false;// 默认失效
                    BigDecimal weiQuanMoney = new BigDecimal(0);
                    if (listWQ != null && listWQ.size() > 0) {
                        BigDecimal fanTotalMoney = new BigDecimal(0);
                        for (TaoBaoWeiQuanOrder weiQuanOrder : listWQ) {
                            BigDecimal fanMoney = weiQuanOrder.getFanMoney();
                            if (fanMoney != null) {
                                fanTotalMoney = MoneyBigDecimalUtil.add(fanTotalMoney, fanMoney);
                            }
                            weiQuanMoney = MoneyBigDecimalUtil.add(weiQuanOrder.getMoney(), weiQuanMoney);
                        }
                        if (fanTotalMoney.compareTo(hongBao) < 0) {
                            isPart = true;
                        }
                    }
                    BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid);
                    if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
                        if (isPart) {
@@ -437,19 +448,15 @@
                            orderStateContent = "维权成功";
                            WeiQuanInfo weiQuanInfo = new WeiQuanInfo();
                            weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
                            if (isPart) {
                                // 维权失效金额=维权的金额*获得的红包/结算金额
                                BigDecimal settlement = order.getSettlement();
                                BigDecimal wqHongbao = MoneyBigDecimalUtil
                                        .div(MoneyBigDecimalUtil.mul(hongBao, settlement), settlement);
//                            if (isPart) {
                                weiQuanInfo.setWqHongBao(
                                        "维权:-¥" + wqHongbao.setScale(2, BigDecimal.ROUND_DOWN).toString());
                                hongBao = MoneyBigDecimalUtil.sub(hongBao, wqHongbao);
                            } else {
                                weiQuanInfo
                                        .setWqHongBao("维权:-¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
                                hongBao = new BigDecimal(0);
                            }
                                        "维权:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
                                hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
//                            } else {
//                                weiQuanInfo
//                                        .setWqHongBao("维权:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
//                                hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
//                            }
                            order.setWeiQuanInfo(weiQuanInfo);
                        }
                    }
@@ -550,13 +557,17 @@
            } else {
                // 奖励订单、免单 使用记录
                if (sourceType == null) {
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null, signList, acceptData);
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null,
                            signList, acceptData);
                } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordTB, signList, acceptData);
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                            listRecordTB, signList, acceptData);
                } else if (sourceType == Constant.SOURCE_TYPE_JD) {
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordJD, signList, acceptData);
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                            listRecordJD, signList, acceptData);
                } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordPDD, signList, acceptData);
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                            listRecordPDD, signList, acceptData);
                }
            }
@@ -578,8 +589,9 @@
     * @param list
     * @param signList
     */
    public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, boolean exchangeCoupon, Integer hongBaoState,
            Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList, AcceptData acceptData) {
    public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, boolean exchangeCoupon,
            Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList,
            AcceptData acceptData) {
        // 是否免单商品
        boolean freeOrder = false;
@@ -632,15 +644,15 @@
                String downTime = order.getDownTime();
                if (!StringUtil.isNullOrEmpty(downTime)) {
                    long downOrderTime = TimeUtil.convertDateToTemp2(downTime);
                    long limitDate = TimeUtil.convertDateToTemp("2019-09-01");
                    if (downOrderTime > limitDate )
                    long limitDate = TimeUtil.convertDateToTemp("2019-09-05");
                    if (downOrderTime > limitDate)
                        hasRewardCoupon = true;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        boolean rewardOrder = false;
        int type = 1; // 1 常规跳转页面 2弹出选项(奖励券)
@@ -652,7 +664,7 @@
            // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单
            type = 2;
            rewardOrder = true;
        }
        }
        if (rewardOrder) {
            ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
@@ -1429,7 +1441,7 @@
        return commonOrderMapper.listBySourceTypeAndStateAndThirdCrateTime(sourceType, state, minTime, maxTime,
                (page - 1) * pageSize, pageSize);
    }
    @Override
    public List<CommonOrder> getByOrderNo(Long uid, String orderNO) {
        return commonOrderMapper.getByOrderNo(uid, orderNO);
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/HongBaoV2Service.java
@@ -4,6 +4,8 @@
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dto.HongBaoDTO;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.order.CommonOrder;
@@ -139,9 +141,20 @@
    /**
     * 让邀请赚失效(根据下级用户ID)
     *
     * @param parentUid
     * @param beiZhu
     */
    public void invalidInviteHongBaoByParentUid(Long parentUid, String beiZhu);
    /**
     * 根据用户ID,交易ID查询红包信息
     *
     * @param sourceType
     * @param uid
     * @param tradeIdList
     * @return
     */
    public List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(int sourceType, long uid, List<String> tradeIdList);
}
fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java
@@ -63,7 +63,8 @@
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createShare(Long uid, int orderType, int validCount, int weiQuanCount, BigDecimal money, Date time) throws UserMoneyDetailException {
    public static UserMoneyDetail createShare(Long uid, int orderType, int validCount, int weiQuanCount,
            BigDecimal money, Date time) throws UserMoneyDetailException {
        if (money == null)
            throw new UserMoneyDetailException(1, "返利金额为空");
@@ -104,7 +105,8 @@
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createInvite(Long uid, int orderType, int validCount, int weiQuanCount, BigDecimal money, Date time) throws UserMoneyDetailException {
    public static UserMoneyDetail createInvite(Long uid, int orderType, int validCount, int weiQuanCount,
            BigDecimal money, Date time) throws UserMoneyDetailException {
        if (money == null)
            throw new UserMoneyDetailException(1, "返利金额为空");
@@ -439,7 +441,7 @@
        detail.setUpdateTime(new Date());
        detail.setUserInfo(user);
        detail.setOrderType(orderType);
        // detail.setDescInfo("订单号:" + orderId);
        detail.setDescInfo("订单号:" + orderId);
        return detail;
    }