| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.HomeCtlGroupDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.LockCtlLogMapper; |
| | | import com.whyc.mapper.LockInfMapper; |
| | | import com.whyc.pojo.db_area.AreaUser; |
| | | import com.whyc.pojo.db_area.LockInf; |
| | | import com.whyc.pojo.db_lock_ram.LockCtlLog; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class LockCtlLogService { |
| | | @Autowired(required = false) |
| | | private LockCtlLogMapper mapper; |
| | | //查询最近的开锁日志 |
| | | public Response getLockLog(Integer lockId) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("lock_id",lockId); |
| | | wrapper.orderByDesc("ctl_time"); |
| | | wrapper.last("limit 20"); |
| | | List<LockInf> list=mapper.selectList(wrapper); |
| | | return new Response().setII(1,list!=null,list,"查询最近的开锁日志"); |
| | | |
| | | //获取开锁错误的日志 |
| | | public List getAllErrorLog(List lockIds) { |
| | | List<LockCtlLog> list=mapper.getAllErrorLog(lockIds); |
| | | return list; |
| | | } |
| | | |
| | | //获取开锁日志 |
| | | public List getAllLog(List lockIds) { |
| | | List<LockCtlLog> list=mapper.getAllLog(lockIds); |
| | | return list; |
| | | } |
| | | //添加操作记录 |
| | | public void setLogByUid(Integer lockId, int result, String uname) { |
| | | LockCtlLog log=new LockCtlLog(); |
| | | log.setLockId(lockId); |
| | | log.setCtlType(7);//蓝牙开锁 |
| | | log.setCtlResult(result); |
| | | log.setCtlTime(new Date()); |
| | | log.setCtlIdCard(0); |
| | | log.setCtlUname(uname); |
| | | mapper.insert(log); |
| | | } |
| | | } |