From 15b3290a092ea16be998d5ce3c1df06ec3752bb5 Mon Sep 17 00:00:00 2001
From: kongdeqiang <kongdeqiang960204@163.com>
Date: 星期二, 15 八月 2023 10:37:54 +0800
Subject: [PATCH] 提交更新

---
 src/main/java/com/boying/controller/phone/TicketController.java |   14 ++----
 src/main/resources/mapper/OutParkMapper.xml                     |    2 
 src/main/java/com/boying/entity/EnterPark.java                  |    6 +++
 src/main/java/com/boying/controller/car/PlateServlet3.java      |   26 ++++++++++++-
 src/main/java/com/boying/job/YCGetEticketScheduled.java         |    2 
 src/main/java/com/boying/job/YCEticketScheduled.java            |    6 +-
 src/main/java/com/boying/util/FileUtil.java                     |    2 
 src/main/resources/mapper/EnterParkMapper.xml                   |    2 
 src/main/java/com/boying/controller/phone/YCPayController.java  |   32 ++++++++++++---
 src/main/resources/application.yml                              |   13 +++++-
 10 files changed, 77 insertions(+), 28 deletions(-)

diff --git a/src/main/java/com/boying/controller/car/PlateServlet3.java b/src/main/java/com/boying/controller/car/PlateServlet3.java
index 82b1f85..612d1e5 100644
--- a/src/main/java/com/boying/controller/car/PlateServlet3.java
+++ b/src/main/java/com/boying/controller/car/PlateServlet3.java
@@ -359,6 +359,8 @@
                         if(tickets.size()>0){
                             enterPark.setStatus(1);//鍙戠幇鏈夎繚绔�
                         }
+                        enterPark.setIsPay(0);
+                        enterPark.setPrice(0);
                         enterParkService.deleteByCarNo(enterPark.getCarNo(),enterPark.getParkId());
                         enterParkService.save(enterPark);
                         barrier.setType2(1);
@@ -409,6 +411,15 @@
                 outPark.setTime(l/(1000*60));
                 toDayHrMinSec = DateUtilOther.millisToDayHrMinSec(l/(1000*60));
                 money = costRuleService.getMoney(one.getParkId(), outPark.getEnterTime(), outPark.getCreateTime(), 1);
+
+                //鍏ュ満璁板綍淇濆瓨涓�涓�
+                if(one.getIsPay()==1){
+                    money = money - one.getPrice();
+                }else {
+                    one.setPrice(money);
+                    one.setIsPay(0);
+                    enterParkService.updateById(one);
+                }
             } catch (ParseException e) {
                 e.printStackTrace();
             }
@@ -486,6 +497,8 @@
         }else {
             enterParkService.deleteByCarNo(carNo,parkId);
             EnterPark enterPark = new EnterPark();
+            enterPark.setIsPay(0);
+            enterPark.setPrice(0);
             enterPark.setCarNo(carNo);
             enterPark.setBarrierId(barrierId);
             enterPark.setParkId(parkId);
@@ -528,6 +541,15 @@
                 outPark.setTime(l/(1000*60));
                 toDayHrMinSec = DateUtilOther.millisToDayHrMinSec(l/(1000*60));
                 money = costRuleService.getMoney(parkId, outPark.getEnterTime(), outPark.getCreateTime(), 1);
+
+                //鍏ュ満璁板綍淇濆瓨涓�涓�
+                if(enterPark.getIsPay() != null && enterPark.getIsPay()==1){
+                    money = money - enterPark.getPrice();
+                }else {
+                    enterPark.setPrice(money);
+                    enterPark.setIsPay(0);
+                    enterParkService.updateById(enterPark);
+                }
             } catch (ParseException e) {
                 e.printStackTrace();
             }
