From 552c700f584700316e8d1919dd1ad7f551c53ec4 Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期二, 12 十一月 2024 10:03:22 +0800
Subject: [PATCH] fix : 新增日统计接口

---
 src/main/java/com/boying/controller/phone/YCPayController.java |   50 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/boying/controller/phone/YCPayController.java b/src/main/java/com/boying/controller/phone/YCPayController.java
index f5ec8c0..a19093c 100644
--- a/src/main/java/com/boying/controller/phone/YCPayController.java
+++ b/src/main/java/com/boying/controller/phone/YCPayController.java
@@ -2,7 +2,6 @@
 
 import cn.hutool.http.Header;
 import cn.hutool.http.HttpRequest;
-import cn.hutool.http.HttpResponse;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,17 +12,15 @@
 import com.boying.entity.*;
 import com.boying.service.*;
 import com.boying.util.DateUtilOther;
-import com.boying.util.HTTPEntityUtil;
-import com.boying.util.RedisJsonUtil;
 import com.google.gson.Gson;
+
 import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
@@ -38,7 +35,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
+
 
 /**
  * @author kdq
@@ -63,7 +60,7 @@
     private final EnterParkService enterParkService;
     private final WXService wxService;
     private final OutParkLogService outParkLogService;
-    private final RedisJsonUtil redisJsonUtil;
+    private  final StringRedisTemplate redisTemplate;
 
 
     /**
@@ -150,6 +147,37 @@
         }
     }
 
+    /**
+     * 鍒ゆ柇鏀粯绔槸鍚﹀凡缁忔敮浠樿繃
+     * @param id
+     * @return
+     */
+    @PostMapping("parkJudg")
+    public Object parkJudg(Long id){
+        if(id == null){
+            return R.failed("鏈壘鍒版暟鎹紝璇风◢鍚庨噸鏂扮偣鍑�");
+        }
+        OutPark outPark =  outParkService.getById(id);
+        if(outPark == null){
+            return R.failed("鏈壘鍒版暟鎹紝璇风◢鍚庨噸鏂扮偣鍑�");
+        }
+        if(StringUtils.isNotBlank(outPark.getPayCode()) && outPark.getStatus() == 0){
+            return R.ok(1,"璁㈠崟宸叉彁浜ゆ敮浠樿姹�");
+        }
+        if(StringUtils.isNotBlank(outPark.getPayCode()) && outPark.getStatus() == 1){
+            return R.failed(0,"璁㈠崟宸茬即璐�");
+        }
+        if(StringUtils.isBlank(outPark.getPayCode())){
+            OutPark by10min = outParkService.findBy10min(outPark.getCarNo(), outPark.getParkId(), outPark.getCreateTime(),outPark.getId());
+            if(by10min !=null){
+                return R.ok(1,"璁㈠崟宸叉彁浜ゆ敮浠樿姹�");
+            }else {
+                return R.ok(0,"璇锋彁浜ゆ敮浠�");
+            }
+        }
+        return R.failed(0,"璇锋彁浜ゆ敮浠�");
+    }
+
 
     /**
      * 鍒ゆ柇鏄惁缂磋垂
@@ -166,7 +194,6 @@
             updateOutPark(outPark.getId(),"03");
             return R.failed("鏈鍋滆溅鏃犻渶鏀粯璐圭敤");
         }
-
         //鍒ゆ柇鏄惁鍦ㄧ櫧鍚嶅崟
         QueryWrapper<WhiteList> wrapper = new QueryWrapper<>();
         wrapper.lambda()
@@ -686,11 +713,8 @@
                 outPark.setStatus(1);
                 outParkService.saveOrUpdate(outPark);
                 //缂撳瓨鍦╮edis閲�
-                try {
-                    redisJsonUtil.set("outPark-"+outPark.getBarrierId(), outPark);
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
+                String jsonValue = JSON.toJSONString(outPark);
+                redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue);
             }
         }
     }

--
Gitblit v1.9.1