系统首页-统计停车车收费收费数据展示
实现代码:对菜单控制代码
@Autowired private MenuService menuService; @Autowired private RoleMenuService roleMenuService; @GetMapping("/list") public Result list(){ List<MenuRoleVO> menuRoleList = this.menuService.getMenuRoleList(); return Result.ok().put("data", menuRoleList); } //添加菜单 @PostMapping("/add") public Result add(@RequestBody Menu menu){ boolean save = this.menuService.save(menu); if(!save) {return Result.error("添加菜单失败");} return Result.ok(); } @GetMapping("/info/{id}") public Result info(@PathVariable("id") Integer id){ Menu menu = this.menuService.getById(id); return Result.ok().put("data", menu); } //编辑菜单 @PutMapping("/edit") public Result edit(@RequestBody Menu menu){ boolean updateById = this.menuService.updateById(menu); if(!updateById){ return Result.error("编辑菜单失败");} return Result.ok(); } //删除菜单 @DeleteMapping("/del/{id}") public Result del(@PathVariable("id") Integer id){ boolean remove = this.menuService.removeById(id); QueryWrapper<Menu> queryWrapper1 = new QueryWrapper<>(); queryWrapper1.eq("parent_id", id); this.menuService.remove(queryWrapper1); QueryWrapper<RoleMenu> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("menu_id", id); this.roleMenuService.remove(queryWrapper); if(remove) {return Result.ok();} return Result.error("删除菜单失败"); }
对停车场物业及车场使用公司管理实现代码:
@Autowired private ParkService parkService; @Autowired private PropertyService propertyService; @GetMapping("/list") public Result list(ParkListForm parkListForm){ Map<String,Object> map = new HashMap<>(); map.put("propertyList", this.propertyService.list()); map.put("pageList",this.parkService.parkList(parkListForm)); return Result.ok().put("data", map); } @GetMapping("/info/{id}") public Result info(@PathVariable("id") Integer id){ if(id == 0) { Map<String, List> map = new HashMap<>(); map.put("propertyList", this.propertyService.list()); return Result.ok().put("data",map); } else { Map<String,Object> map = new HashMap<>(); map.put("park", this.parkService.getById(id)); map.put("propertyList", this.propertyService.list()); return Result.ok().put("data", map); } } //添加停车场 @PostMapping("/add") public Result add(@RequestBody Park park){ boolean save = this.parkService.save(park); if(!save) {return Result.error("停车场添加失败");} return Result.ok(); } //编辑停车场 @PutMapping("/edit") public Result edit(@RequestBody Park park){ boolean updateById = this.parkService.updateById(park); if(!updateById) {return Result.error("停车场修改失败");} return Result.ok(); } //删除停车场 @DeleteMapping("/del") public Result del(@RequestBody Integer[] ids){ boolean removeByIds = this.parkService.removeByIds(Arrays.asList(ids)); if(!removeByIds){ return Result.error("停车场删除失败");} return Result.ok(); } @GetMapping("/getParkMap") public Result getParkMap(){ List<Park> list = this.parkService.list(); if(list == null) {return Result.error("没有停车场数据");} return Result.ok().put("data", list); }
车牌自动识别调用算法接口及实现代码:
@Autowired private InOutRecordService inOutRecordService; @Value("${upload.numberUrl}") private String numberUrl; @Value("${upload.urlPrefix}") private String urlPrefix; @Autowired(required = false) private InOutRecordMapper inOutRecordMapper; @Autowired private ParkService parkService; @Autowired private PayRecordService payRecordService; @Autowired(required = false) private CarMapper carMapper; @Autowired(required = false) private PayRecordMapper payRecordMapper; @GetMapping("/chart") public Result chart(){ List<ChartDBVO> chartList = this.payRecordMapper.chart(); ChartVO chartVO=new ChartVO(); List<String> names=new ArrayList<>(); List<Integer> nums=new ArrayList<>(); for (ChartDBVO chartDBVO : chartList) { names.add(chartDBVO.getName()); nums.add(chartDBVO.getNum()); } chartVO.setNames(names); chartVO.setNums(nums); return Result.ok().put("data",chartVO); } @GetMapping("/parkList") public Result parkList(){ List<Park> list = this.parkService.list(); if(list == null) {return Result.error("没有停车场数据");} return Result.ok().put("data", list); } //车牌识别 @PostMapping("/add") public Result add(@RequestBody InOutParkForm inOutParkForm){ String fileBase64 = inOutParkForm.getFileBase64(); // //调用腾讯AI接口 // String number = ParkApi.getNumber(inOutParkForm.getFileBase64()); //模拟车牌识别 String faceBase = fileBase64.substring(0, 60); String number = ParkUtil.getNumber(faceBase); System.out.println(number); if(number == null){ return Result.ok().put("status", "fail").put("data", "车牌识别失败"); } //入场出场 InOutRecord inOutRecord = new InOutRecord(); inOutRecord.setParkId(inOutParkForm.getParkId()); inOutRecord.setNumber(number); try { //保存图片 String newFileName = UUID.randomUUID()+"." + inOutParkForm.getExtName(); String fileName = numberUrl + newFileName; Base64Util.decoderBase64File(fileBase64,fileName); String basePath = urlPrefix + "park/upload/number/" + newFileName; //查找系统中是否有该车辆的出入场信息 InOutRecord inOutRecord1 = this.inOutRecordMapper.getInOutRecord(inOutRecord); Park park = this.parkService.getById(inOutRecord.getParkId()); Car car=null; Integer payType=1; if(inOutRecord1 == null) { //进入停车场 inOutRecord.setInPic(basePath); this.inOutRecordService.save(inOutRecord); return Result.ok().put("status", "success").put("data", "【"+ number + "】进入"+"【"+ park.getParkName() +"】"); } else { //离开停车场 inOutRecord1.setOutPic(basePath); this.inOutRecordService.updateById(inOutRecord1); String carType = ""; //计算停车费 Map<String, Integer> map = ParkUtil.parkPay(inOutRecord1.getInTime(), inOutRecord1.getOutTime(), park.getFreeDuration(), park.getChargePrice(), park.getMaxCharge()); Integer hour = 0; Integer amount = 0; if(map != null){ hour = map.get("hour"); amount = map.get("amount"); } //判断是否是包月车 car=this.carMapper.getByNumber(number); if (car != null){ payType=2; } inOutRecord.setPayType(payType); String result = ""; if(car == null){ //临时车 carType = "临时车"; result = "【临时车】"+ number +"离开"+"【"+ park.getParkName() +"】停车"+hour+"小时,缴费"+amount+"元"; } else { //包月车 carType = "包月车"; Date effectTime = car.getEffectTime(); //判断是否过期 if(effectTime != null && effectTime.after(new Date())){ result = "【包月车】"+ number +"离开"+"【"+ park.getParkName() +"】停车"+hour+"小时,无需缴费"; } else { result = "【包月车】"+ number +"离开"+"【"+ park.getParkName() +"】停车"+hour+"小时,缴费"+amount+"元"; } } //存储缴费记录 PayRecord payRecord = new PayRecord(); payRecord.setPropertyId(park.getPropertyId()); payRecord.setParkId(park.getParkId()); payRecord.setNumber(number); payRecord.setPayType(payType); payRecord.setAmount(amount); this.payRecordService.save(payRecord); // //更新停车场数据 inOutRecord1.setPayType(payType); this.inOutRecordService.updateById(inOutRecord1); return Result.ok().put("status", "success").put("data", result); } } catch (Exception e) { e.printStackTrace(); } return Result.error("车牌识别失败"); } @GetMapping("/list") public Result list(InOutQueryForm inOutQueryForm){ PageVO pageVO = this.inOutRecordService.inOutRecordList(inOutQueryForm); Map map = new HashMap(); map.put("pageList",pageVO); System.out.println(map); return Result.ok().put("data", map); }