puzhibing
2 天以前 0b9e60f0bada4cc39187a9dd3c36bf37452f63de
修改bug
9个文件已修改
348 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteOrderFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteOrderService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MerMemberPageDto.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/concole/OrderController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml 266 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/UserServiceRecordMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteOrderFallbackFactory.java
@@ -15,6 +15,7 @@
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
/**
 * 订单服务
@@ -108,6 +109,11 @@
            public R addOrder(AddOrderVo orderVo) {
                return R.fail("抽奖活动添加订单失败:" + throwable.getMessage());
            }
            @Override
            public R<Set<Long>> getConsumerGoodsResidueUserId(Long shopId, Integer goodsType) {
                return R.fail("获取剩余服务类型对应的用户id失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteOrderService.java
@@ -14,6 +14,7 @@
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
@FeignClient(contextId = "remoteOrderService", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = RemoteOrderFallbackFactory.class)
public interface RemoteOrderService {
@@ -144,4 +145,12 @@
    @PostMapping(value = "/order/addOrder")
    R addOrder(@RequestBody AddOrderVo orderVo);
    /**
     * 获取剩余服务类型对应的用户id
     * @param shopId
     * @return
     */
    @PostMapping("/order/getConsumerGoodsResidueUserId")
    R<Set<Long>> getConsumerGoodsResidueUserId(@RequestParam("shopId") Long shopId, @RequestParam("goodsType") Integer goodsType);
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java
@@ -90,7 +90,7 @@
        QueryWrapper<TUserLotteryEvent> wrapper = new QueryWrapper<TUserLotteryEvent>().eq("lottery_event_id", id).eq("user_id", userId);
        //下单抽奖
        if(2 == lotteryEvent.getActivityType()){
            wrapper.eq("orderId", orderId);
            wrapper.eq("order_id", orderId);
        }
        List<TUserLotteryEvent> userLotteryEvents = userLotteryEventService.list(wrapper);
        vo.setLaveTimes(lotteryEvent.getTimes() - userLotteryEvents.size());
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MerMemberPageDto.java
@@ -72,6 +72,12 @@
    
    @ApiModelProperty(value = "是否有未跟进任务(0=否,1=是)")
    private Integer isTask;
    @ApiModelProperty(value = "剩余周期人数(0=否,1=是)")
    private Integer residuePeriod;
    @ApiModelProperty(value = "剩余体验人数(0=否,1=是)")
    private Integer residueExperience;
    
    private List<Integer> userIds;
    
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java
@@ -435,13 +435,37 @@
        //今日到店用户
        if(null != merMemberPageDto.getIsTodayStore() && 1 == merMemberPageDto.getIsTodayStore()){
            List<Integer> data = remoteOrderService.countShopServicePerson(merMemberPageDto.getShopId()).getData();
            if(data.isEmpty()){
                data.add(-1);
            }
            merMemberPageDto.setUserIds(data);
        }
        //有未跟进的任务用户
        if(null != merMemberPageDto.getIsTask() && 1 == merMemberPageDto.getIsTask()){
            List<Integer> data = remoteShopService.getMemberIngTotal(merMemberPageDto.getShopId()).getData();
            if(data.isEmpty()){
                data.add(-1);
            }
            merMemberPageDto.setUserIds(data);
        }
        //剩余周期人数
        if(null != merMemberPageDto.getResiduePeriod() && 1 == merMemberPageDto.getResiduePeriod()){
            Set<Long> data = remoteOrderService.getConsumerGoodsResidueUserId(merMemberPageDto.getShopId(), 1).getData();
            List<Integer> collect = data.stream().map(s -> Integer.valueOf(s.intValue())).collect(Collectors.toList());
            if(collect.isEmpty()){
                collect.add(-1);
            }
            merMemberPageDto.setUserIds(collect);
        }
        //剩余体验人数
        if(null != merMemberPageDto.getResidueExperience() && 1 == merMemberPageDto.getResidueExperience()){
            Set<Long> data = remoteOrderService.getConsumerGoodsResidueUserId(merMemberPageDto.getShopId(), 3).getData();
            List<Integer> collect = data.stream().map(s -> Integer.valueOf(s.intValue())).collect(Collectors.toList());
            if(collect.isEmpty()){
                collect.add(-1);
            }
            merMemberPageDto.setUserIds(collect);
        }
        List<MerMemberPageVo> merMemberPageVoList = memberMapper.pageMerMember(page, merMemberPageDto);
        //处理活跃度返回
        if (merMemberPageVoList != null && !merMemberPageVoList.isEmpty()) {
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/concole/OrderController.java
@@ -1,8 +1,10 @@
package com.ruoyi.order.controller.concole;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.binarywang.wxpay.bean.ecommerce.ProfitSharingResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.domain.pojo.order.ConsumerGoods;
import com.ruoyi.order.service.order.ConsumerGoodsService;
import com.ruoyi.order.service.order.OrderService;
import com.ruoyi.order.service.order.UserServiceRecordService;
@@ -19,6 +21,8 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
 * @author jqs34
@@ -238,4 +242,18 @@
        orderService.addOrder(orderVo.getShopId(), orderVo.getUserId(), goods, orderVo.getGoodsName(), orderVo.getGoodsNum(), orderVo.getId(), 2);
        return R.ok();
    }
    /**
     * 获取剩余服务类型对应的用户id
     * @param shopId
     * @return
     */
    @PostMapping("/getConsumerGoodsResidueUserId")
    public R<Set<Long>> getConsumerGoodsResidueUserId(@RequestParam("shopId") Long shopId, @RequestParam("goodsType") Integer goodsType){
        List<ConsumerGoods> list = consumerGoodsService.list(new QueryWrapper<ConsumerGoods>().eq("del_flag", 0)
                .eq("service_status", 1).eq("shop_id", shopId).eq("cycle_num_flag", 1).eq("goods_type", goodsType));
        Set<Long> collect = list.stream().map(ConsumerGoods::getUserId).collect(Collectors.toSet());
        return R.ok(collect);
    }
}
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java
@@ -103,7 +103,7 @@
            merConsumerGoodsVo.setNoSureList(noSureList);
        }
        List<MerConsumerGoodsListVo> sureList = consumerGoodsMapper.listMerConsumerGoods(merConsumerGoodsDto);
        Member member = remoteMemberService.getMember(merConsumerGoodsDto.getUserId()).getData();
        Member member = remoteMemberService.getMember(merConsumerGoodsDto.getMemberUserId()).getData();
        String lastServiceId = member.getLastServiceId();
        if (StringUtils.isNotEmpty(lastServiceId)) {
            List<String> list = JSON.parseArray(lastServiceId, String.class);
@@ -126,6 +126,8 @@
        if(oldConsumerGoods.getSureNum()==null||oldConsumerGoods.getSureNum()<1){
            throw new ServiceException(AppErrorConstant.GOODS_SURE_FAILED);
        }
        Member member = remoteMemberService.getMember(merSureConsumerGoodsDto.getMemberUserId()).getData();
        Shop shop = remoteShopService.getShop(merSureConsumerGoodsDto.getShopId()).getData();
        List<MerSureConsumerGoodsListDto> merSureConsumerGoodsListDtoList = merSureConsumerGoodsDto.getMerSureConsumerGoodsListDtoList();
        if(merSureConsumerGoodsListDtoList!=null && !merSureConsumerGoodsListDtoList.isEmpty()){
            ConsumerGoods consumerGoods;
@@ -182,6 +184,15 @@
                        sureNum = sureNum + 1;
                    }
                }
                String msg = "{\"name\":\"" + (StringUtils.isEmpty(member.getRealName()) ? member.getNickName() : member.getRealName()) + "\"," +
                        "\"store\":\"" + shop.getShopName() + "\",\"product\":\"" + goods.getGoodsName() + "\"}";
                try {
                    MsgUtils.sendMsg(member.getMobile(), "SMS_491320362", msg);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            //判断商品确认次数
            if (sureNum > oldConsumerGoods.getSureNum()) {
@@ -321,7 +332,7 @@
    
            //保存本次确认的服务商品id,用于下次进入页面后默认勾选上
            List<String> collect = goodsList.stream().map(MerSureConsumerGoodsListDto::getConsumerGoodsId).collect(Collectors.toList());
            Member member = remoteMemberService.getMember(merSureConsumerGoodsDto.getUserId()).getData();
            Member member = remoteMemberService.getMember(merSureConsumerGoodsDto.getMemberUserId()).getData();
            member.setLastServiceId(JSON.toJSONString(collect));
            remoteMemberService.editMember(member);
    
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -70,7 +70,6 @@
    </resultMap>-->
    <resultMap id="merOrderResultMap" type="com.ruoyi.order.domain.vo.MerOrderPageVo">
        <result column="userId" property="userId"/>
        <result column="orderId" property="orderId"/>
@@ -310,7 +309,8 @@
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR
                EXISTS( SELECT 1 FROM t_order_goods tog WHERE tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')) )
            EXISTS( SELECT 1 FROM t_order_goods tog WHERE tog.order_id = toc.order_id AND tog.goods_name LIKE
            CONCAT('%',#{param.keyword},'%')) )
        </if>
        ORDER BY toc.create_time DESC
    </select>
@@ -343,12 +343,16 @@
        toc.order_money orderGoodsMoney,
        toc.coupon_money couponDiscount,
        toc.pay_type payType,
        CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney,
        CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN
        toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney,
        toc.receivable_deposit receivableDeposit,
        toc.pay_money payMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) relReceiveMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE
        toc.change_receivable_money END) relReceiveMoney,
        CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN IFNULL(toc.offline_pay_money,0) END receiveMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) - (CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN IFNULL(toc.offline_pay_money,0) END) unPaidMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE
        toc.change_receivable_money END) - (CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN
        IFNULL(toc.offline_pay_money,0) END) unPaidMoney,
        toc.create_time createTime,
        toc.close_flag closeFlag
        FROM t_order toc
@@ -412,7 +416,8 @@
            AND Date(toc.create_time) &lt;= #{param.endOrderDate}
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR EXISTS( SELECT 1 FROM t_order_goods tog WHERE tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%'))
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR EXISTS( SELECT 1 FROM t_order_goods tog WHERE
            tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%'))
            <if test="param.memberUserIdList != null and param.memberUserIdList.size()>0">
                OR toc.user_id IN
                <foreach collection="param.memberUserIdList" item="item" open="(" separator="," close=")">
@@ -440,7 +445,8 @@
        IFNULL(SUM(IFNULL(toc.receivable_money,0)),0) totalReceivableMoney,
        IFNULL(SUM(IFNULL(toc.discount_money,0)),0) totalDiscountMoney,
        IFNULL(SUM(IFNULL(toc.pay_money,0)),0) totalPayMoney,
        IFNULL(SUM((CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END)),0) totalReceiveMoney
        IFNULL(SUM((CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN
        toc.receivable_money ELSE toc.change_receivable_money END)),0) totalReceiveMoney
        FROM t_order toc
        WHERE toc.del_flag = 0 AND toc.user_id = #{param.memberUserId}
        <if test="param.orderStatus != null">
@@ -468,12 +474,14 @@
        WHEN 2 THEN "待核销"
        WHEN 3 THEN "已完成"
        END orderStatus,
        CASE WHEN toc.unbinding_flag = 0 THEN toc.shop_id WHEN toc.unbinding_flag = 1 AND toc.order_from = 1 THEN toc.shop_id WHEN toc.order_status = 3 THEN toc.shop_id ELSE NULL END shopId,
        CASE WHEN toc.unbinding_flag = 0 THEN toc.shop_id WHEN toc.unbinding_flag = 1 AND toc.order_from = 1 THEN
        toc.shop_id WHEN toc.order_status = 3 THEN toc.shop_id ELSE NULL END shopId,
        toc.order_money orderGoodsMoney,
        toc.discount_money discountMoney,
        toc.receivable_money receivableMoney,
        toc.pay_money payMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) receiveMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE
        toc.change_receivable_money END) receiveMoney,
        toc.create_time createTime,
        toc.order_from orderFrom,
        CASE toc.order_from
@@ -488,7 +496,8 @@
            AND toc.order_status = #{param.orderStatus}
        </if>
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from
            = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.orderFrom != null and param.orderFrom != ''">
            AND toc.order_from = #{param.orderFrom}
@@ -500,7 +509,8 @@
            AND Date(toc.create_time) &lt;= #{param.endOrderDate}
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') EXISTS( SELECT 1 FROM t_order_goods tog WHERE tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')))
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') EXISTS( SELECT 1 FROM t_order_goods tog WHERE
            tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')))
        </if>
        ORDER BY toc.create_time DESC
    </select>
