From 6bc25b33e90d45904d1843e927fa709dfeb51d7f Mon Sep 17 00:00:00 2001
From: yanghb <yanghb>
Date: 星期一, 15 四月 2024 15:57:41 +0800
Subject: [PATCH] 4.15

---
 rest/src/main/java/cn/stylefeng/rest/modular/order/controller/MentalTestOrderController.java                                                |   41 +++-
 roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/enums/ImPushTypeEnum.java                                                  |    1 
 rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java                                                 |  135 +++++++++++++-
 rest/src/main/java/cn/stylefeng/rest/modular/home/controller/HomeIndexController.java                                                       |   17 +
 guns/src/main/java/cn/stylefeng/guns/modular/business/controller/VersionController.java                                                     |   24 ++
 rest/src/main/java/cn/stylefeng/rest/modular/work/MentalAppointmentWork.java                                                                |  155 ++++++++++++++++
 roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java    |    4 
 rest/src/main/java/cn/stylefeng/rest/modular/work/OrderOutTimeCancelWork.java                                                               |   16 +
 roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java |    3 
 roses/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/exception/enums/user/SysUserExceptionEnum.java          |    1 
 common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CounsellingOrderServiceImpl.java                               |    2 
 guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java                                             |   10 +
 guns/src/main/java/cn/stylefeng/guns/modular/business/controller/CounsellingOrderController.java                                            |    2 
 rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java                                                          |   73 ++++---
 common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/CounsellingOrderReservationMapper.xml                        |    2 
 roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/exception/enums/defaults/DefaultBusinessExceptionEnum.java                 |    2 
 16 files changed, 420 insertions(+), 68 deletions(-)

diff --git a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/CounsellingOrderReservationMapper.xml b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/CounsellingOrderReservationMapper.xml
index ba25b38..88bdb66 100644
--- a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/CounsellingOrderReservationMapper.xml
+++ b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/CounsellingOrderReservationMapper.xml
@@ -42,7 +42,7 @@
         INNER JOIN toc_customer tcus on tcus.customer_id = tci.user_id
         INNER JOIN t_counselling_user tco on tco.counselling_info_id = tcor.counselling_info_id and tco.user_id = tcor.user_id
         <where>
-
+            tcor.stauts !=5
             <if test="params.stauts != null">
                 AND tcor.stauts = #{params.stauts}
             </if>
diff --git a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CounsellingOrderServiceImpl.java b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CounsellingOrderServiceImpl.java
index af8a114..7346db6 100644
--- a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CounsellingOrderServiceImpl.java
+++ b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CounsellingOrderServiceImpl.java
@@ -226,7 +226,7 @@
 //                    +"预约时间:"+counsellingOrder.getEffectiveEndTime()+"~"+counsellingOrder.getEffectiveEndTime();
             // IM推送数据json
             ImPushDataDTO pushData = ImPushDataDTO.builder()
-                    .type(ImPushTypeEnum.S_TO_W_TIP_CONSULT_PAY_GROUP_SUCCESS.getCode())
+                    .type(ImPushTypeEnum.S_TO_W_TIP_CONSULT_PAY_GROUP_SUCCESS_ONLY.getCode())
                     .objId(ObjUtil.toString(counsellingInfo.getUserId()))
                     .title("通知")
                     .content(pushContent)
diff --git a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/CounsellingOrderController.java b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/CounsellingOrderController.java
index 4a8979f..afc3d4a 100644
--- a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/CounsellingOrderController.java
+++ b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/CounsellingOrderController.java
@@ -163,7 +163,7 @@
                         .set(CounsellingUser::getClassHours,0).set(CounsellingUser::getResidueClassHours,0)
                         .eq(CounsellingUser::getCounsellingInfoId,counsellingOrder.getCounsellingInfoId()).eq(CounsellingUser::getUserId,counsellingOrder.getUserId());
                 if (counsellingOrder.getOrderType().intValue() ==1){
-                    counsellingUserLambdaUpdateWrapper.set(CounsellingUser::getIsFirstAppointment,null);
+                    counsellingUserLambdaUpdateWrapper.set(CounsellingUser::getIsFirstAppointment,1);
                 }
                 //更新咨询师用户信息
                 this.counsellingUserService.update(counsellingUserLambdaUpdateWrapper);
diff --git a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java
index d83f8cf..d5a4158 100644
--- a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java
+++ b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java
@@ -36,6 +36,8 @@
 import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
 import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
 import cn.stylefeng.roses.kernel.sms.modular.service.SysSmsInfoService;
+import cn.stylefeng.roses.kernel.system.api.exception.SystemModularException;
+import cn.stylefeng.roses.kernel.system.api.exception.enums.user.SysUserExceptionEnum;
 import cn.stylefeng.roses.kernel.system.api.expander.SystemConfigExpander;
 import cn.stylefeng.roses.kernel.system.api.pojo.role.dto.SysRoleDTO;
 import cn.stylefeng.roses.kernel.system.api.pojo.user.SysUserDTO;
