From 221b5c8d0de3f6b17a00d543503a79c13b28ba12 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 13 十一月 2019 16:45:57 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java | 41 ++++++++++++++++++++++++++++++++++++++--- 1 files changed, 38 insertions(+), 3 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java index 1e585a4..bdfdad8 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java @@ -23,6 +23,8 @@ 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; @@ -35,6 +37,7 @@ 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; @@ -83,6 +86,9 @@ @Resource(name = "transactionManager") private DataSourceTransactionManager transactionManager; + + @Resource + private UserMoneyMsgNotificationService userMoneyMsgNotificationService; @Transactional @Override @@ -140,6 +146,10 @@ order.setOrderNo(orderNo); banLiShopOrderMapper.updateByPrimaryKeySelective(update); + // 澧炲姞閿�閲� + banLiShopGoodsSetService.addSalesCount(order.getGoodsSet().getId(), 1); + banLiShopGoodsService.addSalesCount(order.getGoods().getId(), 1); + // 璁㈠崟娣诲姞鎴愬姛 ,寤舵椂閫氱煡鍚庣画 sendPlaceOrderMsg(order.getId(), order.getUid()); } @@ -186,12 +196,12 @@ @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 @@ -389,7 +399,17 @@ 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); @@ -415,7 +435,12 @@ } 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, "绾㈠寘浣欓涓嶈冻"); } @@ -452,4 +477,14 @@ 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); + } + } -- Gitblit v1.8.0