nidapeng
2024-04-19 89610234a2bdc56f60e0998045892ef2672edccc
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.util.IdcardUtil;
import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
@@ -16,6 +17,7 @@
import com.doumee.core.haikang.model.HKTools;
import com.doumee.core.haikang.model.param.BaseResponse;
import com.doumee.core.haikang.model.param.request.VisitAppointmentCancelRequest;
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.VisitAppointmentResponse;
import com.doumee.core.haikang.service.HKService;
@@ -33,6 +35,8 @@
import com.doumee.dao.business.join.VisitsJoinMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.web.reqeust.AuditApproveDTO;
import com.doumee.dao.web.reqeust.ErpVisitDTO;
import com.doumee.dao.web.reqeust.ErpWithVisitDTO;
import com.doumee.dao.web.reqeust.VisitRecordDTO;
import com.doumee.dao.web.response.InternalHomeVO;
import com.doumee.dao.web.response.VisitDetailVO;
@@ -51,9 +55,11 @@
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.DigestUtils;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
@@ -65,6 +71,8 @@
@Service
public class VisitsServiceImpl implements VisitsService {
    @Autowired
    private RetentionMapper retentionMapper;
    @Autowired
    private VisitsMapper visitsMapper;
    @Autowired
@@ -91,11 +99,90 @@
    @Autowired
    private WxPlatNotice wxPlatNotice;
    @Autowired
    private InterfaceLogService interfaceLogService;
    @Override
    public Integer create(Visits visits) {
        visitsMapper.insert(visits);
        return visits.getId();
    }
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public void createFKForErp(ErpVisitDTO erpVisitDTO){
            if (Objects.isNull(erpVisitDTO)
                    || StringUtils.isBlank(erpVisitDTO.getName())
                    || StringUtils.isBlank(erpVisitDTO.getPhone())
                    || StringUtils.isBlank(erpVisitDTO.getCompanyName())
                    || Objects.isNull(erpVisitDTO.getIdcardType())
                    || StringUtils.isBlank(erpVisitDTO.getIdcardNo())
                    || Objects.isNull(erpVisitDTO.getStarttime())
                    || Objects.isNull(erpVisitDTO.getEndtime())
                    || StringUtils.isBlank(erpVisitDTO.getFaceImg())
                    || StringUtils.isBlank(erpVisitDTO.getDoors())
                    || Objects.isNull(erpVisitDTO.getReceptMemberId())
                    || Objects.isNull(erpVisitDTO.getErpId())
            ) {
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,信息填写不正确!");
            }
            if (erpVisitDTO.getEndtime().getTime() <= erpVisitDTO.getStarttime().getTime()) {
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约结束时间必须大于开始时间!");
            }
            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()
                    .eq(Member::getIsdeleted, Constants.ZERO).eq(Member::getType, Constants.memberType.internal)
                    .eq(Member::getErpId, erpVisitDTO.getReceptMemberId()).last("limit 1"));
            if (Objects.isNull(member)) {
                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "未查询到被访问人信息");
            }
            if (Objects.isNull(member.getCanVisit()) || member.getCanVisit().equals(Constants.ZERO)) {
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "当前被访问人无法被访问");
            }
            BeanUtils.copyProperties(erpVisitDTO, visits);
            //设置内部系统人员主键
            visits.setReceptMemberId(member.getId());
            visits.setSourceType(Constants.ONE);
            List<ErpWithVisitDTO> erpWithVisitDTOList = erpVisitDTO.getErpWithVisitDTOList();
            if (CollectionUtils.isNotEmpty(erpWithVisitDTOList)) {
                List<Visits> visitsList = new ArrayList<>();
                for (ErpWithVisitDTO erpWithVisitDTO : erpWithVisitDTOList) {
                    Visits withVisits = new Visits();
                    BeanUtils.copyProperties(erpWithVisitDTO, withVisits);
                    withVisits.setCompanyName(visits.getCompanyName());
                    withVisits.setReason(visits.getReason());
                    visitsList.add(withVisits);
                }
                visits.setWithUserList(visitsList);
            }
            this.createFk(visits,true);
    }
    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    void saveInterfaceLog(Object param, String path, String result, Integer type) {
        InterfaceLog interfaceLog=new InterfaceLog();
        interfaceLog.setType(type);
        interfaceLog.setCreateDate(new Date());
        interfaceLog.setIsdeleted(Constants.ZERO);
        if(param!=null){
            interfaceLog.setRequest(JSONObject.toJSONString(param));
        }
        interfaceLog.setPlat(Constants.ONE);
        interfaceLog.setRepose(result);
        interfaceLog.setName(path);
        interfaceLog.setUrl(path);
        interfaceLogService.create(interfaceLog);
    }
    /**
     * 普通访客申请
@@ -104,12 +191,12 @@
     */
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public Integer createFk(Visits visits) {
    public Integer createFk(Visits visits,Boolean isERP) {
        isValidBaseParam(visits);
        //检查是否必须答题,并且符合答题要求
        ProblemLog problemLog = isValidProblemLog(visits);
        //获取申请的海康访问门禁组信息
        getHkDeviceRoles(visits);
        getHkDeviceRoles(visits,isERP);
        //检验拜访人是否合法
        Member visitMember = isValideVisitedUser(visits.getReceptMemberId());
        if(Constants.equalsInteger(Constants.ZERO, visits.getIdcardType())&&visits.getIdcardNo().length()!=18
@@ -132,22 +219,27 @@
        initVisitInfo(visits,date);
        visitsMapper.insert(visits);
        //发起ERP审批申请
        String erpId = startSendErpCheck(visits,visitMember);
        if(StringUtils.isNotBlank(erpId)){
            visits.setErpId(erpId);
            visits.setStatus(Constants.VisitStatus.submitCheck);
            visitsMapper.updateById(visits);
        if(visits.getSourceType().equals(Constants.ZERO)){
            String erpId = startSendErpCheck(visits,visitMember);
            if(StringUtils.isNotBlank(erpId)){
                visits.setErpId(erpId);
                visits.setStatus(Constants.VisitStatus.submitCheck);
                visitsMapper.updateById(visits);
            }else{
                throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,发起拜访审批申请失败!");
            }
            //发送微信公众号通知
            wxPlatNotice.sendVisitAuditTemplateNotice(visits,
                    systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_PREFIX).getCode(),
                    systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_AUDIT_VISIT).getCode());
        }else{
            throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,发起拜访审批申请失败!");
            visits.setStatus(Constants.VisitStatus.pass);
            visitsMapper.updateById(visits);
        }
        initWithVisitInfo(visits);
        updateProblemLog(visits,problemLog,member);
        //创建审批记录
//        createApprove(visits,visitMember);
        //发送微信公众号通知
        wxPlatNotice.sendVisitAuditTemplateNotice(visits,
                systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_PREFIX).getCode(),
                systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_AUDIT_VISIT).getCode());
        return visits.getId();
    }