@@ -201,6 +203,14 @@
     @PostResource(name = "工作人员_删除", path = "/sysUser/delete")
     @BusinessLog
     public ResponseData<?> delete(@RequestBody @Validated(SysUserRequest.delete.class) SysUserDeleteRequest req) {
+
+        List<CounsellingInfo> list = counsellingInfoService.list(Wrappers.lambdaQuery(CounsellingInfo.class).eq(CounsellingInfo::getListingStatus, 1).eq(CounsellingInfo::getIsDelete, 0));
+        if (!list.isEmpty()){
+            throw new SystemModularException(SysUserExceptionEnum.USER_CAN_NOT_DELETE_ADMIN);
+
+        }
+
+
         SysUserRequest sysUserRequest = BeanUtil.toBean(req, SysUserRequest.class);
         boolean del = sysUserService.del(sysUserRequest);
         if (del) {
diff --git a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/VersionController.java b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/VersionController.java
index 6c1122d..fc09c7a 100644
--- a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/VersionController.java
+++ b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/VersionController.java
@@ -7,6 +7,7 @@
 import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
+import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
 import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
 import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
 import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
@@ -18,6 +19,7 @@
 import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
 import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
 import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
+import cn.stylefeng.roses.kernel.system.modular.role.entity.SysRole;
 import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUser;
 import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -48,6 +50,28 @@
     private IVersionService versionService;
     @Autowired
     private SysUserService userService;
+    @Resource
+    private CacheOperatorApi<Integer> cacheOperatorApi;
+
+    @ApiOperation("ios是否内购修改1关2开 -t")
+    @PostResource(name = "ios是否内购修改1关2开 -t", path = "/ios/put")
+    @BusinessLog
+    public ResponseData<?> ios(Integer  ios) {
+        cacheOperatorApi.put("ios:need:pay",ios);
+        return new SuccessResponseData<>();
+
+    }
+
+    @ApiOperation("后台ios是否内购 1")
+    @PostResource(name = "后台ios是否内购 2", path = "/ios-list")
+    @BusinessLog
+    public ResponseData<?> ios1() {
+        Integer o = (Integer) cacheOperatorApi.get("ios:need:pay");
+
+        return new SuccessResponseData<>(o==null ? 0 :o);
+
+
+    }
 
     /**
      * 添加
diff --git a/rest/src/main/java/cn/stylefeng/rest/modular/home/controller/HomeIndexController.java b/rest/src/main/java/cn/stylefeng/rest/modular/home/controller/HomeIndexController.java
index 23ffbe8..b998e8e 100644
--- a/rest/src/main/java/cn/stylefeng/rest/modular/home/controller/HomeIndexController.java
+++ b/rest/src/main/java/cn/stylefeng/rest/modular/home/controller/HomeIndexController.java
@@ -8,6 +8,8 @@
 import cn.stylefeng.guns.modular.business.service.IStoreAppointmentService;
 import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
 import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
+import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
+import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog;
 import cn.stylefeng.roses.kernel.rule.enums.DeleteEnum;
 import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
 import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
@@ -75,10 +77,23 @@
             Long userId = loginUser.getUserId();
             o.setUserId(userId);
         }
-
+        o.setStatusFlag(0);
         // 保存实体
         storeAppointmentService.save(o);
         return new SuccessResponseData(o.getId());
     }
 
+    @Resource
+    private CacheOperatorApi<Integer> cacheOperatorApi;
+    @ApiOperation("ios是否内购")
+    @PostResource(name = "ios是否内购", path = "/ios")
+    @BusinessLog
+    public ResponseData<?> ios() {
+        Integer o = (Integer) cacheOperatorApi.get("ios:need:pay");
+
+        return new SuccessResponseData<>(o==null ? 0 :o);
+
+
+    }
+
 }
diff --git a/rest/src/main/java/cn/stylefeng/rest/modular/order/controller/MentalTestOrderController.java b/rest/src/main/java/cn/stylefeng/rest/modular/order/controller/MentalTestOrderController.java
index 3b1c8a5..b311197 100644
--- a/rest/src/main/java/cn/stylefeng/rest/modular/order/controller/MentalTestOrderController.java
+++ b/rest/src/main/java/cn/stylefeng/rest/modular/order/controller/MentalTestOrderController.java
@@ -5,14 +5,8 @@
 import cn.hutool.core.util.StrUtil;
 import cn.stylefeng.guns.modular.business.dto.request.CreateOrderConsultOneRequest;
 import cn.stylefeng.guns.modular.business.dto.request.CreateOrderMentalTestRequest;
-import cn.stylefeng.guns.modular.business.entity.MentalAnalysisTime;
-import cn.stylefeng.guns.modular.business.entity.MentalAppointment;
-import cn.stylefeng.guns.modular.business.entity.OrderConsultOne;
-import cn.stylefeng.guns.modular.business.entity.OrderMentalTest;
-import cn.stylefeng.guns.modular.business.service.IMentalAnalysisTimeService;
-import cn.stylefeng.guns.modular.business.service.IMentalAppointmentService;
-import cn.stylefeng.guns.modular.business.service.IOrderConsultOneService;
-import cn.stylefeng.guns.modular.business.service.IOrderMentalTestService;
+import cn.stylefeng.guns.modular.business.entity.*;
+import cn.stylefeng.guns.modular.business.service.*;
 import cn.stylefeng.rest.modular.order.service.MentalTestOrderBizService;
 import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
 import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
@@ -33,7 +27,11 @@
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Api(tags = "心理测试接口")
@@ -64,14 +62,31 @@
         return new SuccessResponseData(o);
     }
 
+    @Resource
+    private IMentalAnalysisTimeConfigService mentalAnalysisTimeConfigService;
+
     @ApiOperation(value = "1V1咨询可预约时间")
     @GetResource(name = "1V1咨询可预约时间", path = "/mentalAnalysisTime")
     public ResponseData<List<MentalAnalysisTime>> mentalAnalysisTime() {
-        List<MentalAnalysisTime> list = mentalAnalysisTimeService.list(
-                Wrappers.<MentalAnalysisTime>lambdaQuery()
-                        .orderByAsc(MentalAnalysisTime::getModuleNo, MentalAnalysisTime::getWeekDay, MentalAnalysisTime::getBeginTimePoint, MentalAnalysisTime::getEndTimePoint)
-        );
-        return new SuccessResponseData(list);
+//        List<Customer> filteredCustomers = customerService.list(Wrappers.lambdaQuery(Customer.class).eq(Customer::getMentalAnalysisStatus,1)
+//                .like(Customer::getPostIds, "31"));
+
+//        if (filteredCustomers.isEmpty()) {
+            List<MentalAnalysisTime> list = mentalAnalysisTimeService.list(
+                    Wrappers.<MentalAnalysisTime>lambdaQuery()
+                            .orderByAsc(MentalAnalysisTime::getModuleNo, MentalAnalysisTime::getWeekDay, MentalAnalysisTime::getBeginTimePoint, MentalAnalysisTime::getEndTimePoint)
+            );
+            return new SuccessResponseData(list);
+//        }else {
+//            List<Long> collect = filteredCustomers.stream().map(Customer::getCustomerId).collect(Collectors.toList());
+//            List<MentalAnalysisTimeConfig> list = mentalAnalysisTimeConfigService.list(Wrappers.lambdaQuery(MentalAnalysisTimeConfig.class).in(MentalAnalysisTimeConfig::getCounsellingInfoId, collect));
+//            HashMap<String,MentalAnalysisTimeConfig> hashMap =new HashMap<>();
+//            for (MentalAnalysisTimeConfig mentalAnalysisTimeConfig : list) {
+//                hashMap.put(mentalAnalysisTimeConfig.getWeekDay()+mentalAnalysisTimeConfig.getBeginTimePoint()+mentalAnalysisTimeConfig.getEndTimePoint(),mentalAnalysisTimeConfig);
+//            }
+//            Collection<MentalAnalysisTimeConfig> values = hashMap.values();
+//            return new SuccessResponseData(values);
+//        }
     }
 
     @Resource
diff --git a/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java b/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java
index c1034f1..cb47674 100644
--- a/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java
+++ b/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java
@@ -23,6 +23,7 @@
 import cn.stylefeng.rest.ijpay.controller.WxPayController;
 import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
 import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
+import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
 import cn.stylefeng.roses.kernel.customer.api.pojo.CustomerInfo;
 import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
 import cn.stylefeng.roses.kernel.customer.modular.service.CustomerService;
@@ -37,6 +38,7 @@
 import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
 import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
 import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
+import cn.stylefeng.roses.kernel.system.modular.role.entity.SysRole;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -164,6 +166,10 @@
     }
 
 
+    @Resource
+    private CacheOperatorApi<List<CounsellinginfoResponseDTO>> roleInfoCacheApi;
+
+
     /**
      * 获取咨询师信息列表(分页)
      */
@@ -174,9 +180,14 @@
             @ApiImplicitParam(name = "pageSize", value = "分页:每页大小(默认10)", dataTypeClass = Integer.class, paramType = "query"),
             @ApiImplicitParam(name = "searchType", value = "查询类型 1-严选,2-普通查询,默认2", dataTypeClass = Integer.class, paramType = "query")
     })
