jiaosong
2023-12-06 de64b6758d486eee7cd112853fb0a9cc3af5cf42
Merge remote-tracking branch 'origin/master'
已添加48个文件
已删除3个文件
已修改11个文件
已重命名1个文件
3462 ■■■■■ 文件已修改
.idea/compiler.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Maven__commons_net_commons_net_3_8_0.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
log/eva.log 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_admin/src/main/java/com/doumee/api/business/HkSyncController.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_admin/src/main/resources/application.yml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/config/mybatis/EasySqlInjector.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/config/mybatis/MyBatisPlusConfig.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/HKUtil.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java 310 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/BaseRequst.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/BaseResponse.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/AcsDeviceListRequest.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/CarChargeAddRequest.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/CarChargeDelRequest.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/EntranceListRequest.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/FaceAddRequest.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/FaceEditRequest.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/FacePictureRequest.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/OrgAddRequest.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/OrgDelRequest.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/OrgEditRequest.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/ParkListRequest.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/ParkReservationAddRequest.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/ParkReservationDelRequest.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/PrivilegeGroupRequest.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/UserAddFaceRequest.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/UserAddRequest.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentMDJRequest.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentPermissonRequest.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentRequest.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentVistorRequest.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/AcsDeviceInfoResponse.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/AcsDeviceListResponse.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/EntranceListResponse.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/FaceAddOrEditesponse.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/OrgListResponse.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/OrgOrUserAddFailureResponse.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/OrgOrUserAddResponse.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/OrgOrUserAddSuccessResponse.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/ParkListResponse.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/ParkReservationAddResponse.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/PrivilegeGroupListResponse.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/PrivilegeGroupResponse.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/UserAddResponse.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/UserDelResponse.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/VisitAppointmentResponse.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/VisitAppointmentVistorResponse.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java 440 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/utils/FtpUtil.java 652 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/utils/haikang/base/HKConstants.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/utils/haikang/base/HKTools.java 998 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/utils/haikang/service/HKService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/DeviceMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Device.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/CarEventService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/HkSyncService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/HkSyncServiceImpl.java 175 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/openapi/src/main/java/com/doumee/model/response/erp/UserListRespone.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/compiler.xml
@@ -2,6 +2,7 @@
<project version="4">
  <component name="CompilerConfiguration">
    <annotationProcessing>
      <profile default="true" name="Default" enabled="true" />
      <profile name="Maven default annotation processors profile" enabled="true">
        <sourceOutputDir name="target/generated-sources/annotations" />
        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
.idea/libraries/Maven__commons_net_commons_net_3_8_0.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<component name="libraryTable">
  <library name="Maven: commons-net:commons-net:3.8.0">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/commons-net/commons-net/3.8.0/commons-net-3.8.0.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$MAVEN_REPOSITORY$/commons-net/commons-net/3.8.0/commons-net-3.8.0-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$MAVEN_REPOSITORY$/commons-net/commons-net/3.8.0/commons-net-3.8.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>
log/eva.log
server/dmvisit_admin/src/main/java/com/doumee/api/business/HkSyncController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,45 @@
package com.doumee.api.business;
import com.doumee.api.BaseController;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
import com.doumee.core.haikang.service.HKService;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Device;
import com.doumee.service.business.DeviceService;
import com.doumee.service.business.HkSyncService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
 * @author æ±Ÿè¹„蹄
 * @date 2023/11/30 15:33
 */
@Api(tags = "海康数据同步接口")
@RestController
@RequestMapping("/business/hksync")
public class HkSyncController extends BaseController {
    @Autowired
    private HkSyncService hkSyncService;
    @PreventRepeat
    @ApiOperation("全量同步门禁设备接口")
    @PostMapping("/getDevices")
    @RequiresPermissions("business:hksync:device")
    public ApiResponse getDevices(@RequestBody AcsDeviceListRequest param) {
        hkSyncService.syncHkDevices(param);
        return ApiResponse.success(null);
    }
}
server/dmvisit_admin/src/main/resources/application.yml
@@ -30,7 +30,6 @@
    map-underscore-to-camel-case: true
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# ç¼“存内容设置
cache:
  session:
@@ -46,7 +45,6 @@
  smart: true
  # æŽ’除跟踪的URL正则
  exclude-patterns: .+/list[a-zA-Z0-9\-\_]*$, .+/tree[a-zA-Z0-9\-\_]*$, .+/page[a-zA-Z0-9\-\_]*$, .+/all[a-zA-Z0-9\-\_]*$, /swagger-resources.*
# æ—¥å¿—配置
logback:
@@ -69,7 +67,6 @@
  compression:
    enabled: true
    mime-types: application/json
  port: 10013
  tomcat:
    max-swallow-size: -1
