| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean refundToUser(String id, ShopRefundRecord shopRefundRecord) { |
| | | LogUtil.debug("进入退款接口进行退款。。。", id); |
| | | Boolean flag = false; |
| | |
| | | //退款成功后同时把优惠券退回到用户的账号中 |
| | | if (shopOrder.getDiscountAmount() != null && shopOrder.getDiscountAmount().compareTo(BigDecimal.ZERO) >0) { |
| | | ShopCouponRecord shopCouponRecord = new ShopCouponRecord(); |
| | | String userIds = shopRefundRecord.getUserId(); |
| | | Long userIds = shopRefundRecord.getUserId(); |
| | | shopCouponRecord.setUserId(userIds); |
| | | shopCouponRecord.setOrderId(shopOrder.getId()); |
| | | List<ShopCouponRecord> recordList = shopCouponRecordDao.selectByModel(shopCouponRecord); |
| | |
| | | modifyMap.put("refundCharge", shopRefundRecord.getRefundMoney()); |
| | | shopOrderDao.updateByMap(modifyMap); |
| | | |
| | | rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopOrder.getId()+""); |
| | | rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopRefundRecord.getOrderId()+""); |
| | | |
| | | |
| | | }catch (Exception e){ |
| | |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 退款成功后发送微信提醒 |
| | | * @param shopRefundRecord |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int sendRefundInfoToUser(ShopRefundRecord shopRefundRecord) { |
| | | ShopOrder order = shopOrderDao.selectById(shopRefundRecord.getOrderId()); |
| | | if (order == null) { |
| | | throw new GlobleException("没有找到需要退款的订单信息"); |
| | | } |
| | | List<String> msg = new ArrayList<>(); |
| | | //退款说明 |
| | | String refundExplain = "退款已经原路返回,具体到账时间可能会有1-3天延迟"; |
| | | msg.add(order.getOrderNo()); |
| | | msg.add(DateUtil.dateToString(shopRefundRecord.getRefundTime(),DateUtil.DATE_FORMAT_SS)); |
| | | msg.add(refundExplain); |
| | | String formId = null; |
| | | if(AppConstance.REFUND_GOODS.equals(shopRefundRecord.getRefundType()) && null != shopRefundRecord.getRefundTransactionNo()){ |
| | | formId = shopRefundRecord.getRefundTransactionNo(); |
| | | }else { |
| | | formId = order.getWxOrderNo().split("=")[1]; |
| | | } |
| | | String page = "pages/refunDetail/refunDetail?id=" + shopRefundRecord.getId() + "&&status=1" + "&&inform=1"; |
| | | int res = WxTempLateMsgUtil.sendWxTemplateMsg(msg, order.getUserId(), |
| | | page, WxTempLateMsgUtil.REFUND_SUCCESS, formId); |
| | | return res; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateGroupBuyStatus(Long orderId) { |