src/main/java/com/boying/controller/OutParkController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/boying/controller/ParkController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/boying/controller/car/PlateServlet3.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/boying/service/impl/BarrierServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/boying/controller/OutParkController.java
@@ -32,7 +32,7 @@ import java.util.concurrent.TimeUnit; @RestController @RequestMapping("outPark") @RequestMapping("ffzf/outpark") @RequiredArgsConstructor public class OutParkController { @@ -59,7 +59,7 @@ } //道闸code @PostMapping("findByBarrierCode") @PostMapping("/findByBarrierCode") public Object findById(String code) { QueryWrapper<Barrier> wrapper = new QueryWrapper<>(); wrapper.lambda() @@ -197,45 +197,39 @@ return R.ok(outPark); } @GetMapping("/statisticParkOrder") public Object statisticParkOrder(Integer userId) { User byId = userService.getById(userId); @GetMapping("/statisticParkOrder/count") public R statisticParkOrder(String parkIds) { Map<String,Object> resultMap = new HashMap<>(); if(byId != null){ String parkIds = byId.getParkIds(); if(parkIds != null){ String[] split = parkIds.split(","); int[] array = Arrays.stream(split).mapToInt(Integer::parseInt).toArray(); List<Integer> parkIdList = new ArrayList<>(); for (int i : array) { parkIdList.add(i); } QueryWrapper<OutPark> wrapper = new QueryWrapper<>(); wrapper.lambda() .between(OutPark::getCreateTime, DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date())) .eq(OutPark::getStatus,1) .in(OutPark::getParkId,parkIdList); wrapper.select("IFNULL(ROUND(SUM(price)),0) as num"); Map<String, Object> map = outParkService.getMap(wrapper); String a = map.get("num").toString(); if(a != null){ resultMap.put("money",Double.parseDouble(a)); }else { resultMap.put("money",0.0); } wrapper.clear(); wrapper.lambda() .between(OutPark::getCreateTime, DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date())) .eq(OutPark::getStatus,1) .in(OutPark::getParkId,parkIdList); int count = outParkService.count(wrapper); resultMap.put("count",count); return R.ok(resultMap); }else { return R.failed(null,"该用户未管理停车场"); if(parkIds != null){ String[] split = parkIds.split(","); long[] array = Arrays.stream(split).mapToLong(Long::parseLong).toArray(); List<Long> parkIdList = new ArrayList<>(); for (long i : array) { parkIdList.add(i); } QueryWrapper<OutPark> wrapper = new QueryWrapper<>(); wrapper.lambda() .between(OutPark::getCreateTime, DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date())) .eq(OutPark::getStatus,1) .in(OutPark::getParkId,parkIdList); wrapper.select("IFNULL(ROUND(SUM(price)),0) as num"); Map<String, Object> map = outParkService.getMap(wrapper); String a = map.get("num").toString(); if(a != null){ resultMap.put("money",Double.parseDouble(a)); }else { resultMap.put("money",0.0); } wrapper.clear(); wrapper.lambda() .between(OutPark::getCreateTime, DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date())) .eq(OutPark::getStatus,1) .in(OutPark::getParkId,parkIdList); long count = outParkService.count(wrapper); resultMap.put("count",count); return R.ok(resultMap); }else { return R.failed(null,"未查询到该用户"); return R.failed(null,"该用户未管理停车场"); } } @@ -243,9 +237,9 @@ public Object isJS(String carNo ,Integer parkId) { List<EnterPark> byCarNo = enterParkService.findByCarNo(carNo, parkId); if(byCarNo.size() > 0){ return R.ok(byCarNo.get(0)); return R.ok(byCarNo.get(0),"true"); }else { return R.failed(); return R.ok(null,"false"); } } src/main/java/com/boying/controller/ParkController.java
@@ -94,26 +94,21 @@ } @PostMapping("/getByUserId") public Object getByUserId(Long userId) { User byId = userService.getById(userId); public Object getByUserId(String parkIds) { List<Park> list = new ArrayList<>(); if(byId == null){ return R.failed("未查询到用户"); }else { String parkIds = byId.getParkIds(); if(StringUtils.isBlank(parkIds)){ return R.failed("该用户未管理停车场"); } List<Long> ids= Arrays.stream(parkIds.split(",")).map(s->Long.parseLong(s.trim())).collect(Collectors.toList()); for (Long id : ids) { Park byId1 = parkService.getById(id); String num = redisTemplate.opsForValue().get("car_park_" + byId1.getId()); byId1.setCarNum(Integer.parseInt(num)); list.add(byId1); } return R.ok(list); if(StringUtils.isBlank(parkIds)){ return R.failed("该用户未管理停车场"); } List<Long> ids= Arrays.stream(parkIds.split(",")).map(s->Long.parseLong(s.trim())).collect(Collectors.toList()); for (Long id : ids) { Park byId1 = parkService.getById(id); String num = redisTemplate.opsForValue().get("car_park_" + byId1.getId()); byId1.setCarNum(Integer.parseInt(num)); list.add(byId1); } return R.ok(list); } @PostMapping("/getById") public Object getById(Long parkId) { Park byId = parkService.getById(parkId); @@ -121,6 +116,10 @@ return R.failed("未查询到该停车场"); }else { String s = redisTemplate.opsForValue().get("car_park_" + parkId); if(StringUtils.isBlank(s)){ redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS); s = "0"; } byId.setCarNum(Integer.parseInt(s)); return R.ok(byId,"查询成功"); } src/main/java/com/boying/controller/car/PlateServlet3.java
@@ -41,7 +41,7 @@ * Servlet implementation class PlateServlet */ @Controller @RequestMapping("/car") @RequestMapping("/ffzf/car") @RequiredArgsConstructor public class PlateServlet3 extends HttpServlet { private static final long serialVersionUID = 1L; src/main/java/com/boying/service/impl/BarrierServiceImpl.java
@@ -58,19 +58,24 @@ .orderByDesc(EnterPark::getId) .last(" limit 1"); EnterPark enterPark = enterParkMapper.selectOne(wrapper); long dif = DateUtil.between(Date.from( enterPark.getCreateTime().atZone( ZoneId.systemDefault()).toInstant()), new Date(), DateUnit.SECOND, false); if(dif >= 5 && dif <= 7){ return true; }else { //判断停车场是否有了车位 String s = redisTemplate.opsForValue().get("park_change_in_" + enterPark.getParkId()); if("true".equals(s)){ redisTemplate.opsForValue().set("park_change_in_"+enterPark.getParkId(),"false",1, TimeUnit.DAYS); if(enterPark != null){ long dif = DateUtil.between(Date.from( enterPark.getCreateTime().atZone( ZoneId.systemDefault()).toInstant()), new Date(), DateUnit.SECOND, false); if(dif >= 5 && dif <= 7){ return true; }else { return false; //判断停车场是否有了车位 String s = redisTemplate.opsForValue().get("park_change_in_" + enterPark.getParkId()); if("true".equals(s)){ redisTemplate.opsForValue().set("park_change_in_"+enterPark.getParkId(),"false",1, TimeUnit.DAYS); return true; }else { return false; } } }else { return false; } } @@ -82,9 +87,13 @@ .orderByDesc(OutPark::getId) .last(" limit 1"); OutPark outPark = outParkMapper.selectOne(wrapper); long dif = DateUtil.between(Date.from( outPark.getCreateTime().atZone( ZoneId.systemDefault()).toInstant()), new Date(), DateUnit.SECOND, false); if(dif >= 20 && dif <= 23){ return true; if(outPark != null){ long dif = DateUtil.between(Date.from( outPark.getCreateTime().atZone( ZoneId.systemDefault()).toInstant()), new Date(), DateUnit.SECOND, false); if(dif >= 20 && dif <= 23){ return true; }else { return false; } }else { return false; }