Bläddra i källkod

增加对账管理,订单查询和导出增加已支付和已退款状态

wanxl 1 år sedan
förälder
incheckning
b05ac9f1c4

+ 3 - 1
src/main/java/com/sqx/modules/order/dto/OrderQueryDto.java

@@ -10,7 +10,7 @@ public class OrderQueryDto extends PageQuery {
 
     @ApiModelProperty("操作人id 导出用")
     private String userId;
-    @ApiModelProperty("订单状态 0待结算 1待支付 2直接购买(未支付) 7商家待接单 8商家拒绝接单 6制作中  3待取餐/派送中 4已完成 5已取消 13外卖待接单")
+    @ApiModelProperty("订单状态 0待结算 1待支付 2直接购买(未支付) 7商家待接单 8商家拒绝接单 6制作中  3待取餐/派送中 4已完成 5已取消 13外卖待接单,14已退款,15已支付")
     private Integer status;
     @ApiModelProperty("用户手机号")
     private String phone;
@@ -116,6 +116,8 @@ public class OrderQueryDto extends PageQuery {
             case 7: return "商家待接单";
             case 8: return "商家拒绝接单";
             case 0: return "待结算";
+            case 14: return "已退款";
+            case 15: return "已支付";
             default: return state+"";
         }
     }

+ 21 - 0
src/main/java/com/sqx/modules/reconciliation/controller/PlatformBillController.java

@@ -0,0 +1,21 @@
+package com.sqx.modules.reconciliation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 对账管理表 前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2025-02-27
+ */
+@RestController
+@RequestMapping("/reconciliation/platform-bill")
+public class PlatformBillController {
+
+}
+

+ 16 - 0
src/main/java/com/sqx/modules/reconciliation/mapper/PlatformBillMapper.java

@@ -0,0 +1,16 @@
+package com.sqx.modules.reconciliation.mapper;
+
+import com.sqx.modules.reconciliation.model.PlatformBill;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 对账管理表 Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2025-02-27
+ */
+public interface PlatformBillMapper extends BaseMapper<PlatformBill> {
+
+}

+ 98 - 0
src/main/java/com/sqx/modules/reconciliation/model/PlatformBill.java

@@ -0,0 +1,98 @@
+package com.sqx.modules.reconciliation.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 对账管理表
+ * </p>
+ *
+ * @author ceshi
+ * @since 2025-02-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="PlatformBill对象", description="对账管理表")
+public class PlatformBill implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "id")
+    @TableId(value = "bill_id", type = IdType.AUTO)
+    private Integer billId;
+
+    @ApiModelProperty(value = "账期")
+    private String dayId;
+
+    @ApiModelProperty(value = "关联用户id")
+    private String userId;
+
+    @ApiModelProperty(value = "店铺名称")
+    private String shopName;
+
+    @ApiModelProperty(value = "对账类型 1商户 2骑手 0平台")
+    private String type;
+
+    @ApiModelProperty(value = "期初金额")
+    private String startMoney;
+
+    @ApiModelProperty(value = "总收入")
+    private String revenue;
+
+    @ApiModelProperty(value = "收入笔数")
+    private String revenueCount;
+
+    @ApiModelProperty(value = "商家提现金额")
+    private String shopPayouts;
+
+    @ApiModelProperty(value = "商家提现手续费")
+    private String shopPayoutsRates;
+
+    @ApiModelProperty(value = "商家提现笔数")
+    private String shopPayoutsCount;
+
+    @ApiModelProperty(value = "骑手提现")
+    private String riderPayouts;
+
+    @ApiModelProperty(value = "骑手提现手续费")
+    private String riderPayoutsRates;
+
+    @ApiModelProperty(value = "骑手提现笔数")
+    private String riderPayoutsCount;
+
+    @ApiModelProperty(value = "退款金额")
+    private String refundMoney;
+
+    @ApiModelProperty(value = "退款笔数")
+    private String refundCount;
+
+    @ApiModelProperty(value = "期末金额")
+    private String endMoney;
+
+    @ApiModelProperty(value = "平台抽成手续费")
+    private String platformRates;
+
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
+    private Date updateTime;
+
+
+}