@@ -551,13 +561,15 @@
            AND tog.goods_type = #{param.goodsType}
        </if>
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from
            = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds})
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE
            CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
        </if>
        <if test="param.verifyStartTime != null and param.verifyStartTime != ''">
            AND Date(toc.use_time) &gt;= #{param.verifyStartTime}
@@ -571,7 +583,8 @@
    <select id="totalOrderFirst" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal">
        SELECT
        COUNT(temp.order_id) orderTotal,
        IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END),0) orderMoneyTotal
        IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN
        temp.receivable_money ELSE temp.change_receivable_money END),0) orderMoneyTotal
        FROM
        (SELECT toc.order_id,toc.change_receivable_money,toc.receivable_money,toc.pay_money
        FROM t_order toc
@@ -587,13 +600,15 @@
            <!--AND toc.shop_id = #{param.shopId}-->
        <!--</if>-->
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from
            = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE
            CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
        </if>
        <if test="param.verifyStartTime != null and param.verifyStartTime != ''">
            AND Date(toc.use_time) &gt;= #{param.verifyStartTime}
@@ -607,9 +622,13 @@
    <select id="totalOrderSecond" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal">
        SELECT
        COUNT(temp.order_id) shopOrderTotal,
        IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END),0) shopOrderMoneyTotal,
        IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN
        temp.receivable_money ELSE temp.change_receivable_money END),0) shopOrderMoneyTotal,
        IFNULL(SUM(temp.pay_money),0) shopPayMoneyTotal,
        IFNULL(SUM(CASE WHEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) &gt; temp.pay_money THEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) - temp.pay_money ELSE 0 END),0) shopUnPayMoneyTotal
        IFNULL(SUM(CASE WHEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN
        temp.receivable_money ELSE temp.change_receivable_money END) &gt; temp.pay_money THEN (CASE WHEN null =
        temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE
        temp.change_receivable_money END) - temp.pay_money ELSE 0 END),0) shopUnPayMoneyTotal
        FROM
        (SELECT toc.order_id,toc.change_receivable_money,toc.receivable_money,toc.pay_money
        FROM t_order toc
@@ -625,13 +644,15 @@
            <!--AND toc.shop_id = #{param.shopId}-->
        <!--</if>-->
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from
            = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE
            CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
        </if>
        <if test="param.verifyStartTime != null and param.verifyStartTime != ''">
            AND Date(toc.use_time) &gt;= #{param.verifyStartTime}
@@ -645,9 +666,13 @@
    <select id="totalOrderThird" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal">
        SELECT
        COUNT(temp.order_id) activityOrderTotal,
        IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END),0) activityOrderMoneyTotal,
        IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN
        temp.receivable_money ELSE temp.change_receivable_money END),0) activityOrderMoneyTotal,
        IFNULL(SUM(temp.pay_money),0) activityPayMoneyTotal,
        IFNULL(SUM(CASE WHEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) &gt; temp.pay_money THEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) - temp.pay_money ELSE 0 END),0)activityUnPayMoneyTotal
        IFNULL(SUM(CASE WHEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN
        temp.receivable_money ELSE temp.change_receivable_money END) &gt; temp.pay_money THEN (CASE WHEN null =
        temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE
        temp.change_receivable_money END) - temp.pay_money ELSE 0 END),0)activityUnPayMoneyTotal
        FROM
        (SELECT toc.order_id,toc.change_receivable_money,toc.receivable_money,toc.pay_money
        FROM t_order toc
@@ -663,13 +688,15 @@
            <!--AND toc.shop_id = #{param.shopId}-->
        <!--</if>-->
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from
            = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            and toc.order_status = 3 AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE
            CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
        </if>
        <if test="param.verifyStartTime != null and param.verifyStartTime != ''">
            AND Date(toc.use_time) &gt;= #{param.verifyStartTime}
@@ -708,7 +735,8 @@
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE
            CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
        </if>
        <if test="param.verifyStartTime != null and param.verifyStartTime != ''">
            AND Date(toc.use_time) &gt;= #{param.verifyStartTime}
@@ -730,7 +758,8 @@
        toc.receivable_money receivableMoney,
        toc.create_time createTime,
        toc.pay_money payMoney,
--         CASE WHEN toc.unbinding_flag = 0 THEN toc.shop_id WHEN toc.unbinding_flag = 1 AND toc.order_from = 1 THEN toc.shop_id WHEN toc.order_status = 3 THEN toc.shop_id ELSE NULL END shopId,
        -- CASE WHEN toc.unbinding_flag = 0 THEN toc.shop_id WHEN toc.unbinding_flag = 1 AND toc.order_from = 1 THEN
        toc.shop_id WHEN toc.order_status = 3 THEN toc.shop_id ELSE NULL END shopId,
        toc.shop_id shopId,
        toc.use_time verifyTime,
        CASE toc.order_from
@@ -755,13 +784,15 @@
            AND tog.goods_type = #{param.goodsType}
        </if>
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from
            = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE
            CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
        </if>
        <if test="param.verifyStartTime != null and param.verifyStartTime != ''">
            AND Date(toc.use_time) &gt;= #{param.verifyStartTime}
@@ -775,7 +806,8 @@
    <select id="boardOrderTotal" resultType="com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo">
        SELECT
            IFNULL(SUM(CASE WHEN order_status = 3 THEN (CASE WHEN null = change_receivable_money or 0 = change_receivable_money THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) salesTotal,
        IFNULL(SUM(CASE WHEN order_status = 3 THEN (CASE WHEN null = change_receivable_money or 0 =
        change_receivable_money THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) salesTotal,
            IFNULL(SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END),0) UnUseOrderTotal,
            IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityOrderTotal
        FROM t_order
@@ -814,10 +846,14 @@
        IFNULL(SUM(CASE WHEN order_from = 1 THEN 1 ELSE 0 END),0) onlineTotal,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN 1 ELSE 0 END),0) offlineTotal,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityTotal,
        IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END),0) orderMoney,
        IFNULL(SUM(CASE WHEN order_from = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) offlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) activityMoney
        IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE
        change_receivable_money END),0) orderMoney,
        IFNULL(SUM(CASE WHEN order_from = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money =
        0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN (CASE WHEN null = change_receivable_money or change_receivable_money =
        0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) offlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money =
        0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) activityMoney
        FROM t_order WHERE del_flag = 0 AND order_status = 3
        <if test="param.shopId != null and param.shopId != ''">
            AND shop_id = #{param.shopId}
@@ -884,7 +920,10 @@
        SELECT
            DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey,
            COUNT(order_id) AS mapValueFirst,
            IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) AS mapValueSecond
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0
        THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null =
        change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) +
        online_pay_money ELSE 0 END),0) AS mapValueSecond
        FROM t_order
        WHERE del_flag = 0 AND order_status = 3
        <if test="param.shopId != null and param.shopId != ''">
