Просмотр исходного кода

增加admin登录的验证码和操作日志

王鑫刚 3 дней назад
Родитель
Сommit
62a8ed50a7
48 измененных файлов с 2241 добавлено и 34 удалено
  1. 11 5
      pom.xml
  2. 1 0
      src/main/java/cn/hanghui/outapi/platform/common/config/WebSecurityConfig.java
  3. 41 0
      src/main/java/cn/hanghui/outapi/platform/common/config/log/Log.java
  4. 318 0
      src/main/java/cn/hanghui/outapi/platform/common/config/log/LogAspect.java
  5. 12 1
      src/main/java/cn/hanghui/outapi/platform/common/controller/LoginController.java
  6. 5 0
      src/main/java/cn/hanghui/outapi/platform/common/entity/dto/LoginDto.java
  7. 13 0
      src/main/java/cn/hanghui/outapi/platform/common/entity/dto/LoginUserDto.java
  8. 10 0
      src/main/java/cn/hanghui/outapi/platform/common/entity/dto/LoginUserRedisDto.java
  9. 30 0
      src/main/java/cn/hanghui/outapi/platform/common/entity/dto/PcLoginCodeDto.java
  10. 5 0
      src/main/java/cn/hanghui/outapi/platform/common/entity/dto/PcLoginDto.java
  11. 11 0
      src/main/java/cn/hanghui/outapi/platform/common/entity/po/Account.java
  12. 2 0
      src/main/java/cn/hanghui/outapi/platform/common/service/LoginService.java
  13. 57 1
      src/main/java/cn/hanghui/outapi/platform/common/service/impl/LoginServiceImpl.java
  14. 658 0
      src/main/java/cn/hanghui/outapi/platform/common/utils/RedisUtil.java
  15. 4 13
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/AccountController.java
  16. 7 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/AlipayIotController.java
  17. 7 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/AppApkController.java
  18. 4 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/AuthAmpeController.java
  19. 4 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/AuthDeviceController.java
  20. 60 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/AuthFkjController.java
  21. 9 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/ConfigMaintenanceController.java
  22. 9 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/FkjDeviceController.java
  23. 9 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/HHCultureDeviceController.java
  24. 8 1
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/HhLocalDeviceController.java
  25. 9 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/HhOmcDeviceController.java
  26. 10 3
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/IotDeviceConfigController.java
  27. 7 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/OpenInterfaceAuthController.java
  28. 8 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/OpenInterfaceAuthDeviceController.java
  29. 11 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/ProvisionalProofController.java
  30. 7 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/SceneController.java
  31. 58 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/SysOperLogController.java
  32. 10 4
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/TenantController.java
  33. 5 0
      src/main/java/cn/hanghui/outapi/platform/tenant/controller/UserBlacklistController.java
  34. 51 0
      src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/SysOperLogSearch.java
  35. 62 0
      src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/SysOperLogVo.java
  36. 234 0
      src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/auth/fkj/FkjAuthDeviceDto.java
  37. 22 0
      src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/auth/fkj/FkjAuthDeviceSearch.java
  38. 1 1
      src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/hhlocal/HhLocalDeviceBase.java
  39. 42 0
      src/main/java/cn/hanghui/outapi/platform/tenant/entity/enums/BusinessTypeEnum.java
  40. 38 0
      src/main/java/cn/hanghui/outapi/platform/tenant/entity/enums/LogTagEnum.java
  41. 123 0
      src/main/java/cn/hanghui/outapi/platform/tenant/entity/po/SysOperLog.java
  42. 16 0
      src/main/java/cn/hanghui/outapi/platform/tenant/mapper/SysOperLogMapper.java
  43. 43 0
      src/main/java/cn/hanghui/outapi/platform/tenant/server/job/ClearSysOperLogTask.java
  44. 6 0
      src/main/java/cn/hanghui/outapi/platform/tenant/service/FkjDeviceService.java
  45. 10 0
      src/main/java/cn/hanghui/outapi/platform/tenant/service/SysOperLogService.java
  46. 86 5
      src/main/java/cn/hanghui/outapi/platform/tenant/service/impl/FkjDeviceServiceImpl.java
  47. 71 0
      src/main/java/cn/hanghui/outapi/platform/tenant/service/impl/SysOperLogServiceImpl.java
  48. 16 0
      src/main/java/cn/hanghui/outapi/platform/tenant/typehandle/LoginUserDtoHandler.java

+ 11 - 5
pom.xml

@@ -41,7 +41,7 @@
         <fastjson.version>1.2.74</fastjson.version>
         <jjwt.version>0.9.1</jjwt.version>
         <commons-codec.version>1.10</commons-codec.version>
-        <hutool.version>5.7.7</hutool.version>
+        <hutool.version>5.8.11</hutool.version>
         <swagger-version>3.0.0</swagger-version>
     </properties>
     <dependencies>
@@ -137,6 +137,12 @@
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-all</artifactId>
             <version>${hutool.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>cn.hutool</groupId>
+                    <artifactId>hutool-core</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <!--fastjson-->
@@ -178,11 +184,11 @@
             <version>3.4.1</version>
         </dependency>
 
-        <!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel -->
+        <!-- hh-score-platform项目下的hh-message模块install后引入 -->
         <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>easyexcel</artifactId>
-            <version>4.0.2</version>
+            <groupId>com.yx.message</groupId>
+            <artifactId>hh-message</artifactId>
+            <version>1.0-SNAPSHOT</version>
         </dependency>
 
     </dependencies>

+ 1 - 0
src/main/java/cn/hanghui/outapi/platform/common/config/WebSecurityConfig.java

@@ -155,6 +155,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter implements W
         excludeList.add("/api/v1/hh/culture/device/sn/**");
         excludeList.add("/api/v1/hh/local/device/sn/**");
         excludeList.add("/api/v1/hh/omc/device/config/**");
+        excludeList.add("/pc/getCode");
 
         excludeList.add("/**/v1/proof/**");
         return ArrayUtil.toArray(excludeList, String.class);

+ 41 - 0
src/main/java/cn/hanghui/outapi/platform/common/config/log/Log.java

@@ -0,0 +1,41 @@
+package cn.hanghui.outapi.platform.common.config.log;
+
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
+
+import java.lang.annotation.*;
+
+/**
+ * 自定义操作日志记录注解
+ *
+ */
+@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Log {
+    LogTagEnum tag() default LogTagEnum.OTHER;
+    /**
+     * 模块名称
+     */
+    String title() default "";
+
+    /**
+     * 业务操作类型
+     */
+    BusinessTypeEnum businessTypeEnum() default BusinessTypeEnum.OTHER;
+
+    /**
+     * 是否保存请求参数
+     */
+    boolean isSaveRequestData() default true;
+
+    /**
+     * 是否保存响应数据
+     */
+    boolean isSaveResponseData() default true;
+
+    /**
+     * 排除指定的请求参数
+     */
+    String[] excludeParamNames() default {};
+}

+ 318 - 0
src/main/java/cn/hanghui/outapi/platform/common/config/log/LogAspect.java

@@ -0,0 +1,318 @@
+package cn.hanghui.outapi.platform.common.config.log;
+
+import cn.hanghui.outapi.platform.common.controller.BaseController;
+import cn.hanghui.outapi.platform.common.entity.dto.LoginUserDto;
+import cn.hanghui.outapi.platform.common.entity.po.Account;
+import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
+import cn.hanghui.outapi.platform.common.exception.BusinessException;
+import cn.hanghui.outapi.platform.common.exception.CommonException;
+import cn.hanghui.outapi.platform.tenant.entity.po.SysOperLog;
+import cn.hanghui.outapi.platform.tenant.mapper.SysOperLogMapper;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.net.Ipv4Util;
+import cn.hutool.core.thread.threadlocal.NamedThreadLocal;
+import cn.hutool.jwt.JWTUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.support.spring.PropertyPreFilters;
+
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.ArrayUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * 日志切面
+ */
+@Aspect
+@Component
+@RequiredArgsConstructor
+public class LogAspect extends BaseController {
+
+    /**
+     * 定义需要排除在日志记录之外的属性名称数组
+     */
+    private static final String[] EXCLUDE_PROPERTIES = {"password", "oldPassword", "newPassword", "confirmPassword"};
+
+    private final SysOperLogMapper sysOperLogMapper;
+
+    /**
+     * 使用ThreadLocal维护一个线程局部变量,用于记录操作的耗时
+     */
+    private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
+
+
+    /**
+     * 返回通知
+     *
+     * @param joinPoint 切点
+     */
+    @AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult")
+    public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult) {
+        //调用处理日志的方法
+        handleLog(joinPoint, controllerLog, null, jsonResult);
+
+    }
+
+    /**
+     * 异常通知
+     *
+     * @param joinPoint 切点
+     * @param e         异常
+     */
+    @AfterThrowing(pointcut = "@annotation(controllerLog)", throwing = "e")
+    public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e) {
+        handleLog(joinPoint, controllerLog, e, null);
+    }
+
+    /**
+     * 处理请求前执行,此方法旨在记录方法的开始时间。
+     *
+     * @param joinPoint     切点
+     * @param controllerLog 一个注解对象,表示目标方法上标注的注解。这里用于判断方法是否应该被此切面处理。
+     */
+    @Before(value = "@annotation(controllerLog)")
+    public void boBefore(JoinPoint joinPoint, Log controllerLog) {
+        TIME_THREADLOCAL.set(System.currentTimeMillis());
+    }
+
+    /**
+     * 处理操作日志的逻辑。
+     * 当方法执行完毕或发生异常时,此方法用于封装和记录操作日志。
+     *
+     * @param joinPoint     切点,用于获取目标方法的信息。
+     * @param controllerLog 控制器上的日志注解,用于获取方法描述等信息。
+     * @param e             异常对象,如果方法执行过程中抛出异常。
+     * @param jsonResult    方法返回的对象,用于日志记录,此参数可能为null。
+     */
+    private void handleLog(JoinPoint joinPoint, Log controllerLog, Exception e, Object jsonResult) {
+        try {
+            // 获取当前请求的属性,包括HttpServletRequest对象。
+            RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+            // 如果请求属性为空,则直接返回,不处理日志。
+            if (requestAttributes == null) {
+                return;
+            }
+            // 将请求属性转换为ServletRequestAttributes,以便获取HttpServletRequest对象。
+            ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
+            // 获取HttpServletRequest对象。
+            HttpServletRequest request = servletRequestAttributes.getRequest();
+
+            // 重新获取请求属性,目的是为了后续获取请求方法等信息。
+            RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
+            ServletRequestAttributes http = (ServletRequestAttributes) attributes;
+            // 再次获取HttpServletRequest对象。
+            HttpServletRequest httpServletRequest = http.getRequest();
+
+            // 创建SysOperLog对象,用于存储操作日志的信息。
+            SysOperLog sysOperLog = new SysOperLog();
+            // 默认设置操作状态为正常。
+            sysOperLog.setStatus(true);
+            // 如果方法执行过程中抛出异常,则将操作状态设置为异常。
+            if (e != null) {
+                // 设置状态为异常
+                sysOperLog.setStatus(false);
+                // 设置异常信息。
+                sysOperLog.setErrorMsg(e.getMessage());
+            }
+
+            // 获取当前登录的用户信息。
+            Account account = getAccount();
+            sysOperLog.setAccountId(account.getId());
+            sysOperLog.setAccountName(account.getName());
+            if(CollUtil.isNotEmpty(account.getLoginUserDtoList())){
+                LoginUserDto loginUserDto = account.getLoginUserDtoList().get(0);
+                // 设置操作人员
+                sysOperLog.setOperName(loginUserDto.getName());
+                sysOperLog.setOperPhone(loginUserDto.getPhone());
+            }
+            // 获取目标对象的类名。
+            String className = joinPoint.getTarget().getClass().getName();
+            // 获取方法名
+            String methodName = joinPoint.getSignature().getName();
+            // 设置方法名称
+            sysOperLog.setMethod(className + "." + methodName + "()");
+            // 获取注解中对方法的描述信息
+            getControllerMethodDescription(joinPoint, controllerLog, jsonResult, sysOperLog);
+            // 计算执行时长(毫秒)
+            long executeTime = System.currentTimeMillis() - TIME_THREADLOCAL.get();
+            sysOperLog.setExecuteTime(executeTime);
+            // 设置操作时间。
+            sysOperLog.setOperTime(new Date());
+            // 保存操作日志
+            sysOperLogMapper.insert(sysOperLog);
+        } catch (Exception ex) {
+            // 记录处理日志过程中发生的异常。
+            ex.printStackTrace();
+        }
+    }
+    /**
+     * 从注解中获取控制器方法的描述信息,并填充到操作日志对象中。
+     *
+     * @param joinPoint     切点对象,用于获取方法名和参数信息。
+     * @param controllerLog 控制器日志注解对象,包含标题、业务类型等配置信息。
+     * @param jsonResult    方法的返回结果,用于判断是否需要记录响应数据。
+     * @param sysOperLog    系统操作日志对象,此处将从controllerLog中获取的信息填充到该对象中。
+     */
+    private void getControllerMethodDescription(JoinPoint joinPoint, Log controllerLog, Object jsonResult, SysOperLog sysOperLog) {
+        //设置操作模块
+        sysOperLog.setTitle(controllerLog.title());
+        sysOperLog.setTag(controllerLog.tag().getDesc());
+        sysOperLog.setBusinessType(controllerLog.businessTypeEnum().getCode());
+
+        // 判断是否需要保存请求数据,如果需要,则调用setRequestValue方法进行处理
+        if (controllerLog.isSaveRequestData()) {
+            //调用设置请求数据的方法
+            setRequestValue(joinPoint, sysOperLog, controllerLog.excludeParamNames());
+        }
+
+        // 判断是否需要保存响应数据且返回结果不为空,如果满足条件,则将返回结果转为JSON字符串并保存到操作日志中
+        if (controllerLog.isSaveResponseData() && !StringUtils.isEmpty(jsonResult)) {
+            //设置响应数据
+            sysOperLog.setJsonResult(JSON.toJSONString(jsonResult));
+        }
+    }
+
+
+    /**
+     * 设置操作日志的请求参数信息。
+     *
+     * @param joinPoint         切点,用于获取方法参数。
+     * @param operLog           操作日志对象,用于设置请求参数信息。
+     * @param excludeParamNames 需要排除的参数名数组,这些参数不会被记录在日志中。
+     */
+    private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog, String[] excludeParamNames) {
+        // 获取当前请求的属性
+        Map<String, String[]> parameterMap = getParameterMap();
+        // 如果参数不为空且不为空集合
+        if (parameterMap != null && !parameterMap.isEmpty()) {
+            // 将参数转换为JSON字符串,通过excludePropertyPreFilter过滤掉不需要记录的参数
+            String params = JSONObject.toJSONString(parameterMap, excludePropertyPreFilter(excludeParamNames));
+            // 设置操作日志的请求参数,截取前2000个字符以防止过长
+            operLog.setOperParam(org.apache.commons.lang3.StringUtils.substring(params, 0, 2000));
+        } else {
+            // 如果请求参数为空,尝试从方法参数中获取信息
+            Object args = joinPoint.getArgs();
+            // 如果方法参数不为空
+            if (args != null) {
+                // 将方法参数转换为字符串,同样支持排除某些参数名
+                String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames);
+                // 设置操作日志的请求参数,同样截取前2000个字符
+                operLog.setOperParam(org.apache.commons.lang3.StringUtils.substring(params, 0, 2000));
+            }
+        }
+    }
+
+    /**
+     * 获取当前HTTP请求的参数
+     *
+     * @return 一个Map,映射参数名称到参数值数组。这允许处理多值参数。
+     */
+    private static Map<String, String[]> getParameterMap() {
+        // 从Spring的RequestContextHolder中获取当前请求的属性
+        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+        // 将RequestAttributes强制转换为ServletRequestAttributes,以便访问HTTP请求特定的属性
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
+        // 从ServletRequestAttributes中获取当前HTTP请求对象
+        HttpServletRequest request = (HttpServletRequest) servletRequestAttributes.getRequest();
+        // 获取请求的所有参数
+        Map<String, String[]> parameterMap = request.getParameterMap();
+        return parameterMap;
+    }
+
+
+    /**
+     * 忽略敏感属性
+     *
+     * @param excludeParamNames 需要排除的参数名数组
+     * @return {@link PropertyPreFilters.MySimplePropertyPreFilter }
+     */
+    public PropertyPreFilters.MySimplePropertyPreFilter excludePropertyPreFilter(String[] excludeParamNames) {
+        return new PropertyPreFilters().addFilter().addExcludes(ArrayUtils.addAll(EXCLUDE_PROPERTIES, excludeParamNames));
+    }
+
+    /**
+     * 将对象数组转换为字符串,排除指定的参数名(敏感参数)。
+     *
+     * @param paramsArray       参数数组,可以包含任意类型的对象。
+     * @param excludeParamNames 需要排除的参数名数组,这些参数不会被转换为字符串。
+     * @return 返回转换后的参数字符串,各参数间以空格分隔。
+     */
+    private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames) {
+        // 使用StringBuilder来构建最终的参数字符串
+        StringBuilder params = new StringBuilder();
+        // 检查参数数组是否为空或长度为0,避免不必要的处理
+        if (paramsArray != null) {
+            // 遍历参数数组中的每个对象
+            for (Object o : paramsArray) {
+                // 检查对象是否为空且不属于被过滤的类型
+                if (o != null && !isFilterObject(o)) {
+                    try {
+                        // 将对象转换为JSON字符串,排除指定的属性
+                        Object jsonObj = JSONObject.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
+                        // 将转换后的JSON字符串追加到参数字符串中,并以空格分隔各个参数
+                        params.append(jsonObj).append(" ");
+                    } catch (Exception ignored) {
+                        // 忽略转换过程中的异常,确保方法的健壮性
+                    }
+                }
+            }
+        }
+        return params.toString().trim();
+    }
+
+
+    /**
+     * 判断传入的对象是否需要被过滤。
+     * 这个方法主要用于处理上传文件时,判断接收的参数是否为文件类型或其他特定类型。
+     *
+     * @param o 待检查的对象
+     * @return 如果对象需要被过滤(即对象为MultipartFile或其他特定类型),则返回true;否则返回false。
+     */
+    @SuppressWarnings("rawtypes")
+    public boolean isFilterObject(final Object o) {
+        // 获取对象的类类型
+        Class<?> clazz = o.getClass();
+
+        // 检查对象是否为数组类型
+        if (clazz.isArray()) {
+            // 如果数组的组件类型可以被MultipartFile类转换,则返回true
+            return clazz.getComponentType().isAssignableFrom(MultipartFile.class);
+        } else if (Collection.class.isAssignableFrom(clazz)) {
+            // 如果对象是集合类型,将其转换为Collection接口实例
+            Collection collection = (Collection) o;
+            // 遍历集合中的每个元素,如果任意元素是MultipartFile实例,则返回true
+            for (Object value : collection) {
+                return value instanceof MultipartFile;
+            }
+        } else if (Map.class.isAssignableFrom(clazz)) {
+            // 如果对象是Map类型,将其转换为Map接口实例
+            Map map = (Map) o;
+            // 遍历Map中的每个条目,如果任意条目的值是MultipartFile实例,则返回true
+            for (Object value : map.entrySet()) {
+                Map.Entry entry = (Map.Entry) value;
+                return entry.getValue() instanceof MultipartFile;
+            }
+        }
+        // 如果对象不是数组、集合或Map类型,检查它是否为MultipartFile、HttpServletRequest、HttpServletResponse或BindingResult实例
+        return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse
+                || o instanceof BindingResult;
+    }
+
+}

