From 199202813dd8ca536ed2334f5eeb6aba3ad25b21 Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期一, 22 十二月 2025 08:49:51 +0800
Subject: [PATCH] fix : 新分支

---
 src/main/java/com/boying/controller/phone/YCPayController.java |   63 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/boying/controller/phone/YCPayController.java b/src/main/java/com/boying/controller/phone/YCPayController.java
index 0c773ed..eb20fea 100644
--- a/src/main/java/com/boying/controller/phone/YCPayController.java
+++ b/src/main/java/com/boying/controller/phone/YCPayController.java
@@ -13,6 +13,8 @@
 import com.boying.service.*;
 import com.boying.util.DateUtilOther;
 import com.google.gson.Gson;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.http.ResponseEntity;
@@ -46,6 +48,7 @@
 @RestController
 @RequestMapping("/ffzf/api")
 @RequiredArgsConstructor
+@Tag(description = "ffzf/api" , name = "閭偍/閭㈠彴閾惰 瀵规帴鏀粯鎺ュ彛" )
 public class YCPayController {
     private final OutParkService outParkService;
     private final PayLogService payLogService;
@@ -61,6 +64,8 @@
     private final OutParkLogService outParkLogService;
     private  final StringRedisTemplate redisTemplate;
 
+    private final PaymentLogService paymentLogService;
+
 
     /**
      * 鏌ヨ璁㈠崟鎺ュ彛
@@ -68,21 +73,56 @@
      * @return
      */
     @GetMapping("/getByQueryId")
+    @Operation(summary = "鏍规嵁鍑哄満id鑾峰彇鍑哄満鏁版嵁" , description = "鏍规嵁鍑哄満id鑾峰彇鍑哄満鏁版嵁" )
     public Object getByQueryId(Long queryId){
         if(queryId == null){
             return R.failed("鍙傛暟涓虹┖");
         }
         OutPark byId = outParkService.getById(queryId);
-        if(byId.getTime() > 0){
-            byId.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(byId.getTime()).longValue()));
+        PaymentLog byId1 = paymentLogService.getById(queryId);
+        if(byId1 !=null && byId !=null){
+            if(byId.getCreateTime().isAfter(byId1.getCreateTime())){
+                //鍑哄満琛ㄦ椂闂村湪鏈堢エ鍚�
+                if(byId.getTime() > 0){
+                    byId.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(byId.getTime()).longValue()));
+                }
+                return R.ok(byId,"璇锋眰鎴愬姛");
+            }else {
+                //鍑哄満琛ㄦ椂闂村湪鏈堢エ鍚�
+                OutPark outPark = new OutPark();
+                outPark.setId(byId1.getId());
+                outPark.setCreateTime(LocalDateTime.now());
+                outPark.setEnterTime(LocalDateTime.now());
+                outPark.setTime(0.0);
+                outPark.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(outPark.getTime()).longValue()));
+                outPark.setPrice(byId1.getMoney());
+                return R.ok(outPark,"璇锋眰鎴愬姛");
+            }
         }
-        return R.ok(byId,"璇锋眰鎴愬姛");
+        if(byId == null){
+            OutPark outPark = new OutPark();
+            outPark.setId(byId1.getId());
+            outPark.setCreateTime(LocalDateTime.now());
+            outPark.setEnterTime(LocalDateTime.now());
+            outPark.setTime(0.0);
+            outPark.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(outPark.getTime()).longValue()));
+            outPark.setPrice(byId1.getMoney());
+            return R.ok(outPark,"璇锋眰鎴愬姛");
+        }
+        if(byId1 == null){
+            if(byId.getTime() > 0){
+                byId.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(byId.getTime()).longValue()));
+            }
+            return R.ok(byId,"璇锋眰鎴愬姛");
+        }
+        return R.failed("鏈煡璇㈠埌鏁版嵁");
     }
 
     /**
      * 缂存涔�
      */
     @PostMapping("park")
