|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.HKConstants; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.BaseListPageResponse; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.BaseResponse; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.request.*; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.request.event.visit.EventVisitInfoRequest; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.respose.*; | 
|---|
|  |  |  | import com.doumee.core.haikang.service.HKService; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | 
|---|
|  |  |  | c.setHkStatus(Constants.ONE); | 
|---|
|  |  |  | c.setHkDate(date); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private void getUpdateModelByResponseIccm(  Visits c,Date date, List<DeviceRole> roleList,String path ) { | 
|---|
|  |  |  | public static void getUpdateModelByResponseIccm(  Visits c,Date date, List<DeviceRole> roleList,String path ) { | 
|---|
|  |  |  | String code = null; | 
|---|
|  |  |  | String id = null; | 
|---|
|  |  |  | String qrcode = null; | 
|---|
|  |  |  | 
|---|
|  |  |  | request.setVisitorPermissionSet(getVisitPermissonRequest(roleList,c)); | 
|---|
|  |  |  | return  request; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private IccmAppointmentMDJRequest getHkMDJRequestParamIccm(Visits c,List<DeviceRole> roleList,String path) { | 
|---|
|  |  |  | public static IccmAppointmentMDJRequest getHkMDJRequestParamIccm(Visits c,List<DeviceRole> roleList,String path) { | 
|---|
|  |  |  | IccmAppointmentMDJRequest request = new IccmAppointmentMDJRequest(); | 
|---|
|  |  |  | IccmAppointmentVistorRequest info =getRequestInfoByVisitIccm(c,path); | 
|---|
|  |  |  | if(info == null ){ | 
|---|
|  |  |  | 
|---|
|  |  |  | request.setVisitStartTime(DateUtil.getISO8601Timestamp2(c.getStarttime())); | 
|---|
|  |  |  | request.setVisitEndTime(DateUtil.getISO8601Timestamp2(c.getEndtime())); | 
|---|
|  |  |  | request.setReceptionistId(c.getReceptMemberHkId());//被访人海康编码 | 
|---|
|  |  |  | if(StringUtils.isNotBlank(c.getReason())){ | 
|---|
|  |  |  | /* if(StringUtils.isNotBlank(c.getReason())){ | 
|---|
|  |  |  | char[] charArray = c.getReason().toCharArray(); | 
|---|
|  |  |  | int length = charArray.length; | 
|---|
|  |  |  | if(length>32){ | 
|---|
|  |  |  | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | request.setVisitPurpose(c.getReason()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | request.setVisitorInfo(info); | 
|---|
|  |  |  | request.setVisitorPermissionSet(getVisitPermissonRequestIccm(roleList,c)); | 
|---|
|  |  |  | return  request; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  p; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private IccmPermissionSetRequest getVisitPermissonRequestIccm(List<DeviceRole> roleList, Visits c) { | 
|---|
|  |  |  | public static IccmPermissionSetRequest getVisitPermissonRequestIccm(List<DeviceRole> roleList, Visits c) { | 
|---|
|  |  |  | IccmPermissionSetRequest p = new IccmPermissionSetRequest(); | 
|---|
|  |  |  | //获取权限组集合 | 
|---|
|  |  |  | String[] roles = getHkRoles(c.getDoors(),roleList); | 
|---|
|  |  |  | 
|---|
|  |  |  | request.setVisitorInfoList(infolist); | 
|---|
|  |  |  | return  request; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private IccmAppointmentRequest getHkRequestParaIccm(Visits c,List<DeviceRole> roleList,String path ) { | 
|---|
|  |  |  | public static  IccmAppointmentRequest getHkRequestParaIccm(Visits c,List<DeviceRole> roleList,String path ) { | 
|---|
|  |  |  | IccmAppointmentRequest request = new IccmAppointmentRequest(); | 
|---|
|  |  |  | //申请人信息 | 
|---|
|  |  |  | IccmAppointmentVistorRequest info =getRequestInfoByVisitIccm(c,path); | 
|---|
|  |  |  | 
|---|
|  |  |  | //人脸为空,不能进行推送 | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | request.setVisitStartTime(DateUtil.getISO8601Timestamp(c.getStarttime())); | 
|---|
|  |  |  | request.setVisitEndTime(DateUtil.getISO8601Timestamp(c.getEndtime())); | 
|---|
|  |  |  | request.setVisitStartTime(DateUtil.getISO8601Timestamp2(c.getStarttime())); | 
|---|
|  |  |  | request.setVisitEndTime(DateUtil.getISO8601Timestamp2(c.getEndtime())); | 
|---|
|  |  |  | request.setReceptionistId(c.getReceptMemberHkId());//被访人海康编码 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotBlank(c.getReason())){ | 
|---|
|  |  |  | /*  if(StringUtils.isNotBlank(c.getReason())){ | 
|---|
|  |  |  | char[] charArray = c.getReason().toCharArray(); | 
|---|
|  |  |  | int length = charArray.length; | 
|---|
|  |  |  | if(length>32){ | 
|---|
|  |  |  | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | request.setVisitPurpose(c.getReason()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | //获取权限组集合 | 
|---|
|  |  |  | request.setVisitorPermissionSet(getVisitPermissonRequestIccm(roleList,c)); | 
|---|
|  |  |  | List<IccmAppointmentVistorRequest> infolist = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return info; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private IccmAppointmentVistorRequest getRequestInfoByVisitIccm(Visits c,String path) { | 
|---|
|  |  |  | public static IccmAppointmentVistorRequest getRequestInfoByVisitIccm(Visits c,String path) { | 
|---|
|  |  |  | IccmAppointmentVistorRequest info = new IccmAppointmentVistorRequest(); | 
|---|
|  |  |  | //人脸数据 | 
|---|
|  |  |  | if(StringUtils.isBlank(c.getName()) | 
|---|
|  |  |  | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(c.getFaceImg())){ | 
|---|
|  |  |  | log.info("===================================="+path+c.getFaceImg()+"======start===="); | 
|---|
|  |  |  | info.setVisitorPhoto(ImageBase64Util.Image2Base64(path+c.getFaceImg())); | 
|---|
|  |  |  | log.info("===================================="+path+c.getFaceImg()+"========end==="); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(info.getVisitorPhoto() == null){ | 
|---|
|  |  |  | log.info("===================================="+path+c.getFaceImg()+"======imgerror====="); | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(c.getName())){ | 
|---|
|  |  |  | 
|---|
|  |  |  | info.setVisitorName(c.getName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotBlank(c.getCompanyName())){ | 
|---|
|  |  |  | char[] charArray = c.getCompanyName().toCharArray(); | 
|---|
|  |  |  | int length = charArray.length; | 
|---|
|  |  |  | 
|---|
|  |  |  | info.setCertificateType(HKConstants.CertificateType.HUZHAO.getKey()+""); | 
|---|
|  |  |  | info.setCertificateNo(DESUtil.decrypt(Constants.EDS_PWD,  c.getIdcardNo())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return info; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String[] getHkRoles(String doors, List<DeviceRole> roleList) { | 
|---|
|  |  |  | public static String[] getHkRoles(String doors, List<DeviceRole> roleList) { | 
|---|
|  |  |  | if(StringUtils.isBlank(doors) || roleList.size()==0|| roleList.size()==0){ | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|