|  |  |  | 
|---|
|  |  |  | package com.doumee.service.business.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.hutool.core.bean.BeanUtil; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | 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.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; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.github.yulichang.wrapper.MPJLambdaWrapper; | 
|---|
|  |  |  | import lombok.extern.java.Log; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.context.annotation.Bean; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 钥匙柜基本信息表Service实现 | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private JkCabinetMapper jkCabinetMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CategoryMapper categoryMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private JkCabinetGridMapper jkCabinetGridMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private JkKeysMapper jkKeysMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MemberMapper memberMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) | 
|---|
|  |  |  | public Integer create(JkCabinet jkCabinet) { | 
|---|
|  |  |  | if(Objects.isNull(jkCabinet) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getCode()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getName()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getDevId()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getLinkAddr()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getCode()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getPort()) | 
|---|
|  |  |  | || CollectionUtils.isEmpty(jkCabinet.getManagerIdList()) | 
|---|
|  |  |  | || CollectionUtils.isEmpty(jkCabinet.getAuthMemberIdList()) | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getDoubleAuth()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getRowNum()) | 
|---|
|  |  |  | || jkCabinet.getRowNum() <= Constants.ZERO | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getColumnNum()) | 
|---|
|  |  |  | || jkCabinet.getColumnNum() <= Constants.ZERO | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getNoType()) | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getSortType()) | 
|---|
|  |  |  | || ( | 
|---|
|  |  |  | Constants.equalsInteger(jkCabinet.getNoType(),Constants.ONE) | 
|---|
|  |  |  | && ( Objects.isNull(jkCabinet.getNoIndex()) || Objects.isNull(jkCabinet.getNoLength()) || StringUtils.isBlank(jkCabinet.getNoPrefix()) ) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //查询编号是否重复 | 
|---|
|  |  |  | if(jkCabinetMapper.selectCount(new QueryWrapper<JkCabinet>().lambda().eq(JkCabinet::getCode,jkCabinet.getCode()).eq(JkCabinet::getIsdeleted,Constants.ZERO))>Constants.ZERO){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙柜设备编号已存在!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(jkCabinetMapper.selectCount(new QueryWrapper<JkCabinet>().lambda().eq(JkCabinet::getDevId,jkCabinet.getDevId()).eq(JkCabinet::getIsdeleted,Constants.ZERO))>Constants.ZERO){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙柜设备ID已存在!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = jkCabinet.getLoginUserInfo(); | 
|---|
|  |  |  | jkCabinet.setCreateDate(new Date()); | 
|---|
|  |  |  | jkCabinet.setEditDate(jkCabinet.getCreateDate()); | 
|---|
|  |  |  | jkCabinet.setCreator(loginUserInfo.getId()); | 
|---|
|  |  |  | jkCabinet.setEditor(loginUserInfo.getId()); | 
|---|
|  |  |  | jkCabinet.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | jkCabinet.setStatus(Constants.ZERO); | 
|---|
|  |  |  | jkCabinet.setRunStatus(Constants.ONE); | 
|---|
|  |  |  | if(StringUtils.isNotBlank(jkCabinet.getJwd())&&jkCabinet.getJwd().split(",").length>Constants.ONE){ | 
|---|
|  |  |  | jkCabinet.setLongitude(new BigDecimal(jkCabinet.getJwd().split(",")[Constants.ZERO])); | 
|---|
|  |  |  | jkCabinet.setLatitude(new BigDecimal(jkCabinet.getJwd().split(",")[Constants.ONE])); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | jkCabinet.setManagerId(String.join(",",jkCabinet.getManagerIdList())); | 
|---|
|  |  |  | jkCabinet.setAuthMemberId(String.join(",",jkCabinet.getAuthMemberIdList())); | 
|---|
|  |  |  | jkCabinetMapper.insert(jkCabinet); | 
|---|
|  |  |  | this.createGrid(jkCabinet); | 
|---|
|  |  |  | return jkCabinet.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void createGrid(JkCabinet jkCabinet){ | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = jkCabinet.getLoginUserInfo(); | 
|---|
|  |  |  | Integer startNo =  Constants.equalsInteger(jkCabinet.getNoType(),Constants.ZERO)?1:jkCabinet.getNoIndex() ; | 
|---|
|  |  |  | List<JkCabinetGrid> jkCabinetGridList = new ArrayList<>(); | 
|---|
|  |  |  | Integer maxNum = jkCabinet.getRowNum() * jkCabinet.getColumnNum(); | 
|---|
|  |  |  | for (int i = 0; i < maxNum; i++) { | 
|---|
|  |  |  | JkCabinetGrid grid = new JkCabinetGrid(); | 
|---|
|  |  |  | grid.setCreateDate(new Date()); | 
|---|
|  |  |  | grid.setEditDate(jkCabinet.getCreateDate()); | 
|---|
|  |  |  | grid.setCreator(loginUserInfo.getId()); | 
|---|
|  |  |  | grid.setEditor(loginUserInfo.getId()); | 
|---|
|  |  |  | grid.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | grid.setStatus(Constants.ZERO); | 
|---|
|  |  |  | grid.setCabinetId(jkCabinet.getId()); | 
|---|
|  |  |  | if(Constants.equalsInteger(jkCabinet.getNoType(),Constants.ZERO)){ | 
|---|
|  |  |  | grid.setCode(StringUtils.leftPad(startNo.toString(),maxNum.toString().length()+1,"0")); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | grid.setCode(jkCabinet.getNoPrefix() +  StringUtils.leftPad(startNo.toString(),jkCabinet.getNoLength(),"0")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | jkCabinetGridList.add(grid); | 
|---|
|  |  |  | startNo = startNo + 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | jkCabinetGridMapper.insert(jkCabinetGridList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void deleteById(Integer id) { | 
|---|
|  |  |  | jkCabinetMapper.deleteById(id); | 
|---|
|  |  |  | JkCabinet jkCabinet = jkCabinetMapper.selectById(id); | 
|---|
|  |  |  | if(Constants.equalsInteger(jkCabinet.getStatus(),Constants.ZERO)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非禁用数据,无法进行删除"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //查询钥匙柜下的柜格信息 | 
|---|
|  |  |  | List<JkCabinetGrid> jkCabinetGridList = jkCabinetGridMapper.selectList(new QueryWrapper<JkCabinetGrid>().lambda().eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(JkCabinetGrid::getCabinetId,jkCabinet.getId()) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.nonNull(jkCabinetGridList)){ | 
|---|
|  |  |  | jkCabinetGridMapper.update(null,new UpdateWrapper<JkCabinetGrid>().lambda().set(JkCabinetGrid::getIsdeleted,Constants.ONE) | 
|---|
|  |  |  | .in(JkCabinetGrid::getId,jkCabinetGridList.stream().map(i->i.getId()).collect(Collectors.toList())) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | List<Integer> keyIdList = jkCabinetGridList.stream().filter(i->Objects.nonNull(i.getKeyId())).map(i->i.getKeyId()).collect(Collectors.toList()); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(keyIdList)){ | 
|---|
|  |  |  | jkKeysMapper.update(null,new UpdateWrapper<JkKeys>().lambda() | 
|---|
|  |  |  | .set(JkKeys::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .in(JkKeys::getId,keyIdList) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | jkCabinetMapper.update(null,new UpdateWrapper<JkCabinet>().lambda() | 
|---|
|  |  |  | .set(JkCabinet::getIsdeleted,Constants.ONE) | 
|---|
|  |  |  | .eq(JkCabinet::getId,jkCabinet.getId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateById(JkCabinet jkCabinet) { | 
|---|
|  |  |  | if(Objects.isNull(jkCabinet) | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getId()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getCode()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getName()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getDevId()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getLinkAddr()) | 
|---|
|  |  |  | || StringUtils.isBlank(jkCabinet.getCode()) | 
|---|
|  |  |  | || CollectionUtils.isEmpty(jkCabinet.getManagerIdList()) | 
|---|
|  |  |  | || CollectionUtils.isEmpty(jkCabinet.getAuthMemberIdList()) | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getPort()) | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getDoubleAuth()) | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | jkCabinet.setRowNum(null); | 
|---|
|  |  |  | jkCabinet.setColumnNum(null); | 
|---|
|  |  |  | jkCabinet.setSortType(null); | 
|---|
|  |  |  | jkCabinet.setNoType(null); | 
|---|
|  |  |  | jkCabinet.setNoIndex(null); | 
|---|
|  |  |  | jkCabinet.setNoLength(null); | 
|---|
|  |  |  | jkCabinet.setNoPrefix(null); | 
|---|
|  |  |  | //查询编号是否重复 | 
|---|
|  |  |  | if(jkCabinetMapper.selectCount(new QueryWrapper<JkCabinet>().lambda().ne(JkCabinet::getId,jkCabinet.getId()).eq(JkCabinet::getCode,jkCabinet.getCode()).eq(JkCabinet::getIsdeleted,Constants.ZERO))>Constants.ZERO){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙柜设备编号已存在!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(jkCabinetMapper.selectCount(new QueryWrapper<JkCabinet>().lambda().ne(JkCabinet::getId,jkCabinet.getId()).eq(JkCabinet::getDevId,jkCabinet.getDevId()).eq(JkCabinet::getIsdeleted,Constants.ZERO))>Constants.ZERO){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙柜设备ID已存在!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = jkCabinet.getLoginUserInfo(); | 
|---|
|  |  |  | jkCabinet.setEditDate(new Date()); | 
|---|
|  |  |  | jkCabinet.setEditor(loginUserInfo.getId()); | 
|---|
|  |  |  | if(StringUtils.isNotBlank(jkCabinet.getJwd())&&jkCabinet.getJwd().split(",").length>Constants.ONE){ | 
|---|
|  |  |  | jkCabinet.setLongitude(new BigDecimal(jkCabinet.getJwd().split(",")[Constants.ZERO])); | 
|---|
|  |  |  | jkCabinet.setLatitude(new BigDecimal(jkCabinet.getJwd().split(",")[Constants.ONE])); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | jkCabinet.setManagerId(String.join(",",jkCabinet.getManagerIdList())); | 
|---|
|  |  |  | jkCabinet.setAuthMemberId(String.join(",",jkCabinet.getAuthMemberIdList())); | 
|---|
|  |  |  | jkCabinetMapper.updateById(jkCabinet); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateStatusById(JkCabinet jkCabinet) { | 
|---|
|  |  |  | if(Objects.isNull(jkCabinet) | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getId()) | 
|---|
|  |  |  | || Objects.isNull(jkCabinet.getStatus())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | jkCabinetMapper.update(null,new UpdateWrapper<JkCabinet>() | 
|---|
|  |  |  | .lambda().set(JkCabinet::getStatus,jkCabinet.getStatus()) | 
|---|
|  |  |  | .set(JkCabinet::getEditDate, DateUtil.getCurrDateTime()) | 
|---|
|  |  |  | .eq(JkCabinet::getId,jkCabinet.getId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateByIdInBatch(List<JkCabinet> jkCabinets) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return jkCabinetMapper.selectById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public JkCabinet getDetail(Integer id){ | 
|---|
|  |  |  | JkCabinet jkCabinet = jkCabinetMapper.selectById(id); | 
|---|
|  |  |  | if(Objects.nonNull(jkCabinet.getLongitude()) | 
|---|
|  |  |  | && Objects.nonNull(jkCabinet.getLatitude())){ | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public JkCabinet findOne(JkCabinet jkCabinet) { | 
|---|
|  |  |  | QueryWrapper<JkCabinet> wrapper = new QueryWrapper<>(jkCabinet); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<JkCabinet> findList(JkCabinet jkCabinet) { | 
|---|
|  |  |  | jkCabinet.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | jkCabinet.setStatus(Constants.ZERO); | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | QueryWrapper<JkCabinet> queryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | Utils.MP.blankToNull(pageWrap.getModel()); | 
|---|
|  |  |  | if (pageWrap.getModel().getId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getId, pageWrap.getModel().getId()); | 
|---|
|  |  |  | JkCabinet model = pageWrap.getModel(); | 
|---|
|  |  |  | IPage<JkCabinet> iPage = jkCabinetMapper.selectPage(page, new QueryWrapper<JkCabinet>() | 
|---|
|  |  |  | .lambda() | 
|---|
|  |  |  | .eq(JkCabinet::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .like(StringUtils.isNotBlank(model.getName()),JkCabinet::getName, model.getName()) | 
|---|
|  |  |  | .like(StringUtils.isNotBlank(model.getCode()),JkCabinet::getCode, model.getCode()) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getStatus()),JkCabinet::getStatus, model.getStatus()) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getRunStatus()),JkCabinet::getRunStatus, model.getRunStatus()) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | for (JkCabinet jkCabinet:iPage.getRecords()) { | 
|---|
|  |  |  | jkCabinet.setGridNum(jkCabinet.getColumnNum()*jkCabinet.getRowNum()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCreator() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getCreator, pageWrap.getModel().getCreator()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCreateDate() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(JkCabinet::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); | 
|---|
|  |  |  | queryWrapper.lambda().le(JkCabinet::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getEditor() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getEditor, pageWrap.getModel().getEditor()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getEditDate() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(JkCabinet::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); | 
|---|
|  |  |  | queryWrapper.lambda().le(JkCabinet::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getIsdeleted() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getIsdeleted, pageWrap.getModel().getIsdeleted()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getInfo() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getInfo, pageWrap.getModel().getInfo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCode() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getCode, pageWrap.getModel().getCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getName() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getName, pageWrap.getModel().getName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getDevId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getDevId, pageWrap.getModel().getDevId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getSerialNo() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getSerialNo, pageWrap.getModel().getSerialNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getLinkAddr() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getLinkAddr, pageWrap.getModel().getLinkAddr()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getStatus() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getStatus, pageWrap.getModel().getStatus()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getPort() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getPort, pageWrap.getModel().getPort()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getManagerId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getManagerId, pageWrap.getModel().getManagerId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getUseTime() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getUseTime, pageWrap.getModel().getUseTime()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getDoubleAuth() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getDoubleAuth, pageWrap.getModel().getDoubleAuth()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getAuthMemberId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getAuthMemberId, pageWrap.getModel().getAuthMemberId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getRowNum() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getRowNum, pageWrap.getModel().getRowNum()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getColumnNum() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getColumnNum, pageWrap.getModel().getColumnNum()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getHaertTime() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(JkCabinet::getHaertTime, Utils.Date.getStart(pageWrap.getModel().getHaertTime())); | 
|---|
|  |  |  | queryWrapper.lambda().le(JkCabinet::getHaertTime, Utils.Date.getEnd(pageWrap.getModel().getHaertTime())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getLocation() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getLocation, pageWrap.getModel().getLocation()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getLongitude() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getLongitude, pageWrap.getModel().getLongitude()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getLatitude() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getLatitude, pageWrap.getModel().getLatitude()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getNoType() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getNoType, pageWrap.getModel().getNoType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getNoPrefix() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getNoPrefix, pageWrap.getModel().getNoPrefix()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getNoLength() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getNoLength, pageWrap.getModel().getNoLength()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getNoIndex() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(JkCabinet::getNoIndex, pageWrap.getModel().getNoIndex()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for(PageWrap.SortData sortData: pageWrap.getSorts()) { | 
|---|
|  |  |  | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { | 
|---|
|  |  |  | queryWrapper.orderByDesc(sortData.getProperty()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | queryWrapper.orderByAsc(sortData.getProperty()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return PageData.from(jkCabinetMapper.selectPage(page, queryWrapper)); | 
|---|
|  |  |  | return PageData.from(iPage); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<JkCabinet> wrapper = new QueryWrapper<>(jkCabinet); | 
|---|
|  |  |  | return jkCabinetMapper.selectCount(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public CabinetConfigDataVO getCabinetConfigDataVO(){ | 
|---|
|  |  |  | CabinetConfigDataVO cabinetConfigDataVO = new CabinetConfigDataVO(); | 
|---|
|  |  |  | cabinetConfigDataVO.setConcentration(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.CONCENTRATION).getCode()); | 
|---|
|  |  |  | cabinetConfigDataVO.setPressure(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.PRESSURE).getCode()); | 
|---|
|  |  |  | cabinetConfigDataVO.setBlowTime(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.BLOW_TIME).getCode()); | 
|---|
|  |  |  | cabinetConfigDataVO.setThreshold(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.THRESHOLD).getCode()); | 
|---|
|  |  |  | return cabinetConfigDataVO; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updCabinetConfig(CabinetConfigDataVO cabinetConfigDataVO){ | 
|---|
|  |  |  | if(Objects.isNull(cabinetConfigDataVO) | 
|---|
|  |  |  | || (StringUtils.isBlank(cabinetConfigDataVO.getBlowTime()) | 
|---|
|  |  |  | && StringUtils.isBlank(cabinetConfigDataVO.getConcentration()) | 
|---|
|  |  |  | && StringUtils.isBlank(cabinetConfigDataVO.getPressure()) | 
|---|
|  |  |  | && StringUtils.isBlank(cabinetConfigDataVO.getThreshold()) | 
|---|
|  |  |  | )){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(cabinetConfigDataVO.getConcentration())){ | 
|---|
|  |  |  | SystemDictData systemDictData = systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.CONCENTRATION); | 
|---|
|  |  |  | systemDictData.setCode(cabinetConfigDataVO.getConcentration()); | 
|---|
|  |  |  | systemDictDataBiz.updateByIdNew(systemDictData); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(cabinetConfigDataVO.getPressure())){ | 
|---|
|  |  |  | SystemDictData systemDictData = systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.PRESSURE); | 
|---|
|  |  |  | systemDictData.setCode(cabinetConfigDataVO.getPressure()); | 
|---|
|  |  |  | systemDictDataBiz.updateByIdNew(systemDictData); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(cabinetConfigDataVO.getBlowTime())){ | 
|---|
|  |  |  | SystemDictData systemDictData = systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.BLOW_TIME); | 
|---|
|  |  |  | systemDictData.setCode(cabinetConfigDataVO.getBlowTime()); | 
|---|
|  |  |  | systemDictDataBiz.updateByIdNew(systemDictData); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(cabinetConfigDataVO.getThreshold())){ | 
|---|
|  |  |  | SystemDictData systemDictData = systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.THRESHOLD); | 
|---|
|  |  |  | systemDictData.setCode(cabinetConfigDataVO.getThreshold()); | 
|---|
|  |  |  | systemDictDataBiz.updateByIdNew(systemDictData); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<AdminCabinetVO> getAdminCabinetInfo(LoginUserInfo loginUserInfo){ | 
|---|
|  |  |  | List<AdminCabinetVO> adminCabinetVOList = new ArrayList<>(); | 
|---|
|  |  |  | List<JkCabinet> jkCabinetList = jkCabinetMapper.selectList(new QueryWrapper<JkCabinet>() | 
|---|
|  |  |  | .lambda() | 
|---|
|  |  |  | .eq(JkCabinet::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .apply(" FIND_IN_SET("+loginUserInfo.getMemberId()+",MANAGER_ID) ") | 
|---|
|  |  |  | .orderByAsc(JkCabinet::getCreateDate) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(jkCabinetList)){ | 
|---|
|  |  |  | for (JkCabinet jkCabinet:jkCabinetList) { | 
|---|
|  |  |  | AdminCabinetVO adminCabinetVO = new AdminCabinetVO(); | 
|---|
|  |  |  | BeanUtil.copyProperties(jkCabinet,adminCabinetVO); | 
|---|
|  |  |  | adminCabinetVOList.add(adminCabinetVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return adminCabinetVOList; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 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.getMemberId()+",MANAGER_ID) ") | 
|---|
|  |  |  | .eq(JkCabinet::getId,cabinetId) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(cabinet)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,未查询到钥匙柜信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | BeanUtil.copyProperties(cabinet,cabinetDetailVO); | 
|---|
|  |  |  | cabinetDetailVO.setGridNum(Constants.ZERO); | 
|---|
|  |  |  | cabinetDetailVO.setErrGridNum(Constants.ZERO); | 
|---|
|  |  |  | cabinetDetailVO.setOnlineKeyNum(Constants.ZERO); | 
|---|
|  |  |  | cabinetDetailVO.setServiceKeyNum(Constants.ZERO); | 
|---|
|  |  |  | cabinetDetailVO.setOutKeyNum(Constants.ZERO); | 
|---|
|  |  |  | cabinetDetailVO.setUnBindGridNum(Constants.ZERO); | 
|---|
|  |  |  | cabinetDetailVO.setMemberId(loginUserInfo.getMemberId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //所有柜格信息 | 
|---|
|  |  |  | List<JkCabinetGrid> jkCabinetGridList = | 
|---|
|  |  |  | jkCabinetGridMapper.selectJoinList(JkCabinetGrid.class, new MPJLambdaWrapper<JkCabinetGrid>() | 
|---|
|  |  |  | .selectAll(JkCabinetGrid.class) | 
|---|
|  |  |  | .selectAs(JkKeys::getCarCode,JkCabinetGrid::getCarCode) | 
|---|
|  |  |  | .selectAs(JkKeys::getCode,JkCabinetGrid::getKeyCode) | 
|---|
|  |  |  | .selectAs(JkKeys::getStatus,JkCabinetGrid::getKeyStatus) | 
|---|
|  |  |  | .leftJoin(JkKeys.class,JkKeys::getId,JkCabinetGrid::getKeyId) | 
|---|
|  |  |  | .eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(JkCabinetGrid::getCabinetId,cabinet.getId()) | 
|---|
|  |  |  | .orderByAsc(JkCabinetGrid::getCode) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<CabinetGridInfoVO> cabinetGridInfoVOList = new ArrayList<>(); | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(jkCabinetGridList)){ | 
|---|
|  |  |  | cabinetDetailVO.setGridNum(jkCabinetGridList.size()); | 
|---|
|  |  |  | for (JkCabinetGrid jkCabinetGrid:jkCabinetGridList) { | 
|---|
|  |  |  | CabinetGridInfoVO cabinetGridInfoVO = new CabinetGridInfoVO(); | 
|---|
|  |  |  | BeanUtil.copyProperties(jkCabinetGrid,cabinetGridInfoVO); | 
|---|
|  |  |  | cabinetGridInfoVO.setBindStatus(Objects.isNull(jkCabinetGrid.getKeyId())?Constants.ZERO:Constants.ONE); | 
|---|
|  |  |  | cabinetGridInfoVO.setKeyStatus(Objects.isNull(cabinetGridInfoVO.getKeyStatus())?Constants.ZERO:cabinetGridInfoVO.getKeyStatus()); | 
|---|
|  |  |  | cabinetGridInfoVOList.add(cabinetGridInfoVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cabinetDetailVO.setCabinetGridInfoVOList(cabinetGridInfoVOList); | 
|---|
|  |  |  | cabinetDetailVO.setErrGridNum( | 
|---|
|  |  |  | cabinetGridInfoVOList.stream().filter(i->Constants.equalsInteger(i.getWorkingStatus(),Constants.ONE)).collect(Collectors.toList()).size() | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | cabinetDetailVO.setOnlineKeyNum( | 
|---|
|  |  |  | cabinetGridInfoVOList.stream().filter(i->Constants.equalsInteger(i.getKeyStatus(),Constants.ONE)).collect(Collectors.toList()).size() | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | cabinetDetailVO.setOutKeyNum( | 
|---|
|  |  |  | cabinetGridInfoVOList.stream().filter(i->Constants.equalsInteger(i.getKeyStatus(),Constants.TWO)).collect(Collectors.toList()).size() | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | cabinetDetailVO.setServiceKeyNum( | 
|---|
|  |  |  | cabinetGridInfoVOList.stream().filter(i->Constants.equalsInteger(i.getKeyStatus(),Constants.THREE)).collect(Collectors.toList()).size() | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | cabinetDetailVO.setUnBindGridNum( | 
|---|
|  |  |  | cabinetGridInfoVOList.stream().filter(i->Constants.equalsInteger(i.getBindStatus(),Constants.ZERO)).collect(Collectors.toList()).size() | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return cabinetDetailVO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @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(Cars.class,Cars::getMemberId,Member::getId) | 
|---|
|  |  |  | .leftJoin(JkKeys.class,JkKeys::getCarId,Cars::getId) | 
|---|
|  |  |  | .eq(Member::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(CarDriver::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(CarDriver::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .isNotNull(Member::getFaceImg) | 
|---|
|  |  |  | .in(JkKeys::getId,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<JkCabinetGrid> jkCabinetGridList = | 
|---|
|  |  |  | jkCabinetGridMapper.selectJoinList(JkCabinetGrid.class, new MPJLambdaWrapper<JkCabinetGrid>() | 
|---|
|  |  |  | .selectAll(JkCabinetGrid.class) | 
|---|
|  |  |  | .selectAs(JkKeys::getCarCode,JkCabinetGrid::getCarCode) | 
|---|
|  |  |  | .selectAs(JkKeys::getStatus,JkCabinetGrid::getKeyStatus) | 
|---|
|  |  |  | .selectAs(JkKeys::getCode,JkCabinetGrid::getKeyCode) | 
|---|
|  |  |  | .leftJoin(JkKeys.class,JkKeys::getId,JkCabinetGrid::getKeyId) | 
|---|
|  |  |  | .eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(JkCabinetGrid::getCabinetId,jkCabinet.getId()) | 
|---|
|  |  |  | .orderByAsc(JkCabinetGrid::getCode) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<CabinetGridInfoVO> cabinetGridInfoVOList = new ArrayList<>(); | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(jkCabinetGridList)) { | 
|---|
|  |  |  | for (JkCabinetGrid jkCabinetGrid : jkCabinetGridList) { | 
|---|
|  |  |  | CabinetGridInfoVO cabinetGridInfoVO = new CabinetGridInfoVO(); | 
|---|
|  |  |  | BeanUtil.copyProperties(jkCabinetGrid, cabinetGridInfoVO); | 
|---|
|  |  |  | cabinetGridInfoVO.setBindStatus(Objects.isNull(jkCabinetGrid.getKeyId()) ? Constants.ZERO : Constants.ONE); | 
|---|
|  |  |  | cabinetGridInfoVO.setKeyStatus(Objects.isNull(cabinetGridInfoVO.getKeyStatus())?Constants.ZERO:cabinetGridInfoVO.getKeyStatus()); | 
|---|
|  |  |  | cabinetGridInfoVOList.add(cabinetGridInfoVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cabinetInfoVO.setCabinetGridInfoVOList(cabinetGridInfoVOList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | CabinetConfigDataVO cabinetConfigDataVO = new CabinetConfigDataVO(); | 
|---|
|  |  |  | cabinetConfigDataVO.setConcentration(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.CONCENTRATION).getCode()); | 
|---|
|  |  |  | cabinetConfigDataVO.setPressure(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.PRESSURE).getCode()); | 
|---|
|  |  |  | cabinetConfigDataVO.setBlowTime(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.BLOW_TIME).getCode()); | 
|---|
|  |  |  | cabinetConfigDataVO.setThreshold(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.THRESHOLD).getCode()); | 
|---|
|  |  |  | cabinetInfoVO.setCabinetConfigDataVO(cabinetConfigDataVO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cabinetInfoVO.setLinkPhone(systemDictDataBiz.queryByCode(Constants.CABINET_CONFIG,Constants.LINK_PHONE).getCode()); | 
|---|
|  |  |  | 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)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|