| | |
| | | package com.ruoyi.order.service.impl.order; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReceiver; |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingRequest; |
| | | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.*; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ProfitSharingRequest.Receiver; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum; |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingNotifyResult; |
| | | import com.github.binarywang.wxpay.config.WxPayConfig; |
| | | import com.github.binarywang.wxpay.constant.WxPayConstants; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import com.google.common.base.Joiner; |
| | |
| | | import com.ruoyi.order.domain.dto.*; |
| | | import com.ruoyi.order.domain.pojo.account.OrderPayment; |
| | | import com.ruoyi.order.domain.pojo.account.OrderRefund; |
| | | import com.ruoyi.order.domain.pojo.account.ProfitSharing; |
| | | import com.ruoyi.order.domain.pojo.order.ConsumerGoods; |
| | | import com.ruoyi.order.domain.pojo.order.Order; |
| | | import com.ruoyi.order.domain.pojo.order.OrderGoods; |
| | | import com.ruoyi.order.domain.pojo.order.PayRecord; |
| | | import com.ruoyi.order.domain.vo.*; |
| | | import com.ruoyi.order.enums.RefundStatusEnum; |
| | | import com.ruoyi.order.enums.dict.IDict; |
| | | import com.ruoyi.order.mapper.order.OrderMapper; |
| | | import com.ruoyi.order.service.account.OrderPaymentService; |
| | | import com.ruoyi.order.service.account.OrderRefundService; |
| | | import com.ruoyi.order.service.account.PaymentMessageService; |
| | | import com.ruoyi.order.service.account.ProfitSharingService; |
| | | import com.ruoyi.order.service.order.*; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.constant.DelayTaskEnum; |
| | |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.service.*; |
| | | import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | |
| | | * @since 2023-04-25 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService { |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private OrderPaymentService orderPaymentService; |
| | | |
| | | @Resource |
| | | private ProfitSharingService profitSharingService; |
| | | |
| | | @Resource |
| | | private OrderRefundService orderRefundService; |
| | | |
| | | /** |
| | | * @description: buyGoods |
| | |
| | | appPlaceOrderVo.setOrderId(orderId); |
| | | appPlaceOrderVo.setOrderNo(orderNo); |
| | | |
| | | try { |
| | | // 创建支付订单 |
| | | Long shopId = appPlaceOrderDto.getShopId(); |
| | | R<String> resultMch = remoteShopService.getShopSubMchId(shopId); |
| | | String subMchId = resultMch.getData(); |
| | | if(StringUtils.isEmpty(subMchId)){ |
| | | throw new ServiceException("获取微信商户号失败"); |
| | | } |
| | | |
| | | WxPayConfig config = wxService.getConfig(); |
| | | config.setSubMchId(subMchId); |
| | | |
| | | WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest(); |
| | | request.setTradeType(WxPayConstants.TradeType.JSAPI); |
| | | request.setSubMchId(subMchId); |
| | | // 商户订单号 |
| | | request.setOutTradeNo(orderNo); |
| | | // 订单总金额 |
| | | Integer totalFee = order.getPayMoney().multiply(new BigDecimal(100)).intValue(); |
| | | request.setTotalFee(totalFee); |
| | | request.setProductId(orderNo); |
| | | request.setNotifyUrl(config.getNotifyUrl()); |
| | | request.setProfitSharing("Y"); |
| | | request.setOpenid(appPlaceOrderDto.getOpenid()); |
| | | request.setSpbillCreateIp(appPlaceOrderDto.getSpbillCreateIp()); |
| | | // 商品描述 body |
| | | String body = "商品购买"; |
| | | String goodsName = ""; |
| | | if(null != goods){ |
| | | body = goods.getGoodsName() + "-" + body; |
| | | goodsName = goods.getGoodsName(); |
| | | } |
| | | request.setBody(body); |
| | | |
| | | request.checkAndSign(config); |
| | | // 小程序微信下单支付 |
| | | createWxPayInfo(appPlaceOrderVo, userId, order.getShopId(), goodsName, orderNo, |
| | | orderId, order.getPayMoney(), appPlaceOrderDto.getOpenid(), |
| | | appPlaceOrderDto.getSpbillCreateIp(), goodsNameList); |
| | | |
| | | // 请求参数 |
| | | Gson gson = new Gson(); |
| | | String payRequestJson = gson.toJson(request); |
| | | |
| | | WxPayMpOrderResult result = wxService.createOrder(request); |
| | | |
| | | String payResponseJson = gson.toJson(request); |
| | | |
| | | // 支付相关信息返回 |
| | | appPlaceOrderVo.setAppId(result.getAppId()); |
| | | appPlaceOrderVo.setMchId(config.getMchId()); |
| | | appPlaceOrderVo.setTimeStamp(result.getTimeStamp()); |
| | | appPlaceOrderVo.setNonceStr(result.getNonceStr()); |
| | | appPlaceOrderVo.setPackageStr(result.getPackageValue()); |
| | | appPlaceOrderVo.setSignType(result.getSignType()); |
| | | appPlaceOrderVo.setPaySign(result.getPaySign()); |
| | | appPlaceOrderVo.setPrepayId(result.getPackageValue()); |
| | | |
| | | //减去优惠券 |
| | | if(StringUtils.isNotBlank(memberCouponSJ.toString())){ |
| | |
| | | remoteConfigService.addDelayTask(delayTask); |
| | | appPlaceOrderVo.setEndTime(DateUtils.addMinutes(order.getCreateTime(),delayTime)); |
| | | |
| | | return appPlaceOrderVo; |
| | | } |
| | | |
| | | /** |
| | | * 小程序支付下单API |
| | | * @param appPlaceOrderVo |
| | | * @param userId |
| | | * @param shopId |
| | | * @param goodsName |
| | | * @param orderNo |
| | | * @param orderId |
| | | * @param payMoney |
| | | * @param openid |
| | | * @param payerClientIp |
| | | * @param goodsNameList |
| | | */ |
| | | private void createWxPayInfo(AppPlaceOrderVo appPlaceOrderVo, Long userId, Long shopId, |
| | | String goodsName, String orderNo, |
| | | String orderId, BigDecimal payMoney, |
| | | String openid, String payerClientIp, List<String> goodsNameList){ |
| | | try { |
| | | // 创建支付订单 |
| | | R<String> resultMch = remoteShopService.getShopSubMchId(shopId); |
| | | String subMchId = resultMch.getData(); |
| | | if (StringUtils.isEmpty(subMchId)) { |
| | | throw new ServiceException("获取微信商户号失败"); |
| | | } |
| | | WxPayConfig config = wxService.getConfig(); |
| | | config.setSubMchId(subMchId); |
| | | |
| | | PartnerTransactionsRequest request = new PartnerTransactionsRequest(); |
| | | request.setSpAppid(config.getAppId()); |
| | | request.setSpMchid(config.getMchId()); |
| | | request.setSubMchid(config.getSubMchId()); |
| | | // 商品描述 body |
| | | String description = goodsName + "-商品购买"; |
| | | |
| | | request.setDescription(description); |
| | | request.setOutTradeNo(orderNo); |
| | | request.setNotifyUrl(config.getNotifyUrl()); |
| | | // 结算信息 |
| | | PartnerTransactionsRequest.SettleInfo settleInfo = new PartnerTransactionsRequest.SettleInfo(); |
| | | settleInfo.setProfitSharing(true); |
| | | settleInfo.setSubsidyAmount(BigDecimal.ZERO); |
| | | request.setSettleInfo(settleInfo); |
| | | |
| | | // 订单总金额 |
| | | Integer totalFee = payMoney.multiply(new BigDecimal(100)).intValue(); |
| | | PartnerTransactionsRequest.Amount amount = new PartnerTransactionsRequest.Amount(); |
| | | amount.setTotal(totalFee); |
| | | amount.setCurrency("CNY"); |
| | | request.setAmount(amount); |
| | | |
| | | // 支付者 |
| | | PartnerTransactionsRequest.Payer payer = new PartnerTransactionsRequest.Payer(); |
| | | payer.setSpOpenid(openid); |
| | | request.setPayer(payer); |
| | | |
| | | // 场景信息 |
| | | PartnerTransactionsRequest.SceneInfo sceneInfo = new PartnerTransactionsRequest.SceneInfo(); |
| | | sceneInfo.setPayerClientIp(payerClientIp); |
| | | request.setSceneInfo(sceneInfo); |
| | | |
| | | TransactionsResult.JsapiResult result = wxService.getEcommerceService().partnerTransactions(TradeTypeEnum.JSAPI, request); |
| | | |
| | | // 请求参数 |
| | | Gson gson = new Gson(); |
| | | String payRequestJson = gson.toJson(request); |
| | | // 返回参数 |
| | | String payResponseJson = gson.toJson(result); |
| | | |
| | | // 支付相关信息返回 |
| | | appPlaceOrderVo.setAppId(result.getAppId()); |
| | | appPlaceOrderVo.setMchId(config.getMchId()); |
| | | appPlaceOrderVo.setTimeStamp(result.getTimeStamp()); |
| | | appPlaceOrderVo.setNonceStr(result.getNonceStr()); |
| | | appPlaceOrderVo.setPackageStr(result.getPackageValue()); |
| | | appPlaceOrderVo.setSignType(result.getSignType()); |
| | | appPlaceOrderVo.setPaySign(result.getPaySign()); |
| | | appPlaceOrderVo.setPrepayId(result.getPackageValue()); |
| | | |
| | | // 保存支付订单统一下单日志 |
| | | paymentMessageService.savePaymentMessage("1", 0L, payRequestJson, payResponseJson); |
| | | paymentMessageService.savePaymentMessage("1", orderId, payRequestJson, payResponseJson); |
| | | |
| | | // 保存支付订单统一下单支付记录 |
| | | orderPaymentService.saveOrderPayment(userId, shopId, orderId, order.getPayMoney(), |
| | | appPlaceOrderVo.getEndTime(), "Y", appPlaceOrderDto.getOpenid(), |
| | | orderPaymentService.saveOrderPayment(userId, shopId, subMchId, orderId, payMoney, |
| | | appPlaceOrderVo.getEndTime(), "Y", openid, |
| | | Joiner.on(";").join(goodsNameList),result.getPackageValue()); |
| | | |
| | | return appPlaceOrderVo; |
| | | } catch (WxPayException e){ |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | |
| | | @Override |
| | | public void cancelOrder(String orderId) { |
| | | Order order = this.getById(orderId); |
| | | // 订单状态-1.删除 0.已取消 1.待支付 2.待核销 3.已完成 |
| | | if (order.getOrderStatus() == 0) { |
| | | throw new ServiceException(AppErrorConstant.CANCEL_CANCEL_ORDER); |
| | | }else if (order.getOrderStatus() == 1) { |
| | | this.autoCancelOrder(orderId); |
| | | }else if(order.getOrderStatus() == 2){ |
| | | // 2.待核销 -> 订单退款 |
| | | this.refundOrder(orderId); |
| | | }else{ |
| | | throw new ServiceException(AppErrorConstant.CANCEL_ERROR_ORDER); |
| | |
| | | payRecord.setPayType(2); |
| | | payRecordService.save(payRecord); |
| | | |
| | | submitProfitSharing(orderId, order.getOrderNo(), order.getShopId(), order.getOrderMoney()); |
| | | |
| | | return merVerifyOrderVo; |
| | | } |
| | | |
| | | private void submitProfitSharing(String orderId, String orderNo, Long shopId, BigDecimal orderMoney) { |
| | | String sendMessage = ""; |
| | | String resultMessage = ""; |
| | | try { |
| | | // TODO 核销完成 开始分账(平台收取服务费) |
| | | OrderPayment payment = orderPaymentService.getByOrderId(orderId); |
| | | String transactionId = payment.getTransactionId(); |
| | | |
| | | String platformTyMacId = MyWxPayConfig.getPlatformTyMacId(); |
| | | |
| | | R<String> resultMch = remoteShopService.getShopSubMchId(order.getShopId()); |
| | | R<String> resultMch = remoteShopService.getShopSubMchId(shopId); |
| | | String subMchId = resultMch.getData(); |
| | | if(StringUtils.isEmpty(subMchId)){ |
| | | throw new ServiceException("获取微信商户号失败"); |
| | | } |
| | | if (!StringUtils.isEmpty(subMchId)) { |
| | | |
| | | R<ShopProportionVo> resultShopProportion = remoteShopService.getShopProportion(order.getShopId()); |
| | | |
| | | R<ShopProportionVo> resultShopProportion = remoteShopService.getShopProportion(shopId); |
| | | ShopProportionVo shopProportion = resultShopProportion.getData(); |
| | | if(null == shopProportion){ |
| | | throw new ServiceException("获取商户分成失败"); |
| | | if (null != shopProportion) { |
| | | ProfitSharingRequest request = new ProfitSharingRequest(); |
| | | request.setSubMchid(subMchId); |
| | | request.setTransactionId(transactionId); |
| | | request.setOutOrderNo(orderNo); |
| | | List<Receiver> receiverList = new ArrayList<>(); |
| | | |
| | | String description = "订单:" + orderNo + " 平台抽取佣金"; |
| | | BigDecimal proportionPercent = shopProportion.getProportionPercent(); |
| | | if (null == proportionPercent) { |
| | | proportionPercent = BigDecimal.ZERO; |
| | | } |
| | | |
| | | ProfitSharingRequest request = new ProfitSharingRequest(); |
| | | request.setSubMchId(subMchId); |
| | | request.setTransactionId(transactionId); |
| | | request.setOutOrderNo(order.getOrderNo()); |
| | | List<ProfitSharingReceiver> receiverList = new ArrayList<>(); |
| | | ProfitSharingReceiver receiver = new ProfitSharingReceiver(); |
| | | // TODO 分账 |
| | | // receiver.set |
| | | // request.setReceivers(); |
| | | ProfitSharingResult result = new ProfitSharingResult(); |
| | | result.setOutOrderNo(orderNo); |
| | | result.setStatus("FINISHED"); |
| | | |
| | | // platformTyMacId |
| | | // wxService.getProfitSharingV3Service().profitSharing() |
| | | // 计算分成金额 |
| | | int amount = orderMoney.multiply(proportionPercent).setScale(0, RoundingMode.UP).intValue(); |
| | | log.info("订单分账:{} 分账金额: {}", orderNo, amount); |
| | | if (amount > 0) { |
| | | // 分账创建 |
| | | Receiver receiver = new Receiver(); |
| | | receiver.setType("MERCHANT_ID"); |
| | | receiver.setReceiverAccount(platformTyMacId); |
| | | receiver.setAmount(amount); |
| | | receiver.setDescription(description); |
| | | |
| | | return merVerifyOrderVo; |
| | | receiverList.add(receiver); |
| | | request.setReceivers(receiverList); |
| | | // 分账完成 |
| | | request.setFinish(true); |
| | | result = wxService.getEcommerceService().profitSharing(request); |
| | | } |
| | | |
| | | // 创建分账记录 |
| | | profitSharingService.saveProfitSharing(shopId, orderId, orderMoney, result); |
| | | |
| | | // 保存请求信息 |
| | | sendMessage = JSONObject.toJSONString(request); |
| | | resultMessage = JSONObject.toJSONString(result); |
| | | } else { |
| | | resultMessage = String.format("订单分账:%s 获取商户分成失败", orderNo); |
| | | log.info(resultMessage); |
| | | } |
| | | } else { |
| | | resultMessage = String.format("订单分账:%s 获取微信商户号失败", orderNo); |
| | | log.info(resultMessage); |
| | | } |
| | | } catch (WxPayException e) { |
| | | resultMessage = String.format("订单分账:%s 分账失败:%s", orderNo, e.getMessage()); |
| | | log.info(resultMessage); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // 保存分账信息 |
| | | paymentMessageService.savePaymentMessage("4", orderId, sendMessage, resultMessage); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | /** |
| | | * @param merVerifyPrizeDto |
| | | * @return MerVerifyAwardVo |
| | | * @description 确认核销奖品 |
| | | * @author jqs |
| | | * @date 2023/7/9 9:54 |
| | | * @param merVerifyPrizeDto |
| | | * @return MerVerifyAwardVo |
| | | */ |
| | | @Override |
| | | @Transactional |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取核销奖品 |
| | | * @author jqs |
| | | * @date 2023/7/8 17:46 |
| | | * @param verifyCode |
| | | * @param shopId |
| | | * @return MerVerifyAwardVo |
| | | * @description 获取核销奖品 |
| | | * @author jqs |
| | | * @date 2023/7/8 17:46 |
| | | */ |
| | | @Override |
| | | public MerVerifyAwardVo verifyPrize(String verifyCode,Long shopId){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param merOrderPageDto |
| | | * @return MerTotalOrderVo |
| | | * @description 商户端订单管理统计 |
| | | * @author jqs |
| | | * @date 2023/7/31 10:53 |
| | | * @param merOrderPageDto |
| | | * @return MerTotalOrderVo |
| | | */ |
| | | @Override |
| | | public MerTotalOrderVo totalMerOrder(MerOrderPageDto merOrderPageDto) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param orderId |
| | | * @return void |
| | | * @description 自动取消订单 |
| | | * @author jqs |
| | | * @date 2023/7/13 17:15 |
| | | * @param orderId |
| | | * @return void |
| | | */ |
| | | @Override |
| | | @Transactional |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param transaction |
| | | * @return void |
| | | * @description 订单支付回调 |
| | | * @author jqs |
| | | * @date 2023/7/13 17:57 |
| | | * @param transaction |
| | | * @return void |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void payBack(Transaction transaction) { |
| | | public void payBack(PartnerTransactionsResult transaction) { |
| | | // 更新订单状态 |
| | | String orderId=transaction.getOutTradeNo(); |
| | | Order order = this.getById(orderId); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param orderId |
| | | * @return void |
| | | * @description 订单退款 |
| | | * @author jqs |
| | | * @date 2023/7/13 18:36 |
| | | * @param orderId |
| | | * @return void |
| | | */ |
| | | @Override |
| | | @Transactional |
| | |
| | | orderRefund.setOrderId(order.getOrderId()); |
| | | orderRefund.setUserId(order.getUserId()); |
| | | orderRefund.setShopId(order.getShopId()); |
| | | orderRefund.setRefundMoney(order.getPayMoney()); |
| | | orderRefund.setRefundMoney(order.getOnlinePayMoney()); |
| | | orderRefund.setOrderMoney(order.getPayMoney()); |
| | | orderRefund.setCreateTime(new Date()); |
| | | // 初始化各类商品的收款金额 |
| | |
| | | activityTotalChangeDto.setUserId(order.getUserId()); |
| | | remoteActivityService.changeActivityTotal(activityTotalChangeDto); |
| | | } |
| | | |
| | | // 用户取消订单退款 |
| | | BigDecimal onlinePayMoney = order.getOnlinePayMoney(); |
| | | if(BigDecimal.ZERO.compareTo(onlinePayMoney) < 0){ |
| | | // 订单支付金额大于0,可发起退款 |
| | | orderWxApplyRefund(orderId, refundId, onlinePayMoney, orderRefund); |
| | | } |
| | | |
| | | orderRefund.setRefundStatus(1); |
| | | orderRefundService.saveOrUpdate(orderRefund); |
| | | } |
| | | |
| | | /** |
| | | * 申请退款API |
| | | */ |
| | | private void orderWxApplyRefund(String orderId, String outRefundNo, BigDecimal payMoney, OrderRefund orderRefund){ |
| | | try { |
| | | // 创建支付订单 |
| | | OrderPayment orderPayment = orderPaymentService.getByOrderId(orderId); |
| | | if (null == orderPayment) { |
| | | return; |
| | | } |
| | | String subMchId = orderPayment.getSubMchId(); |
| | | WxPayConfig config = wxService.getConfig(); |
| | | |
| | | RefundsRequest request = new RefundsRequest(); |
| | | request.setSpAppid(config.getAppId()); |
| | | request.setSubMchid(subMchId); |
| | | request.setTransactionId(orderPayment.getTransactionId()); |
| | | request.setOutRefundNo(outRefundNo); |
| | | request.setReason("用户取消订单"); |
| | | // 订单金额 |
| | | int total = payMoney.multiply(new BigDecimal(100)).intValue(); |
| | | RefundsRequest.Amount amount = RefundsRequest.Amount.builder().refund(total).total(total).currency("CNY").build(); |
| | | request.setAmount(amount); |
| | | request.setNotifyUrl(config.getNotifyUrl()); |
| | | |
| | | RefundsResult result = wxService.getEcommerceService().refunds(request); |
| | | |
| | | // 微信退款id |
| | | orderRefund.setWxRefundId(result.getRefundId()); |
| | | |
| | | // 请求参数 |
| | | Gson gson = new Gson(); |
| | | String refundRequestJson = gson.toJson(request); |
| | | // 返回参数 |
| | | String refundResponseJson = gson.toJson(result); |
| | | |
| | | // 保存支付订单统一下单日志 |
| | | paymentMessageService.savePaymentMessage("3", orderId, refundRequestJson, refundResponseJson); |
| | | |
| | | } catch (WxPayException e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return StaffActivityOrderTotalVo |
| | | * @description 员工端活动订单统计 |
| | | * @author jqs |
| | | * @date 2023/7/17 15:25 |
| | | * @param staffTotalDto |
| | | * @return StaffActivityOrderTotalVo |
| | | */ |
| | | @Override |
| | | public StaffActivityOrderTotalVo getStaffActivityOrderTotal(StaffTotalDto staffTotalDto){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return StaffActivityTotalVo |
| | | * @description 员工端活动统计 |
| | | * @author jqs |
| | | * @date 2023/7/17 15:51 |
| | | * @param staffTotalDto |
| | | * @return StaffActivityTotalVo |
| | | */ |
| | | @Override |
| | | public StaffActivityTotalVo getStaffActivityTotal(StaffTotalDto staffTotalDto){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return MerOrderDistributionTotalVo |
| | | * @description 员工端活动统计订单分布 |
| | | * @author jqs |
| | | * @date 2023/7/17 16:16 |
| | | * @param staffTotalDto |
| | | * @return MerOrderDistributionTotalVo |
| | | */ |
| | | @Override |
| | | public MerOrderDistributionTotalVo getStaffOrderDistributionTotal(StaffTotalDto staffTotalDto){ |
| | |
| | | |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return MerOrderTypeTotalVo |
| | | * @description 员工端活动统计销售占比 |
| | | * @author jqs |
| | | * @date 2023/7/17 17:03 |
| | | * @param staffTotalDto |
| | | * @return MerOrderTypeTotalVo |
| | | */ |
| | | @Override |
| | | public MerOrderTypeTotalVo getStaffOrderTypeTotal(StaffTotalDto staffTotalDto){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return StaffActivityDateMemberTotalVo |
| | | * @description 员工端获客人数 |
| | | * @author jqs |
| | | * @date 2023/7/17 18:42 |
| | | * @param staffTotalDto |
| | | * @return StaffActivityDateMemberTotalVo |
| | | */ |
| | | @Override |
| | | public StaffActivityDateMemberTotalVo getStaffActivityGetMemberTotal(StaffTotalDto staffTotalDto) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return StaffActivityDateMemberTotalVo |
| | | * @description 员工端获客人数 |
| | | * @author jqs |
| | | * @date 2023/7/17 18:42 |
| | | * @param staffTotalDto |
| | | * @return StaffActivityDateMemberTotalVo |
| | | */ |
| | | @Override |
| | | public StaffActivityDateMemberTotalVo getStaffActivityMemberTotal(StaffTotalDto staffTotalDto) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取时间段日期 |
| | | * @author jqs |
| | | * @date 2023/7/17 19:11 |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return List<String> |
| | | * @description 获取时间段日期 |
| | | * @author jqs |
| | | * @date 2023/7/17 19:11 |
| | | */ |
| | | public static List<String> getDateRange(String startDate, String endDate) { |
| | | List<String> dateList = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param |
| | | * @return void |
| | | * @description 检查订单状态定时任务 |
| | | * @author jqs |
| | | * @date 2023/7/25 14:40 |
| | | * @param |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public void checkOrderStatus(){ |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void profitSharingBack(ProfitSharingNotifyResult result) { |
| | | |
| | | try { |
| | | String outOrderNo = result.getOutOrderNo(); |
| | | ProfitSharing profitSharing = profitSharingService.getById(outOrderNo); |
| | | if(null != profitSharing){ |
| | | profitSharing.setWxOrderId(result.getOrderId()); |
| | | profitSharing.setFinishTime(result.getSuccessTime()); |
| | | profitSharing.setFinishFlag(1); |
| | | |
| | | profitSharingService.saveOrUpdate(profitSharing); |
| | | } |
| | | } catch (Exception e){ |
| | | |
| | | log.error("==分账回成功回调操作====【{}】========={}", result.getOutOrderNo(), e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void orderRefundBack(RefundNotifyResult result) { |
| | | try { |
| | | String outRefundNo = result.getOutRefundNo(); |
| | | String refundStatus = result.getRefundStatus(); |
| | | OrderRefund orderRefund = orderRefundService.getById(outRefundNo); |
| | | if(null != orderRefund){ |
| | | orderRefund.setWxRefundId(result.getRefundId()); |
| | | orderRefund.setBackTime(result.getSuccessTime()); |
| | | orderRefund.setRefundStatus(IDict.getCodeByText(RefundStatusEnum.class, refundStatus)); |
| | | orderRefundService.saveOrUpdate(orderRefund); |
| | | } |
| | | } catch (Exception e){ |
| | | |
| | | log.error("==退款回成功回调操作====【{}】========={}", result.getOutRefundNo(), e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private void autoTimeCancelOrder(Order order){ |
| | | String orderId = order.getOrderId(); |
| | | order.setOrderStatus(0); |