server/dmvisit_service/src/main/java/com/doumee/config/mybatis/EasySqlInjector.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.doumee.config.mybatis;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
import java.util.List;
public class EasySqlInjector extends DefaultSqlInjector {
    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass ) {
        // æ³¨æ„ï¼šæ­¤SQL注入器继承了DefaultSqlInjector(默认注入器),调用了DefaultSqlInjector的getMethodList方法,保留了mybatis-plus的自带方法
        List<AbstractMethod> methodList = super.getMethodList(mapperClass);
        methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.UPDATE));
        return methodList;
    }
}
server/dmvisit_service/src/main/java/com/doumee/config/mybatis/MyBatisPlusConfig.java
@@ -20,4 +20,9 @@
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
    @Bean
    public EasySqlInjector sqlInjector() {
        return new EasySqlInjector();
    }
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/HKUtil.java
ÎļþÃû´Ó server/dmvisit_service/src/main/java/com/doumee/core/utils/haikang/HKUtil.java ÐÞ¸Ä
@@ -1,9 +1,8 @@
package com.doumee.core.utils.haikang;
package com.doumee.core.haikang;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,100 @@
package com.doumee.core.haikang.model;
import com.doumee.core.utils.Constants;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Data
public class HKConstants {
    private Logger logger = LoggerFactory.getLogger(HKConstants.class);
    //海康平台根据现场环境配置http还是https
    public static final String RESPONSE_SUCCEE = "0";
    public static String https ;
    /**
     * èƒ½åŠ›å¼€æ”¾å¹³å°çš„ç½‘ç«™è·¯å¾„   è·¯å¾„不用修改,就是/artemis
     */
    public static final String ARTEMIS_PATH = "/artemis";
    /**
     * æŽ¥å£åœ°å€é›†åˆ
     */
    public interface InterfacePath{
        String doorEvents = "/api/acs/v2/door/events";//门禁事件查询
        String rootOrg = "/api/resource/v1/org/rootOrg";//获取跟组织
        String addBatchOrg = "/api/resource/v1/org/batch/add";//批量新增组织
        String delBatchOrg = "/api/resource/v1/org/batch/delete";//批量删除组织
        String editOrg = "/api/resource/v1/org/single/update";//修改组织
        String addUser = "/api/resource/v2/person/single/add";//添加人员
        String addBatchUser = "/api/resource/v1/person/batch/add";//批量添加人员
        String editUser = "/api/resource/v1/person/single/update";//修改人员
        String delBatchUser = "/api/resource/v1/person/batch/delete";//批量删除人员
        String addFace = "/api/resource/v1/face/single/add";//添加人脸
        String editFace = "/api/resource/v1/face/single/update";//修改人脸
        String delFace = "/api/resource/v1/face/single/delete";//删除人脸
        String acsDeviceList = "/api/resource/v2/acsDevice/search";//查询门禁设备列表v2
        String acsDeviceTimeRangeList = "/api/resource/v1/acsDevice/timeRange";//增量获取门禁设备数据
        String parkAddition = "/api/pms/v2/parkingSpace/reservations/addition";//车位预约v2
        String parkDeletion= "/api/pms/v1/parkingSpace/reservations/deletion";//车位取消预约v2
        String carChargeAddtion= "/api/pms/v1/car/charge";//固定车充值包期
        String carChargeDeletion= "/api/pms/v1/car/charge/deletion";//固定车取消包期
        String getParkList= "/api/resource/v1/park/parkList";//获取停车库列表
        String getEntranceList= "/api/resource/v1/entrance/entranceList";//获取出入口列表
        String visitAppiontment= "/api/visitor/v2/appointment";//访客预约v2
        String visitAppiontmentMDJ= "/api/visitor/v1/appointment/registration";//访客预约免登记v2
        String visitCancel= "/api/visitor/v1/appointment/cancel";//取消访客预约
        String facePicture= "/api/resource/v1/person/picture";//提取用户人脸照片
        String privilegeGroup= "/api/visitor/v1/privilege/group";//查询访客权限组
    }
    /**
     * é¡”色枚举
     */
    public  enum Colors {
        SYSTEM(0, "系统用户"  )
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        // æž„造方法
        Colors(int key, String name ) {
            this.name = name;
            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 æ–¹æ³•
        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;
        }
    }
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,310 @@
package com.doumee.core.haikang.model;
import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
public class HKTools {
//    private static final Logger logger = LoggerFactory.getLogger(HKUtil.class);
    public static void main(String[] args) throws ParseException {
    }
    private static Map<String, String> getPath(String str) {
        final String getCamsApi = HKConstants.ARTEMIS_PATH  + str;
        Map<String, String> path = new HashMap<String, String>(2) {
            {
                put(HKConstants.https, getCamsApi);// æ ¹æ®çŽ°åœºçŽ¯å¢ƒéƒ¨ç½²ç¡®è®¤æ˜¯http还是https
            }
        };
        return  path;
    }
    /**
     * èŽ·å–é—¨ç¦æ—¶é—´æ•°æ®é›†åˆ
     * @return
     */
    public static String getRootOrg() {
        Map<String, String> path = getPath(HKConstants.InterfacePath.rootOrg);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, "", null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * æ›´æ–°ç»„织信息
     * @param body
     * @return
     */
    public static String editOrg(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.editOrg);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * æ–°å¢žç»„织信息
     * @param body
     * @return
     */
    public static String addBatchOrg(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.addBatchOrg);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * åˆ é™¤ç»„织信息
     * @param body
     * @return
     */
    public static String delOrg(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.delBatchOrg);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * æ–°å¢žäººå‘˜ä¿¡æ¯
     * @param body
     * @return
     */
    public static String addUser(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.addUser);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * æ‰¹é‡æ–°å¢žäººå‘˜ä¿¡æ¯
     * @param body
     * @return
     */
    public static String addBatchUser(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.addBatchUser);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * æ‰¹é‡åˆ é™¤äººå‘˜ä¿¡æ¯
     * @param body
     * @return
     */
    public static String delBatchUser(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.delBatchUser);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * ä¿®æ”¹äººå‘˜ä¿¡æ¯
     * @param body
     * @return
     */
    public static String editUser(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.editUser);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    æ·»åŠ äººè„¸ä¿¡æ¯
     * @param body
     * @return
     */
    public static String addFace(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.addFace);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    ç¼–辑人脸信息
     * @param body
     * @return
     */
    public static String editFace(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.editFace);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    åˆ é™¤äººè„¸ä¿¡æ¯
     * @param body
     * @return
     */
    public static String delFace(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.delFace);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    å…¨é‡èŽ·å–è½¦åº“ä¿¡æ¯
     * @param body
     * @return
     */
    public static String parkList(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.getParkList);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    æ ¹æ®è½¦åº“编码查询出入口列表
     * @param body
     * @return
     */
    public static String entranceList(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.getEntranceList);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    è½¦è¾†é¢„约
     * @param body
     * @return
     */
    public static String parkAddition(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.parkAddition);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    è½¦è¾†å–消预约
     * @param body
     * @return
     */
    public static String parkDeletion(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.parkDeletion);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    å›ºå®šè½¦è¾†å……值(包期)
     * @param body
     * @return
     */
    public static String carChargeAddtion(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.carChargeAddtion);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    å›ºå®šè½¦è¾†å–消包期
     * @param body
     * @return
     */
    public static String carChargeDeletion(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.carChargeDeletion);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * èŽ·å–äººè„¸æ•°æ®ï¼ˆæå–äººè„¸è®¿é—®åœ°å€ï¼‰
     * @param body
     * @return
     */
    public static InputStream getFaceInputStream(String body)  throws  Exception{
        Map<String, String> path = getPath(HKConstants.InterfacePath.facePicture);
        //参数根据接口实际情况设置
        HttpResponse resp = ArtemisHttpUtil.doPostStringImgArtemis( path, body, null, null,"application/json",null);
        if (200==resp.getStatusLine().getStatusCode()) {
            HttpEntity entity = resp.getEntity();
            InputStream in = entity.getContent();
            return  in;
        }else{
            throw  new Exception("人脸下载出错");
        }
    }
    /**
     *    èŽ·å–é—¨ç¦è®¾å¤‡åˆ—è¡¨
     * @param body
     * @return
     */
    public static String acsDeviceList(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.acsDeviceList);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    å¢žé‡èŽ·å–é—¨ç¦è®¾å¤‡åˆ—è¡¨
     * @param body
     * @return
     */
    public static String acsDeviceTimeRangeList(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.acsDeviceList);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    è®¿å®¢é¢„约
     * @param body
     * @return
     */
    public static String visitAppiontment(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.visitAppiontment);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    è®¿å®¢å…ç™»è®°é¢„约
     * @param body
     * @return
     */
    public static String visitAppiontmentMDJ(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.visitAppiontmentMDJ);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    å–消访客预约
     * @param body
     * @return
     */
    public static String visitCancel(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.visitCancel);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     *    è®¿å®¢æƒé™ç»„
     * @param body
     * @return
     */
    public static String privilegeGroup(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.privilegeGroup);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        return  result;
    }
    /**
     * ä¼ å…¥Data类型日期,返回字符串类型时间(ISO8601标准时间)
     * @param date
     * @return
     */
    public static String getISO8601Timestamp(Date date){
        TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
        //TimeZone tz = TimeZone.getTimeZone("GMT-01");
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        df.setTimeZone(tz);
        String nowAsISO = df.format(date);
        return nowAsISO;
    }
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/BaseRequst.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
package com.doumee.core.haikang.model.param;
import lombok.Data;
@Data
public class BaseRequst<T> {
    private T data;
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/BaseResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package com.doumee.core.haikang.model.param;
import lombok.Data;
@Data
public class BaseResponse<T> {
    /**
     * è¿”回码
     * 0:成功
     * å…¶ä»–:失败
     * å‚考附录E.other.1 èµ„源目录错误码
     */
    private String code;
    /**
     * æŽ¥å£æ‰§è¡Œæƒ…况说明信息
     */
    private String msg;
    private T data;
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/AcsDeviceListRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class AcsDeviceListRequest {
 private String   name    ;//string    False    åç§°ï¼Œæ¨¡ç³Šæœç´¢ï¼Œæœ€å¤§é•¿åº¦32,若包含中文,最大长度指不超过按照指定编码的字节长度,即getBytes(“utf-8”).length
    private String[]        regionIndexCodes    ;//string[]    False    åŒºåŸŸç¼–号,可以为空; String[],支持根据区域批量查询;区域编号个数<=1000个;单个长度<=64Byte;,可从查询区域列表v2接口获取返回参数indexCode
    private Boolean      isSubRegion;//    boolean    False    true时,搜索regionIndexCodes及其子孙区域的资源;  false时,只搜索 regionIndexCodes的资源
    private Integer      pageNo    ;//integer    True    å½“前页码
    private Integer      pageSize;//    integer    True    åˆ†é¡µå¤§å°
    private String[]     authCodes    ;//string[]    False    æƒé™ç é›†åˆï¼Œè¯¦è§é™„录A.3 èµ„源权限码中门禁设备对应的资源权限码
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/CarChargeAddRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class CarChargeAddRequest {
    private String    parkSyscode;//        string    True    åœè½¦åº“唯一标识,可通过获取停车库列表接口获取
    private String    plateNo;//        string    True    è½¦ç‰Œå·ç 
    private String    fee;//        string    False    åŒ…期费用,单位:元,2位小数
    private String    startTime;//        string    True    åŒ…期开始时间时间格式:yyyy-MM-dd,如:2018-07-26
    private String     endTime;//        string    True    åŒ…期结束时间时间格式:yyyy-MM-dd,如:2018-07-27
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/CarChargeDelRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class CarChargeDelRequest {
    private String    parkSyscode;//    string    False    åœè½¦åº“唯一标识,为空时则取消当前车辆所有停车库的包期,可通过获取停车库列表接口获取
    private String      plateNo;//    string    True    è½¦ç‰Œå·ç 
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/EntranceListRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class EntranceListRequest {
    private String   parkIndexCodes        ;//    string    True    åœè½¦åœºå”¯ä¸€æ ‡è¯†é›† å¤šä¸ªå€¼ä½¿ç”¨è‹±æ–‡é€—号分隔,不超过1000个, å¯é€šè¿‡èŽ·å–åœè½¦åº“åˆ—è¡¨æŽ¥å£èŽ·å–
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/FaceAddRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,9 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class FaceAddRequest {
    private String  personId    ;//    string    True äººå‘˜Id
    private String  faceData;//        string    True äººè„¸å›¾ç‰‡base64编码后的字符数据
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/FaceEditRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class FaceEditRequest {
    private String  faceId    ;//    string    True    äººè„¸å›¾ç‰‡Id ï¼Œ  æ·»åŠ äººè„¸ æŽ¥å£è¿”回报文中的faceId字段,    æˆ–获取人员列表v2 æŽ¥å£è¿”回报文中的personPhotoIndexCode字段
    private String  faceData;//        string    True äººè„¸å›¾ç‰‡base64编码后的字符数据
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/FacePictureRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class FacePictureRequest {
    private String  picUri    ;//    string    True    å›¾ç‰‡ç›¸å¯¹URI  é€šè¿‡èŽ·å–äººå‘˜åˆ—è¡¨v2接口返回“picUri”字段
    private String  serverIndexCode;//        string    True    å›¾ç‰‡æœåŠ¡å™¨å”¯ä¸€æ ‡è¯† é€šè¿‡èŽ·å–äººå‘˜åˆ—è¡¨v2接口返回“serverIndexCode”字段
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/OrgAddRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class OrgAddRequest {
    private Integer    clientId;//    number    False    è°ƒç”¨æ–¹æŒ‡å®šæ ‡è¯†ï¼ŒæŽ¥å£æ‰§è¡ŒæˆåŠŸåŽå°†æœåŠ¡ç«¯ç”Ÿæˆçš„æ ‡è¯†ä¸Žæ­¤æ ‡è¯†ç»‘å®šåŽè¿”å›ž  æ‰€ä»¥å»ºè®®æ¯æ¬¡æŽ¥å£è°ƒç”¨ï¼Œclientid保持唯一。1~10个字符,只支持数字。 æ³¨é‡Šï¼šISC不对clientid做校验和存储
    private String  orgIndexCode;//    string    False    ç»„织唯一标志,不允许与其它组织唯一标志重复,包括已删除的组织,值为空或者不传此字段系统自动生成唯一标志;该字段禁止传0值。
    private String  orgName;//    string    True    ç»„织名称,1~32个字符;不能包含 â€™ / \ : * ? " < >
    private String  parentIndexCode    ;//string    True    çˆ¶ç»„织唯一标识码
    private String  orgCode;//    string    False    ç»„织编码,当添加小区节点时必填,编码使用01101开头的8位数字编码,当添加楼栋单元时必填,编码使用01101开头的20位数字编码,其它场景下改值无效
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/OrgDelRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class OrgDelRequest {
    private String[] indexCodes;//    string[]    True    å¾…删除的组织indexCode列表,单次提交上限为1000条  ä»ŽèŽ·å–ç»„ç»‡åˆ—è¡¨ æŽ¥å£èŽ·å–è¿”å›žå‚æ•°orgIndexCode
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/OrgEditRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,9 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class OrgEditRequest {
    private String   orgIndexCode    ;//string    True    ç»„织标识,必须保证已存在, èŽ·å–ç»„ç»‡åˆ—è¡¨ æŽ¥å£èŽ·å–è¿”å›žå‚æ•°orgIndexCode。
    private String   orgName    ;//string    False    ç»„织名称,1~32个字符;不能包含 â€™ / \ : * ? " < >
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/ParkListRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class ParkListRequest {
    private String  parkIndexCodes    ;//    string    False    åœè½¦åº“唯一标识集合  å¤šä¸ªå€¼ä½¿ç”¨è‹±æ–‡é€—号分隔,不超过1000个
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/ParkReservationAddRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class ParkReservationAddRequest {
    private String   parkSyscode;//    string    True    åœè½¦åº“唯一标识 æ¥æºäºŽæŸ¥è¯¢åœè½¦åº“列表接口,可通过获取停车库列表接口获取
    private String   plateNo;//    string    True    è½¦ç‰Œå·ç 
    private String    phoneNo;//    string    False    æ‰‹æœºå· çº¯æ•°å­—,位数暂不限制
    private String   owner;//    string    False    è”系人姓名
    private String    allowTimes;//    number    False    å…è®¸è¿›å‡ºæ¬¡æ•°ï¼Œ0:单次1:多次
    private String   isCharge    ;//string    False    æ˜¯å¦æ”¶è´¹0:收费1:免费
    private String   resvWay;//    string    False    é¢„约方式,5:第三方预约(默认)6:访客
    private String    startTime    ;//string    False    é¢„约开始时间 æŒ‰æ—¶é—´é¢„约时必填,按次预约不填 ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区,例如北京时间:2018-07-26T15:00:00+08:00
    private String    endTime    ;//string    False    é¢„约结束时间 æŒ‰æ—¶é—´é¢„约时必填,按次预约不填 ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区,例如北京时间:2018-07-26T15:00:00+08:00
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/ParkReservationDelRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class ParkReservationDelRequest {
    private String  reserveOrderNo    ;//string    True    é¢„约单号
    private String  way    ;//number    False    å–消方式1:用户取消(默认)         5:访客平台取消
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/PrivilegeGroupRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class PrivilegeGroupRequest {
    private String  name;//    string    False    è®¿å®¢æƒé™ç»„名称
    private int pageNo    ;//number    True    å½“前页码,要求大于0
    private int  pageSize    ;//number    True    æ¯é¡µè®°å½•总数,要求大于0且不超过1000
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/UserAddFaceRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
/**
 * äººè„¸base64请求参数
 */
@Data
public class UserAddFaceRequest {
    private String  faceData;//    string    True    äººè„¸å›¾ç‰‡base64编码后的字符
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/UserAddRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
import java.util.List;
/**
 * ç”¨æˆ·æ–°å¢žè¯·æ±‚参数
 */
@Data
public class UserAddRequest {
    private Integer  clientId;//number    False    äººå‘˜ä¸´æ—¶æ ‡å¿—,当调用方未指定personId时,clientId作为人员标志,在返回值中标志每个人员的添加结果。所以每次接口调用,每个人员的clientid需保持唯一,1~10个字符,只支持数字。注:clientid只对本次调用有效
    private String   personId    ;//string    False    äººå‘˜ID,可以指定人员personId,不允许与其他人员personId重复,包括已删除的人员。 ä¸ºç©ºæ—¶å¹³å°è‡ªåŠ¨ç”Ÿæˆäººå‘˜ID
    private String   personName;//    string    True    äººå‘˜åç§°ï¼Œ1~32个字符;不能包含 â€™ / \ : * ? " < >
    private String   gender;//    string    True    æ€§åˆ«ï¼Œ1:男;2:女;0:未知
    private String   orgIndexCode;//    string    True    æ‰€å±žç»„织标识,必须是已存在组织,从获取组织列表接口获取返回参数orgIndexCode
    private String   birthday    ;//string    False    å‡ºç”Ÿæ—¥æœŸï¼Œä¸¾ä¾‹ï¼š1992-09-12
    private String   phoneNo    ;//string    False    æ‰‹æœºå·ï¼Œ1-20位数字,平台上人员信息实名标识选择为手机号码时必填
    private String   email;//    string    False    é‚®ç®±ï¼Œä¸¾ä¾‹ï¼šhic@163.com
    private String   certificateType;//    string    False    è¯ä»¶ç±»åž‹ï¼Œå‚考附录A æ•°æ®å­—典,平台上人员信息实名标识选择为身份证件时必填
    private String   certificateNo;//    string    False    è¯ä»¶å·ç ï¼Œ1-20位数字字母,平台上人员信息实名标识选择为身份证件时必填
    private String   jobNo;//    string    False    å·¥å·ï¼Œ1-32个字符,平台上人员信息实名标识选择为工号时必填
    private List<UserAddFaceRequest> faces;//    object[]    False    äººè„¸ä¿¡æ¯
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentMDJRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
import java.util.List;
@Data
public class VisitAppointmentMDJRequest {
    private String receptionistId;//        string    True    è¢«è®¿äººå”¯ä¸€æ ‡è¯†ï¼ŒæŸ¥è¯¢äººå‘˜åˆ—表v2接口获取返回报文中的personId字段
    private VisitAppointmentPermissonRequest visitorPermissionSet    ;//object    False    æƒé™é›†åˆå°è£…对象
    private String   visitStartTime;//        string    True    é¢„计来访时间,时间参数需满足ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区,例如北京时间:2018-07-26T15:00:00+08:00
    private String   visitEndTime    ;//    string    True    é¢„计离开时间,时间参数需满足ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区,例如北京时间:2018-07-26T15:00:00+08:00预计离开时间必须晚于当前时间和预计来访时间
    private String  visitPurpose;//        string    False    æ¥è®¿äº‹ç”±ï¼Œé•¿åº¦ä¸º0~32个字符
    private VisitAppointmentVistorRequest visitorInfo    ;//object         True    è®¿å®¢ä¿¡æ¯
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentPermissonRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class VisitAppointmentPermissonRequest {
    private String    defaultPrivilegeGroupFlag    ;//    string    False    æ˜¯å¦ä½¿ç”¨é»˜è®¤æƒé™ç»„(1:使用;非1:不使用)
 private String[] privilegeGroupIds    ;//string[]    False    æƒé™ç»„ids,查询访客权限组接口获取返回报文中的privilegeGroupId字段
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
import java.util.List;
@Data
public class VisitAppointmentRequest {
    private String receptionistId;//        string    True    è¢«è®¿äººå”¯ä¸€æ ‡è¯†ï¼ŒæŸ¥è¯¢äººå‘˜åˆ—表v2接口获取返回报文中的personId字段
    private VisitAppointmentPermissonRequest visitorPermissionSet    ;//object    False    æƒé™é›†åˆå°è£…对象
    private String   visitStartTime;//        string    True    é¢„计来访时间,时间参数需满足ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区,例如北京时间:2018-07-26T15:00:00+08:00
    private String   visitEndTime    ;//    string    True    é¢„计离开时间,时间参数需满足ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区,例如北京时间:2018-07-26T15:00:00+08:00预计离开时间必须晚于当前时间和预计来访时间
    private String  visitPurpose;//        string    False    æ¥è®¿äº‹ç”±ï¼Œé•¿åº¦ä¸º0~32个字符
    private List<VisitAppointmentVistorRequest> visitorInfoList    ;//    object[]    True    è®¿å®¢ä¿¡æ¯åˆ—表,最大支持128位访客,其中最多支持4位访客带人脸信息,如果存在人脸上传失败,则整个预约失败。
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentVistorRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class VisitAppointmentVistorRequest {
    private String visitorName    ;//sstring    True    è®¿å®¢å§“名,长度不超过32,支持中英文字符,不能包含 â€™ / \ : * ? " < >
    private String gender;//    number    True    è®¿å®¢æ€§åˆ«1-男,2-女
    private String phoneNo;//    string    True    è”系电话,建议填写手机号码,仅支持纯数字
    private String plateNo;//    string    False    è½¦ç‰Œå·ï¼Œä¸èƒ½åŒ…含 â€™ / \ : * ? " < >
    private String certificateType;//    number    False    è¯ä»¶ç±»åž‹ï¼Œè¯¦è§é™„录A.11 è¯ä»¶ç±»åž‹
    private String certificateNo;//string    False    è¯ä»¶å·ç ï¼Œ1~20个数字、字母组成;证件号码非空时,证件类型必填;
    private String certAddr;//    string    False    è¯ä»¶åœ°ï¼Œæ”¯æŒ1-128位字母、汉字
    private String certIssuer;//    string    False    å‘证机关,支持1-32位字母、汉字
    private String nation;//    number    False
    private String birthplace;//    string    False    ç±è´¯ï¼Œæ”¯æŒ1-32位字母、汉字
    private String visitorPhoto;//    string    False    å¤´åƒbase64编码的字节流,图片最大200K,仅支持jpg格式。由于访客头像需要下发到设备,因此该接口会对访客头像进行质量检测,只有人脸评分大于等于75时,接口才会返回成功,可通过人脸评分接口获取人脸图片的评分。请提供五官清晰,人脸居中的正面人脸免冠照片
    private String visitorWorkUnit;//    string    False    æ¥è®¿å•位,支持1-32位字符,不包含’/😗?”<>
    private String visitorAddress;//    string    False    è®¿å®¢ä½å€ï¼Œæ”¯æŒ1-128位中英文数字
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/AcsDeviceInfoResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class AcsDeviceInfoResponse {
 private String   indexCode    ;//string    False    èµ„源唯一编码
private String   resourceType;//    string    False    èµ„源类型,详见附录A.2 èµ„源类型
private String   name;//    string    False    èµ„源名称
private String   parentIndexCode;//    string    False    çˆ¶çº§èµ„源编号
private String   devTypeCode;//    string    False    é—¨ç¦è®¾å¤‡ç±»åž‹ç¼–码,详见附录A.7 é—¨ç¦è®¾å¤‡ç±»åž‹ä¸­é—¨ç¦è®¾å¤‡ç±»åž‹ç¼–号
private String   devTypeDesc;//    string    False    é—¨ç¦è®¾å¤‡ç±»åž‹åž‹å·ï¼Œè¯¦è§é™„录A.7 é—¨ç¦è®¾å¤‡ç±»åž‹ä¸­é—¨ç¦è®¾å¤‡ç±»åž‹
private String   deviceCode    ;//string    False    ä¸»åŠ¨è®¾å¤‡ç¼–å·
private String   manufacturer;//    string    False    åނ商
private String   regionIndexCode;//    string    False    æ‰€å±žåŒºåŸŸ
private String   regionPath    ;//string    False    æ‰€å±žåŒºåŸŸè·¯å¾„,以@符号分割,包含本节点
private String   treatyType;//    string    False    æŽ¥å…¥åè®®ï¼Œè¯¦è§é™„录A.6 ç¼–码设备接入协议
private Integer   cardCapacity;//    number    False    è®¾å¤‡å¡å®¹é‡
private Integer   fingerCapacity;//    number    False    æŒ‡çº¹å®¹é‡
private Integer   veinCapacity;//    number    False    æŒ‡é™è„‰å®¹é‡
private Integer faceCapacity    ;//number    False    äººè„¸å®¹é‡
private Integer   doorCapacity;//    number    False    é—¨å®¹é‡
private String   deployId    ;//string    False    æ‹¨ç 
private String   createTime    ;//string    False    åˆ›å»ºæ—¶é—´
private String   updateTime    ;//string    False    æ›´æ–°æ—¶é—´
private String   description;//    string    False    æè¿°
private String   netZoneId    ;//string    False    æ‰€å±žç½‘域
private String   acsReaderVerifyModeAbility    ;//string    False    æ”¯æŒè®¤è¯æ–¹å¼ï¼Œæ•°æ®ä¸ºåè¿›åˆ¶
private String   regionName    ;//string    False    åŒºåŸŸåç§°
private String   regionPathName;//    string    False    æ‰€å±žåŒºåŸŸè·¯å¾„名,以"/"分隔
private String   ip    ;//string    False    é—¨ç¦è®¾å¤‡IP
private String   port;//    string    False    é—¨ç¦è®¾å¤‡ç«¯å£
private String   capability;//    string    False    è®¾å¤‡èƒ½åЛ集(含设备上的智能能力),详见附录A.44 è®¾å¤‡èƒ½åЛ集
private String   devSerialNum;//    string    False    è®¾å¤‡åºåˆ—号
private String   dataVersion;//    string    False    ç‰ˆæœ¬å·
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/AcsDeviceListResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
import java.util.List;
@Data
public class AcsDeviceListResponse {
   private int total;//    number    False    æŸ¥è¯¢æ•°æ®è®°å½•总数
   private int pageSize;//    number    False    æ¯é¡µè®°å½•总数
   private int pageNo    ;// number    False    å½“前页码
   private List<AcsDeviceInfoResponse> list    ;// object[]    False    æƒé™ç»„对象列表
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/EntranceListResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class EntranceListResponse {
  private String entranceIndexCode    ;//    string    False    å‡ºå…¥å£å”¯ä¸€æ ‡è¯†ï¼ˆæœ€å¤§é•¿åº¦64)
  private String entranceName    ;//    string    False    å‡ºå…¥å£åç§°ï¼ˆæœ€å¤§é•¿åº¦64)
  private String parkIndexCode    ;//    string    False    åœè½¦åœºå”¯ä¸€æ ‡è¯†ï¼ˆæœ€å¤§é•¿åº¦64)
  private String roadNum    ;//    number    False    è½¦é“数(最大长度32)
  private String createTime;//        string    False    åˆ›å»ºæ—¶é—´ è¦æ±‚遵守ISO8601标准,如2018-07-26T21:30:08+08:00表示北京时间2017å¹´7月26日21时30分08秒
  private String updateTime;//        string    False    æ›´æ–°æ—¶é—´ è¦æ±‚遵守ISO8601标准,如2018-07-26T21:30:08+08:00表示北京时间2017å¹´7月26日21时30分08秒
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/FaceAddOrEditesponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class FaceAddOrEditesponse {
  private String  faceId;//        string    False    äººè„¸Id
  private String  faceUrl;//        string    False    äººè„¸å›¾ç‰‡Url
  private String  personId;//        string    False    äººå‘˜ID
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/OrgListResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class OrgListResponse {
  private String orgIndexCode;//    ç»„织唯一标识码(最大长度64)
    private String  orgNo    ;//string    False    ç»„织编号(最大长度64)
    private String orgName;//    string    False    ç»„织名称(最大长度64)  å½“前组织的名称,如默认部门
    private String orgPath    ;//string    False    ç»„织目录(最大长度64) ä¾‹å¦‚:默认部门/综合安防/开发小组
    private String  parentOrgIndexCode;//    string    False    çˆ¶ç»„织唯一标识码(最大长度64)
    private String  parentOrgName;//    string    False    çˆ¶ç»„织名称(最大长度64)
    private String  updateTime;//    string    False    æ›´æ–°æ—¶é—´    è¦æ±‚遵守ISO8601标准,如2018-07-26T21:30:08+08:00表示北京时间2017å¹´7月26日21时30分08秒
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/OrgOrUserAddFailureResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class OrgOrUserAddFailureResponse {
    private String   clientId    ;//number    False    è°ƒç”¨æ–¹æŒ‡å®šId
    private String   code    ;//string    False    é”™è¯¯ç 
    private String   msg    ;//string    False    é”™è¯¯ä¿¡æ¯
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/OrgOrUserAddResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
import java.util.List;
@Data
public class OrgOrUserAddResponse {
  private List<OrgOrUserAddSuccessResponse> successes    ;//object[]    False    æ‰¹é‡æ·»åŠ æˆåŠŸçš„è®°å½•
  private List<OrgOrUserAddFailureResponse> failures;//    object[]    False    æ‰¹é‡æ·»åŠ å¤±è´¥çš„è®°å½•
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/OrgOrUserAddSuccessResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class OrgOrUserAddSuccessResponse {
  private String clientId;//    number    False    è°ƒç”¨æ–¹æŒ‡å®šId
  private String  orgIndexCode;//    string    False    æœåŠ¡ç«¯ç”Ÿæˆçš„å”¯ä¸€æ ‡è¯†
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/ParkListResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class ParkListResponse {
  private String  parkIndexCode    ;//    string    False    åœè½¦åº“唯一标识(最大长度64)
  private String parentParkIndexCode;//        string    False    çˆ¶åœè½¦åº“唯一标识(最大长度64)
  private String parkName;//        string    False    åœè½¦åº“名称(最大长度64)
  private String createTime    ;//    string    False    åˆ›å»ºæ—¶é—´  éµå®ˆISO8601标准,如2017-11-12T15:41:11.688+08:00表示北京时间2017å¹´11月12日15时41分11.688秒
  private String  updateTime;//        string    False    æ›´æ–°æ—¶é—´  éµå®ˆISO8601标准,如2017-11-12T15:41:11.688+08:00表示北京时间2017å¹´11月12日15时41分11.688秒
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/ParkReservationAddResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,9 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class ParkReservationAddResponse {
    private String reserveOrderNo    ;//string    False    é¢„约单号
    private String reserveTime    ;//number    False    é¢„约有效时间,单位:分钟
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/PrivilegeGroupListResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
import java.util.List;
@Data
public class PrivilegeGroupListResponse {
    private String  privilegeGroupId;//    string    False    æƒé™ç»„ID, ç”¨äºŽè®¿å®¢ç™»è®°æ—¶å¯¹è®¿å®¢æŽˆæƒ
    private String privilegeGroupName;//    string    False    æƒé™ç»„名称
    private String remark;//    string    False    æè¿°
    private Integer isDefault    ;//number    False    æ˜¯å¦æ˜¯é»˜è®¤æƒé™ç»„0: æ˜¯1: å¦
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/PrivilegeGroupResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
import java.util.List;
@Data
public class PrivilegeGroupResponse {
    private int total;//    number    False    æŸ¥è¯¢æ•°æ®è®°å½•总数
    private int pageSize;//    number    False    æ¯é¡µè®°å½•总数
    private int pageNo    ;// number    False    å½“前页码
    private List<PrivilegeGroupListResponse> list    ;// object[]    False    æƒé™ç»„对象列表
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/UserAddResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
import java.util.List;
@Data
public class UserAddResponse {
  private String personId    ;//string    False    æˆåŠŸæ·»åŠ çš„äººå‘˜Id
  private String faceId;//    string    False    æˆåŠŸæ·»åŠ çš„äººè„¸Id
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/UserDelResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class UserDelResponse {
  private String  personId    ;//string    False    äººå‘˜æ ‡å¿—
  private String  code    ;//string    False    é”™è¯¯ç 
  private String  msg;//    string    False    é”™è¯¯ä¿¡æ¯
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/VisitAppointmentResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package com.doumee.core.haikang.model.param.respose;
import com.doumee.core.haikang.model.param.request.VisitAppointmentPermissonRequest;
import com.doumee.core.haikang.model.param.request.VisitAppointmentVistorRequest;
import lombok.Data;
import java.util.List;
@Data
public class VisitAppointmentResponse {
    private String  appointRecordId;//    string    False    é¢„约记录ID,可作为修改、取消预约的依据
    private List<VisitAppointmentVistorRequest>   appointmentInfoList;//    object[]    False    é¢„约详细信息
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/respose/VisitAppointmentVistorResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.doumee.core.haikang.model.param.respose;
import lombok.Data;
@Data
public class VisitAppointmentVistorResponse {
    private String   visitorName        ;//string    False    è®¿å®¢å§“名,支持中英文字符,不能包含 â€™ / \ : * ? " < >
    private String appointRecordId    ;//    string    False é¢„约记录ID
    private String receptionistId    ;//    string    False    è¢«è®¿äººå”¯ä¸€æ ‡è¯†
    private String receptionistName    ;//    string    False    è¢«è®¿äººå§“名,支持中英文字符,不能包含 â€™ / \ : * ? " < >
    private String verificationCode        ;//string    False    è®¿å®¢éªŒè¯ç ï¼Œå¯ç”¨äºŽè®¿å®¢åœ¨è®¿å®¢æœºç™»è®°çš„凭证, æˆ–后期作为查询条件使用
    private String QRCode    ;//    string    False    åŠ¨æ€äºŒç»´ç å†…å®¹ï¼Œå¦‚éœ€è¦ä½¿ç”¨ï¼Œå°†è®¿å®¢äºŒç»´ç å†…å®¹è½¬æˆäºŒç»´ç å›¾ç‰‡å³å¯
    private String orderId    ;//string    False    è®¿å®¢è®°å½•唯一标识,用于已预约登记、访客签离等操作
    private String picUri    ;//    string    False    è®¿å®¢å¤´åƒ,返回图片的相对Uri
    private String svrIndexCode    ;//    string    False    å›¾ç‰‡å­˜å‚¨æœåŠ¡çš„å”¯ä¸€æ ‡è¯†
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,440 @@
package com.doumee.core.haikang.service;
import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.haikang.model.param.request.*;
import com.doumee.core.haikang.model.param.respose.*;
import com.doumee.core.utils.Constants;
import com.doumee.core.haikang.model.HKConstants;
import com.doumee.core.haikang.model.HKTools;
import com.doumee.core.haikang.model.param.BaseRequst;
import com.doumee.core.haikang.model.param.BaseResponse;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import com.alibaba.fastjson.TypeReference;
import java.io.InputStream;
import java.util.List;
@Service
@Slf4j
public class HKService {
    private Logger logger = LoggerFactory.getLogger(HKService.class);
    @Autowired
    private SystemDictDataBiz  systemDictDataBiz;
    @PostConstruct
    public  int  initHkConfig(){
        ArtemisConfig.host = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_HOST).getCode();
        ArtemisConfig.appKey = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_APPKEY).getCode();
        ArtemisConfig.appSecret = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_APPSECRET).getCode();
        HKConstants.https = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_HTTPS).getCode();
        return  0;
    }
    /**
     * èŽ·å–æ ¹ç»„ç»‡æ•°æ®
     * @return
     */
    public  BaseResponse<OrgListResponse>  getRootOrg(BaseRequst param){
        log.error("【海康获取根组织】================开始====");
        try {
            String res = HKTools.getRootOrg ();
            TypeReference typeReference =
                    new TypeReference< BaseResponse<OrgListResponse>>(){};
            BaseResponse<OrgListResponse> result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康获取根组织】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康获取根组织】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     * ä¿®æ”¹ç»„织数据
     * @return
     */
    public  BaseResponse editOrg(OrgEditRequest param){
        log.error("【海康修改组织】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.editOrg(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康修改组织】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康修改组织】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *批量新增组织数据
     * @return
     */
    public  BaseResponse<OrgOrUserAddResponse>  addBatchOrg(List<OrgAddRequest> param){
        log.error("【海康新增组织】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.addBatchOrg(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<OrgOrUserAddResponse>>(){};
            BaseResponse<OrgOrUserAddResponse> result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康新增组织】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康新增组织】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *批量删除组织数据
     * @return
     */
    public  BaseResponse   delBatchOrg(OrgDelRequest param){
        log.error("【海康删除组织】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.delOrg(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse >(){};
            BaseResponse result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康删除组织】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康删除组织】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *新增人员信息(支持人脸数据)
     * @return
     */
    public  BaseResponse<UserAddResponse>  addUser(UserAddRequest param){
        log.error("【海康新增人员】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.addUser(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<UserAddResponse>>(){};
            BaseResponse<UserAddResponse> result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康新增人员】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康新增人员】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *修改人员信息(不支持人脸数据)
     * @return
     */
    public  BaseResponse editUser(UserAddRequest param){
        log.error("【海康修改人员】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.editUser(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<UserAddResponse>>(){};
            BaseResponse<UserAddResponse> result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康修改人员】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康修改人员】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *批量新增人员信息(无人脸)
     * @return
     */
    public  BaseResponse<OrgOrUserAddResponse>  addBatchUser(List<UserAddRequest> param){
        log.error("【海康批量新增人员】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.addBatchUser(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<OrgOrUserAddResponse>>(){};
            BaseResponse<OrgOrUserAddResponse> result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康批量新增人员】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康批量新增人员】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *批量删除人员信息
     * @return
     */
    public  BaseResponse<OrgOrUserAddFailureResponse>  delBatchUser(List<UserAddRequest> param){
        log.error("【海康批量新增人员】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.delBatchUser(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<OrgOrUserAddFailureResponse>>(){};
            BaseResponse<OrgOrUserAddFailureResponse> result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康批量新增人员】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康批量新增人员】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *添加人脸信息
     * @return
     */
    public  BaseResponse<FaceAddOrEditesponse>  addFace(List<FaceAddRequest> param){
        log.error("【海康添加人脸信息】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.addFace(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<FaceAddOrEditesponse>>(){};
            BaseResponse<FaceAddOrEditesponse> result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康添加人脸信息】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康添加人脸信息】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *编辑人脸信息
     * @return
     */
    public  BaseResponse<FaceAddOrEditesponse>  editFace(List<FaceEditRequest> param){
        log.error("【海康编辑人脸信息】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.editFace(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<FaceAddOrEditesponse>>(){};
            BaseResponse<FaceAddOrEditesponse> result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康编辑人脸信息】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康编辑人脸信息】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *删除人脸信息
     * @return
     */
    public  BaseResponse   delFace(List<FaceEditRequest> param){
        log.error("【海康删除人脸信息】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.editFace(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康删除人脸信息】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康删除人脸信息】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     * èŽ·å–æµ·åº·äººè„¸è®¿é—®åœ°å€
     * @return
     */
    public static InputStream getFaceInputStream(FacePictureRequest param) {
        log.error("【海康人脸访问图片流】================开始===="+JSONObject.toJSONString(param));
        try {
            InputStream res = HKTools.getFaceInputStream(JSONObject.toJSONString(param));
            log.error("【海康人脸访问图片流】================成功====\n");
            return  res;
        }catch (Exception e){
            log.error("【海康人脸访问图片流】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *获取车库列表数据(全量)
     * @return
     */
    public  BaseResponse<List<ParkListResponse>>   parkList(ParkListRequest param){
        log.error("【海获取车库列表数据】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.parkList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<ParkListResponse>>>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康获取车库列表数据】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康获取车库列表数据】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *获取车库列表数据(全量)
     * @return
     */
    public  BaseResponse<List<EntranceListResponse>>   entranceList(EntranceListRequest param){
        log.error("【海获取车库列表数据】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.entranceList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<EntranceListResponse>>>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康获取车库列表数据】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康获取车库列表数据】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *固定车辆充值(包期)
     * @return
     */
    public  BaseResponse   carChargeAddtion(CarChargeAddRequest param){
        log.error("【海康固定车辆充值】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.carChargeAddtion(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康固定车辆充值】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康固定车辆充值】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *固定车辆取消包期
     * @return
     */
    public  BaseResponse   carChargeDeletion(CarChargeDelRequest param){
        log.error("【海康固定车辆取消包期】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.carChargeDeletion(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康固定车辆取消包期】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康固定车辆取消包期】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *车位预约
     * @return
     */
    public  BaseResponse<ParkReservationAddResponse>   parkReservationAddition(ParkReservationAddRequest param){
        log.error("【海康车位预约】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.parkAddition(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<ParkReservationAddResponse>>(){};
            BaseResponse<ParkReservationAddResponse>  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康车位预约】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康车位预约】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *车位取消预约
     * @return
     */
    public  BaseResponse   parkReservationDeletion(ParkReservationDelRequest param){
        log.error("【海康车位取消预约】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.carChargeDeletion(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康车位取消预约】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康车位取消预约】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *访客预约
     * @return
     */
    public  BaseResponse<VisitAppointmentResponse>   visitAppiontment(VisitAppointmentRequest param){
        log.error("【海康访客预约】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.visitAppiontment(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<VisitAppointmentResponse>>(){};
            BaseResponse<VisitAppointmentResponse>  result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康访客预约】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康访客预约】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *访客免登记预约
     * @return
     */
    public  BaseResponse<VisitAppointmentVistorResponse>   visitAppiontmentMDJ(VisitAppointmentMDJRequest param){
        log.error("【海康访客免登记预约】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.visitAppiontmentMDJ(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<VisitAppointmentVistorResponse> >(){};
            BaseResponse<VisitAppointmentVistorResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康访客免登记预约】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康访客免登记预约】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *访客权限组列表查询(分页)
     * @return
     */
    public  BaseResponse<PrivilegeGroupResponse>   privilegeGroup(PrivilegeGroupRequest param){
        log.error("【海康访客权限组列表查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.privilegeGroup(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<PrivilegeGroupResponse> >(){};
            BaseResponse<PrivilegeGroupResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康访客权限组列表查询】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康访客权限组列表查询】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *门禁设备查询(分页)
     * @return
     */
    public  BaseResponse<AcsDeviceListResponse>   acsDeviceList(AcsDeviceListRequest param){
        log.error("【海康门禁设备查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.acsDeviceList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<AcsDeviceListResponse> >(){};
            BaseResponse<AcsDeviceListResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            log.error("【海康门禁设备查询】================成功====\n"+res);
            return  result;
        }catch (Exception e){
            log.error("【海康门禁设备查询】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
}
server/dmvisit_service/src/main/java/com/doumee/core/utils/FtpUtil.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,652 @@
package com.doumee.core.utils;
import java.io.*;
import java.util.UUID;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.PrintCommandListener;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import sun.misc.BASE64Encoder;
/** */
/**
 * æ”¯æŒæ–­ç‚¹ç»­ä¼ çš„FTP实用类
 *
 * @author BenZhou http://www.bt285.cn
 * @version 0.1 å®žçŽ°åŸºæœ¬æ–­ç‚¹ä¸Šä¼ ä¸‹è½½
 * @version 0.2 å®žçŽ°ä¸Šä¼ ä¸‹è½½è¿›åº¦æ±‡æŠ¥
 * @version 0.3 å®žçŽ°ä¸­æ–‡ç›®å½•åˆ›å»ºåŠä¸­æ–‡æ–‡ä»¶åˆ›å»ºï¼Œæ·»åŠ å¯¹äºŽä¸­æ–‡çš„æ”¯æŒ
 */
@Slf4j
public class FtpUtil {
    public FTPClient ftpClient = new FTPClient();
    public FtpUtil() {
        // è®¾ç½®å°†è¿‡ç¨‹ä¸­ä½¿ç”¨åˆ°çš„命令输出到控制台
        this.ftpClient.addProtocolCommandListener(new PrintCommandListener(
                new PrintWriter(System.out)));
    }
    public FtpUtil(String hostname, int port, String username, String password)
            throws IOException {
        // è®¾ç½®å°†è¿‡ç¨‹ä¸­ä½¿ç”¨åˆ°çš„命令输出到控制台
        connect(hostname, port, username, password);
    }
    /** */
    /**
     * è¿žæŽ¥åˆ°FTP服务器
     *
     * @param hostname
     *            ä¸»æœºå
     * @param port
     *            ç«¯å£
     * @param username
     *            ç”¨æˆ·å
     * @param password
     *            å¯†ç 
     * @return æ˜¯å¦è¿žæŽ¥æˆåŠŸ
     * @throws IOException
     */
    public boolean connect(String hostname, int port, String username,
            String password) throws IOException {
        ftpClient.connect(hostname, port);
        ftpClient.setControlEncoding("GBK");
        if (FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) {
            if (ftpClient.login(username, password)) {
                return true;
            }
        }
        disconnect();
        return false;
    }
    /** */
    /**
     * ä»ŽFTP服务器上下载文件,支持断点续传,上传百分比汇报
     *
     * @param remote
     *            è¿œç¨‹æ–‡ä»¶è·¯å¾„
     * @param local
     *            æœ¬åœ°æ–‡ä»¶è·¯å¾„
     * @return ä¸Šä¼ çš„状态
     * @throws IOException
     */
    public String download(String remote, String local) throws IOException {
        // è®¾ç½®è¢«åŠ¨æ¨¡å¼
        ftpClient.enterLocalPassiveMode();
        // è®¾ç½®ä»¥äºŒè¿›åˆ¶æ–¹å¼ä¼ è¾“
        ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
        String result;
        // æ£€æŸ¥è¿œç¨‹æ–‡ä»¶æ˜¯å¦å­˜åœ¨
        FTPFile[] files = ftpClient.listFiles(new String(
                remote.getBytes("GBK"), "iso-8859-1"));
        if (files.length != 1) {
            // System.out.println("远程文件不存在");
            return "远程文件不存在";
        }
        long lRemoteSize = files[0].getSize();
        File f = new File(local);
        // æœ¬åœ°å­˜åœ¨æ–‡ä»¶ï¼Œè¿›è¡Œæ–­ç‚¹ä¸‹è½½
        if (f.exists()) {
            long localSize = f.length();
            // åˆ¤æ–­æœ¬åœ°æ–‡ä»¶å¤§å°æ˜¯å¦å¤§äºŽè¿œç¨‹æ–‡ä»¶å¤§å°
            if (localSize >= lRemoteSize) {
                // System.out.println("本地文件大于远程文件,下载中止");
                // return "本地文件大于远程文件,下载中止";
            }
            // è¿›è¡Œæ–­ç‚¹ç»­ä¼ ï¼Œå¹¶è®°å½•状态
            FileOutputStream out = new FileOutputStream(f, true);
            ftpClient.setRestartOffset(localSize);
            InputStream in = ftpClient.retrieveFileStream(new String(remote
                    .getBytes("GBK"), "iso-8859-1"));
            byte[] bytes = new byte[1024];
            long step = lRemoteSize / 100;
            long process = localSize / step;
            int c;
            while ((c = in.read(bytes)) != -1) {
                out.write(bytes, 0, c);
                localSize += c;
                long nowProcess = localSize / step;
                if (nowProcess > process) {
                    process = nowProcess;
                    if (process % 10 == 0)
                        System.out.println("下载进度:" + process);
                    // TODO æ›´æ–°æ–‡ä»¶ä¸‹è½½è¿›åº¦,值存放在process变量中
                }
            }
            in.close();
            out.close();
            boolean isDo = ftpClient.completePendingCommand();
            if (isDo) {
                result = "300";
                // result = DownloadStatus.Download_From_Break_Success;
            } else {
                result = "400";
                // result = DownloadStatus.Download_From_Break_Failed;
            }
        } else {
            OutputStream out = new FileOutputStream(f);
            InputStream in = ftpClient.retrieveFileStream(new String(remote
                    .getBytes("GBK"), "iso-8859-1"));
            byte[] bytes = new byte[1024];
            long step = lRemoteSize / 100;
            long process = 0;
            long localSize = 0L;
            int c;
            while ((c = in.read(bytes)) != -1) {
                out.write(bytes, 0, c);
                localSize += c;
                long nowProcess = localSize / step;
                if (nowProcess > process) {
                    process = nowProcess;
                    if (process % 10 == 0)
                        System.out.println("下载进度:" + process);
                    // TODO æ›´æ–°æ–‡ä»¶ä¸‹è½½è¿›åº¦,值存放在process变量中
                }
            }
            in.close();
            out.close();
            boolean upNewStatus = ftpClient.completePendingCommand();
            if (upNewStatus) {
                result = "500";
                // result = DownloadStatus.Download_New_Success;
            } else {
                // result = DownloadStatus.Download_New_Failed;
                result = "600";
            }
        }
        return result;
    }
    /** */
    /**
     * ä¸Šä¼ æ–‡ä»¶åˆ°FTP服务器,支持断点续传
     *
     * @param local
     *            æœ¬åœ°æ–‡ä»¶åç§°ï¼Œç»å¯¹è·¯å¾„
     * @param remote
     *            è¿œç¨‹æ–‡ä»¶è·¯å¾„,使用/home/directory1/subdirectory/file.ext或是
     *            http://www.guihua.org /subdirectory/file.ext
     *            æŒ‰ç…§Linux上的路径指定方式,支持多级目录嵌套,支持递归创建不存在的目录结构
     * @return ä¸Šä¼ ç»“æžœ
     * @throws IOException
     */
    public String upload(String local, String remote) throws IOException {
        // è®¾ç½®PassiveMode传输
        ftpClient.enterLocalPassiveMode();
        // è®¾ç½®ä»¥äºŒè¿›åˆ¶æµçš„æ–¹å¼ä¼ è¾“
        ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
        ftpClient.setControlEncoding("GBK");
        String result;
        // å¯¹è¿œç¨‹ç›®å½•的处理
        String remoteFileName = remote;
        if (remote.contains(File.separator)) {
            remoteFileName = remote.substring(remote.lastIndexOf(File.separator) + 1);
            // åˆ›å»ºæœåŠ¡å™¨è¿œç¨‹ç›®å½•ç»“æž„ï¼Œåˆ›å»ºå¤±è´¥ç›´æŽ¥è¿”å›ž
            if (StringUtils.equals(CreateDirecroty(remote, ftpClient), "2")) {
                return "2";
            }
        }
     // æ£€æŸ¥è¿œç¨‹æ˜¯å¦å­˜åœ¨æ–‡ä»¶
        FTPFile[] files = ftpClient.listFiles(new String(remoteFileName
                .getBytes("GBK"), "iso-8859-1"));
        if (files.length == 1) {
            long remoteSize = files[0].getSize();
            File f = new File(local);
            long localSize = f.length();
            if (remoteSize == localSize) {
                return "700";
                // return UploadStatus.File_Exits;
            } else if (remoteSize > localSize) {
                return "800";
                // return UploadStatus.Remote_Bigger_Local;
            }
            // å°è¯•移动文件内读取指针,实现断点续传
            result = uploadFile(remoteFileName, f, ftpClient, remoteSize);
            // å¦‚果断点续传没有成功,则删除服务器上文件,重新上传
            if (StringUtils.equals(result, "1")) {
                if (!ftpClient.deleteFile(remoteFileName)) {
                    return "1";
                }
                result = uploadFile(remoteFileName, f, ftpClient, 0);
            }
        } else {
            result = uploadFile(remoteFileName, new File(local), ftpClient, 0);
        }
        return result;
    }
    public int getNumFromStr(String str,char searchstr) {
        int count = 0;
        char[] charArray = str.toCharArray();
        for (char param : charArray) {
            if (param == searchstr) {
                count++;
            }
        }
        return count;
    }
    /** */
    /**
     * ä¸Šä¼ æ–‡ä»¶åˆ°FTP服务器,支持断点续传
     *
     * @param localFile
     *            æœ¬åœ°æ–‡ä»¶æµ
     * @param remote
     *            è¿œç¨‹æ–‡ä»¶è·¯å¾„,使用/home/directory1/subdirectory/file.ext或是
     *            http://www.guihua.org /subdirectory/file.ext
     *            æŒ‰ç…§Linux上的路径指定方式,支持多级目录嵌套,支持递归创建不存在的目录结构
     * @return ä¸Šä¼ ç»“æžœ
     * @throws IOException
     */
    public String uploadFile(File localFile, String remote) throws IOException {
        // è®¾ç½®PassiveMode传输
        ftpClient.enterLocalPassiveMode();
        // è®¾ç½®ä»¥äºŒè¿›åˆ¶æµçš„æ–¹å¼ä¼ è¾“
        ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
        ftpClient.setControlEncoding("GBK");
        String result;
        // å¯¹è¿œç¨‹ç›®å½•的处理
        String remoteFileName = remote ;
         if (remote.contains(File.separator)) {
            remoteFileName = remote.substring(remote.lastIndexOf(File.separator) + 1);
            // åˆ›å»ºæœåŠ¡å™¨è¿œç¨‹ç›®å½•ç»“æž„ï¼Œåˆ›å»ºå¤±è´¥ç›´æŽ¥è¿”å›ž
            if (StringUtils.equals(CreateDirecroty(remote, ftpClient), "2")) {
                return "2";
            }
        }
        // æ£€æŸ¥è¿œç¨‹æ˜¯å¦å­˜åœ¨æ–‡ä»¶
        FTPFile[] files = ftpClient.listFiles(new String(remoteFileName
                .getBytes("GBK"), "iso-8859-1"));
        if (files.length == 1) {
            long remoteSize = files[0].getSize();
            long localSize = localFile.length();
            if (remoteSize == localSize) {
                return "700";
                // return UploadStatus.File_Exits;
            } else if (remoteSize > localSize) {
                return "800";
                // return UploadStatus.Remote_Bigger_Local;
            }
            // å°è¯•移动文件内读取指针,实现断点续传
            result = uploadFile(remoteFileName, localFile, ftpClient,
                    remoteSize);
            // å¦‚果断点续传没有成功,则删除服务器上文件,重新上传
            if (StringUtils.equals(result, "1")) {
                if (!ftpClient.deleteFile(remoteFileName)) {
                    return "1";
                }
                result = uploadFile(remoteFileName, localFile, ftpClient, 0);
            }
            // if (result == UploadStatus.Upload_From_Break_Failed) {
            // if (!ftpClient.deleteFile(remoteFileName)) {
            // return UploadStatus.Delete_Remote_Faild;
            // }
            // result = uploadFile(remoteFileName, f, ftpClient, 0);
            // }
        } else {
            result = uploadFile(remoteFileName, localFile, ftpClient, 0);
        }
        return result;
    }
    /** */
    /**
     * æ–­å¼€ä¸Žè¿œç¨‹æœåŠ¡å™¨çš„è¿žæŽ¥
     *
     * @throws IOException
     */
    public void disconnect() throws IOException {
        if (ftpClient.isConnected()) {
            ftpClient.disconnect();
        }
    }
    /** */
    /**
     * é€’归创建远程服务器目录
     *
     * @param remote
     *            è¿œç¨‹æœåŠ¡å™¨æ–‡ä»¶ç»å¯¹è·¯å¾„
     * @param ftpClient
     *            FTPClient对象
     * @return ç›®å½•创建是否成功
     * @throws IOException
     */
    public String CreateDirecroty(String remote, FTPClient ftpClient)
            throws IOException {
        String status = "1";
        // UploadStatus status = UploadStatus.Create_Directory_Success;
        String directory = remote.substring(0, remote.lastIndexOf(File.separator) + 1);
        if (!directory.equalsIgnoreCase(File.separator)
                && !ftpClient.changeWorkingDirectory(new String(directory
                .getBytes("GBK"), "iso-8859-1"))) {
            // å¦‚果远程目录不存在,则递归创建远程服务器目录
            int start = 0;
            int end = 0;
            if (directory.startsWith(File.separator)) {
                start = 1;
            } else {
                start = 0;
            }
            end = directory
                    .indexOf(File.separator, start);
            while (true) {
                String subDirectory = new String(remote.substring(start, end)
                        .getBytes("GBK"), "iso-8859-1");
                if (!ftpClient.changeWorkingDirectory(subDirectory)) {
                    if (ftpClient.makeDirectory(subDirectory)) {
                        ftpClient.changeWorkingDirectory(subDirectory);
                    } else {
                        System.out.println("创建目录失败");
                        return "2";
                        // return UploadStatus.Create_Directory_Fail;
                    }
                }
                start = end + 1;
                end = directory.indexOf(File.separator,
                        start);
                // æ£€æŸ¥æ‰€æœ‰ç›®å½•是否创建完毕
                if (end <= start) {
                    break;
                }
            }
        }
        return status;
    }
    /**
     * ä¸Šä¼ æ–‡ä»¶åˆ°æœåС噍,新上传和断点续传
     *
     * @param remoteFile
     *            è¿œç¨‹æ–‡ä»¶åï¼Œåœ¨ä¸Šä¼ ä¹‹å‰å·²ç»å°†æœåŠ¡å™¨å·¥ä½œç›®å½•åšäº†æ”¹å˜
     * @param localFile
     *            æœ¬åœ°æ–‡ä»¶File句柄,绝对路径
     *            éœ€è¦æ˜¾ç¤ºçš„处理进度步进值
     * @param ftpClient
     *            FTPClient引用
     * @return
     * @throws IOException
     */
    public String uploadFile(String remoteFile, File localFile,
            FTPClient ftpClient, long remoteSize) throws IOException {
        String status;
        // æ˜¾ç¤ºè¿›åº¦çš„上传
        long step = localFile.length() / 100;
        step=step ==0?1:step;
        long process = 0;
        long localreadbytes = 0L;
//        System.out.println(remoteFile +"-------------------------"+localFile.getPath().toString());
        RandomAccessFile raf = new RandomAccessFile(localFile, "r");
        OutputStream out = ftpClient.appendFileStream(new String(remoteFile
                .getBytes("GBK"), "iso-8859-1"));
        // æ–­ç‚¹ç»­ä¼ 
        if (remoteSize > 0) {
            ftpClient.setRestartOffset(remoteSize);
            process = remoteSize / step;
            raf.seek(remoteSize);
            localreadbytes = remoteSize;
        }
        byte[] bytes = new byte[1024];
        int c;
        while ((c = raf.read(bytes)) != -1) {
            out.write(bytes, 0, c);
            localreadbytes += c;
            if (localreadbytes / step != process) {
                process = localreadbytes / step;
                System.out.println("上传进度:" + process);
                // TODO æ±‡æŠ¥ä¸Šä¼ çŠ¶æ€
            }
        }
        out.flush();
        raf.close();
        out.close();
        boolean result = ftpClient.completePendingCommand();
        if (remoteSize > 0) {
            status = result ? "0" : "1";
            // status = result ? UploadStatus.Upload_From_Break_Success
            // : UploadStatus.Upload_From_Break_Failed;
        } else {
            status = result ? "0" : "1";
            // status = result ? UploadStatus.Upload_New_File_Success
            // : UploadStatus.Upload_New_File_Failed;
        }
        return status;
    }
    public byte[] getOnlineInputsteam(String url){
        try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
            HttpGet httpGet = new HttpGet(url);
            CloseableHttpResponse resp = httpClient.execute(httpGet);// è°ƒç”¨æœåŠ¡å™¨æŽ¥å£
//            return  resp.getEntity().getContent();
            byte[] data = EntityUtils.toByteArray(resp.getEntity());// å°†è¿”回的图片或者文件转化成字节数组的形式
    //        BASE64Encoder encoder = new BASE64Encoder();
    //        String imageBase64 = encoder.encode(data);
    //            String imageBase64 = "data:image/jpg;base64," + encoder.encodeBuffer(data).trim();
    //            imageBase64 = imageBase64.replaceAll("\n", "").replaceAll("\r", "").replaceAll(" ", "");//删除 \r\n
            return data;
        } catch (Exception e) {
            log.error("获取图片异常:{}",e.getMessage());
        }
        return  null;
    }
    public boolean uploadOnlineFile(String url,String ftpPath, String fileName) throws Exception
    {
        byte[] buf = getOnlineInputsteam(url);
        if(buf == null){
            return  false;
        }
        try
        {
            ftpClient.enterLocalPassiveMode();// å¼€å¯è¢«åŠ¨æ¨¡å¼
            ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
            CreateDirecroty( ftpPath,ftpClient);
            String printWorkingDirectory = ftpClient.printWorkingDirectory();
            System.out.println("获取当前目录:" + printWorkingDirectory);
            boolean flag = ftpClient.storeFile(new String(fileName.getBytes("GBK"), "iso-8859-1"), new ByteArrayInputStream(buf));
            // é€šè¿‡å‘送 QUIT å‘½ä»¤æ³¨é”€ FTP æœåС噍
            ftpClient.logout();
            return  flag;
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            if (ftpClient.isConnected()){
                    ftpClient.disconnect();
            }
        }
        return false;
    }
    /**
     * åˆ é™¤ä¸€ä¸ªæ–‡ä»¶
     */
    public boolean deleteFile(String filename) {
        boolean flag = true;
        try {
            flag = ftpClient.deleteFile(filename);
            if (flag) {
                System.out.println("删除文件成功!");
            } else {
                System.out.println("删除文件失败!");
            }
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
        return flag;
    }
    public static void main(String[] args) throws Exception {
        try {
            FtpUtil ftpUtil = new FtpUtil("175.27.187.84", 21, "ftpuser","doumee168" );
            ftpUtil.uploadOnlineFile("https://profile-avatar.csdnimg.cn/default.jpg!1", "test"+File.separator, UUID.randomUUID().toString()+"test.jpg");
            /*FtpUtil myFtp = new FtpUtil("106.15.54.228", 21, "ftptlg",
                    "tlg168.com");
            System.out.println(myFtp.upload("D:\\devices.sql", "/1111/devices.sql"));
            // myFtp.ftpClient.makeDirectory(new String("电视剧".getBytes("GBK"),
            // "iso-8859-1"));
            // myFtp.ftpClient.changeWorkingDirectory(new String("电视剧"
            // .getBytes("GBK"), "iso-8859-1"));
            // myFtp.ftpClient.makeDirectory(new String("走西口".getBytes("GBK"),
            // "iso-8859-1"));
            // System.out.println(myFtp.upload("http://www.5a520.cn /yw.flv",
            // "/yw.flv", 5));
            // System.out.println(myFtp.upload("http://www.5a520.cn /走西口24.mp4",
            // "/央视走西口/新浪网/走西口24.mp4"));
            *//**
             * t.connect("pengtu", "61.191.61.226", 2122, "yangnet",
             * "yanglong@doumee.com"); File file = new File(
             * "D:\\lib/commons-net-3.3-bin/commons-net-3.3/NOTICE.txt");
             *
             *
             *//*
            System.out.println(myFtp.download("/1/2/NOTICE.txt", "D:\\哈.txt"));
            myFtp.deleteFile("/1/2/NOTICE.txt");
            myFtp.disconnect();
            System.out.println("java版本号:" + System.getProperty("java.version")); // java版本号
            System.out
                    .println("Java提供商名称:" + System.getProperty("java.vendor")); // Java提供商名称
            System.out.println("Java提供商网站:"
                    + System.getProperty("java.vendor.url")); // Java提供商网站
            System.out.println("jre目录:" + System.getProperty("java.home")); // Java,哦,应该是jre目录
            System.out.println("Java虚拟机规范版本号:"
                    + System.getProperty("java.vm.specification.version")); // Java虚拟机规范版本号
            System.out.println("Java虚拟机规范提供商:"
                    + System.getProperty("java.vm.specification.vendor")); // Java虚拟机规范提供商
            System.out.println("Java虚拟机规范名称:"
                    + System.getProperty("java.vm.specification.name")); // Java虚拟机规范名称
            System.out.println("Java虚拟机版本号:"
                    + System.getProperty("java.vm.version")); // Java虚拟机版本号
            System.out.println("Java虚拟机提供商:"
                    + System.getProperty("java.vm.vendor")); // Java虚拟机提供商
            System.out.println("Java虚拟机名称:"
                    + System.getProperty("java.vm.name")); // Java虚拟机名称
            System.out.println("Java规范版本号:"
                    + System.getProperty("java.specification.version")); // Java规范版本号
            System.out.println("Java规范提供商:"
                    + System.getProperty("java.specification.vendor")); // Java规范提供商
            System.out.println("Java规范名称:"
                    + System.getProperty("java.specification.name")); // Java规范名称
            System.out.println("Java类版本号:"
                    + System.getProperty("java.class.version")); // Java类版本号
            System.out.println("Java类路径:"
                    + System.getProperty("java.class.path")); // Java类路径
            System.out.println("Java lib路径:"
                    + System.getProperty("java.library.path")); // Java lib路径
            System.out.println("Java输入输出临时路径:"
                    + System.getProperty("java.io.tmpdir")); // Java输入输出临时路径
            System.out
                    .println("Java编译器:" + System.getProperty("java.compiler")); // Java编译器
            System.out.println("Java执行路径:"
                    + System.getProperty("java.ext.dirs")); // Java执行路径
            System.out.println("操作系统名称:" + System.getProperty("os.name")); // æ“ä½œç³»ç»Ÿåç§°
            System.out.println("操作系统的架构:" + System.getProperty("os.arch")); // æ“ä½œç³»ç»Ÿçš„æž¶æž„
            System.out.println("操作系统版本号:" + System.getProperty("os.version")); // æ“ä½œç³»ç»Ÿç‰ˆæœ¬å·
            System.out.println("文件分隔符:" + System.getProperty("file.separator")); // æ–‡ä»¶åˆ†éš”符
            System.out.println("路径分隔符:" + System.getProperty("path.separator")); // è·¯å¾„分隔符
            System.out.println("直线分隔符:" + System.getProperty("line.separator")); // ç›´çº¿åˆ†éš”符
            System.out.println("操作系统用户名:" + System.getProperty("user.name")); // ç”¨æˆ·å
            System.out.println("操作系统用户的主目录:" + System.getProperty("user.home")); // ç”¨æˆ·çš„主目录
            System.out.println("当前程序所在目录:" + System.getProperty("user.dir")); // å½“前程序所在目录*/
        } catch (IOException e) {
            System.out.println("连接FTP出错:" + e.getMessage());
        }
    }
    /***
     * @上传文件夹
     * @param localDirectory
     *            å½“地文件夹
     * @param remoteDirectoryPath
     *            Ftp æœåŠ¡å™¨è·¯å¾„ ä»¥ç›®å½•File.separator结束
     * */
    public boolean uploadDirectory(String localDirectory,
            String remoteDirectoryPath) throws Exception {
        File src = new File(localDirectory);
        try {
            remoteDirectoryPath =  remoteDirectoryPath  + File.separator;
//            System.out.println(remoteDirectoryPath+":===============创建目录=================");
            boolean makeDirFlag = this.ftpClient.makeDirectory(remoteDirectoryPath);
        }catch (IOException e) {
            e.printStackTrace();
            log.info(remoteDirectoryPath + "目录创建失败");
            return false;
        }
        File[] allFile = src.listFiles();
        for (int currentFile = 0;currentFile < allFile.length;currentFile++) {
            File f =allFile[currentFile];
            String srcName=    f.getPath().toString();
//            System.out.println(srcName+":====================读取文件======================");
            String tPath = remoteDirectoryPath+f.getName();
            if (!f.isDirectory()) {
//                System.out.println(srcName+":====================开始传输文件======================");
                int dNum = getNumFromStr(tPath,File.separator.toCharArray()[0]);
                uploadFile(f, tPath);
                if(dNum -2>=0){
                    for (int i = 0; i < dNum-1; i++) {
                        this.ftpClient.changeToParentDirectory();
                    }
                }
            }else{
//                System.out.println(srcName+":====================创建子目录======================");
                uploadDirectory(srcName,
                        tPath+File.separator);
            }
//            System.out.println(srcName+":====================上传完毕======================");
        }
        return true;
    }
    /***
     * @上传文件夹
     * @param pathName
     *             æ–‡ä»¶å¤¹
     * */
    public boolean delDirectory(String pathName ) throws Exception {
        try {
            this.ftpClient.changeWorkingDirectory( pathName.substring(0, pathName.lastIndexOf(File.separator)) );
            ftpClient.removeDirectory(pathName);
        }catch (IOException e) {
            e.printStackTrace();
            log.info(pathName + "目录删除失败");
            return  false;
        }
        return true;
    }
}
server/dmvisit_service/src/main/java/com/doumee/core/utils/haikang/base/HKConstants.java
ÎļþÒÑɾ³ý
server/dmvisit_service/src/main/java/com/doumee/core/utils/haikang/base/HKTools.java
ÎļþÒÑɾ³ý
server/dmvisit_service/src/main/java/com/doumee/core/utils/haikang/service/HKService.java
ÎļþÒÑɾ³ý
server/dmvisit_service/src/main/java/com/doumee/dao/business/DeviceMapper.java
@@ -3,10 +3,14 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.Device;
import java.util.Collection;
/**
 * @author æ±Ÿè¹„蹄
 * @date 2023/11/30 15:33
 */
public interface DeviceMapper extends BaseMapper<Device> {
    Integer insertBatchSomeColumn(Collection<Device> entityList);
}
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Device.java
@@ -52,13 +52,13 @@
    @ExcelColumn(name="备注")
    private String remark;
    @ApiModelProperty(value = "题目")
    @ExcelColumn(name="题目")
    private String title;
    @ApiModelProperty(value = "设别名")
    @ExcelColumn(name="设别名")
    private String name;
    @ApiModelProperty(value = "海康标识", example = "1")
    @ExcelColumn(name="海康标识")
    private Integer hkId;
    private String hkId;
    @ApiModelProperty(value = "海康同步状态 0未同步 1已同步", example = "1")
    @ExcelColumn(name="海康同步状态 0未同步 1已同步")
@@ -79,7 +79,7 @@
    @ApiModelProperty(value = "资源类型", example = "1")
    @ExcelColumn(name="资源类型")
    private BigDecimal resourceType;
    private String resourceType;
    @ApiModelProperty(value = "编号")
    @ExcelColumn(name="编号")
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java
@@ -58,7 +58,18 @@
    @ApiModelProperty(value = "人脸照片")
    @ExcelColumn(name="人脸照片")
    private String faceImg;
    @ApiModelProperty(value = "人脸存储服务器标识(海康)")
    @ExcelColumn(name="人脸存储服务器标识(海康)")
    private String faceServeIndexCode;
    @ApiModelProperty(value = "人脸编码(海康)")
    @ExcelColumn(name="人脸编码(海康)")
    private String faceId;
    @ApiModelProperty(value = "人脸同步状态(海康) 0未同步 1已同步 2同步失败")
    @ExcelColumn(name="人脸同步状态(海康) 0未同步 1已同步  2同步失败")
    private Integer faceStatus;
    @ApiModelProperty(value = "人脸同步信息(海康)")
    @ExcelColumn(name="人脸同步信息(海康)")
    private String faceInfo;
    @ApiModelProperty(value = "健康码")
    @ExcelColumn(name="健康码")
    private String imgurl;
@@ -125,7 +136,7 @@
    @ExcelColumn(name="海康标识")
    private Integer hkId;
    @ApiModelProperty(value = "海康同步状态 0未同步 1已同步 2同步失败", example = "1")
    @ApiModelProperty(value = "海康同步状态 0未同步 1已同步 2同步失败 ", example = "1")
    @ExcelColumn(name="海康同步状态 0未同步 1已同步 2同步失败")
    private Integer hkStatus;
server/dmvisit_service/src/main/java/com/doumee/service/business/CarEventService.java
@@ -26,7 +26,6 @@
     * @param id ä¸»é”®
     */
    void deleteById(Integer id);
    /**
     * åˆ é™¤
     *
server/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java
@@ -1,5 +1,6 @@
package com.doumee.service.business;
import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Device;
@@ -94,4 +95,5 @@
     * @return long
     */
    long count(Device device);
}
server/dmvisit_service/src/main/java/com/doumee/service/business/HkSyncService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package com.doumee.service.business;
import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
/**
 * åœè½¦åœºäº‹ä»¶æŽ¨é€è®°å½•表Service定义
 * @author æ±Ÿè¹„蹄
 * @date 2023/11/30 15:33
 */
public interface HkSyncService {
    String syncHkDevices(AcsDeviceListRequest param);
}
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
@@ -1,7 +1,16 @@
package com.doumee.service.business.impl;
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.BaseResponse;
import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
import com.doumee.core.haikang.model.param.respose.AcsDeviceInfoResponse;
import com.doumee.core.haikang.model.param.respose.AcsDeviceListResponse;
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;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.DeviceMapper;
import com.doumee.dao.business.model.Device;
@@ -10,10 +19,14 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@@ -26,6 +39,9 @@
    @Autowired
    private DeviceMapper deviceMapper;
    @Autowired
    private HKService hkService;
    @Override
    public Integer create(Device device) {
@@ -112,8 +128,8 @@
        if (pageWrap.getModel().getRemark() != null) {
            queryWrapper.lambda().eq(Device::getRemark, pageWrap.getModel().getRemark());
        }
        if (pageWrap.getModel().getTitle() != null) {
            queryWrapper.lambda().eq(Device::getTitle, pageWrap.getModel().getTitle());
        if (pageWrap.getModel().getName() != null) {
            queryWrapper.lambda().eq(Device::getName, pageWrap.getModel().getName());
        }
        if (pageWrap.getModel().getHkId() != null) {
            queryWrapper.lambda().eq(Device::getHkId, pageWrap.getModel().getHkId());
@@ -185,4 +201,5 @@
        QueryWrapper<Device> wrapper = new QueryWrapper<>(device);
        return deviceMapper.selectCount(wrapper);
    }
}
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/HkSyncServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,175 @@
package com.doumee.service.business.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.BaseResponse;
import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
import com.doumee.core.haikang.model.param.respose.AcsDeviceInfoResponse;
import com.doumee.core.haikang.model.param.respose.AcsDeviceListResponse;
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;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.DeviceMapper;
import com.doumee.dao.business.model.Device;
import com.doumee.service.business.DeviceService;
import com.doumee.service.business.HkSyncService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * è®¾å¤‡ä¿¡æ¯è¡¨Service实现
 * @author æ±Ÿè¹„蹄
 * @date 2023/11/30 15:33
 */
@Service
public class HkSyncServiceImpl implements HkSyncService {
    @Autowired
    private DeviceMapper deviceMapper;
    @Autowired
    private HKService hkService;
    @Override
//    @Async
    public String syncHkDevices(AcsDeviceListRequest param){
        List<Device> deleteList = new ArrayList<>();
        List<Device> addList = new ArrayList<>();
        List<Device> editList = new ArrayList<>();
        List<AcsDeviceInfoResponse> allHkList = new ArrayList<>();
        Date date = new Date();
        //查询全部门禁设备数据
        List<Device> allList = deviceMapper.selectList(null);
        boolean hasNext = true;
        int curTotal = 0;
        while (hasNext){
            //分页遍历循环查询所有门禁设备数据
            param = new AcsDeviceListRequest();
            param.setPageNo(1);
            param.setPageSize(10000);
            BaseResponse<AcsDeviceListResponse> response = hkService.acsDeviceList(param);
            if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,海康同步数据失败~");
            }
            AcsDeviceListResponse r = response.getData();
            curTotal += 10000;
            if(curTotal >= r.getTotal()){
                hasNext = false;
            }
            List<AcsDeviceInfoResponse> tlist = r.getList();
        }
        //判断获取删除的门禁设备,逻辑删除
        getAddAndEditList(allList,allHkList,addList,editList,date);
        getDeleteList(allList,allHkList,deleteList,date);
        if(deleteList.size()>0){
            //逻辑删除
            for(Device d : deleteList){
                deviceMapper.updateById(d);
            }
        }
        if(addList.size()>0){
            deviceMapper.insertBatchSomeColumn(addList);
        }
        if(editList.size()>0){
            for(Device d : editList){
                deviceMapper.updateById(d);
            }
        }
        return "同步门禁数据:新增【"+addList.size()+"】条,更新【"+editList.size()+"】条,删除【"+deleteList.size()+"】条";
    }
    private void getAddAndEditList(List<Device> allList, List<AcsDeviceInfoResponse> allHkList, List<Device> addList, List<Device> editList, Date date) {
        if(allHkList!=null && allHkList.size()>0){
            for(AcsDeviceInfoResponse device : allHkList){
                Device model = getExistedDevice(device,allList);
                if(model !=null){
                    //如果已存在,则更新数据
                    model =  initDeviceByHkData(model,device,date);
                    editList.add(model);
                }else{
                    //如果不存在,则新增数据
                    model = new Device();
                    model =  initDeviceByHkData(model,device,date);
                    addList.add(model);
                }
            }
        }
    }
    /**
     * åˆå§‹åŒ–海康入库数据
     * @param model
     * @param device
     * @param date
     * @return
     */
    private Device initDeviceByHkData(Device model, AcsDeviceInfoResponse device,Date date) {
        model.setIsdeleted(Constants.ZERO);
        model.setIp(device.getIp());
        model.setHkDate(date);
        model.setCreateDate(DateUtil.StringToDate2(device.getCreateTime()));
        model.setEditDate(DateUtil.StringToDate2(device.getUpdateTime()));
        model.setNo(device.getDeviceCode());
        model.setHkId(device.getIndexCode());
        model.setName(device.getName());
        model.setHkStatus(Constants.ONE);
        model.setType(Constants.ZERO);
        model.setResourceType(device.getResourceType());
        model.setDevTypeCode(device.getDevTypeCode());
        model.setManufature(device.getManufacturer());
        model.setPort(device.getPort());
        return  model;
    }
    private Device getExistedDevice(AcsDeviceInfoResponse device, List<Device> allList) {
        if(allList.size()>0){
            for(Device r : allList){
                if(StringUtils.equals(r.getHkId(), device.getIndexCode())){
                    //表示未删除
                    return  r;
                }
            }
        }
        return  null;
    }
    private void getDeleteList(List<Device> allList, List<AcsDeviceInfoResponse> allHkList,List<Device> deleteList ,Date date) {
        if(allList!=null && allList.size()>0){
            for(Device device : allList){
                if(isDeletedDevice(device,allHkList)){
                    device.setIsdeleted(Constants.ONE);
                    device.setEditDate(date);
                    deleteList.add(device);
                }
            }
        }
    }
    private boolean isDeletedDevice(Device device, List<AcsDeviceInfoResponse> allHkList) {
        if(allHkList.size()>0){
            for(AcsDeviceInfoResponse r : allHkList){
                if(StringUtils.equals(device.getHkId(), r.getIndexCode())){
                    //表示未删除
                    return  false;
                }
            }
        }
        return  true;
    }
}
server/openapi/src/main/java/com/doumee/model/response/erp/UserListRespone.java
@@ -34,7 +34,7 @@
    private Date editDate;
    @ApiModelProperty(value = "所属组织编码")
    private String orgId;
    @ApiModelProperty(value = "人脸照片地址")
    @ApiModelProperty(value = "人脸照片地址,图片公网访问地址")
    private String faceImg;
    @ApiModelProperty(value = "工号")
    private String code;
server/pom.xml
@@ -271,6 +271,11 @@
      <artifactId>artemis-http-client</artifactId>
      <version>1.1.3</version>
    </dependency>
    <dependency>
      <groupId>commons-net</groupId>
      <artifactId>commons-net</artifactId>
      <version>3.8.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>