@@ -947,7 +986,10 @@
        WHEN 2 THEN "秒杀订单"
        WHEN 3 THEN "线下订单"
        END mapKey,
        IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) WHEN toc.pay_type = 2 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) + toc.online_pay_money ELSE 0 END),0) mapValue
        IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN (CASE WHEN null = toc.change_receivable_money or
        toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) WHEN
        toc.pay_type = 2 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN
        toc.receivable_money ELSE toc.change_receivable_money END) + toc.online_pay_money ELSE 0 END),0) mapValue
        FROM t_order toc
        WHERE toc.del_flag = 0 AND toc.order_status = 3
        <if test="param.shopId != null and param.shopId != ''">
@@ -966,7 +1008,10 @@
    <select id="getTotalActivityTotal" resultType="com.ruoyi.order.domain.vo.MgtTotalActivityTotalVo">
        SELECT
        COUNT(CASE WHEN order_status = 3 THEN order_id ELSE NULL END) orderTotal,
        IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) orderMoney,
        IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or
        change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND
        pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money
        ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) orderMoney,
        COUNT(DISTINCT user_id) orderJoinPerson
        FROM t_order WHERE del_flag = 0 AND order_from = 2 AND order_status =3 AND shop_id = #{param.shopId}
        <if test="param.startDate!=null and param.startDate!=''">
