From 122bb1142631e31ce50716495dba420102f58f56 Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期一, 31 七月 2023 20:05:05 +0800
Subject: [PATCH] bug

---
 ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java             |    4 
 ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml                                |   23 ++
 ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml                                |   25 ++
 ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/ConsumerGoodsMapper.xml                        |    3 
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java                  |    9 +
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerAgencyTaskPageVo.java                 |    6 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/AppUserOrderGetVo.java                 |    4 
 ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopSuggestMapper.xml                            |    2 
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateAgencyTaskDto.java             |    3 
 ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberMapper.xml                             |    5 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsDto.java          |    3 
 ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/AgencyTaskMapper.xml                             |    3 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsListDto.java      |    7 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/order/OrderMapper.java                    |    4 
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java             |    3 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/pojo/order/ConsumerGoods.java             |    3 
 ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberSuggestMapper.xml                      |    2 
 ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/DelayTaskEnum.java                |    2 
 ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopMapper.xml                                   |    7 
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java             |    3 
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/AgencyTask.java                   |   18 +
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java         |   20 ++
 ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberTotalMapper.xml                        |    2 
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/staff/SysStaffServiceImpl.java    |    2 
 ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/MemberTaskMapper.xml                             |    1 
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java                    |    9 +
 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java     |    5 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java |   79 ++++++-
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java         |  194 +++++++++++++++------
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerMemberTaskPageVo.java                 |    6 
 ruoyi-modules/ruoyi-system/src/main/resources/mapper/config/StaffSuggestMapper.xml                       |    2 
 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MgtCouponEditDto.java               |    2 
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateMemberTaskDto.java             |    5 
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java       |    2 
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerGoodsController.java      |    8 
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/MemberTask.java                   |   15 +
 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/scheduler/MemberScheduler.java                 |    4 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerConsumerGoodsListVo.java            |    3 
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java       |   12 +
 39 files changed, 388 insertions(+), 122 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java
index 3cc422e..5a0490a 100644
--- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java
+++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java
@@ -84,7 +84,7 @@
 
     String ACTIVITY_END = "活动已经结束";
 
-    String ACTIVITY_GOODS_NULL = "商品已售罄";
+    String ACTIVITY_GOODS_NULL = "商品已被抢完";
 
     String ACTIVITY_GOODS_BEYOND = "超出商品购买限制";
 
@@ -101,4 +101,6 @@
     String ACTIVITY_TIME_ERROR = "只能选择大于当前时间作为开始时间";
 
     String TRANS_NOT_MYSELF = "不能转移给自己";
+
+    String GOODS_SURE_FAILED = "商品没有确认次数";
 }
diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/DelayTaskEnum.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/DelayTaskEnum.java
index 4847d61..d22b973 100644
--- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/DelayTaskEnum.java
+++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/DelayTaskEnum.java
@@ -10,7 +10,7 @@
 @Getter
 public enum DelayTaskEnum {
 
-    ORDER_AUTOMATIC_CANCEL("订单延时任务-自动关闭","15分钟后订单自动关闭"),
+    ORDER_AUTOMATIC_CANCEL("订单延时任务-自动关闭","超时订单自动关闭"),
     COUPON_SEND_DELAY_TASK("优惠券延时任务","定时启动优惠券发送"),
     ACTIVITY_START_TASK("活动延时任务","定时开始任务"),
     ACTIVITY_END_TASK("活动延时任务","定时结束任务"),
diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerGoodsController.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerGoodsController.java
index 9466a2c..25d422c 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerGoodsController.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerGoodsController.java
@@ -8,6 +8,7 @@
 import com.ruoyi.goods.domain.dto.MgtSelectGoodsPageDto;
 import com.ruoyi.goods.domain.vo.MerGoodsPageVo;
 import com.ruoyi.goods.service.goods.GoodsService;
+import com.ruoyi.system.api.domain.dto.MerBaseDto;
 import com.ruoyi.system.api.domain.vo.MgtSelectGoodsPageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -46,6 +47,13 @@
         return R.ok(page.setRecords(merGoodsPageVoList));
     }
 
+    @RequestMapping(value = "/listMerCycleGoods", method = RequestMethod.POST)
+    @ApiOperation(value = "获取商户周期商品列表")
+    public R<List<MerGoodsPageVo>> listMerCycleGoods(@RequestBody MerBaseDto merBaseDto) {
+        List<MerGoodsPageVo> merGoodsPageVoList = goodsService.listMerCycleGoods(merBaseDto.getShopId());
+        return R.ok(merGoodsPageVoList);
+    }
+
     @RequestMapping(value = "/editMerShopGoods", method = RequestMethod.POST)
     @ApiOperation(value = "编辑商户商品价格")
     public R editMerShopGoods(@RequestBody MerShopGoodsEditDto merShopGoodsEditDto) {
diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java
index c7f548e..d112d3a 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java
@@ -69,6 +69,15 @@
     List<MerGoodsPageVo> pageMerShopGoods(Page page, @Param("param")MerGoodsPageDto merGoodsPageDto);
 
     /**
+     * @description  获取确认次数周期商品
+     * @author  jqs
+     * @date    2023/7/31 16:49
+     * @param shopId
+     * @return  List<MerGoodsPageVo>
+     */
+    List<MerGoodsPageVo> listMerCycleGoods (@Param("shopId")Long shopId);
+
+    /**
      * 平台分页获取商品
      * @param page
      * @param mgtGoodsPageDto
diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java
index 6865398..681a501 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java
@@ -76,6 +76,15 @@
     List<MerGoodsPageVo> pageMerShopGoods(Page page,MerGoodsPageDto merGoodsPageDto);
 
     /**
+     * @description  获取确认次数周期商品
+     * @author  jqs
+     * @date    2023/7/31 16:49
+     * @param shopId
+     * @return  List<MerGoodsPageVo>
+     */
+    List<MerGoodsPageVo> listMerCycleGoods (Long shopId);
+
+    /**
      * 修改商户商品
      * @param merShopGoodsEditDto
      */
diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java
index c51e33b..367e791 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java
@@ -249,6 +249,19 @@
 
     }
 
