From ae6bf015031bd6579cc719ee7689d8160e3d92d2 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 08 十一月 2019 15:43:38 +0800 Subject: [PATCH] 商城订单后台修改,悬浮大图添加音效控制 --- fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderPayServiceImpl.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 57 insertions(+), 1 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderPayServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderPayServiceImpl.java index 4a5e0be..47b2865 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderPayServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderPayServiceImpl.java @@ -7,6 +7,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.yeshi.utils.NumberUtil; import org.yeshi.utils.exception.WXOrderException; import com.aliyun.openservices.ons.api.Message; @@ -20,9 +21,11 @@ import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass; import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets; import com.yeshi.fanli.entity.shop.BanLiShopOrder; +import com.yeshi.fanli.entity.shop.ChargeTypeEnum; 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.exception.shop.FuLuChargeException; import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService; import com.yeshi.fanli.service.inter.redpack.RedPackDetailService; import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService; @@ -30,6 +33,9 @@ import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService; import com.yeshi.fanli.service.inter.shop.BanLiShopOrderPayService; import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService; +import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; +import com.yeshi.fanli.util.charge.FuLuChargeApiUtil; import com.yeshi.fanli.util.factory.RedPackDetailFactory; import com.yeshi.fanli.util.rocketmq.MQTopicName; import com.yeshi.fanli.util.wx.BanLiShopWXPayUtil; @@ -206,7 +212,7 @@ BanLiShopOrderMQMsg msg = new BanLiShopOrderMQMsg(order.getId(), order.getUid()); Message message = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.banLiShopOrderRefund.name(), new Gson().toJson(msg).getBytes()); - message.setStartDeliverTime(System.currentTimeMillis() + 1000 * 60 *5L);// 寤舵椂24灏忔椂閫氱煡妫�娴嬪井淇¢��娆剧姸鎬� + message.setStartDeliverTime(System.currentTimeMillis() + 1000 * 60 * 5L);// 寤舵椂24灏忔椂閫氱煡妫�娴嬪井淇¢��娆剧姸鎬� SendResult result = producer.send(message); if (result == null) { throw new BanLiShopOrderException(8, "娑堟伅鍙戦�佸け璐�"); @@ -281,4 +287,54 @@ } } + @Transactional + @Override + public void charge(Long orderId) throws BanLiShopOrderException { + BanLiShopOrder order = banLiShopOrderService.selectByPrimaryKey(orderId); + if (order == null) + throw new BanLiShopOrderException(1, "璁㈠崟涓嶅瓨鍦�"); + if (order.getState() != BanLiShopOrder.STATE_PAID) { + throw new BanLiShopOrderException(100, "璁㈠崟涓嶆槸澶勪簬浠樻鐘舵��"); + } + if (order.getChargeAccountType() == ChargeTypeEnum.phone) { + if (!StringUtil.isMobile(order.getChargeAccount())) { + throw new BanLiShopOrderException(101, "鐢佃瘽鍙风爜鏍煎紡涓嶆纭�"); + } + } else if (order.getChargeAccountType() == ChargeTypeEnum.qq) { + if (!NumberUtil.isNumeric(order.getChargeAccount())) { + throw new BanLiShopOrderException(101, "QQ鍙锋牸寮忛敊璇�"); + } + } else { + throw new BanLiShopOrderException(102, "闈炲厖鍊煎晢鍝�"); + } + // 鑾峰彇绂忕鐨勫椁� + BanLiShopGoodsSets set = banLiShopGoodsSetService.selectByPrimaryKey(order.getGoodsSet().getId()); + if (set == null) { + throw new BanLiShopOrderException(104, "鍟嗗搧濂楅宸蹭笅绾�"); + } + + if (StringUtil.isNullOrEmpty(set.getChargeFuLuNum())) { + throw new BanLiShopOrderException(105, "绂忕鍏呭�糏D涓虹┖"); + } + + // 鏀瑰彉鐘舵�佷负鎴愬姛 + BanLiShopOrder update = new BanLiShopOrder(order.getId()); + update.setState(BanLiShopOrder.STATE_SUCCESS); + update.setStateDesc("鍏呭�兼垚鍔�"); + update.setUpdateTime(new Date()); + update.setSuccessTime(new Date()); + banLiShopOrderService.udpateSelectiveByPrimaryKey(update); + + try { + if (Constant.IS_TEST) { + FuLuChargeApiUtil.shaXiangCharge(set.getChargeFuLuNum(), "banlishop" + order.getOrderNo(), + order.getChargeAccount()); + } else + FuLuChargeApiUtil.charge(set.getChargeFuLuNum(), "banlishop" + order.getOrderNo(), + order.getChargeAccount()); + } catch (FuLuChargeException e) { + throw new BanLiShopOrderException(e.getCode(), e.getMsg()); + } + } + } -- Gitblit v1.8.0