+    @Operation(summary = "閭偍鐢宠缂存涔�" , description = "閭偍鐢宠缂存涔�" )
     public Object park(Long id){
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
         OutPark outPark =  outParkService.getById(id);
@@ -152,6 +192,7 @@
      * @return
      */
     @PostMapping("parkJudg")
+    @Operation(summary = "鍒ゆ柇鏀粯绔槸鍚﹀凡缁忕敵璇疯繃鏀粯" , description = "鍒ゆ柇鏀粯绔槸鍚﹀凡缁忕敵璇疯繃鏀粯" )
     public Object parkJudg(Long id){
         if(id == null){
             return R.failed("鏈壘鍒版暟鎹紝璇风◢鍚庨噸鏂扮偣鍑�");
@@ -163,15 +204,18 @@
         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 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.ok(0,"璇锋彁浜ゆ敮浠�");
+        return R.failed(0,"璇锋彁浜ゆ敮浠�");
     }
 
 
@@ -179,6 +223,7 @@
      * 鍒ゆ柇鏄惁缂磋垂
      */
     @PostMapping("parkXT")
+    @Operation(summary = "閭㈠彴閾惰鐢宠缂磋垂" , description = "閭㈠彴閾惰鐢宠缂磋垂" )
     public Object parkXT(Long id){
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
         OutPark outPark =  outParkService.getById(id);
@@ -253,6 +298,7 @@
      * 闃块噷缂磋垂
      */
     @PostMapping("payByAli")
+    @Operation(summary = "閭㈠彴閾惰鏀粯瀹濈即璐�" , description = "閭㈠彴閾惰鏀粯瀹濈即璐�" )
     public Object payByAli(Long id){
         OutPark outPark =  outParkService.getById(id);
         String xtyhpay = systemConfigProperties.getXTYHPAY();
@@ -328,6 +374,7 @@
      * 鑾峰彇寰俊openid
      */
     @PostMapping("getOpenId")
+    @Operation(summary = "閭㈠彴閾惰鑾峰彇寰俊鐢ㄦ埛openid" , description = "閭㈠彴閾惰鑾峰彇寰俊鐢ㄦ埛openid" )
     public Object park(Long id,String code){
         OutPark outPark =  outParkService.getById(id);
         String openIdByCode = wxService.getOpenIdByCode(code);
@@ -339,6 +386,7 @@
      * 寰俊缂磋垂
      */
     @PostMapping("payByWX")
+    @Operation(summary = "閭㈠彴閾惰寰俊鏀粯" , description = "閭㈠彴閾惰寰俊鏀粯" )
     public Object payByWX(Long id,String openId){
         System.out.println("寮�濮嬫敮浠�");
         OutPark outPark =  outParkService.getById(id);
@@ -431,6 +479,7 @@
      * @return
      */
     @GetMapping("/result")
+    @Operation(summary = "閭偍鑾峰緱鏀粯鍥炶皟" , description = "閭偍鑾峰緱鏀粯鍥炶皟" )
     public Object result(Long queryId,int success,int msg){
         OutPark byId = outParkService.getById(queryId);
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
@@ -465,6 +514,7 @@
      * @return
      */
     @PostMapping("/getResult")
+    @Operation(summary = "閭㈠彴閾惰鏀粯鍥炶皟鎺ュ彛" , description = "閭㈠彴閾惰鏀粯鍥炶皟鎺ュ彛" )
     public Object getResult(HttpServletRequest request){
         System.out.println("getResult鏀跺埌璁块棶");
         String respCode = request.getParameter("respCode");
@@ -519,6 +569,7 @@
      * @return
      */
     @PostMapping ("/checkbill")
+    @Operation(summary = "閭偍瀵硅处鎺ュ彛" , description = "閭偍瀵硅处鎺ュ彛" )
     public Object checkbill(@RequestBody Map params){
         String checkDate = (String) params.get("checkDate");
         String tranDate = (String) params.get("tranDate");
@@ -540,6 +591,7 @@
      * @return
      */
     @PostMapping ("/checkbillXTYH")
+    @Operation(summary = "閭㈠彴閾惰瀵硅处鎺ュ彛" , description = "閭㈠彴閾惰瀵硅处鎺ュ彛" )
     public Object checkbillXTYH(String date){
         String xtyhpay = systemConfigProperties.getXTYHPAY();
         Map<String,Object> map = new HashMap<>();
@@ -584,6 +636,7 @@
      * @return
      */
     @PostMapping ("/searchPayStatus")
+    @Operation(summary = "浜ゆ槗鐘舵�佹煡璇�" , description = "浜ゆ槗鐘舵�佹煡璇�" )
     public Object searchPayStatus(String txnOrderId,String txnOrderTime){
         OutPark outPark = outParkService.findByOrderId(txnOrderId);
         if(outPark == null){

--
Gitblit v1.9.1