+    /**
+     * @description  获取确认次数周期商品
+     * @author  jqs
+     * @date    2023/7/31 16:49
+     * @param shopId
+     * @return  List<MerGoodsPageVo>
+     */
+    @Override
+    public List<MerGoodsPageVo> listMerCycleGoods (Long shopId){
+        List<MerGoodsPageVo> merGoodsPageVoList = goodsMapper.listMerCycleGoods(shopId);
+        return merGoodsPageVoList;
+
+    }
 
     /**
      * 修改商户商品
@@ -341,6 +354,13 @@
         Goods goodsSame = this.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getDelFlag,0).eq(Goods::getGoodsName,mgtGoodsEditDto.getGoodsName()));
         // 创建MgtClassNumDto对象
         MgtClassNumDto mgtClassNumDto = new MgtClassNumDto();
+        if(mgtGoodsEditDto.getGoodsType()!=1){
+            mgtGoodsEditDto.setCycleNumFlag(1);
+        }else{
+            if(mgtGoodsEditDto.getCycleNumFlag()==null){
+                throw new ServiceException("周期商品需选择是否明确次数");
+            }
+        }
         // 判断是否有商品ID 没有则新建
         if (StringUtils.isNotBlank(goodsId)) {
             if(goodsSame!=null&&!Objects.equals(goodsSame.getGoodsId(), goodsId)){
diff --git a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml
index 2a9b836..325a692 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml
+++ b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml
@@ -313,6 +313,29 @@
         </if>
         ORDER BY tg.create_time DESC
     </select>
+
+    <select id="listMerCycleGoods" resultType="com.ruoyi.goods.domain.vo.MerGoodsPageVo">
+        SELECT
+        tg.goods_id goodsId,
+        tg.goods_name goodsName,
+        tg.goods_introduction goodsIntroduction,
+        tg.goods_type goodsType,
+        tg.goods_tags goodsTag,
+        IFNULL(tsg.sales_price,tg.sales_price) salesPrice,
+        tg.sales_price suggestSalesPrice,
+        tgf.file_url goodsPicture,
+        tg.goods_nurses goodsNurses,
+        tg.cycle_num_flag cycleNumFlag,
+        tg.service_num defaultServiceNum,
+        IFNULL(tsg.service_num,tg.service_num) serviceNum
+        FROM t_goods tg
+        LEFT JOIN t_goods_file tgf ON tg.goods_id = tgf.goods_id AND tgf.del_flag = 0 AND tgf.file_type = 1
+        LEFT JOIN t_shop_goods tsg ON tg.goods_id = tsg.goods_id AND tsg.shop_id = #{param.shopId} AND tsg.del_flag = 0
+        WHERE tg.del_flag = 0 AND tg.goods_status = 1  AND tg.goods_type = 1 AND cycle_num_flag = 1
+        ORDER BY tg.create_time DESC
+    </select>
+
+
     <select id="pageMgtGoods" resultType="com.ruoyi.goods.domain.vo.MgtGoodsPageVo">
         SELECT
         tg.goods_id goodsId,
diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MgtCouponEditDto.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MgtCouponEditDto.java
index 4fc08a3..2096001 100644
--- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MgtCouponEditDto.java
+++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MgtCouponEditDto.java
@@ -1,5 +1,6 @@
 package com.ruoyi.member.domain.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.system.api.domain.dto.MgtBaseDto;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -42,6 +43,7 @@
     private Integer sendTimeType;
 
     @ApiModelProperty(value="发送时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date sendTime;
 
     @ApiModelProperty(value = "使用范围1.全场2.指定商品")
diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/scheduler/MemberScheduler.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/scheduler/MemberScheduler.java
index 682b46a..61412fa 100644
--- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/scheduler/MemberScheduler.java
+++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/scheduler/MemberScheduler.java
@@ -43,7 +43,7 @@
     /**
      * 定时检查优惠券过期
      */
-    @Scheduled(cron="1 0 * * * ?")
+    @Scheduled(cron="1 0 0 * * ?")
     private void timingCheckMemberCoupon(){
         if(schedulerUtils.getSchedulerRun()) {
             log.info("定时检查优惠券过期任务开始执行");
@@ -51,7 +51,7 @@
         }
     }
 
