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

使用统一的登录线程类、注释另一个类

xucaiqin 2 лет назад
Родитель
Сommit
3f60dd910e

+ 140 - 140
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/auth/context/LoginUserHolder.java

@@ -1,140 +1,140 @@
-package com.sckw.core.model.auth.context;
-
-import com.sckw.core.model.auth.LoginUserInfo;
-
-/**
- * 当前登录用户的临时保存容器
- * @Author zhaokang
- * @date 2020/04/13 0021
- */
-public class LoginUserHolder {
-
-    private static final ThreadLocal<LoginUserInfo> LONGIN_USER_HOLDER = new ThreadLocal<LoginUserInfo>();
-
-    /**
-     * 赋值
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static void set(LoginUserInfo loginUserInfo) {
-        LONGIN_USER_HOLDER.set(loginUserInfo);
-    }
-
-    /**
-     * 取值
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static LoginUserInfo get() {
-        return LONGIN_USER_HOLDER == null ? null : LONGIN_USER_HOLDER.get();
-    }
-
-    /**
-     * 删除保存的用户
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static void remove() {
-        LONGIN_USER_HOLDER.remove();
-    }
-
-    /**
-     * 用户id
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static Long getUserId(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getId();
-    }
-
-    /**
-     * 用户所属系统
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static Integer getSystemType(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getSystemType();
-    }
-
-    /**
-     * 用户账号
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static String getAccount(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getAccount();
-    }
-
-    /**
-     * 用户姓名
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static String getUserName(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getUserName();
-    }
-
-    /**
-     * 用户电话
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static String getPhone(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getPhone();
-    }
-
-    /**
-     * 是否主账号(0是/1否)
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static Integer getIsMain(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getIsMain();
-    }
-
-    /**
-     * 用户账号状态(0正常/1锁定)
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static Integer getStatus(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getStatus();
-    }
-
-    /**
-     * 用户所属企业
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static Long getEntId(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getEntId();
-    }
-
-    /**
-     * 用户登录终端
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static String getClientType(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getClientType();
-    }
-
-    /**
-     * 用户机构
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static Long getDeptId(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getDeptId();
-    }
-
-    /**
-     * (司机)
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static String getUserIds(){
-        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getUserIds();
-    }
-
-}
+//package com.sckw.core.model.auth.context;
+//
+//import com.sckw.core.model.auth.LoginUserInfo;
+//
+///**
+// * 当前登录用户的临时保存容器
+// * @Author zhaokang
+// * @date 2020/04/13 0021
+// */
+//public class LoginUserHolder {
+//
+//    private static final ThreadLocal<LoginUserInfo> LONGIN_USER_HOLDER = new ThreadLocal<LoginUserInfo>();
+//
+//    /**
+//     * 赋值
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static void set(LoginUserInfo loginUserInfo) {
+//        LONGIN_USER_HOLDER.set(loginUserInfo);
+//    }
+//
+//    /**
+//     * 取值
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static LoginUserInfo get() {
+//        return LONGIN_USER_HOLDER == null ? null : LONGIN_USER_HOLDER.get();
+//    }
+//
+//    /**
+//     * 删除保存的用户
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static void remove() {
+//        LONGIN_USER_HOLDER.remove();
+//    }
+//
+//    /**
+//     * 用户id
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static Long getUserId(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getId();
+//    }
+//
+//    /**
+//     * 用户所属系统
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static Integer getSystemType(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getSystemType();
+//    }
+//
+//    /**
+//     * 用户账号
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static String getAccount(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getAccount();
+//    }
+//
+//    /**
+//     * 用户姓名
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static String getUserName(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getUserName();
+//    }
+//
+//    /**
+//     * 用户电话
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static String getPhone(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getPhone();
+//    }
+//
+//    /**
+//     * 是否主账号(0是/1否)
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static Integer getIsMain(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getIsMain();
+//    }
+//
+//    /**
+//     * 用户账号状态(0正常/1锁定)
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static Integer getStatus(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getStatus();
+//    }
+//
+//    /**
+//     * 用户所属企业
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static Long getEntId(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getEntId();
+//    }
+//
+//    /**
+//     * 用户登录终端
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static String getClientType(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getClientType();
+//    }
+//
+//    /**
+//     * 用户机构
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static Long getDeptId(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getDeptId();
+//    }
+//
+//    /**
+//     * (司机)
+//     * @author zhaokang
+//     * @Date 2020/04/13 0021
+//     */
+//    public static String getUserIds(){
+//        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getUserIds();
+//    }
+//
+//}

+ 6 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckReportService.java

@@ -2,12 +2,12 @@ package com.sckw.fleet.service;
 
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.SystemException;
-import com.sckw.core.model.auth.context.LoginUserHolder;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.RegularUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.fleet.dao.KwfDriverMapper;
 import com.sckw.fleet.dao.KwfTruckMapper;
@@ -15,7 +15,10 @@ import com.sckw.fleet.dao.KwfTruckReportMapper;
 import com.sckw.fleet.model.KwfDriver;
 import com.sckw.fleet.model.KwfTruck;
 import com.sckw.fleet.model.KwfTruckReport;
-import com.sckw.fleet.model.dto.*;
+import com.sckw.fleet.model.dto.KwfChangeFleetDto;
+import com.sckw.fleet.model.dto.KwfDriverDto;
+import com.sckw.fleet.model.dto.KwfTruckDto;
+import com.sckw.fleet.model.dto.KwfTruckReportDto;
 import com.sckw.fleet.model.vo.KwfTableTopCount;
 import com.sckw.fleet.model.vo.KwfTruckReportVo;
 import com.sckw.system.api.RemoteSystemService;
@@ -26,6 +29,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
+
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;