| | |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public void createFKForErp(ErpVisitDTO erpVisitDTO){ |
| | | try { |
| | | if (Objects.isNull(erpVisitDTO) |
| | | || StringUtils.isBlank(erpVisitDTO.getName()) |
| | | || StringUtils.isBlank(erpVisitDTO.getPhone()) |
| | |
| | | visits.setWithUserList(visitsList); |
| | | } |
| | | this.createFk(visits,true); |
| | | }catch (BusinessException e){ |
| | | throw e; |
| | | }finally { |
| | | saveInterfaceLog(erpVisitDTO,"/visitBiz/resource/createVisit",null,Constants.ZERO); |
| | | } |
| | | } |
| | | |
| | | @Transactional(propagation = Propagation.NOT_SUPPORTED) |
| | |
| | | } |
| | | if(visits.getSourceType().equals(Constants.ZERO)){ |
| | | String code = systemDictDataBiz.queryByCode(Constants.VISIT_CONFIG,Constants.VALIDATE_VISIT).getCode(); |
| | | int codenum =0; |
| | | try { |
| | | codenum = Integer.parseInt(code); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | if(StringUtils.isNotBlank(code)&&!StringUtils.equals(code,"0")){ |
| | | Integer betweenDays = Math.toIntExact(cn.hutool.core.date.DateUtil.between(visits.getEndtime(), visits.getStarttime(), DateUnit.DAY)); |
| | | if(Integer.compare(betweenDays,Integer.valueOf(code))>0){ |
| | | // Integer betweenDays = Math.toIntExact(cn.hutool.core.date.DateUtil.between(visits.getEndtime(), visits.getStarttime(), DateUnit.DAY)); |
| | | int betweenDays = DateUtil.daysBetweenDates11(visits.getEndtime(), visits.getStarttime())+1; |
| | | if( betweenDays > codenum){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约总天数不能超过["+code+"天]!"); |
| | | } |
| | | } |
| | |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,信息填写不正确!"); |
| | | } |
| | | if(visits.getStarttime().getTime() < System.currentTimeMillis()){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约开始时间必须大于当前时间!");// |
| | | } |
| | | // if(visits.getStarttime().getTime() < System.currentTimeMillis()){ |
| | | // throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约开始时间必须大于当前时间!");// |
| | | // } |
| | | if(visits.getEndtime().getTime() <= visits.getStarttime().getTime()){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约结束时间必须大于开始时间!");// |
| | | } |
| | |
| | | .eq(Retention::getType,Constants.memberType.visitor) |
| | | .eq(Retention::getMemberId,visits.getMemberId())); |
| | | } |
| | | @Override |
| | | public void visitCancel(Integer visitId){ |
| | | Visits visits = visitsMapper.selectById(visitId); |
| | | if(Objects.isNull(visits)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!visits.getStatus().equals(Constants.VisitStatus.xfSuccess)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"访客记录状态错误,请刷新重试"); |
| | | } |
| | | VisitAppointmentOutRequest request = new VisitAppointmentOutRequest(); |
| | | request.setOrderId(visits.getHkId()); |
| | | //调用海康强制签离 |
| | | 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())); |
| | | } |
| | | |
| | | } |