-    @Scheduled(cron="3 0 * * * ?")
+    @Scheduled(cron="3 0 0 * * ?")
     private void timinginitIntegralFlag(){
         if(schedulerUtils.getSchedulerRun()) {
             log.info("定时更新用户每日任务标记");
diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java
index 23caea9..a39dd9c 100644
--- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java
+++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java
@@ -685,6 +685,11 @@
     member.setBirthday(merMemberEditDto.getBirthday());
     member.setUpdateUserId(merMemberEditDto.getUserId());
     member.setUpdateTime(new Date());
+    List<String> memberNurse = merMemberEditDto.getMemberNurse();
+    if(memberNurse!=null&&!memberNurse.isEmpty()){
+        String memberNurseString = String.join(",", memberNurse);
+        member.setMemberNurse(memberNurseString);
+    }
     this.saveOrUpdate(member);
      // 更新用户手机号
     SysUser sysUser = new SysUser();
diff --git a/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberMapper.xml b/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberMapper.xml
index 4d1de36..82090cd 100644
--- a/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberMapper.xml
+++ b/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberMapper.xml
@@ -27,10 +27,11 @@
         <result property="bindingFlag"    column="binding_flag"    />
         <result property="goodsType"    column="goods_type"    />
         <result property="relationShopName"    column="relation_shop_name"    />
+        <result property="memberNurse"    column="member_nurse"    />
     </resultMap>
 
     <sql id="selectMemberVo">
-        select user_id, del_flag, member_id, member_no, wx_openid, mini_openid, wx_unionid, relation_shop_id, nick_name, real_name, mobile, gender, referrer, customer_source, level, birthday, create_time, update_time, update_user_id, user_tags, avatar, binding_flag, goods_type,relation_shop_name from t_member
+        select user_id, del_flag, member_id, member_no, wx_openid, mini_openid, wx_unionid, relation_shop_id, nick_name, real_name, mobile, gender, referrer, customer_source, level, birthday, create_time, update_time, update_user_id, user_tags, avatar, binding_flag, goods_type,relation_shop_name,member_nurse from t_member
     </sql>
 
     <select id="selectMemberList" parameterType="com.ruoyi.system.api.domain.poji.member.Member" resultMap="MemberResult">
@@ -257,7 +258,7 @@
             AND Date(tm.create_time) = #{param.createTime}
         </if>
         <if test="param.lastPayTime != null and param.lastPayTime != ''">
-            AND tmt.last_pay_time = #{param.lastPayTime}
+            AND Date(tmt.last_pay_time) = #{param.lastPayTime}
         </if>
         <if test="param.memberFlag != null ">
             AND tm.binding_flag = #{param.memberFlag}
diff --git a/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberSuggestMapper.xml b/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberSuggestMapper.xml
index 9dfebce..f85c6f3 100644
--- a/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberSuggestMapper.xml
+++ b/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberSuggestMapper.xml
@@ -80,6 +80,6 @@
         <if test="param.shopIds!=null and param.shopIds!=''">
             AND tms.shop_id IN (#{param.shopIds})
         </if>
-        ORDER BY tms.create_time DESC
+        ORDER BY tms.replay_flag ASC,tms.create_time DESC
     </select>
 </mapper>
diff --git a/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberTotalMapper.xml b/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberTotalMapper.xml
index d5a7620..4279c48 100644
--- a/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberTotalMapper.xml
+++ b/ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberTotalMapper.xml
@@ -3,7 +3,7 @@
 <mapper namespace="com.ruoyi.member.mapper.member.MemberTotalMapper">
 
     <update id="initIntegralFlag">
-        UPDATE member_total SET share_flag = 0,pl_suggest_flag = 0,shop_suggest_flag = 0,sign_flag = 0,buy_flag = 0
+        UPDATE t_member_total SET share_flag = 0,pl_suggest_flag = 0,shop_suggest_flag = 0,sign_flag = 0,buy_flag = 0
     </update>
 
 
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsDto.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsDto.java
index afd4a88..8d3545d 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsDto.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsDto.java
@@ -19,6 +19,9 @@
     @ApiModelProperty(value = "会员用户id")
     private Long memberUserId;
 
+    @ApiModelProperty(value = "服务id")
+    private String consumerGoodsId;
+
     @ApiModelProperty(value = "确认服务列表")
     private List<MerSureConsumerGoodsListDto> merSureConsumerGoodsListDtoList;
 
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsListDto.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsListDto.java
index c4daaa4..9662c94 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsListDto.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerSureConsumerGoodsListDto.java
@@ -13,10 +13,15 @@
 @Data
 public class MerSureConsumerGoodsListDto {
 
-
     @ApiModelProperty(value = "服务id")
     private String consumerGoodsId;
 
     @ApiModelProperty(value = "服务次数")
     private Integer serviceNum;
+
+    @ApiModelProperty(value = "商品id")
+    private String goodsId;
+
+    @ApiModelProperty(value = "商品次数")
+    private Integer goodsNum;
 }
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/pojo/order/ConsumerGoods.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/pojo/order/ConsumerGoods.java
index 6f8e822..a9f97c6 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/pojo/order/ConsumerGoods.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/pojo/order/ConsumerGoods.java
@@ -134,6 +134,9 @@
     @TableField("member_coupon_id")
     private String memberCouponId;
 
+    @TableField("sure_num")
+    private Integer sureNum;
+
     @Override
     protected Serializable pkVal() {
         return this.consumerGoodsId;
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/AppUserOrderGetVo.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/AppUserOrderGetVo.java
index 5952871..f889c66 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/AppUserOrderGetVo.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/AppUserOrderGetVo.java
@@ -88,4 +88,8 @@
 
     @ApiModelProperty(value = "核销码")
     private String verifyCode;
+
+    @ApiModelProperty(value="结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date endTime;
 }
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerConsumerGoodsListVo.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerConsumerGoodsListVo.java
index 9e3cff3..d7ce21d 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerConsumerGoodsListVo.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerConsumerGoodsListVo.java
@@ -45,4 +45,7 @@
 
     @ApiModelProperty(value="消耗次数")
     private Integer usedNum;
+
+    @ApiModelProperty(value="待确认次数")
+    private Integer sureNum;
 }
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/order/OrderMapper.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/order/OrderMapper.java
index c0d87d4..3196d4f 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/order/OrderMapper.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/order/OrderMapper.java
@@ -471,10 +471,10 @@
      * @description 获取各年龄层统计
      * @author  jqs
      * @date    2023/7/4 10:27
-     * @param userIdList
+     * @param merTotalDto
      * @return  MgtMapTotalPlusVo
      */
-    MgtMapTotalPlusVo listMerOrderDistributionTotal(@Param("userIdList")List<Long> userIdList);
+    List<MgtMapTotalPlusVo> listMerOrderDistributionTotal(@Param("param")MerTotalDto merTotalDto);
 
     /**
      * @description 商户获取销售占比统计
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java
index 91de5b9..40e2f7e 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java
@@ -96,6 +96,10 @@
     @Override
     @Transactional
     public void sureMerConsumerGoods(MerSureConsumerGoodsDto merSureConsumerGoodsDto){
+        ConsumerGoods oldConsumerGoods = this.getById(merSureConsumerGoodsDto.getConsumerGoodsId());
+        if(oldConsumerGoods.getSureNum()==null||oldConsumerGoods.getSureNum()<1){
+            throw new ServiceException(AppErrorConstant.GOODS_SURE_FAILED);
+        }
         List<MerSureConsumerGoodsListDto> merSureConsumerGoodsListDtoList = merSureConsumerGoodsDto.getMerSureConsumerGoodsListDtoList();
         if(merSureConsumerGoodsListDtoList!=null && !merSureConsumerGoodsListDtoList.isEmpty()){
             ConsumerGoods consumerGoods;
@@ -106,27 +110,68 @@
             Integer servicePerson = 0;
             Integer experienceService = 0;
             Integer experiencePerson = 0;
+            Goods goods;
+            GoodsFile goodsFile;
+            String consumerGoodsId;
+            List<ConsumerGoods> consumerGoodsList = new ArrayList<>();
             MerMemberConsumerGoodsTotalVo memberConsumerGoodsTotalVo = this.getMemberConsumerGoodsTotalVo(merSureConsumerGoodsDto.getUserId(), merSureConsumerGoodsDto.getShopId());
+            int sureNum = 0;
             for(MerSureConsumerGoodsListDto merSureConsumerGoodsListDto : merSureConsumerGoodsListDtoList){
-                consumerGoods = this.getById(merSureConsumerGoodsListDto.getConsumerGoodsId());
-                consumerGoods.setCycleNumFlag(1);
-                consumerGoods.setServiceNum(merSureConsumerGoodsListDto.getServiceNum());
-                this.saveOrUpdate(consumerGoods);
-                //处理商品服务次数
-                switch (consumerGoods.getGoodsType()) {
-                    case 1:
-                        cycleService = cycleService + consumerGoods.getServiceNum();
-                        break;
-                    case 2:
-                        serviceService = serviceService + consumerGoods.getServiceNum();
-                        break;
-                    case 3:
-                        experienceService = experienceService + consumerGoods.getServiceNum();
-                        break;
-                    default:
-                        break;
+                goods = remoteGoodsService.getGoods(merSureConsumerGoodsListDto.getGoodsId()).getData();
+                goodsFile = remoteGoodsService.getGoodsFile(goods.getGoodsId()).getData();
+                if(goods!=null&&goods.getGoodsType()==1&&goods.getCycleNumFlag()==1){
+                    for(int i=0;i<merSureConsumerGoodsListDto.getGoodsNum();i++){
+                        consumerGoods = new ConsumerGoods();
+                        consumerGoodsId = IdUtils.simpleUUID();
+                        consumerGoods.setConsumerGoodsId(consumerGoodsId);
+                        consumerGoods.setDelFlag(0);
+                        consumerGoods.setServiceStatus(1);
+                        consumerGoods.setShopId(merSureConsumerGoodsDto.getShopId());
+                        consumerGoods.setUserId(merSureConsumerGoodsDto.getMemberUserId());
+                        consumerGoods.setOrderId(oldConsumerGoods.getOrderId());
+                        consumerGoods.setOrderGoodsId(oldConsumerGoods.getOrderGoodsId());
+                        consumerGoods.setGoodsId(goods.getGoodsId());
+                        consumerGoods.setGoodsName(goods.getGoodsName());
+                        consumerGoods.setCycleNumFlag(goods.getCycleNumFlag());
+                        consumerGoods.setServiceNum(goods.getServiceNum());
+                        consumerGoods.setUsedNum(0);
+                        consumerGoods.setCreateTime(new Date());
+                        consumerGoods.setGoodsType(goods.getGoodsType());
+                        consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction());
+                        consumerGoods.setGoodsPicture(goodsFile.getFileUrl());
+                        consumerGoods.setGoodsNurses(goods.getGoodsNurses());
+                        consumerGoods.setSourceFrom(1);
+                        consumerGoodsList.add(consumerGoods);
+                        //处理商品服务次数
+                        switch (consumerGoods.getGoodsType()) {
+                            case 1:
+                                cycleService = cycleService + consumerGoods.getServiceNum();
+                                break;
+                            case 2:
+                                serviceService = serviceService + consumerGoods.getServiceNum();
+                                break;
+                            case 3:
+                                experienceService = experienceService + consumerGoods.getServiceNum();
+                                break;
+                            default:
+                                break;
+                        }
+                        sureNum = sureNum + 1;
+                    }
                 }
             }
+            if(sureNum>oldConsumerGoods.getSureNum()){
+                throw new ServiceException(AppErrorConstant.GOODS_SURE_FAILED);
+            }else{
+                int surpNum = oldConsumerGoods.getSureNum();
+                surpNum = surpNum - sureNum;
+                oldConsumerGoods.setSureNum(surpNum);
+                if(surpNum==0){
+                    oldConsumerGoods.setDelFlag(1);
+                }
+                this.saveOrUpdate(oldConsumerGoods);
+            }
+            this.saveBatch(consumerGoodsList);
             //判断是否加人
             if (cycleService > 0 && memberConsumerGoodsTotalVo.getCycleOrder() == 0) {
                 cyclePerson = 1;
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
index 14598a7..9d319da 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -415,8 +415,12 @@
         if (activityGoodsGetVo.getActivityStatus() == 2) {
             throw new ServiceException(AppErrorConstant.ACTIVITY_END);
         }
-        if (activityGoodsGetVo.getAvailableBuyNum() < 1) {
+        Integer surpNum = redisService.getCacheObject(SecurityConstant.ACTIVITY_GOODS+"-"+activityId+"-"+goodsId);
+        if(surpNum==null||surpNum<1){
             throw new ServiceException(AppErrorConstant.ACTIVITY_GOODS_NULL);
+        }
+        if (activityGoodsGetVo.getAvailableBuyNum() < 1) {
+            throw new ServiceException(AppErrorConstant.ACTIVITY_GOODS_BEYOND);
         }
         if (activityGoodsGetVo.getAvailableBuyNum() < buyNum) {
             throw new ServiceException(AppErrorConstant.ACTIVITY_GOODS_BEYOND);
@@ -1122,6 +1126,12 @@
         appUserOrderGetVo.setShopName(shop.getShopName());
         appUserOrderGetVo.setAppUserOrderGoodsPageVoList(appUserOrderGoodsPageVoList);
         appUserOrderGetVo.setVerifyCode("1-" + orderId);
+        //生成自动取消订单延时任务
+        Integer delayTime = 30;
+        if(redisService.hasKey(SecurityConstant.AUTO_CANCEL_ORDER_TIME)){
+            delayTime = redisService.getCacheObject(SecurityConstant.AUTO_CANCEL_ORDER_TIME);
+        }
+        appUserOrderGetVo.setEndTime(DateUtils.addMinutes(order.getCreateTime(),delayTime));
         return appUserOrderGetVo;
     }
 
@@ -1274,28 +1284,57 @@
         Goods goods;
         List<ConsumerGoods> consumerGoodsList = new ArrayList<>();
         for (AppUserOrderGoodsPageVo appUserOrderGoodsPageVo : appUserOrderGoodsPageVoList) {
-            consumerGoods = new ConsumerGoods();
-            goods = goodsMap.get(appUserOrderGoodsPageVo.getGoodsId());
-            consumerGoodsId = IdUtils.simpleUUID();
-            consumerGoods.setConsumerGoodsId(consumerGoodsId);
-            consumerGoods.setDelFlag(0);
-            consumerGoods.setServiceStatus(1);
-            consumerGoods.setShopId(order.getShopId());
-            consumerGoods.setUserId(order.getUserId());
-            consumerGoods.setOrderId(orderId);
-            consumerGoods.setOrderGoodsId(appUserOrderGoodsPageVo.getOrderGoodsId());
-            consumerGoods.setGoodsId(appUserOrderGoodsPageVo.getGoodsId());
-            consumerGoods.setGoodsName(appUserOrderGoodsPageVo.getGoodsName());
-            consumerGoods.setCycleNumFlag(appUserOrderGoodsPageVo.getCycleNumFlag());
-            consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum());
-            consumerGoods.setUsedNum(0);
-            consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType());
-            consumerGoods.setCreateTime(nowTime);
-            consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction());
-            consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture());
-            consumerGoods.setGoodsNurses(goods.getGoodsNurses());
-            consumerGoods.setSourceFrom(1);
-            consumerGoodsList.add(consumerGoods);
+            Integer buyNum = appUserOrderGoodsPageVo.getBuyNum();
+            if(appUserOrderGoodsPageVo.getCycleNumFlag()==0){
+                consumerGoods = new ConsumerGoods();
+                goods = goodsMap.get(appUserOrderGoodsPageVo.getGoodsId());
+                consumerGoodsId = IdUtils.simpleUUID();
+                consumerGoods.setConsumerGoodsId(consumerGoodsId);
+                consumerGoods.setDelFlag(0);
+                consumerGoods.setServiceStatus(1);
+                consumerGoods.setShopId(order.getShopId());
+                consumerGoods.setUserId(order.getUserId());
+                consumerGoods.setOrderId(orderId);
+                consumerGoods.setOrderGoodsId(appUserOrderGoodsPageVo.getOrderGoodsId());
+                consumerGoods.setGoodsId(appUserOrderGoodsPageVo.getGoodsId());
+                consumerGoods.setGoodsName(appUserOrderGoodsPageVo.getGoodsName());
+                consumerGoods.setCycleNumFlag(appUserOrderGoodsPageVo.getCycleNumFlag());
+                consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum());
+                consumerGoods.setUsedNum(0);
+                consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType());
+                consumerGoods.setCreateTime(nowTime);
+                consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction());
+                consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture());
+                consumerGoods.setGoodsNurses(goods.getGoodsNurses());
+                consumerGoods.setSourceFrom(1);
+                consumerGoods.setSureNum(buyNum);
+                consumerGoodsList.add(consumerGoods);
+            }else{
+                for(int i=0;i<buyNum;i++){
+                    consumerGoods = new ConsumerGoods();
+                    goods = goodsMap.get(appUserOrderGoodsPageVo.getGoodsId());
+                    consumerGoodsId = IdUtils.simpleUUID();
+                    consumerGoods.setConsumerGoodsId(consumerGoodsId);
+                    consumerGoods.setDelFlag(0);
+                    consumerGoods.setServiceStatus(1);
+                    consumerGoods.setShopId(order.getShopId());
+                    consumerGoods.setUserId(order.getUserId());
+                    consumerGoods.setOrderId(orderId);
+                    consumerGoods.setOrderGoodsId(appUserOrderGoodsPageVo.getOrderGoodsId());
+                    consumerGoods.setGoodsId(appUserOrderGoodsPageVo.getGoodsId());
+                    consumerGoods.setGoodsName(appUserOrderGoodsPageVo.getGoodsName());
+                    consumerGoods.setCycleNumFlag(appUserOrderGoodsPageVo.getCycleNumFlag());
+                    consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum());
+                    consumerGoods.setUsedNum(0);
+                    consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType());
+                    consumerGoods.setCreateTime(nowTime);
+                    consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction());
+                    consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture());
+                    consumerGoods.setGoodsNurses(goods.getGoodsNurses());
+                    consumerGoods.setSourceFrom(1);
+                    consumerGoodsList.add(consumerGoods);
+                }
+            }
         }
         consumerGoodsService.saveBatchConsumerGoods(consumerGoodsList);
         //生成返回
@@ -1792,29 +1831,61 @@
         List<AppUserOrderGoodsPageVo> appUserOrderGoodsPageVoList = orderGoodsService.listAppVoByOrderId(orderId);
         ConsumerGoods consumerGoods;
         String consumerGoodsId;
+        List<ConsumerGoods> consumerGoodsList = new ArrayList<>();
         for (AppUserOrderGoodsPageVo appUserOrderGoodsPageVo : appUserOrderGoodsPageVoList) {
-            consumerGoods = new ConsumerGoods();
-            goods = remoteGoodsService.getGoods(appUserOrderGoodsPageVo.getGoodsId()).getData();
-            consumerGoodsId = IdUtils.simpleUUID();
-            consumerGoods.setConsumerGoodsId(consumerGoodsId);
-            consumerGoods.setDelFlag(0);
-            consumerGoods.setServiceStatus(1);
-            consumerGoods.setShopId(order.getShopId());
-            consumerGoods.setUserId(order.getUserId());
-            consumerGoods.setOrderId(orderId);
-            consumerGoods.setOrderGoodsId(appUserOrderGoodsPageVo.getOrderGoodsId());
-            consumerGoods.setGoodsId(appUserOrderGoodsPageVo.getGoodsId());
-            consumerGoods.setGoodsName(appUserOrderGoodsPageVo.getGoodsName());
-            consumerGoods.setCycleNumFlag(appUserOrderGoodsPageVo.getCycleNumFlag());
-            consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum());
-            consumerGoods.setUsedNum(0);
-            consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType());
-            consumerGoods.setCreateTime(nowTime);
-            consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction());
-            consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture());
-            consumerGoods.setGoodsNurses(goods.getGoodsNurses());
-            consumerGoodsService.save(consumerGoods);
+            Integer buyGoodsNum = appUserOrderGoodsPageVo.getBuyNum();
+            if(appUserOrderGoodsPageVo.getCycleNumFlag()==0){
+                consumerGoods = new ConsumerGoods();
+                goods = remoteGoodsService.getGoods(appUserOrderGoodsPageVo.getGoodsId()).getData();
+                consumerGoodsId = IdUtils.simpleUUID();
+                consumerGoods.setConsumerGoodsId(consumerGoodsId);
+                consumerGoods.setDelFlag(0);
+                consumerGoods.setServiceStatus(1);
+                consumerGoods.setShopId(order.getShopId());
+                consumerGoods.setUserId(order.getUserId());
+                consumerGoods.setOrderId(orderId);
+                consumerGoods.setOrderGoodsId(appUserOrderGoodsPageVo.getOrderGoodsId());
+                consumerGoods.setGoodsId(appUserOrderGoodsPageVo.getGoodsId());
+                consumerGoods.setGoodsName(appUserOrderGoodsPageVo.getGoodsName());
+                consumerGoods.setCycleNumFlag(appUserOrderGoodsPageVo.getCycleNumFlag());
+                consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum());
+                consumerGoods.setUsedNum(0);
+                consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType());
+                consumerGoods.setCreateTime(nowTime);
+                consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction());
+                consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture());
+                consumerGoods.setGoodsNurses(goods.getGoodsNurses());
+                consumerGoods.setSourceFrom(1);
+                consumerGoods.setSureNum(buyGoodsNum);
+                consumerGoodsList.add(consumerGoods);
+            }else{
+                for(int i=0;i<buyGoodsNum;i++) {
+                    consumerGoods = new ConsumerGoods();
+                    goods = remoteGoodsService.getGoods(appUserOrderGoodsPageVo.getGoodsId()).getData();
+                    consumerGoodsId = IdUtils.simpleUUID();
+                    consumerGoods.setConsumerGoodsId(consumerGoodsId);
+                    consumerGoods.setDelFlag(0);
+                    consumerGoods.setServiceStatus(1);
+                    consumerGoods.setShopId(order.getShopId());
+                    consumerGoods.setUserId(order.getUserId());
+                    consumerGoods.setOrderId(orderId);
+                    consumerGoods.setOrderGoodsId(appUserOrderGoodsPageVo.getOrderGoodsId());
+                    consumerGoods.setGoodsId(appUserOrderGoodsPageVo.getGoodsId());
+                    consumerGoods.setGoodsName(appUserOrderGoodsPageVo.getGoodsName());
+                    consumerGoods.setCycleNumFlag(appUserOrderGoodsPageVo.getCycleNumFlag());
+                    consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum());
+                    consumerGoods.setUsedNum(0);
+                    consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType());
+                    consumerGoods.setCreateTime(nowTime);
+                    consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction());
+                    consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture());
+                    consumerGoods.setGoodsNurses(goods.getGoodsNurses());
+                    consumerGoods.setSourceFrom(1);
+                    consumerGoodsList.add(consumerGoods);
+                }
+            }
         }
+        consumerGoodsService.saveBatchConsumerGoods(consumerGoodsList);
         Member member = remoteMemberService.getMember(userId).getData();
         if (member != null && member.getBindingFlag() != 1) {
             //绑定商户
@@ -3004,9 +3075,9 @@
         }
         MerOrderDistributionTotalVo orderDistributionTotalVo = new MerOrderDistributionTotalVo();
         // 获取订单年龄用户列表
-        List<MerOrderAgeUserVo> orderAgeUserVoList = remoteMemberService.listOrderAgeUser(merTotalDto).getData();
+        //List<MerOrderAgeUserVo> orderAgeUserVoList = remoteMemberService.listOrderAgeUser(merTotalDto).getData();
         // 如果订单年龄用户列表不为空
-        if (orderAgeUserVoList != null && !orderAgeUserVoList.isEmpty()) {
+        /*if (orderAgeUserVoList != null && !orderAgeUserVoList.isEmpty()) {
             // 定义变量
             Integer ageType;
             List<Long> userIdList;
@@ -3047,12 +3118,23 @@
                     orderTotalValue[i] = 0;
                     orderMoneyValue[i] = BigDecimal.ZERO;
                 }
+            }*/
+            List<MgtMapTotalPlusVo> mgtMapTotalPlusVoList =  orderMapper.listMerOrderDistributionTotal(merTotalDto);
+            if(mgtMapTotalPlusVoList!=null&&!mgtMapTotalPlusVoList.isEmpty()) {
+                String[] orderTotalKey = new String[mgtMapTotalPlusVoList.size()];
+                Integer[] orderTotalValue = new Integer[mgtMapTotalPlusVoList.size()];
+                BigDecimal[] orderMoneyValue = new BigDecimal[mgtMapTotalPlusVoList.size()];
+                MgtMapTotalPlusVo mgtMapTotalPlusVo;
+                for (int i = 0; i < mgtMapTotalPlusVoList.size(); i++) {
+                    mgtMapTotalPlusVo = mgtMapTotalPlusVoList.get(i);
+                    orderTotalKey[i] = mgtMapTotalPlusVo.getMapKey();
+                    orderTotalValue[i] = mgtMapTotalPlusVo.getMapValueFirst();
+                    orderMoneyValue[i] = mgtMapTotalPlusVo.getMapValueSecond();
+                }
+                orderDistributionTotalVo.setOrderTotalKey(orderTotalKey);
+                orderDistributionTotalVo.setOrderTotalValue(orderTotalValue);
+                orderDistributionTotalVo.setOrderMoneyValue(orderMoneyValue);
             }
-            // 设置订单分布总数对象的属性值
-            orderDistributionTotalVo.setOrderTotalKey(orderTotalKey);
-            orderDistributionTotalVo.setOrderTotalValue(orderTotalValue);
-            orderDistributionTotalVo.setOrderMoneyValue(orderMoneyValue);
-        }
         // 返回订单分布总数对象
         return orderDistributionTotalVo;
     }
@@ -3157,11 +3239,11 @@
     }
 
     /**
-     * @param merBaseDto
-     * @return MerTotalOrderVo
-     * @description 商户端订单管理统计
-     * @author jqs
-     * @date 2023/7/4 16:27
+     * @description  商户端订单管理统计
+     * @author  jqs
+     * @date    2023/7/31 10:53
+     * @param merOrderPageDto
+     * @return  MerTotalOrderVo
      */
     @Override
     public MerTotalOrderVo totalMerOrder(MerOrderPageDto merOrderPageDto) {
diff --git a/ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/ConsumerGoodsMapper.xml b/ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/ConsumerGoodsMapper.xml
index 2b9ef9c..dacb5b1 100644
--- a/ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/ConsumerGoodsMapper.xml
+++ b/ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/ConsumerGoodsMapper.xml
@@ -149,7 +149,8 @@
         tcg.goods_nurses goodsNurses,
         tcg.cycle_num_flag cycleNumFlag,
         tcg.service_num serviceNum,
-        tcg.used_num usedNum
+        tcg.used_num usedNum,
+        tcg.sure_num sureNum
         FROM t_consumer_goods tcg
         WHERE tcg.del_flag = 0 AND tcg.user_id = #{param.memberUserId} AND tcg.shop_id = #{param.shopId} AND tcg.service_status = 1
         AND tcg.goods_type = 1 AND tcg.cycle_num_flag = 0
diff --git a/ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml b/ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
index 1b0d3a1..3845fc3 100644
--- a/ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
+++ b/ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -61,6 +61,7 @@
         <result column="receivableMoney" property="receivableMoney"/>
         <result column="receivableDeposit" property="receivableDeposit"/>
         <result column="payMoney" property="payMoney"/>
+        <result column="receiveMoney" property="receiveMoney"/>
         <result column="orderRemark" property="orderRemark" />
         <result column="orderFrom" property="orderFrom" />
         <result column="createTime" property="createTime" />
@@ -1327,13 +1328,23 @@
 
     <select id="listMerOrderDistributionTotal" resultType="com.ruoyi.order.domain.vo.MgtMapTotalPlusVo">
         SELECT
-        COUNT(order_id) AS mapValueFirst,
-        IFNULL(SUM(order_money),0) AS mapValueSecond
-        FROM t_order
-        WHERE del_flag = 0 AND user_id IN
-        <foreach collection="userIdList" item="item" open="(" separator="," close=")">
-            #{item}
-        </foreach>
+            DATE(toc.create_time) AS mapKey,
+            COUNT(DISTINCT tog.order_id) AS mapValueFirst,
+            SUM(tog.order_money) AS mapValueSecond
+        FROM t_order toc
+        INNER JOIN t_order_goods tog ON toc.order_id = tog.order_id
+        WHERE toc.del_flag = 0 AND tog.del_flag = 0 AND tog.goods_type = #{param.goodsType}
+        <if test="param.shopId != null and param.shopId != ''">
+            AND shop_id = #{param.shopId}
+        </if>
+        <if test="param.shopIdList != null and param.shopIdList.size() > 0">
+            AND shop_id IN
+            <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND toc.create_time >= DATE_SUB(CURDATE(), INTERVAL 5 DAY)
+        GROUP BY mapKey
     </select>
 
     <select id="listMerOrderTotalGoodsType" resultType="com.ruoyi.order.domain.vo.MgtMapTotalPlusVo">
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateAgencyTaskDto.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateAgencyTaskDto.java
index 8fa8f3e..bf9a270 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateAgencyTaskDto.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateAgencyTaskDto.java
@@ -23,5 +23,6 @@
     @ApiModelProperty(value = "任务内容")
     private String taskContent;
 
-
+    @ApiModelProperty(value="紧急情况")
+    private String emergencyState;;
 }
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateMemberTaskDto.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateMemberTaskDto.java
index 88ce154..6fb65d2 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateMemberTaskDto.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerCreateMemberTaskDto.java
@@ -4,8 +4,6 @@
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.util.Date;
-
 /**
  * @author jqs34
  * @ClassName merCreateMemberTaskDto
@@ -25,5 +23,6 @@
     @ApiModelProperty(value = "任务内容")
     private String taskContent;
 
-
+    @ApiModelProperty(value="紧急情况")
+    private String emergencyState;;
 }
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java
index d32df7f..60519d3 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java
@@ -43,6 +43,9 @@
     @ApiModelProperty(value="下次任务时间")
     private String nextTaskDate;
 
+    @ApiModelProperty(value="下次任务紧急情况")
+    private String emergencyState;;
+
     @ApiModelProperty(value="下次任务内容")
     private String nextTaskContent;
 
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java
index 5a01f0f..d2a21ea 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java
@@ -43,6 +43,9 @@
     @ApiModelProperty(value="下次任务时间")
     private String nextTaskDate;
 
+    @ApiModelProperty(value="下次任务紧急情况")
+    private String emergencyState;;
+
     @ApiModelProperty(value="下次任务内容")
     private String nextTaskContent;
 
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/AgencyTask.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/AgencyTask.java
index f0556dd..11eea93 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/AgencyTask.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/AgencyTask.java
@@ -1,17 +1,15 @@
 package com.ruoyi.shop.domain.pojo.task;
 
-import java.util.Date;
-import java.io.Serializable;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -69,7 +67,11 @@
      */
     @TableField("task_status")
     private Integer taskStatus;
