jiaosong
2023-12-07 657d75ff683ef35003bedd64a0fa420e7d294f85
Merge remote-tracking branch 'origin/master'

# Conflicts:
# server/dmvisit_service/src/main/java/com/doumee/service/business/impl/ProblemsServiceImpl.java
已添加8个文件
已修改16个文件
1080 ■■■■ 文件已修改
server/dmvisit_service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java 373 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/utils/IdCardTool.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/core/wx/WXConstant.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/DeviceEvent.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/ProblemLog.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/web/reqeust/FinishAnswerDTO.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/web/response/ProblemsVO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/dao/web/response/WxAuthorizeVO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/MemberService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/ProblemLogService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/ProblemsService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/VisitsService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/ProblemLogServiceImpl.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/ProblemsServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java 186 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncEventServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_web/src/main/java/com/doumee/api/ScheduleTool.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_web/src/main/java/com/doumee/api/web/ApiController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_web/src/main/java/com/doumee/api/web/UnitController.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_web/src/main/java/com/doumee/api/web/VisitorController.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java
@@ -136,7 +136,7 @@
        systemUser.setSalt(salt);
        // åˆ›å»ºç”¨æˆ·è®°å½•
        systemUser.setType(Constants.UserType.SYSTEM.getKey());
        systemUser.setType(Constants.ZERO);
        Integer userId = systemUserService.create(systemUser);
        // è®¾ç½®éƒ¨é—¨
        if (systemUser.getDepartmentId() != null) {
server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -1,12 +1,12 @@
package com.doumee.core.utils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.text.SimpleDateFormat;
import  java.util.Date;
public class Constants {
@@ -22,6 +22,55 @@
    public static final String HK_PUSH_URL = "HK_PUSH_URL";
    public static final String HK_ROOTORG_CODE ="HK_ROOTORG_CODE" ;
    //被拜访人信息校验方式(0手机号单独校验 1手机号和姓名组合校验)
    public static final String BEVISITED_USER_VALID = "BEVISITED_USER_VALID";
    public static final String SELECT_DOORS_VISIT_REQUIRED = "SELECT_DOORS_VISIT_REQUIRED";
    public static final String SELECT_DOORS_LW_REQUIRED = "SELECT_DOORS_LW_REQUIRED";
    public static final String PROBLEM_LW_REQUIRED = "PROBLEM_LW_REQUIRED";
    public static final String PROBLEM_VISIT_REQUIRED = "PROBLEM_VISIT_REQUIRED";
    public static final String MDJ_LW_REQUIRED = "MDJ_LW_REQUIRED";
    public static final String MDJ_VISIT_REQUIRED = "MDJ_VISIT_REQUIRED";
    public static final String EDS_PWD ="!@#$%^&QWERTY" ;
    public static  Date  getBirthdyByCardNo(String idCard){
    if(idCard ==null || idCard.length()<14){
        return null;
    }
    Date birthday = null; // è§£æžä¸ºæ—¥æœŸå¯¹è±¡
    String birthdayString = idCard.substring(6, 14); // æˆªå–身份证号的前六位数字作为出生日期
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    try {
        birthday = dateFormat.parse(birthdayString);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return  birthday;
}
    public static  String  getTuominStr(String s){
        if(StringUtils.isEmpty(s)){
            return "";
        }
        int l = s.length();
        if(l <= 2){
            return s.substring(0,1)+"****";
        }
        if(l <= 5){
            return s.substring(0,2)+"***";
        }
        if(l <= 10){
            return s.substring(0,3)+"***"+s.substring(l-3,l);
        }
        if(l <= 11){
            return s.substring(0,3)+"****"+s.substring(l-4,l);
        }
        if(l <= 15){
            return s.substring(0,3)+"****"+s.substring(l-4,l);
        }
        return s.substring(0,5)+"*******"+s.substring(l-6,l);
}
    /**
     * mq tag
     */
@@ -33,6 +82,11 @@
         String activity_looknum = "looknum";
         String activity_signup = "signup";
    }
    public interface DeviceRoleType{
         int lw = 0;//劳务访客
         int fk = 1;//普通访客
         int nb = 2;//内部访客
    }
    public interface DOOR_ROLE_TYPE{
         int lw = 0;
         int fk = 1;
@@ -41,9 +95,6 @@
    public static final String SUCCESS_STR = "SUCCESS" ;
    //开门时间有效期(分钟)
    public static final String QR_OPENBOOK_VALIDTIME="QR_OPENBOOK_VALIDTIME";
    public static final String QR_OPENROOM_VALIDTIME="QR_OPENROOM_VALIDTIME";
    public static final String ADVANCE_IN="ADVANCE_IN";
    public static final String ACCESS_ID="ACCESS_ID";
    public static final String BUCKETNAME = "BUCKETNAME";
    public static final String OSS = "OSS";
@@ -53,49 +104,21 @@
    public static final String ENDPOINT = "ENDPOINT";
    public static final String RESOURCE_PATH = "RESOURCE_PATH";
    //发送会议开始  å®šæ—¶æå‰å¤šå°‘分钟发送
    public static final String NOTICE_TIME = "NOTICE_TIME";
    public static final String INITIAL_PASSWORD = "INITIAL_PASSWORD";
    public static final String ACCESS_TOKEN = "ACCESS_TOKEN";
    public static final String INITIAL_ROLE = "INITIAL_ROLE";
    public static final String PLAT_ADDR="PLAT_ADDR";
    public static final String ADDR_PHONE="ADDR_PHONE";
    public static final String ADDR_NAME="ADDR_NAME";
    public static final String ADDR_INFO="ADDR_INFO";
    public static final String SYSTEM ="SYSTEM";
    public static final String DEFAULT_PASSWORD = "DEFAULT_PASSWORD" ;
    public static final String CREATION_ROLE = "CREATION_ROLE";
    public static final String ORG_ROLE = "ORG_ROLE";
    public static final String USER_AGREEMENT = "USER_AGREEMENT";
    public static final String ABOUT_USER = "ABOUT_USER";
    public static final String RECHARGE_MONEY = "RECHARGE_MONEY";
    public static final String PLATFORM_ADDRESS = "PLATFORM_ADDRESS";
    public static final String PROJECT_HEAD_IMG = "PROJECT_HEAD_IMG";
    public static final String COFFEE_BEAN_TASK ="COFFEE_BEAN_TASK";
    public static final String  SIGN_BOARD="SIGN_BOARD";//每日签到
    public static final String  SHARE_INFO="SHARE_INFO";//分享资讯
    public static final String  SHARE_INVITE_BILL="SHARE_INVITE_BILL";//分享邀请海报
    public static final String  INVITE_USER_LOGIN="INVITE_USER_LOGIN";///邀请新用户注册
    public static final String  POST_COMMENTS="POST_COMMENTS";//发布评论
    public static final String  COFFEE_MAP_CONSUME="COFFEE_MAP_CONSUME";//咖啡地图消费
        // æœåŠ¡é¡¹ç›®
    public static final String PROJECTS = "PROJECTS";
    //用户头像
    public static final String SYSUSER = "SYSUSER";
    public static final String  ROOT_PATH="ROOT_PATH";//本地文件上传地址配置
    public static final String  FILE_DIR="FILE_DIR";//本地文件访问地址配置
    public static final String WX_PLATFORM = "WX_PLATFORM";
    public static final String WX_PLATFORM_ACCESS_TOKEN = "WX_PLATFORM_ACCESS_TOKEN";
    public static final String WX_PLATFORM_APPID = "WX_PLATFORM_APPID";
    public static final String WX_PLATFORM_SECRET = "WX_PLATFORM_SECRET";
@@ -105,13 +128,7 @@
        public static final String ACTIVITY_SIGN_KEY = "actcode_";
        public static final String AFTERSALE_KEY = "salecode_";
    }
    /**
     * ä¼ä¸šæ•°æ®æ¥æº 0平台注册 1后台导入
     */
    public interface ORIGIN{
        public static final  int platformRegister  = 0;
        public static final  int backstageImport  = 1;
    }
    public static BigDecimal formatBigdecimal(BigDecimal d) {
        if (d == null) {
@@ -171,10 +188,17 @@
      int objTypeBook_in = 1;//参会人员开门
      int objTypeBook_out = 2;//访客开门
}
public interface  memberType{
    int visitor = 0;//普通访客
    int lw_visitor = 1;//劳务访客
    int internal = 2;//内部人员
}
    public static void main(String[] args) {
        String t = URLDecoder.decode("https://lsqw.gtja.com/qwcos/v-index.html#/loginforProperty?corpId=ww4b7aefafeb430e4b&corpId=ww4b7aefafeb430e4b&agentId=1000005&agentId=1000005&fromRoute=&userCode=013561&userCode=&userId=zz&userId=&encryptUserCode=&custQwId=wmIUuSDgAAR8MhtVY8w90EyKltvoK5fA&custCode=&openId=op1wZwD1dKuBQywmWWS5957zUOJI&name=%E8%B9%84%E8%B9%84&headUrl=http%3A%2F%2Fwx.qlogo.cn%2Fmmhead%2FQ3auHgzwzM4QlibSOAvYcvRMdsoyF3Ua7duLOYSJfB3dsGsYxIYonBw%2F0&dbHeadUrl=https%3A%2F%2Ftgf.gtja.com%2Ff%2F%2Fqwoms%2F2022512%2Fqwoms_1652332606613_8.jpg");
        System.out.println(t);
    }
    /**
     * ç”¨æˆ·ç±»åž‹
     */
@@ -803,253 +827,4 @@
//        0订单通知 1系统消息 2互动消息 3优惠券提醒 4官方客服 5活动推荐 6我的关注
        NOTICE_ORDER(0,"0订单通知","0订单通知"),
        NOTICE_SYSTEM(1,"1系统消息","1系统消息"),
        NOTICE_INTERACTION(2,"互动消息","互动消息"),
        NOTICE_MEMBER_COUPON(3,"优惠券提醒","优惠券提醒"),
        NOTICE_ACTIVITY(5,"活动推荐","活动推荐"),
        NOTICE_MEMBER_FOLLOW(6,"我的关注","我的关注")
        ;
        private Integer key;
        private String type;
        private String content;
        NoticeType(Integer key, String type, String content) {
            this.key = key;
            this.type = type;
            this.content = content;
        }
    }
    /**
     * ç§¯åˆ†ç±»åž‹
     */
    public  enum IntegralObjType {
        REGISTER(0, "平台注册", "平台注册",0),
        SIGNIN(1, "签到", "签到",0),
        SHARE(2, "分享邀请", "分享邀请",0),
        INVITENEWUSER(3, "邀请新用户", "邀请新用户",0),
        EXCHANGEGOODS(4, "兑换商品", "兑换商品",1),
        EXCHANGECOUPON(5, "兑换优惠券", "兑换优惠券",1),
        SHARE_INFO(6,"分享资讯","分享资讯",0),
        POST_COMMENTS(7,"发布评论","发布评论",0),
        COFFEE_MAP_CONSUME(8,"咖啡地图消费","咖啡地图消费",0),
        SHOP_ORDER(9,"余额抵扣商品","余额抵扣商品",1),
        AFTERSALE_BACK(10,"售后退款","售后退款",1),
        EXCHANGE_CARD(11,"卡充值","卡充值",0),
        SYSTEM_RECHARGE(12,"平台充值","平台充值",0),
        SYSTEM_DEDUCT(13,"平台扣款","平台扣款",0),
        SHOP_ORDER_CANCEL(14,"余额抵扣商品退还","余额抵扣商品退还",0)
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        private Integer addTitle; // 0 = æ–°å¢žï¼›1 = ä¸æ–°å¢ž
        // æž„造方法
        IntegralObjType(int key, String name, String noteinfo ,Integer addTitle) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
            this.addTitle = addTitle;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (IntegralObjType c : IntegralObjType.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (IntegralObjType c : IntegralObjType.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 int getAddTitle() {
            return this.addTitle;
        }
        public void setAddTitle(Integer addTitle) {
            this.addTitle = addTitle;
        }
    }
    /**
     * æ ‡ç­¾ç±»åž‹
     */
    public  enum LabelsType {
        GOODSTYPE(0, "商品分类", "商品分类"),
        GOODSBRAND(1, "商品品牌", "商品品牌"),
        BUSNESSLABEL(2, "商家标签", "商家标签"),
        EXPRESSDELIVERY(3, "快递", "快递"),
        RETURNOPTIONS(4, "退货选项", "退货选项"),
        EXCHANGEOPTIONS(5, "换货选项", "换货选项"),
        REFUNDOPTIONS(6, "退款选项", "退款选项"),
        CANCELORDEROPTIONS(7, "取消订单选项", "取消订单选项"),
        COFFERBEANTYPE(8, "咖啡百科分类", "咖啡百科分类"),
        INFOTYPE(9, "咨询分类", "咨询分类"),
        ACTIVITYMATCHTYPE(10, "活动赛事分类", "活动赛事分类"),
        DARENTANDIANTYPE(11, "达人探店分类", "达人探店分类"),
        HOMEZHUANQU(12, "首页专区", "首页专区"),
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        // æž„造方法
        LabelsType(int key, String name, String noteinfo) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (LabelsType c : LabelsType.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (LabelsType c : LabelsType.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 ActivityType {
        SHOPACTIVITY(0, "商家活动", "商家活动"),
        PLATACTIVITY(1, "平台活动", "平台活动"),
        TANDIAN(2, "探店", "探店"),
        CONSULT(3, "资讯", "资讯"),
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private int key;
        private String noteinfo;// æè¿°
        // æž„造方法
        ActivityType(int key, String name, String noteinfo) {
            this.name = name;
            this.key = key;
            this.noteinfo = noteinfo;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (ActivityType c : ActivityType.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // æ™®é€šæ–¹æ³•
        public static String getInfo(int index) {
            for (ActivityType c : ActivityType.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;
        }
    }
}
server/dmvisit_service/src/main/java/com/doumee/core/utils/IdCardTool.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
package com.doumee.core.utils;
public class IdCardTool {
}
server/dmvisit_service/src/main/java/com/doumee/core/wx/WXConstant.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package com.doumee.core.wx;
/**
 * å…¬ä¼—号接口地址类
 *
 * @Author : Rk
 * @create 2023/12/7 10:42
 */
public class WXConstant {
    //获取公众号 access_token
    public static final String GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
    //获取用户信息
    public static final String GET_USER_INFO_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
}
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/DeviceEvent.java
@@ -218,6 +218,10 @@
    @ExcelColumn(name="身份证id")
    private String idNum;
    @ApiModelProperty(value = "证件显示信息")
    @ExcelColumn(name="证件显示信息")
    private String idcardDecode;
    @ApiModelProperty(value = "身份证签发机关")
    @ExcelColumn(name="身份证签发机关")
    private String issuingAuthority;
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Member.java
@@ -1,5 +1,6 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -195,5 +196,8 @@
    @ApiModelProperty(value = "ERP组织编码")
    @ExcelColumn(name="ERP组织编码")
    private String erpOrgId;
    @ApiModelProperty(value = "组织名称")
    @TableField(exist = false)
    private String companyName;
}
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/ProblemLog.java
@@ -65,7 +65,7 @@
    @ApiModelProperty(value = "绑定申请编码")
    @ExcelColumn(name="绑定申请编码")
    private String logId;
    private Integer logId;
    @ApiModelProperty(value = "得分", example = "1")
    @ExcelColumn(name="得分")
server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java
@@ -1,5 +1,6 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -9,6 +10,7 @@
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
/**
 * è®¿å®¢ç”³è¯·ä¿¡æ¯è¡¨
@@ -106,12 +108,10 @@
    @ApiModelProperty(value = "门禁有效期开始")
    @ExcelColumn(name="门禁有效期开始")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date starttime;
    @ApiModelProperty(value = "门禁有效期截止")
    @ExcelColumn(name="门禁有效期截止")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endtime;
    @ApiModelProperty(value = "来访事由")
@@ -159,7 +159,9 @@
    @ApiModelProperty(value = "终审备注")
    @ExcelColumn(name="终审备注")
    private String endCheckInfo;
    @ApiModelProperty(value = "证件显示信息")
    @ExcelColumn(name="证件显示信息")
    private String idcardDecode;
    @ApiModelProperty(value = "证件类型 0身份证 1港澳证件 2护照", example = "1")
    @ExcelColumn(name="证件类型 0身份证 1港澳证件 2护照")
    private Integer idcardType;
@@ -192,5 +194,11 @@
    @ApiModelProperty(value = "ERP申请记录编码")
    @ExcelColumn(name="ERP申请记录编码")
    private String erpId;
    @ApiModelProperty(value = "普通访客申请随访人员")
    @TableField(exist = false)
    private List<Visits> withUserList;
    @ApiModelProperty(value = "劳务访客申请随访人员")
    @TableField(exist = false)
    private List<Integer> lwWithUserList;
}
server/dmvisit_service/src/main/java/com/doumee/dao/web/reqeust/FinishAnswerDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package com.doumee.dao.web.reqeust;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2023/12/7 11:19
 */
@Data
public class FinishAnswerDTO {
    @NotBlank(message = "答题明细为空")
    @ApiModelProperty(value = "答题明细(json)")
    private String content;
    @NotNull(message = "使用场景为空")
    @ApiModelProperty(value = "使用场景 0劳务人员 1普通访客")
    private Integer useType;
    @ApiModelProperty(value = "访客编码")
    private String userId;
    @ApiModelProperty(value = "用户openId")
    private String openId;
}
server/dmvisit_service/src/main/java/com/doumee/dao/web/response/ProblemsVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
package com.doumee.dao.web.response;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2023/12/7 11:19
 */
@Data
public class ProblemsVO {
    @ApiModelProperty(value = "主键", example = "1")
    private Integer id;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "题目")
    private String title;
    @ApiModelProperty(value = "选项集合")
    private String options;
    @ApiModelProperty(value = "正确答案")
    private String answer;
    @ApiModelProperty(value = "类型 0单选 1多选 ", example = "1")
    private Integer type;
    @ApiModelProperty(value = "分值", example = "1")
    private BigDecimal score;
}
server/dmvisit_service/src/main/java/com/doumee/dao/web/response/WxAuthorizeVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.doumee.dao.web.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2023/12/7 11:19
 */
@Data
public class WxAuthorizeVO {
    @ApiModelProperty(value = "授权OPENID")
    private String openid;
}
server/dmvisit_service/src/main/java/com/doumee/service/business/MemberService.java
@@ -7,6 +7,8 @@
import com.doumee.dao.admin.request.LaborMemberDTO;
import com.doumee.dao.admin.response.MemberInfoDTO;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.web.response.WxAuthorizeVO;
import java.util.List;
/**
@@ -132,4 +134,25 @@
     * @return
     */
    void importMemberBatch(LaborEmpowerDTO laborEmpowerDTO);
    /********************************************公众号接口***********************************************************************/
    /**
     * å¾®ä¿¡æŽˆæƒæŽ¥å£
     * @param code
     * @return
     */
    WxAuthorizeVO wxAuthorize(String code);
}
server/dmvisit_service/src/main/java/com/doumee/service/business/ProblemLogService.java
@@ -3,6 +3,8 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.ProblemLog;
import com.doumee.dao.web.reqeust.FinishAnswerDTO;
import java.util.List;
/**
@@ -94,4 +96,11 @@
     * @return long
     */
    long count(ProblemLog problemLog);
    /**
     * ä¿å­˜ç­”题记录
     * @param finishAnswerDTO
     * @return
     */
    Integer finishAnswer(FinishAnswerDTO finishAnswerDTO);
}
server/dmvisit_service/src/main/java/com/doumee/service/business/ProblemsService.java
@@ -4,6 +4,8 @@
import com.doumee.core.model.PageWrap;
import com.doumee.dao.admin.response.ProblemDTO;
import com.doumee.dao.business.model.Problems;
import com.doumee.dao.web.response.ProblemsVO;
import java.util.List;
/**
@@ -96,6 +98,14 @@
     */
    long count(Problems problems);
    /**
     * èŽ·å–é¢˜ç›®ä¿¡æ¯
     * @param useType
     * @return
     */
    List<ProblemsVO> getProblemsVO(Integer useType);
    /**
     * èŽ·å–ä¸åŒç”¨æˆ·ç±»åž‹çš„é¢˜ç›®
     * @param useType
server/dmvisit_service/src/main/java/com/doumee/service/business/VisitsService.java
@@ -19,6 +19,7 @@
     * @return Integer
     */
    Integer create(Visits visits);
    Integer createFk(Visits visits);
    /**
     * ä¸»é”®åˆ é™¤
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -4,6 +4,10 @@
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.PhoneUtil;
import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.config.Jwt.JwtPayLoad;
import com.doumee.config.Jwt.JwtTokenUtil;
import com.doumee.core.annotation.excel.ExcelImporter;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
@@ -11,7 +15,9 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.HttpsUtil;
import com.doumee.core.utils.Utils;
import com.doumee.core.wx.WXConstant;
import com.doumee.dao.admin.request.LaborEmpowerDTO;
import com.doumee.dao.admin.request.LaborMemberDTO;
import com.doumee.dao.admin.response.MemberInfoDTO;
@@ -22,6 +28,7 @@
import com.doumee.dao.business.model.Empower;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.TrainTime;
import com.doumee.dao.web.response.WxAuthorizeVO;
import com.doumee.service.business.MemberService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -54,6 +61,10 @@
    @Autowired
    private TrainTimeMapper trainTimeMapper;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Override
    public Integer create(Member member) {
@@ -371,4 +382,45 @@
//
    }
    /********************************************公众号接口***********************************************************************/
    /**
     * å¾®ä¿¡æŽˆæƒæŽ¥å£
     * @param code
     * @return
     */
    @Override
    public WxAuthorizeVO wxAuthorize(String code){
        String appId = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_APPID).getCode();
        String appSecret = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_SECRET).getCode();
        String getTokenUrl = WXConstant.GET_USER_INFO_URL.replace("CODE", code)
                .replace("APPID", appId).replace("SECRET", appSecret);
        JSONObject tokenJson = JSONObject.parseObject(HttpsUtil.get(getTokenUrl,true));
        String openId = null;
        if(!Objects.isNull(tokenJson.get("access_token"))){
            openId = tokenJson.getString("openid");
        }
        WxAuthorizeVO wxAuthorizeVO = new WxAuthorizeVO();
        wxAuthorizeVO.setOpenid(openId);
        return wxAuthorizeVO;
    }
}
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/ProblemLogServiceImpl.java
@@ -1,20 +1,33 @@
package com.doumee.service.business.impl;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
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.CompanyMapper;
import com.doumee.dao.business.MemberMapper;
import com.doumee.dao.business.ProblemLogMapper;
import com.doumee.dao.business.model.Company;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.ProblemLog;
import com.doumee.dao.web.reqeust.FinishAnswerDTO;
import com.doumee.service.business.ProblemLogService;
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 org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
 * è®¿å®¢ç­”题记录表Service实现
@@ -26,6 +39,12 @@
    @Autowired
    private ProblemLogMapper problemLogMapper;
    @Autowired
    private MemberMapper memberMapper;
    @Autowired
    private CompanyMapper companyMapper;
    @Override
    public Integer create(ProblemLog problemLog) {
@@ -152,4 +171,45 @@
        QueryWrapper<ProblemLog> wrapper = new QueryWrapper<>(problemLog);
        return problemLogMapper.selectCount(wrapper);
    }
    /**
     * ä¿å­˜ç­”题记录
     * @param finishAnswerDTO
     * @return
     */
    @Override
    public Integer finishAnswer(FinishAnswerDTO finishAnswerDTO){
        ProblemLog problemLog = new ProblemLog();
        BeanUtils.copyProperties(finishAnswerDTO,problemLog);
        problemLog.setCreateDate(new Date());
        problemLog.setIsdeleted(Constants.ZERO);
        problemLog.setStatus(Constants.ZERO);
        if(finishAnswerDTO.getUseType().equals(Constants.ZERO)&&StringUtils.isNotBlank(finishAnswerDTO.getUserId())){
            Member member = memberMapper.selectById(finishAnswerDTO.getUserId());
            if(Objects.isNull(member)){
                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到劳务人员");
            }
            if(!member.getType().equals(Constants.memberType.lw_visitor)){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非劳务人员类型,答题失败");
            }
            if(!member.getStatus().equals(Constants.ZERO)){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,账号已经" + (member.getStatus().equals(Constants.ONE)?"禁用":"拉黑/删除") );
            }
            problemLog.setName(member.getName());
            problemLog.setPhone(member.getPhone());
            problemLog.setCompanyId(member.getCompanyId());
            Company company = companyMapper.selectById(member.getCompanyId());
            if(Objects.isNull(company)){
                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到劳务人员公司");
            }
            problemLog.setCompanyName(company.getName());
        }
        this.problemLogMapper.insert(problemLog);
        return problemLog.getId();
    }
}
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/ProblemsServiceImpl.java
@@ -10,17 +10,20 @@
import com.doumee.dao.admin.response.ProblemDTO;
import com.doumee.dao.business.ProblemsMapper;
import com.doumee.dao.business.model.Problems;
import com.doumee.dao.web.response.ProblemsVO;
import com.doumee.service.business.ProblemsService;
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 org.springframework.beans.BeanUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -199,4 +202,27 @@
        return collect;
    }
    /**
     * èŽ·å–é¢˜ç›®ä¿¡æ¯
     * @param useType
     * @return
     */
    @Override
    public List<ProblemsVO> getProblemsVO(Integer useType){
        List<Problems> problemsList = problemsMapper.selectList(new QueryWrapper<Problems>().lambda().eq(Problems::getUseType,useType)
                .eq(Problems::getIsdeleted, Constants.ZERO).orderByAsc(Problems::getSortnu));
        List<ProblemsVO> problemsVOList = new ArrayList<>();
        for (Problems problems:problemsList) {
            ProblemsVO problemsVO = new ProblemsVO();
            BeanUtils.copyProperties(problems,problemsVO);
            problemsVOList.add(problemsVO);
        }
        return problemsVOList;
    }
}
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -1,19 +1,35 @@
package com.doumee.service.business.impl;
import cn.hutool.core.util.IdcardUtil;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DESUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.DeviceRoleMapper;
import com.doumee.dao.business.MemberMapper;
import com.doumee.dao.business.ProblemLogMapper;
import com.doumee.dao.business.VisitsMapper;
import com.doumee.dao.business.model.DeviceRole;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.ProblemLog;
import com.doumee.dao.business.model.Visits;
import com.doumee.service.business.VisitsService;
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 org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.DigestUtils;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
@@ -26,13 +42,183 @@
    @Autowired
    private VisitsMapper visitsMapper;
    @Autowired
    private DeviceRoleMapper deviceRoleMapper;
    @Autowired
    private ProblemLogMapper problemLogMapper ;
    @Autowired
    private MemberMapper memberMapper ;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Override
    public Integer create(Visits visits) {
        visitsMapper.insert(visits);
        return visits.getId();
    }
    /**
     * æ™®é€šè®¿å®¢ç”³è¯·
     * @param visits
     * @return
     */
    @Override
    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(), "对不起,信息填写不正确!");
        }
        //检查是否必须答题,并且符合答题要求
        ProblemLog problemLog = isValidProblemLog(visits);
        //获取申请的海康访问门禁组信息
        String[] hkIds = getHkDeviceRoles(visits);
        //检验拜访人是否合法
        isValideVisitedUser(visits.getReceptMemberId());
        //检查随访人员是否合法,生成随访人员新增集合
        List<Member> withUsers = isValideWithUsers(visits.getWithUserList());
        if(Constants.equalsInteger(Constants.ZERO, visits.getIdcardType()) &&!IdcardUtil.isValidCard(visits.getIdcardNo())){
            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);
        visitsMapper.insert(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())
        );
        return  null;
    }
    private List<Member> isValideWithUsers(List<Visits> withUserList) {
        if(withUserList!= null && withUserList .size()>0){
            for(Visits model:withUserList){
            }
        }
        return null;
    }
    /**
     * å¦‚果有答题记录,更新答题记录关联数据
     * @param visits
     * @param problemLog
     * @param member
     */
    private void updateProblemLog(Visits visits, ProblemLog problemLog,Member member) {
        if(problemLog!=null){
            problemLog.setEditDate(visits.getCreateDate());
            problemLog.setName(visits.getName());
            problemLog.setUserId(member.getId());
            problemLog.setPhone(member.getPhone());
            problemLog.setLogId(visits.getId());
            problemLogMapper.updateById(problemLog);
        }
    }
    /**
     *   æ£€æŸ¥è®¿äººæ˜¯å¦åˆæ³•
     * @param receptMemberId
     */
    private Member isValideVisitedUser(Integer receptMemberId) {
        Member member = memberMapper.selectById(receptMemberId);
        if(member == null || Constants.equalsInteger(Constants.ZERO,member.getIsdeleted())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,该拜访人暂时不能接受您的拜访申请!");
        }
        if(!Constants.equalsInteger(member.getStatus(), Constants.ZERO)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,该拜访人暂时不能接受您的拜访申请.");
        }
        if(!Constants.equalsInteger(Constants.ONE, member.getCanVisit())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,该拜访人暂时不能接受您的拜访申请~");
        }
        return  member;
    }
    private ProblemLog isValidProblemLog(Visits visits) {
        String required = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROBLEM_VISIT_REQUIRED).getCode();
        if(StringUtils.equals(required,Constants.ONE+"")){
            //如果必须答题,查找答题记录
            if(visits.getUserAnswerId() == null){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,请先按要求进行安全知识答题!");
            }
            ProblemLog log = problemLogMapper.selectById(visits.getUserAnswerId());
            if(log == null){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,请先按要求进行安全知识答题.");
            }
            if(log.getLogId() !=null){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,请先按要求进行安全知识答题~");
            }
            return  log;
        }
        return null;
    }
    /**
     * èŽ·å–ç”³è¯·çš„æµ·åº·è®¿é—®é—¨ç¦ç»„ä¿¡æ¯
     * @param visits
     * @return
     */
    private String[] getHkDeviceRoles(Visits visits) {
        String mustSelectDoors = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SELECT_DOORS_VISIT_REQUIRED).getCode();
        List<DeviceRole> roles = null;
        if(StringUtils.equals(mustSelectDoors,Constants.ZERO+"")){
            //如果必须选择门禁,但未选择
            if(StringUtils.isBlank(visits.getDoors())){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,请选择访问门禁!");
            }
            //校验门禁组信息是否正确
            String[] dIds = visits.getDoors().split(",");
            roles = deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
                    .eq(DeviceRole::getIsdeleted,Constants.ZERO)
                    .eq(DeviceRole::getType,Constants.DeviceRoleType.fk)
                    .in(DeviceRole::getId, Arrays.asList(dIds)));
            if(roles == null || roles.size()==0 || roles.size() != dIds.length){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,请选择有效访问门禁!");
            }
        }else{
            //如果设置不选择门禁,则提供默认门禁组信息
            String[] dIds = visits.getDoors().split(",");
            roles = deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
                    .eq(DeviceRole::getIsdeleted,Constants.ZERO)
                    .eq(DeviceRole::getIsDefault,Constants.ZERO)
                    .eq(DeviceRole::getType,Constants.DeviceRoleType.fk));
            if(roles.size() ==0){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,暂不存在可访问的访客门禁,无法进行申请操作!");
            }
        }
        String[] ids =new String[roles.size()];
        for (int i = 0; i < roles.size(); i++) {
            ids[i] = roles.get(i).getHkId();
        }
        return  ids;
    }
    @Override
    public void deleteById(Integer id) {
        visitsMapper.deleteById(id);
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncEventServiceImpl.java
@@ -65,7 +65,6 @@
                }
            }
        }
    }
    /**
server/dmvisit_web/src/main/java/com/doumee/api/ScheduleTool.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
package com.doumee.api;
import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.HttpsUtil;
import com.doumee.core.wx.WXConstant;
import com.doumee.dao.system.model.SystemDictData;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
/**
 * å®šæ—¶ä»»åŠ¡
 * @author jiangping
 * @date 2021-10-10 14:40:35
 * https://www.bejson.com/othertools/cron/  cron è¡¨è¾¾å¼ç”Ÿæˆåœ°å€
 */