@@ -477,20 +569,37 @@
    private void isValidBaseParam(Visits visits) {
        if(visits.getEndtime() == null
                || visits.getStarttime() == null
//                ||  StringUtils.isBlank(visits.getReason())
                ||  StringUtils.isBlank(visits.getReason())
                ||  StringUtils.isBlank( visits.getName())
                ||  StringUtils.isBlank( visits.getPhone())
                ||  StringUtils.isBlank( visits.getCompanyName())
                ||  visits.getIdcardType() == null
//                ||  StringUtils.isBlank( visits.getFaceImg() )
                ||  StringUtils.isBlank( visits.getIdcardNo() )
                || visits.getReceptMemberId() == null){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,信息填写不正确!");
        }
//        if(visits.getStarttime().getTime() < System.currentTimeMillis()){
//            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约开始时间必须大于当前时间!");//
//        }
        if(visits.getEndtime().getTime() < System.currentTimeMillis()){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约结束时间必须大于当前时间!");//
        }
        if(visits.getEndtime().getTime() <= visits.getStarttime().getTime()){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约结束时间必须大于开始时间!");//
        }
        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));
                int betweenDays = DateUtil.daysBetweenDates11(visits.getEndtime(), visits.getStarttime())+1;
                if( betweenDays > codenum){
                    throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约总天数不能超过["+code+"天]!");
                }
            }
        }
    }
    private void isValidWithVisitParam(Visits visits,  List<Member> addList,  List<Member> updateList) {
@@ -502,9 +611,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(), "对不起,预约结束时间必须大于开始时间!");//
        }
@@ -551,7 +660,8 @@
                v.setDoors(visits.getDoors());
                v.setType(visits.getType());
                v.setVisitType(visits.getVisitType());
                v.setStatus(Constants.VisitStatus.submitCheck);
                v.setStatus(visits.getStatus());
                v.setSourceType(visits.getSourceType());
            }
            //批量插入数据
            visitsMapper.insertBatchSomeColumn(visits.getWithUserList());
