From 7bc78d8f70a4d11e46f8bd640228804a3dd0dc68 Mon Sep 17 00:00:00 2001 From: kongdeqiang <123456> Date: 星期一, 22 四月 2024 10:52:29 +0800 Subject: [PATCH] Merge branch 'master2' --- src/main/java/com/boying/controller/phone/YCPayController.java | 71 ++++++++++++++++++++++++++++++++--- 1 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/boying/controller/phone/YCPayController.java b/src/main/java/com/boying/controller/phone/YCPayController.java index 349ba82..9f54dde 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,15 +12,16 @@ import com.boying.entity.*; import com.boying.service.*; import com.boying.util.DateUtilOther; -import com.boying.util.HTTPEntityUtil; 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.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; @@ -37,6 +37,7 @@ import java.util.List; import java.util.Map; + /** * @author kdq * @version 1.0.0 @@ -47,6 +48,7 @@ @RestController @RequestMapping("/ffzf/api") @RequiredArgsConstructor +@Tag(description = "ffzf/api" , name = "閭偍/閭㈠彴閾惰 瀵规帴鏀粯鎺ュ彛" ) public class YCPayController { private final OutParkService outParkService; private final PayLogService payLogService; @@ -59,6 +61,9 @@ private final WhiteListService whiteListService; private final EnterParkService enterParkService; private final WXService wxService; + private final OutParkLogService outParkLogService; + private final StringRedisTemplate redisTemplate; + /** * 鏌ヨ璁㈠崟鎺ュ彛 @@ -66,6 +71,7 @@ * @return */ @GetMapping("/getByQueryId") + @Operation(summary = "鏍规嵁鍑哄満id鑾峰彇鍑哄満鏁版嵁" , description = "鏍规嵁鍑哄満id鑾峰彇鍑哄満鏁版嵁" ) public Object getByQueryId(Long queryId){ if(queryId == null){ return R.failed("鍙傛暟涓虹┖"); @@ -81,6 +87,7 @@ * 缂存涔� */ @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); @@ -144,11 +151,44 @@ } } + /** + * 鍒ゆ柇鏀粯绔槸鍚﹀凡缁忔敮浠樿繃 + * @param id + * @return + */ + @PostMapping("parkJudg") + @Operation(summary = "鍒ゆ柇鏀粯绔槸鍚﹀凡缁忕敵璇疯繃鏀粯" , description = "鍒ゆ柇鏀粯绔槸鍚﹀凡缁忕敵璇疯繃鏀粯" ) + 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,"璇锋彁浜ゆ敮浠�"); + } + /** * 鍒ゆ柇鏄惁缂磋垂 */ @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); @@ -160,7 +200,6 @@ updateOutPark(outPark.getId(),"03"); return R.failed("鏈鍋滆溅鏃犻渶鏀粯璐圭敤"); } - //鍒ゆ柇鏄惁鍦ㄧ櫧鍚嶅崟 QueryWrapper<WhiteList> wrapper = new QueryWrapper<>(); wrapper.lambda() @@ -187,6 +226,9 @@ if(StringUtils.isNotBlank(outPark.getPayCode()) && outPark.getStatus() == 0){ String logs = sdf.format(new Date())+" 杞︾墝鍙蜂负锛�"+outPark.getCarNo()+",鐢宠缂磋垂2------銆媆n"; writeTxt(logs); + OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId()); + byOutPark.setPayStartTime(LocalDateTime.now()); + outParkLogService.saveOrUpdate(byOutPark); return R.ok(null,"璺宠浆閭㈠彴閾惰鏀粯"); }else if(StringUtils.isNotBlank(outPark.getPayCode()) && outPark.getStatus() == 1){ return R.failed("宸茬即璐�"); @@ -204,6 +246,9 @@ }else { outPark.setPrice(outPark.getPrice()-enterPark.getPrice()); outParkService.updateById(outPark); + OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId()); + byOutPark.setPayStartTime(LocalDateTime.now()); + outParkLogService.saveOrUpdate(byOutPark); } } } @@ -218,6 +263,7 @@ * 闃块噷缂磋垂 */ @PostMapping("payByAli") + @Operation(summary = "閭㈠彴閾惰鏀粯瀹濈即璐�" , description = "閭㈠彴閾惰鏀粯瀹濈即璐�" ) public Object payByAli(Long id){ OutPark outPark = outParkService.getById(id); String xtyhpay = systemConfigProperties.getXTYHPAY(); @@ -293,6 +339,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); @@ -304,6 +351,7 @@ * 寰俊缂磋垂 */ @PostMapping("payByWX") + @Operation(summary = "閭㈠彴閾惰寰俊鏀粯" , description = "閭㈠彴閾惰寰俊鏀粯" ) public Object payByWX(Long id,String openId){ System.out.println("寮�濮嬫敮浠�"); OutPark outPark = outParkService.getById(id); @@ -396,6 +444,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"); @@ -430,6 +479,7 @@ * @return */ @PostMapping("/getResult") + @Operation(summary = "閭㈠彴閾惰鏀粯鍥炶皟鎺ュ彛" , description = "閭㈠彴閾惰鏀粯鍥炶皟鎺ュ彛" ) public Object getResult(HttpServletRequest request){ System.out.println("getResult鏀跺埌璁块棶"); String respCode = request.getParameter("respCode"); @@ -452,6 +502,9 @@ if(byPayCode.getStatus() == 1){ return R.ok(null,"璁㈠崟宸叉敮浠�"); }else { + OutParkLog byOutPark = outParkLogService.getByOutPark(byPayCode.getCarNo(), byPayCode.getId()); + byOutPark.setPayEndTime(LocalDateTime.now()); + outParkLogService.saveOrUpdate(byOutPark); updateOrderRecord((long)byPayCode.getId(),"03"); List<EnterPark> byCarNo = enterParkService.findByCarNo(byPayCode.getCarNo(),byPayCode.getParkId()); if(byCarNo.size()>0){ @@ -481,6 +534,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"); @@ -502,6 +556,7 @@ * @return */ @PostMapping ("/checkbillXTYH") + @Operation(summary = "閭㈠彴閾惰瀵硅处鎺ュ彛" , description = "閭㈠彴閾惰瀵硅处鎺ュ彛" ) public Object checkbillXTYH(String date){ String xtyhpay = systemConfigProperties.getXTYHPAY(); Map<String,Object> map = new HashMap<>(); @@ -546,6 +601,7 @@ * @return */ @PostMapping ("/searchPayStatus") + @Operation(summary = "浜ゆ槗鐘舵�佹煡璇�" , description = "浜ゆ槗鐘舵�佹煡璇�" ) public Object searchPayStatus(String txnOrderId,String txnOrderTime){ OutPark outPark = outParkService.findByOrderId(txnOrderId); if(outPark == null){ @@ -666,10 +722,13 @@ //鏇存柊鍑哄満 public void updateOutPark(Integer outParkId, String status){ OutPark outPark = outParkService.getById(outParkId); - if(outPark!=null){ + if(outPark!=null && outPark.getEnterTime() !=null){ if(status.equals("03")){ outPark.setStatus(1); outParkService.saveOrUpdate(outPark); + //缂撳瓨鍦╮edis閲� + String jsonValue = JSON.toJSONString(outPark); + redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue); } } } -- Gitblit v1.9.1