@Slf4j
@Component
@EnableScheduling
public class ScheduleTool {
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    /**
     * æ˜¯å¦å¼€å‘者
     */
    @Value("${timing}")
    private Boolean timing;
    /**
     * æ›´æ–°å¾®ä¿¡å…¬ä¼—号 ACCESS_TOKEN
     * @throws Exception
     */
    @Scheduled(fixedDelay=1000 * 60 * 90)
    public void updAccessToken(){
        String appId = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_APPID).getCode();
        String appSecret = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_SECRET).getCode();
        //生成微信token
        String url = WXConstant.GET_ACCESS_TOKEN_URL.replace("APPID",appId).replace("APPSECRET",appSecret);
        String response = HttpsUtil.get(url,false);
        JSONObject json = JSONObject.parseObject(response);
        SystemDictData systemDictData =  systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN);
        if(!Objects.isNull(systemDictData)){
            systemDictData.setCode(json.getString("access_token"));
            systemDictData.setUpdateTime(new Date());
            systemDictDataBiz.updateByIdNew(systemDictData);
            log.info(" æ›´æ–°å¾®ä¿¡å…¬ä¼—号 ACCESS_TOKEN =========> " + systemDictData.getCode() );
        }
    }
}
server/dmvisit_web/src/main/java/com/doumee/api/web/ApiController.java
@@ -1,6 +1,7 @@
package com.doumee.api.web;
import com.doumee.config.Jwt.JwtTokenUtil;
import com.doumee.core.model.PageData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@@ -25,6 +26,7 @@
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        return request;
    }
    /**
     * èŽ·å–ç”¨æˆ·ID
     *
server/dmvisit_web/src/main/java/com/doumee/api/web/UnitController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,73 @@
package com.doumee.api.web;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.dao.system.model.SystemDictData;
import com.doumee.dao.web.reqeust.FinishAnswerDTO;
import com.doumee.dao.web.response.ProblemsVO;
import com.doumee.service.business.ProblemLogService;
import com.doumee.service.business.ProblemsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2023/12/7 10:40
 */
