| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.boying.entity.OutPark; |
| | | import com.boying.entity.Park; |
| | | import com.boying.entity.Statistic; |
| | | import com.boying.mapper.OutParkMapper; |
| | | import com.boying.mapper.StatisticMapper; |
| | | import com.boying.service.OutParkService; |
| | | import com.boying.service.StatisticService; |
| | | import com.boying.util.RedisJsonUtil; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @AllArgsConstructor |
| | | public class OutParkServiceImpl extends ServiceImpl<OutParkMapper, OutPark> implements OutParkService { |
| | | private final OutParkMapper outParkMapper; |
| | | private final RedisJsonUtil redisJsonUtil; |
| | | |
| | | @Override |
| | | public int count1() { |
| | |
| | | |
| | | @Override |
| | | public OutPark count4(Integer bId) { |
| | | QueryWrapper<OutPark> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(OutPark::getBarrierId,bId) |
| | | .eq(OutPark::getStatus,1) |
| | | .eq(OutPark::getStatus2,0) |
| | | .orderByDesc(OutPark::getCreateTime); |
| | | List<OutPark> outParks = outParkMapper.selectList(wrapper); |
| | | if(outParks.size()>0){ |
| | | return outParks.get(0); |
| | | }else{ |
| | | return null; |
| | | OutPark outPark = null; |
| | | try { |
| | | outPark = redisJsonUtil.get("outPark-"+bId, OutPark.class); |
| | | if(outPark != null){ |
| | | return outPark; |
| | | }else { |
| | | QueryWrapper<OutPark> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(OutPark::getBarrierId,bId) |
| | | .eq(OutPark::getStatus,1) |
| | | .eq(OutPark::getStatus2,0) |
| | | .orderByDesc(OutPark::getCreateTime); |
| | | List<OutPark> outParks = outParkMapper.selectList(wrapper); |
| | | if(outParks.size()>0){ |
| | | redisJsonUtil.set("outPark-"+bId, outParks.get(0)); |
| | | return outParks.get(0); |
| | | }else{ |
| | | return null; |
| | | } |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |