| | |
| | | */ |
| | | 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); |
| | | |
| | | } |
| | |
| | | * @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);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | *
|
| | |
| | | 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> { |
| | |
| | | "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;
|
| | |
| | | <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=")"> |
| | |
| | | </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 |
| | |
| | | </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
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @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);
|
| | | }
|
| | | }
|
| | |
| | | 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) {
|
| | |
|
| | |
| | | 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);
|
| | |
|
| | |
| | | .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) {
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | |
| | | } 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);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @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;
|
| | |
| | | String downTime = order.getDownTime();
|
| | | if (!StringUtil.isNullOrEmpty(downTime)) {
|
| | | long downOrderTime = TimeUtil.convertDateToTemp2(downTime);
|
| | | long limitDate = TimeUtil.convertDateToTemp("2019-09-01");
|
| | | long limitDate = TimeUtil.convertDateToTemp("2019-09-05");
|
| | | if (downOrderTime > limitDate )
|
| | | hasRewardCoupon = true;
|
| | | }
|
| | |
| | | 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;
|
| | |
| | |
|
| | | /**
|
| | | * 让邀请赚失效(根据下级用户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);
|
| | |
|
| | | }
|
| | |
| | | * @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, "返利金额为空");
|
| | |
|
| | |
| | | * @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, "返利金额为空");
|
| | |
|
| | |
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(user);
|
| | | detail.setOrderType(orderType);
|
| | | // detail.setDescInfo("订单号:" + orderId);
|
| | | detail.setDescInfo("订单号:" + orderId);
|
| | | return detail;
|
| | | }
|
| | |
|