提交 af7a9925 authored 作者: zhangshuang's avatar zhangshuang

Merge branch 'master' into 'zs'

# Conflicts: # src/main/java/com/zjty/adaptationmaster/adaptor/service/Impl/InspectServiceImpl.java
...@@ -24,8 +24,6 @@ public class ReportEntity { ...@@ -24,8 +24,6 @@ public class ReportEntity {
private Report.DatabaseType databaseType;//数据库类型 private Report.DatabaseType databaseType;//数据库类型
private int fileNum; private int fileNum;
private long lineNum; private long lineNum;
@Column(columnDefinition = "text")
private String dependence;
private Report.Separate isSeparate;//前后端是否分离 private Report.Separate isSeparate;//前后端是否分离
private String compileFilePath;//项目编译文件,如果是maven项目,用maven编译,那么就是pom.xml private String compileFilePath;//项目编译文件,如果是maven项目,用maven编译,那么就是pom.xml
public Report.DependenceManagement dependenceManagement;//版本管理方式 public Report.DependenceManagement dependenceManagement;//版本管理方式
......
...@@ -19,6 +19,7 @@ public class PomDependency { ...@@ -19,6 +19,7 @@ public class PomDependency {
private String groupId; private String groupId;
private String artifactId; private String artifactId;
private String version; private String version;
private Integer reportId;
/*依赖类型,默认类型是jar。它通常表示依赖的文件的扩展名,但也有例外。一个类型可以被映射成另外一个扩展 /*依赖类型,默认类型是jar。它通常表示依赖的文件的扩展名,但也有例外。一个类型可以被映射成另外一个扩展
名或分类器。类型经常和使用的打包方式对应,尽管这也有例外。一些类型的例子:jar,war,ejb-client和test-jar。 名或分类器。类型经常和使用的打包方式对应,尽管这也有例外。一些类型的例子:jar,war,ejb-client和test-jar。
如果设置extensions为 true,就可以在plugin里定义新的类型。所以前面的类型的例子不完整 如果设置extensions为 true,就可以在plugin里定义新的类型。所以前面的类型的例子不完整
......
package com.zjty.adaptationmaster.adaptor.repository;
import com.zjty.adaptationmaster.adaptor.entity.pomEntity.SecondFloor.Dependency;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface PomDependencyDao extends JpaRepository<Dependency,Integer> {
List<Dependency> findAllByReportIdEquals(Integer id);
}
...@@ -26,7 +26,8 @@ public class InspectServiceImpl implements InspectService { ...@@ -26,7 +26,8 @@ public class InspectServiceImpl implements InspectService {
private ProjectDao projectDao; private ProjectDao projectDao;
@Autowired @Autowired
private ReportDao reportDao; private ReportDao reportDao;
@Autowired
private PomDependencyDao pomDependencyDao;
@Transactional @Transactional
@Override @Override
...@@ -51,7 +52,6 @@ public class InspectServiceImpl implements InspectService { ...@@ -51,7 +52,6 @@ public class InspectServiceImpl implements InspectService {
reportEntity.setFramework(report.getFramework()); reportEntity.setFramework(report.getFramework());
reportEntity.setIsSeparate(report.getIsSeparate()); reportEntity.setIsSeparate(report.getIsSeparate());
reportEntity.setLanguage(report.getLanguage()); reportEntity.setLanguage(report.getLanguage());
reportEntity.setPackagePath(report.getPackagePath());
List<PomDependency> dependencies = report.getDependencies(); List<PomDependency> dependencies = report.getDependencies();
String s = JSON.toJSONString(dependencies); String s = JSON.toJSONString(dependencies);
...@@ -61,17 +61,19 @@ public class InspectServiceImpl implements InspectService { ...@@ -61,17 +61,19 @@ public class InspectServiceImpl implements InspectService {
List<String> jarPath = report.getJarPath(); List<String> jarPath = report.getJarPath();
String s2 = JSON.toJSONString(jarPath); String s2 = JSON.toJSONString(jarPath);
reportEntity.setJarPath(s2); reportEntity.setJarPath(s2);
reportEntity.setDependence(s);
if(report.getPackagePath() == null){ if(report.getPackagePath() == null){
report.setPackagePath(project.getCodeUrl()); reportEntity.setPackagePath(project.getCodeUrl());
} }
Project one = projectDao.getOne(project.getId());
ReportEntity reportEntitySave = reportDao.save(reportEntity); ReportEntity reportEntitySave = reportDao.save(reportEntity);
Project one = projectDao.getOne(project.getId());
List<Dependency> dependencies = report.getDependencies();
for (Dependency dependency : dependencies) {
dependency.setReportId(reportEntitySave.getId());
}
pomDependencyDao.saveAll(dependencies);
one.setReport(reportEntitySave); one.setReport(reportEntitySave);
report.setId(reportEntitySave.getId()); return ServerResponse.success(reportEntitySave);
return ServerResponse.success(report);
}else{ }else{
return ServerResponse.error("未上传源代码"); return ServerResponse.error("未上传源代码");
} }
...@@ -81,6 +83,8 @@ public class InspectServiceImpl implements InspectService { ...@@ -81,6 +83,8 @@ public class InspectServiceImpl implements InspectService {
public Report getReportById(Integer id) { public Report getReportById(Integer id) {
ReportEntity one = reportDao.getOne(id); ReportEntity one = reportDao.getOne(id);
Report report = new Report(); Report report = new Report();
List<Dependency> allByReportIdEquals = pomDependencyDao.findAllByReportIdEquals(id);
report.setId(one.getId()); report.setId(one.getId());
List<PomDependency> dependencies = JSON.parseArray(one.getDependence(), PomDependency.class); List<PomDependency> dependencies = JSON.parseArray(one.getDependence(), PomDependency.class);
report.setDependencies(dependencies); report.setDependencies(dependencies);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论