|  |  |  | 
|---|
|  |  |  | //检查是否必须答题,并且符合答题要求 | 
|---|
|  |  |  | ProblemLog problemLog = isValidProblemLog(visits,source); | 
|---|
|  |  |  | //获取申请的海康访问门禁组信息 | 
|---|
|  |  |  | getHkDeviceRoles(visits,isERP); | 
|---|
|  |  |  | //        getHkDeviceRoles(visits,isERP); | 
|---|
|  |  |  | //检验拜访人是否合法 | 
|---|
|  |  |  | Member visitMember = isValideVisitedUser(visits.getReceptMemberId()); | 
|---|
|  |  |  | if(StringUtils.isNotBlank(visits.getIdcardNo()) && Constants.equalsInteger(Constants.ZERO, visits.getIdcardType()) | 
|---|
|  |  |  | 
|---|
|  |  |  | //初始化访客信息 | 
|---|
|  |  |  | initVisitInfo(visits,date); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        if(StringUtils.isNotBlank(visits.getFaceImg())&&(Constants.equalsInteger(visits.getType(),Constants.ZERO)|| Constants.equalsInteger(visits.getType(),Constants.TWO))){ | 
|---|
|  |  |  | //            //人脸评分 | 
|---|
|  |  |  | //            FacePictureCheckRequest param = new FacePictureCheckRequest(); | 
|---|
|  |  |  | //            String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode() + | 
|---|
|  |  |  | //                    systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode(); | 
|---|
|  |  |  | //            param.setFacePicUrl(prefixUrl + visits.getFaceImg()); | 
|---|
|  |  |  | //            BaseResponse<FacePictureCheckResponse> response = HKService.facePictureCheck(param); | 
|---|
|  |  |  | //            if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){ | 
|---|
|  |  |  | //                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //            FacePictureCheckResponse facePictureCheckResponse = response.getData(); | 
|---|
|  |  |  | //            if(Objects.isNull(facePictureCheckResponse) || Objects.isNull(facePictureCheckResponse.getCheckResult())){ | 
|---|
|  |  |  | //                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //            if(!facePictureCheckResponse.getCheckResult()){ | 
|---|
|  |  |  | //                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), facePictureCheckResponse.getStatusMessage()); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | visits.setSendTimeOutNotice(Constants.ZERO); | 
|---|
|  |  |  | visitsMapper.insert(visits); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | queryWrapper.selectAll(Visits.class); | 
|---|
|  |  |  | queryWrapper.select("  ( select count(distinct(v.CAR_NOS)) from visits v where v.PARENT_ID = t.ID and v.CAR_NOS is not null  and v.CAR_NOS != ''  and v.CAR_NOS != t.CAR_NOS ) as carNum  "); | 
|---|
|  |  |  | queryWrapper.select("  ( select count(distinct(v.id)) from retention v where v.member_id = t.member_id and v.type=1 )",Visits::getRetentionNum); | 
|---|
|  |  |  | queryWrapper.selectAs(Member::getName,Visits::getReceptMemberName); | 
|---|
|  |  |  | queryWrapper.selectAs(Company::getName,Visits::getReceptMemberDepartment); | 
|---|
|  |  |  | queryWrapper.leftJoin(Member.class,Member::getId,Visits::getReceptMemberId); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void  visitsSelfCancel(Integer visitId,Integer memberId){ | 
|---|
|  |  |  | public void  visitsSelfCancel(Integer visitId,Integer memberId,String openid){ | 
|---|
|  |  |  | Visits visits = visitsMapper.selectById(visitId); | 
|---|
|  |  |  | if(Objects.isNull(visits)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!(Constants.equalsInteger(memberId,visits.getMemberId()))){ | 
|---|
|  |  |  | /*        if(!(Constants.equalsInteger(memberId,visits.getMemberId()))){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"无此操作权限"); | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | if(!StringUtils.equals(openid,visits.getOpenid())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"无此操作权限"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.visitsCancelBiz(visits); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!( | 
|---|
|  |  |  | CollectionUtils.isNotEmpty(loginUserInfo.getPermissions()) && | 
|---|
|  |  |  | loginUserInfo.getPermissions().stream().filter(i->i.equals("business:visits:cancel")).collect(Collectors.toList()).size()>0)){ | 
|---|
|  |  |  | loginUserInfo.getPermissions().stream().filter(i->i.equals("business:visits:cancel")) | 
|---|
|  |  |  | .collect(Collectors.toList()).size()>0)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"无此操作权限"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.visitsCancelBiz(visits); | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(Visits::getId,visits.getId()); | 
|---|
|  |  |  | //访客报备 | 
|---|
|  |  |  | if(Constants.equalsInteger(visits.getType(),Constants.TWO)){ | 
|---|
|  |  |  | if(!(Constants.equalsInteger(visits.getStatus(),Constants.VisitStatus.waitCheck)||Constants.equalsInteger(visits.getStatus(),Constants.VisitStatus.submitCheck) | 
|---|
|  |  |  | if(!(Constants.equalsInteger(visits.getStatus(),Constants.VisitStatus.waitCheck) | 
|---|
|  |  |  | ||Constants.equalsInteger(visits.getStatus(),Constants.VisitStatus.submitCheck) | 
|---|
|  |  |  | || Constants.equalsInteger(visits.getStatus(),Constants.VisitStatus.pass))){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"访客记录状态错误,无法进行该操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | //                    List<String> memberIds = daysList.stream().map(i->i.getMemberId().toString()).collect(Collectors.toList()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<String> memberIds  = inoutRecordList.stream().filter(i-> | 
|---|
|  |  |  | Objects.isNull(i.getCarCode())&& | 
|---|
|  |  |  | Objects.nonNull(i.getMemberPhone())&&DateUtil.dateToString(i.getTimeInfo(),"yyyy-MM-dd").equals(days) | 
|---|
|  |  |  | Objects.isNull(i.getCarCode()) | 
|---|
|  |  |  | && Constants.equalsInteger(i.getMemberType(),Constants.ONE) | 
|---|
|  |  |  | && Constants.equalsInteger(i.getInOrOut(),Constants.ZERO) | 
|---|
|  |  |  | && Objects.nonNull(i.getMemberPhone())&&DateUtil.dateToString(i.getTimeInfo(),"yyyy-MM-dd").equals(days) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | .map(i->i.getMemberPhone()) | 
|---|
|  |  |  | .collect(Collectors.toList()); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | visitVO.setName(days); | 
|---|
|  |  |  | weekVisitList.add(visitVO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | InterestedListVO carVO = new InterestedListVO(); | 
|---|
|  |  |  | carVO.setNum(Constants.ZERO); | 
|---|
|  |  |  | carVO.setName(days); | 
|---|
|  |  |  | 
|---|
|  |  |  | //                    List<CarEvent> daysList = carEventList.stream().filter(i->StringUtils.isNotBlank(i.getHappenTime()) && i.getHappenTime().substring(0,10).equals(days)).collect(Collectors.toList()); | 
|---|
|  |  |  | //                    List<String> carCodeList = daysList.stream().map(i->i.getPlateNos()).collect(Collectors.toList()); | 
|---|
|  |  |  | List<String> carCodeList  = inoutRecordList.stream().filter(i-> | 
|---|
|  |  |  | Objects.isNull(i.getCarCode())&& | 
|---|
|  |  |  | Objects.nonNull(i.getMemberPhone())&&DateUtil.dateToString(i.getTimeInfo(),"yyyy-MM-dd").equals(days) | 
|---|
|  |  |  | Objects.nonNull(i.getCarCode()) | 
|---|
|  |  |  | && Constants.equalsInteger(i.getInOrOut(),Constants.ZERO) | 
|---|
|  |  |  | &&DateUtil.dateToString(i.getTimeInfo(),"yyyy-MM-dd").equals(days) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | .map(i->i.getMemberPhone()) | 
|---|
|  |  |  | .map(i->i.getCarCode()) | 
|---|
|  |  |  | .collect(Collectors.toList()); | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(carCodeList)){ | 
|---|
|  |  |  | carVO.setNum(new HashSet<String>(carCodeList).size()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(Objects.isNull(carVO.getNum())){ | 
|---|
|  |  |  | visitVO.setNum(Constants.ZERO); | 
|---|
|  |  |  | carVO.setNum(Constants.ZERO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | weekVisitList.add(visitVO); | 
|---|
|  |  |  | weekCarList.add(carVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | pcWorkPlatformDataVO.setWeekVisitList(weekVisitList ); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Company> companyList = companyMapper.selectList(new QueryWrapper<Company>().lambda() | 
|---|
|  |  |  | .eq(Company::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .orderByAsc(Company::getSortnum) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(companyList)){ | 
|---|