@Api(tags = "99、其他")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/unit")
@Slf4j
public class UnitController {
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private ProblemsService problemsService;
    @Autowired
    private ProblemLogService problemLogService;
    @ApiOperation(value = "查询字典值数据", notes = "H5")
    @GetMapping("/getSystemDictData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "label", value = "数据字典值", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "dictCode", value = "系统字典值", required = true)
    })
    public ApiResponse<SystemDictData> getSystemDictData(@RequestParam String dictCode, @RequestParam String label) {
        return ApiResponse.success("查询成功",systemDictDataBiz.queryByCode(dictCode,label));
    }
    @ApiOperation(value = "获取题目数据", notes = "H5")
    @GetMapping("/getProblemsVO")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "useType", value = "使用场景 0劳务人员 1普通访客", required = true)
    })
    public ApiResponse<List<ProblemsVO>> getProblemsVO(@RequestParam Integer useType) {
        return ApiResponse.success("查询成功",problemsService.getProblemsVO(useType));
    }
    @ApiOperation(value = "保存答题记录", notes = "H5")
    @PostMapping("/finishAnswer")
    public ApiResponse<Integer> finishAnswer(@RequestBody FinishAnswerDTO finishAnswerDTO) {
        return ApiResponse.success("查询成功",problemLogService.finishAnswer(finishAnswerDTO));
    }
}
server/dmvisit_web/src/main/java/com/doumee/api/web/VisitorController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
package com.doumee.api.web;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.utils.Constants;
import com.doumee.dao.web.response.WxAuthorizeVO;
import com.doumee.service.business.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2023/12/7 10:40
 */
@Api(tags = "1、访客业务")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/visitor")
@Slf4j
public class VisitorController {
    @Autowired
    private MemberService memberService;
    @ApiOperation(value = "访客微信授权", notes = "访客微信授权获取openId")
    @GetMapping("/wxAuthorize")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "授权码", required = true)
    })
    public ApiResponse<WxAuthorizeVO> wxAuthorize(@RequestParam String code) {
        WxAuthorizeVO wxAuthorizeVO =  memberService.wxAuthorize(code);
        return ApiResponse.success("查询成功",wxAuthorizeVO);
    }
}