| | |
| | | package com.boying.controller; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.boying.common.R; |
| | | import com.boying.common.SystemConfigProperties; |
| | | import com.boying.entity.*; |
| | | import com.boying.service.*; |
| | | import com.boying.util.DateUtilOther; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | @RestController |
| | | @RequestMapping("ffzf/outpark") |
| | | @RequiredArgsConstructor |
| | | @Tag(description = "ffzf/outpark" , name = "出场表接口" ) |
| | | public class OutParkController { |
| | | |
| | | |
| | |
| | | private StringRedisTemplate redisTemplate; |
| | | |
| | | @PostMapping("/findPage") |
| | | @Operation(summary = "分页查询" , description = "分页查询" ) |
| | | public Object findPage(Page page, String carNo,Long parkId,String payCode,String date) throws ParseException { |
| | | List<OutPark> list = outParkService.getList(page.getCurrent(), page.getSize(), carNo,parkId,payCode, date); |
| | | System.out.println(list); |
| | |
| | | } |
| | | //getById |
| | | @PostMapping("/getById") |
| | | @Operation(summary = "根据id查询" , description = "根据id查询" ) |
| | | public Object getById(Long id) { |
| | | return R.ok(outParkService.getById(id)); |
| | | } |
| | | //道闸code |
| | | @PostMapping("/findByBarrierCode") |
| | | @Operation(summary = "根据道闸code查询出场(已废弃)" , description = "根据道闸code查询出场(已废弃)" ) |
| | | public Object findById(String code) { |
| | | if(StringUtils.isBlank(code)){ |
| | | return R.failed(null,"参数错误"); |
| | |
| | | |
| | | //道闸code |
| | | @PostMapping("/findByBarrierCode2") |
| | | @Operation(summary = "根据道闸code查询出场" , description = "根据道闸code查询出场" ) |
| | | public Object findById2(String code2) { |
| | | if(StringUtils.isBlank(code2)){ |
| | | return R.failed(null,"参数错误"); |
| | |
| | | } |
| | | |
| | | @PostMapping("/delete") |
| | | @Operation(summary = "删除出场" , description = "删除出场" ) |
| | | public Object delete(Long id) { |
| | | outParkService.removeById(id); |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PostMapping("enterPark2") |
| | | @Operation(summary = "新增入场(废弃)" , description = "新增入场(废弃)" ) |
| | | public Object enterPark(String carNo,Integer barrierId,Integer parkId,String code2) { |
| | | Barrier barrier1 = findBarrier(code2); |
| | | barrierId = barrier1.getId(); |
| | |
| | | } |
| | | |
| | | @PostMapping("outPark2") |
| | | @Operation(summary = "新增出场(废弃)" , description = "新增出场(废弃)" ) |
| | | public Object outPark(String carNo,Integer barrierId,Integer parkId,String code2) { |
| | | String s = "开始执行出场接口------>\n"; |
| | | Barrier barrier1 = findBarrier(code2); |
| | |
| | | } |
| | | |
| | | @GetMapping("/statisticParkOrder/count") |
| | | @Operation(summary = "统计用户管理的停车场订单数量" , description = "统计用户管理的停车场订单数量" ) |
| | | public R statisticParkOrder(String parkIds) { |
| | | Map<String,Object> resultMap = new HashMap<>(); |
| | | if(StringUtils.isNotBlank(parkIds)){ |
| | |
| | | } |
| | | |
| | | @GetMapping("/isJS") |
| | | @Operation(summary = "僵尸车查询" , description = "僵尸车查询" ) |
| | | public Object isJS(String carNo ,Integer parkId) { |
| | | List<EnterPark> byCarNo = enterParkService.findByCarNo(carNo, parkId); |
| | | if(byCarNo.size() > 0){ |
| | |
| | | } |
| | | |
| | | @GetMapping("/getByCarAndPark") |
| | | @Operation(summary = "根据车牌和停车场获取最新出场" , description = "根据车牌和停车场获取最新出场" ) |
| | | public Object getByCarAndPark(String carNo ,Integer parkId) { |
| | | QueryWrapper<OutPark> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | return R.failed(null,"未找到数据"); |
| | | } |
| | | } |
| | | |
| | | //扫码修改出场(模糊车牌) |
| | | @GetMapping("/getLikeCar") |
| | | public Object getLikeCar(Integer outParkId) { |
| | | OutPark byId = outParkService.getById(outParkId); |
| | | List<Map<String, Object>> likeCar = outParkService.getLikeCar(byId.getCarNo(), byId.getParkId(), byId.getCreateTime()); |
| | | if (CollectionUtils.isNotEmpty(likeCar)) { |
| | | Collections.sort(likeCar, (m1, m2)-> String.valueOf(m2.get("createTime")).compareTo(String.valueOf(m1.get("createTime")))); |
| | | } |
| | | return R.ok(likeCar); |
| | | } |
| | | |
| | | //扫码修改出场(模糊车牌) |
| | | @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); |
| | | Barrier barrier =barrierService.getById(outPark.getBarrierId()); |
| | | if(type == 0){ //入场正确,替换出场,更新出场记录 |
| | | outPark.setCarNo(enterPark.getCarNo()); |
| | | barrier.setCarNo(enterPark.getCarNo()); |
| | | barrierService.saveOrUpdate(barrier); |
| | | String jsonValue = JSON.toJSONString(barrier); |
| | | redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue); |
| | | }else { //出场正确,替换入场,更新出场记录 |
| | | enterPark.setCarNo(outPark.getCarNo()); |
| | | } |
| | |
| | | try { |
| | | long l = outPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - enterPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli(); |
| | | outPark.setTime(l/(1000*60)); |
| | | if(outPark.getTime() > 0){ |
| | | outPark.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(outPark.getTime()).longValue())); |
| | | }else { |
| | | outPark.setTimeStr("不足一分钟"); |
| | | } |
| | | money = costRuleService.getMoney(outPark.getParkId(), outPark.getEnterTime(), outPark.getCreateTime(), 1); |
| | | //入场记录保存一下 |
| | | enterPark.setPrice(money); |
| | |
| | | } |
| | | outPark.setPrice(money); |
| | | outParkService.saveOrUpdate(outPark); |
| | | outPark.setParkName(barrier.getName()); |
| | | return R.ok(outPark,"更新成功"); |
| | | } |
| | | |
| | | @GetMapping("/editEnterPark") |
| | | @Operation(summary = "修改入场信息" , description = "修改入场信息" ) |
| | | public Object editEnterPark(String carNo ,Integer parkId,String time) { |
| | | QueryWrapper<Barrier> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |