Pārlūkot izejas kodu

餐饮Long-->String

he.dujuan 3 gadi atpakaļ
vecāks
revīzija
f20c6f9617
46 mainītis faili ar 387 papildinājumiem un 139 dzēšanām
  1. 2 2
      eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java
  2. 2 2
      eladmin-common/src/main/java/me/zhengjie/utils/SecurityUtils.java
  3. 3 5
      eladmin-system/src/main/java/me/zhengjie/modules/dm/user/domain/DmUser.java
  4. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/dm/user/repository/DmUserRepository.java
  5. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/dm/user/rest/DmUserController.java
  6. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/dm/user/service/DmUserService.java
  7. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/dm/user/service/dto/DmUserDto.java
  8. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/dm/user/service/dto/DmUserQueryCriteria.java
  9. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/dm/user/service/impl/DmUserServiceImpl.java
  10. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/dm/user/util/DmUserUtils.java
  11. 248 0
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/ZkDataSyncTask.java
  12. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/security/service/dto/JwtUserDto.java
  13. 5 5
      eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dept.java
  14. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Job.java
  15. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Role.java
  16. 6 6
      eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java
  17. 5 5
      eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DeptRepository.java
  18. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/system/repository/JobRepository.java
  19. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java
  20. 5 5
      eladmin-system/src/main/java/me/zhengjie/modules/system/repository/RoleRepository.java
  21. 8 8
      eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java
  22. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java
  23. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java
  24. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java
  25. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
  26. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/DataService.java
  27. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java
  28. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/JobService.java
  29. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/MenuService.java
  30. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/RoleService.java
  31. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
  32. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptDto.java
  33. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptQueryCriteria.java
  34. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptSmallDto.java
  35. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/JobDto.java
  36. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleDto.java
  37. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleSmallDto.java
  38. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java
  39. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserQueryCriteria.java
  40. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DataServiceImpl.java
  41. 10 10
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java
  42. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java
  43. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java
  44. 7 7
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/RoleServiceImpl.java
  45. 7 7
      eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
  46. 3 1
      eladmin-system/src/main/resources/config/application-dev.yml

+ 2 - 2
eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java

