Преглед изворни кода

chore: auto bump version and changelog [skip ci]

iwt пре 2 месеци
родитељ
комит
1497ff3491

+ 3 - 3
cfc-backend/src/main/java/com/etotem/cfc/service/DataMigrationService.java

@@ -198,7 +198,7 @@ public class DataMigrationService implements DataMigrationServiceInterface {
                 user.setOpenid(openid + "_parent");
                 user.setFamilyId(familyId);
                 user.setRole("parent");
-                user.setRoles("[\"parent\"]");
+                user.setRoles(java.util.Arrays.asList("parent"));
                 user.setNickname(parentName != null ? parentName : phone);
                 user.setPhone(phone);
                 user.setRealName(parentName);
@@ -290,7 +290,7 @@ public class DataMigrationService implements DataMigrationServiceInterface {
                     childUser.setOpenid(childOpenid);
                     childUser.setFamilyId(familyId);
                     childUser.setRole("child");
-                    childUser.setRoles("[\"child\"]");
+                    childUser.setRoles(java.util.Arrays.asList("child"));
                     childUser.setNickname((String) row.get("name"));
                     childUser.setPhone(phone);
                     childUser.setIdCard((String) row.get("social_no"));
@@ -371,7 +371,7 @@ public class DataMigrationService implements DataMigrationServiceInterface {
                     user.setOpenid(openidKey);
                     user.setFamilyId(0L);
                     user.setRole("teacher");
-                    user.setRoles("[\"teacher\"]");
+                    user.setRoles(java.util.Arrays.asList("teacher"));
                     user.setNickname((String) row.get("user_name"));
                     user.setTeacherNo((String) row.get("dept_bm"));
                     user.setTeacherStatus("approved");

+ 2 - 10
cfc-backend/src/main/java/com/etotem/cfc/service/EnergyService.java

@@ -1088,18 +1088,10 @@ public class EnergyService {
         if (user.getRole() != null && "parent".equals(user.getRole())) {
             return true;
         }
-        String rolesStr = user.getRoles();
-        if (rolesStr == null || rolesStr.isEmpty()) {
+        if (user.getRoles() == null || user.getRoles().isEmpty()) {
             return false;
         }
-        String normalized = rolesStr.replace("[", "").replace("]", "")
-                .replace("\"", "").replace(" ", "");
-        for (String r : normalized.split(",")) {
-            if ("parent".equals(r.trim())) {
-                return true;
-            }
-        }
-        return false;
+        return user.getRoles().contains("parent");
     }
 
     private EnergySandboxDTO buildEmptyDTO() {

+ 6 - 42
cfc-backend/src/main/java/com/etotem/cfc/service/UserService.java

@@ -628,7 +628,7 @@ private FamilyInvitationService familyInvitationService;
         if (user == null) {
             return new ArrayList<>();
         }
-        return parseRoles(user.getRoles());
+        return user.getRoles() != null ? user.getRoles() : new ArrayList<>();
     }
 
     /**
@@ -652,16 +652,14 @@ private FamilyInvitationService familyInvitationService;
         }
         // 如果用户还没有roles字段,设置默认值
         if (user.getRoles() == null || user.getRoles().isEmpty()) {
-            user.setRoles(user.getRole()); // 当前角色作为第一个角色
+            user.setRoles(java.util.Collections.singletonList(user.getRole()));
         }
         // 检查是否已拥有该角色
         if (hasRole(user, newRole)) {
             return true; // 已有该角色
         }
         // 添加新角色
-        List<String> roleList = parseRoles(user.getRoles());
-        roleList.add(newRole);
-        user.setRoles(joinRoles(roleList));
+        user.getRoles().add(newRole);
         user.setUpdatedAt(new Date());
         userMapper.updateById(user);
         return true;
@@ -671,47 +669,13 @@ private FamilyInvitationService familyInvitationService;
      * 检查用户是否拥有指定角色 (内部方法)
      */
     private boolean hasRole(User user, String role) {
-        List<String> roles = parseRoles(user.getRoles());
+        List<String> roles = user.getRoles();
         return roles.contains(role);
     }
 
-    /**
-     * 解析角色字符串为列表
-     */
-    public List<String> parseRoles(String rolesStr) {
-        List<String> result = new ArrayList<>();
-        if (rolesStr == null || rolesStr.isEmpty()) {
-            return result;
-        }
-        // 支持JSON数组格式或逗号分隔格式
-        if (rolesStr.startsWith("[")) {
-            // JSON格式解析
-            rolesStr = rolesStr.replace("[", "").replace("]", "")
-                    .replace("\"", "").replace(" ", "");
-            String[] arr = rolesStr.split(",");
-            for (String r : arr) {
-                if (!r.isEmpty()) {
-                    result.add(r.trim());
-                }
-            }
-        } else {
-            // 逗号分隔格式
-            String[] arr = rolesStr.split(",");
-            for (String r : arr) {
-                if (!r.trim().isEmpty()) {
-                    result.add(r.trim());
-                }
-            }
-        }
-        return result;
-    }
 
-    /**
-     * 将角色列表转换为字符串
-     */
-    private String joinRoles(List<String> roles) {
-        return String.join(",", roles);
-    }
+
+
 
     /**
      * 检查角色是否有效

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/impl/ServiceRoleApplicationServiceImpl.java

@@ -41,7 +41,7 @@ public class ServiceRoleApplicationServiceImpl
 
         ServiceRoleApplication app = new ServiceRoleApplication();
         app.setUserId(userId);
-        app.setRoles(JSON.toJSONString(dto.getRoles()));
+        app.setRoles(dto.getRoles());
         app.setIdCard(dto.getIdCard());
         app.setIdCardImages(dto.getIdCardImages() != null ? JSON.toJSONString(dto.getIdCardImages()) : null);
         app.setCertificateImages(dto.getCertificateImages() != null ? JSON.toJSONString(dto.getCertificateImages()) : null);
@@ -81,7 +81,7 @@ public class ServiceRoleApplicationServiceImpl
         app.setReviewedAt(LocalDateTime.now());
         this.updateById(app);
 
-        List<String> roles = JSON.parseArray(app.getRoles(), String.class);
+        List<String> roles = app.getRoles();
         User user = userMapper.selectById(app.getUserId());
 
         for (String role : roles) {

+ 1 - 1
cfc-web/.last_build_commit

@@ -1 +1 @@
-b5bdd8031d5b157214e3ab8c1f9d478c35281acb
+9e50c3495f24b184c07660e03eb1db5535b0bf66

+ 2 - 2
cfc-web/package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "cfc-web",
-  "version": "1.0.938",
+  "version": "1.0.939",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "cfc-web",
-      "version": "1.0.938",
+      "version": "1.0.939",
       "dependencies": {
         "@wangeditor/editor": "^5.1.23",
         "@wangeditor/editor-for-vue": "^1.0.2",

+ 1 - 1
cfc-web/package.json

@@ -1,6 +1,6 @@
 {
   "name": "cfc-web",
-  "version": "1.0.939",
+  "version": "1.0.940",
   "private": true,
   "scripts": {
     "dev": "vue-cli-service serve",

+ 17 - 0
cfc-web/public/CHANGELOG-v1.0.md

@@ -4,6 +4,23 @@
 
 ---
 
+## v1.0.940 (2026-08-10)
+
+### 文档
+- 知识库菌-疾病关联表格新增问题相关性/证据强度列
+
+### 其他
+- Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
+- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
+- 
+- Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
+- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
+- 
+
+### 新功能
+- 菌群知识库6疾病相关菌新增问题相关性/证据强度
+
+
 ## v1.0.939 (2026-08-10)
 
 ### Bug 修复

+ 18 - 1
cfc-web/public/CHANGELOG.md

@@ -1,6 +1,6 @@
 # 更新日志
 
-> 当前版本: v1.0.939
+> 当前版本: v1.0.940
 
 ## 历史版本
 
@@ -8,6 +8,23 @@
 
 ---
 
+## v1.0.940 (2026-08-10)
+
+### 文档
+- 知识库菌-疾病关联表格新增问题相关性/证据强度列
+
+### 其他
+- Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
+- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
+- 
+- Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
+- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
+- 
+
+### 新功能
+- 菌群知识库6疾病相关菌新增问题相关性/证据强度
+
+
 ## v1.0.939 (2026-08-10)
 
 ### Bug 修复