From e4a06e0730dc0aa6ced97cbb3362d6b8ef473d39 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 27 三月 2025 15:56:34 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncVisitServiceImpl.java |   65 +++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncVisitServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncVisitServiceImpl.java
index 143183d..e85c595 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncVisitServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncVisitServiceImpl.java
@@ -4,22 +4,21 @@
 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;
 import com.doumee.core.utils.DESUtil;
 import com.doumee.core.utils.DateUtil;
 import com.doumee.core.utils.ImageBase64Util;
+import com.doumee.core.wx.wxPlat.WxPlatConstants;
 import com.doumee.core.wx.wxPlat.WxPlatNotice;
 import com.doumee.dao.business.DeviceRoleMapper;
 import com.doumee.dao.business.RetentionMapper;
+import com.doumee.dao.business.WxNoticeConfigMapper;
 import com.doumee.dao.business.join.VisitsJoinMapper;
 import com.doumee.dao.business.model.DeviceRole;
 import com.doumee.dao.business.model.Member;
@@ -43,14 +42,19 @@
 public class HkSyncVisitServiceImpl extends HkSyncBaseServiceImpl {
     @Autowired
     private VisitsJoinMapper visitsMapper;
+
+
+
+    @Autowired
+    private WxPlatNotice wxPlatNotice;
+    @Autowired
+    private WxNoticeConfigMapper wxNoticeConfigMapper;
     @Autowired
     private RetentionMapper retentionMapper;
     @Autowired
     private SystemDictDataBiz systemDictDataBiz;
     @Autowired
     private DeviceRoleMapper deviceRoleMapper;
-    @Autowired
-    private WxPlatNotice wxPlatNotice;
     /**
      * 鍚屾娴峰悍璁垮淇℃伅鏄惁宸茬绂荤姸鎬�
      */
@@ -190,12 +194,13 @@
                     // 瀵圭浉搴旂姸鎬佷笅鐨勬暟鎹繘琛屻�愬凡绛剧銆戝鐞�
                     if(!Constants.equalsInteger(c.getStatus(),Constants.VisitStatus.signout)){
                         Visits update = new Visits();
-                        //宸插け鏁�
+                        //宸茬绂�
                         update.setStatus(Constants.VisitStatus.signout);
                         update.setEditDate(date);
                         update.setId(c.getId());
                         update.setInDate(DateUtil.getISO8601DateByStr2(data.getVisitStartTime()));
                         update.setOutDate(DateUtil.getISO8601DateByStr2(data.getVisitEndTime()));
+                        update.setOutInfo(model.getVisitorStatus().equals(5)?"杩囨湡鑷姩绛剧":"鏌ヨ宸茬绂�");
                         update.setRemark("宸茬绂�");
                         visitsMapper.updateById(update);
 
@@ -297,7 +302,7 @@
             return   ;
         }
         Constants.DEALING_HK_VISIT =true;
-        String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode()
+        String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode()
                 +systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode();
         List<DeviceRole> roleList = deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
                 .eq(DeviceRole::getType, Constants.ONE));
@@ -314,10 +319,13 @@
 //                getUpdateModelByResponse(c,date,roleList,path);
                 getUpdateModelByResponseIccm(c,date,roleList,path);
                 visitsMapper.updateById(c);
-                if(Objects.isNull(c.getParentId())){
-                    wxPlatNotice.sendVisitAuditTemplateNotice(c,
-                            systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_PREFIX).getCode(),
-                            systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_AUDIT_VISIT).getCode());
+                //缁欑敵璇蜂汉鍙戦�佸井淇″叕浼楀彿 涓嬪彂鏉冮檺澶辫触
+                if(StringUtils.isNotBlank(c.getOpenid()) && Constants.equalsInteger(c.getStatus(),Constants.VisitStatus.xfFail)){
+                    wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz,
+                            wxNoticeConfigMapper,c, WxPlatConstants.visitContent.visitApplyHkFail,
+                            systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+                            Arrays.asList(c.getOpenid().split(","))
+                    );
                 }
             }
         }catch (Exception e){
@@ -384,7 +392,8 @@
                     && response.getData().getAppointmentInfoList() !=null
                     && response.getData().getAppointmentInfoList().size()>0)){
                 id =response.getData().getAppointmentInfoList().get(0).getOrderId();
-                qrcode =response.getData().getAppointmentInfoList().get(0).getQRCode();
+                qrcode =response.getData().getAppointmentInfoList().get(0).getVerificationCode();
+//                qrcode =response.getData().getAppointmentInfoList().get(0).getQRCode();
             }
             reson = response!=null?JSONObject.toJSONString(response):"";
         }else{
@@ -421,7 +430,7 @@
         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;
@@ -445,7 +454,8 @@
                     && response.getData().getAppointmentInfoList() !=null
                     && response.getData().getAppointmentInfoList().size()>0)){
                 id =response.getData().getOrderId();
-                qrcode =response.getData().getAppointmentInfoList().get(0).getQRCode();
+//                qrcode =response.getData().getAppointmentInfoList().get(0).getQRCode();
+                qrcode =response.getData().getAppointmentInfoList().get(0).getVerificationCode();
             }
             reson = response!=null?JSONObject.toJSONString(response):"";
         }else{
@@ -511,7 +521,7 @@
         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 ){
@@ -521,7 +531,7 @@
         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){
@@ -529,7 +539,7 @@
             }else{
                 request.setVisitPurpose(c.getReason());
             }
-        }
+        }*/
         request.setVisitorInfo(info);
         request.setVisitorPermissionSet(getVisitPermissonRequestIccm(roleList,c));
         return  request;
@@ -555,7 +565,7 @@
         }
         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);
@@ -598,7 +608,7 @@
         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);
@@ -606,11 +616,11 @@
             //浜鸿劯涓虹┖锛屼笉鑳借繘琛屾帹閫�
             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){
@@ -618,7 +628,7 @@
             }else{
                 request.setVisitPurpose(c.getReason());
             }
-        }
+        }*/
         //鑾峰彇鏉冮檺缁勯泦鍚�
         request.setVisitorPermissionSet(getVisitPermissonRequestIccm(roleList,c));
         List<IccmAppointmentVistorRequest> infolist = new ArrayList<>();
@@ -673,7 +683,7 @@
 
         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())
@@ -682,9 +692,12 @@
             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())){
@@ -696,7 +709,6 @@
                 info.setVisitorName(c.getName());
             }
         }
-
         if(StringUtils.isNotBlank(c.getCompanyName())){
             char[] charArray = c.getCompanyName().toCharArray();
             int length = charArray.length;
@@ -716,11 +728,10 @@
             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;
         }

--
Gitblit v1.9.3