+ 12 - 1
src/main/java/cn/hanghui/outapi/platform/common/controller/LoginController.java

@@ -3,6 +3,7 @@ package cn.hanghui.outapi.platform.common.controller;
 import cn.hanghui.outapi.platform.common.annotation.DecryptBySm2;
 import cn.hanghui.outapi.platform.common.annotation.DecryptParam;
 import cn.hanghui.outapi.platform.common.entity.dto.LoginDto;
+import cn.hanghui.outapi.platform.common.entity.dto.PcLoginCodeDto;
 import cn.hanghui.outapi.platform.common.entity.dto.PcLoginDto;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.common.entity.rest.Result;
@@ -11,13 +12,17 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
+
 @Api(tags = "登录")
 @RestController
 @AllArgsConstructor(onConstructor_ = @Autowired)
+@Validated
 public class LoginController {
 
     private final LoginService loginService;
@@ -47,7 +52,13 @@ public class LoginController {
         LoginDto dto = new LoginDto();
         dto.setAccountName(loginDto.getUsername());
         dto.setPassword(loginDto.getPassword());
+        dto.setCode(loginDto.getCode());
+        dto.setPhone(loginDto.getPhone());
         return RestResult.ok(loginService.login(dto));
     }
-
+    @ApiOperation("PC登录获取验证码")
+    @PostMapping("/pc/getCode")
+    public RestResult<Boolean> getCode(@RequestBody @Valid PcLoginCodeDto dto) {
+        return RestResult.ok(loginService.getCode(dto));
+    }
 }

+ 5 - 0
src/main/java/cn/hanghui/outapi/platform/common/entity/dto/LoginDto.java

@@ -19,4 +19,9 @@ public class LoginDto {
      */
     @ApiModelProperty(value = "密码")
     private String password;
+
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+    @ApiModelProperty(value = "验证码")
+    private String code;
 }

+ 13 - 0
src/main/java/cn/hanghui/outapi/platform/common/entity/dto/LoginUserDto.java

@@ -0,0 +1,13 @@
+package cn.hanghui.outapi.platform.common.entity.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class LoginUserDto {
+    private String name;//姓名
+    private String phone;//手机号
+}

+ 10 - 0
src/main/java/cn/hanghui/outapi/platform/common/entity/dto/LoginUserRedisDto.java

@@ -0,0 +1,10 @@
+package cn.hanghui.outapi.platform.common.entity.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class LoginUserRedisDto extends LoginUserDto implements Serializable {
+    private String code;//验证码
+}

+ 30 - 0
src/main/java/cn/hanghui/outapi/platform/common/entity/dto/PcLoginCodeDto.java

@@ -0,0 +1,30 @@
+package cn.hanghui.outapi.platform.common.entity.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @author shisl
+ * @package cn.hanghui.outapi.platform.common.entity.dto
+ * @class PcLoginDto
+ * @date 2023/4/23 上午9:14
+ * @description
+ */
+@Data
+@ApiModel(value = "登录获取手机验证码")
+public class PcLoginCodeDto {
+
+    @ApiModelProperty(value = "账号名称", required = true)
+    @NotBlank(message = "账号名称不能为空")
+    private String username;
+
+
+    @ApiModelProperty(value = "手机号", required = true)
+    @NotBlank(message = "手机号不能为空")
+    private String phone;
+
+
+}

+ 5 - 0
src/main/java/cn/hanghui/outapi/platform/common/entity/dto/PcLoginDto.java

@@ -29,5 +29,10 @@ public class PcLoginDto {
     @ApiModelProperty(value = "密码", required = true)
     private String password;
 
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+    @ApiModelProperty(value = "验证码")
+    private String code;
+
 
 }

+ 11 - 0
src/main/java/cn/hanghui/outapi/platform/common/entity/po/Account.java

@@ -1,9 +1,14 @@
 package cn.hanghui.outapi.platform.common.entity.po;
 
+import cn.hanghui.outapi.platform.common.entity.dto.LoginUserDto;
+import cn.hanghui.outapi.platform.tenant.typehandle.LoginUserDtoHandler;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.List;
+
 @Data
 @TableName(value = "account", autoResultMap = true)
 @EqualsAndHashCode(callSuper = true)
@@ -29,4 +34,10 @@ public class Account extends Base {
      */
     private Integer accountType;
 
+    /**
+     * 超级管理员账号登录时获取验证码的姓名和手机号列表
+     */
+    @TableField(value = "login_user_json",typeHandler = LoginUserDtoHandler.class )
+    private List<LoginUserDto> LoginUserDtoList;
+
 }

+ 2 - 0
src/main/java/cn/hanghui/outapi/platform/common/service/LoginService.java

@@ -1,6 +1,7 @@
 package cn.hanghui.outapi.platform.common.service;
 
 import cn.hanghui.outapi.platform.common.entity.dto.LoginDto;
