nidapeng
2024-04-15 e3f60427ef427d966253aa7ecd022aa9f20788ad
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -604,9 +604,9 @@
                ){
            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(), "对不起,预约结束时间必须大于开始时间!");//
        }
@@ -1269,5 +1269,25 @@
                .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()));
    }
}