kongdeqiang
2024-04-22 86c29c1a7d83b8fca6ff26f1171dde89989af5f9
src/main/java/com/boying/controller/OutParkController.java
@@ -319,6 +319,34 @@
            return R.failed(null,"未找到数据");
        }
    }
    //扫码修改出场(模糊车牌)
    @GetMapping("/editOutPark")
    public Object editOutPark(Integer outParkId,Integer enterParkId,Integer type) {
        double money = 0.0;
        OutPark outPark = outParkService.getById(outParkId);
        EnterPark enterPark = enterParkService.getById(enterParkId);
        if(type == 0){ //入场正确,替换出场,更新出场记录
            outPark.setCarNo(enterPark.getCarNo());
        }else { //出场正确,替换入场,更新出场记录
            enterPark.setCarNo(outPark.getCarNo());
        }
        outPark.setEnterTime(enterPark.getCreateTime());
        try {
            long l = outPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - enterPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
            outPark.setTime(l/(1000*60));
            money = costRuleService.getMoney(outPark.getParkId(), outPark.getEnterTime(), outPark.getCreateTime(), 1);
            //入场记录保存一下
            enterPark.setPrice(money);
            enterPark.setIsPay(0);
            enterParkService.updateById(enterPark);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        outPark.setPrice(money);
        outParkService.saveOrUpdate(outPark);
        return R.ok(outPark,"更新成功");
    }
    @GetMapping("/editEnterPark")
    public Object editEnterPark(String carNo ,Integer parkId,String time) {
        QueryWrapper<Barrier> wrapper = new QueryWrapper<>();
@@ -332,10 +360,34 @@
        enterPark.setParkId(parkId);
        enterPark.setBarrierId(list.get(0).getId());
        enterPark.setStatus(0);
        enterPark.setIsAdd(1);
        enterPark.setIsPay(0);
        enterPark.setImgId(null);
        enterParkService.saveOrUpdate(enterPark);
        return R.ok("修改成功");
        OutPark outPark = null;
        QueryWrapper<OutPark> wrapper1 = new QueryWrapper<>();
        wrapper1.lambda()
                .eq(OutPark::getParkId,parkId)
                .eq(OutPark::getCarNo,carNo)
                .ge(OutPark::getCreateTime,enterPark.getCreateTime())
                .ne(OutPark::getStatus,1);
        List<OutPark> list1 = outParkService.list(wrapper1);
        if(list1 !=null&&list1.size()>0){
            outPark  = list1.get(0);
            outPark.setEnterTime(enterPark.getCreateTime());
            long l = outPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - enterPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
            outPark.setTime(l/(1000*60));
            try {
                outPark.setPrice(costRuleService.getMoney(parkId, outPark.getEnterTime(), outPark.getCreateTime(), 1));
            }catch (Exception e){
                e.printStackTrace();
            }
            outParkService.saveOrUpdate(outPark);
            return R.ok(null,"修改出场记录成功");
        }else {
            return R.ok(null,"新增入场记录成功");
        }
    }