|  |  |  | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.VisitRecordDTO; | 
|---|
|  |  |  | import com.doumee.dao.web.response.VisitDetailVO; | 
|---|
|  |  |  | import com.doumee.dao.web.response.VisitRecordVO; | 
|---|
|  |  |  | import com.doumee.service.business.ApproveService; | 
|---|
|  |  |  | import com.doumee.service.business.InterfaceLogService; | 
|---|
|  |  |  | import com.doumee.service.business.SmsEmailService; | 
|---|
|  |  |  | import com.doumee.service.business.VisitsService; | 
|---|
|  |  |  | 
|---|
|  |  |  | private SmsEmailService smsEmailService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemUserMapper systemUserMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApproveService approveService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | }else if(dataSyncConfig.getVisitorDataOrigin().equals(Constants.ZERO)){ | 
|---|
|  |  |  | visits.setStatus(Constants.VisitStatus.pass); | 
|---|
|  |  |  | visitsMapper.updateById(visits); | 
|---|
|  |  |  | approveService.createApproveFlow(visits.getType(),visits.getId(),visits.getReceptMemberId()); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,发起拜访审批申请失败!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | approve.setIsEndCheck(Constants.ZERO); | 
|---|
|  |  |  | approve.setType(Constants.ZERO); | 
|---|
|  |  |  | approve.setLevel(Constants.ONE); | 
|---|
|  |  |  | approve.setVisitId(visits.getId()); | 
|---|
|  |  |  | approve.setObjId(visits.getId()); | 
|---|
|  |  |  | approveMapper.insert(approve); | 
|---|
|  |  |  | if(!CollectionUtils.isNotEmpty(approveIds)){ | 
|---|
|  |  |  | approve.setIsEndCheck(Constants.ONE); | 
|---|
|  |  |  | 
|---|
|  |  |  | if(approve.getStatus().equals(Constants.approveStatus.wait)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批记录已处理!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Visits visits = visitsMapper.selectById(approve.getVisitId()); | 
|---|
|  |  |  | Visits visits = visitsMapper.selectById(approve.getObjId()); | 
|---|
|  |  |  | if(Objects.isNull(visits)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if(approve.getApproveType().equals(Constants.ONE)){ | 
|---|
|  |  |  | //会签 查询是否是最后一条记录 如果是最后一条记录 则生成下级审批记录 如果是最后一级,则进行审批确认 | 
|---|
|  |  |  | if(approveMapper.selectCount(new QueryWrapper<Approve>().lambda() | 
|---|
|  |  |  | .eq(Approve::getVisitId,visits.getId()) | 
|---|
|  |  |  | .eq(Approve::getObjId,visits.getId()) | 
|---|
|  |  |  | .eq(Approve::getLevel,approve.getLevel()) | 
|---|
|  |  |  | .ne(Approve::getId,approve.getId()) | 
|---|
|  |  |  | )<=Constants.ZERO){ | 
|---|
|  |  |  | 
|---|
|  |  |  | .set(Approve::getStatus,Constants.approveStatus.otherDeal) | 
|---|
|  |  |  | .set(Approve::getEditDate,new Date()) | 
|---|
|  |  |  | .set(Approve::getCheorId,auditApproveDTO.getMemberId()) | 
|---|
|  |  |  | .eq(Approve::getVisitId,visits.getId()) | 
|---|
|  |  |  | .eq(Approve::getObjId,visits.getId()) | 
|---|
|  |  |  | .eq(Approve::getStatus,Constants.approveStatus.wait) | 
|---|
|  |  |  | .ne(Approve::getId,approve.getId()) | 
|---|
|  |  |  | .eq(Approve::getLevel,approve.getLevel()) | 
|---|
|  |  |  | 
|---|
|  |  |  | .set(Approve::getStatus,Constants.approveStatus.otherDeal) | 
|---|
|  |  |  | .set(Approve::getEditDate,new Date()) | 
|---|
|  |  |  | .set(Approve::getCheorId,auditApproveDTO.getMemberId()) | 
|---|
|  |  |  | .eq(Approve::getVisitId,visits.getId()) | 
|---|
|  |  |  | .eq(Approve::getObjId,visits.getId()) | 
|---|
|  |  |  | .eq(Approve::getStatus,Constants.approveStatus.wait) | 
|---|
|  |  |  | .ne(Approve::getId,approve.getId()) | 
|---|
|  |  |  | .eq(Approve::getLevel,approve.getLevel()) | 
|---|
|  |  |  | 
|---|
|  |  |  | approve.setTemplatId(approveParam.getId()); | 
|---|
|  |  |  | approve.setChekorId(Integer.valueOf(id)); | 
|---|
|  |  |  | approve.setType(Constants.ONE); | 
|---|
|  |  |  | approve.setVisitId(visitId); | 
|---|
|  |  |  | approve.setObjId(visitId); | 
|---|
|  |  |  | approveList.add(approve); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | approveMapper.insertBatchSomeColumn(approveList); | 
|---|
|  |  |  | 
|---|
|  |  |  | approve.setApproveType(approveParam.getApproveType()); | 
|---|
|  |  |  | approve.setChekorId(id); | 
|---|
|  |  |  | approve.setType(Constants.ONE); | 
|---|
|  |  |  | approve.setVisitId(visitId); | 
|---|
|  |  |  | approve.setObjId(visitId); | 
|---|
|  |  |  | approveList.add(approve); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | approveMapper.insertBatchSomeColumn(approveList); | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(ApproveParam::getMemberType,Constants.ZERO) | 
|---|
|  |  |  | .last("limit 1")); | 
|---|
|  |  |  | return  Objects.isNull(approveParam)?null:approveParam.getId(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //访客报备 | 
|---|
|  |  |  | if(visits.getType().equals(Constants.TWO) | 
|---|
|  |  |  | && (StringUtils.isBlank( visits.getName()) | 
|---|
|  |  |  | && (StringUtils.isBlank( visits.getName()) | 
|---|
|  |  |  | ||  StringUtils.isBlank( visits.getPhone()) | 
|---|
|  |  |  | ||  StringUtils.isBlank( visits.getCompanyName())) | 
|---|
|  |  |  | ||  StringUtils.isBlank( visits.getCarNos()) | 
|---|
|  |  |  | ||  Objects.isNull( visits.getMemberNum()) | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,信息填写不正确!"); | 
|---|
|  |  |  | }else if(visits.getType().equals(Constants.ONE) && StringUtils.isBlank(visits.getConstructionReason())){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,未填写施工事由!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(visits.getEndtime().getTime() < System.currentTimeMillis()){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,入厂时间必须大于当前时间!");// | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public VisitDetailVO getVisitDetail(Integer id){ | 
|---|
|  |  |  | public VisitDetailVO getVisitDetail(Integer id,Integer memberId){ | 
|---|
|  |  |  | Visits visits = visitsMapper.selectById(id); | 
|---|
|  |  |  | if(Objects.isNull(visits)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
|---|
|  |  |  | 
|---|
|  |  |  | visitsMapper.selectList(new QueryWrapper<Visits>().lambda() | 
|---|
|  |  |  | .select(Visits::getName,Visits::getPhone,Visits::getQrcode,Visits::getFaceImg,Visits::getImgurl,Visits::getIdcardDecode,Visits::getStatus) | 
|---|
|  |  |  | .eq(Visits::getParentId,id))); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(Objects.nonNull(memberId)){ | 
|---|
|  |  |  | visitDetailVO.setApproveDateVO( | 
|---|
|  |  |  | approveService.arrangeApprovedData(id, | 
|---|
|  |  |  | visits.getType(), | 
|---|
|  |  |  | memberId) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return visitDetailVO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | dto.setId(systemUser.getId()); | 
|---|
|  |  |  | dto.setOperaUserId(systemUser.getId()); | 
|---|
|  |  |  | systemUserBiz.resetPwd(dto); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|