| | |
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopOrderMapper;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackUseContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.mq.MQUnSendInfo;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | |
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackDetailException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.mq.MQUnSendInfoService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
|
| | |
| | |
|
| | | @Resource(name = "transactionManager")
|
| | | private DataSourceTransactionManager transactionManager;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | |
| | | order.setOrderNo(orderNo);
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | // 增加销量
|
| | | banLiShopGoodsSetService.addSalesCount(order.getGoodsSet().getId(), 1);
|
| | | banLiShopGoodsService.addSalesCount(order.getGoods().getId(), 1);
|
| | |
|
| | | // 订单添加成功 ,延时通知后续
|
| | | sendPlaceOrderMsg(order.getId(), order.getUid());
|
| | | }
|
| | |
| | | @Override
|
| | | public List<BanLiShopOrder> listByUid(Long uid, int page, int pageSize) {
|
| | |
|
| | | return banLiShopOrderMapper.listByUid(null, uid, (page - 1) * pageSize, pageSize);
|
| | | return banLiShopOrderMapper.listByUidAndState(null, uid, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByUid(Long uid) {
|
| | | return banLiShopOrderMapper.countByUid(null, uid);
|
| | | return banLiShopOrderMapper.countByUidAndState(null, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | update.setState(BanLiShopOrder.STATE_REJECT);
|
| | | update.setStateDesc(msg);
|
| | | update.setUpdateTime(new Date());
|
| | | update.setRejectTime(new Date());
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | // 消息发送
|
| | | MsgRedPackUseContentDTO dto = new MsgRedPackUseContentDTO();
|
| | | dto.setGoodsSetName(order.getOrderGoods().getSetName());
|
| | | dto.setHongBao(order.getHongBaoPayment());
|
| | | dto.setMoney(order.getMoneyPayment());
|
| | | dto.setReason(msg);
|
| | | dto.setTime(new Date());
|
| | | userMoneyMsgNotificationService.redPackMsg(order.getUid(), MsgTypeMoneyTypeEnum.redPackUseFail,
|
| | | new Gson().toJson(dto), null);
|
| | | transactionManager.commit(transactionStatus);
|
| | | } catch (Exception e) {
|
| | | transactionManager.rollback(transactionStatus);
|
| | |
| | | }
|
| | |
|
| | | if (pay.getHongBaoPrice() != null && pay.getHongBaoPrice().compareTo(new BigDecimal(0)) > 0) {
|
| | | BigDecimal money = redPackBalanceService.getBalance(uid);
|
| | | BigDecimal money = null;
|
| | | try {
|
| | | money = redPackBalanceService.getBalance(uid);
|
| | | } catch (RedPackBalanceException e) {
|
| | | throw new BanLiShopOrderException(25, "红包功能异常");
|
| | | }
|
| | | if (money.compareTo(pay.getHongBaoPrice()) < 0) {
|
| | | throw new BanLiShopOrderException(24, "红包余额不足");
|
| | | }
|
| | |
| | | return banLiShopOrderMapper.selectByOrderNo(orderNo);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopOrder> listByUidAndState(Long uid, List<Integer> stateList, int page, int pageSize) {
|
| | | return banLiShopOrderMapper.listByUidAndState(stateList, uid, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByUidAndState(Long uid, List<Integer> stateList) {
|
| | | return banLiShopOrderMapper.countByUidAndState(stateList, uid);
|
| | | }
|
| | |
|
| | | }
|