Explorar el Código

套餐订单报表统计

wangxy hace 1 semana
padre
commit
7c6210083b

+ 11 - 0
fs-admin/src/main/java/com/fs/his/controller/FsPackageOrderController.java

@@ -69,6 +69,17 @@ public class FsPackageOrderController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 套餐订单报表
+     * @param param
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('his:packageOrder:report')")
+    @GetMapping("/packageOrderReport")
+    public AjaxResult  selectFsPackageOrderReportVO(FsPackageOrderParam param){
+        return AjaxResult.success(fsPackageOrderService.selectFsPackageOrderReportVO(param));
+    }
+
     /**
      * 导出套餐订单列表
      */

+ 8 - 4
fs-service/src/main/java/com/fs/his/mapper/FsPackageOrderMapper.java

@@ -8,10 +8,7 @@ import com.fs.his.domain.FsStorePayment;
 import com.fs.his.dto.PackageOrderDTO;
 import com.fs.his.param.FsPackageOrderListUParam;
 import com.fs.his.param.FsPackageOrderParam;
-import com.fs.his.vo.FsPackageOrderExcelVO;
-import com.fs.his.vo.FsPackageOrderListUVO;
-import com.fs.his.vo.FsPackageOrderListVO;
-import com.fs.his.vo.FsPackageOrderVO;
+import com.fs.his.vo.*;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -241,4 +238,11 @@ public interface FsPackageOrderMapper
     List<PackageOrderDTO> getNewOrder();
 
     List<FsPackageOrder> selectOutTimeOrderList(@Param("unPayTime") Integer unPayTime);
+
+    /**
+     * 套擦订单报表
+     * @param param
+     * @return
+     */
+    List<FsPackageOrderReportVO> selectFsPackageOrderReportVO(FsPackageOrderParam param);
 }

+ 3 - 4
fs-service/src/main/java/com/fs/his/service/IFsPackageOrderService.java

@@ -10,10 +10,7 @@ import com.fs.his.domain.FsPackageOrder;
 import com.fs.his.domain.FsStorePayment;
 import com.fs.his.dto.PackageOrderDTO;
 import com.fs.his.param.*;
-import com.fs.his.vo.FsPackageOrderExcelVO;
-import com.fs.his.vo.FsPackageOrderListUVO;
-import com.fs.his.vo.FsPackageOrderListVO;
-import com.fs.his.vo.FsPackageOrderVO;
+import com.fs.his.vo.*;
 import io.swagger.models.auth.In;
 
 /**
@@ -75,6 +72,8 @@ public interface IFsPackageOrderService
 
     List<FsPackageOrderListVO> selectFsPackageOrderListVO(FsPackageOrderParam fsPackageOrder);
 
+    List<FsPackageOrderReportVO> selectFsPackageOrderReportVO(FsPackageOrderParam param);
+
     Integer PackageOrderRefund(Long orderId);
 
     R confirmOrder(FsPackageOrderConfirmParam param);

+ 0 - 1
fs-service/src/main/java/com/fs/his/service/IFsStoreOrderService.java

@@ -201,7 +201,6 @@ public interface IFsStoreOrderService
 
     Boolean isEntityNull(FsStoreOrderParam param);
 
-
     FsStoreOrderExportDataVO selectFsStoreOrderExportDataVOByOrderId(long orderId);
 
     Long selectFsStoreOrderExcelListVOCount(FsStoreOrderParam fsStoreOrder);

+ 8 - 4
fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java

@@ -47,10 +47,7 @@ import com.fs.his.service.*;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.his.utils.HttpUtil;
 import com.fs.his.utils.PhoneUtil;
-import com.fs.his.vo.FsPackageOrderExcelVO;
-import com.fs.his.vo.FsPackageOrderListUVO;
-import com.fs.his.vo.FsPackageOrderListVO;
-import com.fs.his.vo.FsPackageOrderVO;
+import com.fs.his.vo.*;
 import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
 import com.fs.huifuPay.sdk.opps.core.utils.HuiFuUtils;
@@ -261,6 +258,13 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         return fsPackageOrderMapper.selectFsPackageOrderListVO(fsPackageOrder);
     }
 
+    @Override
+    public List<FsPackageOrderReportVO> selectFsPackageOrderReportVO(FsPackageOrderParam param) {
+        return fsPackageOrderMapper.selectFsPackageOrderReportVO(param);
+    }
+
+
+
     @Override
     public Integer PackageOrderRefund(Long orderId) {
         FsPackageOrder fsPackageOrder = fsPackageOrderMapper.selectFsPackageOrderByOrderId(orderId);

+ 41 - 0
fs-service/src/main/java/com/fs/his/vo/FsPackageOrderReportVO.java

@@ -0,0 +1,41 @@
+package com.fs.his.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class FsPackageOrderReportVO {
+
+    /**
+     * 公司名称
+     */
+    private String companyName;
+
+    /**
+     * 订单数
+     */
+    private Long orderNum;
+
+    /**
+     * 金额
+     */
+    private BigDecimal money;
+
+    /**
+     * 确认收货订单数
+     */
+    private Long receiptOrder;
+
+    /**
+     * 确认收货金额
+     */
+    private  BigDecimal receiptMoney;
+
+    /**
+     * 销售部门
+     */
+    private  String  deptName;
+
+
+}

+ 39 - 0
fs-service/src/main/resources/mapper/his/FsPackageOrderMapper.xml

@@ -320,4 +320,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectOutTimeOrderList" resultType="com.fs.his.domain.FsPackageOrder">
         select * from fs_package_order  where status = 1 AND NOW() &gt; DATE_ADD(create_time, INTERVAL ${unPayTime} MINUTE)
     </select>
+    <select id="selectFsPackageOrderReportVO" resultType="com.fs.his.vo.FsPackageOrderReportVO">
+        SELECT
+        c.company_name companyName,
+        <if test="deptId != null and deptId != ''">
+            cd.dept_name AS deptName,
+        </if>
+        COUNT(po.order_id) AS orderNum,
+        COALESCE(SUM(po.pay_money), 0) AS money,
+        COUNT(CASE WHEN so.status = 3 THEN po.order_id END) AS receiptOrder,
+        COALESCE(SUM(CASE WHEN so.status = 3 THEN po.pay_money ELSE 0 END), 0) AS receiptMoney
+        FROM
+        fs_package_order po
+        inner join company c ON po.company_id = c.company_id
+        <if test="deptId != null and deptId != ''">
+            inner join company_dept cd ON c.dept_id = cd.dept_id
+        </if>
+        inner join fs_store_order so ON po.order_id = so.order_id
+        <where>
+            <if test="companyId != null and companyId != ''">
+                AND po.company_id = #{companyId}
+            </if>
+            <if test="deptId != null and deptId != ''">
+                AND c.dept_id = #{deptId}
+            </if>
+            <!-- 添加时间段查询条件 -->
+            <if test="stTime != null">
+                AND DATE(po.start_time) &gt;= DATE(#{stTime})
+            </if>
+            <if test="endTime != null">
+                AND DATE(po.finish_time) &lt;= DATE(#{endEndTime})
+            </if>
+        </where>
+        GROUP BY
+        po.company_id,
+        c.company_name
+        <if test="deptId != null and deptId != ''">
+            , cd.dept_name
+        </if>
+    </select>
 </mapper>