Ver Fonte

谷物订单添加报表信息

wangxy há 6 dias atrás
pai
commit
78a193b818

+ 33 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsRejectNoReturnController.java

@@ -13,6 +13,7 @@ import com.fs.his.domain.FsExternalOrder;
 import com.fs.his.domain.vo.FsRejectNoReturnReportVO;
 import com.fs.his.mapper.FsStoreOrderMapper;
 import com.fs.his.mapper.FsExternalOrderMapper;
+import com.fs.his.mapper.FsGuCoinOrderMapper;
 import com.fs.his.param.FsStoreOrderParam;
 import com.fs.his.service.IFsExternalOrderService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +40,9 @@ public class FsRejectNoReturnController extends BaseController {
     @Autowired
     private FsExternalOrderMapper fsExternalOrderMapper;
 
+    @Autowired
+    private FsGuCoinOrderMapper fsGuCoinOrderMapper;
+
     /**
      * 拒收未还货列表
      */
@@ -96,4 +100,33 @@ public class FsRejectNoReturnController extends BaseController {
         ExcelUtil<FsRejectNoReturnReportVO> util = new ExcelUtil<>(FsRejectNoReturnReportVO.class);
         return util.exportExcel(list, "拒收未还货报表(药品)");
     }
+
+    /**
+     * 拒收未还货列表(谷币订单)
+     */
+    @GetMapping("/guCoinList")
+    @Log(title = "拒收未还货查询列表(谷币)", businessType = BusinessType.OTHER)
+    @PreAuthorize("@ss.hasPermi('store:rejectNoReturn:list')")
+    public TableDataInfo guCoinList(FsStoreOrderParam param) {
+        startPage();
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        List<FsRejectNoReturnReportVO> list = fsGuCoinOrderMapper.selectGuCoinRejectNoReturnReport(param);
+        java.util.Map<String, Object> summary = fsGuCoinOrderMapper.selectGuCoinRejectNoReturnReportSum(param);
+        return getDataTable(list, summary);
+    }
+
+    /**
+     * 拒收未还货导出(谷币订单)
+     */
+    @GetMapping("/guCoinExport")
+    @Log(title = "拒收未还货查询导出(谷币)", businessType = BusinessType.EXPORT)
+    @PreAuthorize("@ss.hasPermi('store:rejectNoReturn:list')")
+    public AjaxResult guCoinExport(FsStoreOrderParam param) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        List<FsRejectNoReturnReportVO> list = fsGuCoinOrderMapper.selectGuCoinRejectNoReturnReport(param);
+        ExcelUtil<FsRejectNoReturnReportVO> util = new ExcelUtil<>(FsRejectNoReturnReportVO.class);
+        return util.exportExcel(list, "拒收未还货报表(谷币)");
+    }
 }

+ 62 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsRejectReportController.java

@@ -14,6 +14,7 @@ import com.fs.his.domain.vo.FsRejectOrderReportVO;
 import com.fs.his.domain.vo.FsRejectProductReportVO;
 import com.fs.his.mapper.FsStoreOrderMapper;
 import com.fs.his.mapper.FsExternalOrderMapper;
