提交 62176287 authored 作者: 孙洁清's avatar 孙洁清

关键技术接口根据name查询功能

上级 48d23b1e
...@@ -80,20 +80,26 @@ public class InspectController { ...@@ -80,20 +80,26 @@ public class InspectController {
reportVo.setSourceAddress(file.getCanonicalPath()); reportVo.setSourceAddress(file.getCanonicalPath());
ReportVo inspect = inspectService.inspect(reportVo,inspectParameter); ReportVo inspect = inspectService.inspect(reportVo,inspectParameter);
// Map map=new HashMap(); Map map=new HashMap();
// map.put("inspect",inspect); map.put("inspect",inspect);
// map.put("time",TimeUtil.getTime()); map.put("time",TimeUtil.getTime());
// HashMap<String, List<Warn>> warnMap = inspect.getWarnDetails(); HashMap<String, List<Warn>> warnMap = inspect.getWarnDetails();
// List<Technology> technologies = inspect.getTechnologies(); List<Technology> technologies = inspect.getTechnologies();
// map.put("warnMap",warnMap); Map techMap=new HashMap();
// map.put("technologies",technologies); for (Technology technology : technologies) {
// try { techMap.put(technology.getTechnologyName(),technology.getSupport());
// String template = FreemarkerUtils.getTemplate("pg.ftl", map); }
// String s = inspectService.generateHtml(template, map); map.put("techMap",techMap);
// System.out.println("内容"+s); map.put("warnMap",warnMap);
// } catch (TemplateException e) { map.put("technologies",technologies);
// e.printStackTrace(); try {
// } String template = FreemarkerUtils.getTemplate("pg.ftl", map);
String s = inspectService.generateHtml(template, map);
FileUtil.write(s,"/opt/pgbg/"+fileName+".html");
System.out.println("内容"+s);
} catch (TemplateException e) {
e.printStackTrace();
}
return ResponseEntity.ok(inspect); return ResponseEntity.ok(inspect);
} }
......
package com.zjty.inspect.entity; package com.zjty.inspect.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class Category { public class Category {
@Id @Id
@Column(length = 48) @Column(length = 48)
......
package com.zjty.inspect.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class Config {
@Id
@Column(length = 48)
private String id;
private String name;
private String value;
private String type;
private String des;
private String arrs;
}
...@@ -9,9 +9,7 @@ import org.dom4j.Document; ...@@ -9,9 +9,7 @@ import org.dom4j.Document;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -113,16 +111,61 @@ public class FileUtil { ...@@ -113,16 +111,61 @@ public class FileUtil {
log.error("unpack rar file fail....", e.getMessage(), e); log.error("unpack rar file fail....", e.getMessage(), e);
} }
} }
/**
* 将内容写人文件中
* @param content 写入内容
* @param path 文件路径(如:F:/a/b/test.txt)
*/
public static void write(String content, String path) {
// 检测文件夹是否存在,不存在则创建文件夹和文件
createFile(path);
FileWriter writer = null;
try {
writer = new FileWriter(path);
writer.write(content);
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 创建文件
* @param path 文件路径
* @return 文件路径(如:F:/a/b/test.txt)
*/
private static File createFile(String path) {
// 创建文件夹
if (path.contains("/")) {
String[] split = path.split("/");
String fileName = split[split.length-1];
String dirPath = path.replace(fileName, "");
File dir = new File(dirPath);
if (!dir.exists()) {
dir.mkdirs();
}
}
File file = new File(path);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
return file;
}
public static void main(String[] args) throws IOException {
System.out.println(LocalDate.now().toString());
String[] split1 = UUIDUtil.getUUID().split("-");
System.out.println(split1[0]);
// FileUtil.unPackZip(new File("/Users/mcj/Downloads/acq-server.zip"),"", "./");
//FileUtils.deleteDirectory(new File("./acq-server"));
SAXReader reader = new SAXReader();
Document document = null;
public static void main(String[] args) throws IOException {
// System.out.println(LocalDate.now().toString());
// String[] split1 = UUIDUtil.getUUID().split("-");
// System.out.println(split1[0]);
// // FileUtil.unPackZip(new File("/Users/mcj/Downloads/acq-server.zip"),"", "./");
// //FileUtils.deleteDirectory(new File("./acq-server"));
// SAXReader reader = new SAXReader();
// Document document = null;
write("hello","E://test//text.txt");
} }
} }
...@@ -123,20 +123,20 @@ ...@@ -123,20 +123,20 @@
<p class="detailContentT">应用系统信创评估详情</p> <p class="detailContentT">应用系统信创评估详情</p>
<div class="systemName"> <div class="systemName">
<img src="./img/system.png" alt=""> <img src="./img/system.png" alt="">
<div class="nav-title">系统名称:<span>${inspect.projectName}</span></div> <div class="nav-title">系统名称:<span>${inspect.projectName?default("")}</span></div>
<div class="nav-time">评估时间:<span>${time}</span></div> <div class="nav-time">评估时间:<span>${time?default("")}</span></div>
<div class="clearfloat"></div> <div class="clearfloat"></div>
<div class="line"></div> <div class="line"></div>
<div class="systemNameCon"> <div class="systemNameCon">
<div>编号:<span>${inspect.id}</span></div> <div>编号:<span>${inspect.id?default("")}</span></div>
<div>上传类型:<span>${inspect.uploadType}</span></div> <div>上传类型:<span>${inspect.uploadType?default("")}</span></div>
<div>文件名:<span><#if (inspect.fileName)??></#if></span></div> <div>文件名:<span>${inspect.fileName?default("")}</span></div>
<div>架构:<span><#if (inspect.framework)??></#if></span></div> <div>架构:<span>${inspect.framework?default("")}</span></div>
</div> </div>
<div class="systemNameCon"> <div class="systemNameCon">
<div>数据库类型:<span><#if (inspect.databaseType)??></#if></span></div> <div>数据库类型:<span>${inspect.databaseType?default("")}</span></div>
<div>依赖管理工具:<span><#if(inspect.manager)??></#if></span></div> <div>依赖管理工具:<span>${inspect.manager?default("")}</span></div>
<div>语言: <span>${inspect.language}</span></div> <div>语言: <span>${inspect.language?default("")}</span></div>
<div></div> <div></div>
</div> </div>
<div class="systemNameCon"> <div class="systemNameCon">
...@@ -145,15 +145,22 @@ ...@@ -145,15 +145,22 @@
</div> </div>
<div class="keyTec"> <div class="keyTec">
<#if warnDetails??>
<#list technologies as tech> <#assign keys=warnMap?keys/>
<#assign warns= warnMap[tech.technologyName]/> <#list keys as key>
<#assign warns= warnMap[key]/>
<div class="first"> <div class="first">
<div class="first-title"> <div class="first-title">
<img src="./img/key.png" alt=""> <img src="./img/key.png" alt="">
<div class="nav-title key-title">关键技术:<span>${tech.technologyName}(${tech.support}<#if tech.support==1>支持国产化)<span>不需要替换</span><#elseif tech.support==2>不支持国产化)<span>需替换</span><#elseif tech.support==3>未知<#elseif tech.support==4>不完全支持国产化)<span>需替换</span></#if></span> </div> <div class="nav-title
<#if techMap[key]==1>
keySecond-title
<#elseif techMap[key]==2>
key-title
<#else>
keyThird-title
</#if>">关键技术:<span>${key?default("")} </div>
<div class="rightPic"> <div class="rightPic">
<img onclick="showDiv()" id="pic" src="./img/down.png" alt=""> <img onclick="showDiv()" id="pic" src="./img/down.png" alt="">
</div> </div>
...@@ -168,10 +175,28 @@ ...@@ -168,10 +175,28 @@
<th>行数</th> <th>行数</th>
</tr> </tr>
<#list warns as warn> <#list warns as warn>
<tr> <tr >
<td>${warn.rule}</td> <td class="<#if techMap[key]==1>
<td>${warn.filePath}</td> keySecond-title
<td>${warn.lineNum}</td> <#elseif techMap[key]==2>
key-title
<#else>
keyThird-title
</#if> ">${warn.rule?default("")}</td>
<td class="<#if techMap[key]==1>
keySecond-title
<#elseif techMap[key]==2>
key-title
<#else>
keyThird-title
</#if> ">${warn.filePath?default("")}</td>
<td class=" <#if techMap[key]==1>
keySecond-title
<#elseif techMap[key]==2>
key-title
<#else>
keyThird-title
</#if>">${warn.lineNum?default("")}</td>
</tr> </tr>
</#list> </#list>
</table> </table>
...@@ -179,7 +204,7 @@ ...@@ -179,7 +204,7 @@
</div> </div>
</#list> </#list>
</#if>
<div class="second"> <div class="second">
<div class="first-title"> <div class="first-title">
<img src="./img/key.png" alt=""> <img src="./img/key.png" alt="">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论