jiangping
2023-12-07 ddf3d6493849d77ae6dd8350eb80ee71fad03c6a
海康接口对接开发
已添加2个文件
已修改11个文件
1022 ■■■■■ 文件已修改
server/dmvisit_admin/src/main/java/com/doumee/api/common/PublicController.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentCancelRequest.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentOutRequest.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java 625 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/VisitsMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java 246 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_web/src/main/java/com/doumee/api/common/PublicController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/openapi/src/main/java/com/doumee/api/common/PublicController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_admin/src/main/java/com/doumee/api/common/PublicController.java
@@ -184,21 +184,6 @@
    }
    @ApiOperation(value = "上传", notes = "上传", httpMethod = "POST", position = 6)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
    })
    @PostMapping(value = "/uploadLocal", headers = "content-type=multipart/form-data")
    public void uploadLocal(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
       // CommonsMultipartFile files = (CommonsMultipartFile) multipartRequest.getFile("filedata");
        uploadFileLocal(multipartRequest,  folder+ "/", response,
                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ROOT_PATH).getCode() ,
                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode());
    }
    public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
@@ -45,6 +45,7 @@
        String visitAppiontment= "/api/visitor/v2/appointment";//访客预约v2
        String visitAppiontmentMDJ= "/api/visitor/v1/appointment/registration";//访客预约免登记v2
        String visitCancel= "/api/visitor/v1/appointment/cancel";//取消访客预约
        String visitOut= "/api/visitor/v1/visitor/out";//签离访客预约
        String facePicture= "/api/resource/v1/person/picture";//提取用户人脸照片
        String privilegeGroup= "/api/visitor/v1/privilege/group";//查询访客权限组
        String eventSub= "/api/eventService/v1/eventSubscriptionByEventTypes";//事件订阅
@@ -74,15 +75,6 @@
            this.key = key;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (Constants.UserType c : Constants.UserType.values()) {
                if (c.getKey() == index) {
                    return c.getName();
                }
            }
            return null;
        }
        // get set æ–¹æ³•