@@ -693,9 +693,9 @@ public class RedisUtils {
      * @param prefix 前缀
      * @param ids    id
      */
-    public void delByKeys(String prefix, Set<Long> ids) {
+    public void delByKeys(String prefix, Set<String> ids) {
         Set<Object> keys = new HashSet<>();
-        for (Long id : ids) {
+        for (String id : ids) {
             keys.addAll(redisTemplate.keys(new StringBuffer(prefix).append(id).toString()));
         }
         long count = redisTemplate.delete(keys);

+ 2 - 2
eladmin-common/src/main/java/me/zhengjie/utils/SecurityUtils.java

@@ -72,9 +72,9 @@ public class SecurityUtils {
      * 获取系统用户ID
      * @return 系统用户ID
      */
-    public static Long getCurrentUserId() {
+    public static String getCurrentUserId() {
         UserDetails userDetails = getCurrentUser();
-        return new JSONObject(new JSONObject(userDetails).get("user")).get("id", Long.class);
+        return new JSONObject(new JSONObject(userDetails).get("user")).get("id", String.class);
     }
 
     /**

+ 3 - 5
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/domain/DmUser.java

@@ -43,16 +43,14 @@ import java.util.Set;
 @Data
 @Table(name="dm_user")
 public class DmUser extends BaseEntity implements Serializable {
-
     @Id
     @Column(name = "id")
     @NotNull(groups = BaseEntity.Update.class)
     @ApiModelProperty(value = "id")
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private Long id;
+    private String id;
 
     @Column(name = "name",nullable = false)
-    @NotBlank
+//    @NotBlank
     @ApiModelProperty(value = "姓名")
     private String name;
 
@@ -65,7 +63,7 @@ public class DmUser extends BaseEntity implements Serializable {
     private String contacts;
 
     @Column(name = "email",nullable = false)
-    @NotBlank
+//    @NotBlank
     @ApiModelProperty(value = "邮箱")
     private String email;
 

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/repository/DmUserRepository.java

@@ -28,7 +28,7 @@ import java.util.List;
 * @author shiguangji
 * @date 2021-03-09
 **/
-public interface DmUserRepository extends JpaRepository<DmUser, Long>, JpaSpecificationExecutor<DmUser> {
+public interface DmUserRepository extends JpaRepository<DmUser, String>, JpaSpecificationExecutor<DmUser> {
 
     /**
      * 查询未绑定账户的用户
@@ -51,8 +51,8 @@ public interface DmUserRepository extends JpaRepository<DmUser, Long>, JpaSpecif
      * @return
      */
     @Query(value = "SELECT COUNT(1) FROM dm_user WHERE dept_id = ?1",nativeQuery = true)
-    Integer selecIsNotDept(Long floorId);
+    Integer selecIsNotDept(String deptId);
 
     @Query(value = "SELECT DISTINCT name FROM sys_dept WHERE dept_id in (?1)",nativeQuery = true)
-    List selectDeptName(Long floorId);
+    List selectDeptName(String deptId);
 }

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/rest/DmUserController.java

@@ -77,7 +77,7 @@ public class DmUserController {
             criteria.getDeptIds().addAll(deptService.getDeptChildren(deptService.findByPid(criteria.getDeptId())));
         }
         // 数据权限
-        List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
+        List<String> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
         // criteria.getDeptIds() 不为空并且数据权限不为空则取交集
         if (!CollectionUtils.isEmpty(criteria.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)){
             // 取交集
@@ -123,9 +123,9 @@ public class DmUserController {
     @ApiOperation("删除会议用户")
     @PreAuthorize("@el.check('dmUser:del')")
     @DeleteMapping
-    public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
+    public ResponseEntity<Object> delete(@RequestBody String[] ids) {
         //判断是否关联账号
-        for(Long id : ids){
+        for(String id : ids){
             List<User> users = userService.findByDmUserId(id,null);
             if(users != null && users.size() > 0){
                 throw new BadRequestException("删除的用户存在关联的账号,请先解绑账号");
@@ -138,7 +138,7 @@ public class DmUserController {
     @GetMapping(value="/findNotBindUser")
     @Log("查询未绑定账号的会议用户")
     @ApiOperation("查询未绑定账号的会议用户")
-    public ResponseEntity<Object> findNotBindUser(Long userId){
+    public ResponseEntity<Object> findNotBindUser(String userId){
         return new ResponseEntity<>(dmUserService.findNotBindUser(userId),HttpStatus.OK);
     }
 }

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/service/DmUserService.java

@@ -52,7 +52,7 @@ public interface DmUserService {
      * @param id ID
      * @return DmUserDto
      */
-    DmUserDto findById(Long id);
+    DmUserDto findById(String id);
 
     /**
     * 创建
@@ -71,7 +71,7 @@ public interface DmUserService {
     * 多选删除
     * @param ids /
     */
-    void deleteAll(Long[] ids);
+    void deleteAll(String[] ids);
 
     /**
     * 导出数据
@@ -86,5 +86,5 @@ public interface DmUserService {
      * @param userId
      * @return
      */
-    List<DmUser> findNotBindUser(Long userId);
+    List<DmUser> findNotBindUser(String userId);
 }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/service/dto/DmUserDto.java

@@ -34,7 +34,7 @@ import java.util.Set;
 @Data
 public class DmUserDto extends BaseDTO implements Serializable {
 
-    private Long id;
+    private String id;
 
     /** 姓名 */
     private String name;

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/service/dto/DmUserQueryCriteria.java

@@ -33,15 +33,15 @@ import me.zhengjie.annotation.Query;
 public class DmUserQueryCriteria{
 
     @Query
-    private Long id;
+    private String id;
 
     @Query(propName = "id", type = Query.Type.IN, joinName = "dept")
-    private Set<Long> deptIds = new HashSet<>();
+    private Set<String> deptIds = new HashSet<>();
 
     @Query(blurry = "name,contacts,email")
     private String blurry;
 
-    private Long deptId;
+    private String deptId;
 
     @Query(type = Query.Type.BETWEEN)
     private List<Timestamp> createTime;

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/service/impl/DmUserServiceImpl.java

@@ -68,7 +68,7 @@ public class DmUserServiceImpl implements DmUserService {
 
     @Override
     @Transactional
-    public DmUserDto findById(Long id) {
+    public DmUserDto findById(String id) {
         DmUser dmUser = dmUserRepository.findById(id).orElseGet(DmUser::new);
         ValidationUtil.isNull(dmUser.getId(),"DmUser","id",id);
         return dmUserMapper.toDto(dmUser);
@@ -102,8 +102,8 @@ public class DmUserServiceImpl implements DmUserService {
     }
 
     @Override
-    public void deleteAll(Long[] ids) {
-        for (Long id : ids) {
+    public void deleteAll(String[] ids) {
+        for (String id : ids) {
             dmUserRepository.deleteById(id);
         }
     }
@@ -129,7 +129,7 @@ public class DmUserServiceImpl implements DmUserService {
     }
 
     @Override
-    public List<DmUser> findNotBindUser(Long userId) {
+    public List<DmUser> findNotBindUser(String userId) {
         String param = "";
         if(userId != null){
             param = userId+"";

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/util/DmUserUtils.java

@@ -15,7 +15,7 @@ public class DmUserUtils {
 
     public static DmUserDto getCurrDmUser(){
         UserService userService = SpringContextHolder.getBean(UserService.class);
-        Long userId = SecurityUtils.getCurrentUserId();
+        String userId = SecurityUtils.getCurrentUserId();
         //获取账号关联的DM用户
         UserDto userDto = userService.findById(userId);
         DmUserDto dmUser = userDto.getDmUser();

+ 248 - 0
eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/ZkDataSyncTask.java

@@ -0,0 +1,248 @@
+/*
+ *  Copyright 2019-2020 Zheng Jie
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package me.zhengjie.modules.quartz.task;
+
+import cn.hutool.http.HttpRequest;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.modules.dm.user.domain.DmUser;
+import me.zhengjie.modules.dm.user.service.DmUserService;
+import me.zhengjie.modules.dm.user.service.dto.DmUserDto;
+import me.zhengjie.modules.system.domain.Dept;
+import me.zhengjie.modules.system.domain.Job;
+import me.zhengjie.modules.system.domain.Role;
+import me.zhengjie.modules.system.domain.User;
+import me.zhengjie.modules.system.service.DeptService;
+import me.zhengjie.modules.system.service.UserService;
+import me.zhengjie.modules.system.service.dto.DeptDto;
+import me.zhengjie.modules.system.service.dto.UserDto;
+import me.zhengjie.utils.SecurityUtils;
+import me.zhengjie.utils.StringUtils;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
+
+import java.util.*;
+
+/**
+ * ERP 数据同步
+ * @author Sky
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Component
+public class ZkDataSyncTask {
+
+    private final String erpApiUrl = "http://121.31.41.88:29312";
+    private final String sign = "e34b2f59-0e9d-45ed-a32a-f4abd4381000";
+    private final String header_key = "X_AUTO_USER_INFO_HEAD";
+    private final String header_value = "{\"id\":\"anonymous\",\"tenantId\":\"caih\"}";
+    private final String key = "DMERPYT!@#$QWER2021+{:>";
+
+    private final DeptService deptService;
+    private final UserService userService;
+    private final DmUserService dmUserService;
+    private final PasswordEncoder passwordEncoder;
+
+    public void run() {
+        log.info("deptsync 执行开始");
+        deptsync();
+        log.info("deptsync 执行结束");
+
+        log.info("usersync 执行开始");
+        usersync();
+        log.info("usersync 执行结束");
+    }
+
+    private JSONObject getDatas(String api, int pagenum, int pagesize) {
+        String res = HttpRequest.get(erpApiUrl + api)
+                .header(header_key, header_value)
+                .body("{\n" +
+                        "    \"formData\":{\n" +
+                        "        \"pageNum\":" + pagenum + ",\n" +
+                        "        \"pageSize\":" + pagesize + "\n" +
+                        "    },\n" +
+                        "    \"product\":\"17\",\n" +
+                        "    \"sign\":\"" + sign + "\"\n" +
+                        "}").execute().body();
+        JSONObject json = JSONObject.parseObject(res);
+        return json;
+    }
+
+    private int gettotal(String api) {
+        JSONObject json = getDatas(api, 0, 100);
+        return json.getJSONObject("page").getInteger("totalCount");
+    }
+
+    /**
+     * 部门数据同步
+     */
+    private void deptsync() {
+        String api = "/api-third-party/busi/comm/usky/queryGroup";
+
+        //计算总页数
+        int total = gettotal(api);
+        int pagesize = 100;
+        int pagetotal = (total / pagesize);
+        if (total % pagesize != 0) {
+            pagetotal++;
+        }
+
+        //按页获取
+        for (int k = 0; k < pagetotal; k++) {
+            JSONObject json = getDatas(api, k, pagesize);
+            JSONArray datas = json.getJSONArray("data");
+            JSONObject item;
+            Dept dept;
+            for (int i = 0; i < datas.size(); i++) {
+                item = datas.getJSONObject(i);
+                dept = new Dept();
+
+                if (StringUtils.isBlank(item.getString("groupId"))) {
+                    dept.setId(UUID.randomUUID().toString());
+                } else {
+                    dept.setId(item.getString("groupId"));
+                }
+                dept.setName(item.getString("groupName"));
+
+                if (item.getString("parentId").equals("~")) {
+                    dept.setPid(null);
+                } else {
+                    dept.setPid(item.getString("parentId"));
+                }
+                dept.setDeptSort(item.getInteger("sort"));
+                dept.setEnabled(item.getBoolean("groupStatus"));
+//                dept.setTreeNames(item.getString("groupNamePath"));
+//                dept.setTreeIds(item.getString("groupIdPath"));
+//                dept.setDeptType(item.getInteger("groupType"));
+                dept.setDescription(item.getString("groupName"));
+
+                try {
+                    DeptDto deptDto = deptService.findById(item.getString("groupId"));
+                    if (deptDto != null) {
+                        deptService.update(dept);
+                    } else {
+                        deptService.create(dept);
+                    }
+                } catch (Exception ex) {
+                    System.out.println(JSONObject.toJSON(dept));
+                }
+            }
+        }
+    }
+
+    /**
+     * 人员数据同步
+     */
+    private void usersync() {
+
+        String api = "/api-third-party/busi/comm/usky/queryUser";
+
+        //计算总页数
+        int total = gettotal(api);
+        int pagesize = 100;
+        int pagetotal = (total / pagesize);
+        if (total % pagesize != 0) {
+            pagetotal++;
+        }
+
+        //按页获取
+        for (int k = 0; k < pagetotal; k++) {
+            JSONObject json = getDatas(api, k, pagesize);
+            JSONArray datas = json.getJSONArray("data");
+            JSONObject item;
+            User user;
+            UserDto userDto;
+            Dept dept;
+            DmUser dmUser;
+            DmUserDto dmUserDto;
+            for (int i = 0; i < datas.size(); i++) {
+                item = datas.getJSONObject(i);
+                user = new User();
+                user.setId(item.getString("userId"));
+//                user.setUsercode(item.getString("usercode"));
+                user.setNickName(item.getString("userName"));
+                user.setUsername(item.getString("userAccount"));
+
+                if(StringUtils.isBlank(item.getString("sex"))){
+                    user.setGender("");
+                }else{
+                    user.setGender(item.getString("sex").equals("m") ? "男" : "女");
+                }
+
+                user.setEmail(item.getString("email"));
+                user.setPhone(item.getString("mobile"));
+                user.setPassword(passwordEncoder.encode("12345678"));
+                user.setEnabled(item.getInteger("userStatus") == 1);
+                user.setIsAdmin(false);
+                user.setOrgPassword("12345678");
+                dept = new Dept();
+                dept.setId(item.getString("userGroupId"));
+                if (StringUtils.isBlank(dept.getId())) {
+                    dept.setId("0001T110000000000UKL");
+                }
+                user.setDept(dept);
+
+                Set<Job> jobs = new HashSet<Job>();
+                Job job = new Job();
+                job.setId("10");
+                jobs.add(job);
+                user.setJobs(jobs);
+
+                Set<Role> roles = new HashSet<Role>();
+
+                Role role = new Role();
+                role.setId("2");//普通用户
+                roles.add(role);
+                user.setRoles(roles);
+                dmUser = new DmUser();
+                dmUser.setDept(dept);
+                dmUser.setId(user.getId());
+                dmUser.setEmail(user.getEmail());
+                dmUser.setContacts(user.getPhone());
+                dmUser.setName(user.getNickName());
+                dmUser.setSex(user.getGender());
+//                dmUser.setUsercode(user.getUsercode());
+                dmUser.setJobs(jobs);
+                dmUser.setRoles(roles);
+
+                try {
+                    //1、入用户库
+                    dmUserDto = dmUserService.findById(dmUser.getId());
+
+                    if (dmUserDto != null) {
+                        dmUserService.update(dmUser);
+                    } else {
+                        dmUserService.create(dmUser);
+                    }
+                    user.setDmUser(dmUser);
+
+                    //2、入账户库并与用户库关联
+                    userDto = userService.findById(user.getId());
+                    if (userDto != null) {
+                        userService.update(user);
+                    } else {
+                        userService.create(user);
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+}

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/security/service/dto/JwtUserDto.java

@@ -35,7 +35,7 @@ public class JwtUserDto implements UserDetails {
 
     private final UserDto user;
 
-    private final List<Long> dataScopes;
+    private final List<String> dataScopes;
 
     @JSONField(serialize = false)
     private final List<GrantedAuthority> authorities;

+ 5 - 5
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dept.java

@@ -41,8 +41,8 @@ public class Dept extends BaseEntity implements Serializable {
     @Column(name = "dept_id")
     @NotNull(groups = Update.class)
     @ApiModelProperty(value = "ID", hidden = true)
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private Long id;
+//    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private String id;
 
     @JSONField(serialize = false)
     @ManyToMany(mappedBy = "depts")
@@ -52,7 +52,7 @@ public class Dept extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "排序")
     private Integer deptSort;
 
-    @NotBlank
+//    @NotBlank
     @ApiModelProperty(value = "部门名称")
     private String name;
 
@@ -62,12 +62,12 @@ public class Dept extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "部门备注")
     private String remark;
 
-    @NotNull
+//    @NotNull
     @ApiModelProperty(value = "是否启用")
     private Boolean enabled;
 
     @ApiModelProperty(value = "上级部门")
-    private Long pid;
+    private String pid;
 
     @ApiModelProperty(value = "子节点数目", hidden = true)
     private Integer subCount = 0;

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Job.java

@@ -39,8 +39,8 @@ public class Job extends BaseEntity implements Serializable {
     @Column(name = "job_id")
     @NotNull(groups = Update.class)
     @ApiModelProperty(value = "ID", hidden = true)
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private Long id;
+//    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private String id;
 
     @NotBlank
     @ApiModelProperty(value = "岗位名称")

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Role.java

@@ -43,9 +43,9 @@ public class Role extends BaseEntity implements Serializable {
     @Id
     @Column(name = "role_id")
     @NotNull(groups = {Update.class})
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
+//    @GeneratedValue(strategy = GenerationType.IDENTITY)
     @ApiModelProperty(value = "ID", hidden = true)
-    private Long id;
+    private String id;
 
     @JSONField(serialize = false)
     @ManyToMany(mappedBy = "roles")

+ 6 - 6
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java

@@ -44,9 +44,9 @@ public class User extends BaseEntity implements Serializable {
     @Id
     @Column(name = "user_id")
     @NotNull(groups = Update.class)
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
+//    @GeneratedValue(strategy = GenerationType.IDENTITY)
     @ApiModelProperty(value = "ID", hidden = true)
-    private Long id;
+    private String id;
 
     @ManyToMany
     @ApiModelProperty(value = "用户角色")
@@ -77,7 +77,7 @@ public class User extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "DM单位")
     private DmCompany dmCompany;
 
-    @NotBlank
+//    @NotBlank
     @Column(unique = true)
     @ApiModelProperty(value = "用户名称")
     private String username;
@@ -91,7 +91,7 @@ public class User extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "邮箱")
     private String email;
 
-    @NotBlank
+//    @NotBlank
     @ApiModelProperty(value = "电话号码")
     private String phone;
 
@@ -107,7 +107,7 @@ public class User extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "密码")
     private String password;
 
-    @NotNull
+//    @NotNull
     @ApiModelProperty(value = "是否启用")
     private Boolean enabled;
 
@@ -122,7 +122,7 @@ public class User extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "初始密码", hidden = true)
     private String orgPassword;
 
-    @NotNull
+//    @NotNull
     @ApiModelProperty(value = "限制次数", hidden = true)
     private Integer errLimit = 3;
 

+ 5 - 5
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DeptRepository.java

@@ -27,14 +27,14 @@ import java.util.Set;
 * @author Zheng Jie
 * @date 2019-03-25
 */
-public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificationExecutor<Dept> {
+public interface DeptRepository extends JpaRepository<Dept, String>, JpaSpecificationExecutor<Dept> {
 
     /**
      * 根据 PID 查询
      * @param id pid
      * @return /
      */
-    List<Dept> findByPid(Long id);
+    List<Dept> findByPid(String id);
 
     /**
      * 获取顶级部门
@@ -49,14 +49,14 @@ public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificat
      */
     @Query(value = "select d.* from sys_dept d, sys_roles_depts r where " +
             "d.dept_id = r.dept_id and r.role_id = ?1", nativeQuery = true)
-    Set<Dept> findByRoleId(Long roleId);
+    Set<Dept> findByRoleId(String roleId);
 
     /**
      * 判断是否存在子节点
      * @param pid /
      * @return /
      */
-    int countByPid(Long pid);
+    int countByPid(String pid);
 
     /**
      * 根据ID更新sub_count
@@ -65,5 +65,5 @@ public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificat
      */
     @Modifying
     @Query(value = " update sys_dept set sub_count = ?1 where dept_id = ?2 ",nativeQuery = true)
-    void updateSubCntById(Integer count, Long id);
+    void updateSubCntById(Integer count, String id);
 }

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/JobRepository.java

@@ -25,7 +25,7 @@ import java.util.Set;
 * @author Zheng Jie
 * @date 2019-03-29
 */
-public interface JobRepository extends JpaRepository<Job, Long>, JpaSpecificationExecutor<Job> {
+public interface JobRepository extends JpaRepository<Job, String>, JpaSpecificationExecutor<Job> {
 
     /**
      * 根据名称查询
@@ -38,5 +38,5 @@ public interface JobRepository extends JpaRepository<Job, Long>, JpaSpecificatio
      * 根据Id删除
      * @param ids /
      */
-    void deleteAllByIdIn(Set<Long> ids);
+    void deleteAllByIdIn(Set<String> ids);
 }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java

@@ -65,7 +65,7 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat
      */
     @Query(value = "SELECT m.* FROM sys_menu m, sys_roles_menus r WHERE " +
             "m.menu_id = r.menu_id AND r.role_id IN ?1 AND type != ?2 order by m.menu_sort asc",nativeQuery = true)
-    LinkedHashSet<Menu> findByRoleIdsAndTypeNot(Set<Long> roleIds, int type);
+    LinkedHashSet<Menu> findByRoleIdsAndTypeNot(Set<String> roleIds, int type);
 
     /**
      * 获取节点数量

+ 5 - 5
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/RoleRepository.java

@@ -29,7 +29,7 @@ import java.util.Set;
  * @author Zheng Jie
  * @date 2018-12-03
  */
-public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificationExecutor<Role> {
+public interface RoleRepository extends JpaRepository<Role, String>, JpaSpecificationExecutor<Role> {
 
     /**
      * 根据名称查询
@@ -42,7 +42,7 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
      * 删除多个角色
      * @param ids /
      */
-    void deleteAllByIdIn(Set<Long> ids);
+    void deleteAllByIdIn(Set<String> ids);
 
     /**
      * 根据用户ID查询
@@ -51,7 +51,7 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
      */
     @Query(value = "SELECT r.* FROM sys_role r, sys_users_roles u WHERE " +
             "r.role_id = u.role_id AND u.user_id = ?1",nativeQuery = true)
-    Set<Role> findByUserId(Long id);
+    Set<Role> findByUserId(String id);
 
     /**
      * 解绑角色菜单
@@ -68,7 +68,7 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
      */
     @Query(value = "select count(1) from sys_role r, sys_roles_depts d where " +
             "r.role_id = d.role_id and d.dept_id in ?1",nativeQuery = true)
-    int countByDepts(Set<Long> deptIds);
+    int countByDepts(Set<String> deptIds);
 
     /**
      * 根据菜单Id查询
@@ -86,5 +86,5 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
      */
     @Query(value = "SELECT r.* FROM sys_role r WHERE " +
             "r.role_key = :roleKey AND if(:id != '',r.role_id != :id,1=1)",nativeQuery = true)
-    List<Role> findByRoleKey(@Param("roleKey") String roleKey,@Param("id") Long id);
+    List<Role> findByRoleKey(@Param("roleKey") String roleKey,@Param("id") String id);
 }

+ 8 - 8
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java

@@ -30,7 +30,7 @@ import java.util.Set;
  * @author Zheng Jie
  * @date 2018-11-22
  */
-public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> {
+public interface UserRepository extends JpaRepository<User, String>, JpaSpecificationExecutor<User> {
 
     /**
      * 根据用户名查询
@@ -79,7 +79,7 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
      */
     @Query(value = "SELECT u.* FROM sys_user u, sys_users_roles r WHERE" +
             " u.user_id = r.user_id AND r.role_id = ?1", nativeQuery = true)
-    List<User> findByRoleId(Long roleId);
+    List<User> findByRoleId(String roleId);
 
     /**
      * 根据角色中的部门查询
@@ -88,7 +88,7 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
      */
     @Query(value = "SELECT u.* FROM sys_user u, sys_users_roles r, sys_roles_depts d WHERE " +
             "u.user_id = r.user_id AND r.role_id = d.role_id AND d.dept_id = ?1 group by u.user_id", nativeQuery = true)
-    List<User> findByRoleDeptId(Long deptId);
+    List<User> findByRoleDeptId(String deptId);
 
     /**
      * 根据菜单查询
@@ -103,7 +103,7 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
      * 根据Id删除
      * @param ids /
      */
-    void deleteAllByIdIn(Set<Long> ids);
+    void deleteAllByIdIn(Set<String> ids);
 
     /**
      * 根据岗位查询
@@ -111,7 +111,7 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
      * @return /
      */
     @Query(value = "SELECT count(1) FROM sys_user u, sys_users_jobs j WHERE u.user_id = j.user_id AND j.job_id IN ?1", nativeQuery = true)
-    int countByJobs(Set<Long> ids);
+    int countByJobs(Set<String> ids);
 
     /**
      * 根据部门查询
@@ -119,7 +119,7 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
      * @return /
      */
     @Query(value = "SELECT count(1) FROM sys_user u WHERE u.dept_id IN ?1", nativeQuery = true)
-    int countByDepts(Set<Long> deptIds);
+    int countByDepts(Set<String> deptIds);
 
     /**
      * 根据角色查询
@@ -128,11 +128,11 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
      */
     @Query(value = "SELECT count(1) FROM sys_user u, sys_users_roles r WHERE " +
             "u.user_id = r.user_id AND r.role_id in ?1", nativeQuery = true)
-    int countByRoles(Set<Long> ids);
+    int countByRoles(Set<String> ids);
 
     @Query(value = "SELECT u.* FROM sys_user u WHERE " +
             "u.dm_user_id = :dmUserId AND if(:userId != '',u.user_id != :userId,1=1)",nativeQuery = true)
-    List<User> findByDmUserId(@Param("dmUserId")Long dmUserId, @Param("userId") Long userId);
+    List<User> findByDmUserId(@Param("dmUserId")String dmUserId, @Param("userId") String userId);
 
     @Query(value = "SELECT COUNT(1) FROM sys_user WHERE company_id = ?1",nativeQuery = true)
     Integer selecIsNotCompany(Long companyId);

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java

@@ -73,9 +73,9 @@ public class DeptController {
     @ApiOperation("查询部门:根据ID获取同级与上级数据")
     @PostMapping("/superior")
     @PreAuthorize("@el.check('user:list','dept:list')")
-    public ResponseEntity<Object> getSuperior(@RequestBody List<Long> ids) {
+    public ResponseEntity<Object> getSuperior(@RequestBody List<String> ids) {
         Set<DeptDto> deptDtos  = new LinkedHashSet<>();
-        for (Long id : ids) {
+        for (String id : ids) {
             DeptDto deptDto = deptService.findById(id);
             List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>());
             deptDtos.addAll(depts);
@@ -108,9 +108,9 @@ public class DeptController {
     @ApiOperation("删除部门")
     @DeleteMapping
     @PreAuthorize("@el.check('dept:del')")
-    public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
+    public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
         Set<DeptDto> deptDtos = new HashSet<>();
-        for (Long id : ids) {
+        for (String id : ids) {
             List<Dept> deptList = deptService.findByPid(id);
             deptDtos.add(deptService.findById(id));
             if(CollectionUtil.isNotEmpty(deptList)){

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java

@@ -85,7 +85,7 @@ public class JobController {
     @ApiOperation("删除岗位")
     @DeleteMapping
     @PreAuthorize("@el.check('job:del')")
-    public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
+    public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
         // 验证是否被用户关联
         jobService.verification(ids);
         jobService.delete(ids);

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java

@@ -57,7 +57,7 @@ public class RoleController {
     @ApiOperation("获取单个role")
     @GetMapping(value = "/{id}")
     @PreAuthorize("@el.check('roles:list')")
-    public ResponseEntity<Object> query(@PathVariable Long id){
+    public ResponseEntity<Object> query(@PathVariable String id){
         return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK);
     }
 
@@ -126,8 +126,8 @@ public class RoleController {
     @ApiOperation("删除角色")
     @DeleteMapping
     @PreAuthorize("@el.check('roles:del')")
-    public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
-        for (Long id : ids) {
+    public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
+        for (String id : ids) {
             RoleDto role = roleService.findById(id);
             getLevels(role.getLevel());
         }

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java

@@ -88,7 +88,7 @@ public class UserController {
             criteria.getDeptIds().addAll(deptService.getDeptChildren(deptService.findByPid(criteria.getDeptId())));
         }
         // 数据权限
-        List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
+        List<String> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
         // criteria.getDeptIds() 不为空并且数据权限不为空则取交集
         if (!CollectionUtils.isEmpty(criteria.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)){
             // 取交集
@@ -142,8 +142,8 @@ public class UserController {
     @ApiOperation("删除用户")
     @DeleteMapping
     @PreAuthorize("@el.check('user:del')")
-    public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
-        for (Long id : ids) {
+    public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
+        for (String id : ids) {
             Integer currentLevel =  Collections.min(roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
             Integer optLevel =  Collections.min(roleService.findByUsersId(id).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
             if (currentLevel > optLevel) {
@@ -205,7 +205,7 @@ public class UserController {
     @ApiOperation("解绑用户")
     @PostMapping(value = "/unBindDmUser")
     @Log("解绑账号用户")
-    public ResponseEntity<Object> unBindDmUser(@RequestBody Set<Long> ids) throws Exception{
+    public ResponseEntity<Object> unBindDmUser(@RequestBody Set<String> ids) throws Exception{
         userService.unBindDmUser(ids);
         return new ResponseEntity<>(HttpStatus.OK);
     }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DataService.java

@@ -30,5 +30,5 @@ public interface DataService {
      * @param user /
      * @return /
      */
-    List<Long> getDeptIds(UserDto user);
+    List<String> getDeptIds(UserDto user);
 }

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java

@@ -55,7 +55,7 @@ public interface DeptService {
      * @param id /
      * @return /
      */
-    DeptDto findById(Long id);
+    DeptDto findById(String id);
 
     /**
      * 创建
@@ -81,14 +81,14 @@ public interface DeptService {
      * @param pid /
      * @return /
      */
-    List<Dept> findByPid(long pid);
+    List<Dept> findByPid(String pid);
 
     /**
      * 根据角色ID查询
      * @param id /
      * @return /
      */
-    Set<Dept> findByRoleId(Long id);
+    Set<Dept> findByRoleId(String id);
 
     /**
      * 导出数据
@@ -126,7 +126,7 @@ public interface DeptService {
      * @param deptList
      * @return
      */
-    List<Long> getDeptChildren(List<Dept> deptList);
+    List<String> getDeptChildren(List<Dept> deptList);
 
     /**
      * 验证是否被角色或用户关联

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/system/service/JobService.java

@@ -36,7 +36,7 @@ public interface JobService {
      * @param id /
      * @return /
      */
-    JobDto findById(Long id);
+    JobDto findById(String id);
 
     /**
      * 创建
@@ -55,7 +55,7 @@ public interface JobService {
      * 删除
      * @param ids /
      */
-    void delete(Set<Long> ids);
+    void delete(Set<String> ids);
 
     /**
      * 分页查询
@@ -84,5 +84,5 @@ public interface JobService {
      * 验证是否被用户关联
      * @param ids /
      */
-    void verification(Set<Long> ids);
+    void verification(Set<String> ids);
 }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/service/MenuService.java

@@ -121,5 +121,5 @@ public interface MenuService {
      * @param currentUserId /
      * @return /
      */
-    List<MenuDto> findByUser(Long currentUserId);
+    List<MenuDto> findByUser(String currentUserId);
 }

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/system/service/RoleService.java

@@ -44,7 +44,7 @@ public interface RoleService {
      * @param id /
      * @return /
      */
-    RoleDto findById(long id);
+    RoleDto findById(String id);
 
     /**
      * 创建
@@ -62,14 +62,14 @@ public interface RoleService {
      * 删除
      * @param ids /
      */
-    void delete(Set<Long> ids);
+    void delete(Set<String> ids);
 
     /**
      * 根据用户ID查询
      * @param id 用户ID
      * @return /
      */
-    List<RoleSmallDto> findByUsersId(Long id);
+    List<RoleSmallDto> findByUsersId(String id);
 
     /**
      * 根据角色查询角色级别
@@ -125,7 +125,7 @@ public interface RoleService {
      * 验证是否被用户关联
      * @param ids /
      */
-    void verification(Set<Long> ids);
+    void verification(Set<String> ids);
 
     /**
      * 根据菜单Id查询

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java

@@ -37,7 +37,7 @@ public interface UserService {
      * @param id ID
      * @return /
      */
-    UserDto findById(long id);
+    UserDto findById(String id);
 
     /**
      * 新增用户
@@ -55,7 +55,7 @@ public interface UserService {
      * 删除用户
      * @param ids /
      */
-    void delete(Set<Long> ids);
+    void delete(Set<String> ids);
 
     /**
      * 根据用户名查询
@@ -114,11 +114,11 @@ public interface UserService {
      */
     void updateCenter(User resources);
 
-    List<User> findByDmUserId(Long dmUserId,Long userId);
+    List<User> findByDmUserId(String dmUserId,String userId);
 
     /**
      * 解绑用户
      * @param ids
      */
-    void unBindDmUser(Set<Long> ids) throws Exception;
+    void unBindDmUser(Set<String> ids) throws Exception;
 }

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptDto.java

@@ -31,7 +31,7 @@ import java.util.Objects;
 @Setter
 public class DeptDto extends BaseDTO implements Serializable {
 
-    private Long id;
+    private String id;
 
     private String name;
 
@@ -46,7 +46,7 @@ public class DeptDto extends BaseDTO implements Serializable {
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private List<DeptDto> children;
 
-    private Long pid;
+    private String pid;
 
     private Integer subCount;
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptQueryCriteria.java

@@ -46,7 +46,7 @@ public class DeptQueryCriteria{
     private Boolean enabled;
 
     @Query
-    private Long pid;
+    private String pid;
 
     @Query(type = Query.Type.IS_NULL, propName = "pid")
     private Boolean pidIsNull;

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptSmallDto.java

@@ -25,7 +25,7 @@ import java.io.Serializable;
 @Data
 public class DeptSmallDto implements Serializable {
 
-    private Long id;
+    private String id;
 
     private String name;
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/JobDto.java

@@ -31,7 +31,7 @@ import java.io.Serializable;
 @NoArgsConstructor
 public class JobDto extends BaseDTO implements Serializable {
 
-    private Long id;
+    private String id;
 
     private Integer jobSort;
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleDto.java

@@ -30,7 +30,7 @@ import java.util.Set;
 @Setter
 public class RoleDto extends BaseDTO implements Serializable {
 
-    private Long id;
+    private String id;
 
     private String roleKey;
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleSmallDto.java

@@ -25,7 +25,7 @@ import java.io.Serializable;
 @Data
 public class RoleSmallDto implements Serializable {
 
-    private Long id;
+    private String id;
 
     private String name;
 

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java

@@ -36,7 +36,7 @@ import java.util.Set;
 @Setter
 public class UserDto extends BaseDTO implements Serializable {
 
-    private Long id;
+    private String id;
 
     private Set<RoleSmallDto> roles;
 
@@ -48,7 +48,7 @@ public class UserDto extends BaseDTO implements Serializable {
 
     private DmCompanyDto dmCompany;
 
-    private Long deptId;
+    private String deptId;
 
     private String username;
 

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserQueryCriteria.java

@@ -31,10 +31,10 @@ import java.util.Set;
 public class UserQueryCriteria implements Serializable {
 
     @Query
-    private Long id;
+    private String id;
 
     @Query(propName = "id", type = Query.Type.IN, joinName = "dept")
-    private Set<Long> deptIds = new HashSet<>();
+    private Set<String> deptIds = new HashSet<>();
 
     @Query(blurry = "email,username,nickName")
     private String blurry;
@@ -42,7 +42,7 @@ public class UserQueryCriteria implements Serializable {
     @Query
     private Boolean enabled;
 
-    private Long deptId;
+    private String deptId;
 
     @Query(type = Query.Type.BETWEEN)
     private List<Timestamp> createTime;

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DataServiceImpl.java

@@ -49,9 +49,9 @@ public class DataServiceImpl implements DataService {
      */
     @Override
     @Cacheable(key = "'user:' + #p0.id")
-    public List<Long> getDeptIds(UserDto user) {
+    public List<String> getDeptIds(UserDto user) {
         // 用于存储部门id
-        Set<Long> deptIds = new HashSet<>();
+        Set<String> deptIds = new HashSet<>();
         // 查询用户角色
         List<RoleSmallDto> roleSet = roleService.findByUsersId(user.getId());
         // 获取对应的部门ID
@@ -77,7 +77,7 @@ public class DataServiceImpl implements DataService {
      * @param role 角色
      * @return 数据权限ID
      */
-    public Set<Long> getCustomize(Set<Long> deptIds, RoleSmallDto role){
+    public Set<String> getCustomize(Set<String> deptIds, RoleSmallDto role){
         Set<Dept> depts = deptService.findByRoleId(role.getId());
         for (Dept dept : depts) {
             deptIds.add(dept.getId());

+ 10 - 10
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java

@@ -127,19 +127,19 @@ public class DeptServiceImpl implements DeptService {
 
     @Override
     @Cacheable(key = "'id:' + #p0")
-    public DeptDto findById(Long id) {
+    public DeptDto findById(String id) {
         Dept dept = deptRepository.findById(id).orElseGet(Dept::new);
         ValidationUtil.isNull(dept.getId(),"Dept","id",id);
         return deptMapper.toDto(dept);
     }
 
     @Override
-    public List<Dept> findByPid(long pid) {
+    public List<Dept> findByPid(String pid) {
         return deptRepository.findByPid(pid);
     }
 
     @Override
-    public Set<Dept> findByRoleId(Long id) {
+    public Set<Dept> findByRoleId(String id) {
         return deptRepository.findByRoleId(id);
     }
 
@@ -157,8 +157,8 @@ public class DeptServiceImpl implements DeptService {
     @Transactional(rollbackFor = Exception.class)
     public void update(Dept resources) {
         // 旧的部门
-        Long oldPid = findById(resources.getId()).getPid();
-        Long newPid = resources.getPid();
+        String oldPid = findById(resources.getId()).getPid();
+        String newPid = resources.getPid();
         if(resources.getPid() != null && resources.getId().equals(resources.getPid())) {
             throw new BadRequestException("上级不能为自己");
         }
@@ -228,8 +228,8 @@ public class DeptServiceImpl implements DeptService {
     }
 
     @Override
-    public List<Long> getDeptChildren(List<Dept> deptList) {
-        List<Long> list = new ArrayList<>();
+    public List<String> getDeptChildren(List<Dept> deptList) {
+        List<String> list = new ArrayList<>();
         deptList.forEach(dept -> {
                     if (dept!=null && dept.getEnabled()) {
                         List<Dept> depts = deptRepository.findByPid(dept.getId());
@@ -291,7 +291,7 @@ public class DeptServiceImpl implements DeptService {
 
     @Override
     public void verification(Set<DeptDto> deptDtos) {
-        Set<Long> deptIds = deptDtos.stream().map(DeptDto::getId).collect(Collectors.toSet());
+        Set<String> deptIds = deptDtos.stream().map(DeptDto::getId).collect(Collectors.toSet());
         if(userRepository.countByDepts(deptIds) > 0){
             throw new BadRequestException("所选部门存在用户关联,请解除后再试!");
         }
@@ -300,7 +300,7 @@ public class DeptServiceImpl implements DeptService {
         }
     }
 
-    private void updateSubCnt(Long deptId){
+    private void updateSubCnt(String deptId){
         if(deptId != null){
             int count = deptRepository.countByPid(deptId);
             deptRepository.updateSubCntById(count, deptId);
@@ -328,7 +328,7 @@ public class DeptServiceImpl implements DeptService {
      * 清理缓存
      * @param id /
      */
-    public void delCaches(Long id){
+    public void delCaches(String id){
         List<User> users = userRepository.findByRoleDeptId(id);
         // 删除数据权限
         redisUtils.delByKeys(CacheKey.DATA_USER, users.stream().map(User::getId).collect(Collectors.toSet()));

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java

@@ -65,7 +65,7 @@ public class JobServiceImpl implements JobService {
 
     @Override
     @Cacheable(key = "'id:' + #p0")
-    public JobDto findById(Long id) {
+    public JobDto findById(String id) {
         Job job = jobRepository.findById(id).orElseGet(Job::new);
         ValidationUtil.isNull(job.getId(),"Job","id",id);
         return jobMapper.toDto(job);
@@ -97,7 +97,7 @@ public class JobServiceImpl implements JobService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void delete(Set<Long> ids) {
+    public void delete(Set<String> ids) {
         jobRepository.deleteAllByIdIn(ids);
         // 删除缓存
         redisUtils.delByKeys(CacheKey.JOB_ID, ids);
@@ -117,7 +117,7 @@ public class JobServiceImpl implements JobService {
     }
 
     @Override
-    public void verification(Set<Long> ids) {
+    public void verification(Set<String> ids) {
         if(userRepository.countByJobs(ids) > 0){
             throw new BadRequestException("所选的岗位中存在用户关联,请解除关联再试!");
         }

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java

@@ -96,9 +96,9 @@ public class MenuServiceImpl implements MenuService {
      */
     @Override
     @Cacheable(key = "'user:' + #p0")
-    public List<MenuDto> findByUser(Long currentUserId) {
+    public List<MenuDto> findByUser(String currentUserId) {
         List<RoleSmallDto> roles = roleService.findByUsersId(currentUserId);
-        Set<Long> roleIds = roles.stream().map(RoleSmallDto::getId).collect(Collectors.toSet());
+        Set<String> roleIds = roles.stream().map(RoleSmallDto::getId).collect(Collectors.toSet());
         LinkedHashSet<Menu> menus = menuRepository.findByRoleIdsAndTypeNot(roleIds, 2);
         return menus.stream().map(menuMapper::toDto).collect(Collectors.toList());
     }

+ 7 - 7
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/RoleServiceImpl.java

@@ -84,7 +84,7 @@ public class RoleServiceImpl implements RoleService {
     @Override
     @Cacheable(key = "'id:' + #p0")
     @Transactional(rollbackFor = Exception.class)
-    public RoleDto findById(long id) {
+    public RoleDto findById(String id) {
         Role role = roleRepository.findById(id).orElseGet(Role::new);
         ValidationUtil.isNull(role.getId(), "Role", "id", id);
         return roleMapper.toDto(role);
@@ -144,8 +144,8 @@ public class RoleServiceImpl implements RoleService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void delete(Set<Long> ids) {
-        for (Long id : ids) {
+    public void delete(Set<String> ids) {
+        for (String id : ids) {
             // 更新相关缓存
             delCaches(id, null);
         }
@@ -153,7 +153,7 @@ public class RoleServiceImpl implements RoleService {
     }
 
     @Override
-    public List<RoleSmallDto> findByUsersId(Long id) {
+    public List<RoleSmallDto> findByUsersId(String id) {
         return roleSmallMapper.toDto(new ArrayList<>(roleRepository.findByUserId(id)));
     }
 
@@ -202,7 +202,7 @@ public class RoleServiceImpl implements RoleService {
     }
 
     @Override
-    public void verification(Set<Long> ids) {
+    public void verification(Set<String> ids) {
         if (userRepository.countByRoles(ids) > 0) {
             throw new BadRequestException("所选角色存在用户关联,请解除关联再试!");
         }
@@ -217,11 +217,11 @@ public class RoleServiceImpl implements RoleService {
      * 清理缓存
      * @param id /
      */
-    public void delCaches(Long id, List<User> users) {
+    public void delCaches(String id, List<User> users) {
         users = CollectionUtil.isEmpty(users) ? userRepository.findByRoleId(id) : users;
         if (CollectionUtil.isNotEmpty(users)) {
             users.forEach(item -> userCacheClean.cleanUserCache(item.getUsername()));
-            Set<Long> userIds = users.stream().map(User::getId).collect(Collectors.toSet());
+            Set<String> userIds = users.stream().map(User::getId).collect(Collectors.toSet());
             redisUtils.delByKeys(CacheKey.DATA_USER, userIds);
             redisUtils.delByKeys(CacheKey.MENU_USER, userIds);
             redisUtils.delByKeys(CacheKey.ROLE_AUTH, userIds);

+ 7 - 7
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java

@@ -85,7 +85,7 @@ public class UserServiceImpl implements UserService {
     @Override
     @Cacheable(key = "'id:' + #p0")
     @Transactional(rollbackFor = Exception.class)
-    public UserDto findById(long id) {
+    public UserDto findById(String id) {
         User user = userRepository.findById(id).orElseGet(User::new);
         ValidationUtil.isNull(user.getId(), "User", "id", id);
         return userMapper.toDto(user);
@@ -184,15 +184,15 @@ public class UserServiceImpl implements UserService {
     }
 
     @Override
-    public List<User> findByDmUserId(Long dmUserId,Long userId) {
+    public List<User> findByDmUserId(String dmUserId,String userId) {
         return userRepository.findByDmUserId(dmUserId,userId);
     }
 
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void delete(Set<Long> ids) {
-        for (Long id : ids) {
+    public void delete(Set<String> ids) {
+        for (String id : ids) {
             // 清理缓存
             UserDto user = findById(id);
             delCaches(user.getId(), user.getUsername());
@@ -268,7 +268,7 @@ public class UserServiceImpl implements UserService {
      *
      * @param id /
      */
-    public void delCaches(Long id, String username) {
+    public void delCaches(String id, String username) {
         redisUtils.del(CacheKey.USER_ID + id);
         flushCache(username);
     }
@@ -326,8 +326,8 @@ public class UserServiceImpl implements UserService {
      * 解绑用户
      * @param ids
      */
-    public void unBindDmUser(Set<Long> ids) throws Exception{
-        for(Long id: ids){
+    public void unBindDmUser(Set<String> ids) throws Exception{
+        for(String id: ids){
             //查询用户信息
            User user = userMapper.toEntity(findById(id));
            if(user != null){

+ 3 - 1
eladmin-system/src/main/resources/config/application-dev.yml

@@ -7,10 +7,12 @@ spring:
 #      url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:eladmin}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
 #      username: ${DB_USER:root}
 #      password: ${DB_PWD:123456}
-#      url: jdbc:log4jdbc:mysql://47.101.34.182:3306/dm_restaurant?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
       url: jdbc:log4jdbc:mysql://114.55.24.6:3308/dm_restaurant?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
       username: root
       password: shimao@123
+#      url: jdbc:log4jdbc:mysql://47.101.34.182:3306/dm_restaurant?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
+#      username: dev
+#      password: root
       # 初始连接数
       initial-size: 5
       # 最小连接数