From ddf3d6493849d77ae6dd8350eb80ee71fad03c6a Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 07 十二月 2023 17:35:48 +0800
Subject: [PATCH] 海康接口对接开发

---
 server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java                                      |    8 
 server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java                                 |   36 ++
 server/openapi/src/main/java/com/doumee/api/common/PublicController.java                                            |   14 
 server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java                                 |   19 -
 server/dmvisit_web/src/main/java/com/doumee/api/common/PublicController.java                                        |   14 
 server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentCancelRequest.java |   11 
 server/dmvisit_admin/src/main/java/com/doumee/api/common/PublicController.java                                      |   15 
 server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java                        |  246 ++++++++++++-
 server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java                                     |   11 
 server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java                                           |  625 +---------------------------------
 server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentOutRequest.java    |    9 
 server/dmvisit_service/src/main/java/com/doumee/dao/business/VisitsMapper.java                                      |    3 
 server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java                                      |   11 
 13 files changed, 331 insertions(+), 691 deletions(-)

diff --git a/server/dmvisit_admin/src/main/java/com/doumee/api/common/PublicController.java b/server/dmvisit_admin/src/main/java/com/doumee/api/common/PublicController.java
index 85b332f..d69c175 100644
--- a/server/dmvisit_admin/src/main/java/com/doumee/api/common/PublicController.java
+++ b/server/dmvisit_admin/src/main/java/com/doumee/api/common/PublicController.java
@@ -184,21 +184,6 @@
     }
 
 
-    @ApiOperation(value = "涓婁紶", notes = "涓婁紶", httpMethod = "POST", position = 6)
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "folder", value = "鏂囦欢澶�", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
-    })
-    @PostMapping(value = "/uploadLocal", headers = "content-type=multipart/form-data")
-    public void uploadLocal(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-
-       // CommonsMultipartFile files = (CommonsMultipartFile) multipartRequest.getFile("filedata");
-        uploadFileLocal(multipartRequest,  folder+ "/", response,
-                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ROOT_PATH).getCode() ,
-                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode());
-
-    }
-
     public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception {
         response.setCharacterEncoding("UTF-8");
         response.setContentType("text/html;charset=UTF-8");
diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
index 9187b3c..4605753 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
@@ -45,6 +45,7 @@
         String visitAppiontment= "/api/visitor/v2/appointment";//璁垮棰勭害v2
         String visitAppiontmentMDJ= "/api/visitor/v1/appointment/registration";//璁垮棰勭害鍏嶇櫥璁皏2
         String visitCancel= "/api/visitor/v1/appointment/cancel";//鍙栨秷璁垮棰勭害
+        String visitOut= "/api/visitor/v1/visitor/out";//绛剧璁垮棰勭害
         String facePicture= "/api/resource/v1/person/picture";//鎻愬彇鐢ㄦ埛浜鸿劯鐓х墖
         String privilegeGroup= "/api/visitor/v1/privilege/group";//鏌ヨ璁垮鏉冮檺缁�
         String eventSub= "/api/eventService/v1/eventSubscriptionByEventTypes";//浜嬩欢璁㈤槄
@@ -74,15 +75,6 @@
             this.key = key;
         }
 
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (Constants.UserType c : Constants.UserType.values()) {
-                if (c.getKey() == index) {
-                    return c.getName();
-                }
-            }
-            return null;
-        }
 
 
         // get set 鏂规硶
@@ -120,15 +112,6 @@
             this.key = key;
         }
 
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (Constants.UserType c : Constants.UserType.values()) {
-                if (c.getKey() == index) {
-                    return c.getName();
-                }
-            }
-            return null;
-        }
 
 
         // get set 鏂规硶
diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java
index c9177c5..2b7579a 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java
@@ -325,6 +325,17 @@
 		return  result;
 	}
 	/**
+	 *	绛剧璁垮棰勭害
+	 * @param body
+	 * @return
+	 */
+	public static String visitOut(String body) {
+		Map<String, String> path = getPath(HKConstants.InterfacePath.visitOut);
+		String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post璇锋眰application/json绫诲瀷鍙傛暟
+		saveInterfaceLog(body,result,path);
+		return  result;
+	}
+	/**
 	 *	璁垮鏉冮檺缁�
 	 * @param body
 	 * @return
diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentCancelRequest.java b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentCancelRequest.java
new file mode 100644
index 0000000..684e68d
--- /dev/null
+++ b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentCancelRequest.java
@@ -0,0 +1,11 @@
+package com.doumee.core.haikang.model.param.request;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class VisitAppointmentCancelRequest {
+
+    private String[] appointRecordIds;//	string[]	True	棰勭害璁板綍ID鐨勬暟缁勶紝涓庢煡璇㈣瀹㈤绾﹁褰晇2鎺ュ彛涓殑appointRecordId瀵瑰簲
+}
\ No newline at end of file
diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentOutRequest.java b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentOutRequest.java
new file mode 100644
index 0000000..b772384
--- /dev/null
+++ b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentOutRequest.java
@@ -0,0 +1,9 @@
+package com.doumee.core.haikang.model.param.request;
+
+import lombok.Data;
+
+@Data
+public class VisitAppointmentOutRequest {
+
+    private String orderId	;//string	True	璁垮璁板綍id锛屼粠鏌ヨ璁垮鏉ヨ璁板綍v2鎺ュ彛鑾峰彇杩斿洖鎶ユ枃涓殑orderId瀛楁
+}
\ No newline at end of file
diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java
index d0f68a9..b4b788b 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java
@@ -373,6 +373,42 @@
         return  null;
     }
     /**
+     *璁垮棰勭害鍙栨秷
+     * @return
+     */
+    public  static  BaseResponse   cancelVisitAppiontment(VisitAppointmentCancelRequest param){
+        log.error("銆愭捣搴疯瀹㈤绾﹀彇娑堛��================寮�濮�===="+JSONObject.toJSONString(param));
+        try {
+            String res = HKTools.visitCancel(JSONObject.toJSONString(param));
+            TypeReference typeReference =
+                    new TypeReference< BaseResponse>(){};
+            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
+           logResult(result,"娴峰悍璁垮棰勭害鍙栨秷");
+            return  result;
+        }catch (Exception e){
+            log.error("銆愭捣搴疯瀹㈤绾﹀彇娑堛��================澶辫触====锛歕n"+ e.getMessage());
+        }
+        return  null;
+    }
+    /**
+     *璁垮棰勭害绛剧
+     * @return
+     */
+    public  static  BaseResponse  outVisitAppiontment(VisitAppointmentOutRequest param){
+        log.error("銆愭捣搴疯瀹㈤绾︾绂汇��================寮�濮�===="+JSONObject.toJSONString(param));
+        try {
+            String res = HKTools.visitOut(JSONObject.toJSONString(param));
+            TypeReference typeReference =
+                    new TypeReference< BaseResponse>(){};
+            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
+           logResult(result,"娴峰悍璁垮棰勭害绛剧");
+            return  result;
+        }catch (Exception e){
+            log.error("銆愭捣搴疯瀹㈤绾︾绂汇��================澶辫触====锛歕n"+ e.getMessage());
+        }
+        return  null;
+    }
+    /**
      *璁垮鍏嶇櫥璁伴绾�
      * @return
      */
diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java b/server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java
index 1fce4da..fdecd22 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -6,7 +6,11 @@
 import java.math.BigDecimal;
 import java.net.URLDecoder;
 import java.text.SimpleDateFormat;
+import java.util.Arrays;
 import  java.util.Date;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class Constants {
 
@@ -47,6 +51,17 @@
     }
     return  birthday;
 }
+
+    /**
+     *   鍒ゆ柇鏄惁涓烘湁鏁堣溅鐗屽彿
+     */
+    public static boolean checkCarNo(String str) {
+        String patt="^[浜触娌唨鏅嬭窘鍚夐粦鑻忔禉鐨栭椊璧i瞾璞剛婀樼菠妗傜惣宸濋粩浜戞笣钘忛檿闄囬潚瀹佹柊闂界菠鏅嬬惣浣块A_Z]{1}[A_Z]{1}[A-Z0-9]{4}[A-Z0-9鎸傚璀︽腐婢砞{1}$";
+        Pattern r = Pattern.compile(patt);
+        Matcher matcher = r.matcher(str);
+        return matcher.find();
+    }
+
     public static  String  getTuominStr(String s){
         if(StringUtils.isEmpty(s)){
             return "";
@@ -87,6 +102,17 @@
          int fk = 1;//鏅�氳瀹�
          int nb = 2;//鍐呴儴璁垮
     }
+    public interface VisitStatus{
+        //瀹℃牳鐘舵�� 0寰呭鏍� 1宸叉彁浜RP瀹℃壒  2瀹℃牳閫氳繃 3瀹℃牳涓嶉�氳繃 4鍙栨秷 5涓嬪彂鎴愬姛 6涓嬪彂澶辫触 7宸茬绂�
+         int waitCheck = 0;
+         int submitCheck = 1;
+         int pass = 2;
+         int noPass = 3;
+         int cancel = 4;
+         int xfSuccess = 5;
+         int xfFail = 6;
+         int signout = 7;
+    }
     public interface DOOR_ROLE_TYPE{
          int lw = 0;
          int fk = 1;
@@ -98,7 +124,6 @@
     public static final String ACCESS_ID="ACCESS_ID";
     public static final String BUCKETNAME = "BUCKETNAME";
     public static final String OSS = "OSS";
-    public static final String COFFEE_ARTICLE = "COFFEE_ARTICLE";
 
     public static final String ACCESS_KEY = "ACCESS_KEY";
     public static final String ENDPOINT = "ENDPOINT";
@@ -179,15 +204,7 @@
         return d.longValue();
     }
 
-public interface  UserRelObjType{
-      int objTypeRoom = 0;
-      int objTypeBook = 1;
-}
-public interface  RoomRecordObjType{
-      int objTypeRoom = 0;//绠$悊鍛樺紑闂�
-      int objTypeBook_in = 1;//鍙備細浜哄憳寮�闂�
-      int objTypeBook_out = 2;//璁垮寮�闂�
-}
+
 public interface  memberType{
     int visitor = 0;//鏅�氳瀹�
     int lw_visitor = 1;//鍔冲姟璁垮
@@ -199,84 +216,6 @@
     }
 
 
-    /**
-     * 鐢ㄦ埛绫诲瀷
-     */
-    public  enum UserType {
-
-        SYSTEM(0, "绯荤粺鐢ㄦ埛", "绠$悊鍛�",Arrays.asList(0)),
-        ORG(1, "鏈烘瀯", "鏈烘瀯",Arrays.asList(1)),
-        CREATION(2, "鍒涗綔涓績", "鍒涗綔涓績",Arrays.asList(2))
-
-        ;
-        // 鎴愬憳鍙橀噺
-        private String name;
-        private int key;
-        private List<Integer> historyStatus;
-        private String noteinfo;// 鎻忚堪
-
-        // 鏋勯�犳柟娉�
-        UserType(int key, String name, String noteinfo,List<Integer> historyStatus) {
-            this.name = name;
-            this.key = key;
-            this.noteinfo = noteinfo;
-            this.historyStatus=historyStatus;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (UserType c : UserType.values()) {
-                if (c.getKey() == index) {
-                    return c.name;
-                }
-            }
-            return null;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getInfo(int index) {
-            for (UserType c : UserType.values()) {
-                if (c.getKey() == index) {
-                    return c.noteinfo;
-                }
-            }
-            return null;
-        }
-        // 鏅�氭柟娉�
-        public static List<Integer> getHistoryStatus(int index) {
-            for (UserType c : UserType.values()) {
-                if (c.getKey() == index) {
-                    return c.historyStatus;
-                }
-            }
-            return null;
-        }
-
-        // get set 鏂规硶
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getKey() {
-            return key;
-        }
-        public List<Integer> getHistoryStatus() {
-            return historyStatus;
-        }
-
-        public void setKey(int key) {
-            this.key = key;
-        }
-
-        public String getNoteinfo() {
-            return noteinfo;
-        }
-
-    }
 
     /**
      * 鏁版嵁鐘舵�佹灇涓�
@@ -315,516 +254,6 @@
     }
 
 
-    /**
-     * 鍏宠仈瀵硅薄绫诲瀷 0娲诲姩杞挱鍥� 1娲诲姩璇︽儏鍥� 2闂ㄥ簵璇勪环3璁㈠崟璇勪环 4骞冲彴鍟嗗搧杞挱 5鎺㈠簵澶氬浘 6搴楅摵鏂伴矞浜嬪鍥� 7鍟嗗鍥剧墖澶氬浘
-     */
-    public  enum MultiFile{
-        ACTIVITY_ROTATION(0, "娲诲姩杞挱鍥�", "娲诲姩杞挱鍥�"),
-        ACTIVITY_DETAIL(1, "娲诲姩璇︽儏鍥�", "娲诲姩璇︽儏鍥�"),
-        SHOP_APPRAISE(2, "闂ㄥ簵璇勪环", "闂ㄥ簵璇勪环"),
-        ORDER_APPRAISE(3, "璁㈠崟璇勪环", "璁㈠崟璇勪环"),
-        PLATFORM_GOOD_ROTATION(4, "骞冲彴鍟嗗搧杞挱", "骞冲彴鍟嗗搧杞挱"),
-        TANDIAN_PICTURE(5, "鎺㈠簵澶氬浘", "鎺㈠簵澶氬浘"),
-        SHOP_HOT_PICTURE(6, "搴楅摵鏂伴矞浜嬪鍥�", "搴楅摵鏂伴矞浜嬪鍥�"),
-        SHOP_PICTURE(7, "鍟嗗鍥剧墖澶氬浘", "鍟嗗鍥剧墖澶氬浘"),
-        AFTERSALE_APPLY(8, "鐢宠鍞悗琛ュ厖璇存槑闄勪欢", "鐢宠鍞悗琛ュ厖璇存槑闄勪欢"),
-        AFTERSALE_KD(9, "鐢宠鍞悗閭瘎璇存槑闄勪欢", "鐢宠鍞悗閭瘎璇存槑闄勪欢"),
-        ;
-        // 鎴愬憳鍙橀噺
-        private String name;
-        private int key;
-        private String noteinfo;// 鎻忚堪
-
-        // 鏋勯�犳柟娉�
-        MultiFile(int key, String name, String noteinfo) {
-            this.name = name;
-            this.key = key;
-            this.noteinfo = noteinfo;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (MultiFile c : MultiFile.values()) {
-                if (c.getKey() == index) {
-                    return c.name;
-                }
-            }
-            return null;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getInfo(int index) {
-            for (MultiFile c : MultiFile.values()) {
-                if (c.getKey() == index) {
-                    return c.noteinfo;
-                }
-            }
-            return null;
-        }
-
-        // get set 鏂规硶
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getKey() {
-            return key;
-        }
-
-        public void setKey(int key) {
-            this.key = key;
-        }
-
-        public String getNoteinfo() {
-            return noteinfo;
-        }
-
-    }
-
-
-
-    /**
-     * 璁㈠崟绠$悊
-     * 鐘舵�� 0鐢宠涓� 1宸叉敮浠�  2宸插彇娑�
-     */
-    public  enum ActivitySignupStatus{
-        APPLY_ING(0, "鐢宠涓�", "鐢宠涓�"),
-        PAY_DONE(1, "宸叉敮浠�", "宸叉敮浠�"),
-        CANCEL(2, "宸插彇娑�", "宸插彇娑�"),
-        ;
-        // 鎴愬憳鍙橀噺
-        private String name;
-        private int key;
-        private String noteinfo;// 鎻忚堪
-
-        // 鏋勯�犳柟娉�
-        ActivitySignupStatus(int key, String name, String noteinfo) {
-            this.name = name;
-            this.key = key;
-            this.noteinfo = noteinfo;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (ActivitySignupStatus c : ActivitySignupStatus.values()) {
-                if (c.getKey() == index) {
-                    return c.name;
-                }
-            }
-            return null;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getInfo(int index) {
-            for (ActivitySignupStatus c : ActivitySignupStatus.values()) {
-                if (c.getKey() == index) {
-                    return c.noteinfo;
-                }
-            }
-            return null;
-        }
-
-        // get set 鏂规硶
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getKey() {
-            return key;
-        }
-
-        public void setKey(int key) {
-            this.key = key;
-        }
-
-        public String getNoteinfo() {
-            return noteinfo;
-        }
-
-    }
-
-    /**
-     * 鍞悗鐘舵��
-     * 鐘舵�� 0寰呭鐞� 1寰呴偖瀵� 2宸插瘎鍑� 3鍟嗗宸查��娆� 4鍟嗗宸插彂璐�5鍞悗宸插畬鎴�6鍟嗗鎷掔粷 7宸插彇娑�
-     */
-    public  enum AftersaleStatus{
-        APPLY_ING(0, "寰呭鐞�", "寰呭鐞�"),
-        WAIT_SEND(1, "寰呴偖瀵�", "寰呴偖瀵�"),
-        SENDED(2, "瀹㈡埛宸插瘎鍑�", "瀹㈡埛宸插瘎鍑�"),
-        REFUND(3, "宸查��娆�", "宸查��娆�"),
-        SHOP_SENDED(4, "骞冲彴宸插彂璐�", "骞冲彴宸插彂璐�"),
-        DONE(5, "鍞悗宸插畬鎴�", "鍞悗宸插畬鎴�"),
-        SHOP_REFUSE(6, "宸叉嫆缁�", "骞冲彴鎷掔粷"),
-        CANCEL(7, "宸插彇娑�", "瀹㈡埛鍙栨秷鍞悗"),
-
-
-        ;
-        // 鎴愬憳鍙橀噺
-        private String name;
-        private int key;
-        private String noteinfo;// 鎻忚堪
-
-        // 鏋勯�犳柟娉�
-        AftersaleStatus(int key, String name, String noteinfo) {
-            this.name = name;
-            this.key = key;
-            this.noteinfo = noteinfo;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (AftersaleStatus c : AftersaleStatus.values()) {
-                if (c.getKey() == index) {
-                    return c.name;
-                }
-            }
-            return null;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getInfo(int index) {
-            for (AftersaleStatus c : AftersaleStatus.values()) {
-                if (c.getKey() == index) {
-                    return c.noteinfo;
-                }
-            }
-            return null;
-        }
-
-        // get set 鏂规硶
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getKey() {
-            return key;
-        }
-
-        public void setKey(int key) {
-            this.key = key;
-        }
-
-        public String getNoteinfo() {
-            return noteinfo;
-        }
-
-    }
-    /**
-     * 鍞悗绫诲瀷
-     *  鍞悗绫诲瀷 0閫�娆� 1閫�璐ч��娆� 2鎹㈣揣
-     */
-    public  enum AftersaleType{
-        TK(0, "閫�娆�", "閫�娆�"),
-        THTK(1, "閫�璐ч��娆�", "閫�璐ч��娆�"),
-        HH(2, "鎹㈣揣", "鎹㈣揣"),
-        ;
-        // 鎴愬憳鍙橀噺
-        private String name;
-        private int key;
-        private String noteinfo;// 鎻忚堪
-
-        // 鏋勯�犳柟娉�
-        AftersaleType(int key, String name, String noteinfo) {
-            this.name = name;
-            this.key = key;
-            this.noteinfo = noteinfo;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (AftersaleType c : AftersaleType.values()) {
-                if (c.getKey() == index) {
-                    return c.name;
-                }
-            }
-            return null;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getInfo(int index) {
-            for (AftersaleType c : AftersaleType.values()) {
-                if (c.getKey() == index) {
-                    return c.noteinfo;
-                }
-            }
-            return null;
-        }
-
-        // get set 鏂规硶
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getKey() {
-            return key;
-        }
-
-        public void setKey(int key) {
-            this.key = key;
-        }
-
-        public String getNoteinfo() {
-            return noteinfo;
-        }
-
-    }
-    /**
-     * 璁㈠崟绠$悊
-     * 鐘舵�� 0寰呮敮浠� 1寰呭彂璐� 2寰呮敹璐� 3浜ゆ槗瀹屾垚 4宸插叧闂� 5閮ㄥ垎鍙戣揣
-     */
-    public  enum OrderStatus{
-        WAIT_PAY(0, "寰呮敮浠�", "寰呮敮浠�"),
-        PAY_DONE(1, "寰呭彂璐�", "宸叉敮浠樹唬鍙戣揣"),
-        WAIT_RECEIVE(2, "寰呮敹璐�", "宸插彂璐у緟鏀惰揣"),
-        DONE(3, "浜ゆ槗瀹屾垚", "浜ゆ槗瀹屾垚"),
-        CLOSE(4, "宸插叧闂�", "宸插叧闂�"),
-        PART_DONE(5, "閮ㄥ垎鍙戣揣", "閮ㄥ垎鍙戣揣"),
-
-
-        ;
-        // 鎴愬憳鍙橀噺
-        private String name;
-        private int key;
-        private String noteinfo;// 鎻忚堪
-
-        // 鏋勯�犳柟娉�
-        OrderStatus(int key, String name, String noteinfo) {
-            this.name = name;
-            this.key = key;
-            this.noteinfo = noteinfo;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (OrderStatus c : OrderStatus.values()) {
-                if (c.getKey() == index) {
-                    return c.name;
-                }
-            }
-            return null;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getInfo(int index) {
-            for (OrderStatus c : OrderStatus.values()) {
-                if (c.getKey() == index) {
-                    return c.noteinfo;
-                }
-            }
-            return null;
-        }
-
-        // get set 鏂规硶
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getKey() {
-            return key;
-        }
-
-        public void setKey(int key) {
-            this.key = key;
-        }
-
-        public String getNoteinfo() {
-            return noteinfo;
-        }
-
-    }
-
-
-    /**
-     * 璁㈠崟绫诲瀷
-     *  璁㈠崟绫诲瀷 0骞冲彴鍟嗗煄 1鍜栬眴鍟嗗煄 2鍜栧暋璁″垝缂栫爜
-     */
-    public  enum OrderType{
-        ADMINPLAT(0, "骞冲彴鍟嗗煄 ", "骞冲彴鍟嗗煄 "),
-        KADOUPLAT(1, "鍜栬眴鍟嗗煄", "鍜栬眴鍟嗗煄"),
-        COFFERPLAN(2, "2鍜栧暋璁″垝缂栫爜", "2鍜栧暋璁″垝缂栫爜")
-
-
-        ;
-        // 鎴愬憳鍙橀噺
-        private String name;
-        private int key;
-        private String noteinfo;// 鎻忚堪
-
-        // 鏋勯�犳柟娉�
-        OrderType(int key, String name, String noteinfo) {
-            this.name = name;
-            this.key = key;
-            this.noteinfo = noteinfo;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getName(int index) {
-            for (OrderType c : OrderType.values()) {
-                if (c.getKey() == index) {
-                    return c.name;
-                }
-            }
-            return null;
-        }
-
-        // 鏅�氭柟娉�
-        public static String getInfo(int index) {
-            for (OrderType c : OrderType.values()) {
-                if (c.getKey() == index) {
-                    return c.noteinfo;
-                }
-            }
-            return null;
-        }
-
-        // get set 鏂规硶
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getKey() {
-            return key;
-        }
-
-        public void setKey(int key) {
-            this.key = key;
-        }
-
-        public String getNoteinfo() {
-            return noteinfo;
-        }
-
-    }
-
-    public enum ShareType{
-//    0娲诲姩1鎺㈠簵2鍜ㄨ3搴楅摵 4鍟嗗搧5鍒嗕韩閭�璇锋捣鎶�
-        SHARE_ACTIVITY_ACTIVITY(0,"娲诲姩","娲诲姩"),
-        SHARE_ACTIVITY_VISITSHOP(1,"鎺㈠簵","鍜ㄨ"),
-        SHARE_ACTIVITY_NEW(2,"鍜ㄨ","鍜ㄨ"),
-        SHARE_SHOP(3,"搴楅摵","搴楅摵" ),
-        SHARE_GOODS(4,"鍟嗗搧","鍟嗗搧"),
-        SHARE_POSTER(5,"鍒嗕韩閭�璇锋捣鎶�","鍒嗕韩閭�璇锋捣鎶�")
-
-        ;
-        private Integer key;
-
-        private String name;
-
-        private String des;
-
-        ShareType(Integer key, String name, String des) {
-            this.key = key;
-            this.name = name;
-            this.des = des;
-        }
-
-        public Integer getKey() {
-            return key;
-        }
-
-        public void setKey(Integer key) {
-            this.key = key;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public String getDes() {
-            return des;
-        }
-
-        public void setDes(String des) {
-            this.des = des;
-        }
-    }
-
-    /**
-     * 鍜栬眴浠诲姟
-     */
-    public enum CoffeeBeanTask{
-
-        SIGN_BOARD(1,"SIGN_BOARD","姣忔棩绛惧埌"),
-        SHARE_INFO(6,"SHARE_INFO","鍒嗕韩璧勮"),
-        SHARE_INVITE_BILL(2,"SHARE_INVITE_BILL","鍒嗕韩閭�璇锋捣鎶�"),
-        INVITE_USER_LOGIN(3,"INVITE_USER_LOGIN","閭�璇锋柊鐢ㄦ埛娉ㄥ唽"),
-        EXCHANGE_GOODS(4,"INVITE_USER_LOGIN","鍏戞崲鍟嗗搧"),
-        EXCHANGE_COUPON(5,"INVITE_USER_LOGIN","鍏戞崲浼樻儬鍒�"),
-        POST_COMMENTS(7,"POST_COMMENTS","鍙戝竷璇勮"),
-        COFFEE_MAP_CONSUME(8,"COFFEE_MAP_CONSUME","鍜栧暋鍦板浘娑堣垂"),
-        ;
-
-        //  0骞冲彴娉ㄥ唽 1绛惧埌 2鍒嗕韩閭�璇� 3閭�璇锋柊鐢ㄦ埛 4鍏戞崲鍟嗗搧 5鍏戞崲浼樻儬鍒�
-        // 鎴愬憳鍙橀噺
-        private Integer key;
-
-        private String name;
-
-        private String des;// 鎻忚堪
-
-        CoffeeBeanTask(Integer key, String name, String des) {
-            this.key = key;
-            this.name = name;
-            this.des = des;
-        }
-
-        public Integer getKey() {
-            return key;
-        }
-
-        public void setKey(Integer key) {
-            this.key = key;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public String getDes() {
-            return des;
-        }
-
-        public void setDes(String des) {
-            this.des = des;
-        }
-    }
-
-
-
-    public enum NoticeType{
 
-//        0璁㈠崟閫氱煡 1绯荤粺娑堟伅 2浜掑姩娑堟伅 3浼樻儬鍒告彁閱� 4瀹樻柟瀹㈡湇 5娲诲姩鎺ㄨ崘 6鎴戠殑鍏虫敞
 
 }
diff --git a/server/dmvisit_service/src/main/java/com/doumee/dao/business/VisitsMapper.java b/server/dmvisit_service/src/main/java/com/doumee/dao/business/VisitsMapper.java
index 28d77b8..977569f 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/dao/business/VisitsMapper.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/dao/business/VisitsMapper.java
@@ -3,10 +3,13 @@
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.doumee.dao.business.model.Visits;
 
+import java.util.List;
+
 /**
  * @author 姹熻箘韫�
  * @date 2023/11/30 15:33
  */
 public interface VisitsMapper extends BaseMapper<Visits> {
 
+    void insertBatchSomeColumn(List<Visits> withUserList);
 }
diff --git a/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java b/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java
index d0e63a5..bcb9649 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java
@@ -99,7 +99,9 @@
     @ApiModelProperty(value = "璇佷欢鏄剧ず淇℃伅")
     @ExcelColumn(name="璇佷欢鏄剧ず淇℃伅")
     private String idcardDecode;
-
+    @ApiModelProperty(value = "璇佷欢绫诲瀷 0韬唤璇� 1娓境璇佷欢 2鎶ょ収", example = "1")
+    @ExcelColumn(name="璇佷欢绫诲瀷 0韬唤璇� 1娓境璇佷欢 2鎶ょ収")
+    private Integer idcardType;
     @ApiModelProperty(value = "宸ュ彿")
     @ExcelColumn(name="宸ュ彿")
     private String code;
@@ -111,7 +113,9 @@
     @ApiModelProperty(value = "鐘舵�� 0姝e父 1绂佺敤 2鎷夐粦/鍐荤粨", example = "1")
     @ExcelColumn(name="鐘舵�� 0姝e父 1绂佺敤 2鎷夐粦/鍐荤粨")
     private Integer status;
-
+    @ApiModelProperty(value = "鎬у埆 1鐢� 2濂� ", example = "1")
+    @ExcelColumn(name="鎬у埆 1鐢� 2濂�")
+    private Integer sex;
     @ApiModelProperty(value = "娣诲姞浜虹紪鐮侊紙鑷叧鑱旓級", example = "1")
     @ExcelColumn(name="娣诲姞浜虹紪鐮侊紙鑷叧鑱旓級")
     private Integer parentId;
diff --git a/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java b/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java
index e38623c..e498b41 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java
@@ -130,8 +130,8 @@
     @ExcelColumn(name="鎺ュ緟浜哄憳")
     private Integer receptMemberId;
 
-    @ApiModelProperty(value = "瀹℃牳鐘舵�� 0寰呭鏍� 1宸叉彁浜RP瀹℃壒  2瀹℃牳閫氳繃 3瀹℃牳涓嶉�氳繃 4鍙栨秷", example = "1")
-    @ExcelColumn(name="瀹℃牳鐘舵�� 0寰呭鏍� 1宸叉彁浜RP瀹℃壒  2瀹℃牳閫氳繃 3瀹℃牳涓嶉�氳繃 4鍙栨秷")
+    @ApiModelProperty(value = "瀹℃牳鐘舵�� 0寰呭鏍� 1宸叉彁浜RP瀹℃壒  2瀹℃牳閫氳繃 3瀹℃牳涓嶉�氳繃 4鍙栨秷 5涓嬪彂鎴愬姛 6涓嬪彂澶辫触", example = "1")
+    @ExcelColumn(name="瀹℃牳鐘舵�� 0寰呭鏍� 1宸叉彁浜RP瀹℃壒  2瀹℃牳閫氳繃 3瀹℃牳涓嶉�氳繃 4鍙栨秷 5涓嬪彂鎴愬姛 6涓嬪彂澶辫触")
     private Integer status;
 
     @ApiModelProperty(value = "鍒濆浜虹紪鐮�", example = "1")
@@ -165,7 +165,9 @@
     @ApiModelProperty(value = "璇佷欢绫诲瀷 0韬唤璇� 1娓境璇佷欢 2鎶ょ収", example = "1")
     @ExcelColumn(name="璇佷欢绫诲瀷 0韬唤璇� 1娓境璇佷欢 2鎶ょ収")
     private Integer idcardType;
-
+    @ApiModelProperty(value = "鎬у埆 1鐢� 2濂� ", example = "1")
+    @ExcelColumn(name="鎬у埆 1鐢� 2濂�")
+    private Integer sex;
     @ApiModelProperty(value = "杞︾墝鍙凤紝澶氫釜鐢ㄨ嫳鏂囬�楀彿闅斿紑")
     @ExcelColumn(name="杞︾墝鍙凤紝澶氫釜鐢ㄨ嫳鏂囬�楀彿闅斿紑")
     private String carNos;
@@ -181,6 +183,9 @@
     @ApiModelProperty(value = "娴峰悍鏍囪瘑")
     @ExcelColumn(name="娴峰悍鏍囪瘑")
     private String hkId;
+    @ApiModelProperty(value = "openid")
+    @ExcelColumn(name="openid")
+    private String openid;
 
     @ApiModelProperty(value = "娴峰悍鍚屾鐘舵�� 0鏈悓姝� 1宸插悓姝�", example = "1")
     @ExcelColumn(name="娴峰悍鍚屾鐘舵�� 0鏈悓姝� 1宸插悓姝�")
diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
index 041f876..d41ae86 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -4,6 +4,13 @@
 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.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.VisitAppointmentRequest;
+import com.doumee.core.haikang.model.param.respose.VisitAppointmentResponse;
+import com.doumee.core.haikang.service.HKService;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.utils.Constants;
@@ -25,9 +32,11 @@
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.DigestUtils;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -63,18 +72,9 @@
      * @return
      */
     @Override
+    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
     public Integer createFk(Visits visits) {
-        if(visits.getStarttime() == null
-                || visits.getEndtime() == null
-                ||  StringUtils.isBlank(visits.getReason())
-                ||  StringUtils.isBlank( visits.getName())
-                ||  StringUtils.isBlank( visits.getPhone())
-                ||  visits.getIdcardType() == null
-                ||  StringUtils.isBlank( visits.getFaceImg() )
-                ||  StringUtils.isBlank( visits.getIdcardNo() )
-                || visits.getReceptMemberId() == null){
-            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝淇℃伅濉啓涓嶆纭紒");
-        }
+        isValidBaseParam(visits);
         //妫�鏌ユ槸鍚﹀繀椤荤瓟棰橈紝骞朵笖绗﹀悎绛旈瑕佹眰
         ProblemLog problemLog = isValidProblemLog(visits);
         //鑾峰彇鐢宠鐨勬捣搴疯闂棬绂佺粍淇℃伅
@@ -88,31 +88,223 @@
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝韬唤璇佸彿鐮佹湁璇紝璇锋牳瀹炲悗閲嶈瘯锛�");
         }
         Date date = new Date();
-
-        visits.setBirthday(Constants.getBirthdyByCardNo(visits.getIdcardNo()));
-        //韬唤璇佸彿瀛樺偍瀵嗘枃
-        visits.setIdcardNo(DESUtil.encrypt(Constants.EDS_PWD, visits.getIdcardNo()));//韬唤璇佸彿鍔犲瘑
-        visits.setIdcardDecode(Constants.getTuominStr(visits.getIdcardNo()));//鑴辨晱鎵嬫満鍙�
-        visits.setCreateDate(date);
-
         //璁垮淇℃伅(浣跨敤韬唤璇佸彿鏌ヨ鏄惁宸插瓨鍦ㄦ敼鏅�氳瀹紝娌℃湁鍒欐柊澧烇紝瀛樺湪鍒欐洿鏂皁penid绛変俊鎭�)
-        Member member = getMemberByIdcardno(visits);
+        Member member =dealMemberAndVisits(visits);
+        //鍒濆鍖栬瀹俊鎭�
+        initVisitInfo(visits,date);
+        //鍙戣捣ERP瀹℃壒鐢宠
+        String erpid = startSendErpCheck(visits);
+        if(StringUtils.isNotBlank(erpid)){
+            visits.setErpId(erpid);
+        }else{
+            throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵逛笉璧凤紝鍙戣捣鎷滆瀹℃壒鐢宠澶辫触锛�");
+        }
         visitsMapper.insert(visits);
-
-
+        initWithVisitInfo(visits);
         updateProblemLog(visits,problemLog,member);
-
         return visits.getId();
     }
 
-    private Member getMemberByIdcardno(Visits idcardNo) {
-        Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda()
-//                .eq(Member::getType,Constants.MEMBER_TYPE)
-                .eq(Member::getIdcardNo,idcardNo.getIdcardNo())
-        );
+    /**
+     * 鏍¢獙蹇呭~椤规暟鎹槸鍚﹀悎娉�
+     * @param visits
+     */
+    private void isValidBaseParam(Visits visits) {
+        if(visits.getStarttime() == null
+                || visits.getEndtime() == null
+                ||  StringUtils.isBlank(visits.getReason())
+                ||  StringUtils.isBlank( visits.getName())
+                ||  StringUtils.isBlank( visits.getPhone())
+                ||  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() <= visits.getStarttime().getTime()){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝棰勭害缁撴潫鏃堕棿蹇呴』澶т簬寮�濮嬫椂闂达紒");//
+        }
+    }
+    private void isValidWithVisitParam(Visits visits,  List<Member> addList,  List<Member> updateList) {
+        if(  StringUtils.isBlank( visits.getName())
+                ||  StringUtils.isBlank( visits.getPhone())
+                ||  visits.getIdcardType() == null
+                ||  StringUtils.isBlank( visits.getFaceImg() )
+                ||  StringUtils.isBlank( visits.getIdcardNo() )
+                ){
+            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(), "瀵逛笉璧凤紝棰勭害缁撴潫鏃堕棿蹇呴』澶т簬寮�濮嬫椂闂达紒");//
+        }
+        if(isRepeatedMember(visits,addList,updateList)){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝鎵嬫満鍙锋垨韬唤璇佸彿鍑虹幇閲嶅鏁版嵁锛岃淇敼鍚庨噸鏂版彁浜わ紒");//
+        }
+    }
+
+    private boolean isRepeatedMember(Visits visits, List<Member> addList, List<Member> updateList) {
+        if(addList.size()>0){
+            for(Member m :addList){
+                if(StringUtils.equals(visits.getPhone(), m.getPhone()) || StringUtils.equals(visits.getIdcardNo(), m.getIdcardDecode())){
+                    return true;
+                }
+            }
+        }
+        if(updateList.size()>0){
+            for(Member m :updateList){
+                if(StringUtils.equals(visits.getPhone(), m.getPhone()) || StringUtils.equals(visits.getIdcardNo(), m.getIdcardDecode())){
+                    return true;
+                }
+            }
+        }
+        return  false;
+    }
+
+    private void initWithVisitInfo(Visits visits) {
+        if(visits.getWithUserList()!=null && visits.getLwWithUserList().size()>0){
+            for(Visits v :visits.getWithUserList()){
+                v.setParentId(visits.getId());
+                v.setStarttime(visits.getStarttime());
+                v.setEndtime(visits.getEndtime());
+                v.setIsdeleted(Constants.ZERO);
+                v.setCreateDate(visits.getCreateDate());
+                v.setErpId(visits.getErpId());
+                v.setHkStatus(Constants.ZERO);
+                v.setStatus(Constants.ZERO);
+            }
+            //鎵归噺鎻掑叆鏁版嵁
+            visitsMapper.insertBatchSomeColumn(visits.getWithUserList());
+        }
+    }
+
+    private void initVisitInfo(Visits visits,Date date) {
+        visits.setHkStatus(Constants.ZERO);//鏈悓姝�
+        visits.setBirthday(Constants.getBirthdyByCardNo(visits.getIdcardNo()));
+        visits.setStatus(Constants.ZERO);//寰呭鎵�
+        visits.setIdcardNo(DESUtil.encrypt(Constants.EDS_PWD, visits.getIdcardNo()));//韬唤璇佸彿鍔犲瘑
+        //韬唤璇佸彿瀛樺偍瀵嗘枃
+        visits.setIdcardDecode(Constants.getTuominStr(visits.getIdcardNo()));//鑴辨晱鎵嬫満鍙�
+        visits.setCreateDate(date);
+    }
+
+    private String startSendErpCheck(Visits visits) {
         return  null;
     }
 
+    private String visitAppiontment(Visits visits) {
+        VisitAppointmentRequest param = new VisitAppointmentRequest();
+        param.setVisitStartTime(HKTools.getISO8601Timestamp(visits.getStarttime()));
+        param.setVisitEndTime(HKTools.getISO8601Timestamp(visits.getStarttime()));
+        BaseResponse<VisitAppointmentResponse>  res = HKService.visitAppiontment(param);
+        if(res==null || !StringUtils.equals(res.getCode(), HKConstants.RESPONSE_SUCCEE) || res.getData()==null){
+          //濡傛灉鍙戣捣棰勭害澶辫触
+            visits.setStatus(Constants.VisitStatus.xfFail);
+        }else{
+            visits.setStatus(Constants.VisitStatus.xfSuccess);
+            visits.setHkStatus(Constants.ONE);
+            visits.setHkId(res.getData().getAppointRecordId());
+        }
+        visits.setHkDate(visits.getCheckDate());
+        return  res.getData().getAppointRecordId();
+    }
+
+    /**
+     * 鏍¢鐢宠珛浜轰俊鎭紝鏈夊垯淇敼锛屾棤鍒欐柊澧烇紝骞剁粦瀹氭渶鏂皁penid鏁版嵁
+     * @param visits
+     * @return
+     */
+    private Member  dealMemberAndVisits(Visits visits ) {
+        if(StringUtils.isNotBlank(visits.getOpenid())){
+            //鍏堟竻绌哄師鏈夎瀹㈢殑openid缁戝畾鍏崇郴
+            memberMapper.update(null, new UpdateWrapper<Member>().lambda()
+                    .eq(Member::getType,Constants.memberType.visitor)
+                    .eq(Member::getOpenid,visits.getOpenid())
+                    .set(Member::getOpenid,null)
+            );
+        }
+        List<Member> addList = new ArrayList<>();
+        List<Member> editList = new ArrayList<>();
+        //鐢宠浜轰俊鎭�
+        Member m = getMemberListParam(visits.getIdcardNo(),visits,addList,editList);
+        //闅忚浜哄憳淇℃伅澶勭悊
+        if(visits.getWithUserList()!= null && visits.getWithUserList().size()>0){
+            for(Visits model:visits.getWithUserList()){
+                //鏍¢獙闅忚浜哄憳濉姤鏁版嵁鍚堟硶鎬�
+                isValidWithVisitParam(model,addList,editList);
+                model.setCreateDate(visits.getCreateDate());
+                getMemberListParam(model.getIdcardNo(),visits,addList,editList);
+            }
+        }
+        return  m;
+    }
+
+    private Member getMemberListParam(String cardno, Visits visits, List<Member> addList, List<Member> editList) {
+        if(!Constants.checkCarNo(visits.getCarNos())){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝杞︾墝鍙枫��"+visits.getCarNos()+"銆戜笉鍚堟硶锛岃鏍稿疄鍚庨噸璇晘");
+        }
+        Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda()
+                .eq(Member::getType,Constants.memberType.visitor)
+                .eq(Member::getIdcardType,visits.getIdcardType())
+                .eq(Member::getIdcardNo,visits.getIdcardNo()).last("limit 1" )
+        );
+        if(member == null){
+            //濡傛灉鐢ㄦ埛涓嶅瓨鍦紝鍒欐柊澧�
+            member.setCreateDate(visits.getCreateDate());
+            member.setIsdeleted(Constants.ZERO);
+            member.setIdcardNo(visits.getIdcardNo());
+            member.setIdcardDecode(visits.getIdcardDecode());
+            member.setIdcardNo(DESUtil.encrypt(Constants.EDS_PWD, cardno));//韬唤璇佸彿鍔犲瘑
+            member.setIdcardDecode(Constants.getTuominStr(cardno));//鑴辨晱鎵嬫満鍙�
+            member.setName(visits.getName());
+            member.setPhone(visits.getPhone());
+            member.setOpenid(visits.getOpenid());
+            member.setType(Constants.memberType.visitor);
+            member.setStatus(Constants.ZERO);
+            member.setSex(visits.getSex());
+            // 鏂板璁垮璁板綍
+            addList.add(member);
+        }else{
+            if(!Constants.equalsInteger(Constants.ZERO,member.getStatus() )){
+                //濡傛灉鐢ㄦ埛鐘舵�佸紓甯革紝鍒欐彁绀�
+                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝璇ヨ韩浠借瘉鍙疯绂佹璁块棶鐢宠锛屽鏈夌枒闂紝璇疯仈绯绘偍鐨勬嫓璁夸汉杩涜鏍稿疄");
+            }
+            //鏍告煡棰勭害鐢ㄦ埛鏄惁瀛樺湪鏈绂荤殑棰勭害璁板綍
+            isExsitNoOutVisisRecord(member);
+            member.setEditDate(visits.getCreateDate());
+            member.setIsdeleted(Constants.ZERO);
+            member.setIdcardNo(visits.getIdcardNo());
+            member.setIdcardDecode(visits.getIdcardDecode());
+            member.setName(visits.getName());
+            member.setPhone(visits.getPhone());
+            member.setOpenid(visits.getOpenid());
+            member.setSex(visits.getSex());
+            // 鏇存柊璁垮淇℃伅,
+            editList.add(member);
+        }
+        return  member;
+    }
+
+    /**
+     * 鏍告煡棰勭害鐢ㄦ埛鏄惁瀛樺湪鏈绂荤殑棰勭害璁板綍
+     * @param member
+     */
+    private void isExsitNoOutVisisRecord(Member member) {
+        Visits v = visitsMapper.selectOne(new QueryWrapper<Visits>().lambda()
+                .eq(Visits::getPhone, member.getPhone())
+                .eq(Visits::getStatus,Constants.VisitStatus.xfSuccess)
+                .last(" limit 1" )
+        );
+        if(v !=null){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝鎵嬫満鍙枫��"+member.getPhone()+"銆戝瓨鍦ㄦ湭绛剧棰勭害鐢宠锛屼笉鑳介噸澶嶇敵璇峰摝锛�");
+        }
+    }
+
     private List<Member> isValideWithUsers(List<Visits> withUserList) {
         if(withUserList!= null && withUserList .size()>0){
             for(Visits model:withUserList){
diff --git a/server/dmvisit_web/src/main/java/com/doumee/api/common/PublicController.java b/server/dmvisit_web/src/main/java/com/doumee/api/common/PublicController.java
index d8e6bc0..eec54de 100644
--- a/server/dmvisit_web/src/main/java/com/doumee/api/common/PublicController.java
+++ b/server/dmvisit_web/src/main/java/com/doumee/api/common/PublicController.java
@@ -185,20 +185,6 @@
 
 
 
-    @ApiOperation(value = "涓婁紶鏈嶅姟鍣ㄦ湰鍦�", notes = "涓婁紶鏈嶅姟鍣ㄦ湰鍦�", httpMethod = "POST", position = 6)
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "folder", value = "鏂囦欢澶�", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
-    })
-    @PostMapping(value = "/uploadLocal", headers = "content-type=multipart/form-data")
-    public void uploadLocal(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-
-        // CommonsMultipartFile files = (CommonsMultipartFile) multipartRequest.getFile("filedata");
-        uploadFileLocal(multipartRequest,  folder+ "/", response,
-                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ROOT_PATH).getCode() ,
-                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode());
-
-    }
 
     public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception {
         response.setCharacterEncoding("UTF-8");
diff --git a/server/openapi/src/main/java/com/doumee/api/common/PublicController.java b/server/openapi/src/main/java/com/doumee/api/common/PublicController.java
index d8e6bc0..eec54de 100644
--- a/server/openapi/src/main/java/com/doumee/api/common/PublicController.java
+++ b/server/openapi/src/main/java/com/doumee/api/common/PublicController.java
@@ -185,20 +185,6 @@
 
 
 
-    @ApiOperation(value = "涓婁紶鏈嶅姟鍣ㄦ湰鍦�", notes = "涓婁紶鏈嶅姟鍣ㄦ湰鍦�", httpMethod = "POST", position = 6)
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "folder", value = "鏂囦欢澶�", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
-    })
-    @PostMapping(value = "/uploadLocal", headers = "content-type=multipart/form-data")
-    public void uploadLocal(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-
-        // CommonsMultipartFile files = (CommonsMultipartFile) multipartRequest.getFile("filedata");
-        uploadFileLocal(multipartRequest,  folder+ "/", response,
-                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ROOT_PATH).getCode() ,
-                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode());
-
-    }
 
     public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception {
         response.setCharacterEncoding("UTF-8");

--
Gitblit v1.9.3