@@ -999,7 +1044,10 @@
        SELECT
        DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey,
        COUNT(DISTINCT order_id) AS mapValueFirst,
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) AS mapValueSecond
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0
        THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null =
        change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) +
        online_pay_money ELSE 0 END),0) AS mapValueSecond
        FROM t_order
        WHERE del_flag = 0 AND order_from = 2 AND order_status = 3 AND shop_id = #{param.shopId}
        <if test="param.startDate!=null and param.startDate!=''">
@@ -1071,10 +1119,14 @@
    <select id="getTotalDataMemberTotal" resultType="com.ruoyi.order.domain.vo.MgtTotalDataTotalVo">
        SELECT
            COUNT(DISTINCT CASE WHEN goods_type_1_count &gt; 0 AND goods_type_3_count = 0 THEN user_id ELSE NULL END) AS onlyCyclePerson,
            COUNT(DISTINCT CASE WHEN goods_type_1_count = 0 AND goods_type_3_count &gt; 0 THEN user_id ELSE NULL END) AS onlyExperiencePerson,
            COUNT(DISTINCT CASE WHEN goods_type_1_count &gt; 0 AND goods_type_3_count &gt; 0 THEN user_id ELSE NULL END) AS experienceCyclePerson,
            COUNT(DISTINCT CASE WHEN goods_type_1_count &gt; 0 OR goods_type_2_count &gt; 0 OR goods_type_3_count &gt; 0 OR goods_type_4_count &gt; 0 THEN user_id ELSE NULL END) AS orderPerson
        COUNT(DISTINCT CASE WHEN goods_type_1_count &gt; 0 AND goods_type_3_count = 0 THEN user_id ELSE NULL END) AS
        onlyCyclePerson,
        COUNT(DISTINCT CASE WHEN goods_type_1_count = 0 AND goods_type_3_count &gt; 0 THEN user_id ELSE NULL END) AS
        onlyExperiencePerson,
        COUNT(DISTINCT CASE WHEN goods_type_1_count &gt; 0 AND goods_type_3_count &gt; 0 THEN user_id ELSE NULL END) AS
        experienceCyclePerson,
        COUNT(DISTINCT CASE WHEN goods_type_1_count &gt; 0 OR goods_type_2_count &gt; 0 OR goods_type_3_count &gt; 0 OR
        goods_type_4_count &gt; 0 THEN user_id ELSE NULL END) AS orderPerson
            FROM (
                 SELECT
                     o.user_id,
@@ -1099,7 +1151,10 @@
    </select>
    <select id="shopSalesTotal" resultType="java.math.BigDecimal">
        SELECT IFNULL(SUM(CASE pay_type WHEN 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0)
        SELECT IFNULL(SUM(CASE pay_type WHEN 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money
        = 0 THEN receivable_money ELSE change_receivable_money END) WHEN 2 THEN (CASE WHEN null =
        change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money
        END)+online_pay_money ELSE 0 END),0)
        FROM t_order
        WHERE del_flag = 0 AND order_status = 3
        <if test="param.shopId != null and param.shopId != ''">
@@ -1207,10 +1262,14 @@
        IFNULL(SUM(CASE WHEN order_from = 6 THEN receivable_money ELSE 0 END),0) douyinAmount,
        IFNULL(SUM(CASE WHEN order_from = 7 THEN 1 ELSE 0 END),0) kuaishou,
        IFNULL(SUM(CASE WHEN order_from = 7 THEN receivable_money ELSE 0 END),0) kuaishouAmount,
        IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END),0) orderMoney,
        IFNULL(SUM(CASE WHEN order_from = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) offlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) activityMoney
        IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE
        change_receivable_money END),0) orderMoney,
        IFNULL(SUM(CASE WHEN order_from = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money =
        0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN (CASE WHEN null = change_receivable_money or change_receivable_money =
        0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) offlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money =
        0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) activityMoney
        FROM t_order WHERE del_flag = 0 AND order_status = 3
        <if test="param.shopIdList != null and param.shopIdList.size() > 0">
            AND shop_id IN
@@ -1255,7 +1314,10 @@
        SELECT
        DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey,
        COUNT(order_id) AS mapValueFirst,
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) AS mapValueSecond
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0
        THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null =
        change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) +
        online_pay_money ELSE 0 END),0) AS mapValueSecond
        FROM
        t_order
        WHERE del_flag = 0 AND order_status = 3
