From 1901fceb6ddaa56a57f3131191454554c3e77e68 Mon Sep 17 00:00:00 2001
From: guohongjin <guohongjin@test.com>
Date: 星期三, 01 五月 2024 13:56:51 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PsychologicalCounseling

---
 rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

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 926eb8b..5642909 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
@@ -335,7 +335,7 @@
 
                 if (CollectionUtil.isNotEmpty(lowMapList)){
                     lowMapList.stream().forEach(stringObjectMap -> {
-                        if (stringObjectMap.get("counsellingInfoId") != null){
+                        if (stringObjectMap.get("counsellingInfoId") != null && stringObjectMap.get("counsellingInfoId").toString().equals(counsellinginfoResponseDTO.getId().toString()) ){
                             counsellinginfoResponseDTO.setLowPrice(new BigDecimal(stringObjectMap.get("price").toString()));
                         }
                     });
@@ -624,10 +624,12 @@
         if (counsellingOrder == null){
             throw new ServiceException("没有在咨询的订单,无法进行预约!");
         }
-        RLock lock = redissonClient.getLock("counsel:" + counsellingReservationRequest.getCounsellingId()+"_"+counsellingReservationRequest.getDayTime()+"_"+counsellingReservationRequest.getTimePoint());
+        String key = "counsel:" + counsellingReservationRequest.getCounsellingId()+"_"+counsellingReservationRequest.getDayTime()+"_"+counsellingReservationRequest.getTimePoint();
+        RLock lock = redissonClient.getLock(key);
         boolean tryLock = false;
         try {
-            tryLock = lock.tryLock(10, TimeUnit.SECONDS);
+            log.info("咨询key:"+key+",userId:"+counsellingOrder.getUserId());
+            tryLock = lock.tryLock(20, TimeUnit.SECONDS);
             if (!tryLock) {
                 throw new ServiceException("当前时间段已预约,请选择其他时间段!");
             }
@@ -708,8 +710,8 @@
 
             // 发送IM消息
             ImPushDataDTO pushData1 = ImPushDataDTO.builder()
-                    .type(ImPushTypeEnum.C_TO_W_IM_1V1_START_CONSULT.getCode())
-                    .title(ImPushTypeEnum.C_TO_W_IM_1V1_START_CONSULT.getName())
+                    .type(ImPushTypeEnum.C_TO_W_IM_1V1_START_CONSULT_FIRST.getCode())
+                    .title(ImPushTypeEnum.C_TO_W_IM_1V1_START_CONSULT_FIRST.getName())
                     .content("预约成功"+",请注意预约时间:"+counsellingReservationRequest.getDayTime()+counsellingReservationRequest.getTimePoint())
 //                    .content("预约成功!")
                     .objId(ObjUtil.toString(counsellingInfo.getId()))
@@ -796,7 +798,7 @@
             return new SuccessResponseData<>(counsellingOrderReservation);
         }catch (Exception ex){
             log.error("咨询预约服务异常",ex.getStackTrace());
-            throw new ServiceException("服务异常,请稍后再试");
+            throw new ServiceException("当前时间段已在进行预约,请稍后再试!");
         }finally {
             if(tryLock){
                 lock.unlock();

--
Gitblit v1.7.1