+ 16 - 0
src/main/java/com/sqx/modules/reconciliation/service/PlatformBillService.java

@@ -0,0 +1,16 @@
+package com.sqx.modules.reconciliation.service;
+
+import com.sqx.modules.reconciliation.model.PlatformBill;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 对账管理表 服务类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2025-02-27
+ */
+public interface PlatformBillService extends IService<PlatformBill> {
+
+}

+ 20 - 0
src/main/java/com/sqx/modules/reconciliation/service/impl/PlatformBillServiceImpl.java

@@ -0,0 +1,20 @@
+package com.sqx.modules.reconciliation.service.impl;
+
+import com.sqx.modules.reconciliation.model.PlatformBill;
+import com.sqx.modules.reconciliation.mapper.PlatformBillMapper;
+import com.sqx.modules.reconciliation.service.PlatformBillService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 对账管理表 服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2025-02-27
+ */
+@Service
+public class PlatformBillServiceImpl extends ServiceImpl<PlatformBillMapper, PlatformBill> implements PlatformBillService {
+
+}

+ 43 - 0
src/main/java/com/sqx/scheduler/reconciliation/BillsScheduler.java

@@ -0,0 +1,43 @@
+package com.sqx.scheduler.reconciliation;
+
+import com.sqx.modules.coupon.service.TbCouponUserService;
+import com.sqx.scheduler.config.SchedulerLock;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.redisson.api.RLock;
+import org.redisson.api.RedissonClient;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+/**
+ * 对账定时任务
+ *
+ * @author : codingliang
+ * @date : 2024-09-09 12:22
+ */
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class BillsScheduler {
+
+    private final TbCouponUserService tbCouponUserService;
+
+    /**
+     * 将所有超过失效时间的优惠券改为失效状态
+     * 每分钟运行一次
+     */
+    @Async
+    @Scheduled(cron = "0 */1 * * * ?", zone = "Asia/Shanghai")
+    public void couponEnd(){
+
+        try {
+            log.info("用户优惠券自动过期任务运行");
+            tbCouponUserService.updateExpiration();
+            log.info("用户优惠券自动过期任务运行成功");
+        } catch (Exception e) {
+            log.error("用户优惠券自动过期任务运行失败,【{}】", e);
+        }
+
+    }
+}

+ 6 - 6
src/main/resources/mapper/dataCentre/dataCenterMapper.xml

@@ -511,28 +511,28 @@
     </select>
 
     <select id="cancelOrderCount" resultType="int">
-        select count(*) from tb_order where status = 5
+        select count(*) from tb_order where status in (5,8)
         <if test="query.shopId!=null">
             and shop_id = #{query.shopId}
         </if>
         <if test="query.startTime!=null and query.startTime!=''">
-            and create_time>=#{query.startTime}
+            and update_time>=#{query.startTime}
         </if>
         <if test="query.endTime!=null and query.endTime!=''">
-            and create_time <![CDATA[<=]]> #{query.endTime}
+            and update_time <![CDATA[<=]]> #{query.endTime}
         </if>
     </select>
 
     <select id="cancelOrderMoney" resultType="java.math.BigDecimal">
-        select ifnull(sum(pay_money), 0) from tb_order where status = 5
+        select ifnull(sum(pay_money), 0) from tb_order where status in (5,8)
         <if test="query.shopId!=null">
             and shop_id = #{query.shopId}
         </if>
         <if test="query.startTime!=null and query.startTime!=''">
-            and create_time>=#{query.startTime}
+            and update_time>=#{query.startTime}
         </if>
         <if test="query.endTime!=null and query.endTime!=''">