+import com.fs.his.mapper.FsGuCoinOrderMapper;
 import com.fs.his.param.FsStoreOrderParam;
 import com.fs.his.service.IFsExternalOrderService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,6 +41,9 @@ public class FsRejectReportController extends BaseController {
     @Autowired
     private FsExternalOrderMapper fsExternalOrderMapper;
 
+    @Autowired
+    private FsGuCoinOrderMapper fsGuCoinOrderMapper;
+
     /**
      * 拒收明细 - 订单维度列表
      */
@@ -155,4 +159,62 @@ public class FsRejectReportController extends BaseController {
         ExcelUtil<FsRejectProductReportVO> util = new ExcelUtil<>(FsRejectProductReportVO.class);
         return util.exportExcel(list, "拒收明细产品报表(药品)");
     }
+
+    /**
+     * 拒收明细(谷币订单) - 订单维度列表
+     */
+    @GetMapping("/guCoinOrderList")
+    @Log(title = "拒收明细报表(谷币)订单维度", businessType = BusinessType.OTHER)
+    @PreAuthorize("@ss.hasPermi('store:rejectReport:list')")
+    public TableDataInfo guCoinOrderList(FsStoreOrderParam param) {
+        startPage();
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        List<FsRejectOrderReportVO> list = fsGuCoinOrderMapper.selectGuCoinRejectOrderReport(param);
+        java.util.Map<String, Object> summary = fsGuCoinOrderMapper.selectGuCoinRejectOrderReportSum(param);
+        return getDataTable(list, summary);
+    }
+
+    /**
+     * 拒收明细(谷币订单) - 订单维度导出
+     */
+    @GetMapping("/guCoinOrderExport")
+    @Log(title = "拒收明细报表(谷币)订单维度导出", businessType = BusinessType.EXPORT)
+    @PreAuthorize("@ss.hasPermi('store:rejectReport:list')")
+    public AjaxResult guCoinOrderExport(FsStoreOrderParam param) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        List<FsRejectOrderReportVO> list = fsGuCoinOrderMapper.selectGuCoinRejectOrderReport(param);
+        ExcelUtil<FsRejectOrderReportVO> util = new ExcelUtil<>(FsRejectOrderReportVO.class);
+        return util.exportExcel(list, "拒收明细订单报表(谷币)");
+    }
+
+    /**
+     * 拒收明细(谷币订单) - 产品维度列表
+     */
+    @GetMapping("/guCoinProductList")
+    @Log(title = "拒收明细报表(谷币)产品维度", businessType = BusinessType.OTHER)
+    @PreAuthorize("@ss.hasPermi('store:rejectReport:list')")
+    public TableDataInfo guCoinProductList(FsStoreOrderParam param) {
+        startPage();
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        List<FsRejectProductReportVO> list = fsGuCoinOrderMapper.selectGuCoinRejectProductReport(param);
+        java.util.Map<String, Object> summary = fsGuCoinOrderMapper.selectGuCoinRejectProductReportSum(param);
+        return getDataTable(list, summary);
+    }
+
+    /**
+     * 拒收明细(谷币订单) - 产品维度导出
+     */
+    @GetMapping("/guCoinProductExport")
+    @Log(title = "拒收明细报表(谷币)产品维度导出", businessType = BusinessType.EXPORT)
+    @PreAuthorize("@ss.hasPermi('store:rejectReport:list')")
+    public AjaxResult guCoinProductExport(FsStoreOrderParam param) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        List<FsRejectProductReportVO> list = fsGuCoinOrderMapper.selectGuCoinRejectProductReport(param);
+        ExcelUtil<FsRejectProductReportVO> util = new ExcelUtil<>(FsRejectProductReportVO.class);
+        return util.exportExcel(list, "拒收明细产品报表(谷币)");
+    }
 }

+ 28 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsSignDetailReportController.java

@@ -9,6 +9,7 @@ import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.his.domain.FsExternalOrder;
 import com.fs.his.domain.vo.FsSignDetailReportVO;
 import com.fs.his.mapper.FsStoreOrderMapper;