+import cn.hanghui.outapi.platform.common.entity.dto.PcLoginCodeDto;
 import org.springframework.security.core.userdetails.UserDetailsService;
 
 public interface LoginService extends UserDetailsService {
@@ -12,4 +13,5 @@ public interface LoginService extends UserDetailsService {
      * @return token
      */
     String login(LoginDto loginDto);
+    Boolean getCode(PcLoginCodeDto dto);
 }

+ 57 - 1
src/main/java/cn/hanghui/outapi/platform/common/service/impl/LoginServiceImpl.java

@@ -2,18 +2,30 @@ package cn.hanghui.outapi.platform.common.service.impl;
 
 import cn.hanghui.outapi.platform.common.config.JwtConfig;
 import cn.hanghui.outapi.platform.common.entity.dto.LoginDto;
+import cn.hanghui.outapi.platform.common.entity.dto.LoginUserDto;
+import cn.hanghui.outapi.platform.common.entity.dto.LoginUserRedisDto;
+import cn.hanghui.outapi.platform.common.entity.dto.PcLoginCodeDto;
 import cn.hanghui.outapi.platform.common.entity.po.Account;
 import cn.hanghui.outapi.platform.common.entity.rest.RespCodeEnum;
 import cn.hanghui.outapi.platform.common.exception.CommonException;
 import cn.hanghui.outapi.platform.common.handler.LoginAuthorizedHandler;
 import cn.hanghui.outapi.platform.common.mapper.AccountMapper;
 import cn.hanghui.outapi.platform.common.service.LoginService;
+import cn.hanghui.outapi.platform.common.utils.ClassUtil;
+import cn.hanghui.outapi.platform.common.utils.RedisUtil;
+import cn.hanghui.outapi.platform.tenant.entity.enums.AccountTypeEnum;
+import com.yx.message.service.server.MessageServer;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import cn.hutool.jwt.JWTUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -23,11 +35,12 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 @Service
-//@AllArgsConstructor(onConstructor_ = @Autowired)
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
 public class LoginServiceImpl implements LoginService {
 
     @Resource
@@ -37,6 +50,9 @@ public class LoginServiceImpl implements LoginService {
     @Resource
     private RedisTemplate<String, String> redisTemplate;
 
+    private final RedisUtil redisUtil;
+    private final String REIDS_CODE_KEY = "code::";//code::账号名::手机号
+
     @Override
     public UserDetails loadUserByUsername(String name) throws UsernameNotFoundException {
         String token = redisTemplate.opsForValue().get(JwtConfig.TOKEN_PREFIX + name.toLowerCase());
@@ -70,9 +86,49 @@ public class LoginServiceImpl implements LoginService {
         tokenAccount.setName(loginDto.getAccountName());
         tokenAccount.setPassword(loginDto.getPassword());
         Map<String, Object> payload = BeanUtil.beanToMap(tokenAccount);
+        if(AccountTypeEnum.ADMIN.getCode().equals(account.getAccountType())){
+            ClassUtil.throwBusinessException(StrUtil.isBlank(loginDto.getPhone()),"手机号不能为空");
+            ClassUtil.throwBusinessException(StrUtil.isBlank(loginDto.getCode()),"验证码不能为空");
+            String key = REIDS_CODE_KEY + loginDto.getAccountName() + "::" + loginDto.getPhone();
+            ClassUtil.throwBusinessException(!redisUtil.hasKey(key),"验证码已过期");
+            LoginUserRedisDto dto = redisUtil.get(key);
+            ClassUtil.throwBusinessException(!dto.getCode().equals(loginDto.getCode()),"验证码不正确");
+            account.setLoginUserDtoList(CollUtil.toList(new LoginUserDto(dto.getName(),dto.getPhone())));
+        }
+
         String token = JWTUtil.createToken(payload, JwtConfig.SECRET_KEY.getBytes());
         redisTemplate.opsForValue().set(JwtConfig.TOKEN_PREFIX + loginDto.getAccountName().toLowerCase(), token, JwtConfig.EXPIRE_TIME, TimeUnit.SECONDS);
         redisTemplate.opsForValue().set(JwtConfig.SESSION_PREFIX + token, JSON.toJSONString(account), JwtConfig.EXPIRE_TIME, TimeUnit.SECONDS);
         return token;
     }
+
+
+    @Override
+    public Boolean getCode(PcLoginCodeDto dto) {
+        /**
+         * 两个方法
+         * 1.获取用户的手机号列表
+         * 2.发送短信
+         */
+        Account account = accountMapper.selectOne(Wrappers.lambdaQuery(Account.class).eq(Account::getName, dto.getUsername()));
+        ClassUtil.checkData(account,"账号不存在");
+        ClassUtil.throwBusinessException(!AccountTypeEnum.ADMIN.getCode().equals(account.getAccountType()),"不是超级管理员,不需要获取验证码");
+        List<LoginUserDto> loginUserDtoList = account.getLoginUserDtoList();
+        LoginUserDto loginUserDto = null;
+        for (LoginUserDto item : loginUserDtoList) {
+            if (item.getPhone().equals(dto.getPhone())) {
+                loginUserDto = item;
+            }
+        }
+        ClassUtil.checkData(loginUserDto,"手机号不存在");
+        String code = RandomUtil.randomNumbers(6);
+        MessageServer.sendMessage(loginUserDto.getPhone(),code);
+        String key = REIDS_CODE_KEY + dto.getUsername() + "::" + dto.getPhone();
+        LoginUserRedisDto redisDto = new LoginUserRedisDto();
+        redisDto.setCode(code);
+        redisDto.setName(loginUserDto.getName());
+        redisDto.setPhone(loginUserDto.getPhone());
+        redisUtil.set(key,redisDto,300);
+        return true;
+    }
 }

+ 658 - 0
src/main/java/cn/hanghui/outapi/platform/common/utils/RedisUtil.java

@@ -0,0 +1,658 @@
+package cn.hanghui.outapi.platform.common.utils;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
+
+/**
+ * redis 工具类
+ *
+ * @Author Scott
+ */
+@Component
+public class RedisUtil {
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+    /**
+     * 指定缓存失效时间
+     *
+     * @param key  键
+     * @param time 时间(秒)
+     * @return
+     */
+    public boolean expire(String key, long time) {
+        try {
+            if (time > 0) {
+                redisTemplate.expire(key, time, TimeUnit.SECONDS);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 根据key 获取过期时间
+     *
+     * @param key 键 不能为null
+     * @return 时间(秒) 返回0代表为永久有效
+     */
+    public long getExpire(String key) {
+        return redisTemplate.getExpire(key, TimeUnit.SECONDS);
+    }
+
+    /**
+     * 判断key是否存在
+     *
+     * @param key 键
+     * @return true 存在 false不存在
+     */
+    public boolean hasKey(String key) {
+        try {
+            return redisTemplate.hasKey(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    // ============================String=============================
+
+    /**
+     * 普通缓存获取
+     *
+     * @param key 键
+     * @return 值
+     */
+    public <T> T get(String key) {
+        return key == null ? null : (T)redisTemplate.opsForValue().get(key);
+    }
+    public <T> T get(String key, Class<T> tClass) {
+        if(key == null){
+            return null;
+        }
+        Object o = redisTemplate.opsForValue().get(key);
+        if(ObjectUtil.isEmpty(o)){
+            return null;
+        }
+        return (T)o;
+    }
+    public <T> T getValue(String key) {
+        if(key == null){
+            return null;
+        }
+        Object o = redisTemplate.opsForValue().get(key);
+        if(ObjectUtil.isEmpty(o)){
+            return null;
+        }
+        return (T)o;
+    }
+    /**
+     * 普通缓存放入
+     *
+     * @param key   键
+     * @param value 值
+     * @return true成功 false失败
+     */
+    public boolean set(String key, Object value) {
+        try {
+            redisTemplate.opsForValue().set(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+
+    }
+
+    public boolean setIfAbsent(String key, Object value, long time, TimeUnit timeUnit) {
+        try {
+            return redisTemplate.opsForValue().setIfAbsent(key, value, time, timeUnit);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 普通缓存放入并设置时间
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒) time要大于0 如果time小于等于0 将设置无限期
+     * @return true成功 false 失败
+     */
+    public boolean set(String key, Object value, long time) {
+        try {
+            if (time > 0) {
+                redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
+            } else {
+                set(key, value);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 递增
+     *
+     * @param key       键
+     * @param 要增加几(大于0)
+     * @return
+     */
+    public long incr(String key, long delta) {
+        if (delta < 0) {
+            throw new RuntimeException("递增因子必须大于0");
+        }
+        return redisTemplate.opsForValue().increment(key, delta);
+    }
+
+    /**
+     * 递减
+     *
+     * @param key       键
+     * @param 要减少几(小于0)
+     * @return
+     */
+    public long decr(String key, long delta) {
+        if (delta < 0) {
+            throw new RuntimeException("递减因子必须大于0");
+        }
+        return redisTemplate.opsForValue().increment(key, -delta);
+    }
+
+    // ================================Map=================================
+
+    /**
+     * HashGet
+     *
+     * @param key  键 不能为null
+     * @param item 项 不能为null
+     * @return 值
+     */
+    public Object hget(String key, String item) {
+        return redisTemplate.opsForHash().get(key, item);
+    }
+
+    /**
+     * 获取hashKey对应的所有键值
+     *
+     * @param key 键
+     * @return 对应的多个键值
+     */
+    public Map<Object, Object> hmget(String key) {
+        return redisTemplate.opsForHash().entries(key);
+    }
+
+    /**
+     * HashSet
+     *
+     * @param key 键
+     * @param map 对应多个键值
+     * @return true 成功 false 失败
+     */
+    public boolean hmset(String key, Map<String, Object> map) {
+        try {
+            redisTemplate.opsForHash().putAll(key, map);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * HashSet 并设置时间
+     *
+     * @param key  键
+     * @param map  对应多个键值
+     * @param time 时间(秒)
+     * @return true成功 false失败
+     */
+    public boolean hmset(String key, Map<String, Object> map, long time) {
+        try {
+            redisTemplate.opsForHash().putAll(key, map);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 向一张hash表中放入数据,如果不存在将创建
+     *
+     * @param key   键
+     * @param item  项
+     * @param value 值
+     * @return true 成功 false失败
+     */
+    public boolean hset(String key, String item, Object value) {
+        try {
+            redisTemplate.opsForHash().put(key, item, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 向一张hash表中放入数据,如果不存在将创建
+     *
+     * @param key   键
+     * @param item  项
+     * @param value 值
+     * @param time  时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
+     * @return true 成功 false失败
+     */
+    public boolean hset(String key, String item, Object value, long time) {
+        try {
+            redisTemplate.opsForHash().put(key, item, value);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 删除hash表中的值
+     *
+     * @param key  键 不能为null
+     * @param item 项 可以使多个 不能为null
+     */
+    public void hdel(String key, Object... item) {
+        redisTemplate.opsForHash().delete(key, item);
+    }
+
+    /**
+     * 判断hash表中是否有该项的值
+     *
+     * @param key  键 不能为null
+     * @param item 项 不能为null
+     * @return true 存在 false不存在
+     */
+    public boolean hHasKey(String key, String item) {
+        return redisTemplate.opsForHash().hasKey(key, item);
+    }
+
+    /**
+     * hash递增 如果不存在,就会创建一个 并把新增后的值返回
+     *
+     * @param key  键
+     * @param item 项
+     * @param by   要增加几(大于0)
+     * @return
+     */
+    public double hincr(String key, String item, double by) {
+        return redisTemplate.opsForHash().increment(key, item, by);
+    }
+
+    public long hincr(String key, String item, long by) {
+        return redisTemplate.opsForHash().increment(key, item, by);
+    }
+
+    /**
+     * hash递减
+     *
+     * @param key  键
+     * @param item 项
+     * @param by   要减少记(小于0)
+     * @return
+     */
+    public double hdecr(String key, String item, double by) {
+        return redisTemplate.opsForHash().increment(key, item, -by);
+    }
+
+    // ============================set=============================
+
+    /**
+     * 根据key获取Set中的所有值
+     *
+     * @param key 键
+     * @return
+     */
+    public Set<Object> sGet(String key) {
+        try {
+            return redisTemplate.opsForSet().members(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 根据value从一个set中查询,是否存在
+     *
+     * @param key   键
+     * @param value 值
+     * @return true 存在 false不存在
+     */
+    public boolean sHasKey(String key, Object value) {
+        try {
+            return redisTemplate.opsForSet().isMember(key, value);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 将数据放入set缓存
+     *
+     * @param key    键
+     * @param values 值 可以是多个
+     * @return 成功个数
+     */
+    public long sSet(String key, Object... values) {
+        try {
+            return redisTemplate.opsForSet().add(key, values);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * 将set数据放入缓存
+     *
+     * @param key    键
+     * @param time   时间(秒)
+     * @param values 值 可以是多个
+     * @return 成功个数
+     */
+    public long sSetAndTime(String key, long time, Object... values) {
+        try {
+            Long count = redisTemplate.opsForSet().add(key, values);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return count;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * 获取set缓存的长度
+     *
+     * @param key 键
+     * @return
+     */
+    public long sGetSetSize(String key) {
+        try {
+            return redisTemplate.opsForSet().size(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * 移除值为value的
+     *
+     * @param key    键
+     * @param values 值 可以是多个
+     * @return 移除的个数
+     */
+    public long setRemove(String key, Object... values) {
+        try {
+            Long count = redisTemplate.opsForSet().remove(key, values);
+            return count;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * 删除key
+     *
+     * @param key 键
+     * @return ture or false
+     */
+    public Boolean del(String key) {
+        try {
+            Boolean delete = redisTemplate.delete(key);
+            return delete;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 根据key前缀批量删除
+     *
+     * @param keyPrefix 键前缀字符串
+     * @return 结果
+     */
+    public boolean delAll(String keyPrefix) {
+        try {
+            if (keyPrefix != null) {
+                Set<String> keys = redisTemplate.keys(Pattern.matches("\\*$", keyPrefix) ? keyPrefix : keyPrefix + "*");
+                redisTemplate.delete(keys);
+                return true;
+            }
+            return false;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+
+    }
+
+
+    // ===============================list=================================
+
+    /**
+     * 获取list缓存的内容
+     *
+     * @param key   键
+     * @param start 开始
+     * @param end   结束 0 到 -1代表所有值
+     * @return
+     */
+    public List<Object> lGet(String key, long start, long end) {
+        try {
+            return redisTemplate.opsForList().range(key, start, end);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 获取list缓存的长度
+     *
+     * @param key 键
+     * @return
+     */
+    public long lGetListSize(String key) {
+        try {
+            return redisTemplate.opsForList().size(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * 通过索引 获取list中的值
+     *
+     * @param key   键
+     * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
+     * @return
+     */
+    public Object lGetIndex(String key, long index) {
+        try {
+            return redisTemplate.opsForList().index(key, index);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 将list放入缓存
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒)
+     * @return
+     */
+    public boolean lSet(String key, Object value) {
+        try {
+            redisTemplate.opsForList().rightPush(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 将list放入缓存
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒)
+     * @return
+     */
+    public boolean lSet(String key, Object value, long time) {
+        try {
+            redisTemplate.opsForList().rightPush(key, value);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 将list放入缓存
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒)
+     * @return
+     */
+    public boolean lSet(String key, List<Object> value) {
+        try {
+            redisTemplate.opsForList().rightPushAll(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 将list放入缓存
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒)
+     * @return
+     */
+    public boolean lSet(String key, List<Object> value, long time) {
+        try {
+            redisTemplate.opsForList().rightPushAll(key, value);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 根据索引修改list中的某条数据
+     *
+     * @param key   键
+     * @param index 索引
+     * @param value 值
+     * @return
+     */
+    public boolean lUpdateIndex(String key, long index, Object value) {
+        try {
+            redisTemplate.opsForList().set(key, index, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 移除N个值为value
+     *
+     * @param key   键
+     * @param count 移除多少个
+     * @param value 值
+     * @return 移除的个数
+     */
+    public long lRemove(String key, long count, Object value) {
+        try {
+            Long remove = redisTemplate.opsForList().remove(key, count, value);
+            return remove;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    public Object lPop(String key) {
+        try {
+            Object o = redisTemplate.opsForList().leftPop(key);
+            return o;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public List<String> getAllByKey(String keyPrefix) {
+        try {
+            if (keyPrefix != null) {
+                Set<String> keys = redisTemplate.keys(Pattern.matches("\\*$", keyPrefix) ? keyPrefix : keyPrefix + "*");
+                if (CollUtil.isEmpty(keys)) {
+                    return null;
+                }
+                return new ArrayList<>(keys);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 4 - 13
src/main/java/cn/hanghui/outapi/platform/tenant/controller/AccountController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.common.utils.EnumUtils;
@@ -7,19 +8,7 @@ import cn.hanghui.outapi.platform.tenant.entity.dto.EnumCommonVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.account.AccountDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.account.AccountSearch;
 import cn.hanghui.outapi.platform.tenant.entity.dto.account.AccountVo;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFaceCollectConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFaceFaceConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFaceFuncConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFaceHardwareConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFacePushConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFaceResultConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFaceSystemConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFaceThirdConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.HhFaceUseConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.ModuleTypeEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.PushConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.SystemConfigEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.UseConfigEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.*;
 import cn.hanghui.outapi.platform.tenant.entity.enums.fkj.*;
 import cn.hanghui.outapi.platform.tenant.service.AccountService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -58,12 +47,14 @@ public class AccountController extends BaseController {
     @ApiOperation(value = "添加或编辑授权账号")
     @PostMapping("/add")
     @ApiOperationSupport(order = 1)
+    @Log(tag = LogTagEnum.AUTH_ACCOUNT,title = "添加/编辑账号授权",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> add(@RequestBody AccountDto dto) {
         return accountService.add(dto);
     }
 
     @ApiOperation(value = "删除授权账号")
     @PostMapping("/del/{accountId}")
+    @Log(tag = LogTagEnum.AUTH_ACCOUNT,title = "删除账号授权",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "accountId") @ApiParam(value = "accountId", required = true) Long accountId) {
         return accountService.del(accountId);
     }

+ 7 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/AlipayIotController.java

@@ -1,9 +1,12 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.tenant.entity.dto.IotPlatformAuthDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.IotPlatformAuthReqDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.IotUserInfoDto;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.AlipayIotService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -39,24 +42,28 @@ public class AlipayIotController {
 
     @ApiOperation(value = "添加/编辑授权")
     @PostMapping("/add")
+    @Log(tag = LogTagEnum.ALIPAY,title = "添加/编辑授权",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> addAuth(@RequestBody IotPlatformAuthDto dto) {
         return alipayIotService.addAuth(dto);
     }
 
     @ApiOperation(value = "删除授权")
     @GetMapping("/del/{id}")
+    @Log(tag = LogTagEnum.ALIPAY,title = "删除授权",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return alipayIotService.del(id);
     }
 
     @ApiOperation(value = "停用")
     @GetMapping("/cancel/{id}")
+    @Log(tag = LogTagEnum.ALIPAY,title = "停用",businessTypeEnum = BusinessTypeEnum.CLOSE)
     public RestResult<Boolean> cancel(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return alipayIotService.opStatus(id, Boolean.FALSE);
     }
 
     @ApiOperation(value = "启用")
     @GetMapping("/enable/{id}")
+    @Log(tag = LogTagEnum.ALIPAY,title = "启用",businessTypeEnum = BusinessTypeEnum.OPEN)
     public RestResult<Boolean> enable(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return alipayIotService.opStatus(id, Boolean.TRUE);
     }

+ 7 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/AppApkController.java

@@ -1,6 +1,7 @@
 
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
@@ -14,6 +15,8 @@ import cn.hanghui.outapi.platform.tenant.entity.dto.AppApkDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.AppApkPageDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.AppApkVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.DeviceTaskStatusVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.AppApkService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.Api;
@@ -69,12 +72,14 @@ public class AppApkController extends BaseController {
 
     @ApiOperation(value = "apk添加/编辑", notes = "apk添加/编辑")
     @PostMapping(value = "/apk/add")
+    @Log(tag = LogTagEnum.APK,title = "添加/编辑APK",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult add(@RequestBody AppApkDto dto) {
         return appApkService.add(dto);
     }
 
     @ApiOperation(value = "apk删除", notes = "apk删除")
     @PostMapping(value = "/apk/deleted/{id}")
+    @Log(tag = LogTagEnum.APK,title = "删除APK",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult del(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         //删除
         return appApkService.del(id);
@@ -94,12 +99,14 @@ public class AppApkController extends BaseController {
 
     @ApiOperation(value = "添加任务", notes = "添加任务")
     @PostMapping(value = "/task/add")
+    @Log(tag = LogTagEnum.APK,title = "添加任务",businessTypeEnum = BusinessTypeEnum.INSERT)
     public RestResult addTask(@RequestBody AppApkDeviceTaskDto dto) {
         return appApkService.addTask(dto);
     }
 
     @ApiOperation(value = "取消任务", notes = "取消任务")
     @PostMapping(value = "/task/cancel/{id}")
+    @Log(tag = LogTagEnum.APK,title = "取消任务",businessTypeEnum = BusinessTypeEnum.OTHER)
     public RestResult cancelTask(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return appApkService.cancelTask(id);
     }

+ 4 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/AuthAmpeController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.po.Account;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
@@ -8,6 +9,8 @@ import cn.hanghui.outapi.platform.tenant.entity.dto.IotDeviceConfigVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.TenantVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.ampe.AmpeDeviceDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.ampe.AmpeDeviceSearch;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.AmpeService;
 import cn.hanghui.outapi.platform.tenant.service.IotDeviceConfigService;
 import cn.hanghui.outapi.platform.tenant.service.TenantService;
@@ -71,6 +74,7 @@ public class AuthAmpeController extends BaseController {
     @ApiOperation(value = "修改ampe设备配置信息")
     @PostMapping("/device/update")
     @ApiOperationSupport(order = 4)
+    @Log(tag = LogTagEnum.HHAROME,title = "修改ampe设备配置信息",businessTypeEnum = BusinessTypeEnum.UPDATE)
     public RestResult<Boolean> update(@RequestBody AmpeDeviceDto dto) {
         Account account = getAccount();
         return iotDeviceConfigService.update(dto, account);

+ 4 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/AuthDeviceController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.po.Account;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
@@ -13,6 +14,8 @@ import cn.hanghui.outapi.platform.tenant.entity.dto.ampe.AmpeDeviceSearch;
 import cn.hanghui.outapi.platform.tenant.entity.dto.ampe.HhFaceDeviceDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.ampe.HhFaceDeviceSearch;
 import cn.hanghui.outapi.platform.tenant.entity.enums.AuthModuleTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.AmpeService;
 import cn.hanghui.outapi.platform.tenant.service.IotDeviceConfigService;
 import cn.hanghui.outapi.platform.tenant.service.SceneService;
@@ -74,6 +77,7 @@ public class AuthDeviceController extends BaseController {
     @ApiOperation(value = "修改HHFace设备配置信息")
     @PostMapping("/device/update")
     @ApiOperationSupport(order = 4)
+    @Log(tag = LogTagEnum.HHFACE,title = "修改HHFace设备配置信息",businessTypeEnum = BusinessTypeEnum.UPDATE)
     public RestResult<Boolean> update(@RequestBody HhFaceDeviceDto dto) {
         Account account = getAccount();
         return tenantService.update(dto, account);

+ 60 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/AuthFkjController.java

@@ -0,0 +1,60 @@
+package cn.hanghui.outapi.platform.tenant.controller;
+
+import cn.hanghui.outapi.platform.common.config.log.Log;
+import cn.hanghui.outapi.platform.common.controller.BaseController;
+import cn.hanghui.outapi.platform.common.entity.po.Account;
+import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
+import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceVo;
+import cn.hanghui.outapi.platform.tenant.entity.dto.TenantVo;
+import cn.hanghui.outapi.platform.tenant.entity.dto.UserLibDto;
+import cn.hanghui.outapi.platform.tenant.entity.dto.ampe.HhFaceDeviceDto;
+import cn.hanghui.outapi.platform.tenant.entity.dto.auth.fkj.FkjAuthDeviceDto;
+import cn.hanghui.outapi.platform.tenant.entity.dto.auth.fkj.FkjAuthDeviceSearch;
+import cn.hanghui.outapi.platform.tenant.entity.enums.AuthModuleTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
+import cn.hanghui.outapi.platform.tenant.service.FkjDeviceService;
+import cn.hanghui.outapi.platform.tenant.service.SceneService;
+import cn.hanghui.outapi.platform.tenant.service.TenantService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@Slf4j
+@Api(tags = "授权账号的访客机设备管理")
+@RestController
+@RequestMapping(value = "/api/v1/auth/fkj")
+@RequiredArgsConstructor(onConstructor_ = @__(@Autowired))
+public class AuthFkjController extends BaseController {
+
+
+    private final FkjDeviceService fkjDeviceService;
+
+
+    @ApiOperation(value = "获取FKJ设备列表(分页)")
+    @PostMapping("/device/page")
+    @ApiOperationSupport(order = 1)
+    public RestResult<IPage<FkjDeviceVo>> authPage(@RequestBody FkjAuthDeviceSearch dto) {
+        Account account = getAccount();
+        return fkjDeviceService.authPage(dto, account);
+    }
+
+    @ApiOperation(value = "修改访客机设备配置信息")
+    @PostMapping("/device/update")
+    @ApiOperationSupport(order = 2)
+    @Log(tag = LogTagEnum.FKJ,title = "修改访客机设备配置信息",businessTypeEnum = BusinessTypeEnum.UPDATE)
+    public RestResult<Boolean> update(@RequestBody FkjAuthDeviceDto dto) {
+        Account account = getAccount();
+        return fkjDeviceService.update(dto, account);
+    }
+}

+ 9 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/ConfigMaintenanceController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.tenant.entity.config.maintenance.application.device.ApplicationTypeDto;
@@ -11,6 +12,8 @@ import cn.hanghui.outapi.platform.tenant.entity.config.maintenance.device.Device
 import cn.hanghui.outapi.platform.tenant.entity.config.maintenance.purchaser.PurchaserDto;
 import cn.hanghui.outapi.platform.tenant.entity.config.maintenance.purchaser.PurchaserSearch;
 import cn.hanghui.outapi.platform.tenant.entity.config.maintenance.purchaser.PurchaserVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.ApplicationTypeService;
 import cn.hanghui.outapi.platform.tenant.service.DeviceModelService;
 import cn.hanghui.outapi.platform.tenant.service.PurchaserService;
@@ -50,6 +53,7 @@ public class ConfigMaintenanceController {
     @ApiOperation("购买方-新增/编辑")
     @PostMapping("purchaser/edit")
     @ApiOperationSupport(order = 10)
+    @Log(tag = LogTagEnum.PURCHASER,title = "添加/编辑购买方公司",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> edit(@RequestBody @Valid PurchaserDto dto) {
         return RestResponse.ok(purchaserService.edit(dto));
     }
@@ -68,6 +72,7 @@ public class ConfigMaintenanceController {
     @ApiOperation("购买方-删除")
     @DeleteMapping("purchaser/{purchaserId}")
     @ApiOperationSupport(order = 40)
+    @Log(tag = LogTagEnum.PURCHASER,title = "删除购买方公司",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> purchaserDelete(@PathVariable(value = "purchaserId") Long purchaserId) {
         return RestResponse.ok(purchaserService.purchaserDelete(purchaserId));
     }
@@ -76,6 +81,7 @@ public class ConfigMaintenanceController {
     @ApiOperation("设备型号-新增/编辑")
     @PostMapping("deviceModel/edit")
     @ApiOperationSupport(order = 110)
+    @Log(tag = LogTagEnum.DEVICEMODEL,title = "添加/编辑设备型号",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> edit(@RequestBody @Valid DeviceModelDto dto) {
         return RestResponse.ok(deviceModelService.edit(dto));
     }
@@ -94,6 +100,7 @@ public class ConfigMaintenanceController {
     @ApiOperation("设备型号-删除")
     @DeleteMapping("deviceModel/{deviceModelId}")
     @ApiOperationSupport(order = 140)
+    @Log(tag = LogTagEnum.DEVICEMODEL,title = "删除设备型号",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> deviceModelDelete(@PathVariable(value = "deviceModelId") Long deviceModelId) {
         return RestResponse.ok(deviceModelService.deviceModelDelete(deviceModelId));
     }
@@ -102,6 +109,7 @@ public class ConfigMaintenanceController {
     @ApiOperation("应用类型-新增/编辑")
     @PostMapping("applicationType/edit")
     @ApiOperationSupport(order = 110)
+    @Log(tag = LogTagEnum.APPLICATIONTYPE,title = "添加/编辑应用类型",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> edit(@RequestBody @Valid ApplicationTypeDto dto) {
         return RestResponse.ok(applicationTypeService.edit(dto));
     }
@@ -120,6 +128,7 @@ public class ConfigMaintenanceController {
     @ApiOperation("应用类型-删除")
     @DeleteMapping("applicationType/{applicationTypeId}")
     @ApiOperationSupport(order = 140)
+    @Log(tag = LogTagEnum.APPLICATIONTYPE,title = "删除应用类型",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> applicationTypeDelete(@PathVariable(value = "applicationTypeId") Long applicationTypeId) {
         return RestResponse.ok(applicationTypeService.applicationTypeDelete(applicationTypeId));
     }

+ 9 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/FkjDeviceController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
@@ -14,6 +15,8 @@ import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDe
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceTemplateSearch;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceUpdateMiniDto;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.FkjDeviceService;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
@@ -55,6 +58,7 @@ public class FkjDeviceController extends BaseController {
     @ApiOperation("模版-新增/编辑")
     @PostMapping("template/edit")
     @ApiOperationSupport(order = 100)
+    @Log(tag = LogTagEnum.FKJ,title = "添加/编辑模版",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> templateEdit(@RequestBody @Valid FkjDeviceTemplateDto dto) {
         return RestResponse.ok(fkjDeviceService.templateEdit(dto));
     }
@@ -76,6 +80,7 @@ public class FkjDeviceController extends BaseController {
     @ApiOperation("模版-删除")
     @DeleteMapping("template/{id}")
     @ApiOperationSupport(order = 130)
+    @Log(tag = LogTagEnum.FKJ,title = "删除模版",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> templateDelete(@PathVariable(value = "id") Long id) {
         return RestResponse.ok(fkjDeviceService.templateDelete(id));
     }
@@ -90,6 +95,7 @@ public class FkjDeviceController extends BaseController {
     @ApiOperation(value = "设备配置-添加/编辑")
     @PostMapping("/add")
     @ApiOperationSupport(order = 150)
+    @Log(tag = LogTagEnum.FKJ,title = "添加/编辑设备",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> add(@RequestBody FkjDeviceDto dto) {
         return fkjDeviceService.add(dto);
     }
@@ -104,6 +110,7 @@ public class FkjDeviceController extends BaseController {
     @ApiOperation(value = "设备删除")
     @PostMapping("/del/{id}")
     @ApiOperationSupport(order = 170)
+    @Log(tag = LogTagEnum.FKJ,title = "删除设备",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return fkjDeviceService.del(id);
     }
@@ -111,6 +118,7 @@ public class FkjDeviceController extends BaseController {
     @ApiOperation(value = "设备授权")
     @GetMapping("/enable")
     @ApiOperationSupport(order = 180)
+    @Log(tag = LogTagEnum.FKJ,title = "设备授权",businessTypeEnum = BusinessTypeEnum.AUTH)
     public RestResult<Boolean> enable(@RequestParam(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return fkjDeviceService.enable(id);
     }
@@ -118,6 +126,7 @@ public class FkjDeviceController extends BaseController {
     @ApiOperation(value = "设备取消授权")
     @GetMapping("/disable")
     @ApiOperationSupport(order = 190)
+    @Log(tag = LogTagEnum.FKJ,title = "设备取消授权",businessTypeEnum = BusinessTypeEnum.CANCEL_AUTH)
     public RestResult<Boolean> disable(@RequestParam(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return fkjDeviceService.disable(id);
     }

+ 9 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/HHCultureDeviceController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
@@ -16,6 +17,8 @@ import cn.hanghui.outapi.platform.tenant.entity.dto.hhculture.HhCultureDeviceTem
 import cn.hanghui.outapi.platform.tenant.entity.dto.hhculture.HhCultureDeviceTemplateVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.hhculture.HhCultureDeviceUpdateMiniDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.hhculture.HhCultureDeviceVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.entity.enums.ManualInParamsEnum;
 import cn.hanghui.outapi.platform.tenant.service.HHCultureDeviceService;
 import cn.hutool.core.util.StrUtil;
@@ -58,6 +61,7 @@ public class HHCultureDeviceController extends BaseController {
     @ApiOperation("模版-新增/编辑")
     @PostMapping("template/edit")
     @ApiOperationSupport(order = 100)
+    @Log(tag = LogTagEnum.HHCULTURE,title = "添加/编辑模版",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> templateEdit(@RequestBody @Valid HhCultureDeviceTemplateDto dto) {
         return RestResponse.ok(hhCultureDeviceService.templateEdit(dto));
     }
@@ -79,6 +83,7 @@ public class HHCultureDeviceController extends BaseController {
     @ApiOperation("模版-删除")
     @GetMapping("template/{deviceTemplateId}")
     @ApiOperationSupport(order = 130)
+    @Log(tag = LogTagEnum.HHCULTURE,title = "删除模版",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> templateDelete(@PathVariable(value = "deviceTemplateId") Long deviceTemplateId) {
         return RestResponse.ok(hhCultureDeviceService.templateDelete(deviceTemplateId));
     }
@@ -93,6 +98,7 @@ public class HHCultureDeviceController extends BaseController {
     @ApiOperation(value = "设备配置-添加/编辑")
     @PostMapping("/add")
     @ApiOperationSupport(order = 150)
+    @Log(tag = LogTagEnum.HHCULTURE,title = "添加/编辑设备",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> add(@RequestBody HhCultureDeviceDto dto) {
         return hhCultureDeviceService.add(dto);
     }
@@ -113,6 +119,7 @@ public class HHCultureDeviceController extends BaseController {
     @ApiOperation(value = "设备删除")
     @PostMapping("/del/{deviceId}")
     @ApiOperationSupport(order = 170)
+    @Log(tag = LogTagEnum.HHCULTURE,title = "删除设备",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhCultureDeviceService.del(deviceId);
     }
@@ -120,6 +127,7 @@ public class HHCultureDeviceController extends BaseController {
     @ApiOperation(value = "设备授权")
     @GetMapping("/enable")
     @ApiOperationSupport(order = 180)
+    @Log(tag = LogTagEnum.HHCULTURE,title = "设备授权",businessTypeEnum = BusinessTypeEnum.AUTH)
     public RestResult<Boolean> enable(@RequestParam(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhCultureDeviceService.opeDeviceAuth(deviceId, Boolean.TRUE);
     }
@@ -127,6 +135,7 @@ public class HHCultureDeviceController extends BaseController {
     @ApiOperation(value = "设备取消授权")
     @GetMapping("/disable")
     @ApiOperationSupport(order = 190)
+    @Log(tag = LogTagEnum.HHCULTURE,title = "设备取消授权",businessTypeEnum = BusinessTypeEnum.CANCEL_AUTH)
     public RestResult<Boolean> disable(@RequestParam(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhCultureDeviceService.opeDeviceAuth(deviceId, Boolean.FALSE);
     }

+ 8 - 1
src/main/java/cn/hanghui/outapi/platform/tenant/controller/HhLocalDeviceController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
@@ -55,6 +56,7 @@ public class HhLocalDeviceController extends BaseController {
     @ApiOperation("模版-新增/编辑")
     @PostMapping("template/edit")
     @ApiOperationSupport(order = 100)
+    @Log(tag = LogTagEnum.HHLOCAL,title = "添加/编辑模版",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> templateEdit(@RequestBody @Valid HhLocalDeviceTemplateDto dto) {
         return RestResponse.ok(hhLocalDeviceService.templateEdit(dto));
     }
@@ -76,6 +78,7 @@ public class HhLocalDeviceController extends BaseController {
     @ApiOperation("模版-删除")
     @GetMapping("template/{deviceTemplateId}")
     @ApiOperationSupport(order = 130)
+    @Log(tag = LogTagEnum.HHLOCAL,title = "删除模版",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> templateDelete(@PathVariable(value = "deviceTemplateId") Long deviceTemplateId) {
         return RestResponse.ok(hhLocalDeviceService.templateDelete(deviceTemplateId));
     }
@@ -90,6 +93,7 @@ public class HhLocalDeviceController extends BaseController {
     @ApiOperation(value = "设备配置-添加/编辑")
     @PostMapping("/add")
     @ApiOperationSupport(order = 150)
+    @Log(tag = LogTagEnum.HHLOCAL,title = "添加/编辑设备",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> add(@RequestBody HhLocalDeviceDto dto) {
         return hhLocalDeviceService.add(dto);
     }
@@ -110,6 +114,7 @@ public class HhLocalDeviceController extends BaseController {
     @ApiOperation(value = "设备删除")
     @PostMapping("/del/{deviceId}")
     @ApiOperationSupport(order = 170)
+    @Log(tag = LogTagEnum.HHLOCAL,title = "删除设备",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhLocalDeviceService.del(deviceId);
     }
@@ -117,6 +122,7 @@ public class HhLocalDeviceController extends BaseController {
     @ApiOperation(value = "设备授权")
     @GetMapping("/enable")
     @ApiOperationSupport(order = 180)
+    @Log(tag = LogTagEnum.HHLOCAL,title = "设备授权",businessTypeEnum = BusinessTypeEnum.AUTH)
     public RestResult<Boolean> enable(@RequestParam(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhLocalDeviceService.opeDeviceAuth(deviceId, Boolean.TRUE);
     }
@@ -124,6 +130,7 @@ public class HhLocalDeviceController extends BaseController {
     @ApiOperation(value = "设备取消授权")
     @GetMapping("/disable")
     @ApiOperationSupport(order = 190)
+    @Log(tag = LogTagEnum.HHLOCAL,title = "设备取消授权",businessTypeEnum = BusinessTypeEnum.CANCEL_AUTH)
     public RestResult<Boolean> disable(@RequestParam(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhLocalDeviceService.opeDeviceAuth(deviceId, Boolean.FALSE);
     }
@@ -144,7 +151,7 @@ public class HhLocalDeviceController extends BaseController {
     @ApiOperation(value = "获取手动输入内容项")
     @GetMapping("/getManualInParamsEnum")
     public RestResult<List<Map<String, String>>> getManualInParamsEnum() {
-        return RestResult.ok(EnumUtils.enumToListMap(ManualInParamsEnum.class));
+        return RestResult.ok(EnumUtils.enumToListMap( ManualInParamsEnum.class));
     }
 
     @ApiOperation(value = "获取摄像头类型")

+ 9 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/HhOmcDeviceController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
@@ -13,6 +14,8 @@ import cn.hanghui.outapi.platform.tenant.entity.dto.hhomc.HhOmcDeviceTemplateLes
 import cn.hanghui.outapi.platform.tenant.entity.dto.hhomc.HhOmcDeviceTemplateSearch;
 import cn.hanghui.outapi.platform.tenant.entity.dto.hhomc.HhOmcDeviceTemplateVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.hhomc.HhOmcDeviceVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.HhOmcDeviceService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -52,6 +55,7 @@ public class HhOmcDeviceController extends BaseController {
     @ApiOperation("模版-新增/编辑")
     @PostMapping("template/edit")
     @ApiOperationSupport(order = 100)
+    @Log(tag = LogTagEnum.HHOMC,title = "添加/编辑模版",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> templateEdit(@RequestBody @Valid HhOmcDeviceTemplateDto dto) {
         return RestResponse.ok(hhOmcDeviceService.templateEdit(dto));
     }
@@ -73,6 +77,7 @@ public class HhOmcDeviceController extends BaseController {
     @ApiOperation("模版-删除")
     @GetMapping("template/{deviceTemplateId}")
     @ApiOperationSupport(order = 130)
+    @Log(tag = LogTagEnum.HHOMC,title = "删除模版",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> templateDelete(@PathVariable(value = "deviceTemplateId") Long deviceTemplateId) {
         return RestResponse.ok(hhOmcDeviceService.templateDelete(deviceTemplateId));
     }
@@ -87,6 +92,7 @@ public class HhOmcDeviceController extends BaseController {
     @ApiOperation(value = "设备配置-添加/编辑")
     @PostMapping("/add")
     @ApiOperationSupport(order = 150)
+    @Log(tag = LogTagEnum.HHOMC,title = "添加/编辑设备",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> add(@RequestBody HhOmcDeviceDto dto) {
         return hhOmcDeviceService.add(dto);
     }
@@ -107,6 +113,7 @@ public class HhOmcDeviceController extends BaseController {
     @ApiOperation(value = "设备删除")
     @PostMapping("/del/{deviceId}")
     @ApiOperationSupport(order = 170)
+    @Log(tag = LogTagEnum.HHOMC,title = "删除设备",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhOmcDeviceService.del(deviceId);
     }
@@ -114,6 +121,7 @@ public class HhOmcDeviceController extends BaseController {
     @ApiOperation(value = "设备授权")
     @GetMapping("/enable")
     @ApiOperationSupport(order = 180)
+    @Log(tag = LogTagEnum.HHOMC,title = "设备授权",businessTypeEnum = BusinessTypeEnum.AUTH)
     public RestResult<Boolean> enable(@RequestParam(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhOmcDeviceService.opeDeviceAuth(deviceId, Boolean.TRUE);
     }
@@ -121,6 +129,7 @@ public class HhOmcDeviceController extends BaseController {
     @ApiOperation(value = "设备取消授权")
     @GetMapping("/disable")
     @ApiOperationSupport(order = 190)
+    @Log(tag = LogTagEnum.HHOMC,title = "设备取消授权",businessTypeEnum = BusinessTypeEnum.CANCEL_AUTH)
     public RestResult<Boolean> disable(@RequestParam(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return hhOmcDeviceService.opeDeviceAuth(deviceId, Boolean.FALSE);
     }

+ 10 - 3
src/main/java/cn/hanghui/outapi/platform/tenant/controller/IotDeviceConfigController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
@@ -14,9 +15,7 @@ import cn.hanghui.outapi.platform.tenant.entity.config.iot.template.IotDeviceCon
 import cn.hanghui.outapi.platform.tenant.entity.config.iot.template.IotDeviceConfigTemplateSearch;
 import cn.hanghui.outapi.platform.tenant.entity.config.iot.template.IotDeviceConfigTemplateVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.*;
-import cn.hanghui.outapi.platform.tenant.entity.enums.InterfaceTypeEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.MicrophoneTypeEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.PrinterConfigEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.*;
 import cn.hanghui.outapi.platform.tenant.service.AmpeService;
 import cn.hanghui.outapi.platform.tenant.service.IotDeviceConfigService;
 import cn.hanghui.outapi.platform.tenant.service.IotDeviceConfigTemplateService;
@@ -57,6 +56,7 @@ public class IotDeviceConfigController extends BaseController {
     @ApiOperation("iot模版-新增/编辑")
     @PostMapping("template/edit")
     @ApiOperationSupport(order = 100)
+    @Log(tag = LogTagEnum.HHAROME,title = "添加/编辑模版",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> edit(@RequestBody @Valid IotDeviceConfigTemplateDto dto) {
         return RestResponse.ok(iotDeviceConfigTemplateService.edit(dto));
     }
@@ -75,6 +75,7 @@ public class IotDeviceConfigController extends BaseController {
     @ApiOperation("iot模版-删除")
     @DeleteMapping("template/{iotDeviceConfigTemplateId}")
     @ApiOperationSupport(order = 130)
+    @Log(tag = LogTagEnum.HHAROME,title = "删除模版",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> templateDelete(@PathVariable(value = "iotDeviceConfigTemplateId") Long iotDeviceConfigTemplateId) {
         return RestResponse.ok(iotDeviceConfigTemplateService.iotDeviceConfigTemplateDelete(iotDeviceConfigTemplateId));
     }
@@ -90,6 +91,7 @@ public class IotDeviceConfigController extends BaseController {
     @ApiOperation("ampe-新增/编辑")
     @PostMapping("ampe/edit")
     @ApiOperationSupport(order = 200)
+    @Log(tag = LogTagEnum.HHAROME,title = "添加/编辑ampe",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> edit(@RequestBody @Valid AmpeDto dto) {
         return RestResponse.ok(ampeService.edit(dto));
     }
@@ -108,6 +110,7 @@ public class IotDeviceConfigController extends BaseController {
     @ApiOperation("ampe-删除")
     @DeleteMapping("ampe/{ampeId}")
     @ApiOperationSupport(order = 230)
+    @Log(tag = LogTagEnum.HHAROME,title = "删除ampe",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> ampeDelete(@PathVariable(value = "ampeId") Long ampeId) {
         return RestResponse.ok(ampeService.ampeDelete(ampeId));
     }
@@ -128,6 +131,7 @@ public class IotDeviceConfigController extends BaseController {
     @ApiOperation(value = "容器配置-添加/编辑")
     @PostMapping("/add")
     @ApiOperationSupport(order = 300)
+    @Log(tag = LogTagEnum.HHAROME,title = "添加/编辑设备",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> add(@RequestBody IotDeviceConfigDto dto) {
         return iotDeviceConfigService.add(dto);
     }
@@ -140,18 +144,21 @@ public class IotDeviceConfigController extends BaseController {
     @ApiOperation(value = "容器配置删除")
     @PostMapping("/del/{iotDeviceConfigId}")
     @ApiOperationSupport(order = 320)
+    @Log(tag = LogTagEnum.HHAROME,title = "删除设备",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "iotDeviceConfigId") @ApiParam(value = "iotDeviceConfigId", required = true) Long iotDeviceConfigId) {
         return iotDeviceConfigService.del(iotDeviceConfigId);
     }
     @ApiOperation(value = "设备授权")
     @GetMapping("/empower")
     @ApiOperationSupport(order = 330)
+    @Log(tag = LogTagEnum.HHAROME,title = "设备授权",businessTypeEnum = BusinessTypeEnum.AUTH)
     public RestResult<Boolean> empower(@RequestParam(value = "iotDeviceConfigId") @ApiParam(value = "iotDeviceConfigId", required = true) Long iotDeviceConfigId) {
         return iotDeviceConfigService.empower(iotDeviceConfigId);
     }
     @ApiOperation(value = "设备取消授权")
     @GetMapping("/cancelEmpower")
     @ApiOperationSupport(order = 340)
+    @Log(tag = LogTagEnum.HHAROME,title = "设备取消授权",businessTypeEnum = BusinessTypeEnum.CANCEL_AUTH)
     public RestResult<Boolean> cancelEmpower(@RequestParam(value = "iotDeviceConfigId") @ApiParam(value = "iotDeviceConfigId", required = true) Long iotDeviceConfigId) {
         return iotDeviceConfigService.cancelEmpower(iotDeviceConfigId);
     }

+ 7 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/OpenInterfaceAuthController.java

@@ -1,12 +1,15 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.common.utils.EnumUtils;
 import cn.hanghui.outapi.platform.common.utils.Preconditions;
 import cn.hanghui.outapi.platform.tenant.entity.dto.auth.OpenInterfaceAuthDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.auth.OpenInterfaceAuthPageDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.auth.OpenInterfaceAuthVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
 import cn.hanghui.outapi.platform.tenant.entity.enums.InterfaceTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.OpenInterfaceAuthService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.Api;
@@ -42,6 +45,7 @@ public class OpenInterfaceAuthController {
 
     @ApiOperation(value = "添加/编辑")
     @PostMapping("/add")
+    @Log(tag = LogTagEnum.THIRD_API,title = "添加/编辑服务权限",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> add(@RequestBody OpenInterfaceAuthDto dto) {
         if (Preconditions.isBlank(dto.getPurchaserId()) || Preconditions.isBlank(dto.getInterfaceType()) ) {
             return RestResult.error("参数有误,请重试!");
@@ -51,18 +55,21 @@ public class OpenInterfaceAuthController {
 
     @ApiOperation(value = "删除")
     @GetMapping("/del/{id}")
+    @Log(tag = LogTagEnum.THIRD_API,title = "删除服务权限",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return openInterfaceAuthService.del(id);
     }
 
     @ApiOperation(value = "开启")
     @GetMapping("/enable/{id}")
+    @Log(tag = LogTagEnum.THIRD_API,title = "开启服务权限",businessTypeEnum = BusinessTypeEnum.OPEN)
     public RestResult<Boolean> enable(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return openInterfaceAuthService.updateStatus(id, Boolean.TRUE);
     }
 
     @ApiOperation(value = "停用")
     @GetMapping("/disable/{id}")
+    @Log(tag = LogTagEnum.THIRD_API,title = "停用服务权限",businessTypeEnum = BusinessTypeEnum.CLOSE)
     public RestResult<Boolean> disable(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return openInterfaceAuthService.updateStatus(id, Boolean.FALSE);
     }

+ 8 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/OpenInterfaceAuthDeviceController.java

@@ -1,10 +1,13 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.tenant.entity.dto.auth.OpenInterfaceAuthDeviceDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.auth.OpenInterfaceAuthDeviceImportDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.auth.OpenInterfaceAuthDevicePageDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.auth.OpenInterfaceAuthDeviceVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.OpenInterfaceAuthDeviceService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.Api;
@@ -36,12 +39,14 @@ public class OpenInterfaceAuthDeviceController {
 
     @ApiOperation(value = "添加/编辑")
     @PostMapping("/add")
+    @Log(tag = LogTagEnum.THIRD_API,title = "添加/编辑设备",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> add(@RequestBody OpenInterfaceAuthDeviceDto dto) {
         return openInterfaceAuthDeviceService.add(dto);
     }
 
     @ApiOperation(value = "批量添加")
     @PostMapping("/batch/add")
+    @Log(tag = LogTagEnum.THIRD_API,title = "批量添加设备",businessTypeEnum = BusinessTypeEnum.INSERT)
     public RestResult<Boolean> batchAdd(@RequestBody OpenInterfaceAuthDeviceImportDto dto) {
         return openInterfaceAuthDeviceService.batchAdd(dto);
     }
@@ -49,6 +54,7 @@ public class OpenInterfaceAuthDeviceController {
 
     @ApiOperation(value = "删除")
     @GetMapping("/del/{id}")
+    @Log(tag = LogTagEnum.THIRD_API,title = "删除设备",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
 
         return openInterfaceAuthDeviceService.del(id);
@@ -56,12 +62,14 @@ public class OpenInterfaceAuthDeviceController {
 
     @ApiOperation(value = "授权")
     @GetMapping("/enable/{id}")
+    @Log(tag = LogTagEnum.THIRD_API,title = "授权设备",businessTypeEnum = BusinessTypeEnum.AUTH)
     public RestResult<Boolean> enable(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return openInterfaceAuthDeviceService.updateStatus(id, Boolean.TRUE);
     }
 
     @ApiOperation(value = "取消授权")
     @GetMapping("/disable/{id}")
+    @Log(tag = LogTagEnum.THIRD_API,title = "取消授权设备",businessTypeEnum = BusinessTypeEnum.CANCEL_AUTH)
     public RestResult<Boolean> disable(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return openInterfaceAuthDeviceService.updateStatus(id, Boolean.FALSE);
     }

+ 11 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/ProvisionalProofController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
@@ -17,6 +18,8 @@ import cn.hanghui.outapi.platform.tenant.entity.dto.proof.ProvisionalIdentityPro
 import cn.hanghui.outapi.platform.tenant.entity.dto.proof.ProvisionalIdentityProofTemplateLessVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.proof.ProvisionalIdentityProofTemplateSearch;
 import cn.hanghui.outapi.platform.tenant.entity.dto.proof.ProvisionalIdentityProofTemplateVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.ProvisionalProofService;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
@@ -61,6 +64,7 @@ public class ProvisionalProofController {
     @ApiOperation("须知-新增/编辑")
     @PostMapping("/notice/add")
     @ApiOperationSupport(order = 100)
+    @Log(tag = LogTagEnum.PROVISIONAL,title = "新增/编辑小程序授权配置",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> noticeEdit(@RequestBody @Valid ProvisionalIdentityProofNoticeDto dto) {
         return RestResponse.ok(provisionalProofService.noticeEdit(dto));
     }
@@ -82,6 +86,7 @@ public class ProvisionalProofController {
     @ApiOperation("须知-删除")
     @DeleteMapping("/notice/{noticeId}")
     @ApiOperationSupport(order = 103)
+    @Log(tag = LogTagEnum.PROVISIONAL,title = "删除小程序授权配置",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> noticeDelete(@PathVariable(value = "noticeId") Long noticeId) {
         return RestResponse.ok(provisionalProofService.noticeDelete(noticeId));
     }
@@ -97,6 +102,7 @@ public class ProvisionalProofController {
     @ApiOperation("模版-新增编辑")
     @PostMapping("/template/add")
     @ApiOperationSupport(order = 200)
+    @Log(tag = LogTagEnum.PROVISIONAL,title = "新增/编辑模版",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> templateEdit(@RequestBody @Valid ProvisionalIdentityProofTemplateDto dto) {
         return RestResponse.ok(provisionalProofService.templateEdit(dto));
     }
@@ -118,6 +124,7 @@ public class ProvisionalProofController {
     @ApiOperation("模版-删除")
     @DeleteMapping("/template/{templateId}")
     @ApiOperationSupport(order = 203)
+    @Log(tag = LogTagEnum.PROVISIONAL,title = "删除模版",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> templateDelete(@PathVariable(value = "templateId") Long templateId) {
         return RestResponse.ok(provisionalProofService.templateDelete(templateId));
     }
@@ -133,6 +140,7 @@ public class ProvisionalProofController {
     @ApiOperation(value = "临证设备配置-添加/编辑")
     @PostMapping("/device/add")
     @ApiOperationSupport(order = 300)
+    @Log(tag = LogTagEnum.PROVISIONAL,title = "新增/编辑设备",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> deviceAdd(@RequestBody ProvisionalIdentityProofDeviceDto dto) {
         return provisionalProofService.deviceAdd(dto);
     }
@@ -147,6 +155,7 @@ public class ProvisionalProofController {
     @ApiOperation(value = "临证设备删除")
     @DeleteMapping("/device/del/{deviceId}")
     @ApiOperationSupport(order = 302)
+    @Log(tag = LogTagEnum.PROVISIONAL,title = "删除设备",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> deviceDel(@PathVariable(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return provisionalProofService.deviceDel(deviceId);
     }
@@ -154,6 +163,7 @@ public class ProvisionalProofController {
     @ApiOperation(value = "临证设备授权")
     @GetMapping("/device/enable")
     @ApiOperationSupport(order = 303)
+    @Log(tag = LogTagEnum.PROVISIONAL,title = "临证设备授权",businessTypeEnum = BusinessTypeEnum.AUTH)
     public RestResult<Boolean> deviceEnable(@RequestParam(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return provisionalProofService.deviceEnable(deviceId);
     }
@@ -161,6 +171,7 @@ public class ProvisionalProofController {
     @ApiOperation(value = "临证设备取消授权")
     @GetMapping("/device/disable")
     @ApiOperationSupport(order = 304)
+    @Log(tag = LogTagEnum.PROVISIONAL,title = "临证设备授权",businessTypeEnum = BusinessTypeEnum.CANCEL_AUTH)
     public RestResult<Boolean> deviceDisable(@RequestParam(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return provisionalProofService.deviceDisable(deviceId);
     }

+ 7 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/SceneController.java

@@ -1,8 +1,11 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.tenant.entity.dto.SceneDto;
 import cn.hanghui.outapi.platform.tenant.entity.dto.UserLibDto;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.SceneService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.Api;
@@ -30,12 +33,14 @@ public class SceneController {
 
     @ApiOperation(value = "添加或编辑场景")
     @PostMapping("/add")
+    @Log(tag = LogTagEnum.SCENE,title = "添加/编辑场景",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> addScene(@RequestBody SceneDto dto) {
         return sceneService.addScene(dto);
     }
 
     @ApiOperation(value = "删除场景")
     @GetMapping("/del/{id}")
+    @Log(tag = LogTagEnum.SCENE,title = "删除场景",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> delScene(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return sceneService.delScene(id);
     }
@@ -49,12 +54,14 @@ public class SceneController {
 
     @ApiOperation(value = "添加或编辑用户库")
     @PostMapping("/userlib/add")
+    @Log(tag = LogTagEnum.USERLIB,title = "添加/编辑用户库",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> addUserLib(@RequestBody UserLibDto dto) {
         return sceneService.addUserLib(dto);
     }
 
     @ApiOperation(value = "删除用户库")
     @GetMapping("/userlib/del/{id}")
+    @Log(tag = LogTagEnum.USERLIB,title = "删除用户库",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> delUserLib(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return sceneService.delUserLib(id);
     }

+ 58 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/SysOperLogController.java

@@ -0,0 +1,58 @@
+package cn.hanghui.outapi.platform.tenant.controller;
+
+import cn.hanghui.outapi.platform.common.controller.BaseController;
+import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
+import cn.hanghui.outapi.platform.common.utils.EnumUtils;
+import cn.hanghui.outapi.platform.tenant.entity.dto.SysOperLogSearch;
+import cn.hanghui.outapi.platform.tenant.entity.dto.SysOperLogVo;
+import cn.hanghui.outapi.platform.tenant.entity.dto.blacklist.*;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.ModuleTypeEnum;
+import cn.hanghui.outapi.platform.tenant.service.SysOperLogService;
+import cn.hanghui.outapi.platform.tenant.service.UserBlacklistService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Api(tags = "操作日志")
+@RestController
+@RequestMapping(value = "/api/oper")
+@Validated
+@RequiredArgsConstructor(onConstructor = @__(@Autowired))
+public class SysOperLogController extends BaseController {
+
+    private final SysOperLogService sysOperLogService;
+
+
+    @ApiOperation(value = "所属模块枚举列表")
+    @PostMapping("/tag/list")
+    @ApiOperationSupport(order = 1)
+    public RestResult<List<Map<Integer, String>>> logTagEnumList() {
+        return RestResult.ok(EnumUtils.enumToListMap(LogTagEnum.class));
+    }
+    @ApiOperation(value = "业务类型枚举列表")
+    @PostMapping("/Business/type/list")
+    @ApiOperationSupport(order = 2)
+    public RestResult<List<Map<Integer, String>>> businessTypeEnumList() {
+        return RestResult.ok(EnumUtils.enumToListMap(BusinessTypeEnum.class));
+    }
+
+    @ApiOperation(value = "操作记录(分页)")
+    @PostMapping("/page")
+    @ApiOperationSupport(order = 20)
+    public RestResult<IPage<SysOperLogVo>> page(@RequestBody SysOperLogSearch dto) {
+        return sysOperLogService.page(dto);
+    }
+
+}

+ 10 - 4
src/main/java/cn/hanghui/outapi/platform/tenant/controller/TenantController.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
@@ -10,10 +11,7 @@ import cn.hanghui.outapi.platform.tenant.entity.config.device.template.DeviceTem
 import cn.hanghui.outapi.platform.tenant.entity.config.device.template.DeviceTemplateSearch;
 import cn.hanghui.outapi.platform.tenant.entity.config.device.template.DeviceTemplateVo;
 import cn.hanghui.outapi.platform.tenant.entity.dto.*;
-import cn.hanghui.outapi.platform.tenant.entity.enums.IdCardReaderBrandEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.PushFailedRecordTypeEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.QrCodeReaderBrandEnum;
-import cn.hanghui.outapi.platform.tenant.entity.enums.ReaderBrandEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.*;
 import cn.hanghui.outapi.platform.tenant.service.DeviceTemplateService;
 import cn.hanghui.outapi.platform.tenant.service.TenantService;
 import com.alibaba.fastjson.JSONObject;
@@ -63,12 +61,14 @@ public class TenantController {
 
     @ApiOperation(value = "添加商户")
     @PostMapping("/add")
+    @Log(tag = LogTagEnum.TENANT,title = "添加/编辑服务商平台",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> addApply(@RequestBody TenantReqDto dto) {
         return tenantService.add(dto);
     }
 
     @ApiOperation(value = "删除商户")
     @GetMapping("/del/{id}")
+    @Log(tag = LogTagEnum.TENANT,title = "删除服务商平台",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
         return tenantService.del(id);
     }
@@ -101,6 +101,7 @@ public class TenantController {
 
     @ApiOperation(value = "添加或编辑设备")
     @PostMapping("/sn/add")
+    @Log(tag = LogTagEnum.HHFACE,title = "添加/编辑设备",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> addDevice(@Valid @RequestBody DeviceDto dto) {
         return tenantService.addDevice(dto);
     }
@@ -120,18 +121,21 @@ public class TenantController {
 
     @ApiOperation(value = "授权")
     @PostMapping("/sn/auth/{deviceId}")
+    @Log(tag = LogTagEnum.HHFACE,title = "设备授权",businessTypeEnum = BusinessTypeEnum.AUTH)
     public RestResult<Boolean> deviceAuth(@PathVariable(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return tenantService.opeDeviceAuth(deviceId, Boolean.TRUE);
     }
 
     @ApiOperation(value = "取消授权")
     @PostMapping("/sn/auth/cancel/{deviceId}")
+    @Log(tag = LogTagEnum.HHFACE,title = "设备取消授权",businessTypeEnum = BusinessTypeEnum.CANCEL_AUTH)
     public RestResult<Boolean> deviceAuthCancel(@PathVariable(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return tenantService.opeDeviceAuth(deviceId, Boolean.FALSE);
     }
 
     @ApiOperation(value = "删除设备")
     @PostMapping("/sn/del/{deviceId}")
+    @Log(tag = LogTagEnum.HHFACE,title = "删除设备",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> deviceDel(@PathVariable(value = "deviceId") @ApiParam(value = "deviceId", required = true) Long deviceId) {
         return tenantService.deviceDel(deviceId);
     }
@@ -163,6 +167,7 @@ public class TenantController {
     @ApiOperation("设备模版-新增/编辑")
     @PostMapping("template/edit")
     @ApiOperationSupport(order = 100)
+    @Log(tag = LogTagEnum.HHFACE,title = "新增/编辑模版",businessTypeEnum = BusinessTypeEnum.INSERT_UPDATE)
     public RestResult<Boolean> edit(@RequestBody @Valid DeviceTemplateDto dto) {
         return RestResponse.ok(deviceTemplateService.edit(dto));
     }
@@ -184,6 +189,7 @@ public class TenantController {
     @ApiOperation("设备模版-删除")
     @DeleteMapping("template/{deviceTemplateId}")
     @ApiOperationSupport(order = 130)
+    @Log(tag = LogTagEnum.HHFACE,title = "删除模版",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> templateDelete(@PathVariable(value = "deviceTemplateId") Long deviceTemplateId) {
         return RestResponse.ok(deviceTemplateService.deviceTemplateDelete(deviceTemplateId));
     }

+ 5 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/controller/UserBlacklistController.java

@@ -1,9 +1,12 @@
 package cn.hanghui.outapi.platform.tenant.controller;
 
+import cn.hanghui.outapi.platform.common.config.log.Log;
 import cn.hanghui.outapi.platform.common.controller.BaseController;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.common.utils.ExcelDataListener;
 import cn.hanghui.outapi.platform.tenant.entity.dto.blacklist.*;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum;
 import cn.hanghui.outapi.platform.tenant.service.UserBlacklistService;
 import com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -44,6 +47,7 @@ public class UserBlacklistController extends BaseController {
 
     @ApiOperation("批量导入黑名单")
     @PostMapping("/task/import")
+    @Log(tag = LogTagEnum.BLACK,title = "批量导入黑名单",businessTypeEnum = BusinessTypeEnum.INSERT,isSaveRequestData=false)
     public RestResult<List<String>> importBlacklist(@RequestParam("file") MultipartFile excelFile,
                                                     @RequestParam("taskName") String taskName,
                                                     @RequestParam("purchaserId") Long purchaserId) {
@@ -71,6 +75,7 @@ public class UserBlacklistController extends BaseController {
 
     @ApiOperation(value = "黑名单任务删除")
     @PostMapping("/del/{taskId}")
+    @Log(tag = LogTagEnum.BLACK,title = "黑名单任务删除",businessTypeEnum = BusinessTypeEnum.DELETE)
     public RestResult<Boolean> del(@PathVariable(value = "taskId") @ApiParam(value = "taskId", required = true) Long taskId) {
         return userBlacklistService.del(taskId);
     }

+ 51 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/SysOperLogSearch.java

@@ -0,0 +1,51 @@
+package cn.hanghui.outapi.platform.tenant.entity.dto;
+
+import cn.hanghui.outapi.platform.tenant.entity.config.maintenance.BaseSearch;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+@Data
+public class SysOperLogSearch extends BaseSearch implements Serializable {
+
+    /**
+     * 所属模块
+     * @see cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum
+     */
+    @ApiModelProperty(value = "所属模块-所属模块枚举")
+    private String tag;
+    /**
+     * 业务类型BusinessTypeEnum枚举
+     * @see cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum
+     */
+    @ApiModelProperty(value = "业务类型-业务类型枚举")
+    private Integer businessType;
+
+    @ApiModelProperty(value = "操作名称")
+    private String title;
+
+    @ApiModelProperty(value = "操作人员")
+    private String operName;
+
+    @ApiModelProperty(value = "操作人员手机号")
+    private String operPhone;
+
+    @ApiModelProperty(value = "开始时间")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date startTime;
+
+    @ApiModelProperty(value = "结束时间")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date endTime;
+
+    @ApiModelProperty(value = "账号")
+    private Long accountId;
+
+}

+ 62 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/SysOperLogVo.java

@@ -0,0 +1,62 @@
+package cn.hanghui.outapi.platform.tenant.entity.dto;
+
+import cn.hanghui.outapi.platform.tenant.entity.dto.blacklist.UserBlacklistBean;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+
+@Data
+public class SysOperLogVo implements Serializable {
+
+    /**
+     * 所属模块
+     * @see cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum
+     */
+    @ApiModelProperty(value = "所属模块-所属模块枚举")
+    private String tag;
+    /**
+     * 业务类型BusinessTypeEnum枚举
+     * @see cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum
+     */
+    @ApiModelProperty(value = "业务类型-业务类型枚举")
+    private String businessTypeName;
+
+    @ApiModelProperty(value = "操作名称")
+    private String title;
+
+    @ApiModelProperty(value = "方法名称")
+    private String method;
+
+    @ApiModelProperty(value = "操作人员")
+    private String operName;
+
+    @ApiModelProperty(value = "操作人员手机号")
+    private String operPhone;
+
+    @ApiModelProperty(value = "请求参数")
+    private String operParam;
+
+    @ApiModelProperty(value = "返回参数")
+    private String jsonResult;
+
+    @ApiModelProperty(value = "错误消息")
+    private String errorMsg;
+
+    @ApiModelProperty(value = "操作状态(true正常 false异常)")
+    private Boolean status;
+
+    @ApiModelProperty(value = "操作时间")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date operTime;
+
+    @ApiModelProperty(value = "执行时长(毫秒)")
+    private Long executeTime;
+
+    @ApiModelProperty(value = "账号名称")
+    private String accountName;
+}

+ 234 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/auth/fkj/FkjAuthDeviceDto.java

@@ -0,0 +1,234 @@
+package cn.hanghui.outapi.platform.tenant.entity.dto.auth.fkj;
+
+import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceDto;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import java.time.LocalDate;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author shisl
+ * @package cn.hanghui.outapi.platform.tenant.entity.dto
+ * @class IotDeviceConfigVo
+ * @date 2023/12/5 下午2:11
+ * @description
+ */
+@Data
+public class FkjAuthDeviceDto {
+
+    private Long id;
+
+    @ApiModelProperty(value = "设备编号")
+    @NotNull(message = "请选择设备编号")
+    private String sn;
+
+    @ApiModelProperty(value = "购买方公司id")
+    @NotNull(message = "请选择购买方公司")
+    private Long purchaserId;
+
+    @ApiModelProperty(value = "应用类型id")
+    @NotNull(message = "请选择应用类型")
+    private Long applicationTypeId;
+
+    @ApiModelProperty(value = "设备型号(硬件)id")
+    @NotNull(message = "请选择设备型号(硬件)")
+    private Long deviceModelHardwareId;
+
+    @ApiModelProperty(value = "设备型号(环境)id")
+    @NotNull(message = "请选择设备型号(环境)")
+    private Long deviceModelEnvironmentId;
+
+    @ApiModelProperty(value = "系统类型 1-蚂蚁OS 2-非蚂蚁OS")
+    @NotNull(message = "请选择系统类型")
+    @Min(value = 1,message = "请选择系统类型")
+    @Max(value = 2,message = "请选择系统类型")
+    private Integer systemTypeCode;
+
+    @ApiModelProperty(value = "启用支付宝刷脸功能 false-不启用 true-启用(默认)")
+    private Boolean useAlipayFace;
+
+    @ApiModelProperty(value = "启用身份证功能 false-不启用 true-启用(默认)")
+    private Boolean useIdcard;
+
+    @ApiModelProperty(value = "是否人证比对 默认:tue")
+    private Boolean usePersonCard;
+
+    @ApiModelProperty(value = "否启用无证登记 默认:false")
+    private Boolean noIdcardRegister;
+
+    @ApiModelProperty(value = "无证是否输入手机号 默认:true")
+    private Boolean noIdcardInputPhone;
+
+    @ApiModelProperty(value = "微信扫码登记 默认:false")
+    private Boolean wxScanRegister;
+
+    @ApiModelProperty(value = "微信二维码地址")
+    private String wxQrcodeUrl;
+
+    @ApiModelProperty(value = "支付宝扫码登记 默认:false")
+    private Boolean zfbScanRegister;
+
+    @ApiModelProperty(value = "支付宝二维码地址")
+    private String zfbQrcodeUrl;
+
+    @ApiModelProperty(value = "获取受访人列表地址")
+    private String visiteeUrl;
+
+    @ApiModelProperty(value = "获取辖区配置地址")
+    private String areaUrl;
+
+    @ApiModelProperty(value = "进出记录推送地址")
+    private String transitPushUrl;
+
+    @ApiModelProperty(value = "是否打印访客单 默认:false")
+    private Boolean printVisitorList;
+
+    @ApiModelProperty(value = "是否启用签离 默认:true")
+    private Boolean signOut;
+
+    @ApiModelProperty(value = "是否启用风险人核查 默认:false")
+    private Boolean riskCheck;
+
+    @ApiModelProperty(value = "是否隐藏签离、设置等按钮 默认:false")
+    private Boolean hiddenButton;
+
+    @ApiModelProperty(value = "否启用通用二维码 默认:true")
+    private Boolean generalQrcode;
+
+    @ApiModelProperty(value = "通用二维码标题")
+    private String generalQrcodeTitle;
+
+    @ApiModelProperty(value = "是否启用梯控二维码 默认:false")
+    private Boolean ethQrcode;
+
+    @ApiModelProperty(value = "梯控二维码标题")
+    private String ethQrcodeTitle;
+
+    @ApiModelProperty(value = "梯控二维码接口")
+    private String ethQrcodeUrl;
+
+    @ApiModelProperty(value = "是否启用闸机二维码 默认:false")
+    private Boolean gateQrcode;
+
+    @ApiModelProperty(value = "闸机二维码标题")
+    private String gateQrcodeTitle;
+
+    @ApiModelProperty(value = "闸机二维码接口")
+    private String gateGrcodeUrl;
+
+    @ApiModelProperty(value = "选择受访人超时时间 90(秒)")
+    private Integer chooseVisiteeTimeout;
+
+    @ApiModelProperty(value = "刷身份证超时时间 15(秒)")
+    private Integer readIdcardTimeout;
+
+    @ApiModelProperty(value = "输入身份证超时时间 30(秒)")
+    private Integer inputIdcardTimeout;
+
+    @ApiModelProperty(value = "输入手机号超时时间 30(秒)")
+    private Integer inputPhoneTimeout;
+
+    @ApiModelProperty(value = "签离扫码超时时间 15(秒)")
+    private Integer singOutTimeout;
+
+    @ApiModelProperty(value = "结果页超时时间 5(秒)")
+    private Integer resultPageTimeout;
+
+    @ApiModelProperty(value = "刷脸超时时间(秒)")
+    private Integer faceTimeout;
+    @ApiModelProperty(value = "1v1比对超时时间(秒)")
+    private Integer oneToOneTimeout;
+    @ApiModelProperty(value = "联网查询超时时间(秒)")
+    private Integer connectSearchTimeout;
+
+    @ApiModelProperty(value = "支付宝比对成功语音 默认: 比对成功")
+    private String successVoice;
+
+    @ApiModelProperty(value = "支付宝比对失败语音 默认: 比对失败,请重试或刷身份证")
+    private String failVoice;
+
+    @ApiModelProperty(value = "访客登记成功语音 默认: 正在打印访客单")
+    private String registerSuccessVoice;
+
+    @ApiModelProperty(value = "刷身份证提示音语 默认: 请刷身份证")
+    private String readIdcardVoice;
+
+    @ApiModelProperty(value = "输入身份证提示音语 默认: 请输入身份证")
+    private String inputIdcardVoice;
+
+    @ApiModelProperty(value = "输入手机号提示音语 默认: 请输入手机号")
+    private String inputPhoneVoice;
+
+    @ApiModelProperty(value = "联网信息查询提示音语 默认: 正在联网信息查询,请耐心等待")
+    private String connectSearchVoice;
+
+    @ApiModelProperty(value = "签离扫码提示语音 默认: 请将二维码对准设备的扫码窗")
+    private String singOutVoice;
+
+    @ApiModelProperty(value = "设备管理员密码")
+    private String mpassword;
+
+    @ApiModelProperty(value = "语音音量0-100 默认:80")
+    private Integer voiceVolume;
+
+    @ApiModelProperty(value = "提示语(图片)")
+    private String reminder;
+
+    @ApiModelProperty(value = "不脱敏的字段 1-姓名 2-身份证 3-手机号")
+    private List<Integer> notDesensitizedColumn;
+
+    @ApiModelProperty(value = "登记页面不脱敏的字段 1-姓名 2-身份证")
+    private List<Integer> registerNotDesensitizedColumn;
+
+    @ApiModelProperty(value = "刷脸失败跳转手输 false-关闭 true-开启 默认false")
+    private Boolean faceFailHandInput;
+
+    @ApiModelProperty(value = "是否启用注意事项提示语 true-启用 false-不启用")
+    private Boolean reminderAuth;
+
+    @ApiModelProperty(value = "到期日期")
+    private LocalDate expirationDate;
+
+    @ApiModelProperty(value = "拜访事由")
+    private String visitReason;
+
+    @ApiModelProperty(value = "是否启用确定倒计时")
+    private Boolean confirmCountdownSwitch;
+
+    @ApiModelProperty(value = "确定倒计时时长(s)")
+    private Integer confirmCountdownTime;
+
+    @ApiModelProperty(value = "是否启用副屏轮播图")
+    private Boolean secondaryPageSwitch;
+
+    @ApiModelProperty(value = "副屏轮播图")
+    private List<String> secondaryPageImages;
+
+    @ApiModelProperty(value = "是否启用副屏处理中页面")
+    private Boolean processingPageSwitch;
+
+    @ApiModelProperty(value = "副屏处理中页面图片")
+    private String processingPageImage;
+
+    @ApiModelProperty(value = "提示标语播报文本")
+    private String reminderPlayText;
+
+    @ApiModelProperty(value = "启用进出记录推送 默认: true")
+    private Boolean transitPushSwitch;
+    @ApiModelProperty(value = "进出记录推送数据是否加解密 默认true")
+    private Boolean transitPushEncryptSwitch;
+    @ApiModelProperty(value = "进出记录推送数据是否加解密appKey")
+    private String transitPushEncryptAppKey;
+    @ApiModelProperty(value = "进出记录推送数据是否加解密appSecrete")
+    private String transitPushEncryptAppSecret;
+    @ApiModelProperty(value = "进出记录推送数据是否加解密PrivateKey")
+    private String transitPushEncryptPrivateKey;
+
+
+}

+ 22 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/auth/fkj/FkjAuthDeviceSearch.java

@@ -0,0 +1,22 @@
+package cn.hanghui.outapi.platform.tenant.entity.dto.auth.fkj;
+
+import cn.hanghui.outapi.platform.tenant.entity.config.maintenance.BaseSearch;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author shisl
+ * @package cn.hanghui.outapi.platform.tenant.entity.dto.ampe
+ * @class HhFaceDeviceSearch
+ * @date 2024/9/11 下午3:45
+ * @description
+ */
+@Data
+public class FkjAuthDeviceSearch extends BaseSearch {
+
+    @ApiModelProperty(value = "设备编号")
+    private String sn;
+    @ApiModelProperty(value = "授权状态  false:未授权 true:已授权")
+    private Boolean status;
+
+}

+ 1 - 1
src/main/java/cn/hanghui/outapi/platform/tenant/entity/dto/hhlocal/HhLocalDeviceBase.java

@@ -72,7 +72,7 @@ public class HhLocalDeviceBase implements Serializable {
      */
     @ApiModelProperty(value = "二维码读头品牌 QrCodeReaderBrandEnum")
     private Integer qrCodeReaderBrand;
-    @ApiModelProperty(value = "二维码读头通信模式 1-虚拟串口 2-串口serialPort")
+    @ApiModelProperty(value = "二维码读头通信模式 1-虚拟串口 2-串口serialPort 3-虚拟键盘")
     private Integer qrCodeReaderCommunicationMode;
     @ApiModelProperty(value = "二维码读头串口地址serialPort")
     private String qrCodeReaderSerialPort;

+ 42 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/entity/enums/BusinessTypeEnum.java

@@ -0,0 +1,42 @@
+package cn.hanghui.outapi.platform.tenant.entity.enums;
+
+import cn.hanghui.outapi.platform.common.utils.Preconditions;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @description 日志记录的操作类型
+ */
+@Getter
+@AllArgsConstructor
+public enum BusinessTypeEnum {
+
+    INSERT(1, "新增"),
+    UPDATE(2, "编辑"),
+    DELETE(3, "删除"),
+    INSERT_UPDATE(4, "新增/编辑"),
+    AUTH(5, "授权"),
+    CANCEL_AUTH(6, "取消授权"),
+    AUTH_COMMON(7, "授权/取消授权"),
+    OPEN(8, "启用"),
+    CLOSE(9, "停用"),
+    OTHER(99, "其他"),
+    ;
+
+    private Integer code;
+    private String desc;
+
+
+    public static BusinessTypeEnum getByCode(Integer code) {
+        if(code == null){
+            return OTHER;
+        }
+        for (BusinessTypeEnum value : values()) {
+            if (value.getCode().equals(code)) {
+                return value;
+            }
+        }
+        return OTHER;
+    }
+
+}

+ 38 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/entity/enums/LogTagEnum.java

@@ -0,0 +1,38 @@
+package cn.hanghui.outapi.platform.tenant.entity.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @description 日志记录的操作类型
+ */
+@Getter
+@AllArgsConstructor
+public enum LogTagEnum {
+
+    AUTH_ACCOUNT("授权账号"),
+    PURCHASER("购买方公司"),
+    APPLICATIONTYPE("应用类型"),
+    DEVICEMODEL("设备型号"),
+    TENANT("服务商平台"),
+    SCENE("场景"),
+    USERLIB("用户库"),
+    HHOMC("HHOMC"),
+    HHFACE("HHFace"),
+    HHLOCAL("HHLocal"),
+    HHCULTURE("HHCulture"),
+    HHAROME("HHArome"),
+    FKJ("访客机"),
+    PROVISIONAL("临时身份证明"),
+    BLACK("黑名单"),
+    APK("升级安装管理"),
+    ALIPAY("支付宝三要素授权管理"),
+    THIRD_API("三方API调用管理"),
+    OTHER("其他"),
+
+    ;
+
+    private String desc;
+
+
+}

+ 123 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/entity/po/SysOperLog.java

@@ -0,0 +1,123 @@
+package cn.hanghui.outapi.platform.tenant.entity.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * <p>
+ * 操作日志记录
+ * </p>
+ *
+ * @author wxg
+ * @since 2024-12-31
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sys_oper_log")
+public class SysOperLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 日志主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 所属模块
+     * @see cn.hanghui.outapi.platform.tenant.entity.enums.LogTagEnum
+     */
+    @TableField("tag")
+    private String tag;
+
+    /**
+     * 业务类型BusinessTypeEnum枚举
+     * @see cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum
+     */
+    @TableField("business_type")
+    private Integer businessType;
+
+    /**
+     * 操作名称
+     */
+    @TableField("title")
+    private String title;
+
+    /**
+     * 方法名称
+     */
+    @TableField("method")
+    private String method;
+
+    /**
+     * 操作人员
+     */
+    @TableField("oper_name")
+    private String operName;
+
+    /**
+     * 操作人员手机号
+     */
+    @TableField("oper_phone")
+    private String operPhone;
+
+    /**
+     * 请求参数
+     */
+    @TableField("oper_param")
+    private String operParam;
+
+    /**
+     * 返回参数
+     */
+    @TableField("json_result")
+    private String jsonResult;
+
+    /**
+     * 错误消息
+     */
+    @TableField("error_msg")
+    private String errorMsg;
+
+    /**
+     * 操作状态(1正常 0异常)
+     */
+    @TableField("status")
+    private Boolean status;
+
+    /**
+     * 操作时间
+     */
+    @TableField("oper_time")
+    private Date operTime;
+
+    /**
+     * 执行时长(毫秒)
+     */
+    @TableField("execute_time")
+    private Long executeTime;
+
+    /**
+     * 账号id
+     */
+    @TableField("account_id")
+    private Long accountId;
+
+    /**
+     * 账号名称
+     */
+    @TableField("account_name")
+    private String accountName;
+
+}

+ 16 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/mapper/SysOperLogMapper.java

@@ -0,0 +1,16 @@
+package cn.hanghui.outapi.platform.tenant.mapper;
+
+import cn.hanghui.outapi.platform.tenant.entity.po.SysOperLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 操作日志记录 Mapper 接口
+ * </p>
+ *
+ * @author wxg
+ * @since 2024-12-31
+ */
+public interface SysOperLogMapper extends BaseMapper<SysOperLog> {
+
+}

+ 43 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/server/job/ClearSysOperLogTask.java

@@ -0,0 +1,43 @@
+package cn.hanghui.outapi.platform.tenant.server.job;
+
+import cn.hanghui.outapi.platform.tenant.entity.po.SysOperLog;
+import cn.hanghui.outapi.platform.tenant.mapper.SysOperLogMapper;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alipay.api.domain.UserInfoDetail;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+
+import javax.annotation.Resource;
+import java.util.Date;
+
+
+@Configuration      //1.主要用于标记配置类,兼备Component的效果。
+@EnableScheduling   // 2.开启定时任务
+@EnableAsync
+@Slf4j
+@RequiredArgsConstructor(onConstructor_ = @__(@Autowired))
+public class ClearSysOperLogTask {
+
+    private final SysOperLogMapper sysOperLogMapper;
+
+    @Async("ThreadPoolExecutor")
+    @Scheduled(cron = "0 0 0 * * ? ")
+    public void userTask() {
+        log.info("----------开始------清除一个月前的操作日志-------------");
+        String monthAgo = DateUtil.formatDate(DateUtil.offsetMonth(new Date(), -1));//一个月前
+        int delete = sysOperLogMapper.delete(
+                Wrappers.<SysOperLog>lambdaQuery()
+                        .lt(SysOperLog::getOperTime, monthAgo)
+        );
+        log.info("删除的数量:{}",delete);
+        log.info("----------完成------清除一个月前的操作日志-------------");
+    }
+}

+ 6 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/service/FkjDeviceService.java

@@ -1,5 +1,6 @@
 package cn.hanghui.outapi.platform.tenant.service;
 
+import cn.hanghui.outapi.platform.common.entity.po.Account;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceDto;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceMiniDto;
@@ -10,6 +11,8 @@ import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDe
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceTemplateSearch;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceUpdateMiniDto;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceVo;
+import cn.hanghui.outapi.platform.tenant.entity.dto.auth.fkj.FkjAuthDeviceDto;
+import cn.hanghui.outapi.platform.tenant.entity.dto.auth.fkj.FkjAuthDeviceSearch;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import java.util.List;
@@ -46,4 +49,7 @@ public interface FkjDeviceService {
     FkjDeviceVo snConfig(FkjDeviceMiniDto dto);
 
     void updateConfig(FkjDeviceUpdateMiniDto dto);
+    RestResult<IPage<FkjDeviceVo>> authPage(FkjAuthDeviceSearch dto, Account account);
+
+    RestResult<Boolean> update(FkjAuthDeviceDto dto, Account account);
 }

+ 10 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/service/SysOperLogService.java

@@ -0,0 +1,10 @@
+package cn.hanghui.outapi.platform.tenant.service;
+
+import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
+import cn.hanghui.outapi.platform.tenant.entity.dto.SysOperLogSearch;
+import cn.hanghui.outapi.platform.tenant.entity.dto.SysOperLogVo;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+public interface SysOperLogService {
+    RestResult<IPage<SysOperLogVo>> page(SysOperLogSearch dto);
+}

+ 86 - 5
src/main/java/cn/hanghui/outapi/platform/tenant/service/impl/FkjDeviceServiceImpl.java

@@ -1,7 +1,11 @@
 package cn.hanghui.outapi.platform.tenant.service.impl;
 
+import cn.hanghui.outapi.platform.common.entity.po.Account;
+import cn.hanghui.outapi.platform.common.entity.po.AccountAuthConfig;
 import cn.hanghui.outapi.platform.common.entity.rest.RestCode;
 import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
+import cn.hanghui.outapi.platform.common.exception.BusinessException;
+import cn.hanghui.outapi.platform.common.mapper.AccountAuthConfigMapper;
 import cn.hanghui.outapi.platform.common.utils.ClassUtil;
 import cn.hanghui.outapi.platform.common.utils.Preconditions;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceDto;
@@ -13,12 +17,10 @@ import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDe
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceTemplateVo;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceUpdateMiniDto;
 import cn.hanghui.outapi.platform.tenant.entity.config.fkj.device.template.FkjDeviceVo;
+import cn.hanghui.outapi.platform.tenant.entity.dto.auth.fkj.FkjAuthDeviceDto;
+import cn.hanghui.outapi.platform.tenant.entity.dto.auth.fkj.FkjAuthDeviceSearch;
 import cn.hanghui.outapi.platform.tenant.entity.enums.SystemTypeEnum;
-import cn.hanghui.outapi.platform.tenant.entity.po.ApplicationType;
-import cn.hanghui.outapi.platform.tenant.entity.po.DeviceModel;
-import cn.hanghui.outapi.platform.tenant.entity.po.FkjDevice;
-import cn.hanghui.outapi.platform.tenant.entity.po.FkjDeviceTemplate;
-import cn.hanghui.outapi.platform.tenant.entity.po.Purchaser;
+import cn.hanghui.outapi.platform.tenant.entity.po.*;
 import cn.hanghui.outapi.platform.tenant.mapper.ApplicationTypeMapper;
 import cn.hanghui.outapi.platform.tenant.mapper.DeviceModelMapper;
 import cn.hanghui.outapi.platform.tenant.mapper.FkjDeviceMapper;
@@ -32,6 +34,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -47,6 +51,7 @@ import java.util.stream.Collectors;
  * @description
  */
 @Service
+@RequiredArgsConstructor(onConstructor_ = @__(@Autowired))
 public class FkjDeviceServiceImpl implements FkjDeviceService {
 
     @Resource
@@ -66,6 +71,7 @@ public class FkjDeviceServiceImpl implements FkjDeviceService {
 
     @Resource
     private PurchaserMapper purchaserMapper;
+    private final AccountAuthConfigMapper accountAuthConfigMapper;
 
     @Override
     public Boolean templateEdit(FkjDeviceTemplateDto dto) {
@@ -373,6 +379,7 @@ public class FkjDeviceServiceImpl implements FkjDeviceService {
         }
     }
 
+
     private void deviceVoiceConfig(FkjDeviceUpdateMiniDto dto, FkjDevice device) {
         device.setSuccessVoice(dto.getSuccessVoice());
         device.setFailVoice(dto.getFailVoice());
@@ -453,6 +460,80 @@ public class FkjDeviceServiceImpl implements FkjDeviceService {
         device.setConfirmCountdownTime(dto.getConfirmCountdownTime());
         fkjDeviceMapper.updateById(device);
     }
+    @Override
+    public RestResult<IPage<FkjDeviceVo>> authPage(FkjAuthDeviceSearch dto, Account account) {
+        LambdaQueryWrapper<AccountAuthConfig> awrapper = new LambdaQueryWrapper<>();
+        awrapper.eq(AccountAuthConfig::getAccountId, account.getId()).eq(AccountAuthConfig::getIsDeleted, Boolean.FALSE);
+        AccountAuthConfig config = accountAuthConfigMapper.selectOne(awrapper);
+        if (Preconditions.isBlank(config) || Preconditions.isBlank(config.getFkjSwitch()) || !config.getFkjSwitch() || Preconditions.isBlank(config.getPurchaserId())) {
+            throw new BusinessException("禁止访问该资源");
+        }
+        LambdaQueryWrapper<FkjDevice> wrapper = getWrapper(dto,config);
+        Page<FkjDevice> page = new Page<>(dto.getPageNumber(), dto.getPageSize());
+        IPage<FkjDevice> iPage = fkjDeviceMapper.selectPage(page, wrapper);
+        Map<Long, Purchaser> purchaserMap = commonImpl.getPurchaserMap(iPage, FkjDevice::getPurchaserId);
+        Map<Long, ApplicationType> applicationTypeMap = commonImpl.getApplicationTypeMap(iPage, FkjDevice::getApplicationTypeId);
+        Map<Long, DeviceModel> deviceModelHardwareMap = commonImpl.getDeviceModelMap(iPage, FkjDevice::getDeviceModelHardwareId);
+        Map<Long, DeviceModel> deviceModelEnvironmentMap = commonImpl.getDeviceModelMap(iPage, FkjDevice::getDeviceModelEnvironmentId);
+
+        IPage<FkjDeviceVo> convert = iPage.convert(t -> {
+            FkjDeviceVo item = BeanUtil.copyProperties(t, FkjDeviceVo.class);
+            if (purchaserMap.containsKey(t.getPurchaserId())) {
+                item.setCompanyName(purchaserMap.get(t.getPurchaserId()).getCompanyName());
+            }
+            if (applicationTypeMap.containsKey(t.getApplicationTypeId())) {
+                item.setApplicationType(applicationTypeMap.get(t.getApplicationTypeId()).getApplicationType());
+            }
+            if (deviceModelHardwareMap.containsKey(t.getDeviceModelHardwareId())) {
+                item.setDeviceModelHardware(deviceModelHardwareMap.get(t.getDeviceModelHardwareId()).getDeviceModel());
+            }
+            if (deviceModelEnvironmentMap.containsKey(t.getDeviceModelEnvironmentId())) {
+                item.setDeviceModelEnvironment(deviceModelEnvironmentMap.get(t.getDeviceModelEnvironmentId()).getDeviceModel());
+            }
+            SystemTypeEnum systemTypeEnum = SystemTypeEnum.getEnumByCode(t.getSystemTypeCode());
+            if (ObjectUtil.isNotNull(systemTypeEnum)) {
+                item.setSystemType(systemTypeEnum.getDesc());
+            }
+            return item;
+        });
+        return RestResult.ok(convert);
+    }
+
+    private LambdaQueryWrapper<FkjDevice> getWrapper(FkjAuthDeviceSearch dto,AccountAuthConfig config) {
+        LambdaQueryWrapper<FkjDevice> wrapper = new LambdaQueryWrapper<>();
+        //查询的传参条件
+        wrapper.like(StrUtil.isNotBlank(dto.getSn()), FkjDevice::getSn, dto.getSn());
+        wrapper.eq(ObjectUtil.isNotNull(dto.getStatus()), FkjDevice::getStatus, dto.getStatus());
+        //基础条件
+        wrapper.eq(FkjDevice::getIsDeleted, Boolean.FALSE);
+        wrapper.eq(FkjDevice::getPurchaserId, config.getPurchaserId());
+        wrapper.orderByDesc(FkjDevice::getId);
+        return wrapper;
+    }
+
+    @Override
+    public RestResult<Boolean> update(FkjAuthDeviceDto dto, Account account) {
+        if (Preconditions.isBlank(dto.getId())) {
+            throw new BusinessException("参数有误");
+        }
+        LambdaQueryWrapper<AccountAuthConfig> awrapper = new LambdaQueryWrapper<>();
+        awrapper.eq(AccountAuthConfig::getAccountId, account.getId()).eq(AccountAuthConfig::getIsDeleted, Boolean.FALSE);
+        AccountAuthConfig authConfig = accountAuthConfigMapper.selectOne(awrapper);
+        if (Preconditions.isBlank(authConfig)
+                || Preconditions.isBlank(authConfig.getFkjSwitch())
+                || !authConfig.getFkjSwitch()) {
+            throw new BusinessException("禁止修改该资源");
+        }
+
+        FkjDevice device = fkjDeviceMapper.selectById(dto.getId());
+        if (device == null || device.getIsDeleted() == null || device.getIsDeleted()) {
+            return RestResult.error("数据不存在或已删除");
+        }
+        BeanUtil.copyProperties(dto, device, "id");
+        fkjDeviceMapper.updateById(device);
+        return RestResult.ok(Boolean.TRUE);
+    }
+
 
 
 }

+ 71 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/service/impl/SysOperLogServiceImpl.java

@@ -0,0 +1,71 @@
+package cn.hanghui.outapi.platform.tenant.service.impl;
+
+import cn.hanghui.outapi.platform.common.controller.BaseController;
+import cn.hanghui.outapi.platform.common.entity.po.Account;
+import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
+import cn.hanghui.outapi.platform.tenant.entity.dto.SysOperLogSearch;
+import cn.hanghui.outapi.platform.tenant.entity.dto.SysOperLogVo;
+import cn.hanghui.outapi.platform.tenant.entity.dto.account.AccountVo;
+import cn.hanghui.outapi.platform.tenant.entity.dto.blacklist.UserBlacklistTaskVo;
+import cn.hanghui.outapi.platform.tenant.entity.enums.AccountTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.enums.BusinessTypeEnum;
+import cn.hanghui.outapi.platform.tenant.entity.po.Purchaser;
+import cn.hanghui.outapi.platform.tenant.entity.po.SysOperLog;
+import cn.hanghui.outapi.platform.tenant.entity.po.UserBlacklistTask;
+import cn.hanghui.outapi.platform.tenant.mapper.SysOperLogMapper;
+import cn.hanghui.outapi.platform.tenant.service.AccountService;
+import cn.hanghui.outapi.platform.tenant.service.SysOperLogService;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+@Service
+@RequiredArgsConstructor(onConstructor = @__(@Autowired))
+public class SysOperLogServiceImpl extends BaseController implements SysOperLogService {
+    private final SysOperLogMapper sysOperLogMapper;
+    private final AccountService accountService;
+
+    @Override
+    public RestResult<IPage<SysOperLogVo>> page(SysOperLogSearch dto) {
+        LambdaQueryWrapper<SysOperLog> wrapper = this.getWrapper(dto);
+        Page<SysOperLog> page = new Page<>(dto.getPageNumber(), dto.getPageSize());
+        IPage<SysOperLog> iPage = sysOperLogMapper.selectPage(page, wrapper);
+        IPage<SysOperLogVo> convert = iPage.convert(t -> {
+            SysOperLogVo item = BeanUtil.copyProperties(t, SysOperLogVo.class);
+            BusinessTypeEnum code = BusinessTypeEnum.getByCode(t.getBusinessType());
+            item.setBusinessTypeName(code.getDesc());
+            return item;
+        });
+
+        return RestResult.ok(convert);
+    }
+
+    private LambdaQueryWrapper<SysOperLog> getWrapper(SysOperLogSearch dto) {
+        LambdaQueryWrapper<SysOperLog> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(StrUtil.isNotBlank(dto.getTag()), SysOperLog::getTag, dto.getTag());
+        wrapper.eq(ObjectUtil.isNotEmpty(dto.getBusinessType()), SysOperLog::getBusinessType, dto.getBusinessType());
+        wrapper.like(StrUtil.isNotBlank(dto.getTitle()), SysOperLog::getTitle, dto.getTitle());
+        wrapper.eq(StrUtil.isNotBlank(dto.getOperName()), SysOperLog::getOperName, dto.getOperName());
+        wrapper.eq(StrUtil.isNotBlank(dto.getOperPhone()), SysOperLog::getOperPhone, dto.getOperPhone());
+        wrapper.ge(ObjectUtil.isNotNull(dto.getStartTime()), SysOperLog::getOperTime, dto.getStartTime());
+        wrapper.le(ObjectUtil.isNotNull(dto.getEndTime()), SysOperLog::getOperTime, dto.getEndTime());
+        wrapper.eq(ObjectUtil.isNotNull(dto.getAccountId()), SysOperLog::getAccountId, dto.getAccountId());
+
+        Account account = getAccount();
+        RestResult<AccountVo> query = accountService.query(account);
+        AccountVo data = query.getData();
+        if(AccountTypeEnum.AUTH.getCode().equals(data.getAccountType())){
+            wrapper.eq(SysOperLog::getAccountId, data.getId());
+        }
+
+        return wrapper;
+    }
+}

+ 16 - 0
src/main/java/cn/hanghui/outapi/platform/tenant/typehandle/LoginUserDtoHandler.java

@@ -0,0 +1,16 @@
+package cn.hanghui.outapi.platform.tenant.typehandle;
+
+import cn.hanghui.outapi.platform.common.entity.dto.LoginUserDto;
+import com.alibaba.fastjson.TypeReference;
+
+import java.util.List;
+
+public class LoginUserDtoHandler extends ListTypeHandler<LoginUserDto> {
+
+    @Override
+    protected TypeReference<List<LoginUserDto>> specificType() {
+        return new TypeReference<List<LoginUserDto>>() {
+        };
+    }
+
+}