| | |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.CategoryMapper; |
| | | import com.doumee.dao.business.JkCabinetGridMapper; |
| | | import com.doumee.dao.business.JkKeysMapper; |
| | | import com.doumee.dao.business.model.JkCabinetGrid; |
| | | import com.doumee.dao.business.model.JkKeys; |
| | | import com.doumee.dao.business.vo.AdminCabinetVO; |
| | | import com.doumee.dao.business.vo.CabinetConfigDataVO; |
| | | import com.doumee.dao.business.vo.CabinetDetailVO; |
| | | import com.doumee.dao.business.vo.CabinetGridInfoVO; |
| | | import com.doumee.dao.business.dao.MemberMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.vo.*; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.JkCabinetMapper; |
| | | import com.doumee.dao.business.model.JkCabinet; |
| | | import com.doumee.service.business.JkCabinetService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | private JkCabinetMapper jkCabinetMapper; |
| | | |
| | | @Autowired |
| | | private CategoryMapper categoryMapper; |
| | | |
| | | @Autowired |
| | | private JkCabinetGridMapper jkCabinetGridMapper; |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | |
| | | jkCabinet.setJwd(jkCabinet.getLongitude() + "," + jkCabinet.getLatitude()); |
| | | } |
| | | jkCabinet.setGridNum(jkCabinet.getColumnNum()*jkCabinet.getRowNum()); |
| | | if(StringUtils.isNotBlank(jkCabinet.getManagerId())){ |
| | | jkCabinet.setManagerIdList(Arrays.asList( |
| | | jkCabinet.getManagerId().split(",") |
| | | )); |
| | | } |
| | | if(StringUtils.isNotBlank(jkCabinet.getAuthMemberId())){ |
| | | jkCabinet.setAuthMemberIdList(Arrays.asList( |
| | | jkCabinet.getAuthMemberId().split(",") |
| | | )); |
| | | } |
| | | return jkCabinet; |
| | | } |
| | | |
| | |
| | | QueryWrapper<JkCabinet> wrapper = new QueryWrapper<>(jkCabinet); |
| | | return jkCabinetMapper.selectList(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageData<JkCabinet> findPage(PageWrap<JkCabinet> pageWrap) { |
| | | IPage<JkCabinet> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | |
| | | |
| | | |
| | | @Override |
| | | public CabinetDetailVO getCabinetDetail(Integer cabinetId){ |
| | | public CabinetDetailVO getCabinetDetail(Integer cabinetId,LoginUserInfo loginUserInfo){ |
| | | CabinetDetailVO cabinetDetailVO = new CabinetDetailVO(); |
| | | JkCabinet cabinet = jkCabinetMapper.selectOne(new QueryWrapper<JkCabinet>() |
| | | .lambda() |
| | | .eq(JkCabinet::getIsdeleted,Constants.ZERO) |
| | | .apply(" FIND_IN_SET("+loginUserInfo.getId()+",MANAGER_ID) ") |
| | | .eq(JkCabinet::getId,cabinetId) |
| | | .last(" limit 1") |
| | | ); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public CabinetFaceVO getCabinetFaceVO(String code){ |
| | | CabinetFaceVO cabinetFaceVO = new CabinetFaceVO(); |
| | | List<CabinetFaceInfoVO> driverFaceList = new ArrayList<>(); |
| | | List<CabinetFaceInfoVO> autoFaceList = new ArrayList<>(); |
| | | |
| | | JkCabinet jkCabinet = jkCabinetMapper.selectOne(new QueryWrapper<JkCabinet>().lambda() |
| | | .eq(JkCabinet::getCode,code) |
| | | .eq(JkCabinet::getIsdeleted,Constants.ZERO) |
| | | .last("limit 1") |
| | | ); |
| | | if(Objects.nonNull(jkCabinet)){ |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode(); |
| | | //查询司机信息 |
| | | List<JkCabinetGrid> jkCabinetGridList = jkCabinetGridMapper.selectJoinList(JkCabinetGrid.class,new MPJLambdaWrapper<JkCabinetGrid>() |
| | | .selectAll(JkCabinetGrid.class) |
| | | .selectAs(JkKeys::getCarId,JkCabinetGrid::getCarId) |
| | | .innerJoin(JkKeys.class,JkKeys::getId,JkCabinetGrid::getKeyId) |
| | | .eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) |
| | | .eq(JkKeys::getIsdeleted,Constants.ZERO) |
| | | .isNotNull(JkKeys::getCarId) |
| | | .eq(JkCabinetGrid::getCabinetId,jkCabinet.getId()) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(jkCabinetGridList)){ |
| | | List<Integer> carIdList = jkCabinetGridList.stream().map(i->i.getKeyId()).collect(Collectors.toList()); |
| | | //查询车辆所有人员信息 |
| | | List<Member> memberList = memberMapper.selectJoinList(Member.class,new MPJLambdaWrapper<Member>() |
| | | .selectAll(Member.class) |
| | | .leftJoin(CarDriver.class,CarDriver::getMemberId,Member::getId) |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .eq(CarDriver::getIsdeleted,Constants.ZERO) |
| | | .eq(CarDriver::getStatus,Constants.ZERO) |
| | | .isNotNull(Member::getFaceImg) |
| | | .in(CarDriver::getCarId,carIdList) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | Set<Member> memberSet = new HashSet<>(memberList); |
| | | for (Member member:memberSet) { |
| | | CabinetFaceInfoVO cabinetFaceInfoVO = new CabinetFaceInfoVO(); |
| | | cabinetFaceInfoVO.setMemberId(member.getId()); |
| | | cabinetFaceInfoVO.setMemberName(member.getName()); |
| | | cabinetFaceInfoVO.setFaceImg(prefixUrl + member.getFaceImg()); |
| | | driverFaceList.add(cabinetFaceInfoVO); |
| | | } |
| | | } |
| | | } |
| | | //查询设备验证人员 |
| | | List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda() |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .isNotNull(Member::getFaceImg) |
| | | .apply(" FIND_IN_SET( id ,'"+jkCabinet.getManagerId()+"') ") |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | for (Member member:memberList) { |
| | | CabinetFaceInfoVO cabinetFaceInfoVO = new CabinetFaceInfoVO(); |
| | | cabinetFaceInfoVO.setMemberId(member.getId()); |
| | | cabinetFaceInfoVO.setMemberName(member.getName()); |
| | | cabinetFaceInfoVO.setFaceImg(prefixUrl + member.getFaceImg()); |
| | | autoFaceList.add(cabinetFaceInfoVO); |
| | | } |
| | | } |
| | | |
| | | } |
| | | cabinetFaceVO.setAutoFaceList(autoFaceList); |
| | | cabinetFaceVO.setDriverFaceList(driverFaceList); |
| | | return cabinetFaceVO; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public CabinetInfoVO getCabinetInfoForDriver(String code){ |
| | | JkCabinet jkCabinet = jkCabinetMapper.selectOne(new QueryWrapper<JkCabinet>() |
| | | .lambda() |
| | | .eq(JkCabinet::getIsdeleted,Constants.ZERO) |
| | | .eq(JkCabinet::getCode,code) |
| | | .orderByAsc(JkCabinet::getCreateDate) |
| | | .last(" limit 1 ") |
| | | ); |
| | | CabinetInfoVO cabinetInfoVO = new CabinetInfoVO(); |
| | | if(Objects.nonNull(jkCabinet)){ |
| | | BeanUtil.copyProperties(jkCabinet,cabinetInfoVO); |
| | | } |
| | | List<Category> categoryList = categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getIsdeleted,Constants.ZERO) |
| | | .eq(Category::getStatus,Constants.ZERO) |
| | | .eq(Category::getType,Constants.THREE) |
| | | .orderByAsc(Category::getSortnum) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(categoryList)){ |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.FTP,Constants.BANNER_IMG).getCode(); |
| | | for (Category category:categoryList) { |
| | | category.setImgurlFull(prefixUrl + category.getImgurl()); |
| | | } |
| | | cabinetInfoVO.setBannerList( |
| | | categoryList.stream().map(i->i.getImgurlFull()).collect(Collectors.toList()) |
| | | ); |
| | | } |
| | | return cabinetInfoVO; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void updateRunStatusById(Integer id) { |
| | | jkCabinetMapper.update(null,new UpdateWrapper<JkCabinet>() |
| | | .lambda().set(JkCabinet::getRunStatus,Constants.ZERO) |
| | | .set(JkCabinet::getEditDate, DateUtil.getCurrDateTime()) |
| | | .set(JkCabinet::getHaertTime, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinet::getId,id)); |
| | | } |
| | | |
| | | |
| | | } |