-    public ResponseData<PageResult<CounsellinginfoResponseDTO>> page(Integer pageNo, Integer pageSize,Integer searchType) {
+    public ResponseData<List<CounsellinginfoResponseDTO>> page(Integer pageNo, Integer pageSize,Integer searchType) {
+        if (roleInfoCacheApi.get("customer")!=null){
+            List<CounsellinginfoResponseDTO> customer = roleInfoCacheApi.get("customer");
+            return  new SuccessResponseData<>(customer);
+        }
+
         LambdaQueryWrapper<CounsellingInfo> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingInfo>().eq(CounsellingInfo::getIsDelete,false)
-                    .orderByDesc(CounsellingInfo::getSort,CounsellingInfo::getCreateTime).eq(CounsellingInfo::getListingStatus,1);
+                .orderByDesc(CounsellingInfo::getSort,CounsellingInfo::getCreateTime).eq(CounsellingInfo::getListingStatus,1);
         //默认普通查询
         if (searchType != null  && searchType.intValue() == 1){
             List<Customer> customerList = customerService.getWorkerListByLineStatusAndPost(null, null, PostIdEnum.PO_22.getCode(), CustomerWorkStatusEnum.ON_WORK.getCode());
@@ -185,9 +196,9 @@
                 lambdaQueryWrapper.in(CounsellingInfo::getUserId,customerIds);
             }
         }
-        Page<CounsellingInfo> page = this.counsellingInfoService.page(PageFactory.defaultPage(), lambdaQueryWrapper);
-        if (CollectionUtil.isNotEmpty(page.getRecords())){
-            List<Long> counseIds = page.getRecords().stream().map(CounsellingInfo::getId).collect(Collectors.toList());
+        List<CounsellingInfo> page = this.counsellingInfoService.list(lambdaQueryWrapper);
+        if (CollectionUtil.isNotEmpty(page)){
+            List<Long> counseIds = page.stream().map(CounsellingInfo::getId).collect(Collectors.toList());
             QueryWrapper<CounsellingOrder> orderQueryWrapper = new QueryWrapper<CounsellingOrder>().select("counselling_info_id counsellingInfoId,count(1) num ");
             //查询是否首次咨询
             orderQueryWrapper.lambda().eq(CounsellingOrder::getUserId,LoginContext.me().getLoginUser().getUserId()).in(CounsellingOrder::getStatusFlag,1,2).in(CounsellingOrder::getCounsellingInfoId,counseIds)
@@ -203,14 +214,14 @@
             //查询标签总条数
             List<CounsellingTag> counsellingTags = this.counsellingTagService.list(new LambdaQueryWrapper<CounsellingTag>()
                     .select(CounsellingTag::getId,CounsellingTag::getTagName));
-            List<Long> custommerIds = page.getRecords().stream().map(CounsellingInfo::getUserId).collect(Collectors.toList());
+            List<Long> custommerIds = page.stream().map(CounsellingInfo::getUserId).collect(Collectors.toList());
             //查询客户ids
             List<Customer> customerList = this.customerService.list(new LambdaQueryWrapper<Customer>().select(Customer::getCustomerId,Customer::getNickName).in(Customer::getCustomerId,custommerIds));
             //查询套餐最低价
             List<Map<String,Object>> lowMapList = this.counsellingSetMealService.listMaps(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().in(CounsellingSetMeal::getCounsellingInfoId,counseIds)
                     .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0));
 
-            List<CounsellinginfoResponseDTO> counsellinginfoResponseDTOS = BeanUtil.copyToList(page.getRecords(),CounsellinginfoResponseDTO.class, CopyOptions.create());
+            List<CounsellinginfoResponseDTO> counsellinginfoResponseDTOS = BeanUtil.copyToList(page,CounsellinginfoResponseDTO.class, CopyOptions.create());
             counsellinginfoResponseDTOS.stream().forEach(counsellinginfoResponseDTO -> {
                 if (fristMap.get(counsellinginfoResponseDTO.getId()) != null){
                     counsellinginfoResponseDTO.setIsFirstBuy(true);
@@ -222,7 +233,7 @@
 //                    LambdaQueryWrapper<CounsellingTag> counsellingTagLambdaQueryWrapper = new QueryWrapper<CounsellingTag>().select(" GROUP_CONCAT(tag_name)  tagName ").lambda();
 //                    Map<String,Object> map = counsellingTagService.getMap(counsellingTagLambdaQueryWrapper.in(CounsellingTag::getId,counsellinginfoResponseDTO.getCounsellingTagIds().split(",")));
 //                    if (ObjectUtil.isNotEmpty(map)){
-                        counsellinginfoResponseDTO.setCounsellingTagNames(tagNames);
+                    counsellinginfoResponseDTO.setCounsellingTagNames(tagNames);
 //                    }
                 }
                 counsellinginfoResponseDTO.setPersonalProfile(null);
@@ -247,10 +258,93 @@
 
             });
 
-            return  new SuccessResponseData<>(PageResultFactory.createPageResult(counsellinginfoResponseDTOS,page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
+
+            return  new SuccessResponseData<>(counsellinginfoResponseDTOS);
         }
 
-        return  new SuccessResponseData<>(PageResultFactory.createPageResult(new ArrayList<CounsellinginfoResponseDTO>(),page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
+        return  new SuccessResponseData<>();
+
+
+
+
+
+
+//        LambdaQueryWrapper<CounsellingInfo> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingInfo>().eq(CounsellingInfo::getIsDelete,false)
+//                    .orderByDesc(CounsellingInfo::getSort,CounsellingInfo::getCreateTime).eq(CounsellingInfo::getListingStatus,1);
+//        //默认普通查询
+//        if (searchType != null  && searchType.intValue() == 1){
+//            List<Customer> customerList = customerService.getWorkerListByLineStatusAndPost(null, null, PostIdEnum.PO_22.getCode(), CustomerWorkStatusEnum.ON_WORK.getCode());
+//            if (CollectionUtil.isNotEmpty(customerList)){
+//                List<Long> customerIds = customerList.stream().map(Customer::getCustomerId).collect(Collectors.toList());
+//                lambdaQueryWrapper.in(CounsellingInfo::getUserId,customerIds);
+//            }
+//        }
+//        Page<CounsellingInfo> page = this.counsellingInfoService.page(PageFactory.defaultPage(), lambdaQueryWrapper);
+//        if (CollectionUtil.isNotEmpty(page.getRecords())){
+//            List<Long> counseIds = page.getRecords().stream().map(CounsellingInfo::getId).collect(Collectors.toList());
+//            QueryWrapper<CounsellingOrder> orderQueryWrapper = new QueryWrapper<CounsellingOrder>().select("counselling_info_id counsellingInfoId,count(1) num ");
+//            //查询是否首次咨询
+//            orderQueryWrapper.lambda().eq(CounsellingOrder::getUserId,LoginContext.me().getLoginUser().getUserId()).in(CounsellingOrder::getStatusFlag,1,2).in(CounsellingOrder::getCounsellingInfoId,counseIds)
+//                    .eq(CounsellingOrder::getOrderType,1).groupBy(CounsellingOrder::getCounsellingInfoId).having(" num > 0 ");
+//            List<Map<String,Object>> mapList = this.counsellingOrderService.listMaps(orderQueryWrapper);
+//            Map<Long,Object> fristMap = new HashMap<>();
+//            if (CollectionUtil.isNotEmpty(mapList)){
+//
+//                mapList.stream().forEach(stringObjectMap -> {
+//                    fristMap.put(Long.parseLong(stringObjectMap.get("counsellingInfoId").toString()),stringObjectMap.get("num"));
+//                });
+//            }
+//            //查询标签总条数
+//            List<CounsellingTag> counsellingTags = this.counsellingTagService.list(new LambdaQueryWrapper<CounsellingTag>()
+//                    .select(CounsellingTag::getId,CounsellingTag::getTagName));
+//            List<Long> custommerIds = page.getRecords().stream().map(CounsellingInfo::getUserId).collect(Collectors.toList());
+//            //查询客户ids
+//            List<Customer> customerList = this.customerService.list(new LambdaQueryWrapper<Customer>().select(Customer::getCustomerId,Customer::getNickName).in(Customer::getCustomerId,custommerIds));
+//            //查询套餐最低价
+//            List<Map<String,Object>> lowMapList = this.counsellingSetMealService.listMaps(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().in(CounsellingSetMeal::getCounsellingInfoId,counseIds)
+//                    .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0));
+//
+//            List<CounsellinginfoResponseDTO> counsellinginfoResponseDTOS = BeanUtil.copyToList(page.getRecords(),CounsellinginfoResponseDTO.class, CopyOptions.create());
+//            counsellinginfoResponseDTOS.stream().forEach(counsellinginfoResponseDTO -> {
+//                if (fristMap.get(counsellinginfoResponseDTO.getId()) != null){
+//                    counsellinginfoResponseDTO.setIsFirstBuy(true);
+//                }
+//                if (StrUtil.isNotBlank(counsellinginfoResponseDTO.getCounsellingTagIds())){
+//                    List<String> counsellingTagList = Arrays.asList(counsellinginfoResponseDTO.getCounsellingTagIds().split(","));
+//                    String tagNames = counsellingTags.stream().filter(cou -> counsellingTagList.contains(cou.getId().toString())).map(CounsellingTag::getTagName).collect(Collectors.joining(","));
+//                    //获取课程标签名称
+////                    LambdaQueryWrapper<CounsellingTag> counsellingTagLambdaQueryWrapper = new QueryWrapper<CounsellingTag>().select(" GROUP_CONCAT(tag_name)  tagName ").lambda();
+////                    Map<String,Object> map = counsellingTagService.getMap(counsellingTagLambdaQueryWrapper.in(CounsellingTag::getId,counsellinginfoResponseDTO.getCounsellingTagIds().split(",")));
+////                    if (ObjectUtil.isNotEmpty(map)){
+//                        counsellinginfoResponseDTO.setCounsellingTagNames(tagNames);
+////                    }
+//                }
+//                counsellinginfoResponseDTO.setPersonalProfile(null);
+//
+//                counsellinginfoResponseDTO.setNikeName(customerList.stream().filter(cus -> counsellinginfoResponseDTO.getUserId().longValue() == cus.getCustomerId().longValue()).findFirst().get().getNickName());
+//
+////                BigDecimal lowPrice = this.counsellingSetMealService.getObj(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().eq(CounsellingSetMeal::getCounsellingInfoId,counsellinginfoResponseDTO.getId())
+////                        .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0),Convert::toBigDecimal);
+//
+//
+//                if (CollectionUtil.isNotEmpty(lowMapList)){
+//                    lowMapList.stream().forEach(stringObjectMap -> {
+//                        if (stringObjectMap.get("counsellingInfoId") != null){
+//                            counsellinginfoResponseDTO.setLowPrice(new BigDecimal(stringObjectMap.get("price").toString()));
+//                        }
+//                    });
+//                    if (counsellinginfoResponseDTO.getLowPrice() == null){
+//                        counsellinginfoResponseDTO.setLowPrice(new BigDecimal(0));
+//                    }
+//                }
+//
+//
+//            });
+//
+//            return  new SuccessResponseData<>(PageResultFactory.createPageResult(counsellinginfoResponseDTOS,page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
+//        }
+//
+//        return  new SuccessResponseData<>(PageResultFactory.createPageResult(new ArrayList<CounsellinginfoResponseDTO>(),page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
     }
 
 
@@ -623,11 +717,32 @@
                     .type(ImPushTypeEnum.S_TO_W_TIP_CONSULT_PAY_SUCCESS.getCode())
                     .objId(ObjUtil.toString(counsellingOrderReservation.getId()))
                     .title("通知")
+                    .data1(ObjUtil.toString(counsellingInfo.getUserId()))
+                    .data2(ObjUtil.toString(counsellingOrder.getUserId()))
                     .content(pushContent)
 //                    .extra("("+DateUtil.formatDate(counsellingOrder.getFirstAppointmentDate())+" "+counsellingOrder.getFirstAppointmentTimes()+")")
                     .build();
             // 发送首次预约
             imBizService.messageSendSystem(counsellingOrderReservation.getUserId()+"", new String[]{counsellingOrderReservation.getUserId()+""}, pushData, ImUserTypeEnum.USER, null, true);
+
+
+            //给咨询师发消息
+            Customer customerOld = this.customerService.getById(counsellingOrderReservation.getUserId());
+
+            String pushContent1 = "你有新的预约,请注意查收。预约用户:"+customerOld.getNickName()+",预约时间:"+DateUtil.formatDate(counsellingOrder.getFirstAppointmentDate())+" "+counsellingOrder.getFirstAppointmentTimes();
+//                    +"预约时间:"+counsellingOrder.getEffectiveEndTime()+"~"+counsellingOrder.getEffectiveEndTime();
+            // IM推送数据json
+            ImPushDataDTO pushData2 = ImPushDataDTO.builder()
+                    .type(ImPushTypeEnum.S_TO_W_TIP_CONSULT_PAY_GROUP_SUCCESS.getCode())
+                    .objId(ObjUtil.toString(counsellingInfo.getUserId()))
+                    .title("通知")
+                    .content(pushContent1)
+                    .data1(ObjUtil.toString(counsellingOrder.getUserId()))
+                    .data2(ObjUtil.toString(counsellingInfo.getUserId()))
+//                    .extra("去查看。")
+                    .build();
+            // 发送预约提示
+            imBizService.messageSendSystem(counsellingOrder.getUserId()+"", new String[]{counsellingInfo.getUserId()+""}, pushData2, ImUserTypeEnum.WORKER, PostIdEnum.PO_22, true);
         }else{
             counsellingOrderReservation.setStauts(1);
             counsellingOrderReservation.setReservationType(2);
diff --git a/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java b/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java
index b661bd5..0e3ad33 100644
--- a/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java
+++ b/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java
@@ -17,6 +17,7 @@
 import cn.stylefeng.guns.modular.business.entity.*;
 import cn.stylefeng.guns.modular.business.service.*;
 import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
+import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
 import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
 import cn.stylefeng.roses.kernel.customer.modular.service.CustomerService;
 import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
@@ -118,46 +119,50 @@
         }
         return new SuccessResponseData<>(course);
     }
-
+    @Resource
+    private CacheOperatorApi<List<CourseResponseDTO>> roleInfoCacheApi1;
     /**
      * 获取课程管理列表(分页)
      */
     @ApiOperation("获取课程管理列表(分页)")
     @GetResource(name = "获取课程管理列表(分页)", path = "/page", requiredPermission = false)
-    public ResponseData<PageResult<CourseResponseDTO>> page(CourseRequest courseRequest) {
-        LambdaQueryWrapper<Course> lambdaQueryWrapper = new LambdaQueryWrapper<Course>().eq(Course::getIsDelete,false)
-                    .orderByDesc(Course::getSort,Course::getCreateTime);
-        if (courseRequest.getListingStatus() != null){
-            lambdaQueryWrapper.eq(Course::getListingStatus,courseRequest.getListingStatus());
-        }else {
-            lambdaQueryWrapper.eq(Course::getListingStatus,1);
-        }
-        lambdaQueryWrapper.like(StrUtil.isNotBlank(courseRequest.getCourseName()),Course::getCourseName,courseRequest.getCourseName());
-        Page<Course> page = this.courseService.page(PageFactory.defaultPage(), lambdaQueryWrapper);
+    public ResponseData<List<CourseResponseDTO>> page(CourseRequest courseRequest) {
+        List<CourseResponseDTO> course = roleInfoCacheApi1.get("course");
+        return new SuccessResponseData<>(course);
 
-        if (CollectionUtil.isNotEmpty(page.getRecords())){
-            List<CourseResponseDTO> courseResponseDTOList = BeanUtil.copyToList(page.getRecords(),CourseResponseDTO.class, CopyOptions.create());
-            //查询当前人是否购买过课程
-            List<CourseOrder> courseOrderList = this.courseOrderService.list(new LambdaQueryWrapper<CourseOrder>().select(CourseOrder::getCourseId).eq(CourseOrder::getUserId, LoginContext.me().getLoginUser().getUserId()).eq(CourseOrder::getStatusFlag,1));
-            if (CollectionUtil.isNotEmpty(courseOrderList)){
-                List<Long> courseIds = courseOrderList.stream().map(CourseOrder::getCourseId).collect(Collectors.toList());
-                courseResponseDTOList.forEach(course1 -> {
-                   if (courseIds.contains(course1.getId())){
-                       course1.setIsBuy(true);
-                       CourseOrder courseOrder = this.courseOrderService.getOne(new LambdaQueryWrapper<CourseOrder>().select(CourseOrder::getId).eq(CourseOrder::getUserId, LoginContext.me().getLoginUser().getUserId()).eq(CourseOrder::getStatusFlag,1)
-                               .eq(CourseOrder::getCourseId,course1.getId()).orderByAsc(CourseOrder::getPayTime)
-                               .last(" limit 1 "));
-                       if(courseOrder != null){
-                           course1.setCourseOrderId(courseOrder.getId());
-                       }
-                   }else{
-                       course1.setIsBuy(false);
-                   }
-                });
-            }
-         return  new SuccessResponseData<>(PageResultFactory.createPageResult(courseResponseDTOList,page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
-        }
-        return  new SuccessResponseData<>(PageResultFactory.createPageResult(new ArrayList<CourseResponseDTO>(),page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
+//        LambdaQueryWrapper<Course> lambdaQueryWrapper = new LambdaQueryWrapper<Course>().eq(Course::getIsDelete,false)
+//                    .orderByDesc(Course::getSort,Course::getCreateTime);
+//        if (courseRequest.getListingStatus() != null){
+//            lambdaQueryWrapper.eq(Course::getListingStatus,courseRequest.getListingStatus());
+//        }else {
+//            lambdaQueryWrapper.eq(Course::getListingStatus,1);
+//        }
+//        lambdaQueryWrapper.like(StrUtil.isNotBlank(courseRequest.getCourseName()),Course::getCourseName,courseRequest.getCourseName());
+//        Page<Course> page = this.courseService.page(PageFactory.defaultPage(), lambdaQueryWrapper);
+//
+//        if (CollectionUtil.isNotEmpty(page.getRecords())){
+//            List<CourseResponseDTO> courseResponseDTOList = BeanUtil.copyToList(page.getRecords(),CourseResponseDTO.class, CopyOptions.create());
+//            //查询当前人是否购买过课程
+//            List<CourseOrder> courseOrderList = this.courseOrderService.list(new LambdaQueryWrapper<CourseOrder>().select(CourseOrder::getCourseId).eq(CourseOrder::getUserId, LoginContext.me().getLoginUser().getUserId()).eq(CourseOrder::getStatusFlag,1));
+//            if (CollectionUtil.isNotEmpty(courseOrderList)){
+//                List<Long> courseIds = courseOrderList.stream().map(CourseOrder::getCourseId).collect(Collectors.toList());
+//                courseResponseDTOList.forEach(course1 -> {
+//                   if (courseIds.contains(course1.getId())){
+//                       course1.setIsBuy(true);
+//                       CourseOrder courseOrder = this.courseOrderService.getOne(new LambdaQueryWrapper<CourseOrder>().select(CourseOrder::getId).eq(CourseOrder::getUserId, LoginContext.me().getLoginUser().getUserId()).eq(CourseOrder::getStatusFlag,1)
+//                               .eq(CourseOrder::getCourseId,course1.getId()).orderByAsc(CourseOrder::getPayTime)
+//                               .last(" limit 1 "));
+//                       if(courseOrder != null){
+//                           course1.setCourseOrderId(courseOrder.getId());
+//                       }
+//                   }else{
+//                       course1.setIsBuy(false);
+//                   }
+//                });
+//            }
+//         return  new SuccessResponseData<>(PageResultFactory.createPageResult(courseResponseDTOList,page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
+//        }
+//        return  new SuccessResponseData<>(PageResultFactory.createPageResult(new ArrayList<CourseResponseDTO>(),page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
     }
 
 
diff --git a/rest/src/main/java/cn/stylefeng/rest/modular/work/MentalAppointmentWork.java b/rest/src/main/java/cn/stylefeng/rest/modular/work/MentalAppointmentWork.java
index bcae22e..8aa52d6 100644
--- a/rest/src/main/java/cn/stylefeng/rest/modular/work/MentalAppointmentWork.java
+++ b/rest/src/main/java/cn/stylefeng/rest/modular/work/MentalAppointmentWork.java
@@ -1,26 +1,42 @@
 package cn.stylefeng.rest.modular.work;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.bean.copier.CopyOptions;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
+import cn.stylefeng.guns.modular.business.dto.CounsellinginfoResponseDTO;
+import cn.stylefeng.guns.modular.business.dto.CourseResponseDTO;
 import cn.stylefeng.guns.modular.business.dto.ImPushDataDTO;
 import cn.stylefeng.guns.modular.business.dto.MentalTestMyTestTopicDTO;
-import cn.stylefeng.guns.modular.business.entity.MentalAppointment;
-import cn.stylefeng.guns.modular.business.service.IMentalAppointmentService;
-import cn.stylefeng.guns.modular.business.service.IMentalTestRecordService;
+import cn.stylefeng.guns.modular.business.entity.*;
+import cn.stylefeng.guns.modular.business.service.*;
 import cn.stylefeng.guns.modular.business.service.impl.ImBizService;
+import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
+import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
+import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
+import cn.stylefeng.roses.kernel.customer.modular.service.CustomerService;
+import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
+import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
 import cn.stylefeng.roses.kernel.rule.enums.*;
+import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
+import java.math.BigDecimal;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -47,7 +63,136 @@
      * Corn表达式 @Scheduled(cron = Corn表达式)
      * @Scheduled(cron = "0 0/30 * * * *")
      */
+    @Resource
+    private CacheOperatorApi<List<CounsellinginfoResponseDTO>> roleInfoCacheApi;
+    @Resource
+    private CacheOperatorApi<List<CourseResponseDTO>> roleInfoCacheApi1;
+    @Resource
+    private CustomerService customerService;
+    @Resource
+    private ICounsellingInfoService counsellingInfoService;
+    @Resource
+    private ICounsellingOrderService counsellingOrderService;
+    @Resource
+    private ICounsellingTagService counsellingTagService;
+    @Resource
+    private ICounsellingSetMealService counsellingSetMealService;
+    @Resource
+    private ICourseService courseService;
+    @Resource
+    private ICourseOrderService courseOrderService;
+    @Scheduled(fixedRate = 1000 * 60)
+    public void list1() {
+        LambdaQueryWrapper<Course> lambdaQueryWrapper = new LambdaQueryWrapper<Course>().eq(Course::getIsDelete,false)
+                .orderByDesc(Course::getSort,Course::getCreateTime);
+            lambdaQueryWrapper.eq(Course::getListingStatus,1);
+//        lambdaQueryWrapper.like(StrUtil.isNotBlank(courseRequest.getCourseName()),Course::getCourseName,courseRequest.getCourseName());
+        List<Course> page = this.courseService.list(lambdaQueryWrapper);
 
+        if (CollectionUtil.isNotEmpty(page)){
+            List<CourseResponseDTO> courseResponseDTOList = BeanUtil.copyToList(page,CourseResponseDTO.class, CopyOptions.create());
+            //查询当前人是否购买过课程
+            List<CourseOrder> courseOrderList = this.courseOrderService.list(new LambdaQueryWrapper<CourseOrder>().select(CourseOrder::getCourseId).eq(CourseOrder::getUserId, LoginContext.me().getLoginUser().getUserId()).eq(CourseOrder::getStatusFlag,1));
+            if (CollectionUtil.isNotEmpty(courseOrderList)){
+                List<Long> courseIds = courseOrderList.stream().map(CourseOrder::getCourseId).collect(Collectors.toList());
+                courseResponseDTOList.forEach(course1 -> {
+                    if (courseIds.contains(course1.getId())){
+                        course1.setIsBuy(true);
+                        CourseOrder courseOrder = this.courseOrderService.getOne(new LambdaQueryWrapper<CourseOrder>().select(CourseOrder::getId).eq(CourseOrder::getUserId, LoginContext.me().getLoginUser().getUserId()).eq(CourseOrder::getStatusFlag,1)
+                                .eq(CourseOrder::getCourseId,course1.getId()).orderByAsc(CourseOrder::getPayTime)
+                                .last(" limit 1 "));
+                        if(courseOrder != null){
+                            course1.setCourseOrderId(courseOrder.getId());
+                        }
+                    }else{
+                        course1.setIsBuy(false);
+                    }
+                });
+            }
+            roleInfoCacheApi1.put("course",courseResponseDTOList);
+        }
+
+
+
+
+    }
+        @Scheduled(fixedRate = 1000 * 60)
+
+    public void list() {
+        LambdaQueryWrapper<CounsellingInfo> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingInfo>().eq(CounsellingInfo::getIsDelete,false)
+                .orderByDesc(CounsellingInfo::getSort,CounsellingInfo::getCreateTime).eq(CounsellingInfo::getListingStatus,1);
+        //默认普通查询
+//        if (searchType != null  && searchType.intValue() == 1){
+            List<Customer> customerList1 = customerService.getWorkerListByLineStatusAndPost(null, null, PostIdEnum.PO_22.getCode(), CustomerWorkStatusEnum.ON_WORK.getCode());
+            if (CollectionUtil.isNotEmpty(customerList1)){
+                List<Long> customerIds = customerList1.stream().map(Customer::getCustomerId).collect(Collectors.toList());
+                lambdaQueryWrapper.in(CounsellingInfo::getUserId,customerIds);
+            }
+//        }
+        List<CounsellingInfo> page = this.counsellingInfoService.list(lambdaQueryWrapper);
+        if (CollectionUtil.isNotEmpty(page)){
+            List<Long> counseIds = page.stream().map(CounsellingInfo::getId).collect(Collectors.toList());
+            QueryWrapper<CounsellingOrder> orderQueryWrapper = new QueryWrapper<CounsellingOrder>().select("counselling_info_id counsellingInfoId,count(1) num ");
+            //查询是否首次咨询
+            orderQueryWrapper.lambda().eq(CounsellingOrder::getUserId,LoginContext.me().getLoginUser().getUserId()).in(CounsellingOrder::getStatusFlag,1,2).in(CounsellingOrder::getCounsellingInfoId,counseIds)
+                    .eq(CounsellingOrder::getOrderType,1).groupBy(CounsellingOrder::getCounsellingInfoId).having(" num > 0 ");
+            List<Map<String,Object>> mapList = this.counsellingOrderService.listMaps(orderQueryWrapper);
+            Map<Long,Object> fristMap = new HashMap<>();
+            if (CollectionUtil.isNotEmpty(mapList)){
+
+                mapList.stream().forEach(stringObjectMap -> {
+                    fristMap.put(Long.parseLong(stringObjectMap.get("counsellingInfoId").toString()),stringObjectMap.get("num"));
+                });
+            }
+            //查询标签总条数
+            List<CounsellingTag> counsellingTags = this.counsellingTagService.list(new LambdaQueryWrapper<CounsellingTag>()
+                    .select(CounsellingTag::getId,CounsellingTag::getTagName));
+            List<Long> custommerIds = page.stream().map(CounsellingInfo::getUserId).collect(Collectors.toList());
+            //查询客户ids
+            List<Customer> customerList = this.customerService.list(new LambdaQueryWrapper<Customer>().select(Customer::getCustomerId,Customer::getNickName).in(Customer::getCustomerId,custommerIds));
+            //查询套餐最低价
+            List<Map<String,Object>> lowMapList = this.counsellingSetMealService.listMaps(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().in(CounsellingSetMeal::getCounsellingInfoId,counseIds)
+                    .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0));
+
+            List<CounsellinginfoResponseDTO> counsellinginfoResponseDTOS = BeanUtil.copyToList(page,CounsellinginfoResponseDTO.class, CopyOptions.create());
+            counsellinginfoResponseDTOS.stream().forEach(counsellinginfoResponseDTO -> {
+                if (fristMap.get(counsellinginfoResponseDTO.getId()) != null){
+                    counsellinginfoResponseDTO.setIsFirstBuy(true);
+                }
+                if (StrUtil.isNotBlank(counsellinginfoResponseDTO.getCounsellingTagIds())){
+                    List<String> counsellingTagList = Arrays.asList(counsellinginfoResponseDTO.getCounsellingTagIds().split(","));
+                    String tagNames = counsellingTags.stream().filter(cou -> counsellingTagList.contains(cou.getId().toString())).map(CounsellingTag::getTagName).collect(Collectors.joining(","));
+                    //获取课程标签名称
+//                    LambdaQueryWrapper<CounsellingTag> counsellingTagLambdaQueryWrapper = new QueryWrapper<CounsellingTag>().select(" GROUP_CONCAT(tag_name)  tagName ").lambda();
+//                    Map<String,Object> map = counsellingTagService.getMap(counsellingTagLambdaQueryWrapper.in(CounsellingTag::getId,counsellinginfoResponseDTO.getCounsellingTagIds().split(",")));
+//                    if (ObjectUtil.isNotEmpty(map)){
+                    counsellinginfoResponseDTO.setCounsellingTagNames(tagNames);
+//                    }
+                }
+                counsellinginfoResponseDTO.setPersonalProfile(null);
+
+                counsellinginfoResponseDTO.setNikeName(customerList.stream().filter(cus -> counsellinginfoResponseDTO.getUserId().longValue() == cus.getCustomerId().longValue()).findFirst().get().getNickName());
+
+//                BigDecimal lowPrice = this.counsellingSetMealService.getObj(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().eq(CounsellingSetMeal::getCounsellingInfoId,counsellinginfoResponseDTO.getId())
+//                        .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0),Convert::toBigDecimal);
+
+
+                if (CollectionUtil.isNotEmpty(lowMapList)){
+                    lowMapList.stream().forEach(stringObjectMap -> {
+                        if (stringObjectMap.get("counsellingInfoId") != null){
+                            counsellinginfoResponseDTO.setLowPrice(new BigDecimal(stringObjectMap.get("price").toString()));
+                        }
+                    });
+                    if (counsellinginfoResponseDTO.getLowPrice() == null){
+                        counsellinginfoResponseDTO.setLowPrice(new BigDecimal(0));
+                    }
+                }
+
+
+            });
+            roleInfoCacheApi.put("customer",counsellinginfoResponseDTOS);
+        }
+    }
     @Scheduled(fixedRate = 1000 * 30)
     public void autoStartMentalAppointment() {
         // 当前时间
diff --git a/rest/src/main/java/cn/stylefeng/rest/modular/work/OrderOutTimeCancelWork.java b/rest/src/main/java/cn/stylefeng/rest/modular/work/OrderOutTimeCancelWork.java
index 09a438b..7777e11 100644
--- a/rest/src/main/java/cn/stylefeng/rest/modular/work/OrderOutTimeCancelWork.java
+++ b/rest/src/main/java/cn/stylefeng/rest/modular/work/OrderOutTimeCancelWork.java
@@ -449,7 +449,7 @@
                 .ge(CounsellingOrderReservation::getReservationBeginTime,startTime).le(CounsellingOrderReservation::getReservationBeginTime,nowDate)
                 .eq(CounsellingOrderReservation::getStauts,2));
         if (CollectionUtil.isNotEmpty(waitList)){
-            //更新为待服务
+            //更新为服务中
             List<Long> idList = waitList.stream().map(CounsellingOrderReservation::getId).collect(Collectors.toList());
             log.info("自动更新待服务的咨询,ids:"+idList.toString());
             this.counsellingOrderReservationService.update(new LambdaUpdateWrapper<CounsellingOrderReservation>().set(CounsellingOrderReservation::getStauts,3)
@@ -457,6 +457,20 @@
                     .in(CounsellingOrderReservation::getId,idList));
 
         }
+
+//        //查询结束的预约
+//        List<CounsellingOrderReservation> waitList1 = this.counsellingOrderReservationService.list(new LambdaQueryWrapper<CounsellingOrderReservation>()
+//                .le(CounsellingOrderReservation::getReservationEndTime,startTime).eq(CounsellingOrderReservation::getStauts,2));
+//
+//        if (CollectionUtil.isNotEmpty(waitList1)){
+//            //更新为已完成
+//            List<Long> idList = waitList1.stream().map(CounsellingOrderReservation::getId).collect(Collectors.toList());
+//            log.info("自动更新待服务的咨询,ids:"+idList.toString());
+//            this.counsellingOrderReservationService.update(new LambdaUpdateWrapper<CounsellingOrderReservation>().set(CounsellingOrderReservation::getStauts,4)
+//                    .set(CounsellingOrderReservation::getServiceBeginTime,new Date())
+//                    .in(CounsellingOrderReservation::getId,idList));
+
+//        }
         //查询服务中的预约
         List<CounsellingOrderReservation> serviceList = this.counsellingOrderReservationService.list(new LambdaQueryWrapper<CounsellingOrderReservation>()
                 .le(CounsellingOrderReservation::getReservationEndTime,nowDate)
diff --git a/roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/enums/ImPushTypeEnum.java b/roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/enums/ImPushTypeEnum.java
index 10cc017..a455a14 100644
--- a/roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/enums/ImPushTypeEnum.java
+++ b/roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/enums/ImPushTypeEnum.java
@@ -23,6 +23,7 @@
     S_TO_W_TIP_MENTAL_APPOINTMENT("01002", "提示性格分析师有预约"),
     S_TO_W_TIP_CONSULT_PAY_SUCCESS("21103", "首次咨询支付成功后提示"),
     S_TO_W_TIP_CONSULT_PAY_GROUP_SUCCESS("21204", "咨询支付成功后提示"),
+    S_TO_W_TIP_CONSULT_PAY_GROUP_SUCCESS_ONLY("212041", "只提示"),
     S_TO_W_TIP_COURSE_PAY_GROUP_SUCCESS("21205", "课程支付成功后提示"),
     C_TO_W_IM_1V1_START_CONSULT("21107", "用户发送心理测试结果,1v1咨询开始"),
     S_TO_C_TIP_AUDIT_PASS("02001", "咨询师同意预约后提示"),
diff --git a/roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/exception/enums/defaults/DefaultBusinessExceptionEnum.java b/roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/exception/enums/defaults/DefaultBusinessExceptionEnum.java
index 1c5a73d..24432ff 100644
--- a/roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/exception/enums/defaults/DefaultBusinessExceptionEnum.java
+++ b/roses/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/exception/enums/defaults/DefaultBusinessExceptionEnum.java
@@ -43,7 +43,7 @@
      * 系统执行出错(一级宏观错误码)
      */
     SYSTEM_RUNTIME_ERROR(BUSINESS_ERROR_TYPE_CODE + FIRST_LEVEL_WIDE_CODE, "系统执行出错,请检查系统运行状况"),
-    MENTAL_APPOINTMENT_NO_WORKER_ERROR("500", "预约失败,请更换预约时间段");
+    MENTAL_APPOINTMENT_NO_WORKER_ERROR("500", "分析师已下班");
 
     /**
      * 错误编码
diff --git a/roses/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/exception/enums/user/SysUserExceptionEnum.java b/roses/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/exception/enums/user/SysUserExceptionEnum.java
index d9d7c09..3cda835 100644
--- a/roses/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/exception/enums/user/SysUserExceptionEnum.java
+++ b/roses/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/exception/enums/user/SysUserExceptionEnum.java
@@ -62,6 +62,7 @@
      * 不能删除超级管理员
      */
     USER_CAN_NOT_DELETE_ADMIN(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + SystemConstants.SYSTEM_EXCEPTION_STEP_CODE + "75", "不能删除超级管理员"),
+    USER_CAN_NOT_DELETE_INFO(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + SystemConstants.SYSTEM_EXCEPTION_STEP_CODE + "778", "不能删除已配置咨询师信息的员工"),
 
     /**
      * 不能修改超级管理员状态
diff --git a/roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java b/roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java
index 0880017..c174cc9 100644
--- a/roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java
+++ b/roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java
@@ -22,6 +22,7 @@
 import cn.stylefeng.roses.kernel.wrapper.api.annotation.Wrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
@@ -61,6 +62,9 @@
         return new SuccessResponseData<>();
     }
 
+
+
+
     /**
      * 删除系统用户
      *
diff --git a/roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java b/roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java
index 85c4faa..fa2aacf 100644
--- a/roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java
+++ b/roses/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java
@@ -172,11 +172,14 @@
         return  sysUser;
     }
 
+
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean del(SysUserRequest sysUserRequest) {
         SysUser sysUser = this.querySysUser(sysUserRequest);
 
+
         // 不能删除超级管理员
         if (YesOrNotEnum.Y.getCode().equals(sysUser.getSuperAdminFlag())) {
             throw new SystemModularException(SysUserExceptionEnum.USER_CAN_NOT_DELETE_ADMIN);

--
Gitblit v1.7.1