From 3ef02177eae63e4287e27aa36493d696b53c5621 Mon Sep 17 00:00:00 2001 From: kongdeqiang <123456> Date: 星期三, 20 九月 2023 17:17:44 +0800 Subject: [PATCH] 修改 --- src/main/java/com/boying/controller/phone/YCPayController.java | 45 ++++++++++++++++++++++++++++++++++++++------- 1 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/boying/controller/phone/YCPayController.java b/src/main/java/com/boying/controller/phone/YCPayController.java index a4f7935..fb7ea9c 100644 --- a/src/main/java/com/boying/controller/phone/YCPayController.java +++ b/src/main/java/com/boying/controller/phone/YCPayController.java @@ -64,6 +64,7 @@ */ @PostMapping("park") public Object park(Long id){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); OutPark outPark = outParkService.getById(id); if(outPark.getPrice()==0){ updateOutPark(outPark.getId(),"03"); @@ -94,6 +95,8 @@ } } if(StringUtils.isNotBlank(outPark.getPayCode()) && outPark.getStatus() == 0){ + String logs = sdf.format(new Date())+" 杞︾墝鍙蜂负锛�"+outPark.getCarNo()+",鐢宠缂磋垂2------銆媆n"; + writeTxt(logs); // "http://wxtest.smeia.cn/h5/static/router.html?rurl=router&router=psbc&appid=CUP16522400671¶ms={\"payMode\":\"B\",\"payItemNo\":\"41301106100124\",\"userNo\":"+id+"}" return R.ok("璺宠浆閭偍鏀粯","https://openpayment.psbc.com/h5/static/router.html?rurl=router&router=psbc&appid=CUP14094502391¶ms={\"payMode\":\"B\",\"payItemNo\":\"41304508000500\",\"userNo\":"+id+"}"); // return R.ok("璺宠浆閭偍鏀粯","http://wxtest.smeia.cn/h5/static/router.html?rurl=router&router=psbc&appid=CUP16522400671¶ms={\"payMode\":\"B\",\"payItemNo\":\"41301106100124\",\"userNo\":"+id+"}"); @@ -102,6 +105,20 @@ } 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¶ms={\"payMode\":\"B\",\"payItemNo\":\"41304508000500\",\"userNo\":"+id+"}"); }else { @@ -117,15 +134,23 @@ @GetMapping("/result") public Object result(Long queryId,int success,int msg){ OutPark byId = outParkService.getById(queryId); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); if(byId == null){ return R.failed("鏈煡璇㈠埌璁㈠崟"); }else { //淇敼璁㈠崟鐘舵�� 0鎴愬姛 if(success==0){ 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 { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); String logs = sdf.format(new Date())+" 鍑哄満id涓猴細"+queryId+",缂磋垂澶辫触------銆媆n"; logs += "鍥炴墽鍘熷洜锛�"+msg+",\n"; writeTxt(logs); @@ -248,10 +273,20 @@ //鎻掑叆鍋滆溅璁㈠崟璁板綍 public void addOrderRecord(OutPark outPark){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); + String logs = sdf.format(new Date())+" 杞︾墝鍙蜂负锛�"+outPark.getCarNo()+",鍒涘缓璁㈠崟------銆媆n"; + writeTxt(logs); outPark.setPayCode(outPark.getId()+""); - outParkService.saveOrUpdate(outPark); + 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()); @@ -261,14 +296,10 @@ orderRecord.setType(1); orderRecord.setTicketStatus(0); orderRecord.setPayCode(outPark.getPayCode()); - orderRecordService.saveOrUpdate(orderRecord); if(outPark.getImgId() != null){ orderRecord.setImgOutId(outPark.getImgId()); } - EnterPark enterPark = enterParkService.getByCarNoAndDate(outPark.getCarNo(), outPark.getParkId(), outPark.getEnterTime()); - if(enterPark != null && enterPark.getImgId() != null){ - orderRecord.setImgInId(enterPark.getImgId()); - } + orderRecordService.saveOrUpdate(orderRecord); } //鎻掑叆鎵ф硶璁㈠崟璁板綍 -- Gitblit v1.9.1