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

fix:多机构同步权限数据混乱错误

caozixuan 3 лет назад
Родитель
Сommit
eb8abb353a

+ 10 - 5
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.teachcloud.common.service.impl;
 
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ZipUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -29,6 +30,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.tomcat.util.http.fileupload.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -348,14 +350,17 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
                 throw ExceptionResultEnum.ERROR.exception("未找到学校信息");
             }
             for (SysPrivilege sysPrivilege : sysPrivileges) {
+                SysPrivilege cell = new SysPrivilege();
+                BeanUtils.copyProperties(sysPrivilege,cell);
                 Long id = SystemConstant.getDbUuid();
-                map.put(sysPrivilege.getId(), id);
-                sysPrivilege.setId(id);
-                sysPrivilege.setSchoolId(newSchoolId);
-                sysPrivilege.setEnable(basicSchool.getEnable());
-                newList.add(sysPrivilege);
+                map.put(cell.getId(), id);
+                cell.setId(id);
+                cell.setSchoolId(newSchoolId);
+                cell.setEnable(basicSchool.getEnable());
+                newList.add(cell);
             }
         }
+        System.out.println(JSON.toJSONString(newList));
         for (SysPrivilege sysPrivilege : newList) {
             if (Objects.nonNull(sysPrivilege.getParentId())) {
                 sysPrivilege.setParentId(map.get(sysPrivilege.getParentId()));