@@ -1335,7 +1397,10 @@
        WHEN 3 THEN "线下订单"
        WHEN 4 then "抽奖订单"
        END mapKey,
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) mapValue
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0
        THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null =
        change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) +
        online_pay_money ELSE 0 END),0) mapValue
        FROM t_order toc
        WHERE toc.del_flag = 0 AND order_status = 3
        <if test="param.shopIdList != null and param.shopIdList.size() > 0">
@@ -1357,7 +1422,10 @@
    <select id="getPlTotalActivityTotal" resultType="com.ruoyi.order.domain.vo.MgtPlTotalActivityTotalVo">
        SELECT
        COUNT(CASE WHEN order_status = 3 THEN order_id ELSE NULL END) orderTotal,
        IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) orderMoney,
        IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or
        change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND
        pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money
        ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) orderMoney,
        COUNT(DISTINCT user_id) orderJoinPerson
        FROM t_order WHERE del_flag = 0 AND order_from = 2
        <if test="param.shopId != null and param.shopId != ''">
@@ -1417,7 +1485,8 @@
        COUNT(DISTINCT CASE WHEN tog.goods_type = 2 THEN toc.user_id ELSE NULL END) servicePerson
        FROM t_order toc
        INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id
        WHERE toc.del_flag = 0 AND toc.order_from = 2 AND toc.order_status = 3 AND toc.new_member_flag = 1 AND toc.shop_id = #{param.shopId}
        WHERE toc.del_flag = 0 AND toc.order_from = 2 AND toc.order_status = 3 AND toc.new_member_flag = 1 AND
        toc.shop_id = #{param.shopId}
        <if test="param.startDate!=null and param.startDate!=''">
            AND Date(toc.create_time) &gt;= #{param.startDate}
        </if>