@@ -556,7 +578,7 @@
                 if(w.getType()==0){
                     outLedShowYueZu(barrier.getCarNo(),"鏈堢杞�",parkId,request,response,0);
                     OutPark byCarNoAndBarrierId = outParkService.findByCarNoAndBarrierId(carNo, barrierId);
-                    byCarNoAndBarrierId.setStatus(1);
+                    byCarNoAndBarrierId.setStatus(2);
                     byCarNoAndBarrierId.setStatus2(1);
                     outParkService.saveOrUpdate(byCarNoAndBarrierId);
                     return 0.0;
@@ -570,7 +592,7 @@
                                 if(pid == outPark.getParkId() && System.currentTimeMillis()<w.getEndTime().getTime()){
                                     outLedShowYueZu(barrier.getCarNo(),"鏈堢杞�",parkId,request,response,0);
                                     OutPark byCarNoAndBarrierId = outParkService.findByCarNoAndBarrierId(carNo, barrierId);
-                                    byCarNoAndBarrierId.setStatus(1);
+                                    byCarNoAndBarrierId.setStatus(2);
                                     byCarNoAndBarrierId.setStatus2(1);
                                     outParkService.saveOrUpdate(byCarNoAndBarrierId);
                                     return 0.0;
diff --git a/src/main/java/com/boying/controller/phone/TicketController.java b/src/main/java/com/boying/controller/phone/TicketController.java
index 902d4c8..cc0e7d2 100644
--- a/src/main/java/com/boying/controller/phone/TicketController.java
+++ b/src/main/java/com/boying/controller/phone/TicketController.java
@@ -174,15 +174,15 @@
         String shouQianMing = byId.getShouQianMing();
         String zfQianMing1 = byId.getZfQianMing1();
         String zfQianMing2 = byId.getZfQianMing2();
-        if(shouQianMing != null){
+        if(StringUtils.isNotBlank(shouQianMing)){
             String get = FileUtil.netSourceToBase64(shouQianMing, "GET");
             byId.setShouQianMing("data:image/png;base64,"+get);
         }
-        if(zfQianMing1 != null){
+        if(StringUtils.isNotBlank(zfQianMing1)){
             String get = FileUtil.netSourceToBase64(zfQianMing1, "GET");
             byId.setZfQianMing1("data:image/png;base64,"+get);
         }
-        if(zfQianMing2 != null){
+        if(StringUtils.isNotBlank(zfQianMing2)){
             String get = FileUtil.netSourceToBase64(zfQianMing2, "GET");
             byId.setZfQianMing2("data:image/png;base64,"+get);
         }
@@ -226,12 +226,8 @@
     //涓庢墽娉曞鎺�
     @GetMapping("/getResult")
     public Object getResult(Ticket ticket){
-        if(StringUtils.isNotBlank(ticket.getShouQianMing())){
-            ticketService.updateById(ticket);
-            return R.ok();
-        }else {
-            return R.failed("鏇存柊澶辫触");
-        }
+        ticketService.updateById(ticket);
+        return R.ok();
     }
 
     public void saveLogo(String name,String lng,String lat){
diff --git a/src/main/java/com/boying/controller/phone/YCPayController.java b/src/main/java/com/boying/controller/phone/YCPayController.java
index f31113e..fb7ea9c 100644
--- a/src/main/java/com/boying/controller/phone/YCPayController.java
+++ b/src/main/java/com/boying/controller/phone/YCPayController.java
@@ -107,6 +107,18 @@
         if(StringUtils.isBlank(outPark.getPayCode())){
             String logs = sdf.format(new Date())+" 杞︾墝鍙蜂负锛�"+outPark.getCarNo()+",鐢宠缂磋垂------銆媆n";
             writeTxt(logs);
+            List<EnterPark> byCarNo = enterParkService.findByCarNo(outPark.getCarNo(),outPark.getParkId());
+            if(byCarNo.size()>0){
+                EnterPark enterPark = byCarNo.get(0);
+                if(enterPark != null && enterPark.getIsPay() == 1){
+                    if(outPark.getPrice()==enterPark.getPrice()){
+                        return R.failed("宸茬即璐�");
+                    }else {
+                        outPark.setPrice(outPark.getPrice()-enterPark.getPrice());
+                        outParkService.updateById(outPark);
+                    }
+                }
+            }
             addOrderRecord(outPark);
             return R.ok("璺宠浆閭偍鏀粯","https://openpayment.psbc.com/h5/static/router.html?rurl=router&router=psbc&appid=CUP14094502391&params={\"payMode\":\"B\",\"payItemNo\":\"41304508000500\",\"userNo\":"+id+"}");
         }else {
@@ -131,6 +143,12 @@
                 updateOrderRecord(queryId,"03");
                 String logs = sdf.format(new Date())+" 杞︾墝鍙蜂负锛�"+byId.getCarNo()+",缂磋垂鎴愬姛------銆媆n";
                 writeTxt(logs);
+                List<EnterPark> byCarNo = enterParkService.findByCarNo(byId.getCarNo(),byId.getParkId());
+                if(byCarNo.size()>0){
+                    EnterPark enterPark = byCarNo.get(0);
+                    enterPark.setIsPay(1);
+                    enterParkService.updateById(enterPark);
+                }
                 return R.ok(null,"鍥炶皟鎴愬姛");
             }else {
                 String logs = sdf.format(new Date())+" 鍑哄満id涓猴細"+queryId+",缂磋垂澶辫触------銆媆n";
@@ -259,9 +277,16 @@
         String logs = sdf.format(new Date())+" 杞︾墝鍙蜂负锛�"+outPark.getCarNo()+",鍒涘缓璁㈠崟------銆媆n";
         writeTxt(logs);
         outPark.setPayCode(outPark.getId()+"");
+        List<EnterPark> byCarNo = enterParkService.findByCarNo(outPark.getCarNo(),outPark.getParkId());
         outParkService.updateById(outPark);
         Park park = parkService.getById(outPark.getParkId());
         OrderRecord orderRecord = new OrderRecord();
+        if(byCarNo.size() >0){
+            EnterPark enterPark = byCarNo.get(0);
+            if(enterPark != null && enterPark.getImgId() != null){
+                orderRecord.setImgInId(enterPark.getImgId());
+            }
+        }
         orderRecord.setAddress(park.getName());
         orderRecord.setCarNo(outPark.getCarNo());
         orderRecord.setCode(outPark.getCode());
@@ -273,13 +298,6 @@
         orderRecord.setPayCode(outPark.getPayCode());
         if(outPark.getImgId() != null){
             orderRecord.setImgOutId(outPark.getImgId());
-        }
-        List<EnterPark> byCarNo = enterParkService.findByCarNo(outPark.getCarNo(),outPark.getParkId());
-        if(byCarNo.size() >0){
-            EnterPark enterPark = byCarNo.get(0);
-            if(enterPark != null && enterPark.getImgId() != null){
-                orderRecord.setImgInId(enterPark.getImgId());
-            }
         }
         orderRecordService.saveOrUpdate(orderRecord);
     }
diff --git a/src/main/java/com/boying/entity/EnterPark.java b/src/main/java/com/boying/entity/EnterPark.java
index af1404e..f9707a6 100644
--- a/src/main/java/com/boying/entity/EnterPark.java
+++ b/src/main/java/com/boying/entity/EnterPark.java
@@ -47,6 +47,12 @@
     @Column(columnDefinition = "int comment '鍥剧墖id'")
     private Integer imgId;
 
+    @ApiModelProperty(value = "鏄惁鏀粯")
+    @Column(columnDefinition = "int comment '鏄惁鏀粯'")
+    private Integer isPay;
+
+    private double price;
+
 
     @Transient
     @TableField(exist = false)
diff --git a/src/main/java/com/boying/job/YCEticketScheduled.java b/src/main/java/com/boying/job/YCEticketScheduled.java
index fbc019b..a8d5b2a 100644
--- a/src/main/java/com/boying/job/YCEticketScheduled.java
+++ b/src/main/java/com/boying/job/YCEticketScheduled.java
@@ -64,7 +64,7 @@
             }
             //寮�鍙栧彂绁�
             for (OrderRecord orderRecord : list) {
-                System.out.println("姝e湪鐢宠寮�绁ㄦ枃浠讹細" + orderRecord);
+               // System.out.println("姝e湪鐢宠寮�绁ㄦ枃浠讹細" + orderRecord);
                 doTicket(orderRecord);
             }
         }
@@ -91,7 +91,7 @@
             writeTxt(txt);
             doTicketGet(mapTypes,orderRecord);
         }else {
-            System.out.println(entity.getBody());
+          //  System.out.println(entity.getBody());
             txt += "鏌ヨ鏈夎锛�"+entity.getBody()+"\n";
             writeTxt(txt);
         }
@@ -111,7 +111,7 @@
         RestTemplate restTemplate = new RestTemplate();
         ResponseEntity<ReturnData> entity = restTemplate.postForEntity(urlIp+urlRoad, HTTPEntityUtil.setEntity(map1), ReturnData.class);
         if(entity.getBody().getCode() == 1){
-            System.out.println(entity.getBody());
+           // System.out.println(entity.getBody());
             txt += entity.getBody()+",\n";
             Object o1 = entity.getBody().getData().get(0);
             String s1 = JSON.toJSONString(o1);
diff --git a/src/main/java/com/boying/job/YCGetEticketScheduled.java b/src/main/java/com/boying/job/YCGetEticketScheduled.java
index 20330a3..eb75386 100644
--- a/src/main/java/com/boying/job/YCGetEticketScheduled.java
+++ b/src/main/java/com/boying/job/YCGetEticketScheduled.java
@@ -55,7 +55,7 @@
             }
             //寮�鍙栧彂绁�
             for (OrderRecord orderRecord : list) {
-                System.out.println("姝e湪鐢宠寮�绁細" + orderRecord);
+              //  System.out.println("姝e湪鐢宠寮�绁細" + orderRecord);
                 doTicket(orderRecord);
             }
         }
diff --git a/src/main/java/com/boying/util/FileUtil.java b/src/main/java/com/boying/util/FileUtil.java
index 7affa1d..4fef8c6 100644
--- a/src/main/java/com/boying/util/FileUtil.java
+++ b/src/main/java/com/boying/util/FileUtil.java
@@ -121,7 +121,7 @@
             // 鍒涘缓閾炬帴
             HttpURLConnection conn = (HttpURLConnection) url.openConnection();
             conn.setRequestMethod(requestMethod);
-            conn.setConnectTimeout(10 * 1000);
+            conn.setConnectTimeout(20000);
 
             if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
                 //杩炴帴澶辫触/閾炬帴澶辨晥/鏂囦欢涓嶅瓨鍦�
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 152db19..fd1c5ce 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -44,7 +44,7 @@
 #椤圭洰閰嶇疆
 ffpark:
   #鍥剧墖涓婁紶鍦板潃
-  uploadPath: D:/project/img/
+  uploadPath: D:/FFproject/img/
   showImg: ticket/showImg?result=
   #鏈嶅姟绔痠p鍦板潃
   ip: http://183.196.93.178:8088/
@@ -74,8 +74,15 @@
   DIRECTMKOTEINVOICE: directmkoteinvoice
   #鑾峰彇鐢靛瓙绁ㄦ嵁鏂囦欢
   GETEINVOICEBYBIZCODE: geteinvoicebybizcode
-  logPath: D:/project/log/
-  filePath: D:/project/file/
+  logPath: D:/FFproject/log/
+  filePath: D:/FFproject/file/
+
+#椤圭洰閰嶇疆
+ffzf:
+  ip: http://36.134.129.218:6060/
+  loginIp: http://36.134.129.218:9999/auth/oauth/token
+  info: api/getInfo
+  getNumber: api/getNumber
 
 
 
diff --git a/src/main/resources/mapper/EnterParkMapper.xml b/src/main/resources/mapper/EnterParkMapper.xml
index 826e25a..6d86341 100644
--- a/src/main/resources/mapper/EnterParkMapper.xml
+++ b/src/main/resources/mapper/EnterParkMapper.xml
@@ -18,7 +18,7 @@
         <where>
             1=1
             <if test="carNo != null and carNo != ''">
-               and car_no = #{carNo}
+                and car_no like concat('%',#{carNo},'%')
             </if>
             <if test="parkId != null and parkId != ''">
                 and park_id = #{parkId}
diff --git a/src/main/resources/mapper/OutParkMapper.xml b/src/main/resources/mapper/OutParkMapper.xml
index 9921d25..c3a8551 100644
--- a/src/main/resources/mapper/OutParkMapper.xml
+++ b/src/main/resources/mapper/OutParkMapper.xml
@@ -27,7 +27,7 @@
           <where>
                 1=1
                 <if test="carNo != null and carNo != ''">
-                      and car_no = #{carNo}
+                      and car_no like concat('%',#{carNo},'%')
                 </if>
                 <if test="payCode != null and payCode != ''">
                       and pay_code = #{payCode}

--
Gitblit v1.9.1