| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | if (oldHongBao == null) |
| | | throw new HongBaoException(10, "红包对象不存在"); |
| | | // 已经失效,已经领取,领取中,新老状态一致的红包不做处理 |
| | | if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU|| oldHongBao.getState() == HongBaoV2.STATE_LINGQUING) |
| | | if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU || oldHongBao.getState() == HongBaoV2.STATE_LINGQUING) |
| | | return false; |
| | | |
| | | SystemEnum system = userInfoService.getUserSystem(commonOrder.getUserInfo().getId()); |
| | |
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId()); |
| | | if (children != null && children.size() > 0) |
| | | for (HongBaoV2 child : children) { |
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU||child.getState() == HongBaoV2.STATE_LINGQUING) |
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU || child.getState() == HongBaoV2.STATE_LINGQUING) |
| | | continue; |
| | | |
| | | HongBaoV2 childUpdate = new HongBaoV2(child.getId()); |
| | |
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId()); |
| | | if (children != null) |
| | | for (HongBaoV2 child : children) { |
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU||child.getState() == HongBaoV2.STATE_LINGQUING) |
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU || child.getState() == HongBaoV2.STATE_LINGQUING) |
| | | continue; |
| | | |
| | | HongBaoV2 childUpdate = new HongBaoV2(child.getId()); |
| | |
| | | if (goods != null) { |
| | | try { |
| | | if (userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(), |
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId()), commonOrder.getSourceType())) |
| | | commonOrder.getOrderNo(), payMent, goods.getGoodsId(), commonOrder.getSourceType())) |
| | | mianDanMoney = payMent; |
| | | } catch (NumberFormatException e) { |
| | | throw new HongBaoException(10, "免单商品处理出错"); |
| | |
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO); |
| | | hongBao.setMoney(new BigDecimal(0)); |
| | | } else { |
| | | throw new HongBaoException(3, "维权订单不能创建红包"); |
| | | throw new HongBaoException(HongBaoException.CODE_ORDER_WEIQUAN, "维权订单不能创建红包"); |
| | | } |
| | | |
| | | if (mianDanMoney != null) |
| | |
| | | |
| | | HongBao hb = new HongBao(); |
| | | if (goods != null) |
| | | hb.setAuctionId(Long.parseLong(goods.getGoodsId())); |
| | | hb.setAuctionId(TaoBaoUtil.getAuctionId(goods.getGoodsId())); |
| | | hb.setUserInfo(hongBao.getUserInfo()); |
| | | hb.setMoney(hongBao.getMoney()); |
| | | |
| | |
| | | @Transactional |
| | | @Override |
| | | public void setHongBaoRecieved(Long uid, List<Integer> typeList, Date preGetTime) { |
| | | hongBaoV2Mapper.setHongBaoRecieved(uid, typeList, preGetTime); |
| | | |
| | | String getMonth = TimeUtil.getGernalTime(preGetTime.getTime(), "yyyy-MM"); |
| | | //前面几个月的可能有未结算的,统一加入到本月结算 |
| | | hongBaoV2Mapper.setHongBaoRecieved(uid, typeList, preGetTime, getMonth); |
| | | } |
| | | |
| | | |