@@ -1460,7 +1529,10 @@
        SELECT
        DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey,
        COUNT(DISTINCT order_id) AS mapValueFirst,
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) AS mapValueSecond
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0
        THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null =
        change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) +
        online_pay_money ELSE 0 END),0) AS mapValueSecond
        FROM t_order
        WHERE del_flag = 0 AND order_from = 2 AND order_status = 3
        <if test="param.activityId!=null and param.activityId!=''">
@@ -1552,7 +1624,10 @@
    <select id="listPlTotalShopActivitySalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo">
        SELECT
        shop_id AS mapKey,
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) AS mapValue
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0
        THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null =
        change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money
        END)+online_pay_money ELSE 0 END),0) AS mapValue
        FROM t_order
        WHERE del_flag = 0 AND order_from = 2 AND order_status = 3
        <if test="param.activityId!=null and param.activityId!=''">
@@ -1580,7 +1655,10 @@
    <select id="listPlTotalActivitySalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo">
        SELECT
        activity_name AS mapKey,
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) AS mapValue
        IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0
        THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null =
        change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money
        END)+online_pay_money ELSE 0 END),0) AS mapValue
        FROM t_order
        WHERE del_flag = 0 AND order_from = 2 AND order_status = 3
        <if test="param.activityId!=null and param.activityId!=''">
@@ -1606,11 +1684,20 @@
    </select>
    <select id="getMerHomeShopTotalVo" resultType="com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo">
        SELECT sum(aa.unHandleOrder) as unHandleOrder,sum(aa.shopTurnover) as shopTurnover FROM (
        SELECT
            IFNULL(SUM(CASE WHEN order_status = 2 AND order_from = 1 THEN 1 ELSE 0 END),0) unHandleOrder,
            IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) shopTurnover
            IFNULL(SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END),0) unHandleOrder,
            0 AS shopTurnover
        FROM t_order
        WHERE del_flag = 0 AND shop_id = #{shopId} AND order_status IN (2,3)
        UNION ALL
        SELECT
            0,
            IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) shopTurnover
        FROM t_order
        WHERE del_flag = 0 AND shop_id = #{shopId} AND order_status IN (2,3) and DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
      ) AS aa
    </select>
    <select id="getMerHomeShopServiceTotalVo" resultType="com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo">
