| | |
| | | |
| | | 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; |
| | |
| | | import com.boying.entity.*; |
| | | 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 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; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | |
| | | /** |
| | | * @author kdq |
| | |
| | | @RestController |
| | | @RequestMapping("/ffzf/api") |
| | | @RequiredArgsConstructor |
| | | @Tag(description = "ffzf/api" , name = "邮储/邢台银行 对接支付接口" ) |
| | | public class YCPayController { |
| | | private final OutParkService outParkService; |
| | | private final PayLogService payLogService; |
| | |
| | | private final EnterParkService enterParkService; |
| | | private final WXService wxService; |
| | | private final OutParkLogService outParkLogService; |
| | | private final RedisJsonUtil redisJsonUtil; |
| | | private final StringRedisTemplate redisTemplate; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getByQueryId") |
| | | @Operation(summary = "根据出场id获取出场数据" , description = "根据出场id获取出场数据" ) |
| | | public Object getByQueryId(Long queryId){ |
| | | if(queryId == null){ |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断支付端是否已经支付过 |
| | | * @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); |
| | |
| | | updateOutPark(outPark.getId(),"03"); |
| | | return R.failed("本次停车无需支付费用"); |
| | | } |
| | | |
| | | //判断是否在白名单 |
| | | QueryWrapper<WhiteList> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | * 阿里缴费 |
| | | */ |
| | | @PostMapping("payByAli") |
| | | @Operation(summary = "邢台银行支付宝缴费" , description = "邢台银行支付宝缴费" ) |
| | | public Object payByAli(Long id){ |
| | | OutPark outPark = outParkService.getById(id); |
| | | String xtyhpay = systemConfigProperties.getXTYHPAY(); |
| | |
| | | * 获取微信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); |
| | |
| | | * 微信缴费 |
| | | */ |
| | | @PostMapping("payByWX") |
| | | @Operation(summary = "邢台银行微信支付" , description = "邢台银行微信支付" ) |
| | | public Object payByWX(Long id,String openId){ |
| | | System.out.println("开始支付"); |
| | | OutPark outPark = outParkService.getById(id); |
| | |
| | | * @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"); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/getResult") |
| | | @Operation(summary = "邢台银行支付回调接口" , description = "邢台银行支付回调接口" ) |
| | | public Object getResult(HttpServletRequest request){ |
| | | System.out.println("getResult收到访问"); |
| | | String respCode = request.getParameter("respCode"); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping ("/checkbill") |
| | | @Operation(summary = "邮储对账接口" , description = "邮储对账接口" ) |
| | | public Object checkbill(@RequestBody Map params){ |
| | | String checkDate = (String) params.get("checkDate"); |
| | | String tranDate = (String) params.get("tranDate"); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping ("/checkbillXTYH") |
| | | @Operation(summary = "邢台银行对账接口" , description = "邢台银行对账接口" ) |
| | | public Object checkbillXTYH(String date){ |
| | | String xtyhpay = systemConfigProperties.getXTYHPAY(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping ("/searchPayStatus") |
| | | @Operation(summary = "交易状态查询" , description = "交易状态查询" ) |
| | | public Object searchPayStatus(String txnOrderId,String txnOrderTime){ |
| | | OutPark outPark = outParkService.findByOrderId(txnOrderId); |
| | | if(outPark == null){ |
| | |
| | | outPark.setStatus(1); |
| | | outParkService.saveOrUpdate(outPark); |
| | | //缓存在redis里 |
| | | try { |
| | | redisJsonUtil.set("outPark-"+outPark.getBarrierId(), outPark); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String jsonValue = JSON.toJSONString(outPark); |
| | | redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue); |
| | | } |
| | | } |
| | | } |