| | |
| | | if(park != null){ |
| | | num = park.getNum(); |
| | | if(s !=null){ |
| | | if(Integer.parseInt(s) > num){ |
| | | return "null"; |
| | | if(Integer.parseInt(s) >= num){ |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"false",30, TimeUnit.DAYS); |
| | | return "false"; |
| | | } |
| | | }else { |
| | | s= "0"; |
| | | redisTemplate.opsForValue().set("car_park_" + parkId,s,30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS); |
| | | } |
| | | } |
| | | enterParkService.deleteByCarNo(carNo,parkId); |
| | |
| | | int i = Integer.parseInt(s); |
| | | i++; |
| | | redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS); |
| | | |
| | | Barrier barrier = (Barrier) barrierService.findById(barrierId); |
| | | barrier.setType2(1); |
| | |
| | | } |
| | | String redis = redisTemplate.opsForValue().get("car_park_" + parkId); |
| | | long l = outPark.getCreateTime().getTime() - enterPark.getCreateTime().getTime(); |
| | | s+= "场内时长为:"+l+"毫秒,合计为: "+l/(1000*60)+"秒\n"; |
| | | s+= "场内时长为:"+l+"毫秒,合计为: "+l/(1000*60)+"分\n"; |
| | | outPark.setTime(l/(1000*60)); |
| | | double money = 0; |
| | | try { |
| | |
| | | i--; |
| | | if(i<0){ |
| | | redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS); |
| | | }else { |
| | | redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS); |
| | | } |
| | | |
| | | Barrier barrier = (Barrier) barrierService.findById(barrierId); |
| | |
| | | |
| | | @PostMapping("/status") |
| | | public void heart(String serialno,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { |
| | | |
| | | Barrier barrier = barrierService.findByCode(serialno); |
| | | |
| | | Park park = (Park)parkService.findById(barrier.getParkId()); |
| | | String redis = redisTemplate.opsForValue().get("park_up_" + park.getId()); |
| | | if(StringUtil.isNullOrEmpty(redis) || redis.equals("false")){ |
| | | return; |
| | | } |
| | | if(barrier!=null){ |
| | | if(barrier.getType2()==1){ |
| | | open(request,response); |
| | |
| | | @PostMapping("/PlateServlet") |
| | | protected void info(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| | | String s= ""; |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8")); |
| | | String str = ""; |
| | | String lineStr = ""; |
| | |
| | | if(park != null){ |
| | | num = park.getNum(); |
| | | if(s !=null){ |
| | | if(Integer.parseInt(s) > num){ |
| | | if(Integer.parseInt(s) >= num){ |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"false",30, TimeUnit.DAYS); |
| | | return; |
| | | } |
| | | }else { |
| | | s= "0"; |
| | | redisTemplate.opsForValue().set("car_park_" + parkId,s,30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS); |
| | | } |
| | | } |
| | | enterParkService.deleteByCarNo(carNo,parkId); |
| | |
| | | EnterPark enterPark = enterParkService.findByCarNo(carNo).get(0); |
| | | |
| | | if(enterPark==null){ |
| | | String s1 = "未发现入场车辆:"+carNo; |
| | | System.out.println(carNo+"未发现场内车辆"); |
| | | }else{ |
| | | outPark.setEnterTime(enterPark.getCreateTime()); |
| | | } |
| | |
| | | i--; |
| | | if(i<0){ |
| | | redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS); |
| | | }else { |
| | | redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS); |
| | | } |
| | | |
| | | Barrier barrier = (Barrier) barrierService.findById(barrierId); |
| | |
| | | @PostMapping("result") |
| | | public String result(HttpServletRequest request,String payKey,String payerTypeCode,String payerNum,String payCode,Double amt,String status,String errorInfo,String sign,String signType) throws Exception{ |
| | | System.out.println(payCode+"-------"+status); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH_mm_ss"); |
| | | String s = "payCode===="+payCode+",\n"; |
| | | try { |
| | | s += "开始走回调接口------>"; |
| | | s += sdf.format(new Date())+"开始走回调接口------>\n"; |
| | | writeTxt(s); |
| | | updateOrderRecord(payCode,status); |
| | | }catch (Exception e){ |
| | |
| | | |
| | | //更新订单记录 |
| | | public void updateOrderRecord(String payCode,String status){ |
| | | String s = "更新订单记录:payCode===="+payCode+",status==="+status+",\n"; |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH_mm_ss"); |
| | | String s = sdf.format(new Date())+"更新订单记录:payCode===="+payCode+",status==="+status+",\n"; |
| | | Specification<OrderRecord> specification = new Specification<OrderRecord>() { |
| | | @Override |
| | | public Predicate toPredicate(Root<OrderRecord> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { |
| | |
| | | list.add(cb.equal(root.get("payCode").as(String.class), payCode)); |
| | | Predicate[] arr = new Predicate[list.size()]; |
| | | cq.where(list.toArray(arr)); |
| | | cq.orderBy(cb.desc(root.get("createTime"))); |
| | | return null; |
| | | } |
| | | }; |
| | | List<OrderRecord> all = orderRecordService.findAll(specification); |
| | | s += "查询到订单记录为:"+all.size()+"条,\n"; |
| | | if(all.size()==1){ |
| | | if(all.size()>=1){ |
| | | OrderRecord orderRecord = all.get(0); |
| | | s += "查询到订单为:"+orderRecord.getId()+",\n"; |
| | | if(status.equals("01")){ |
| | |
| | | // } |
| | | |
| | | public void updateOutPark(Long outParkId,String status){ |
| | | String s = "开始修改出场表-----》,\n"; |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH_mm_ss"); |
| | | String s = sdf.format(new Date())+"开始修改出场表-----》\n"; |
| | | s+= "outparkId==="+outParkId+",status==="+status+",\n"; |
| | | writeTxt(s); |
| | | OutPark outPark = (OutPark) outParkService.findById(outParkId); |
| | | if(outPark!=null){ |
| | | s += "找到出场数据:"+outPark.getId()+",\n"; |
| | |
| | | outPark.setStatus(1); |
| | | outParkService.save(outPark); |
| | | } |
| | | }else { |
| | | s += "未找到出场数据-----》"; |
| | | writeTxt(s); |
| | | } |
| | | s += "未找到出场数据-----》"; |
| | | writeTxt(s); |
| | | |
| | | } |
| | | |
| | | //删除进停车场的数据 |
| | |
| | | //生成电子缴款码 |
| | | @PostMapping("park") |
| | | public Object park(Long id){ |
| | | String logs = "开始缴费流程------》"; |
| | | logs += "出场id为:"+id+",\n"; |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); |
| | | String logs = sdf.format(new Date())+"开始扫码缴费------》\n"; |
| | | logs += "出场表id为:"+id+",\n"; |
| | | OutPark outPark = (OutPark) outParkService.findById(id); |
| | | if(outPark.getPrice()==0){ |
| | | updateOutPark(outPark.getId(),"03"); |
| | |
| | | s.append("&payKey=df937eda27cb4a59a12347966678e232");//财政给的 |
| | | s.append("&payerName="+outPark.getCarNo()); |
| | | s.append("&payerNum="+ outPark.getCode());//订单号 |
| | | s.append("&payerTypeCode=1304062100000001");////财政给的 |
| | | //s.append("&payerTypeCode=1304062100000001");////财政给的 |
| | | s.append("&payerTypeCode=072101");////财政给的 |
| | | s.append("&reserve1="); |
| | | s.append("&reserve2="); |
| | | s.append("&reserve3="); |
| | |
| | | //插入停车订单记录 |
| | | public void addOrderRecord(OutPark outPark){ |
| | | Park park = (Park) parkService.findById(outPark.getParkId()); |
| | | |
| | | OrderRecord orderRecord = new OrderRecord(); |
| | | orderRecord.setAddress(park.getName()); |
| | | orderRecord.setCarNo(outPark.getCarNo()); |
| | |
| | | time = Long.valueOf(l / 30).intValue(); |
| | | } |
| | | if(maxCost!=null){ |
| | | if(time*cost>maxCost){//大于封顶价格 |
| | | if(time*cost+1>maxCost){//大于封顶价格 |
| | | return maxCost; |
| | | } |
| | | } |
| | | return time*cost; |
| | | return time*cost+1; |
| | | } |
| | | |
| | | public static void main(String[] args) { |