@@ -1648,10 +1735,14 @@
        IFNULL(SUM(CASE WHEN order_from in (1,4,5,6,7) THEN 1 ELSE 0 END),0) onlineTotal,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN 1 ELSE 0 END),0) offlineTotal,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityTotal,
        IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END),0) orderMoney,
        IFNULL(SUM(CASE WHEN order_from in (1,4,5,6,7) THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) offlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) activityMoney
        IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE
        change_receivable_money END),0) orderMoney,
        IFNULL(SUM(CASE WHEN order_from in (1,4,5,6,7) THEN (CASE WHEN null = change_receivable_money or
        change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN (CASE WHEN null = change_receivable_money or change_receivable_money =
        0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) offlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money =
        0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) activityMoney
        FROM t_order WHERE del_flag = 0 AND order_status = 3
        <if test="param.shopId != null and param.shopId != ''">
            AND shop_id = #{param.shopId}
@@ -1790,13 +1881,20 @@
    <select id="totalMerOrder" resultType="com.ruoyi.order.domain.vo.MerTotalOrderVo">
        SELECT
        COUNT(toc.order_id) orderTotal,
        IFNULL(SUM(CASE toc.pay_type WHEN 1 THEN toc.receivable_money WHEN 2 THEN order_money-coupon_money-online_pay_money END),0) receivableMoney,
        IFNULL(SUM(CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END),0) relReceiveMoney,
        IFNULL(SUM(IF(toc.order_from = 3, toc.offline_pay_money, IF(toc.order_from != 3 AND toc.pay_type = 1, toc.online_pay_money, IFNULL(toc.offline_pay_money,0)))),0) relPayMoney,
        IFNULL(SUM((CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END)-IFNULL(IF(toc.order_from = 3, toc.offline_pay_money, IF(toc.order_from != 3 AND toc.pay_type = 1, toc.online_pay_money, IFNULL(toc.offline_pay_money,0))),0)),0) unpaidMoney,
        IFNULL(SUM(CASE toc.pay_type WHEN 1 THEN toc.receivable_money WHEN 2 THEN
        order_money-coupon_money-online_pay_money END),0) receivableMoney,
        IFNULL(SUM(CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN
        toc.receivable_money ELSE toc.change_receivable_money END),0) relReceiveMoney,
        IFNULL(SUM(IF(toc.order_from = 3, toc.offline_pay_money, IF(toc.order_from != 3 AND toc.pay_type = 1,
        toc.online_pay_money, IFNULL(toc.offline_pay_money,0)))),0) relPayMoney,
        IFNULL(SUM((CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN
        toc.receivable_money ELSE toc.change_receivable_money END)-IFNULL(IF(toc.order_from = 3, toc.offline_pay_money,
        IF(toc.order_from != 3 AND toc.pay_type = 1, toc.online_pay_money, IFNULL(toc.offline_pay_money,0))),0)),0)
        unpaidMoney,
        IFNULL(SUM(CASE toc.pay_type WHEN 2 THEN toc.online_pay_money ELSE 0 END),0) receivableDeposit
        FROM t_order toc
        WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId} and if(toc.order_from = 1, 1 = 1, toc.order_status = 3)<!--临时增加过滤-->
        WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId} and if(toc.order_from = 1, 1 = 1, toc.order_status =
        3)<!--临时增加过滤-->
        <if test="param.memberUserId != null and param.memberUserId != ''">
            AND toc.user_id = #{param.memberUserId}
        </if>
@@ -1820,7 +1918,8 @@
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR
            toc.order_id IN (SELECT DISTINCT tog.order_id FROM t_order_goods tog WHERE tog.goods_name LIKE CONCAT('%',#{param.keyword},'%'))
            toc.order_id IN (SELECT DISTINCT tog.order_id FROM t_order_goods tog WHERE tog.goods_name LIKE
            CONCAT('%',#{param.keyword},'%'))
            <if test="param.memberUserIdList != null and param.memberUserIdList.size()>0">
                OR toc.user_id IN
                <foreach collection="param.memberUserIdList" item="item" open="(" separator="," close=")">
@@ -1839,9 +1938,12 @@
        toc.user_id userId,
        toc.order_money orderMoney,
        toc.discount_money discountMoney,
        CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) payMoney,
        CASE toc.order_from WHEN 1 THEN '小程序' WHEN 2 THEN CONCAT('秒杀活动(',toc.activity_name,')') WHEN 3 THEN '线下创建' END orderFrom,
        CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN
        toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE
        toc.change_receivable_money END) payMoney,
        CASE toc.order_from WHEN 1 THEN '小程序' WHEN 2 THEN CONCAT('秒杀活动(',toc.activity_name,')') WHEN 3 THEN '线下创建' END
        orderFrom,
        CASE toc.order_status
        WHEN 0 THEN "已取消"
        WHEN 1 THEN "待支付"
@@ -1881,7 +1983,10 @@
    <select id="getStaffActivityOrderTotal" resultType="com.ruoyi.order.domain.vo.StaffActivityOrderTotalVo">
        SELECT
            COUNT(DISTINCT toc.order_id) orderTotal,
            IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) WHEN toc.pay_type = 2 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) + toc.online_pay_money ELSE 0 END),0) orderMoney,
        IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN (CASE WHEN null = toc.change_receivable_money or
        toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) WHEN
        toc.pay_type = 2 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN
        toc.receivable_money ELSE toc.change_receivable_money END) + toc.online_pay_money ELSE 0 END),0) orderMoney,
            COUNT(DISTINCT toc.user_id) memberTotal
        FROM t_order toc
        WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId} AND toc.order_from = 2 AND toc.order_status = 3
