From 06c7348b197ede0b68e6d02f019bf81892329b88 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 19 三月 2024 18:07:12 +0800
Subject: [PATCH] 修改bug

---
 cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java |  108 +++++++++++++++++++++++++++---------------------------
 1 files changed, 54 insertions(+), 54 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 d4259cd..8c26b25 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
@@ -24,6 +24,7 @@
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
@@ -62,8 +63,31 @@
 
     @Resource
     private UserCouponClient userCouponClient;
-    @Autowired
+
+    @Resource
     private CityManagerClient cityManagerClient;
+
+    @Autowired
+    private TGameConfigService gameConfigService;
+
+    @Autowired
+    private TGameRecordService gameRecordService;
+
+    @Resource
+    private CourseRecordClient courseRecordClient;
+
+    @Autowired
+    private RedisUtil redisUtil;
+
+
+
+
+
+
+
+
+
+
 
     /**
      * 通过运营商id查询运营商对应的支付宝商户号
@@ -226,9 +250,6 @@
         }
     }
 
-    @Autowired
-    private RedisUtil redisUtil;
-
     @ResponseBody
     @PostMapping("/base/site/querySiteTimes")
     @ApiOperation(value = "获取场地详情时间段数据", tags = {"用户—预约场地"})
@@ -289,20 +310,6 @@
         }
     }
 
-//        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("系统繁忙,请稍后再试!");
-//        }
-//
-//    }
 
 
     /**
@@ -326,11 +333,12 @@
                     siteBooking.setStatus(1);
                     siteBooking.setPayOrderNo(transaction_id);
                     siteBookingService.updateById(siteBooking);
+
+                    PrintWriter out = response.getWriter();
+                    out.write(result);
+                    out.flush();
+                    out.close();
                 }
-                PrintWriter out = response.getWriter();
-                out.write(result);
-                out.flush();
-                out.close();
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -347,7 +355,6 @@
     @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");
@@ -359,24 +366,21 @@
                     siteBooking.setStatus(1);
                     siteBooking.setPayOrderNo(trade_no);
                     siteBookingService.updateById(siteBooking);
+                    PrintWriter out = response.getWriter();
+                    out.write("success");
+                    out.flush();
+                    out.close();
                 }
-                PrintWriter out = response.getWriter();
-                out.write("success");
-                out.flush();
-                out.close();
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
     }
 
-    @Autowired
-    private TGameConfigService gameConfigService;
-    @Autowired
-    private TGameRecordService gameRecordService;
 
-    @Resource
-    private CourseRecordClient courseRecordClient;
+
+
+
     /**
      * 启动游戏支付宝回调
      *
@@ -387,10 +391,8 @@
     @PostMapping("/base/site/gameCallback")
     public void gameCallback(HttpServletRequest request, HttpServletResponse response) {
         try {
-            System.out.println("回调回调回调");
             Map<String, String> map = payMoneyUtil.alipayCallback(request);
             if (null != map) {
-
                 String code = map.get("passback_params");
                 String trade_no = map.get("trade_no");
                 String[] s = code.split("_");
@@ -412,7 +414,6 @@
                 }
                 gameRecordService.updateBatchById(list);
 
-                System.err.println("===========游戏回调游戏回调=========" + i);
                 PrintWriter out = response.getWriter();
                 out.write("success");
                 out.flush();
@@ -477,10 +478,10 @@
     public ResultUtil<Map<String, Object>> queryMySiteById(Integer id) {
         try {
             HashMap<String, Object> map = new HashMap<>();
-            SiteBooking byId = siteBookingService.getById(id);
-            Integer storeId = byId.getStoreId();
+            SiteBooking siteBooking = siteBookingService.getById(id);
+            Integer storeId = siteBooking.getStoreId();
             Store byId1 = service.getById(storeId);
-            Site site = siteService.getById(byId.getSiteId());
+            Site site = siteService.getById(siteBooking.getSiteId());
             map.put("siteName", byId1.getName());
             SiteType siteType = siteTypeService.getById(site.getSiteTypeId());
             map.put("siteType", siteType.getName());
@@ -490,29 +491,30 @@
             map.put("name", site.getName());
 
 
-            List<Integer> ids = getIds(byId.getSiteId());
-            byId.setStorePhone(byId1.getPhone());
+            List<Integer> ids = getIds(siteBooking.getSiteId());
+            siteBooking.setStorePhone(byId1.getPhone());
 
             //拼接开始结束时间
-            Date startTime = byId.getStartTime();
-            Date endTime = byId.getEndTime();
+            Date startTime = siteBooking.getStartTime();
+            Date endTime = siteBooking.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);
+            siteBooking.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());
-            Integer siteId = byId.getSiteId();
+            siteBooking.setSid(Arrays.asList(storeId));
+            Integer siteId = siteBooking.getSiteId();
             ArrayList<Integer> list1 = new ArrayList<>();
             list1.add(siteId);
-            byId.setRid(list1);
-            map.put("data", byId);
+            siteBooking.setRid(list1);
+            SiteBookingVo siteBookingVo = new SiteBookingVo();
+            BeanUtils.copyProperties(siteBooking, siteBookingVo);
+            siteBookingVo.setStartTime(siteBooking.getStartTime().getTime());
+            siteBookingVo.setEndTime(siteBooking.getEndTime().getTime());
+            siteBookingVo.setPayTime(siteBooking.getPayTime().getTime());
+            map.put("data", siteBookingVo);
             map.put("ids", ids);
             return ResultUtil.success(map);
         } catch (Exception e) {
@@ -553,8 +555,6 @@
             if (null == uid) {
                 return ResultUtil.tokenErr();
             }
-
-
             return siteService.cancelMySite(uid, id);
         } catch (Exception e) {
             e.printStackTrace();

--
Gitblit v1.7.1