kongdeqiang
2 天以前 199202813dd8ca536ed2334f5eeb6aba3ad25b21
src/main/java/com/boying/controller/phone/YCPayController.java
@@ -13,6 +13,8 @@
import com.boying.service.*;
import com.boying.util.DateUtilOther;
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.data.redis.core.StringRedisTemplate;
import org.springframework.http.ResponseEntity;
@@ -46,6 +48,7 @@
@RestController
@RequestMapping("/ffzf/api")
@RequiredArgsConstructor
@Tag(description = "ffzf/api" , name = "邮储/邢台银行 对接支付接口" )
public class YCPayController {
    private final OutParkService outParkService;
    private final PayLogService payLogService;
@@ -61,6 +64,8 @@
    private final OutParkLogService outParkLogService;
    private  final StringRedisTemplate redisTemplate;
    private final PaymentLogService paymentLogService;
    /**
     * 查询订单接口
@@ -68,21 +73,56 @@
     * @return
     */
    @GetMapping("/getByQueryId")
    @Operation(summary = "根据出场id获取出场数据" , description = "根据出场id获取出场数据" )
    public Object getByQueryId(Long queryId){
        if(queryId == null){
            return R.failed("参数为空");
        }
        OutPark byId = outParkService.getById(queryId);
        if(byId.getTime() > 0){
            byId.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(byId.getTime()).longValue()));
        PaymentLog byId1 = paymentLogService.getById(queryId);
        if(byId1 !=null && byId !=null){
            if(byId.getCreateTime().isAfter(byId1.getCreateTime())){
                //出场表时间在月票后
                if(byId.getTime() > 0){
                    byId.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(byId.getTime()).longValue()));
                }
                return R.ok(byId,"请求成功");
            }else {
                //出场表时间在月票后
                OutPark outPark = new OutPark();
                outPark.setId(byId1.getId());
                outPark.setCreateTime(LocalDateTime.now());
                outPark.setEnterTime(LocalDateTime.now());
                outPark.setTime(0.0);
                outPark.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(outPark.getTime()).longValue()));
                outPark.setPrice(byId1.getMoney());
                return R.ok(outPark,"请求成功");
            }
        }
        return R.ok(byId,"请求成功");
        if(byId == null){
            OutPark outPark = new OutPark();
            outPark.setId(byId1.getId());
            outPark.setCreateTime(LocalDateTime.now());
            outPark.setEnterTime(LocalDateTime.now());
            outPark.setTime(0.0);
            outPark.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(outPark.getTime()).longValue()));
            outPark.setPrice(byId1.getMoney());
            return R.ok(outPark,"请求成功");
        }
        if(byId1 == null){
            if(byId.getTime() > 0){
                byId.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(byId.getTime()).longValue()));
            }
            return R.ok(byId,"请求成功");
        }
        return R.failed("未查询到数据");
    }
    /**
     * 缴款书
     */
    @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);
@@ -146,11 +186,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);
@@ -162,7 +235,6 @@
            updateOutPark(outPark.getId(),"03");
            return R.failed("本次停车无需支付费用");
        }
        //判断是否在白名单
        QueryWrapper<WhiteList> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -226,6 +298,7 @@
     * 阿里缴费
     */
    @PostMapping("payByAli")
    @Operation(summary = "邢台银行支付宝缴费" , description = "邢台银行支付宝缴费" )
    public Object payByAli(Long id){
        OutPark outPark =  outParkService.getById(id);
        String xtyhpay = systemConfigProperties.getXTYHPAY();
@@ -301,6 +374,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);
@@ -312,6 +386,7 @@
     * 微信缴费
     */
    @PostMapping("payByWX")
    @Operation(summary = "邢台银行微信支付" , description = "邢台银行微信支付" )
    public Object payByWX(Long id,String openId){
        System.out.println("开始支付");
        OutPark outPark =  outParkService.getById(id);
@@ -404,6 +479,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");
@@ -438,6 +514,7 @@
     * @return
     */
    @PostMapping("/getResult")
    @Operation(summary = "邢台银行支付回调接口" , description = "邢台银行支付回调接口" )
    public Object getResult(HttpServletRequest request){
        System.out.println("getResult收到访问");
        String respCode = request.getParameter("respCode");
@@ -492,6 +569,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");
@@ -513,6 +591,7 @@
     * @return
     */
    @PostMapping ("/checkbillXTYH")
    @Operation(summary = "邢台银行对账接口" , description = "邢台银行对账接口" )
    public Object checkbillXTYH(String date){
        String xtyhpay = systemConfigProperties.getXTYHPAY();
        Map<String,Object> map = new HashMap<>();
@@ -557,6 +636,7 @@
     * @return
     */
    @PostMapping ("/searchPayStatus")
    @Operation(summary = "交易状态查询" , description = "交易状态查询" )
    public Object searchPayStatus(String txnOrderId,String txnOrderTime){
        OutPark outPark = outParkService.findByOrderId(txnOrderId);
        if(outPark == null){