kongdeqiang
2023-03-31 329f524e2c112978aecfc05c6c2608f1b7559d53
src/main/java/com/boying/controller/phone/YCPayController.java
@@ -32,6 +32,7 @@
@RequiredArgsConstructor
public class YCPayController {
    private final OutParkService outParkService;
    private final ParkService parkService;
    private final OrderRecordService orderRecordService;
    private final TicketService ticketService;
    private final TicketBlackService ticketBlackService;
@@ -76,25 +77,30 @@
                updateOutPark(outPark.getId(),"03");
                return R.failed("本次停车无需支付费用!");
            }else{
                if(w.getParkId()!=null){
                    if(w.getEndTime()!=null){
                        if(w.getParkId().equals(outPark.getParkId())&&System.currentTimeMillis()<w.getEndTime().getTime()){
                            updateOutPark(outPark.getId(),"03");
                            return R.failed("本次停车无需支付费用!");
                if(StringUtils.isNotBlank(w.getParkIds())){
                    if(w.getParkIds().contains(outPark.getParkId()+"")){
                        if(w.getEndTime()!=null){
                            if(System.currentTimeMillis()<w.getEndTime().getTime()){
                                updateOutPark(outPark.getId(),"03");
                                return R.failed("本次停车无需支付费用!");
                            }
                        }
                    }
                }
            }
        }
        if(outPark.getStatus() == 0){
//            return R.ok("跳转邮储支付", "https://hbfs.govpay.ccb.com/online/fssm?fee=130000000001&PyfScnCgycd=01&pyfTpcd=3&BNo="+outPark.getPayCode());
           // return R.ok("跳转邮储支付", "http://wxtest.smeia.cn/h5/?appid=CUP11234601101&params={\"payMode\":\"B\",\"payItemNo\":\"41301106100124\",\"userNo\":"+id+"}");
        if(StringUtils.isNotBlank(outPark.getPayCode()) && outPark.getStatus() == 0){
            return R.ok("跳转邮储支付", "http://wxtest.smeia.cn/h5/static/router.html?rurl=router&router=psbc&appid=CUP16522400671&params={\"payMode\":\"B\",\"payItemNo\":\"41301106100124\",\"userNo\":"+id+"}");
        }else if(outPark.getStatus() == 1){
        }else if(StringUtils.isNotBlank(outPark.getPayCode()) && outPark.getStatus() == 1){
            return R.failed("已缴费");
        }
        if(StringUtils.isBlank(outPark.getPayCode())){
            addOrderRecord(outPark);
            return R.ok("跳转邮储支付", "http://wxtest.smeia.cn/h5/static/router.html?rurl=router&router=psbc&appid=CUP16522400671&params={\"payMode\":\"B\",\"payItemNo\":\"41301106100124\",\"userNo\":"+id+"}");
        }else {
            return R.failed("系统异常");
            return R.failed("出错");
        }
    }
@@ -230,6 +236,39 @@
        }
    }
    //插入停车订单记录
    public void addOrderRecord(OutPark outPark){
        outPark.setPayCode(outPark.getId()+"");
        outParkService.saveOrUpdate(outPark);
        Park park = parkService.getById(outPark.getParkId());
        OrderRecord orderRecord = new OrderRecord();
        orderRecord.setAddress(park.getName());
        orderRecord.setCarNo(outPark.getCarNo());
        orderRecord.setCode(outPark.getCode());
        orderRecord.setCode2(outPark.getCode2());
        orderRecord.setMoney(outPark.getPrice());
        orderRecord.setQueryId(outPark.getId());
        orderRecord.setType(1);
        orderRecord.setTicketStatus(0);
        orderRecord.setPayCode(outPark.getPayCode());
        orderRecordService.saveOrUpdate(orderRecord);
    }
    //插入执法订单记录
    public void addOrderRecord2(Ticket ticket){
        OrderRecord orderRecord = new OrderRecord();
        orderRecord.setAddress(ticket.getAddress());
        orderRecord.setCarNo(ticket.getCarNo());
        orderRecord.setCode(ticket.getCode());
        orderRecord.setMoney(ticket.getMoney());
        orderRecord.setQueryId(ticket.getId());
        orderRecord.setType(0);
        orderRecord.setPayCode(ticket.getPayCode());
        orderRecordService.saveOrUpdate(orderRecord);
    }
    private void writeTxt( String txt)
    {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");