| | |
| | | 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.api.R; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.DataSyncConfig; |
| | |
| | | @Override |
| | | public List<RoleListResponse> erpQueryDeviceList(RoleListRequest param){ |
| | | List<RoleListResponse> result = new ArrayList<>(); |
| | | try{ |
| | | List<DeviceRole> deviceRoleList = this.deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda() |
| | | .eq(DeviceRole::getIsdeleted,Constants.ZERO) |
| | | .eq(!Objects.isNull(param.getId()),DeviceRole::getId,param.getId()) |
| | | .like(StringUtils.isNotBlank(param.getName()),DeviceRole::getName,param.getName()) |
| | | .orderByAsc(DeviceRole::getCreateDate) |
| | | ); |
| | | List<String> roleIds = new ArrayList<String>(); |
| | | if(CollectionUtils.isNotEmpty(deviceRoleList)){ |
| | | for (DeviceRole deviceRole:deviceRoleList) { |
| | | if(StringUtils.isNotBlank(deviceRole.getDoorIds())){ |
| | | List<String> doorList = Arrays.asList(deviceRole.getDoorIds().split(",")); |
| | | roleIds.addAll(doorList); |
| | | } |
| | | } |
| | | if(CollectionUtils.isNotEmpty(roleIds)){ |
| | | List<Device> deviceList = deviceMapper.selectList(new QueryWrapper<Device>().lambda().in(Device::getId,roleIds)); |
| | | for (DeviceRole deviceRole:deviceRoleList) { |
| | | RoleListResponse roleListResponse = new RoleListResponse(); |
| | | BeanUtils.copyProperties(deviceRole,roleListResponse); |
| | | if(deviceRole.getType().equals("2")){ |
| | | roleListResponse.setType(Constants.ONE); |
| | | }else{ |
| | | roleListResponse.setType(Constants.ZERO); |
| | | } |
| | | if(StringUtils.isNotBlank(deviceRole.getDoorIds())){ |
| | | List<DeviceListResponse> DeviceListResponseList = new ArrayList<>(); |
| | | List<String> doorList = Arrays.asList(deviceRole.getDoorIds().split(",")); |
| | | List<Device> roleDeviceList = deviceList.stream().filter(m-> doorList.contains(m.getId().toString())).collect(Collectors.toList()); |
| | | for (Device device:roleDeviceList) { |
| | | DeviceListResponse deviceListResponse = new DeviceListResponse(); |
| | | BeanUtils.copyProperties(device,deviceListResponse); |
| | | DeviceListResponseList.add(deviceListResponse); |
| | | } |
| | | roleListResponse.setDeviceList(DeviceListResponseList); |
| | | } |
| | | result.add(roleListResponse); |
| | | } |
| | | List<DeviceRole> deviceRoleList = this.deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda() |
| | | .eq(DeviceRole::getIsdeleted,Constants.ZERO) |
| | | .eq(!Objects.isNull(param.getId()),DeviceRole::getId,param.getId()) |
| | | .like(StringUtils.isNotBlank(param.getName()),DeviceRole::getName,param.getName()) |
| | | .orderByAsc(DeviceRole::getCreateDate) |
| | | ); |
| | | List<String> roleIds = new ArrayList<String>(); |
| | | if(CollectionUtils.isNotEmpty(deviceRoleList)){ |
| | | for (DeviceRole deviceRole:deviceRoleList) { |
| | | if(StringUtils.isNotBlank(deviceRole.getDoorIds())){ |
| | | List<String> doorList = Arrays.asList(deviceRole.getDoorIds().split(",")); |
| | | roleIds.addAll(doorList); |
| | | } |
| | | } |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/visitBiz/resource/role/list",JSONObject.toJSONString(result),Constants.ZERO); |
| | | if(CollectionUtils.isNotEmpty(roleIds)){ |
| | | List<Device> deviceList = deviceMapper.selectList(new QueryWrapper<Device>().lambda().in(Device::getId,roleIds)); |
| | | for (DeviceRole deviceRole:deviceRoleList) { |
| | | RoleListResponse roleListResponse = new RoleListResponse(); |
| | | BeanUtils.copyProperties(deviceRole,roleListResponse); |
| | | if(deviceRole.getType().equals("2")){ |
| | | roleListResponse.setType(Constants.ONE); |
| | | }else{ |
| | | roleListResponse.setType(Constants.ZERO); |
| | | } |
| | | if(StringUtils.isNotBlank(deviceRole.getDoorIds())){ |
| | | List<DeviceListResponse> DeviceListResponseList = new ArrayList<>(); |
| | | List<String> doorList = Arrays.asList(deviceRole.getDoorIds().split(",")); |
| | | List<Device> roleDeviceList = deviceList.stream().filter(m-> doorList.contains(m.getId().toString())).collect(Collectors.toList()); |
| | | for (Device device:roleDeviceList) { |
| | | DeviceListResponse deviceListResponse = new DeviceListResponse(); |
| | | BeanUtils.copyProperties(device,deviceListResponse); |
| | | DeviceListResponseList.add(deviceListResponse); |
| | | } |
| | | roleListResponse.setDeviceList(DeviceListResponseList); |
| | | } |
| | | result.add(roleListResponse); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | |
| | | @Override |
| | | public List<ParkListResponse> parkList(ParkListRequest param){ |
| | | List<ParkListResponse> result = new ArrayList<>(); |
| | | try{ |
| | | List<Parks> parksList = this.parksMapper.selectList(new QueryWrapper<Parks>().lambda() |
| | | .eq(Parks::getIsdeleted,Constants.ZERO) |
| | | .eq(!Objects.isNull(param.getId()),Parks::getId,param.getId()) |
| | | .like(StringUtils.isNotBlank(param.getName()),Parks::getName,param.getName()) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(parksList)){ |
| | | for (Parks parks:parksList) { |
| | | ParkListResponse parkListResponse = new ParkListResponse(); |
| | | BeanUtils.copyProperties(parks,parkListResponse); |
| | | result.add(parkListResponse); |
| | | } |
| | | List<Parks> parksList = this.parksMapper.selectList(new QueryWrapper<Parks>().lambda() |
| | | .eq(Parks::getIsdeleted,Constants.ZERO) |
| | | .eq(!Objects.isNull(param.getId()),Parks::getId,param.getId()) |
| | | .like(StringUtils.isNotBlank(param.getName()),Parks::getName,param.getName()) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(parksList)){ |
| | | for (Parks parks:parksList) { |
| | | ParkListResponse parkListResponse = new ParkListResponse(); |
| | | BeanUtils.copyProperties(parks,parkListResponse); |
| | | result.add(parkListResponse); |
| | | } |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/visitBiz/resource/park/list",JSONObject.toJSONString(result),Constants.ZERO); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | @Override |
| | | public PageData<VisitEventListResponse> visitListPage(PageWrap<VisitListRequest> param) { |
| | | PageData<VisitEventListResponse> result = new PageData<>(); |
| | | try{ |
| | | VisitListRequest visitListRequest = param.getModel(); |
| | | IPage<VisitEvent> page = new Page<>(param.getPage(), param.getCapacity()); |
| | | MPJLambdaWrapper<VisitEvent> queryWrapper = new MPJLambdaWrapper<>(); |
| | |
| | | } |
| | | IPage<VisitEventListResponse> pageData = visitEventJoinMapper.selectJoinPage(page, VisitEventListResponse.class,queryWrapper); |
| | | result = PageData.from(pageData); |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/visitBiz/resource/visit/list",JSONObject.toJSONString(result),Constants.ZERO); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | |
| | | @Override |
| | | public PageData<DoorEventListResponse> doorEventListPage(PageWrap<DoorEventListRequest> param) { |
| | | PageData<DoorEventListResponse> result = new PageData<>(); |
| | | try{ |
| | | |
| | | DoorEventListRequest doorEventListRequest = param.getModel(); |
| | | IPage<DeviceEvent> page = new Page<>(param.getPage(), param.getCapacity()); |
| | | MPJLambdaWrapper<DeviceEvent> queryWrapper = new MPJLambdaWrapper<>(); |
| | |
| | | |
| | | IPage<DoorEventListResponse> pageData = deviceEventJoinMapper.selectJoinPage(page, DoorEventListResponse.class,queryWrapper); |
| | | result = PageData.from(pageData); |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/visitBiz/resource/doorEvent/list",JSONObject.toJSONString(result),Constants.ZERO); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | |
| | | @Override |
| | | public PageData<CarEventListResponse> carEventList(PageWrap<CarEventListRequest> param) { |
| | | PageData<CarEventListResponse> result = new PageData<>(); |
| | | try{ |
| | | CarEventListRequest carEventListRequest = param.getModel(); |
| | | IPage<CarEvent> page = new Page<>(param.getPage(), param.getCapacity()); |
| | | MPJLambdaWrapper<CarEvent> queryWrapper = new MPJLambdaWrapper<>(); |
| | |
| | | i.setVehiclePicUrl(null); |
| | | } |
| | | }); |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/visitBiz/resource/carEventList",JSONObject.toJSONString(result),Constants.ZERO); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void orgUpdate(OrgUpdateRequest param){ |
| | | try{ |
| | | if(Objects.isNull(param) |
| | | ||Objects.isNull(param.getId()) |
| | | ||StringUtils.isBlank(param.getName()) |
| | |
| | | companyMapper.updateById(company); |
| | | //TODO 海康数据更新 |
| | | } |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/visitBiz/resource/orgUpdate",null,Constants.ZERO); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void userUpdate(UserUpdateRequest param){ |
| | | try{ |
| | | if(param.getIsdeleted() == 1){ |
| | | if( Objects.isNull(param.getId()) ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | |
| | | //添加人员卡片数据 |
| | | dealMemberCard(member,param); |
| | | } |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/visitBiz/resource/userUpdate",null,Constants.ZERO); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public void roleUserAuthor(UserAuthorRequest param){ |
| | | try{ |
| | | if(Objects.isNull(param) |
| | | ||StringUtils.isBlank(param.getUserId())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | |
| | | .set(Member::getEndTime,param.getValidEndTime()) |
| | | .set(Member::getEditDate,new Date()) |
| | | .set(Member::getHkStatus,Constants.ZERO )); |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/event/role/userAuthor",null,Constants.ZERO); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void parkCarAuthor(CarAuthorRequest param){ |
| | | try{ |
| | | if(Objects.isNull(param) |
| | | ||StringUtils.isBlank(param.getCarCode())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,停车库信息不存在,授权失败"); |
| | | } |
| | | } |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(param,"/event/park/carAuthor",null,Constants.ZERO); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @Transactional(propagation = Propagation.NOT_SUPPORTED) |
| | | @Override |
| | | public void saveInterfaceLog(Object param, String path, String result, Integer type) { |
| | | InterfaceLog interfaceLog=new InterfaceLog(); |
| | | interfaceLog.setType(type); |