From 6af0c7434178ca41e727c700af8174201a865de9 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期四, 02 十一月 2023 11:55:29 +0800
Subject: [PATCH] 10.31.8

---
 cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java |   74 +++++++++++++++++++++++++++++++++++--
 1 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
index 8ea716e..ea1db91 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -4,6 +4,7 @@
 import cn.hutool.http.HttpResponse;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.dsh.other.entity.*;
 import com.dsh.other.feignclient.account.CityManagerClient;
@@ -19,6 +20,7 @@
 import com.dsh.other.model.vo.siteVo.SiteSearchVO;
 import com.dsh.other.service.*;
 import com.dsh.other.util.PayMoneyUtil;
+import com.dsh.other.util.RedisUtil;
 import com.dsh.other.util.ResultUtil;
 import com.dsh.other.util.TokenUtil;
 import io.swagger.annotations.ApiImplicitParam;
@@ -27,12 +29,15 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
+import redis.clients.jedis.Jedis;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author zhibing.pu
@@ -197,7 +202,8 @@
         }
     }
 
-
+    @Autowired
+    private RedisUtil redisUtil;
 
     @ResponseBody
     @PostMapping("/base/site/querySiteTimes")
@@ -217,6 +223,22 @@
             return ResultUtil.runErr();
         }
     }
+
+//    public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day, String halfName, String siteName) throws Exception {
+//
+//        if (redisUtil.acquireLock(day,day)) {
+//            try {
+//                List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName);
+//            return ResultUtil.success(list);
+//            } finally {
+//                redisUtil.releaseLock(day);
+//            }
+//        } else {
+//            return ResultUtil.error("系统繁忙,请稍后再试!");
+//        }
+//
+//    }
+
 
 
     /**
@@ -256,6 +278,22 @@
         }
     }
 
+//        public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day, String halfName, String siteName) throws Exception {
+//
+//        if (redisUtil.acquireLock(day,day)) {
+//            try {
+//                List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName);
+//            return ResultUtil.success(list);
+//            } finally {
+//                redisUtil.releaseLock(day);
+//            }
+//        } else {
+//            return ResultUtil.error("系统繁忙,请稍后再试!");
+//        }
+//
+//    }
+
+
     /**
      * 购买课程微信支付回调
      * @param request
@@ -289,7 +327,7 @@
 
 
     /**
-     * 购买课程支付宝回调
+     * 预约场地支付宝回调
      * @param request
      * @param response
      */
@@ -297,6 +335,7 @@
     @PostMapping("/base/site/aliPaymentSiteCallback")
     public void aliPaymentSiteCallback(HttpServletRequest request, HttpServletResponse response){
         try {
+            System.out.println("回调回调回调");
             Map<String, String> map = payMoneyUtil.alipayCallback(request);
             if(null != map){
                 String code = map.get("out_trade_no");
@@ -317,8 +356,6 @@
             e.printStackTrace();
         }
     }
-
-
 
 
     @ResponseBody
@@ -356,10 +393,39 @@
             SiteBooking byId = siteBookingService.getById(id);
             Integer storeId = byId.getStoreId();
             Store byId1 = service.getById(storeId);
+            Site site = siteService.getById(byId.getSiteId());
+
+            map.put("siteName",byId1.getName());
+            SiteType siteType = siteTypeService.getById(site.getSiteTypeId());
+            map.put("siteType",siteType.getName());
+            map.put("shopName",byId1.getName());
+            map.put("shopAddress",byId1.getAddress());
+
 
             List<Integer> ids = getIds(byId.getSiteId());
             byId.setStorePhone(byId1.getPhone());
+            
+            //拼接开始结束时间
+            Date startTime = byId.getStartTime();
+            Date endTime = byId.getEndTime();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+
+            String startTimeString = sdf.format(startTime);
+            String endTimeString = sdf.format(endTime);
+
+            String result = startTimeString + "-" + endTimeString.substring(11);
+            byId.setTimes(result);
+
+
+
+
+            byId.setSid(Arrays.asList(storeId));
+            List<Site> list = siteService.list(new LambdaQueryWrapper<Site>().eq(Site::getStoreId, storeId).eq(Site::getSign, 1));
+            List<Integer> collect = list.stream().map(Site::getId).collect(Collectors.toList());
+            byId.setRid(collect);
             map.put("data",byId);
+
+
             map.put("ids",ids);
             return ResultUtil.success(map);
         }catch (Exception e){

--
Gitblit v1.7.1