-
+    /**
+     * 紧急情况
+     */
+    @TableField("emergency_state")
+    private String emergencyState;
 
     @Override
     protected Serializable pkVal() {
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/MemberTask.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/MemberTask.java
index 890cb9f..e04bfea 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/MemberTask.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/task/MemberTask.java
@@ -1,15 +1,15 @@
 package com.ruoyi.shop.domain.pojo.task;
 
-import java.util.Date;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -46,6 +46,11 @@
      */
     @TableField("task_status")
     private Integer taskStatus;
+    /**
+     * 紧急情况
+     */
+    @TableField("emergency_state")
+    private String emergencyState;
 
     @Override
     protected Serializable pkVal() {
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerAgencyTaskPageVo.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerAgencyTaskPageVo.java
index 3505125..566edc4 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerAgencyTaskPageVo.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerAgencyTaskPageVo.java
@@ -3,8 +3,6 @@
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.util.Date;
-
 /**
  * @author jqs34
  * @ClassName MerMemberTaskPageVo
@@ -27,4 +25,8 @@
     @ApiModelProperty(value="今日标记")
     private Integer todayFlag;
 
+    @ApiModelProperty(value="紧急情况")
+    private String emergencyState;;
+
+
 }
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerMemberTaskPageVo.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerMemberTaskPageVo.java
index bfe0184..ba51931 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerMemberTaskPageVo.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MerMemberTaskPageVo.java
@@ -1,11 +1,7 @@
 package com.ruoyi.shop.domain.vo;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-
-import java.util.Date;
 
 /**
  * @author jqs34
@@ -29,6 +25,8 @@
     @ApiModelProperty(value="处理内容")
     private String dealContent;
 
+    @ApiModelProperty(value="紧急情况")
+    private String emergencyState;;
 
     @ApiModelProperty(value="今日标记")
     private Integer todayFlag;
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java
index c4848ff..30e138c 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java
@@ -78,6 +78,7 @@
         agencyTask.setAgencyId(merCreateAgencyTaskDto.getAgencyId());
         agencyTask.setTaskDate(merCreateAgencyTaskDto.getTaskDate());
         agencyTask.setTaskContent(merCreateAgencyTaskDto.getTaskContent());
+        agencyTask.setEmergencyState(merCreateAgencyTaskDto.getEmergencyState());
         agencyTask.setCreateTime(new Date());
         this.saveOrUpdate(agencyTask);
     }
@@ -169,7 +170,16 @@
             agencyTask.setAgencyId(oldAgencyTask.getAgencyId());
             agencyTask.setTaskDate(merFollowAgencyTaskDto.getNextTaskDate());
             agencyTask.setTaskContent(merFollowAgencyTaskDto.getNextTaskContent());
-            agencyTask.setTaskStatus(2);
+            agencyTask.setEmergencyState(merFollowAgencyTaskDto.getEmergencyState());
+            String nowTimeStr = DateUtils.getDate();
+            int i = merFollowAgencyTaskDto.getNextTaskDate().compareTo(nowTimeStr);
+            if(i>0){
+                agencyTask.setTaskStatus(0);
+            }else if(i==0){
+                agencyTask.setTaskStatus(1);
+            }else{
+                agencyTask.setTaskStatus(3);
+            }
             agencyTask.setCreateTime(new Date());
             this.saveOrUpdate(agencyTask);
         }
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java
index 50a5f25..731f9a4 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java
@@ -93,6 +93,7 @@
         }else{
             memberTask.setTaskStatus(3);
         }
+        memberTask.setEmergencyState(merCreateMemberTaskDto.getEmergencyState());
         memberTask.setShopId(merCreateMemberTaskDto.getShopId());
         memberTask.setUserId(merCreateMemberTaskDto.getMemberUserId());
         memberTask.setTaskDate(merCreateMemberTaskDto.getTaskDate());
@@ -205,6 +206,7 @@
             memberTask.setUserId(oldMemberTask.getUserId());
             memberTask.setTaskDate(merFollowMemberTaskDto.getNextTaskDate());
             memberTask.setTaskContent(merFollowMemberTaskDto.getNextTaskContent());
+            memberTask.setEmergencyState(merFollowMemberTaskDto.getEmergencyState());
             int i = merFollowMemberTaskDto.getNextTaskDate().compareTo(nowTimeStr);
             if(i>0){
                 memberTask.setTaskStatus(0);
diff --git a/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopMapper.xml b/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopMapper.xml
index a795e00..e490eaa 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopMapper.xml
+++ b/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopMapper.xml
@@ -339,8 +339,11 @@
         <if test="param.signAreaCode!=null and param.signAreaCode!=''">
             AND ts.sign_area_code = #{param.signAreaCode}
         </if>
-        <if test="param.shopStatus!=null and param.shopStatus!=''">
-            AND ts.shop_status = #{param.shopStatus}
+        <if test="param.shopStatus!=null and param.shopStatus==0">
+            AND ts.frozen_flag = 1
+        </if>
+        <if test="param.shopStatus!=null and param.shopStatus==1">
+            AND ts.frozen_flag = 0
         </if>
         <if test="param.recommendPerson!=null and param.recommendPerson!=''">
             AND ts.recommend_person = #{param.recommendPerson}
diff --git a/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopSuggestMapper.xml b/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopSuggestMapper.xml
index 1f5f4bd..d4f4d9b 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopSuggestMapper.xml
+++ b/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopSuggestMapper.xml
@@ -58,6 +58,6 @@
         <if test="param.replayEndTime!=null and param.replayEndTime!=''">
             AND Date(tss.replay_time) &lt;= #{param.replayEndTime}
         </if>
-        ORDER BY tss.create_time DESC
+        ORDER BY tss.replay_flag ASC,tss.create_time DESC
     </select>
 </mapper>
diff --git a/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/AgencyTaskMapper.xml b/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/AgencyTaskMapper.xml
index 71a0d3a..f6ef362 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/AgencyTaskMapper.xml
+++ b/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/AgencyTaskMapper.xml
@@ -18,7 +18,8 @@
         tat.task_id taskId,
         tat.task_date taskDate,
         tat.task_content taskContent,
-        tmtr.follow_content dealContent
+        tmtr.follow_content dealContent,
+        tat.emergency_state emergencyState
         FROM t_agency_task tat
         LEFT JOIN t_agency_task_record tmtr ON tat.task_id = tmtr.task_id
         WHERE tat.del_flag = 0 AND tat.shop_id = #{param.shopId} AND tat.agency_id = #{param.agencyId}
diff --git a/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/MemberTaskMapper.xml b/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/MemberTaskMapper.xml
index 26f0f93..72fba4e 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/MemberTaskMapper.xml
+++ b/ruoyi-modules/ruoyi-shop/src/main/resources/mapper/task/MemberTaskMapper.xml
@@ -85,6 +85,7 @@
         tmt.task_date taskDate,
         tmt.task_content taskContent,
         tmtr.follow_content dealContent,
+        tmt.emergency_state emergencyState,
         CASE WHEN task_date = #{param.today} THEN 1 ELSE 0 END todayFlag
         FROM t_member_task tmt
         LEFT JOIN t_member_task_record tmtr ON tmt.task_id = tmtr.task_id
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/staff/SysStaffServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/staff/SysStaffServiceImpl.java
index 30f7fe2..03acb69 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/staff/SysStaffServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/staff/SysStaffServiceImpl.java
@@ -186,7 +186,7 @@
         sysStaff.setDelFlag(1);
         sysStaff.setStaffMobile(sysStaff.getStaffMobile()+":已删除");
         this.saveOrUpdate(sysStaff);
-        sysUserService.deleteUserById(mgtBaseGetDto.getUserId());
+        sysUserService.deleteUserById(userId);
     }
 
     /**
diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/config/StaffSuggestMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/config/StaffSuggestMapper.xml
index 5604bc1..68d1b5f 100644
--- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/config/StaffSuggestMapper.xml
+++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/config/StaffSuggestMapper.xml
@@ -51,7 +51,7 @@
         <if test="param.replayEndTime!=null and param.replayEndTime!=''">
             AND Date(tss.replay_time) &lt;= #{param.replayEndTime}
         </if>
-        ORDER BY tss.create_time DESC
+        ORDER BY tss.replay_flag ASC,tss.create_time DESC
     </select>
 
     <select id="pageStaffShopSuggest" resultType="com.ruoyi.system.domain.vo.StaffSuggestPageVo">

--
Gitblit v1.7.1