-            and create_time <![CDATA[<=]]> #{query.endTime}
+            and update_time <![CDATA[<=]]> #{query.endTime}
         </if>
     </select>
 

+ 66 - 18
src/main/resources/mapper/order/OrderMapper.xml

@@ -121,12 +121,28 @@
         <if test="query.orderNumber!=null and query.orderNumber!=''">
             and tor.order_number = #{query.orderNumber}
         </if>
-        <if test="query.status!=null and query.status!=-1 and query.status!=1">
-            and tor.status = #{query.status}
-        </if>
-        <if test="query.status!=null and query.status==1">
-            and tor.status in (1,2)
-        </if>
+        <choose>
+            <when test="query.status!=null and query.status==1">
+                and tor.status in (1,2)
+            </when>
+            <when test="query.status!=null and query.status==14">
+                and tor.status in (5,8)
+            </when>
+            <when test="query.status!=null and query.status==15">
+                and tor.status in (3,4,6,7)
+            </when>
+            <when test="query.status!=null">
+                and tor.status = #{query.status}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+<!--        <if test="query.status!=null and query.status!=-1 and query.status!=1">-->
+<!--            and tor.status = #{query.status}-->
+<!--        </if>-->
+<!--        <if test="query.status!=null and query.status==1">-->
+<!--            and tor.status in (1,2)-->
+<!--        </if>-->
         <if test="query.shopId!=null">
             and tor.shop_id = #{query.shopId}
         </if>
@@ -205,12 +221,28 @@
         <if test="query.orderNumber!=null and query.orderNumber!=''">
             and tor.order_number = #{query.orderNumber}
         </if>
-        <if test="query.status!=null and query.status!=-1 and query.status!=1">
-            and tor.status = #{query.status}
-        </if>
-        <if test="query.status!=null and query.status==1">
-            and tor.status in (1,2)
-        </if>
+        <choose>
+            <when test="query.status!=null and query.status==1">
+                and tor.status in (1,2)
+            </when>
+            <when test="query.status!=null and query.status==14">
+                and tor.status in (5,8)
+            </when>
+            <when test="query.status!=null and query.status==15">
+                and tor.status in (3,4,6,7)
+            </when>
+            <when test="query.status!=null">
+                and tor.status = #{query.status}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+<!--        <if test="query.status!=null and query.status!=-1 and query.status!=1">-->
+<!--            and tor.status = #{query.status}-->
+<!--        </if>-->
+<!--        <if test="query.status!=null and query.status==1">-->
+<!--            and tor.status in (1,2)-->
+<!--        </if>-->
         <if test="query.shopId!=null">
             and tor.shop_id = #{query.shopId}
         </if>
@@ -630,12 +662,28 @@
         <if test="query.orderNumber!=null and query.orderNumber!=''">
             and tor.order_number = #{query.orderNumber}
         </if>
-        <if test="query.status!=null and query.status!=-1 and query.status!=1">
-            and tor.status = #{query.status}
-        </if>
-        <if test="query.status!=null and query.status==1">
-            and tor.status in (1,2)
-        </if>
+        <choose>
+            <when test="query.status!=null and query.status==1">
+                and tor.status in (1,2)
+            </when>
+            <when test="query.status!=null and query.status==14">
+                and tor.status in (5,8)
+            </when>
+            <when test="query.status!=null and query.status==15">
+                and tor.status in (3,4,6,7)
+            </when>
+            <when test="query.status!=null">
+                and tor.status = #{query.status}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+<!--        <if test="query.status!=null and query.status!=-1 and query.status!=1">-->
+<!--            and tor.status = #{query.status}-->
+<!--        </if>-->
+<!--        <if test="query.status!=null and query.status==1">-->
+<!--            and tor.status in (1,2)-->
+<!--        </if>-->
         <if test="query.shopId!=null">
             and tor.shop_id = #{query.shopId}
         </if>