From 726e8e39795a6ee3da1c7a4361e5c0264273a47a Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Wed, 5 Feb 2025 09:07:05 +0800 Subject: [PATCH] 111 --- .../controller/system/StoreController.java | 7 ++- .../web/controller/system/UserController.java | 6 +- .../common/constant/ServiceConstants.java | 33 ++++++++--- .../service/impl/CallbackServiceImpl.java | 58 ++++++++++++++++--- .../domain/DividendDetailQuery.java | 5 +- .../mapper/DividendDetailMapper.java | 5 ++ .../mapper/DividendDetailMapper.xml | 13 +++++ .../service/IDividendDetailService.java | 8 +++ .../impl/DividendDetailServiceImpl.java | 10 ++++ .../com/ruoyi/ss/order/domain/OrderQuery.java | 8 +++ .../ruoyi/ss/order/mapper/OrderMapper.java | 6 ++ .../com/ruoyi/ss/order/mapper/OrderMapper.xml | 18 ++++++ .../ruoyi/ss/order/service/IOrderService.java | 6 ++ .../service/impl/OrderAssemblerImpl.java | 14 +++++ .../order/service/impl/OrderServiceImpl.java | 11 +++- .../ss/orderOper/mapper/OrderOperMapper.xml | 2 +- .../ss/pay/service/impl/WxPayService.java | 5 +- .../com/ruoyi/ss/refund/domain/Refund.java | 6 +- .../service/impl/RefundServiceImpl.java | 6 +- .../com/ruoyi/ss/store/domain/StoreQuery.java | 11 ++++ .../com/ruoyi/ss/store/domain/StoreVO.java | 3 + .../ss/store/service/IStoreAssembler.java | 3 +- .../service/impl/StoreAssemblerImpl.java | 30 +++++++++- .../com/ruoyi/ss/user/domain/UserQuery.java | 12 +++- .../java/com/ruoyi/ss/user/domain/UserVO.java | 5 ++ .../ruoyi/ss/user/service/IUserAssembler.java | 4 +- .../user/service/impl/UserAssemblerImpl.java | 30 +++++++++- .../ss/user/service/impl/UserServiceImpl.java | 21 +++---- .../com/ruoyi/system/domain/vo/DailyVo.java | 21 +++++++ .../com/ruoyi/system/domain/vo/InCome.java | 3 +- 30 files changed, 323 insertions(+), 47 deletions(-) create mode 100644 share-space-system/src/main/java/com/ruoyi/system/domain/vo/DailyVo.java diff --git a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/StoreController.java b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/StoreController.java index 7e27ec7..475be0a 100644 --- a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/StoreController.java +++ b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/StoreController.java @@ -1,9 +1,12 @@ package com.ruoyi.web.controller.system; +import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.ss.store.service.IStoreAssembler; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -72,11 +75,11 @@ public class StoreController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:store:query')") @GetMapping(value = "/{storeId}") - public AjaxResult getInfo(@PathVariable("storeId") Long storeId) + public AjaxResult getInfo(@PathVariable("storeId") Long storeId, StoreQuery query) { StoreVO vo = storeService.selectEStoreByStoreId(storeId); // 拼接今日收入、本月收入、总设备数、总营收、房间总数、正在使用中的房间数、设施总数、正在使用中的设施数 统计数据 - storeAssembler.assembleStatisticalData(vo); + storeAssembler.assembleStatisticalData(vo,query.getStartTime(),query.getEndTime()); return success(vo); } diff --git a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java index 7e9a334..2935f89 100644 --- a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java +++ b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java @@ -12,11 +12,13 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.ss.user.domain.UserQuery; import com.ruoyi.ss.user.service.IUserAssembler; import com.ruoyi.ss.user.service.IUserService; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import java.time.LocalDateTime; import java.util.List; /** @@ -80,14 +82,14 @@ public class UserController extends BaseController * 根据用户编号获取详细信息 */ @GetMapping(value = { "/", "/{userId}" }) - public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId,UserQuery query) { AjaxResult ajax = AjaxResult.success(); if (StringUtils.isNotNull(userId)) { UserVO user = eUserService.selectUserById(userId); // 拼接店铺数、房间数、设施数、设备数、总收入、总提现、总消费 - userAssembler.assembleStatisticalData(user); + userAssembler.assembleStatisticalData(user, query.getStartDate(), query.getEndDate()); ajax.put(AjaxResult.DATA_TAG, user); } return ajax; diff --git a/share-space-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java b/share-space-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java index c0b7f71..13d79a6 100644 --- a/share-space-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java +++ b/share-space-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java @@ -1087,24 +1087,43 @@ public class ServiceConstants { /**----------------------------设施类型end----------------------------*/ - /**----------------------------退款申请状态start----------------------------*/ +// /**----------------------------退款申请状态start----------------------------*/ +// +// /** +// * 退款申请状态: 1-待处理 +// */ +// public static final String REFUND_STATUS_PENDING = "1"; +// +// /** +// * 退款申请状态: 2-退款成功 +// */ +// public static final String REFUND_STATUS_SUCCESS = "2"; +// +// /** +// * 退款申请状态: 3-驳回 +// */ +// public static final String REFUND_STATUS_REJECTED = "3"; +// +// /**----------------------------退款申请状态end----------------------------*/ + + /**----------------------------退款订单状态start----------------------------*/ /** - * 退款申请状态: 1-待处理 + * 退款订单状态: 1-退款中 */ - public static final String REFUND_STATUS_PENDING = "1"; + public static final String REFUND_STATUS_PROCESSING = "1"; /** - * 退款申请状态: 2-退款成功 + * 退款订单状态: 2-退款成功 */ public static final String REFUND_STATUS_SUCCESS = "2"; /** - * 退款申请状态: 3-驳回 + * 退款订单状态: 3-退款失败 */ - public static final String REFUND_STATUS_REJECTED = "3"; + public static final String REFUND_STATUS_FAILED = "3"; - /**----------------------------退款申请状态end----------------------------*/ +/**----------------------------退款订单状态end----------------------------*/ /**----------------------------是否已退款start----------------------------*/ diff --git a/share-space-system/src/main/java/com/ruoyi/ss/callback/service/impl/CallbackServiceImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/callback/service/impl/CallbackServiceImpl.java index de1d897..089fc4d 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/callback/service/impl/CallbackServiceImpl.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/callback/service/impl/CallbackServiceImpl.java @@ -8,6 +8,7 @@ import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.pay.wx.domain.NotifyEventType; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ServiceUtil; +import com.ruoyi.common.utils.collection.CollectionUtils; import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.ss.callback.domain.CallbackLog; import com.ruoyi.ss.callback.mapper.CallbackLogMapper; @@ -22,6 +23,7 @@ import com.ruoyi.ss.order.domain.Order; import com.ruoyi.ss.order.domain.OrderVO; import com.ruoyi.ss.orderOper.service.IOrderOperService; import com.ruoyi.ss.payBill.domain.PayBill; +import com.ruoyi.ss.payBill.domain.PayBillQuery; import com.ruoyi.ss.payBill.domain.PayBillVO; import com.ruoyi.ss.payBill.domain.enums.PayBillStatus; import com.ruoyi.ss.payBill.service.PayBillService; @@ -407,17 +409,59 @@ public class CallbackServiceImpl implements ICallbackService { logger.info("【微信退款回调】转换成RefundNotification: {}", JSON.toJSONString(refundNotification)); etCallbackLog.setBody(JSON.toJSONString(refundNotification)); if (Status.SUCCESS.equals(refundNotification.getRefundStatus())) { - // 退款成功后 改变 etRefundService - // 如果outRefundNo没有值,说明是押金退款,直接新增退款记录, 还是在还车时新建退款记录? + /** + * 退款回调 + * 1.更新分成表的退款金额、结算金额 + * 2.更新订单中的退款金额 + * 3.金额、退款金额、结算金额 + * 4.更新退款表状态 + * */ + String outRefundNo = refundNotification.getOutRefundNo(); + Refund refund = etRefundService.selectEtRefundByRefundNo(outRefundNo); + ServiceUtil.assertion(refund == null, "退款记录不存在"); + + + + Boolean execute = transactionTemplate.execute(e -> { + // 1.更新分成表的退款金额、结算金额 + + + // 2.更新订单中的退款金额--金额、退款金额、结算金额 + + // 3.更新支付单中的退款金额 + + // 4.更新退款表状态为成功 + + + + + return Boolean.TRUE; + }); + if(Boolean.FALSE.equals(execute))throw new ServiceException("微信支付回调失败"); + + + + PayBill closeData = new PayBillVO(); + closeData.setStatus(PayBillStatus.CANCEL.getStatus()); + PayBillQuery updateQuery = new PayBillQuery(); + updateQuery.setStatusList(PayBillStatus.getCanCancelList()); + updateQuery.setPayId(refund.getPayId()); + int update = paymentService.updateByQuery(closeData, updateQuery); + + + Order order = new Order(); +// order.setOrderNo(refundNotification.getOutTradeNo()); +// orderService.updateRlOrderByOrderNo(); + + + // 更新退款表状态 + Refund rlRefund = new Refund(); rlRefund.setRefundNo(outRefundNo); - rlRefund.setRefundResult(Constants.SUCCESS2); + rlRefund.setStatus(REFUND_STATUS_SUCCESS);// int i = etRefundService.updateEtRefundByRefundNo(rlRefund); - if(i==0){ - logger.error("【微信退款回调】更新退款单失败"); - throw new ServiceException("【微信退款回调】更新退款单失败"); - } + ServiceUtil.assertion(i == 0, "【微信退款回调】更新退款单失败"); logger.info("【微信退款回调】全部结束!!!!!"); } } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/domain/DividendDetailQuery.java b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/domain/DividendDetailQuery.java index 3711452..087c9c7 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/domain/DividendDetailQuery.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/domain/DividendDetailQuery.java @@ -2,6 +2,7 @@ package com.ruoyi.ss.dividendDetail.domain; import lombok.Data; +import java.time.LocalDate; import java.time.LocalDateTime; @Data @@ -11,8 +12,8 @@ public class DividendDetailQuery extends DividendDetail{ private String agentName; /** 开始时间 */ - private LocalDateTime startTime; + private LocalDate startTime; /** 结束时间 */ - private LocalDateTime endTime; + private LocalDate endTime; } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/mapper/DividendDetailMapper.java b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/mapper/DividendDetailMapper.java index f82a0ab..a64d1ce 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/mapper/DividendDetailMapper.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/mapper/DividendDetailMapper.java @@ -90,4 +90,9 @@ public interface DividendDetailMapper * 查询收入 */ BigDecimal getIncome(DividendDetailQuery query ); + + /** + * 根据时间查询收入 + */ + List selectIncome(DividendDetailQuery query); } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/mapper/DividendDetailMapper.xml b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/mapper/DividendDetailMapper.xml index fc9a1a6..385cf05 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/mapper/DividendDetailMapper.xml +++ b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/mapper/DividendDetailMapper.xml @@ -115,6 +115,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into ss_dividend_detail diff --git a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/service/IDividendDetailService.java b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/service/IDividendDetailService.java index a70ba4f..53cc0db 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/service/IDividendDetailService.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/service/IDividendDetailService.java @@ -114,6 +114,14 @@ public interface IDividendDetailService */ List select30DaysIncome(Long merchantId); + /** + * 根据时间查询收入 + * @param query 查询条件 + * @return 结果 + */ + List selectIncome(DividendDetailQuery query); + + /** * 获取指定时间范围的收入 * @return 收入金额 diff --git a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/service/impl/DividendDetailServiceImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/service/impl/DividendDetailServiceImpl.java index 5934786..dc6a61d 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/service/impl/DividendDetailServiceImpl.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/dividendDetail/service/impl/DividendDetailServiceImpl.java @@ -154,6 +154,16 @@ public class DividendDetailServiceImpl implements IDividendDetailService return dividendDetailMapper.select30DaysIncome(merchantId); } + /** + * 根据时间查询收入 + * @param query 查询条件 + * @return 结果 + */ + @Override + public List selectIncome(DividendDetailQuery query) { + return dividendDetailMapper.selectIncome(query); + } + /** * 查询收入 * @return 结果 diff --git a/share-space-system/src/main/java/com/ruoyi/ss/order/domain/OrderQuery.java b/share-space-system/src/main/java/com/ruoyi/ss/order/domain/OrderQuery.java index e2b34f0..1846e9c 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/order/domain/OrderQuery.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/order/domain/OrderQuery.java @@ -3,6 +3,8 @@ package com.ruoyi.ss.order.domain; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.time.LocalDate; + @Data public class OrderQuery extends Order { @@ -12,6 +14,12 @@ public class OrderQuery extends Order { /** 结束时间*/ private String endTime; + /** 支付开始时间*/ + private LocalDate payStartTime; + + /** 支付结束时间*/ + private LocalDate payEndTime; + /** 手机号*/ private String phone; diff --git a/share-space-system/src/main/java/com/ruoyi/ss/order/mapper/OrderMapper.java b/share-space-system/src/main/java/com/ruoyi/ss/order/mapper/OrderMapper.java index 8234a64..88e5934 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/order/mapper/OrderMapper.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/order/mapper/OrderMapper.java @@ -4,6 +4,7 @@ import com.ruoyi.ss.order.domain.Order; import com.ruoyi.ss.order.domain.OrderQuery; import com.ruoyi.ss.order.domain.OrderVO; import com.ruoyi.ss.order.domain.vo.ReservedTimePeriod; +import com.ruoyi.system.domain.vo.InCome; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; @@ -171,6 +172,11 @@ public interface OrderMapper */ BigDecimal getOrderFee(OrderQuery rlOrder); + /** + * 统计营收(根据日期返回) + */ + List getInComeList(OrderQuery rlOrder); + // /** // * 扫码绑定车辆 // */ diff --git a/share-space-system/src/main/java/com/ruoyi/ss/order/mapper/OrderMapper.xml b/share-space-system/src/main/java/com/ruoyi/ss/order/mapper/OrderMapper.xml index 153e911..65e928e 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/order/mapper/OrderMapper.xml +++ b/share-space-system/src/main/java/com/ruoyi/ss/order/mapper/OrderMapper.xml @@ -133,6 +133,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and date_format(o.create_time,'%Y%m%d') <= date_format(#{endTime},'%Y%m%d') + and date(o.pay_time) >= #{payStartTime} + and date(o.pay_time) <= #{payEndTime} AND (o.phone LIKE CONCAT('%', #{keywords}, '%') OR o.order_no LIKE CONCAT('%', #{keywords}, '%')) @@ -334,6 +336,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into ss_order diff --git a/share-space-system/src/main/java/com/ruoyi/ss/order/service/IOrderService.java b/share-space-system/src/main/java/com/ruoyi/ss/order/service/IOrderService.java index b056a8c..9db46cd 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/order/service/IOrderService.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/order/service/IOrderService.java @@ -11,6 +11,7 @@ import com.ruoyi.ss.order.domain.dto.ReOrderDTO; import com.ruoyi.ss.order.domain.dto.TopUpOrderDTO; import com.ruoyi.ss.order.domain.vo.ReservedTimePeriod; import com.ruoyi.ss.refund.domain.Refund; +import com.ruoyi.system.domain.vo.InCome; import com.ruoyi.system.domain.vo.IndexAdminVo; import java.math.BigDecimal; @@ -267,5 +268,10 @@ public interface IOrderService */ BigDecimal getRevenueByTimeType(String timeType,OrderQuery query); + /** + * 统计营收(根据日期返回) + */ + List getInComeList(OrderQuery rlOrder); + } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/order/service/impl/OrderAssemblerImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/order/service/impl/OrderAssemblerImpl.java index eb18bc3..12a3475 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/order/service/impl/OrderAssemblerImpl.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/order/service/impl/OrderAssemblerImpl.java @@ -3,11 +3,15 @@ package com.ruoyi.ss.order.service.impl; import cn.hutool.core.util.ObjectUtil; import com.ruoyi.ss.order.domain.OrderVO; import com.ruoyi.ss.order.service.IOrderAssembler; +import com.ruoyi.ss.orderOper.domain.OrderOper; +import com.ruoyi.ss.orderOper.service.IOrderOperService; import com.ruoyi.ss.payBill.domain.PayBillVO; import com.ruoyi.ss.payBill.service.PayBillService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * 订单组装器 @@ -20,6 +24,10 @@ public class OrderAssemblerImpl implements IOrderAssembler { @Autowired private PayBillService paymentService; + + @Autowired + private IOrderOperService orderOperService; + /** * 拼接后台需要的订单信息 * @param order 房间对象 @@ -33,5 +41,11 @@ public class OrderAssemblerImpl implements IOrderAssembler { order.setPayNo(payBillVO.getPayNo()); order.setPayBillVO(payBillVO); } + + // 操作履历 + OrderOper orderOper = new OrderOper(); + orderOper.setOrderNo(order.getOrderNo()); + List list = orderOperService.selectRlOrderOperList(orderOper); + order.setOrderOpers(list); } } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/order/service/impl/OrderServiceImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/order/service/impl/OrderServiceImpl.java index 9364530..29250f0 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/order/service/impl/OrderServiceImpl.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/order/service/impl/OrderServiceImpl.java @@ -1276,8 +1276,8 @@ public class OrderServiceImpl implements IOrderService DividendDetailQuery dividendDetailQuery = new DividendDetailQuery(); dividendDetailQuery.setStatus(DIVIDEND_STATUS_PAID); dividendDetailQuery.setPartnerId(merchantId); - dividendDetailQuery.setStartTime(startTime); - dividendDetailQuery.setEndTime(now); + dividendDetailQuery.setStartTime(startTime.toLocalDate()); + dividendDetailQuery.setEndTime(now.toLocalDate()); return dividendDetailService.getIncome(dividendDetailQuery); } @@ -1388,5 +1388,12 @@ public class OrderServiceImpl implements IOrderService return orderMapper.getOrderFee(order); } + /** + * 统计营收(根据日期返回) + */ + public List getInComeList(OrderQuery rlOrder){ + return orderMapper.getInComeList(rlOrder); + } + } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/orderOper/mapper/OrderOperMapper.xml b/share-space-system/src/main/java/com/ruoyi/ss/orderOper/mapper/OrderOperMapper.xml index e4ae3a3..12283c2 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/orderOper/mapper/OrderOperMapper.xml +++ b/share-space-system/src/main/java/com/ruoyi/ss/orderOper/mapper/OrderOperMapper.xml @@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and oper_user_id = #{operUserId} and oper_phone = #{operPhone} - order by oper_id desc + order by create_time