+import com.fs.his.mapper.FsGuCoinOrderMapper;
 import com.fs.his.param.FsStoreOrderParam;
 import com.fs.his.service.IFsExternalOrderService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,9 @@ public class FsSignDetailReportController extends BaseController {
     @Autowired
     private FsStoreOrderMapper fsStoreOrderMapper;
 
+    @Autowired
+    private FsGuCoinOrderMapper fsGuCoinOrderMapper;
+
     /**
      * 签收情况明细列表(所有公司、部门维度统计)
      */
@@ -79,4 +83,28 @@ public class FsSignDetailReportController extends BaseController {
         ExcelUtil<FsSignDetailReportVO> util = new ExcelUtil<>(FsSignDetailReportVO.class);
         return util.exportExcel(list, "签收情况明细表(药品)");
     }
+
+    /**
+     * 签收情况明细列表(谷币订单)
+     */
+    @GetMapping("/guCoinList")
+    @Log(title = "签收情况明细表查询(谷币)", businessType = BusinessType.OTHER)
+    @PreAuthorize("@ss.hasPermi('store:signDetailReport:list')")
+    public TableDataInfo guCoinList(FsStoreOrderParam param) {
+        startPage();
+        List<FsSignDetailReportVO> list = fsGuCoinOrderMapper.selectGuCoinSignDetailReport(param);
+        return getDataTable(list);
+    }
+
+    /**
+     * 签收情况明细导出(谷币订单)
+     */
+    @GetMapping("/guCoinExport")
+    @Log(title = "签收情况明细表导出(谷币)", businessType = BusinessType.EXPORT)
+    @PreAuthorize("@ss.hasPermi('store:signDetailReport:list')")
+    public AjaxResult guCoinExport(FsStoreOrderParam param) {
+        List<FsSignDetailReportVO> list = fsGuCoinOrderMapper.selectGuCoinSignDetailReport(param);
+        ExcelUtil<FsSignDetailReportVO> util = new ExcelUtil<>(FsSignDetailReportVO.class);
+        return util.exportExcel(list, "签收情况明细表(谷币)");
+    }
 }

+ 1 - 1
fs-service/src/main/java/com/fs/his/domain/vo/FsSignDetailReportVO.java

