|  |  | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.core.haikang.model.HKConstants; | 
 |  |  | import com.doumee.core.haikang.model.param.BaseResponse; | 
 |  |  | import com.doumee.core.haikang.model.param.request.FacePictureCheckRequest; | 
 |  |  | import com.doumee.core.haikang.model.param.request.VisitAppointmentOutRequest; | 
 |  |  | import com.doumee.core.haikang.model.param.request.VisitAppointmentRequest; | 
 |  |  | import com.doumee.core.haikang.model.param.respose.FacePictureCheckResponse; | 
 |  |  | import com.doumee.core.haikang.model.param.respose.VisitAppointmentResponse; | 
 |  |  | import com.doumee.core.haikang.service.HKService; | 
 |  |  | import com.doumee.core.model.LoginUserInfo; | 
 |  |  | import com.doumee.core.model.PageData; | 
 |  |  | import com.doumee.core.model.PageWrap; | 
 |  |  | 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.*; | 
 |  |  | import com.doumee.core.wx.WXConstant; | 
 |  |  | import com.doumee.core.wx.wxPlat.WxPlatConstants; | 
 |  |  | import com.doumee.core.wx.wxPlat.WxPlatNotice; | 
 |  |  | import com.doumee.dao.admin.response.InterestedListVO; | 
 |  |  | import com.doumee.dao.admin.response.PCWorkPlatformDataVO; | 
 |  |  | import com.doumee.dao.business.*; | 
 |  |  | import com.doumee.dao.business.dao.CompanyMapper; | 
 |  |  | import com.doumee.dao.business.dao.MemberMapper; | 
 |  |  | import com.doumee.dao.business.dao.SmsConfigMapper; | 
 |  |  | import com.doumee.dao.business.dao.SmsEmailMapper; | 
 |  |  | import com.doumee.dao.business.dto.ResetPasswordDTO; | 
 |  |  | 
 |  |  | import com.doumee.dao.business.join.VisitsJoinMapper; | 
 |  |  | import com.doumee.dao.business.model.*; | 
 |  |  |  | 
 |  |  | import com.doumee.dao.business.model.Member; | 
 |  |  | import com.doumee.dao.system.SystemUserMapper; | 
 |  |  | import com.doumee.dao.system.dto.ResetSystemUserPwdDTO; | 
 |  |  | import com.doumee.dao.system.join.NoticesJoinMapper; | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private RetentionMapper retentionMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private VisitsMapper visitsMapper; | 
 |  |  |     private VisitsJoinMapper visitsMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private ApproveMapper approveMapper; | 
 |  |  |     @Autowired | 
 |  |  | 
 |  |  |             } | 
 |  |  |             if (Constants.equalsInteger(Constants.ZERO, erpVisitDTO.getIdcardType()) && erpVisitDTO.getIdcardNo().length() != 18 | 
 |  |  |                 //&&!IdcardUtil.isValidCard(visits.getIdcardNo()) | 
 |  |  |             ) { | 
 |  |  |             ){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证号码有误,请核实后重试!"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             Visits visits = new Visits(); | 
 |  |  |             //根据被访问人ERP主键查询系统内人员主键信息 | 
 |  |  |             Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda() | 
 |  |  | 
 |  |  |     @Override | 
 |  |  |     @Transactional(rollbackFor = {BusinessException.class,Exception.class}) | 
 |  |  |     public Integer createFk(Visits visits,Boolean isERP,Integer source) { | 
 |  |  |         visits.setId(null); | 
 |  |  |         isValidBaseParam(visits); | 
 |  |  |         //检查是否必须答题,并且符合答题要求 | 
 |  |  |         ProblemLog problemLog = isValidProblemLog(visits,source); | 
 |  |  | 
 |  |  |         //发送微信公众号通知 - 申请提交成功待审核 | 
 |  |  |         if(StringUtils.isNotBlank(visits.getOpenid())){ | 
 |  |  |             WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
 |  |  |             wxPlatNotice.sendVisitTemplateNotice( | 
 |  |  |             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(), | 
 |  |  | 
 |  |  |         //初始化访客信息 | 
 |  |  | //        initVisitInfo(visits,date); | 
 |  |  |         visitsMapper.insert(visits); | 
 |  |  |         if(Objects.nonNull(visits.getLoginUserInfo())){ | 
 |  |  |             SystemUser systemUser = systemUserMapper.selectById(visits.getLoginUserInfo().getId()); | 
 |  |  |             if(Objects.nonNull(systemUser)&&StringUtils.isNotBlank(systemUser.getOpenid())){ | 
 |  |  |                 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(), | 
 |  |  |                         Arrays.asList(systemUser.getOpenid().split(",")) | 
 |  |  |                 ); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         approveService.createApproveFlow(visits.getType(),visits.getId(),visits.getReceptMemberId()); | 
 |  |  |         return visits.getId(); | 
 |  |  |     } | 
 |  |  | 
 |  |  |             result.setBusinessStatus(result.getStatus()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         Notices notices = noticesJoinMapper.selectOne(new QueryWrapper<Notices>().lambda() | 
 |  |  |                 .eq(Notices::getObjId,id) | 
 |  |  |                 .eq(Notices::getType,Constants.equalsInteger(result.getType(),Constants.TWO)?Constants.noticesObjectType.visitReporting:Constants.noticesObjectType.visit) | 
 |  |  |                 .eq(Notices::getUserId,memberId) | 
 |  |  |                 .eq(Notices::getSendacopy,Constants.ZERO) | 
 |  |  |                 .orderByDesc(Notices::getId).last(" limit 1 ")); | 
 |  |  |         if(Objects.nonNull(notices)){ | 
 |  |  |             if(Constants.equalsInteger(notices.getStatus(),Constants.ZERO)){ | 
 |  |  |                 result.setInfo("待我处理"); | 
 |  |  |             }else{ | 
 |  |  |                 result.setInfo(notices.getInfo()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |         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()); | 
 |  |  |  | 
 |  |  |         if(Objects.nonNull(pageWrap.getModel().getBusinessStatus())){ | 
 |  |  |             if(Constants.equalsInteger(pageWrap.getModel().getBusinessStatus(),Constants.TWO)){ | 
 |  |  |                 queryWrapper.in(Visits::getStatus, | 
 |  |  |                         Constants.VisitStatus.xfSuccess, | 
 |  |  |                         Constants.VisitStatus.xfFail, | 
 |  |  |                         Constants.VisitStatus.signin, | 
 |  |  |                         Constants.VisitStatus.signout, | 
 |  |  |                         Constants.VisitStatus.invalid, | 
 |  |  |                         Constants.VisitStatus.pass | 
 |  |  |                         ); | 
 |  |  |             }else{ | 
 |  |  |                 queryWrapper.eq(Visits::getStatus,pageWrap.getModel().getBusinessStatus()); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         queryWrapper.orderByDesc(Visits::getCreateDate); | 
 |  |  |         IPage<Visits> result = visitsJoinMapper.selectJoinPage(page, Visits.class,queryWrapper); | 
 |  |  |  | 
 |  |  | 
 |  |  |                             memberId) | 
 |  |  |             ); | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |         Notices notices = noticesJoinMapper.selectOne(new QueryWrapper<Notices>().lambda() | 
 |  |  |                 .eq(Notices::getObjId,id) | 
 |  |  |                 .eq(Notices::getType,Constants.equalsInteger(visits.getType(),Constants.TWO)?Constants.noticesObjectType.visitReporting:Constants.noticesObjectType.visit) | 
 |  |  |                 .eq(Notices::getUserId,memberId) | 
 |  |  |                 .eq(Notices::getSendacopy,Constants.ZERO) | 
 |  |  |                 .orderByDesc(Notices::getId).last(" limit 1 ")); | 
 |  |  |         if(Objects.nonNull(notices)){ | 
 |  |  |             if(Constants.equalsInteger(notices.getStatus(),Constants.ZERO)){ | 
 |  |  |                 visitDetailVO.setInfo("待我处理"); | 
 |  |  |             }else{ | 
 |  |  |                 visitDetailVO.setInfo(notices.getInfo()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return visitDetailVO; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |         dto.setPassword(resetPasswordDTO.getPassword()); | 
 |  |  |         dto.setId(systemUser.getId()); | 
 |  |  |         dto.setOperaUserId(systemUser.getId()); | 
 |  |  |         dto.setNeedChangePwd(Constants.ONE); | 
 |  |  |         systemUserBiz.resetPwd(dto); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |                             .selectAll(Retention.class) | 
 |  |  |                             .selectAs(Company::getType,Retention::getCompanyType) | 
 |  |  |                             .leftJoin(Company.class,Company::getId,Retention::getCompanyId) | 
 |  |  |                             .eq(Retention::getIsdeleted,Constants.ZERO) | 
 |  |  |             ); | 
 |  |  |  | 
 |  |  |             InoutDayCount inoutDayCount = inoutDayCountMapper.selectOne(new QueryWrapper<InoutDayCount>() | 
 |  |  | 
 |  |  |                 ); | 
 |  |  |                 for (Company company:companyList) { | 
 |  |  |                     Integer count = retentionList.stream().filter(i->Constants.equalsInteger(i.getCompanyId(),company.getId())).collect(Collectors.toList()).size(); | 
 |  |  |                     InterestedListVO lw = new InterestedListVO(); | 
 |  |  |                     lw.setNum(count); | 
 |  |  |                     lw.setName(company.getName()); | 
 |  |  |                     lwList.add(lw); | 
 |  |  |                     if(count>0){ | 
 |  |  |                         InterestedListVO lw = new InterestedListVO(); | 
 |  |  |                         lw.setNum(count); | 
 |  |  |                         lw.setName(company.getName()); | 
 |  |  |                         lwList.add(lw); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  | 
 |  |  |                 SmsEmailServiceImpl.sendVisitTimeOutSms(systemDictDataBiz, | 
 |  |  |                         emayService,smsEmailMapper,smsConfigMapper, | 
 |  |  |                         SmsConstants.visitContent.visitTimeOutSignOutNum, | 
 |  |  |                         visitReportTimeCount.toString(),Arrays.asList(mobile.split(",")) | 
 |  |  |                         visitTimeCount.toString(),Arrays.asList(mobile.split(",")) | 
 |  |  |                 ); | 
 |  |  |             } | 
 |  |  |         } |