kongdeqiang
2023-06-08 3fba1d84220268d871c3c28e0e25f6eab3526f46
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&params={\"payMode\":\"B\",\"payItemNo\":\"41301106100124\",\"userNo\":"+id+"}"
            return R.ok("跳转邮储支付","https://openpayment.psbc.com/h5/static/router.html?rurl=router&router=psbc&appid=CUP14094502391&params={\"payMode\":\"B\",\"payItemNo\":\"41304508000500\",\"userNo\":"+id+"}");
          //  return R.ok("跳转邮储支付","http://wxtest.smeia.cn/h5/static/router.html?rurl=router&router=psbc&appid=CUP16522400671&params={\"payMode\":\"B\",\"payItemNo\":\"41301106100124\",\"userNo\":"+id+"}");
@@ -102,6 +105,8 @@
        }
        if(StringUtils.isBlank(outPark.getPayCode())){
            String logs = sdf.format(new Date())+" 车牌号为:"+outPark.getCarNo()+",申请缴费------》\n";
            writeTxt(logs);
            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 {
@@ -117,15 +122,17 @@
    @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);
                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,8 +255,11 @@
    //插入停车订单记录
    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);
        outParkService.updateById(outPark);
        Park park = parkService.getById(outPark.getParkId());
        OrderRecord orderRecord = new OrderRecord();
        orderRecord.setAddress(park.getName());
@@ -261,14 +271,17 @@
        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());
        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);
    }
    //插入执法订单记录