@@ -11,7 +11,7 @@ import java.math.BigDecimal;
 @Data
 public class FsSignDetailReportVO {
 
-    @Excel(name = "订单类型", readConverterExp = "1=外部订单,2=套餐包,3=问诊,4=积分")
+    @Excel(name = "订单类型", readConverterExp = "1=外部订单,2=套餐包,3=问诊,4=积分,5=谷币")
     private Integer orderType;
 
     @Excel(name = "发货数量")

+ 28 - 0
fs-service/src/main/java/com/fs/his/mapper/FsGuCoinOrderMapper.java

@@ -1,8 +1,13 @@
 package com.fs.his.mapper;
 
 import com.fs.his.domain.FsGuCoinOrder;
+import com.fs.his.domain.vo.FsRejectNoReturnReportVO;
+import com.fs.his.domain.vo.FsRejectOrderReportVO;
+import com.fs.his.domain.vo.FsRejectProductReportVO;
+import com.fs.his.domain.vo.FsSignDetailReportVO;
 import com.fs.his.param.FsGuCoinOrderListUParam;
 import com.fs.his.param.FsGuCoinOrderParam;
+import com.fs.his.param.FsStoreOrderParam;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -45,4 +50,27 @@ public interface FsGuCoinOrderMapper {
     /** 查询待同步发货状态的谷币订单(已推送聚水潭且仍待发货) */
     @Select("select order_code, extend_order_id from fs_gu_coin_order where extend_order_id is not null and status = 1")
     List<FsGuCoinOrder> selectJstOmsGuCoinOrderdeliveryOp();
+
+    // ========== 报表查询 ==========
+
+    /** 拒收明细报表 - 订单维度 */
+    List<FsRejectOrderReportVO> selectGuCoinRejectOrderReport(FsStoreOrderParam param);
+
+    /** 拒收明细报表 - 订单维度合计 */
+    java.util.Map<String, Object> selectGuCoinRejectOrderReportSum(FsStoreOrderParam param);
+
+    /** 拒收明细报表 - 产品维度 */
+    List<FsRejectProductReportVO> selectGuCoinRejectProductReport(FsStoreOrderParam param);
+
+    /** 拒收明细报表 - 产品维度合计 */
+    java.util.Map<String, Object> selectGuCoinRejectProductReportSum(FsStoreOrderParam param);
+
+    /** 拒收未还货报表 */
+    List<FsRejectNoReturnReportVO> selectGuCoinRejectNoReturnReport(FsStoreOrderParam param);
+
+    /** 拒收未还货合计 */
+    java.util.Map<String, Object> selectGuCoinRejectNoReturnReportSum(FsStoreOrderParam param);
+
+    /** 签收情况明细表 */
+    List<FsSignDetailReportVO> selectGuCoinSignDetailReport(FsStoreOrderParam param);
 }

+ 263 - 0
fs-service/src/main/resources/mapper/his/FsGuCoinOrderMapper.xml

@@ -206,4 +206,267 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{orderId}
         </foreach>
     </delete>
+
+    <!-- ========== 报表查询 ========== -->
+
+    <!-- 拒收明细报表 - 订单维度 -->
+    <select id="selectGuCoinRejectOrderReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsRejectOrderReportVO">
+        SELECT
+            o.order_code AS orderCode,
+            o.delivery_sn AS deliverySn,
+            o.user_name AS userName,
+            o.create_time AS externalCreateTime,
+            o.delivery_time AS deliveryTime,
+            o.total_money AS totalPrice,
+            o.delivery_name AS deliveryName,
+            o.follow_time AS followTime,
+            o.reject_return_time AS rejectReturnTime,
+            o.delivery_status_update_by AS rejectUser,
+            o.user_phone AS userPhone,
+            o.user_phone AS memberPhone,
+            cu.user_name AS companyUserName,
+            REPLACE(REPLACE(REPLACE(
+                CAST(IFNULL(JSON_EXTRACT(o.item_json, '$[*].goodsName'), '[]') AS CHAR),
+                '","', ','), '["', ''), '"]', '') AS productNames,
+            o.user_address AS userAddress
+        FROM fs_gu_coin_order o
+        LEFT JOIN company c ON o.company_id = c.company_id
+        LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
+        LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
+        <where>
+            o.delivery_status IN (4, 5, 6)
+            <if test="orderCode != null and orderCode != ''"> AND o.order_code = #{orderCode}</if>
+            <if test="deliverySn != null and deliverySn != ''"> AND o.delivery_sn = #{deliverySn}</if>
+            <if test="userName != null and userName != ''"> AND o.user_name LIKE CONCAT('%', #{userName}, '%')</if>
+            <if test="userAddress != null and userAddress != ''"> AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
+            <if test="sTime != null"> AND o.create_time &gt;= #{sTime}</if>
+            <if test="eTime != null"> AND o.create_time &lt;= #{eTime}</if>
+            <if test="totalPrice != null"> AND o.total_money = #{totalPrice}</if>
+            <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
+            <if test="rejectReturnTimeStart != null and rejectReturnTimeStart != ''"> AND o.reject_return_time &gt;= #{rejectReturnTimeStart}</if>
+            <if test="rejectReturnTimeEnd != null and rejectReturnTimeEnd != ''"> AND o.reject_return_time &lt;= #{rejectReturnTimeEnd}</if>
+            <if test="returnUser != null and returnUser != ''"> AND o.delivery_status_update_by LIKE CONCAT('%', #{returnUser}, '%')</if>
+            <if test="userPhone != null and userPhone != ''"> AND o.user_phone LIKE CONCAT('%', #{userPhone}, '%')</if>
+            <if test="companyUserName != null and companyUserName != ''"> AND cu.user_name LIKE CONCAT('%', #{companyUserName}, '%')</if>
+            <if test="deliveryStartTime != null"> AND o.delivery_time &gt;= #{deliveryStartTime}</if>
+            <if test="deliveryEndTime != null"> AND o.delivery_time &lt;= #{deliveryEndTime}</if>
+            <if test="companyId != null"> AND o.company_id = #{companyId}</if>
+        </where>
+        GROUP BY o.order_id
+        <if test="productName != null and productName != ''">
+            HAVING REPLACE(REPLACE(REPLACE(
+                CAST(IFNULL(JSON_EXTRACT(o.item_json, '$[*].goodsName'), '[]') AS CHAR),
+                '","', ','), '["', ''), '"]', '') LIKE CONCAT('%', #{productName}, '%')
+        </if>
+        ORDER BY o.order_id DESC
+    </select>
+
+    <!-- 拒收明细报表 - 订单维度合计 -->
+    <select id="selectGuCoinRejectOrderReportSum" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="java.util.Map">
+        SELECT
+            SUM(t.totalPrice) AS totalPrice
+        FROM (
+            SELECT
+                o.total_money AS totalPrice
+            FROM fs_gu_coin_order o
+            LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
+            <where>
+                o.delivery_status IN (4, 5, 6)
+                <if test="orderCode != null and orderCode != ''"> AND o.order_code = #{orderCode}</if>
+                <if test="deliverySn != null and deliverySn != ''"> AND o.delivery_sn = #{deliverySn}</if>
+                <if test="userName != null and userName != ''"> AND o.user_name LIKE CONCAT('%', #{userName}, '%')</if>
+                <if test="userAddress != null and userAddress != ''"> AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
+                <if test="sTime != null"> AND o.create_time &gt;= #{sTime}</if>
+                <if test="eTime != null"> AND o.create_time &lt;= #{eTime}</if>
+                <if test="totalPrice != null"> AND o.total_money = #{totalPrice}</if>
+                <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
+                <if test="rejectReturnTimeStart != null and rejectReturnTimeStart != ''"> AND o.reject_return_time &gt;= #{rejectReturnTimeStart}</if>
+                <if test="rejectReturnTimeEnd != null and rejectReturnTimeEnd != ''"> AND o.reject_return_time &lt;= #{rejectReturnTimeEnd}</if>
+                <if test="returnUser != null and returnUser != ''"> AND o.delivery_status_update_by LIKE CONCAT('%', #{returnUser}, '%')</if>
+                <if test="userPhone != null and userPhone != ''"> AND o.user_phone LIKE CONCAT('%', #{userPhone}, '%')</if>
+                <if test="companyUserName != null and companyUserName != ''"> AND cu.user_name LIKE CONCAT('%', #{companyUserName}, '%')</if>
+                <if test="deliveryStartTime != null"> AND o.delivery_time &gt;= #{deliveryStartTime}</if>
+                <if test="deliveryEndTime != null"> AND o.delivery_time &lt;= #{deliveryEndTime}</if>
+                <if test="companyId != null"> AND o.company_id = #{companyId}</if>
+            </where>
+            GROUP BY o.order_id
+            <if test="productName != null and productName != ''">
+                HAVING REPLACE(REPLACE(REPLACE(
+                    CAST(IFNULL(JSON_EXTRACT(o.item_json, '$[*].goodsName'), '[]') AS CHAR),
+                    '","', ','), '["', ''), '"]', '') LIKE CONCAT('%', #{productName}, '%')
+            </if>
+        ) t
+    </select>
+
+    <!-- 拒收明细报表 - 产品维度 -->
+    <select id="selectGuCoinRejectProductReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsRejectProductReportVO">
+        SELECT
+            t.productName AS productName,
+            t.deliveryName AS deliveryName,
+            SUM(t.num) AS num,
+            SUM(t.num * t.price) AS totalPrice
+        FROM (
+            SELECT
+                o.delivery_name AS deliveryName,
+                JSON_UNQUOTE(JSON_EXTRACT(o.item_json, CONCAT('$[', seq.idx, '].goodsName'))) AS productName,
+                CAST(JSON_UNQUOTE(JSON_EXTRACT(o.item_json, CONCAT('$[', seq.idx, '].num'))) AS DECIMAL(10,0)) AS num,
+                CAST(JSON_UNQUOTE(JSON_EXTRACT(o.item_json, CONCAT('$[', seq.idx, '].price'))) AS DECIMAL(10,2)) AS price
+            FROM fs_gu_coin_order o
+            LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
+            CROSS JOIN (SELECT 0 AS idx UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) seq
+            <where>
+                o.delivery_status IN (4, 5, 6)
+                AND JSON_EXTRACT(o.item_json, CONCAT('$[', seq.idx, '].goodsName')) IS NOT NULL
+                <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
+                <if test="companyId != null"> AND o.company_id = #{companyId}</if>
+            </where>
+        ) t
+        <where>
+            <if test="productName != null and productName != ''"> AND t.productName LIKE CONCAT('%', #{productName}, '%')</if>
+        </where>
+        GROUP BY t.deliveryName, t.productName
+        <if test="totalNum != null or totalPrice != null">
+            HAVING 1=1
+            <if test="totalNum != null"> AND SUM(t.num) = #{totalNum}</if>
+            <if test="totalPrice != null"> AND SUM(t.num * t.price) = #{totalPrice}</if>
+        </if>
+        ORDER BY t.deliveryName, t.productName
+    </select>
+
+    <!-- 拒收明细报表 - 产品维度合计 -->
+    <select id="selectGuCoinRejectProductReportSum" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="java.util.Map">
+        SELECT
+            SUM(t.num) AS num,
+            SUM(t.totalPrice) AS totalPrice
+        FROM (
+            SELECT
+                t2.deliveryName,
+                t2.productName,
+                SUM(t2.num) AS num,
+                SUM(t2.num * t2.price) AS totalPrice
+            FROM (
+                SELECT
+                    o.delivery_name AS deliveryName,
+                    JSON_UNQUOTE(JSON_EXTRACT(o.item_json, CONCAT('$[', seq.idx, '].goodsName'))) AS productName,
+                    CAST(JSON_UNQUOTE(JSON_EXTRACT(o.item_json, CONCAT('$[', seq.idx, '].num'))) AS DECIMAL(10,0)) AS num,
+                    CAST(JSON_UNQUOTE(JSON_EXTRACT(o.item_json, CONCAT('$[', seq.idx, '].price'))) AS DECIMAL(10,2)) AS price
+                FROM fs_gu_coin_order o
+                LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
+                CROSS JOIN (SELECT 0 AS idx UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) seq
+                <where>
+                    o.delivery_status IN (4, 5, 6)
+                    AND JSON_EXTRACT(o.item_json, CONCAT('$[', seq.idx, '].goodsName')) IS NOT NULL
+                    <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
+                    <if test="companyId != null"> AND o.company_id = #{companyId}</if>
+                </where>
+            ) t2
+            <where>
+                <if test="productName != null and productName != ''"> AND t2.productName LIKE CONCAT('%', #{productName}, '%')</if>
+            </where>
+            GROUP BY t2.deliveryName, t2.productName
+        ) t
+    </select>
+
+    <!-- 拒收未还货报表 -->
+    <select id="selectGuCoinRejectNoReturnReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsRejectNoReturnReportVO">
+        SELECT
+            o.order_code AS orderCode,
+            o.delivery_sn AS deliverySn,
+            o.user_name AS userName,
+            o.user_address AS userAddress,
+            o.delivery_time AS deliveryTime,
+            o.total_money AS totalPrice,
+            o.follow_time AS followTime,
+            o.delivery_name AS deliveryName
+        FROM fs_gu_coin_order o
+        LEFT JOIN company c ON o.company_id = c.company_id
+        LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
+        LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
+        <where>
+            o.delivery_status = 4 AND (o.is_return_goods IS NULL OR o.is_return_goods = 2)
+            <if test="orderCode != null and orderCode != ''"> AND o.order_code = #{orderCode}</if>
+            <if test="deliverySn != null and deliverySn != ''"> AND o.delivery_sn = #{deliverySn}</if>
+            <if test="userName != null and userName != ''"> AND o.user_name LIKE CONCAT('%', #{userName}, '%')</if>
+            <if test="userAddress != null and userAddress != ''"> AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
+            <if test="totalPrice != null"> AND o.total_money = #{totalPrice}</if>
+            <if test="followTimeStart != null and followTimeStart != ''"> AND o.follow_time &gt;= #{followTimeStart}</if>
+            <if test="followTimeEnd != null and followTimeEnd != ''"> AND o.follow_time &lt;= #{followTimeEnd}</if>
+            <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
+            <if test="deliveryStartTime != null"> AND o.delivery_time &gt;= #{deliveryStartTime}</if>
+            <if test="deliveryEndTime != null"> AND o.delivery_time &lt;= #{deliveryEndTime}</if>
+            <if test="companyId != null"> AND o.company_id = #{companyId}</if>
+        </where>
+        ORDER BY o.order_id DESC
+    </select>
+
+    <!-- 拒收未还货合计 -->
+    <select id="selectGuCoinRejectNoReturnReportSum" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="java.util.Map">
+        SELECT
+            SUM(o.total_money) AS totalPrice
+        FROM fs_gu_coin_order o
+        LEFT JOIN company c ON o.company_id = c.company_id
+        LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
+        LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
+        <where>
+            o.delivery_status = 4 AND (o.is_return_goods IS NULL OR o.is_return_goods = 2)
+            <if test="orderCode != null and orderCode != ''"> AND o.order_code = #{orderCode}</if>
+            <if test="deliverySn != null and deliverySn != ''"> AND o.delivery_sn = #{deliverySn}</if>
+            <if test="userName != null and userName != ''"> AND o.user_name LIKE CONCAT('%', #{userName}, '%')</if>
+            <if test="userAddress != null and userAddress != ''"> AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
+            <if test="totalPrice != null"> AND o.total_money = #{totalPrice}</if>
+            <if test="followTimeStart != null and followTimeStart != ''"> AND o.follow_time &gt;= #{followTimeStart}</if>
+            <if test="followTimeEnd != null and followTimeEnd != ''"> AND o.follow_time &lt;= #{followTimeEnd}</if>
+            <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
+            <if test="deliveryStartTime != null"> AND o.delivery_time &gt;= #{deliveryStartTime}</if>
+            <if test="deliveryEndTime != null"> AND o.delivery_time &lt;= #{deliveryEndTime}</if>
+            <if test="companyId != null"> AND o.company_id = #{companyId}</if>
+        </where>
+    </select>
+
+    <!-- 签收情况明细表 -->
+    <select id="selectGuCoinSignDetailReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsSignDetailReportVO">
+        SELECT
+            t.order_type AS orderType,
+            t.delivery_count AS deliveryCount,
+            t.delivery_amount AS deliveryAmount,
+            t.sign_count AS signCount,
+            t.sign_amount AS signAmount,
+            CASE WHEN t.delivery_count &gt; 0
+                 THEN CONCAT(ROUND(t.sign_count * 100.0 / t.delivery_count, 2), '%')
+                 ELSE '0%' END AS orderSignRate,
+            CASE WHEN t.delivery_amount &gt; 0
+                 THEN CONCAT(ROUND(t.sign_amount * 100.0 / t.delivery_amount, 2), '%')
+                 ELSE '0%' END AS amountSignRate,
+            t.dept_name AS deptName,
+            t.company_name AS companyName
+        FROM (
+            SELECT
+                5 AS order_type,
+                COUNT(o.order_id) AS delivery_count,
+                COALESCE(SUM(o.total_money), 0) AS delivery_amount,
+                COUNT(CASE WHEN o.delivery_status = 3 THEN 1 END) AS sign_count,
+                COALESCE(SUM(CASE WHEN o.delivery_status = 3 THEN o.total_money ELSE 0 END), 0) AS sign_amount,
+                d.dept_name AS dept_name,
+                c.company_name AS company_name
+            FROM fs_gu_coin_order o
+            LEFT JOIN company c ON o.company_id = c.company_id
+            LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
+            LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
+            <where>
+                o.status &gt;= 3
+                <if test="companyId != null"> AND o.company_id = #{companyId}</if>
+                <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
+                <if test="sTime != null and sTime != ''"> AND o.create_time &gt;= #{sTime}</if>
+                <if test="eTime != null and eTime != ''"> AND o.create_time &lt;= #{eTime}</if>
+            </where>
+            GROUP BY d.dept_id, d.dept_name, c.company_id, c.company_name
+        ) t
+        <where>
+            <if test="deliveryCount != null"> AND t.delivery_count = #{deliveryCount}</if>
+            <if test="deliveryAmount != null"> AND t.delivery_amount = #{deliveryAmount}</if>
+            <if test="signCount != null"> AND t.sign_count = #{signCount}</if>
+            <if test="signAmount != null"> AND t.sign_amount = #{signAmount}</if>
+        </where>
+        ORDER BY t.company_name, t.dept_name
+    </select>
 </mapper>