@@ -2119,7 +2224,8 @@
        SELECT
        COUNT(DISTINCT toc.order_id) orderTotal,
        IFNULL(SUM(toc.order_money),0) totalOrderMoney,
        IFNULL(SUM(CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END),0) totalReceiveMoney,
        IFNULL(SUM(CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN
        toc.receivable_money ELSE toc.change_receivable_money END),0) totalReceiveMoney,
        IFNULL(SUM(CASE WHEN toc.pay_type = 2 THEN toc.online_pay_money ELSE 0 END),0) totalDepositMoney
        FROM t_order toc
        WHERE toc.del_flag = 0
@@ -2195,7 +2301,8 @@
    <select id="shopSalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo">
        SELECT
        shop_id mapKey,
        SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) mapValue
        SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE
        change_receivable_money END) mapValue
        FROM t_order
        WHERE del_flag = 0 AND order_status = 3 AND shop_id IN
        <foreach collection="shopIdList" item="item" open="(" separator="," close=")">
@@ -2207,7 +2314,10 @@
    <select id="getAgencyTotalVo" resultType="com.ruoyi.system.api.domain.vo.AgencyTotalVo">
        SELECT
        IFNULL(SUM(CASE pay_type WHEN 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) areaTurnover
        IFNULL(SUM(CASE pay_type WHEN 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0
        THEN receivable_money ELSE change_receivable_money END) WHEN 2 THEN (CASE WHEN null = change_receivable_money or
        change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0
        END),0) areaTurnover
        FROM t_order
        WHERE del_flag = 0 AND order_status = 3 AND shop_id IN
        <foreach collection="shopIdList" item="item" open="(" separator="," close=")">
@@ -2253,7 +2363,8 @@
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds})
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE
            CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
        </if>
        <if test="param.createTimeBegin != null and param.createTimeBegin != ''">
            AND toc.create_time &gt;= #{param.createTimeBegin}
@@ -2305,7 +2416,8 @@
        COUNT(temp.order_id) thirdOrderTotal,
        IFNULL(SUM( temp.receivable_money ),0) thirdOrderMoneyTotal,
        IFNULL(SUM(temp.pay_money),0) thirdPayMoneyTotal,
        IFNULL(SUM(CASE WHEN (temp.receivable_money ) &gt; temp.pay_money THEN ( temp.receivable_money ) - temp.pay_money ELSE 0 END),0)thirdUnPayMoneyTotal
        IFNULL(SUM(CASE WHEN (temp.receivable_money ) &gt; temp.pay_money THEN ( temp.receivable_money ) -
        temp.pay_money ELSE 0 END),0)thirdUnPayMoneyTotal
        FROM
        (SELECT toc.order_id,toc.receivable_money,toc.pay_money
        FROM t_order toc
@@ -2321,13 +2433,15 @@
        <!--AND toc.shop_id = #{param.shopId}-->
        <!--</if>-->
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from in (5,6,7)) OR (toc.unbinding_flag = 1 AND toc.order_from in (5,6,7) AND toc.order_status = 3))
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from
            in (5,6,7)) OR (toc.unbinding_flag = 1 AND toc.order_from in (5,6,7) AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            and toc.order_status = 3 AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
        </if>
        <if test="param.keyword != null and param.keyword != ''">
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
            AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE
            CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) &gt; 0)
        </if>
        <if test="param.verifyStartTime != null and param.verifyStartTime != ''">
            AND Date(toc.use_time) &gt;= #{param.verifyStartTime}
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/UserServiceRecordMapper.xml
@@ -132,7 +132,7 @@
          AND user_id = #{userId}
    </select>
    
    <select id="countShopServicePerson" resultType="list">
    <select id="countShopServicePerson" resultType="int">
        SELECT DISTINCT user_id
        FROM t_user_service_record
        WHERE shop_id = #{shopId} AND DATE (create_time) = CURDATE()