@@ -686,7 +796,7 @@
    }
    private Member getMemberListParam(String cardno, Visits visits, List<Member> addList, List<Member> editList) {
        if(!StringUtils.isNotBlank(visits.getCarNos())
        if(StringUtils.isNotBlank(visits.getCarNos())
                &&Objects.isNull(Constants.getVehiclePlateNo(visits.getCarNos()))
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,车牌号【"+visits.getCarNos()+"】不合法,请核实后重试~");
@@ -694,7 +804,7 @@
        if(Constants.equalsInteger(Constants.ZERO, visits.getIdcardType())&&cardno.length()!=18
            //&&!IdcardUtil.isValidCard(cardno)
        ){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证号码有误,请核实后重试!");
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证【"+cardno+"】号码有误,请核实后重试!");
        }
        Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda()
                .eq(Member::getType,Constants.memberType.visitor)
@@ -730,10 +840,9 @@
        }else{
            if(!Constants.equalsInteger(Constants.ZERO,member.getStatus() )){
                //如果用户状态异常,则提示
                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,该身份证号被禁止访问申请,如有疑问,请联系您的拜访人进行核实");
                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,身份证号【"+cardno+"】被禁止访问申请,如有疑问,请联系您的拜访人进行核实");
            }
            //核查预约用户是否存在未签离的预约记录
//            isExsitNoOutVisisRecord(member);
            member.setFaceImg(visits.getFaceImg());
@@ -751,15 +860,13 @@
            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.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.eq(Visits::getPhone, visits.getPhone())
                        .or().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) {
@@ -830,12 +937,15 @@
        if(!Constants.equalsInteger(Constants.ONE, member.getCanVisit())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,该拜访人暂时不能接受您的拜访申请~");
        }
        if(StringUtils.isBlank(member.getHkId())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,该拜访人未下发暂时不能接受您的拜访申请~");
        }
        return  member;
    }
    private ProblemLog isValidProblemLog(Visits visits) {
        String required = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROBLEM_VISIT_REQUIRED).getCode();
        if(StringUtils.equals(required,Constants.ONE+"")){
        if(StringUtils.equals(required,Constants.ONE+"")&&visits.getSourceType()==Constants.ZERO){
            //如果必须答题,查找答题记录
            if(visits.getUserAnswerId() == null){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,请先按要求进行安全知识答题!");
@@ -857,17 +967,13 @@
     * @param visits
     * @return
     */
    private String[] getHkDeviceRoles(Visits visits) {
    private String[] getHkDeviceRoles(Visits visits,Boolean isERP) {
        String mustSelectDoors = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SELECT_DOORS_VISIT_REQUIRED).getCode();
        if(isERP){
            mustSelectDoors = Constants.ONE+"";
        }
        List<DeviceRole> roles = null;
        if(StringUtils.equals(mustSelectDoors,Constants.ZERO+"")){
            //如果设置不选择门禁,则提供默认门禁组信息
            if(StringUtils.isBlank(visits.getDoors())){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,请选择访问门禁!");
            }
            //校验门禁组信息是否正确
            String[] dIds = visits.getDoors().split(",");
            roles = deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
                    .eq(DeviceRole::getIsDefault,Constants.ZERO)
                    .eq(DeviceRole::getIsdeleted,Constants.ZERO)
@@ -875,9 +981,11 @@
            if(roles.size() ==0){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,暂不存在可访问的访客门禁,无法进行申请操作!");
            }
        }else{
            //如果必须选择门禁,但未选择
            if(StringUtils.isBlank(visits.getDoors())){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,请选择有效访问门禁!");
            }
            String[] dIds = visits.getDoors().split(",");
            roles = deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
                    .eq(DeviceRole::getIsdeleted,Constants.ZERO)
@@ -1028,7 +1136,7 @@
        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);
@@ -1038,11 +1146,9 @@
        queryWrapper.eq(Visits::getIsdeleted,Constants.ZERO);
        queryWrapper.eq(Objects.nonNull(pageWrap.getModel().getType()),Visits::getType,pageWrap.getModel().getType());
        queryWrapper.and(StringUtils.isNotBlank(pageWrap.getModel().getName()),ms->ms.like(Visits::getPhone,pageWrap.getModel().getName())
                .or().like(Visits::getPhone,pageWrap.getModel().getName()))
                .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(!Objects.nonNull(pageWrap.getModel().getLevelStatus()),Visits::getOutDate);
                .or().like(Visits::getName,pageWrap.getModel().getName()));
        queryWrapper.eq(StringUtils.isNotBlank(pageWrap.getModel().getIdcardNo()),Visits::getIdcardNo,StringUtils.isNotBlank(pageWrap.getModel().getIdcardNo()));
        queryWrapper.eq(StringUtils.isNotBlank(pageWrap.getModel().getCompanyName()),Visits::getCompanyName,pageWrap.getModel().getCompanyName());
        queryWrapper.orderByDesc(Visits::getEditDate);
        IPage<Visits> result = visitsJoinMapper.selectJoinPage(page, Visits.class,queryWrapper);
        if(result!=null&&result.getRecords()!=null){
@@ -1080,6 +1186,7 @@
        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());
@@ -1106,7 +1213,7 @@
        }
        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;
    }
@@ -1158,9 +1265,36 @@
        if(!visits.getStatus().equals(Constants.VisitStatus.signin)){
            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()));
    }
    @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()));
    }
}