kongdeqiang
2024-03-18 ffa5f49a2bcb6311486d00777b3629538eb3e6f0
src/main/java/com/boying/controller/phone/YCPayController.java
@@ -14,9 +14,11 @@
import com.boying.service.*;
import com.boying.util.DateUtilOther;
import com.boying.util.HTTPEntityUtil;
import com.boying.util.RedisJsonUtil;
import com.google.gson.Gson;
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.*;
@@ -36,6 +38,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
 * @author kdq
@@ -59,6 +62,9 @@
    private final WhiteListService whiteListService;
    private final EnterParkService enterParkService;
    private final WXService wxService;
    private final OutParkLogService outParkLogService;
    private final RedisJsonUtil redisJsonUtil;
    /**
     * 查询订单接口
@@ -187,6 +193,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 +213,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);
                    }
                }
            }
@@ -452,6 +464,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){
@@ -666,10 +681,16 @@
    //更新出场
    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);
                //缓存在redis里
                try {
                    redisJsonUtil.set("outPark-"+outPark.getBarrierId(), outPark);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }