Commit 2974b9d9 authored by June's avatar June

v3- fix bug

parent 1b2faeeb
...@@ -12,6 +12,7 @@ import org.springframework.data.mongodb.core.index.CompoundIndexes; ...@@ -12,6 +12,7 @@ import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
/** /**
* 运动锻炼库
* @description: 运动锻炼库do * @description: 运动锻炼库do
* @author: zyj * @author: zyj
* @email: zhaoyujie@jiankangyouyi.com * @email: zhaoyujie@jiankangyouyi.com
......
...@@ -18,6 +18,8 @@ import java.util.Date; ...@@ -18,6 +18,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 封面配置表
*
* @author :wangyalei * @author :wangyalei
* @date :Created in 2021/7/12 6:39 下午 * @date :Created in 2021/7/12 6:39 下午
*/ */
......
...@@ -14,6 +14,8 @@ import org.springframework.format.annotation.DateTimeFormat; ...@@ -14,6 +14,8 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
/** /**
* 休息动作配置表
*
* @author :wangyalei * @author :wangyalei
* @date :Created in 2021/6/3 1:39 下午 * @date :Created in 2021/6/3 1:39 下午
*/ */
......
package com.jiankangyouyi.cloud.basedata.model.entity.mongo.article; package com.jiankangyouyi.cloud.basedata.model.entity.mongo.article;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jiankangyouyi.cloud.basedata.api.enums.food.AuditStatusValidEnum;
import com.jiankangyouyi.cloud.basedata.api.model.entity.article.ArticleInfo; import com.jiankangyouyi.cloud.basedata.api.model.entity.article.ArticleInfo;
import com.jiankangyouyi.cloud.core.base.enums.ValidStatusEnum; import com.jiankangyouyi.cloud.core.base.enums.ValidStatusEnum;
import com.jiankangyouyi.cloud.core.validator.annotation.EnumHC;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
...@@ -14,17 +11,12 @@ import org.springframework.data.annotation.Version; ...@@ -14,17 +11,12 @@ import org.springframework.data.annotation.Version;
import org.springframework.data.mongodb.core.index.CompoundIndex; import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes; import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Stack;
/** /**
* @description: 文章库do * 文章库
*
* @author: zyj * @author: zyj
* @email: zhaoyujie@jiankangyouyi.com * @email: zhaoyujie@jiankangyouyi.com
* @date: 2021/10/25 9:53 上午 * @date: 2021/10/25 9:53 上午
......
...@@ -3,7 +3,6 @@ package com.jiankangyouyi.cloud.data.center.model.entity.mongo; ...@@ -3,7 +3,6 @@ package com.jiankangyouyi.cloud.data.center.model.entity.mongo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.jiankangyouyi.cloud.data.center.model.entity.mongo.component.AppUserHealthProblem; import com.jiankangyouyi.cloud.data.center.model.entity.mongo.component.AppUserHealthProblem;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex; import org.springframework.data.mongodb.core.index.CompoundIndex;
...@@ -80,7 +79,7 @@ public class AppUserHealthProblemDO implements Serializable { ...@@ -80,7 +79,7 @@ public class AppUserHealthProblemDO implements Serializable {
private String recordId; private String recordId;
/** /**
* NOT NULL 健康问题 * 健康问题
*/ */
private List<AppUserHealthProblem> healthProblems; private List<AppUserHealthProblem> healthProblems;
......
...@@ -8,8 +8,6 @@ import lombok.Data; ...@@ -8,8 +8,6 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
...@@ -17,6 +15,8 @@ import java.io.Serializable; ...@@ -17,6 +15,8 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 分词词典表,语音记录时,用于分词的字典数据
*
* @author jingpeng * @author jingpeng
* @description 分词词典表,语音记录时,用于分词的字典数据 * @description 分词词典表,语音记录时,用于分词的字典数据
* @date 2020/11/2 * @date 2020/11/2
......
...@@ -18,6 +18,8 @@ import java.io.Serializable; ...@@ -18,6 +18,8 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 自定义运动表
*
* @author jingpeng * @author jingpeng
* @description 自定义运动表DO * @description 自定义运动表DO
* @date 2020/11/2 * @date 2020/11/2
......
...@@ -18,6 +18,7 @@ import java.io.Serializable; ...@@ -18,6 +18,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 自定义食物表
* @author jingpeng * @author jingpeng
* @description 自定义食物表 * @description 自定义食物表
* @date 2020/11/2 * @date 2020/11/2
......
...@@ -28,6 +28,8 @@ import java.util.List; ...@@ -28,6 +28,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 能量平衡计划表
*
* @description: 能量平衡计划do * @description: 能量平衡计划do
* @author: zyj * @author: zyj
* @email: zhaoyujie@jiankangyouyi.com * @email: zhaoyujie@jiankangyouyi.com
......
...@@ -23,6 +23,8 @@ import java.util.Date; ...@@ -23,6 +23,8 @@ import java.util.Date;
/** /**
* 配餐结果信息
*
* @description: 配餐结果do * @description: 配餐结果do
* @author: zyj * @author: zyj
* @email: zhaoyujie@jiankangyouyi.com * @email: zhaoyujie@jiankangyouyi.com
......
...@@ -13,7 +13,7 @@ import org.springframework.data.mongodb.core.mapping.Document; ...@@ -13,7 +13,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
/** /**
* @description: 配餐结果do * 配餐结果信息
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
......
...@@ -5,7 +5,6 @@ import com.june.entitytodbdoc.utils.FileUtils; ...@@ -5,7 +5,6 @@ import com.june.entitytodbdoc.utils.FileUtils;
import com.june.entitytodbdoc.utils.GetClassCommentUtils; import com.june.entitytodbdoc.utils.GetClassCommentUtils;
import com.june.entitytodbdoc.utils.MarkdownUtils; import com.june.entitytodbdoc.utils.MarkdownUtils;
import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -19,10 +18,10 @@ import java.util.stream.Collectors; ...@@ -19,10 +18,10 @@ import java.util.stream.Collectors;
public class Starter { public class Starter {
public static void main(String[] args) { public static void main(String[] args) {
// String beanFilePath = String beanFilePath =
// "D:\\work\\idea\\june\\entity-to-db-doc\\entity-to-db-doc\\src\\main\\java\\com\\jiankangyouyi\\cloud"; "D:\\work\\idea\\june\\entity-to-db-doc\\entity-to-db-doc\\src\\main\\java\\com\\jiankangyouyi\\cloud";
// List<String> javaFilePaths = FileUtils.findJavaFilePaths(beanFilePath); List<String> javaFilePaths = FileUtils.findJavaFilePaths(beanFilePath);
List<String> javaFilePaths = Arrays.asList("D:\\work\\idea\\june\\entity-to-db-doc\\entity-to-db-doc\\src\\main\\java\\com\\jiankangyouyi\\cloud\\motorplan\\model\\entity\\mongo\\ExerciseCoursePlanDO.java"); // List<String> javaFilePaths = Arrays.asList("D:\\work\\idea\\june\\entity-to-db-doc\\entity-to-db-doc\\src\\main\\java\\com\\jiankangyouyi\\cloud\\motorplan\\model\\entity\\mongo\\ExerciseCourseProjectGlobalConfigDO.java");
// 获取所有的 markdown 内容 // 获取所有的 markdown 内容
List<String> resultContentList = javaFilePaths List<String> resultContentList = javaFilePaths
.parallelStream().map(GetClassCommentUtils::execute) .parallelStream().map(GetClassCommentUtils::execute)
......
...@@ -60,6 +60,9 @@ public class GetClassCommentUtils { ...@@ -60,6 +60,9 @@ public class GetClassCommentUtils {
} }
private static ClassDoc getClassDoc(String beanFilePath){ private static ClassDoc getClassDoc(String beanFilePath){
if (beanFilePath.contains("$")) {
return getInnerClassDoc(beanFilePath);
}
Main.execute(new String[]{"-doclet", GetClassCommentUtils.class.getName(), "-docletpath", Main.execute(new String[]{"-doclet", GetClassCommentUtils.class.getName(), "-docletpath",
Objects.requireNonNull(GetClassCommentUtils.class.getResource("/")).getPath(), "-encoding", "utf-8", beanFilePath}); Objects.requireNonNull(GetClassCommentUtils.class.getResource("/")).getPath(), "-encoding", "utf-8", beanFilePath});
...@@ -108,6 +111,9 @@ public class GetClassCommentUtils { ...@@ -108,6 +111,9 @@ public class GetClassCommentUtils {
} }
private static void handleField(ClassDoc classDoc, List<DocumentInfoDTO.FieldInfoDTO> fieldInfoDTOList) { private static void handleField(ClassDoc classDoc, List<DocumentInfoDTO.FieldInfoDTO> fieldInfoDTOList) {
if (Objects.isNull(classDoc)) {
return;
}
// 获取属性名称和注释 // 获取属性名称和注释
FieldDoc[] fields = classDoc.fields(false); FieldDoc[] fields = classDoc.fields(false);
doHandleField(fieldInfoDTOList, fields, classDoc.qualifiedName()); doHandleField(fieldInfoDTOList, fields, classDoc.qualifiedName());
...@@ -130,6 +136,15 @@ public class GetClassCommentUtils { ...@@ -130,6 +136,15 @@ public class GetClassCommentUtils {
} }
if (fieldClassFullName.endsWith("ArticleOptionInfo")) { if (fieldClassFullName.endsWith("ArticleOptionInfo")) {
fieldInfoDTO.setChildrenFieldList(getArticleOptionInfoFieldInfo()); fieldInfoDTO.setChildrenFieldList(getArticleOptionInfoFieldInfo());
} else if (fieldClassFullName.contains("$")) {
// 是否内部类
String inJarClassPath = JarPathAndPackageMapping.getInJarClassPath(fieldClassFullName);
if (StringUtils.isNotBlank(inJarClassPath)) {
ClassDoc innerClassDoc = getInnerClassDoc(inJarClassPath);
List<DocumentInfoDTO.FieldInfoDTO> children = new LinkedList<>();
handleField(innerClassDoc, children);
fieldInfoDTO.setChildrenFieldList(children);
}
} else if (isSelfClass(fieldClassFullName)) { } else if (isSelfClass(fieldClassFullName)) {
List<DocumentInfoDTO.FieldInfoDTO> children = new LinkedList<>(); List<DocumentInfoDTO.FieldInfoDTO> children = new LinkedList<>();
handleField(getRealClassDoc(field.type().asClassDoc()), children); handleField(getRealClassDoc(field.type().asClassDoc()), children);
...@@ -139,7 +154,7 @@ public class GetClassCommentUtils { ...@@ -139,7 +154,7 @@ public class GetClassCommentUtils {
String genericsType = ClassUtils.getGenericsType(classFullName, field.name()); String genericsType = ClassUtils.getGenericsType(classFullName, field.name());
if (StringUtils.isNotBlank(genericsType)) { if (StringUtils.isNotBlank(genericsType)) {
// 设置当前字段的字段类型 // 设置当前字段的字段类型
fieldInfoDTO.setFieldType(String.format("%s&lt;%s&gt;", fieldInfoDTO.getFieldType(), genericsType.substring(genericsType.lastIndexOf(".") + 1))); fieldInfoDTO.setFieldType(String.format("%s&lt;%s&gt;", fieldInfoDTO.getFieldType(), genericsType.replace("$", ".").substring(genericsType.lastIndexOf(".") + 1)));
if (isSelfClass(genericsType)) { if (isSelfClass(genericsType)) {
getRealClassDoc(genericsType).ifPresent(fieldDoc -> { getRealClassDoc(genericsType).ifPresent(fieldDoc -> {
List<DocumentInfoDTO.FieldInfoDTO> children = new LinkedList<>(); List<DocumentInfoDTO.FieldInfoDTO> children = new LinkedList<>();
...@@ -172,10 +187,23 @@ public class GetClassCommentUtils { ...@@ -172,10 +187,23 @@ public class GetClassCommentUtils {
private static String getFirstLineComment(String comment) { private static String getFirstLineComment(String comment) {
if (!comment.contains("\n")) { String commentFinal = !comment.contains("\n")
return comment.replace("\n", ""); ? comment.replace("\n", "") : comment.substring(0, comment.indexOf("\n"));
return replaceLink(commentFinal);
}
public static String replaceLink(String input) {
if (input.contains("{@link")) {
int index = input.indexOf("{@link");
input = input.substring(0, index).trim();
} }
return comment.substring(0, comment.indexOf("\n")); return input;
}
public static void main(String[] args) {
System.out.println(replaceLink("动作禁忌类型 {@link com.jiankangyouyi.cloud.basedata.api.enums.action.ActionFeatureEnum} "));
} }
/** /**
......
...@@ -55,7 +55,7 @@ public class JarPathAndPackageMapping { ...@@ -55,7 +55,7 @@ public class JarPathAndPackageMapping {
if (file.exists()) { if (file.exists()) {
return file.getAbsolutePath(); return file.getAbsolutePath();
} }
return null; return file.getPath();
} }
private static String packageToPath(String packageName){ private static String packageToPath(String packageName){
......
...@@ -28,7 +28,7 @@ public class MarkdownUtils { ...@@ -28,7 +28,7 @@ public class MarkdownUtils {
// 返回的列表 // 返回的列表
List<String> contentList = new LinkedList<>(); List<String> contentList = new LinkedList<>();
// 获取 title // 获取 title
contentList.add(getDocumentTitle(document, 2)); contentList.add(getDocumentTitle(document, 1));
List<DocumentInfoDTO.FieldInfoDTO> fieldList = document.getFieldList(); List<DocumentInfoDTO.FieldInfoDTO> fieldList = document.getFieldList();
if (CollectionUtils.isEmpty(fieldList)) { if (CollectionUtils.isEmpty(fieldList)) {
return contentList; return contentList;
...@@ -64,9 +64,31 @@ public class MarkdownUtils { ...@@ -64,9 +64,31 @@ public class MarkdownUtils {
} }
private static List<String> CAN_NOT_IN_TITLE_NAMES = Arrays.asList( private static List<String> CAN_NOT_IN_TITLE_NAMES = Arrays.asList(
",可以为空" ",可以为空",
"(运动v2.4新增,之前的数据没有该字段信息,用到时需做兼容或特殊处理)",
",(多个选择器为OR关系,顺序匹配),未返回下一题选择器,表示问卷结束",
"多个之间为or关系",
"此表只有一条数据 (似乎有点鸡肋 0.0``)",
"对象,foodProperty为1时不为空",
"对象,foodProperty为2时不为空",
"当 训练动作组合 bmi 条件 为空时 有值",
"--TODO 先按照步数热量分析",
"当 热身动作BMI 条件 为空时 有值",
"当 拉伸动作 bmi 条件 为空时 有值",
"-换一换之后才有",
"-NOT NULL ",
"NOT NULL",
"NULL ",
"NULL",
"当前视频信息是动作视频时有值"
); );
/**
* 获取标题名字
*
* @param titleName 标题名称
* @return {@link String}
*/
private static String getTitleName(String titleName) { private static String getTitleName(String titleName) {
for (String canNotInTitleName : CAN_NOT_IN_TITLE_NAMES) { for (String canNotInTitleName : CAN_NOT_IN_TITLE_NAMES) {
if (titleName.contains(canNotInTitleName)) { if (titleName.contains(canNotInTitleName)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment