| | |
| | | @Autowired |
| | | private InoutDayCountMapper inoutDayCountMapper; |
| | | @Autowired |
| | | private InoutRecordMapper inoutRecordMapper; |
| | | @Autowired |
| | | private CarEventMapper carEventMapper; |
| | | |
| | | @Autowired |
| | |
| | | if (erpVisitDTO.getEndtime().getTime() <= erpVisitDTO.getStarttime().getTime()) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约结束时间必须大于开始时间!"); |
| | | } |
| | | if (Constants.equalsInteger(Constants.ZERO, erpVisitDTO.getIdcardType()) && erpVisitDTO.getIdcardNo().length() != 18 |
| | | if (StringUtils.isNotBlank(erpVisitDTO.getIdcardNo()) && Constants.equalsInteger(Constants.ZERO, erpVisitDTO.getIdcardType()) && erpVisitDTO.getIdcardNo().length() != 18 |
| | | //&&!IdcardUtil.isValidCard(visits.getIdcardNo()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证号码有误,请核实后重试!"); |
| | |
| | | getHkDeviceRoles(visits,isERP); |
| | | //检验拜访人是否合法 |
| | | Member visitMember = isValideVisitedUser(visits.getReceptMemberId()); |
| | | if(Constants.equalsInteger(Constants.ZERO, visits.getIdcardType()) |
| | | &&visits.getIdcardNo().length()!=18 |
| | | ){ |
| | | if(StringUtils.isNotBlank(visits.getIdcardNo()) && Constants.equalsInteger(Constants.ZERO, visits.getIdcardType()) |
| | | &&visits.getIdcardNo().length()!=18 ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证号码有误,请核实后重试!"); |
| | | } |
| | | Date date = new Date(); |
| | |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz, |
| | | wxNoticeConfigMapper,visits, |
| | | Constants.equalsInteger(visits.getType(),Constants.TWO)?WxPlatConstants.visitReportContent.visitReportUpload:WxPlatConstants.visitContent.visitUpload, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Constants.equalsInteger(visits.getType(),Constants.TWO)?WxPlatConstants.visitReportContent.visitReportUpload:WxPlatConstants.visitContent.visitUpload, |
| | | Arrays.asList(visits.getOpenid().split(",")) |
| | | ); |
| | | } |
| | |
| | | |
| | | return visits.getId(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | |
| | | wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz, |
| | | wxNoticeConfigMapper,visits, |
| | | Constants.equalsInteger(visits.getType(),Constants.TWO)?WxPlatConstants.visitReportContent.visitReportUpload:WxPlatConstants.visitContent.visitUpload, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(systemUser.getOpenid().split(",")) |
| | | ); |
| | | } |
| | |
| | | queryWrapper.isNull(Visits::getParentId); |
| | | queryWrapper.eq(Objects.nonNull(pageWrap.getModel().getMemberId()),Visits::getMemberId,pageWrap.getModel().getMemberId()); |
| | | queryWrapper.eq(Objects.nonNull(pageWrap.getModel().getReceptMemberId()),Visits::getReceptMemberId,pageWrap.getModel().getReceptMemberId()); |
| | | queryWrapper.ge(Objects.nonNull(pageWrap.getModel().getQueryStarttime()),Visits::getStarttime,Utils.Date.getStart(pageWrap.getModel().getQueryStarttime())); |
| | | queryWrapper.le(Objects.nonNull(pageWrap.getModel().getQueryEndtime()),Visits::getStarttime,Utils.Date.getEnd(pageWrap.getModel().getQueryEndtime())); |
| | | |
| | | |
| | | if(Objects.nonNull(pageWrap.getModel().getBusinessStatus())){ |
| | | if(Constants.equalsInteger(pageWrap.getModel().getBusinessStatus(),Constants.TWO)){ |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public void visitLevelForCarOut(Visits visits){ |
| | | visits.setRemark("跟随访客车辆离园自动签离"); |
| | | visitLevelBiz(visits); |
| | | } |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public void visitLevel(Integer visitId){ |
| | | Visits visits = visitsMapper.selectById(visitId); |
| | | visits.setRemark("平台管理员手动签离成功"); |
| | | visitLevelBiz(visits); |
| | | //产出在场人员信息 |
| | | retentionMapper.delete(new UpdateWrapper<Retention>().lambda() |
| | | .eq(Retention::getType,Constants.memberType.visitor) |
| | | .eq(Retention::getMemberId,visits.getMemberId())); |
| | | } |
| | | |
| | | private void visitLevelBiz(Visits visits) { |
| | | if(Objects.isNull(visits)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | |
| | | request.setOrderId(visits.getHkId()); |
| | | //调用海康强制签离 |
| | | BaseResponse response = HKService.iccmSignoff(request); |
| | | // BaseResponse response = HKService.outVisitAppiontment(request); |
| | | visitsMapper.update(null,new UpdateWrapper<Visits>().lambda().set(Visits::getStatus,Constants.VisitStatus.signout) |
| | | .eq(Visits::getId,visitId)); |
| | | //产出在场人员信息 |
| | | retentionMapper.delete(new UpdateWrapper<Retention>().lambda() |
| | | .eq(Retention::getType,Constants.memberType.visitor) |
| | | .eq(Retention::getMemberId,visits.getMemberId())); |
| | | if(response!=null &&StringUtils.isNotBlank(response.getCode()) && StringUtils.equals(response.getCode(),HKConstants.RESPONSE_SUCCEE)){ |
| | | visitsMapper.update(null,new UpdateWrapper<Visits>().lambda() |
| | | .set(Visits::getStatus,Constants.VisitStatus.signout) |
| | | .set(Visits::getRemark,visits.getRemark()) |
| | | .eq(Visits::getId,visits.getId())); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"访客签离失败,请刷新重试"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void visitCancel(Integer visitId){ |
| | | Visits visits = visitsMapper.selectById(visitId); |
| | |
| | | .eq(Notices::getStatus,Constants.ZERO) |
| | | .eq(Notices::getParam2,Constants.ZERO)//待处理 |
| | | .eq(Notices::getObjId,visits.getId()) |
| | | .eq(Notices::getObjType,Constants.equalsInteger(visits.getType(),Constants.ZERO)?Constants.noticesObjectType.visit:Constants.noticesObjectType.visitReporting) |
| | | .eq(Notices::getObjType,!Constants.equalsInteger(visits.getType(),Constants.TWO)? |
| | | Constants.noticesObjectType.visit:Constants.noticesObjectType.visitReporting) |
| | | ); |
| | | |
| | | Approve approve = new Approve(); |
| | |
| | | .apply(" DATE(TIME_INFO) = CURDATE() ") |
| | | .last(" limit 1 ") |
| | | ); |
| | | |
| | | |
| | | //今日在园人数 |
| | | pcWorkPlatformDataVO.setTodayInParkUserNum( |
| | | retentionList.stream().filter(i->!Constants.equalsInteger(i.getType(),Constants.THREE)).count() |
| | | inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda() |
| | | .isNotNull(InoutRecord::getMemberPhone) |
| | | .isNull(InoutRecord::getCarCode) |
| | | .apply( " DATE(TIME_INFO) = CURDATE() " )) |
| | | //retentionList.stream().filter(i->!Constants.equalsInteger(i.getType(),Constants.THREE)).count() |
| | | ); |
| | | |
| | | pcWorkPlatformDataVO.setTodayInUserNum(Constants.ZERO); |
| | |
| | | |
| | | //在园长期相关方人数 |
| | | pcWorkPlatformDataVO.setInParkLwUserNum( |
| | | retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.TWO) |
| | | && Constants.equalsInteger(i.getCompanyType(),Constants.ZERO)).count() |
| | | inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda() |
| | | .eq(InoutRecord::getMemberType,Constants.TWO) |
| | | .isNotNull(InoutRecord::getMemberPhone) |
| | | .isNull(InoutRecord::getCarCode) |
| | | .apply( " DATE(TIME_INFO) = CURDATE() " )) |
| | | // retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.TWO) |
| | | // && Constants.equalsInteger(i.getCompanyType(),Constants.ZERO)).count() |
| | | ); |
| | | pcWorkPlatformDataVO.setLwUserInNum(Constants.ZERO); |
| | | pcWorkPlatformDataVO.setLwUserOutNum(Constants.ZERO); |
| | |
| | | |
| | | //在园访客数量 |
| | | pcWorkPlatformDataVO.setInParkVisitUserNum( |
| | | retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&Objects.isNull(i.getCompanyType())).count() |
| | | inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda() |
| | | .eq(InoutRecord::getMemberType,Constants.ZERO) |
| | | .isNotNull(InoutRecord::getMemberPhone) |
| | | .isNull(InoutRecord::getCarCode) |
| | | .apply( " DATE(TIME_INFO) = CURDATE() " )) |
| | | //retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&Objects.isNull(i.getCompanyType())).count() |
| | | ); |
| | | pcWorkPlatformDataVO.setVisitUserNum(Constants.ZERO); |
| | | pcWorkPlatformDataVO.setSignLevelNum(Constants.ZERO); |
| | | |
| | | //在园货运车辆司机 |
| | | pcWorkPlatformDataVO.setInParkDriverUserNum(inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda() |
| | | .eq(InoutRecord::getMemberType,Constants.THREE) |
| | | .isNotNull(InoutRecord::getMemberPhone) |
| | | .isNull(InoutRecord::getCarCode) |
| | | .apply( " DATE(TIME_INFO) = CURDATE() " ))); |
| | | |
| | | //在园车辆 |
| | | pcWorkPlatformDataVO.setTodayInParkCarNum( |
| | | retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.THREE)).count() |
| | | inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda() |
| | | .isNotNull(InoutRecord::getCarCode) |
| | | .isNull(InoutRecord::getMemberPhone) |
| | | .apply( " DATE(TIME_INFO) = CURDATE() " )) |
| | | //retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.THREE)).count() |
| | | ); |
| | | pcWorkPlatformDataVO.setTodayInCarNum(Constants.ZERO); |
| | | pcWorkPlatformDataVO.setTodayOutCarNum(Constants.ZERO); |
| | |
| | | List<InterestedListVO> weekVisitList = new ArrayList<>(); |
| | | List<InterestedListVO> weekCarList = new ArrayList<>(); |
| | | List<InterestedListVO> lwList = new ArrayList<>(); |
| | | List<InterestedListVO> internalList = new ArrayList<>(); |
| | | //查询七天前的访客记录数量 |
| | | List<Visits> visitsList = visitsMapper.selectList(new QueryWrapper<Visits>().lambda().in(Visits::getStatus, |
| | | Constants.VisitStatus.signin,Constants.VisitStatus.signout) |
| | |
| | | .eq(Company::getIsdeleted,Constants.ZERO) |
| | | ); |
| | | |
| | | |
| | | |
| | | if(CollectionUtils.isNotEmpty(companyList)){ |
| | | List<Integer> companyIds = companyList.stream().map(i->i.getId()).collect(Collectors.toList()); |
| | | List<Retention> retentionList = retentionMapper.selectList( |
| | | new QueryWrapper<Retention>().lambda() |
| | | .eq(Retention::getType,Constants.TWO) |
| | | .in(Retention::getCompanyId,companyIds) |
| | | ); |
| | | for (Company company:companyList) { |
| | | Integer count = retentionList.stream().filter(i->Constants.equalsInteger(i.getCompanyId(),company.getId())).collect(Collectors.toList()).size(); |
| | | if(count>0){ |
| | | InterestedListVO lw = new InterestedListVO(); |
| | | lw.setNum(count); |
| | | lw.setName(company.getName()); |
| | | lwList.add(lw); |
| | | List<Company> lwCompanyList = companyList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList()); |
| | | if(CollectionUtils.isNotEmpty(lwCompanyList)){ |
| | | List<Integer> lwCompanyIds = lwCompanyList.stream().map(i->i.getId()).collect(Collectors.toList()); |
| | | List<Retention> retentionList = retentionMapper.selectList( |
| | | new QueryWrapper<Retention>().lambda() |
| | | .eq(Retention::getType,Constants.TWO) |
| | | .in(Retention::getCompanyId,lwCompanyIds) |
| | | ); |
| | | for (Company company:lwCompanyList) { |
| | | Integer count = retentionList.stream().filter(i->Constants.equalsInteger(i.getCompanyId(),company.getId())).collect(Collectors.toList()).size(); |
| | | if(count>0){ |
| | | InterestedListVO lw = new InterestedListVO(); |
| | | lw.setNum(count); |
| | | lw.setName(company.getName()); |
| | | lwList.add(lw); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<Company> internalCompanyList = companyList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)).collect(Collectors.toList()); |
| | | if(CollectionUtils.isNotEmpty(internalCompanyList)){ |
| | | List<Integer> internalCompanyIds = internalCompanyList.stream().map(i->i.getId()).collect(Collectors.toList()); |
| | | List<Retention> retentionList = retentionMapper.selectList( |
| | | new QueryWrapper<Retention>().lambda() |
| | | .eq(Retention::getType,Constants.TWO) |
| | | .in(Retention::getCompanyId,internalCompanyIds) |
| | | ); |
| | | for (Company company:internalCompanyList) { |
| | | Integer count = retentionList.stream().filter(i->Constants.equalsInteger(i.getCompanyId(),company.getId())).collect(Collectors.toList()).size(); |
| | | if(count>0){ |
| | | InterestedListVO lw = new InterestedListVO(); |
| | | lw.setNum(count); |
| | | lw.setName(company.getName()); |
| | | internalList.add(lw); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | pcWorkPlatformDataVO.setLwList(lwList ); |
| | | pcWorkPlatformDataVO.setInternalList(internalList); |
| | | pcWorkPlatformDataVO.setLwList(lwList); |
| | | }else if(Constants.equalsInteger(queryType,Constants.THREE)) { |
| | | if (Objects.isNull(loginUserInfo.getMemberId())) { |
| | | pcWorkPlatformDataVO.setNoticesList(new ArrayList<>()); |
| | |
| | | List<Visits> visitsList = visitsMapper.selectList(new QueryWrapper<Visits>().lambda() |
| | | .eq(Visits::getStatus,Constants.VisitStatus.signin) |
| | | .eq(Visits::getSendTimeOutNotice,Constants.ZERO) |
| | | .eq(Visits::getIsdeleted,Constants.ZERO) |
| | | .apply(" now() >= DATE_ADD(ENDTIME,INTERVAL -"+times+" MINUTE) ") |
| | | ); |
| | | Integer visitTimeCount = 0; |