| | |
| | | * @return
|
| | | */
|
| | | List<InviteOrderSubsidy> listByOrderNoAndType(@Param("orderNo") String orderNo, @Param("type") Integer type);
|
| | | |
| | |
|
| | | List<InviteOrderSubsidy> listByOrderNoAndTypeAndUid(@Param("orderNo") String orderNo, @Param("type") Integer type,
|
| | | Long uid);
|
| | |
|
| | | InviteOrderSubsidy selectByPrimaryKeyForUpdate(Long id);
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计用户已到账金额
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | BigDecimal sumRecievedMoneyByUid(@Param("uid") long uid, @Param("level") Integer level);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计用户有效金额
|
| | | * @param uid
|
| | | * @param day 1今日 2昨日 3本月 4上月
|
| | | * @return
|
| | | */
|
| | | BigDecimal sumValidMoneyByUidAndDate(@Param("uid") long uid, @Param("day") Integer day, @Param("level") Integer level);
|
| | | |
| | | |
| | | |
| | | BigDecimal sumValidMoneyByUidAndDate(@Param("uid") long uid, @Param("day") Integer day,
|
| | | @Param("level") Integer level);
|
| | |
|
| | | /**
|
| | | * 统计用户有效金额
|
| | | * @param uid
|
| | | * @param day 1今日 2昨日 3本月 4上月
|
| | | * @return
|
| | | */
|
| | | BigDecimal sumMoneyByUidAndDateAndState(@Param("uid") long uid, @Param("day") Integer day, |
| | | BigDecimal sumMoneyByUidAndDateAndState(@Param("uid") long uid, @Param("day") Integer day,
|
| | | @Param("level") Integer level, @Param("state") Integer state);
|
| | | |
| | |
|
| | | } |
| | |
| | | from yeshi_ec_invite_order_subsidy where os_order_no = #{orderNo} AND |
| | | os_source_type = #{type} |
| | | </select> |
| | | |
| | | <select id="listByOrderNoAndTypeAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_invite_order_subsidy where os_order_no = #{orderNo} AND |
| | | os_source_type = #{type} and os_uid=#{uid} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_invite_order_subsidy where os_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | |
| | | </update> |
| | | <select id="getByOrderNoAndType" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_invite_order_subsidy WHERE os_uid = #{uid} AND os_order_no = |
| | | #{orderNo} AND os_source_type = #{type} LIMIT 1</select> |
| | | #{orderNo} AND os_source_type = #{type} LIMIT 1 |
| | | </select> |
| | | <select id="getByOrderNoAndTypeForUpdate" resultMap="BaseResultMap">SELECT * |
| | | FROM yeshi_ec_invite_order_subsidy WHERE os_uid = #{uid} AND |
| | | os_order_no = #{orderNo} AND os_source_type = #{type} for update |
| | | </select> |
| | | <select id="countByOrderNoAndType" resultType="java.lang.Long">SELECT count(*) |
| | | FROM yeshi_ec_invite_order_subsidy WHERE os_order_no = #{orderNo} AND |
| | | os_source_type = #{type}</select> |
| | | |
| | | |
| | | os_source_type = #{type} |
| | | </select> |
| | | |
| | | |
| | | <select id="sumValidMoneyByUidAndDate" resultType="BigDecimal"> |
| | | SELECT SUM(d.`os_money`) FROM yeshi_ec_invite_order_subsidy d |
| | | WHERE d.`os_uid` = #{uid} AND (d.`os_state` = 1 OR d.`os_state` = 3) |
| | | WHERE |
| | | d.`os_uid` = #{uid} AND (d.`os_state` = 1 OR d.`os_state` = 3) |
| | | <if test="level != null"> |
| | | AND d.os_level = #{level} |
| | | </if> |
| | |
| | | AND TO_DAYS(NOW()) - TO_DAYS(d.`os_valid_time`) = 1 |
| | | </if> |
| | | <if test="day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(d.`os_valid_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') |
| | | AND DATE_FORMAT(d.`os_valid_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(),'%Y%m'),DATE_FORMAT(d.`os_valid_time`, '%Y%m')) = 1 |
| | | AND |
| | | PERIOD_DIFF(DATE_FORMAT(NOW(),'%Y%m'),DATE_FORMAT(d.`os_valid_time`, |
| | | '%Y%m')) = 1 |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="sumMoneyByUidAndDateAndState" resultType="BigDecimal"> |
| | | SELECT SUM(d.`os_money`) FROM yeshi_ec_invite_order_subsidy d |
| | | WHERE d.`os_uid` = #{uid} AND d.`os_state` = #{state} |
| | | WHERE |
| | | d.`os_uid` = #{uid} AND d.`os_state` = #{state} |
| | | <if test="level != null"> |
| | | AND d.os_level = #{level} |
| | | </if> |
| | |
| | | AND TO_DAYS(NOW()) - TO_DAYS(d.`os_valid_time`) = 1 |
| | | </if> |
| | | <if test="day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(d.`os_valid_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') |
| | | AND DATE_FORMAT(d.`os_valid_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(),'%Y%m'),DATE_FORMAT(d.`os_valid_time`, '%Y%m')) = 1 |
| | | AND |
| | | PERIOD_DIFF(DATE_FORMAT(NOW(),'%Y%m'),DATE_FORMAT(d.`os_valid_time`, |
| | | '%Y%m')) = 1 |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="sumRecievedMoneyByUid" resultType="BigDecimal"> |
| | | SELECT SUM(d.`os_money`) FROM yeshi_ec_invite_order_subsidy d |
| | | WHERE d.`os_uid` = #{uid} AND d.`os_state` = 3 |
| | | WHERE |
| | | d.`os_uid` = #{uid} AND d.`os_state` = 3 |
| | | <if test="level != null"> |
| | | AND d.os_level = #{level} |
| | | </if> |
| | | </select> |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getPayment(), money,new BigDecimal(0), goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money,
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money,new BigDecimal(0),
|
| | | goodsCount, commonOrder.getState(), commonOrder.getThirdCreateTime());
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getPayment(), money,new BigDecimal(0), goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money,
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money,new BigDecimal(0),
|
| | | goodsCount, commonOrder.getState(), commonOrder.getThirdCreateTime());
|
| | | break;
|
| | | }
|
| | |
| | | return money;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<InviteOrderSubsidy> listByOrderNoAndTypeAndUid(String orderNo, Integer type, Long uid) {
|
| | | return inviteOrderSubsidyMapper.listByOrderNoAndTypeAndUid(orderNo, type, uid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | |
|
| | | public List<InviteOrderSubsidy> listByOrderNoAndType(String orderNo, Integer type);
|
| | | |
| | | |
| | | public List<InviteOrderSubsidy> listByOrderNoAndTypeAndUid(String orderNo, Integer type,Long uid);
|
| | |
|
| | | /**
|
| | | * 查询补贴(加锁)
|
| | |
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.order.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.InviteOrderSubsidyException;
|
| | |
| | | * 通知用户的返利情况
|
| | | */
|
| | |
|
| | | // if (!Constant.IS_TEST) {
|
| | | if (hasAdd) {
|
| | | Iterator<Integer> its = notificationMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | Integer t = its.next();
|
| | | HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
|
| | | CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
|
| | | Long uid = notify.getUserInfo().getId();
|
| | | BigDecimal money = notify.getMoney();
|
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | | // if (!Constant.IS_TEST) {
|
| | | if (hasAdd) {
|
| | | // 获取订单补贴
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | Iterator<Integer> its = notificationMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | Integer t = its.next();
|
| | | HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
|
| | | CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
|
| | | Long uid = notify.getUserInfo().getId();
|
| | |
|
| | | userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | List<InviteOrderSubsidy> subsidyList = inviteOrderSubsidyService.listByOrderNoAndTypeAndUid(orderId,
|
| | | orderType, uid);
|
| | | BigDecimal subsidy = new BigDecimal(0);
|
| | | if (subsidyList != null)
|
| | | for (InviteOrderSubsidy s : subsidyList) {
|
| | | if (s.getState() != InviteOrderSubsidy.STATE_INVALID)
|
| | | subsidy = subsidy.add(s.getOriginalMoney());
|
| | | }
|
| | |
|
| | | BigDecimal money = notify.getMoney();
|
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state, commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
|
| | | userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state, commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, subsidy, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, subsidy, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, subsidy, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, subsidy, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | }
|
| | | // }
|
| | | }
|
| | | // }
|
| | | }
|
| | |
|
| | | int resultCode = 0;
|