| | |
| | | |
| | | 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.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.*; |
| | | |
| | | 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; |
| | | |
| | | |
| | | /** |
| | | * @author kdq |
| | |
| | | private final WhiteListService whiteListService; |
| | | private final EnterParkService enterParkService; |
| | | private final WXService wxService; |
| | | private final OutParkLogService outParkLogService; |
| | | private final StringRedisTemplate redisTemplate; |
| | | |
| | | |
| | | /** |
| | | * 查询订单接口 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断支付端是否已经支付过 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("parkJudg") |
| | | 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,"请提交支付"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断是否缴费 |
| | |
| | | updateOutPark(outPark.getId(),"03"); |
| | | return R.failed("本次停车无需支付费用"); |
| | | } |
| | | |
| | | //判断是否在白名单 |
| | | QueryWrapper<WhiteList> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | 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("已缴费"); |
| | |
| | | }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); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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){ |
| | |
| | | //更新出场 |
| | | 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里 |
| | | String jsonValue = JSON.toJSONString(outPark); |
| | | redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue); |
| | | } |
| | | } |
| | | } |