| | |
| | | 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.*; |
| | | import com.doumee.dao.business.dao.MemberMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.vo.*; |
| | |
| | | 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.service.business.JkCabinetService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | |
| | | @Autowired |
| | | private CarUseBookMapper carUseBookMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public Integer create(JkCabinet jkCabinet) { |
| | |
| | | || CollectionUtils.isEmpty(jkCabinet.getManagerIdList()) |
| | | || CollectionUtils.isEmpty(jkCabinet.getAuthMemberIdList()) |
| | | || Objects.isNull(jkCabinet.getDoubleAuth()) |
| | | || Objects.isNull(jkCabinet.getAlcoholStatus()) |
| | | |
| | | || Objects.isNull(jkCabinet.getRowNum()) |
| | | || jkCabinet.getRowNum() <= Constants.ZERO |
| | |
| | | || CollectionUtils.isEmpty(jkCabinet.getAuthMemberIdList()) |
| | | || Objects.isNull(jkCabinet.getPort()) |
| | | || Objects.isNull(jkCabinet.getDoubleAuth()) |
| | | || Objects.isNull(jkCabinet.getAlcoholStatus()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | |
| | | .isNotNull(JkKeys::getCarId) |
| | | .eq(JkCabinetGrid::getCabinetId,jkCabinet.getId()) |
| | | ); |
| | | List<Member> driverList = new ArrayList<>(); |
| | | 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>() |
| | | driverList.addAll(memberMapper.selectJoinList(Member.class,new MPJLambdaWrapper<Member>() |
| | | .selectAll(Member.class) |
| | | .leftJoin(Cars.class,Cars::getMemberId,Member::getId) |
| | | .leftJoin(JkKeys.class,JkKeys::getCarId,Cars::getId) |
| | |
| | | .eq(CarDriver::getIsdeleted,Constants.ZERO) |
| | | .eq(CarDriver::getStatus,Constants.ZERO) |
| | | .isNotNull(Member::getFaceImg) |
| | | .in(JkKeys::getId,carIdList) |
| | | .in(JkKeys::getId,carIdList)) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | Set<Member> memberSet = new HashSet<>(memberList); |
| | | } |
| | | //派车单司机信息 |
| | | String earlyConfig = systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.EARLY_CONFIG).getCode(); |
| | | List<CarUseBook> carUseBookList = carUseBookMapper.selectList(new QueryWrapper<CarUseBook>().lambda() |
| | | .eq(CarUseBook::getIsdeleted,Constants.ZERO) |
| | | .isNotNull(CarUseBook::getDriverId) |
| | | .apply(" car_id in ( SELECT k.CAR_ID FROM jk_cabinet_grid j inner join jk_keys k on j.KEY_ID = k.ID where j.isdeleted = 0 and k.isdeleted = 0 ) ") |
| | | .apply(" (" + |
| | | "( NOW() > DATE_SUB(START_TIME, INTERVAL "+earlyConfig+" MINUTE) and now() < end_time and KEY_STATUS = 0 ) " + |
| | | "or" + |
| | | " KEY_STATUS = 1 " + |
| | | ") ") |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(carUseBookList)){ |
| | | driverList.addAll(memberMapper.selectList(new QueryWrapper<Member>().lambda() |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .isNotNull(Member::getFaceImg) |
| | | .in(Member::getId,carUseBookList.stream().map(i->i.getDriverId()).collect(Collectors.toList())) |
| | | )); |
| | | } |
| | | |
| | | if(CollectionUtils.isNotEmpty(driverList)){ |
| | | if(CollectionUtils.isNotEmpty(driverList)){ |
| | | Set<Member> memberSet = new HashSet<>(driverList); |
| | | for (Member member:memberSet) { |
| | | CabinetFaceInfoVO cabinetFaceInfoVO = new CabinetFaceInfoVO(); |
| | | cabinetFaceInfoVO.setMemberId(member.getId()); |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updHeartbeat(String code){ |
| | | jkCabinetMapper.update(null,new UpdateWrapper<JkCabinet>() |
| | | .lambda() |
| | | .set(JkCabinet::getHaertTime, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinet::getCode,code)); |
| | | } |
| | | |
| | | } |