@@ -120,15 +112,6 @@
            this.key = key;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (Constants.UserType c : Constants.UserType.values()) {
                if (c.getKey() == index) {
                    return c.getName();
                }
            }
            return null;
        }
        // get set æ–¹æ³•
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKTools.java
@@ -325,6 +325,17 @@
        return  result;
    }
    /**
     *    ç­¾ç¦»è®¿å®¢é¢„约
     * @param body
     * @return
     */
    public static String visitOut(String body) {
        Map<String, String> path = getPath(HKConstants.InterfacePath.visitOut);
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json", null);// post请求application/json类型参数
        saveInterfaceLog(body,result,path);
        return  result;
    }
    /**
     *    è®¿å®¢æƒé™ç»„
     * @param body
     * @return
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentCancelRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
import java.util.List;
@Data
public class VisitAppointmentCancelRequest {
    private String[] appointRecordIds;//    string[]    True    é¢„约记录ID的数组,与查询访客预约记录v2接口中的appointRecordId对应
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/VisitAppointmentOutRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,9 @@
package com.doumee.core.haikang.model.param.request;
import lombok.Data;
@Data
public class VisitAppointmentOutRequest {
    private String orderId    ;//string    True    è®¿å®¢è®°å½•id,从查询访客来访记录v2接口获取返回报文中的orderId字段
}
server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java
@@ -373,6 +373,42 @@
        return  null;
    }
    /**
     *访客预约取消
     * @return
     */
    public  static  BaseResponse   cancelVisitAppiontment(VisitAppointmentCancelRequest param){
        log.error("【海康访客预约取消】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.visitCancel(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
           logResult(result,"海康访客预约取消");
            return  result;
        }catch (Exception e){
            log.error("【海康访客预约取消】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *访客预约签离
     * @return
     */
    public  static  BaseResponse  outVisitAppiontment(VisitAppointmentOutRequest param){
        log.error("【海康访客预约签离】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.visitOut(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
           logResult(result,"海康访客预约签离");
            return  result;
        }catch (Exception e){
            log.error("【海康访客预约签离】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *访客免登记预约
     * @return
     */
server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -6,7 +6,11 @@
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import  java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Constants {
@@ -47,6 +51,17 @@
    }
    return  birthday;
}
    /**
     *   åˆ¤æ–­æ˜¯å¦ä¸ºæœ‰æ•ˆè½¦ç‰Œå·
     */
    public static boolean checkCarNo(String str) {
        String patt="^[京津沪冀晋辽吉黑苏浙皖闽赣鲁豫鄂湘粤桂琼川黔云渝藏陕陇青宁新闽粤晋琼使领A_Z]{1}[A_Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$";
        Pattern r = Pattern.compile(patt);
        Matcher matcher = r.matcher(str);
        return matcher.find();
    }
    public static  String  getTuominStr(String s){
        if(StringUtils.isEmpty(s)){
            return "";
@@ -87,6 +102,17 @@
         int fk = 1;//普通访客
         int nb = 2;//内部访客
    }
    public interface VisitStatus{
        //审核状态 0待审核 1已提交ERP审批  2审核通过 3审核不通过 4取消 5下发成功 6下发失败 7已签离
         int waitCheck = 0;
         int submitCheck = 1;
         int pass = 2;
         int noPass = 3;
         int cancel = 4;
         int xfSuccess = 5;
         int xfFail = 6;
         int signout = 7;
    }
    public interface DOOR_ROLE_TYPE{
         int lw = 0;
         int fk = 1;
@@ -98,7 +124,6 @@
    public static final String ACCESS_ID="ACCESS_ID";
    public static final String BUCKETNAME = "BUCKETNAME";
    public static final String OSS = "OSS";
    public static final String COFFEE_ARTICLE = "COFFEE_ARTICLE";
    public static final String ACCESS_KEY = "ACCESS_KEY";
    public static final String ENDPOINT = "ENDPOINT";
@@ -179,15 +204,7 @@
        return d.longValue();
    }
public interface  UserRelObjType{
      int objTypeRoom = 0;
      int objTypeBook = 1;
}
public interface  RoomRecordObjType{
      int objTypeRoom = 0;//管理员开门
      int objTypeBook_in = 1;//参会人员开门
      int objTypeBook_out = 2;//访客开门
}
public interface  memberType{
    int visitor = 0;//普通访客
    int lw_visitor = 1;//劳务访客
@@ -199,84 +216,6 @@
    }
    /**
     * ç”¨æˆ·ç±»åž‹
     */
    public  enum UserType {
        SYSTEM(0, "系统用户", "管理员",Arrays.asList(0)),
        ORG(1, "机构", "机构",Arrays.asList(1)),
        CREATION(2, "创作中心", "创作中心",Arrays.asList(2))
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private List<Integer> historyStatus;
        private String noteinfo;// æè¿°
        // æž„造方法
        UserType(int key, String name, String noteinfo,List<Integer> historyStatus) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
            this.historyStatus=historyStatus;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (UserType c : UserType.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (UserType c : UserType.values()) {
                if (c.getKey() == index) {
                    return c.noteinfo;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static List<Integer> getHistoryStatus(int index) {
            for (UserType c : UserType.values()) {
                if (c.getKey() == index) {
                    return c.historyStatus;
                }
            }
            return null;
        }
        // get set æ–¹æ³•
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public List<Integer> getHistoryStatus() {
            return historyStatus;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getNoteinfo() {
            return noteinfo;
        }
    }
    /**
     * æ•°æ®çŠ¶æ€æžšä¸¾
@@ -315,516 +254,6 @@
    }
    /**
     * å…³è”对象类型 0活动轮播图 1活动详情图 2门店评价3订单评价 4平台商品轮播 5探店多图 6店铺新鲜事多图 7商家图片多图
     */
    public  enum MultiFile{
        ACTIVITY_ROTATION(0, "活动轮播图", "活动轮播图"),
        ACTIVITY_DETAIL(1, "活动详情图", "活动详情图"),
        SHOP_APPRAISE(2, "门店评价", "门店评价"),
        ORDER_APPRAISE(3, "订单评价", "订单评价"),
        PLATFORM_GOOD_ROTATION(4, "平台商品轮播", "平台商品轮播"),
        TANDIAN_PICTURE(5, "探店多图", "探店多图"),
        SHOP_HOT_PICTURE(6, "店铺新鲜事多图", "店铺新鲜事多图"),
        SHOP_PICTURE(7, "商家图片多图", "商家图片多图"),
        AFTERSALE_APPLY(8, "申请售后补充说明附件", "申请售后补充说明附件"),
        AFTERSALE_KD(9, "申请售后邮寄说明附件", "申请售后邮寄说明附件"),
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        // æž„造方法
        MultiFile(int key, String name, String noteinfo) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (MultiFile c : MultiFile.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (MultiFile c : MultiFile.values()) {
                if (c.getKey() == index) {
                    return c.noteinfo;
                }
            }
            return null;
        }
        // get set æ–¹æ³•
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getNoteinfo() {
            return noteinfo;
        }
    }
    /**
     * è®¢å•管理
     * çŠ¶æ€ 0申请中 1已支付  2已取消
     */
    public  enum ActivitySignupStatus{
        APPLY_ING(0, "申请中", "申请中"),
        PAY_DONE(1, "已支付", "已支付"),
        CANCEL(2, "已取消", "已取消"),
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        // æž„造方法
        ActivitySignupStatus(int key, String name, String noteinfo) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (ActivitySignupStatus c : ActivitySignupStatus.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (ActivitySignupStatus c : ActivitySignupStatus.values()) {
                if (c.getKey() == index) {
                    return c.noteinfo;
                }
            }
            return null;
        }
        // get set æ–¹æ³•
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getNoteinfo() {
            return noteinfo;
        }
    }
    /**
     * å”®åŽçŠ¶æ€
     * çŠ¶æ€ 0待处理 1待邮寄 2已寄出 3商家已退款 4商家已发货5售后已完成6商家拒绝 7已取消
     */
    public  enum AftersaleStatus{
        APPLY_ING(0, "待处理", "待处理"),
        WAIT_SEND(1, "待邮寄", "待邮寄"),
        SENDED(2, "客户已寄出", "客户已寄出"),
        REFUND(3, "已退款", "已退款"),
        SHOP_SENDED(4, "平台已发货", "平台已发货"),
        DONE(5, "售后已完成", "售后已完成"),
        SHOP_REFUSE(6, "已拒绝", "平台拒绝"),
        CANCEL(7, "已取消", "客户取消售后"),
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        // æž„造方法
        AftersaleStatus(int key, String name, String noteinfo) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (AftersaleStatus c : AftersaleStatus.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (AftersaleStatus c : AftersaleStatus.values()) {
                if (c.getKey() == index) {
                    return c.noteinfo;
                }
            }
            return null;
        }
        // get set æ–¹æ³•
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getNoteinfo() {
            return noteinfo;
        }
    }
    /**
     * å”®åŽç±»åž‹
     *  å”®åŽç±»åž‹ 0退款 1退货退款 2换货
     */
    public  enum AftersaleType{
        TK(0, "退款", "退款"),
        THTK(1, "退货退款", "退货退款"),
        HH(2, "换货", "换货"),
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        // æž„造方法
        AftersaleType(int key, String name, String noteinfo) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (AftersaleType c : AftersaleType.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (AftersaleType c : AftersaleType.values()) {
                if (c.getKey() == index) {
                    return c.noteinfo;
                }
            }
            return null;
        }
        // get set æ–¹æ³•
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getNoteinfo() {
            return noteinfo;
        }
    }
    /**
     * è®¢å•管理
     * çŠ¶æ€ 0待支付 1待发货 2待收货 3交易完成 4已关闭 5部分发货
     */
    public  enum OrderStatus{
        WAIT_PAY(0, "待支付", "待支付"),
        PAY_DONE(1, "待发货", "已支付代发货"),
        WAIT_RECEIVE(2, "待收货", "已发货待收货"),
        DONE(3, "交易完成", "交易完成"),
        CLOSE(4, "已关闭", "已关闭"),
        PART_DONE(5, "部分发货", "部分发货"),
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        // æž„造方法
        OrderStatus(int key, String name, String noteinfo) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (OrderStatus c : OrderStatus.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (OrderStatus c : OrderStatus.values()) {
                if (c.getKey() == index) {
                    return c.noteinfo;
                }
            }
            return null;
        }
        // get set æ–¹æ³•
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getNoteinfo() {
            return noteinfo;
        }
    }
    /**
     * è®¢å•类型
     *  è®¢å•类型 0平台商城 1咖豆商城 2咖啡计划编码
     */
    public  enum OrderType{
        ADMINPLAT(0, "平台商城 ", "平台商城 "),
        KADOUPLAT(1, "咖豆商城", "咖豆商城"),
        COFFERPLAN(2, "2咖啡计划编码", "2咖啡计划编码")
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        // æž„造方法
        OrderType(int key, String name, String noteinfo) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (OrderType c : OrderType.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (OrderType c : OrderType.values()) {
                if (c.getKey() == index) {
                    return c.noteinfo;
                }
            }
            return null;
        }
        // get set æ–¹æ³•
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getNoteinfo() {
            return noteinfo;
        }
    }
    public enum ShareType{
//    0活动1探店2咨询3店铺 4商品5分享邀请海报
        SHARE_ACTIVITY_ACTIVITY(0,"活动","活动"),
        SHARE_ACTIVITY_VISITSHOP(1,"探店","咨询"),
        SHARE_ACTIVITY_NEW(2,"咨询","咨询"),
        SHARE_SHOP(3,"店铺","店铺" ),
        SHARE_GOODS(4,"商品","商品"),
        SHARE_POSTER(5,"分享邀请海报","分享邀请海报")
        ;
        private Integer key;
        private String name;
        private String des;
        ShareType(Integer key, String name, String des) {
            this.key = key;
            this.name = name;
            this.des = des;
        }
        public Integer getKey() {
            return key;
        }
        public void setKey(Integer key) {
            this.key = key;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getDes() {
            return des;
        }
        public void setDes(String des) {
            this.des = des;
        }
    }
    /**
     * å’–豆任务
     */
    public enum CoffeeBeanTask{
        SIGN_BOARD(1,"SIGN_BOARD","每日签到"),
        SHARE_INFO(6,"SHARE_INFO","分享资讯"),
        SHARE_INVITE_BILL(2,"SHARE_INVITE_BILL","分享邀请海报"),
        INVITE_USER_LOGIN(3,"INVITE_USER_LOGIN","邀请新用户注册"),
        EXCHANGE_GOODS(4,"INVITE_USER_LOGIN","兑换商品"),
        EXCHANGE_COUPON(5,"INVITE_USER_LOGIN","兑换优惠券"),
        POST_COMMENTS(7,"POST_COMMENTS","发布评论"),
        COFFEE_MAP_CONSUME(8,"COFFEE_MAP_CONSUME","咖啡地图消费"),
        ;
        //  0平台注册 1签到 2分享邀请 3邀请新用户 4兑换商品 5兑换优惠券
        // æˆå‘˜å˜é‡
        private Integer key;
        private String name;
        private String des;// æè¿°
        CoffeeBeanTask(Integer key, String name, String des) {
            this.key = key;
            this.name = name;
            this.des = des;
        }
        public Integer getKey() {
            return key;
        }
        public void setKey(Integer key) {
            this.key = key;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getDes() {
            return des;
        }
        public void setDes(String des) {
            this.des = des;
        }
    }
    public enum NoticeType{
//        0订单通知 1系统消息 2互动消息 3优惠券提醒 4官方客服 5活动推荐 6我的关注
}
server/dmvisit_service/src/main/java/com/doumee/dao/business/VisitsMapper.java
@@ -3,10 +3,13 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.Visits;
import java.util.List;
/**
 * @author æ±Ÿè¹„蹄
 * @date 2023/11/30 15:33
 */
public interface VisitsMapper extends BaseMapper<Visits> {
    void insertBatchSomeColumn(List<Visits> withUserList);
}
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java
@@ -99,7 +99,9 @@
    @ApiModelProperty(value = "证件显示信息")
    @ExcelColumn(name="证件显示信息")
    private String idcardDecode;
    @ApiModelProperty(value = "证件类型 0身份证 1港澳证件 2护照", example = "1")
    @ExcelColumn(name="证件类型 0身份证 1港澳证件 2护照")
    private Integer idcardType;
    @ApiModelProperty(value = "工号")
    @ExcelColumn(name="工号")
    private String code;
@@ -111,7 +113,9 @@
    @ApiModelProperty(value = "状态 0正常 1禁用 2拉黑/冻结", example = "1")
    @ExcelColumn(name="状态 0正常 1禁用 2拉黑/冻结")
    private Integer status;
    @ApiModelProperty(value = "性别 1男 2女 ", example = "1")
    @ExcelColumn(name="性别 1男 2女")
    private Integer sex;
    @ApiModelProperty(value = "添加人编码(自关联)", example = "1")
    @ExcelColumn(name="添加人编码(自关联)")
    private Integer parentId;
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java
@@ -130,8 +130,8 @@
    @ExcelColumn(name="接待人员")
    private Integer receptMemberId;
    @ApiModelProperty(value = "审核状态 0待审核 1已提交ERP审批  2审核通过 3审核不通过 4取消", example = "1")
    @ExcelColumn(name="审核状态 0待审核 1已提交ERP审批  2审核通过 3审核不通过 4取消")
    @ApiModelProperty(value = "审核状态 0待审核 1已提交ERP审批  2审核通过 3审核不通过 4取消 5下发成功 6下发失败", example = "1")
    @ExcelColumn(name="审核状态 0待审核 1已提交ERP审批  2审核通过 3审核不通过 4取消 5下发成功 6下发失败")
    private Integer status;
    @ApiModelProperty(value = "初审人编码", example = "1")
@@ -165,7 +165,9 @@
    @ApiModelProperty(value = "证件类型 0身份证 1港澳证件 2护照", example = "1")
    @ExcelColumn(name="证件类型 0身份证 1港澳证件 2护照")
    private Integer idcardType;
    @ApiModelProperty(value = "性别 1男 2女 ", example = "1")
    @ExcelColumn(name="性别 1男 2女")
    private Integer sex;
    @ApiModelProperty(value = "车牌号,多个用英文逗号隔开")
    @ExcelColumn(name="车牌号,多个用英文逗号隔开")
    private String carNos;
@@ -181,6 +183,9 @@
    @ApiModelProperty(value = "海康标识")
    @ExcelColumn(name="海康标识")
    private String hkId;
    @ApiModelProperty(value = "openid")
    @ExcelColumn(name="openid")
    private String openid;
    @ApiModelProperty(value = "海康同步状态 0未同步 1已同步", example = "1")
    @ExcelColumn(name="海康同步状态 0未同步 1已同步")
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -4,6 +4,13 @@
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.haikang.model.HKConstants;
import com.doumee.core.haikang.model.HKTools;
import com.doumee.core.haikang.model.param.BaseResponse;
import com.doumee.core.haikang.model.param.request.VisitAppointmentCancelRequest;
import com.doumee.core.haikang.model.param.request.VisitAppointmentRequest;
import com.doumee.core.haikang.model.param.respose.VisitAppointmentResponse;
import com.doumee.core.haikang.service.HKService;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
@@ -25,9 +32,11 @@
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.DigestUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -63,18 +72,9 @@
     * @return
     */
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public Integer createFk(Visits visits) {
        if(visits.getStarttime() == null
                || visits.getEndtime() == null
                ||  StringUtils.isBlank(visits.getReason())
                ||  StringUtils.isBlank( visits.getName())
                ||  StringUtils.isBlank( visits.getPhone())
                ||  visits.getIdcardType() == null
                ||  StringUtils.isBlank( visits.getFaceImg() )
                ||  StringUtils.isBlank( visits.getIdcardNo() )
                || visits.getReceptMemberId() == null){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,信息填写不正确!");
        }
        isValidBaseParam(visits);
        //检查是否必须答题,并且符合答题要求
        ProblemLog problemLog = isValidProblemLog(visits);
        //获取申请的海康访问门禁组信息
@@ -88,31 +88,223 @@
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证号码有误,请核实后重试!");
        }
        Date date = new Date();
        visits.setBirthday(Constants.getBirthdyByCardNo(visits.getIdcardNo()));
        //身份证号存储密文
        visits.setIdcardNo(DESUtil.encrypt(Constants.EDS_PWD, visits.getIdcardNo()));//身份证号加密
        visits.setIdcardDecode(Constants.getTuominStr(visits.getIdcardNo()));//脱敏手机号
        visits.setCreateDate(date);
        //访客信息(使用身份证号查询是否已存在改普通访客,没有则新增,存在则更新openid等信息)
        Member member = getMemberByIdcardno(visits);
        Member member =dealMemberAndVisits(visits);
        //初始化访客信息
        initVisitInfo(visits,date);
        //发起ERP审批申请
        String erpid = startSendErpCheck(visits);
        if(StringUtils.isNotBlank(erpid)){
            visits.setErpId(erpid);
        }else{
            throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,发起拜访审批申请失败!");
        }
        visitsMapper.insert(visits);
        initWithVisitInfo(visits);
        updateProblemLog(visits,problemLog,member);
        return visits.getId();
    }
    private Member getMemberByIdcardno(Visits idcardNo) {
        Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda()
//                .eq(Member::getType,Constants.MEMBER_TYPE)
                .eq(Member::getIdcardNo,idcardNo.getIdcardNo())
        );
    /**
     * æ ¡éªŒå¿…填项数据是否合法
     * @param visits
     */
    private void isValidBaseParam(Visits visits) {
        if(visits.getStarttime() == null
                || visits.getEndtime() == null
                ||  StringUtils.isBlank(visits.getReason())
                ||  StringUtils.isBlank( visits.getName())
                ||  StringUtils.isBlank( visits.getPhone())
                ||  visits.getIdcardType() == null
                ||  StringUtils.isBlank( visits.getFaceImg() )
                ||  StringUtils.isBlank( visits.getIdcardNo() )
                || visits.getReceptMemberId() == null){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,信息填写不正确!");
        }
        if(visits.getStarttime().getTime() < System.currentTimeMillis()){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约开始时间必须大于当前时间!");//
        }
        if(visits.getEndtime().getTime() <= visits.getStarttime().getTime()){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约结束时间必须大于开始时间!");//
        }
    }
    private void isValidWithVisitParam(Visits visits,  List<Member> addList,  List<Member> updateList) {
        if(  StringUtils.isBlank( visits.getName())
                ||  StringUtils.isBlank( visits.getPhone())
                ||  visits.getIdcardType() == null
                ||  StringUtils.isBlank( visits.getFaceImg() )
                ||  StringUtils.isBlank( visits.getIdcardNo() )
                ){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,信息填写不正确!");
        }
        if(visits.getStarttime().getTime() < System.currentTimeMillis()){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约开始时间必须大于当前时间!");//
        }
        if(visits.getEndtime().getTime() <= visits.getStarttime().getTime()){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约结束时间必须大于开始时间!");//
        }
        if(isRepeatedMember(visits,addList,updateList)){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,手机号或身份证号出现重复数据,请修改后重新提交!");//
        }
    }
    private boolean isRepeatedMember(Visits visits, List<Member> addList, List<Member> updateList) {
        if(addList.size()>0){
            for(Member m :addList){
                if(StringUtils.equals(visits.getPhone(), m.getPhone()) || StringUtils.equals(visits.getIdcardNo(), m.getIdcardDecode())){
                    return true;
                }
            }
        }
        if(updateList.size()>0){
            for(Member m :updateList){
                if(StringUtils.equals(visits.getPhone(), m.getPhone()) || StringUtils.equals(visits.getIdcardNo(), m.getIdcardDecode())){
                    return true;
                }
            }
        }
        return  false;
    }
    private void initWithVisitInfo(Visits visits) {
        if(visits.getWithUserList()!=null && visits.getLwWithUserList().size()>0){
            for(Visits v :visits.getWithUserList()){
                v.setParentId(visits.getId());
                v.setStarttime(visits.getStarttime());
                v.setEndtime(visits.getEndtime());
                v.setIsdeleted(Constants.ZERO);
                v.setCreateDate(visits.getCreateDate());
                v.setErpId(visits.getErpId());
                v.setHkStatus(Constants.ZERO);
                v.setStatus(Constants.ZERO);
            }
            //批量插入数据
            visitsMapper.insertBatchSomeColumn(visits.getWithUserList());
        }
    }
    private void initVisitInfo(Visits visits,Date date) {
        visits.setHkStatus(Constants.ZERO);//未同步
        visits.setBirthday(Constants.getBirthdyByCardNo(visits.getIdcardNo()));
        visits.setStatus(Constants.ZERO);//待审批
        visits.setIdcardNo(DESUtil.encrypt(Constants.EDS_PWD, visits.getIdcardNo()));//身份证号加密
        //身份证号存储密文
        visits.setIdcardDecode(Constants.getTuominStr(visits.getIdcardNo()));//脱敏手机号
        visits.setCreateDate(date);
    }
    private String startSendErpCheck(Visits visits) {
        return  null;
    }
    private String visitAppiontment(Visits visits) {
        VisitAppointmentRequest param = new VisitAppointmentRequest();
        param.setVisitStartTime(HKTools.getISO8601Timestamp(visits.getStarttime()));
        param.setVisitEndTime(HKTools.getISO8601Timestamp(visits.getStarttime()));
        BaseResponse<VisitAppointmentResponse>  res = HKService.visitAppiontment(param);
        if(res==null || !StringUtils.equals(res.getCode(), HKConstants.RESPONSE_SUCCEE) || res.getData()==null){
          //如果发起预约失败
            visits.setStatus(Constants.VisitStatus.xfFail);
        }else{
            visits.setStatus(Constants.VisitStatus.xfSuccess);
            visits.setHkStatus(Constants.ONE);
            visits.setHkId(res.getData().getAppointRecordId());
        }
        visits.setHkDate(visits.getCheckDate());
        return  res.getData().getAppointRecordId();
    }
    /**
     * æ ¡é©—申請人信息,有则修改,无则新增,并绑定最新openid数据
     * @param visits
     * @return
     */
    private Member  dealMemberAndVisits(Visits visits ) {
        if(StringUtils.isNotBlank(visits.getOpenid())){
            //先清空原有访客的openid绑定关系
            memberMapper.update(null, new UpdateWrapper<Member>().lambda()
                    .eq(Member::getType,Constants.memberType.visitor)
                    .eq(Member::getOpenid,visits.getOpenid())
                    .set(Member::getOpenid,null)
            );
        }
        List<Member> addList = new ArrayList<>();
        List<Member> editList = new ArrayList<>();
        //申请人信息
        Member m = getMemberListParam(visits.getIdcardNo(),visits,addList,editList);
        //随访人员信息处理
        if(visits.getWithUserList()!= null && visits.getWithUserList().size()>0){
            for(Visits model:visits.getWithUserList()){
                //校验随访人员填报数据合法性
                isValidWithVisitParam(model,addList,editList);
                model.setCreateDate(visits.getCreateDate());
                getMemberListParam(model.getIdcardNo(),visits,addList,editList);
            }
        }
        return  m;
    }
    private Member getMemberListParam(String cardno, Visits visits, List<Member> addList, List<Member> editList) {
        if(!Constants.checkCarNo(visits.getCarNos())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,车牌号【"+visits.getCarNos()+"】不合法,请核实后重试~");
        }
        Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda()
                .eq(Member::getType,Constants.memberType.visitor)
                .eq(Member::getIdcardType,visits.getIdcardType())
                .eq(Member::getIdcardNo,visits.getIdcardNo()).last("limit 1" )
        );
        if(member == null){
            //如果用户不存在,则新增
            member.setCreateDate(visits.getCreateDate());
            member.setIsdeleted(Constants.ZERO);
            member.setIdcardNo(visits.getIdcardNo());
            member.setIdcardDecode(visits.getIdcardDecode());
            member.setIdcardNo(DESUtil.encrypt(Constants.EDS_PWD, cardno));//身份证号加密
            member.setIdcardDecode(Constants.getTuominStr(cardno));//脱敏手机号
            member.setName(visits.getName());
            member.setPhone(visits.getPhone());
            member.setOpenid(visits.getOpenid());
            member.setType(Constants.memberType.visitor);
            member.setStatus(Constants.ZERO);
            member.setSex(visits.getSex());
            // æ–°å¢žè®¿å®¢è®°å½•
            addList.add(member);
        }else{
            if(!Constants.equalsInteger(Constants.ZERO,member.getStatus() )){
                //如果用户状态异常,则提示
                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,该身份证号被禁止访问申请,如有疑问,请联系您的拜访人进行核实");
            }
            //核查预约用户是否存在未签离的预约记录
            isExsitNoOutVisisRecord(member);
            member.setEditDate(visits.getCreateDate());
            member.setIsdeleted(Constants.ZERO);
            member.setIdcardNo(visits.getIdcardNo());
            member.setIdcardDecode(visits.getIdcardDecode());
            member.setName(visits.getName());
            member.setPhone(visits.getPhone());
            member.setOpenid(visits.getOpenid());
            member.setSex(visits.getSex());
            // æ›´æ–°è®¿å®¢ä¿¡æ¯,
            editList.add(member);
        }
        return  member;
    }
    /**
     * æ ¸æŸ¥é¢„约用户是否存在未签离的预约记录
     * @param member
     */
    private void isExsitNoOutVisisRecord(Member member) {
        Visits v = visitsMapper.selectOne(new QueryWrapper<Visits>().lambda()
                .eq(Visits::getPhone, member.getPhone())
                .eq(Visits::getStatus,Constants.VisitStatus.xfSuccess)
                .last(" limit 1" )
        );
        if(v !=null){
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,手机号【"+member.getPhone()+"】存在未签离预约申请,不能重复申请哦!");
        }
    }
    private List<Member> isValideWithUsers(List<Visits> withUserList) {
        if(withUserList!= null && withUserList .size()>0){
            for(Visits model:withUserList){
server/dmvisit_web/src/main/java/com/doumee/api/common/PublicController.java
@@ -185,20 +185,6 @@
    @ApiOperation(value = "上传服务器本地", notes = "上传服务器本地", httpMethod = "POST", position = 6)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
    })
    @PostMapping(value = "/uploadLocal", headers = "content-type=multipart/form-data")
    public void uploadLocal(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        // CommonsMultipartFile files = (CommonsMultipartFile) multipartRequest.getFile("filedata");
        uploadFileLocal(multipartRequest,  folder+ "/", response,
                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ROOT_PATH).getCode() ,
                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode());
    }
    public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception {
        response.setCharacterEncoding("UTF-8");
server/openapi/src/main/java/com/doumee/api/common/PublicController.java
@@ -185,20 +185,6 @@
    @ApiOperation(value = "上传服务器本地", notes = "上传服务器本地", httpMethod = "POST", position = 6)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
    })
    @PostMapping(value = "/uploadLocal", headers = "content-type=multipart/form-data")
    public void uploadLocal(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        // CommonsMultipartFile files = (CommonsMultipartFile) multipartRequest.getFile("filedata");
        uploadFileLocal(multipartRequest,  folder+ "/", response,
                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ROOT_PATH).getCode() ,
                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode());
    }
    public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception {
        response.setCharacterEncoding("UTF-8");