| | |
| | | //普通访客 |
| | | visits.setType(Constants.ONE); |
| | | //随行人员数量 |
| | | visits.setMemberNum(CollectionUtils.isNotEmpty(visits.getWithUserList())?visits.getWithUserList().size()+1:1); |
| | | visits.setMemberNum(CollectionUtils.isNotEmpty(visits.getWithUserList())?visits.getWithUserList().size():0); |
| | | //访客信息(使用身份证号查询是否已存在改普通访客,没有则新增,存在则更新openid等信息),包括随访人员校验和处理 |
| | | Member member =dealMemberAndVisits(visits); |
| | | visits.setMemberId(member.getId()); |
| | | visits.setVisitType(Integer.valueOf(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.MDJ_VISIT_REQUIRED).getCode())); |
| | | //初始化访客信息 |
| | | initVisitInfo(visits,date); |
| | | visitsMapper.insert(visits); |
| | |
| | | v.setHkStatus(Constants.ZERO); |
| | | v.setReason(visits.getReason()); |
| | | v.setDoors(visits.getDoors()); |
| | | v.setType(visits.getType()); |
| | | v.setVisitType(visits.getVisitType()); |
| | | v.setStatus(Constants.VisitStatus.submitCheck); |
| | | } |
| | | //批量插入数据 |
| | |
| | | } |
| | | |
| | | private Member getMemberListParam(String cardno, Visits visits, List<Member> addList, List<Member> editList) { |
| | | if(!StringUtils.isNotBlank(visits.getCarNos()) |
| | | // &&!Constants.checkCarNo(visits.getCarNos()) |
| | | if(StringUtils.isNotBlank(visits.getCarNos()) |
| | | &&Objects.isNull(Constants.getVehiclePlateNo(visits.getCarNos())) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,车牌号【"+visits.getCarNos()+"】不合法,请核实后重试~"); |
| | | } |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,该身份证号被禁止访问申请,如有疑问,请联系您的拜访人进行核实"); |
| | | } |
| | | //核查预约用户是否存在未签离的预约记录 |
| | | isExsitNoOutVisisRecord(member); |
| | | |
| | | // isExsitNoOutVisisRecord(member); |
| | | |
| | | member.setFaceImg(visits.getFaceImg()); |
| | | member.setImgurl(StringUtils.isNotBlank(visits.getImgurl())?visits.getImgurl():null); |
| | | member.setEditDate(visits.getCreateDate()); |
| | |
| | | member.setErpStatus(Constants.ZERO); |
| | | member.setVisitCompanyName(visits.getCompanyName()); |
| | | memberMapper.updateById(member); |
| | | // 更新访客信息, |
| | | // editList.add(member); |
| | | } |
| | | //根据手机号和身份证号码查询 当前预约的时间是否与其他预约记录有冲突 |
| | | if (visitsMapper.selectCount(new QueryWrapper<Visits>().lambda() |
| | | .notIn(Visits::getStatus,Constants.VisitStatus.cancel,Constants.VisitStatus.cancel,Constants.VisitStatus.noPass,Constants.VisitStatus.xfFail) |
| | | .and(ms -> ms.eq(Visits::getPhone, visits.getPhone()) |
| | | .or().eq(Visits::getIdcardDecode, Constants.getTuominStr(cardno))) |
| | | .notIn(Visits::getStatus,Constants.VisitStatus.cancel,Constants.VisitStatus.noPass,Constants.VisitStatus.xfFail,Constants.VisitStatus.signout,Constants.VisitStatus.invalid) |
| | | .eq(Visits::getIdcardDecode, Constants.getTuominStr(cardno)) |
| | | .and(ms -> ms.apply(" visits.STARTTIME <= '" + DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm:ss") + "' and visits.ENDTIME >= '" + DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm:ss") + "' ") |
| | | .or().apply(" visits.STARTTIME <= '" + DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm:ss") + "' and visits.ENDTIME >= '" + DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm:ss") + "' ") |
| | | )) > Constants.ZERO) { |
| | |
| | | MPJLambdaWrapper<Visits> queryWrapper = new MPJLambdaWrapper<>(); |
| | | |
| | | 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.selectAs(Member::getName,Visits::getReceptMemberName); |
| | | queryWrapper.selectAs(Company::getName,Visits::getReceptMemberDepartment); |
| | | queryWrapper.leftJoin(Member.class,Member::getId,Visits::getReceptMemberId); |
| | |
| | | queryWrapper.isNull(Visits::getParentId); |
| | | queryWrapper.orderByDesc(Visits::getCreateDate); |
| | | IPage<Visits> result = visitsJoinMapper.selectJoinPage(page, Visits.class,queryWrapper); |
| | | |
| | | for (Visits visits:result.getRecords()) { |
| | | if(StringUtils.isNotBlank(visits.getCarNos())){ |
| | | visits.setCarNum(visits.getCarNum() + Constants.ONE); |
| | | } |
| | | } |
| | | return PageData.from(result); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public PageData<Visits> retentionPage(PageWrap<Visits> pageWrap) { |
| | | String code= systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.TIMEOUT_WARNING).getCode(); |
| | | IPage<Visits> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<Visits> queryWrapper = new MPJLambdaWrapper<>(); |
| | | |
| | | queryWrapper.selectAll(Visits.class); |
| | | queryWrapper.selectAs(Member::getName,Visits::getReceptMemberName); |
| | | queryWrapper.select("TIMESTAMPDIFF(MINUTE,t.ENDTIME , NOW()) AS timeOut"); |
| | | queryWrapper.select("TIMESTAMPDIFF( MINUTE, NOW(), t.OUT_DATE) AS timeOut"); |
| | | queryWrapper.selectAs(Member::getType,Visits::getMemberType); |
| | | queryWrapper.selectAs(Company::getName,Visits::getReceptMemberDepartment); |
| | | queryWrapper.leftJoin(Member.class,Member::getId,Visits::getReceptMemberId); |
| | | queryWrapper.leftJoin(Company.class,Company::getId,Member::getCompanyId); |
| | | queryWrapper.leftJoin(" member m on m.id=t.MEMBER_ID"); |
| | | queryWrapper.leftJoin(" member m on m.id= t.MEMBER_ID"); |
| | | |
| | | queryWrapper.eq(Objects.nonNull(pageWrap.getModel().getLevelStatus()),Visits::getStatus,Constants.VisitStatus.signin); |
| | | |
| | | queryWrapper.apply(Objects.nonNull(pageWrap.getModel().getLevelStatus())," TIMESTAMPDIFF( MINUTE, NOW(), t.OUT_DATE) <= "+code+" "); |
| | | |
| | | queryWrapper.ne("m.type ",Constants.TWO); |
| | | queryWrapper.eq(Visits::getIsdeleted,Constants.ZERO); |
| | | queryWrapper.eq(Objects.nonNull(pageWrap.getModel().getType()),Visits::getType,pageWrap.getModel().getType()); |
| | |
| | | .eq(StringUtils.isNotBlank(pageWrap.getModel().getIdcardNo()),Visits::getIdcardNo,StringUtils.isNotBlank(pageWrap.getModel().getIdcardNo())) |
| | | .eq(StringUtils.isNotBlank(pageWrap.getModel().getCompanyName()),Visits::getCompanyName,pageWrap.getModel().getCompanyName()) |
| | | .eq(Objects.nonNull(pageWrap.getModel().getStatus()),Visits::getStatus,pageWrap.getModel().getStatus()); |
| | | queryWrapper.isNull(Visits::getOutDate); |
| | | queryWrapper.isNull(!Objects.nonNull(pageWrap.getModel().getLevelStatus()),Visits::getOutDate); |
| | | queryWrapper.orderByDesc(Visits::getEditDate); |
| | | String code= systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.TIMEOUT_FREEZE).getCode(); |
| | | IPage<Visits> result = visitsJoinMapper.selectJoinPage(page, Visits.class,queryWrapper); |
| | | if(result!=null&&result.getRecords()!=null){ |
| | | result.getRecords().stream().forEach(s ->{ |
| | | if(s.getTimeOut()>=Constants.ZERO){ |
| | | s.setOutStatus(Constants.ONE); |
| | | }else if(s.getTimeOut()<=Integer.valueOf(code)&&s.getTimeOut()>0){ |
| | | s.setOutStatus(Constants.TWO); |
| | | }else{ |
| | | s.setOutStatus(Constants.ZERO); |
| | | if(s.getStatus().equals(Constants.VisitStatus.signin)){ |
| | | if(s.getTimeOut()<=Integer.valueOf(code)&&s.getTimeOut()>=0){ |
| | | s.setOutStatus(Constants.TWO); |
| | | }else if(s.getTimeOut()>Constants.ZERO){ |
| | | s.setOutStatus(Constants.ZERO); |
| | | }else{ |
| | | s.setOutStatus(Constants.ONE); |
| | | } |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | |
| | | VisitDetailVO visitDetailVO = new VisitDetailVO(); |
| | | visitDetailVO.setStatus(visits.getStatus()); |
| | | visitDetailVO.setCarNos(visits.getCarNos()); |
| | | visitDetailVO.setPhone(visits.getPhone()); |
| | | visitDetailVO.setVisitUserName(member.getName()); |
| | | visitDetailVO.setVisitReason(visits.getReason()); |
| | | visitDetailVO.setQrcode(visits.getQrcode()); |
| | | visitDetailVO.setVisitTime(DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm") + " 至 " + DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm") ); |
| | | //被访人员部门 |
| | | Company company = companyMapper.selectById(member.getCompanyId()); |
| | |
| | | } |
| | | visitDetailVO.setWithVisitsList( |
| | | visitsMapper.selectList(new QueryWrapper<Visits>().lambda() |
| | | .select(Visits::getName,Visits::getPhone,Visits::getFaceImg,Visits::getImgurl,Visits::getIdcardDecode,Visits::getStatus) |
| | | .select(Visits::getName,Visits::getPhone,Visits::getQrcode,Visits::getFaceImg,Visits::getImgurl,Visits::getIdcardDecode,Visits::getStatus) |
| | | .eq(Visits::getParentId,id))); |
| | | return visitDetailVO; |
| | | } |