提交 6dddac82 authored 作者: wyl's avatar wyl

合并分支 'wyl' 到 'master'

Wyl 查看合并请求 ty_wyl/adaptation-master1!59
......@@ -24,4 +24,9 @@ public class InspectController {
public ResponseEntity report(@PathVariable Integer id){
return ResponseEntity.ok(inspectService.getReportById(id));
}
@GetMapping("/print/{id}")
public ResponseEntity printReport(@PathVariable Integer id){
return ResponseEntity.ok(inspectService.getPrintReport(id));
}
}
......@@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
@Service
......@@ -147,4 +150,50 @@ public class InspectServiceImpl implements InspectService {
report.setJarPath(path);
return ServerResponse.success(report);
}
@Override
public ServerResponse getPrintReport(Integer id) {
ReportEntity one = reportDao.getOne(id);
//Project one1 = projectDao.getOne(id);
// Report report = new Report();
//
// List<PomDependency> allByReportIdEquals = pomDependencyDao.findAllByReportIdEquals(id);
// report.setId(one.getId());
// report.setDependencies(allByReportIdEquals);
// report.setDatabaseType(one.getDatabaseType());
// report.setLanguage(one.getLanguage());
// report.setPackagePath(one.getPackagePath());
// report.setCompileFilePath(one.getCompileFilePath());
// report.setDependenceManagement(one.getDependenceManagement());
// report.setFileNum(one.getFileNum());
// report.setLineNum(one.getLineNum());
// report.setFramework(one.getFramework());
// report.setIsSeparate(one.getIsSeparate());
// report.setCreateTime(one.getCreateTime());
//
// List<Inspector.Warn> warns = JSON.parseArray(one.getWarnList(), Inspector.Warn.class);
// report.setWarnList(warns);
//
// List<String> path = JSON.parseArray(one.getJarPath(), String.class);
// report.setJarPath(path);
String result = "评估报告------------"+
"\t评估时间:"+ new Date(one.getCreateTime())+//LocalDateTime.ofEpochSecond(one.getCreateTime(),0, ZoneOffset.ofHours(8))+
"\n系统名称:"+/*one1.getProjectName()+*/
"\n\n语言:"+one.getLanguage()+"\t"+
"\t架构:未知"+
"\t前后端分离:未知"+
"\n数据库类型:"+(one.getDatabaseType()==null?"未知":one.getDatabaseType())+
"\t文件数量:"+one.getFileNum()+
"\t代码行数:"+one.getLineNum();
StringBuilder stringBuilder = new StringBuilder(result);
List<Inspector.Warn> warns = JSON.parseArray(one.getWarnList(), Inspector.Warn.class);
int i = 1;
for(Inspector.Warn warn:warns){
stringBuilder.append("\n\n"+i+++"、所在文件:"+warn.getPath()+",行数:"+warn.getLine()+",关键字:"+warn.getKeyWord()+
"\n建议:"+warn.getSuggest());
}
System.out.println(stringBuilder.toString());
return ServerResponse.success(stringBuilder.toString());
}
}
......@@ -9,4 +9,6 @@ public interface InspectService {
ServerResponse inspect(Project projectId,String uuid);
ServerResponse getReportById(Integer id);
ServerResponse getPrintReport(Integer id);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论