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

Merge branch 'master' of git.yfzx.zjtys.com.cn:912-system/monitor/inspect

package com.zjty.inspect.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* @author Mcj
* @date 2020-03-16 10:33
*/
@ControllerAdvice
@Slf4j
public class ExceptionHandlerConfig {
@ExceptionHandler(value = HttpMessageNotReadableException.class)
public ResponseEntity defaultErrorHandler(Exception e) {
log.error("异常{}",e);
return ResponseEntity.badRequest().build();
}
@ExceptionHandler(value = IOException.class)
public ResponseEntity defaultIOHandler(Exception e) {
log.error("IO异常{}",e);
return ResponseEntity.status(500).build();
}
}
...@@ -35,7 +35,7 @@ public class InspectParameter { ...@@ -35,7 +35,7 @@ public class InspectParameter {
private Double proportion; private Double proportion;
/** /**
* 利率 * 利率
*/ */
private Double moneyRate; private Double moneyRate;
......
...@@ -13,30 +13,18 @@ public enum Language { ...@@ -13,30 +13,18 @@ public enum Language {
*/ */
JAVA("java",1), JAVA("java",1),
VUE("js",2),
PYTHON("python",3), PYTHON("python",3),
ASP("asp",4),
/**
* js
*/
JAVASCRIPT("js",5), JAVASCRIPT("js",5),
/**
* go
*/
GO("go",6), GO("go",6),
/**
* html
*/
HTML("html",7), HTML("html",7),
C("c#",8), C("c#",8),
C("c++",9), C("c++",9),
UNKNOW("unknowun",10); UNKNOW("unknowun",10);
...@@ -56,9 +44,4 @@ public enum Language { ...@@ -56,9 +44,4 @@ public enum Language {
public Integer getStatus() { public Integer getStatus() {
return status; return status;
} }
public static void main(String[] args) {
Language language = Language.valueOf("VUE");
System.out.println(language.name);
}
} }
...@@ -4,6 +4,7 @@ import com.zjty.inspect.entity.InspectParameter; ...@@ -4,6 +4,7 @@ import com.zjty.inspect.entity.InspectParameter;
import com.zjty.inspect.entity.Report; import com.zjty.inspect.entity.Report;
import com.zjty.inspect.entity.ReportVo; import com.zjty.inspect.entity.ReportVo;
import java.io.IOException;
import java.util.Map; import java.util.Map;
public interface InspectService { public interface InspectService {
...@@ -12,7 +13,7 @@ public interface InspectService { ...@@ -12,7 +13,7 @@ public interface InspectService {
* @param inspectParameter * @param inspectParameter
* @return * @return
*/ */
ReportVo inspect(ReportVo reportVo,InspectParameter inspectParameter); ReportVo inspect(ReportVo reportVo,InspectParameter inspectParameter) throws IOException;
String generateHtml(String templateContent, Map model ); String generateHtml(String templateContent, Map model );
......
...@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils; import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -45,7 +46,7 @@ public class InspectServiceImpl implements InspectService { ...@@ -45,7 +46,7 @@ public class InspectServiceImpl implements InspectService {
@Transactional @Transactional
@Override @Override
public ReportVo inspect(ReportVo reportVo,InspectParameter inspectParameter) { public ReportVo inspect(ReportVo reportVo,InspectParameter inspectParameter) throws IOException {
//统计文件后缀数量 //统计文件后缀数量
Map<String, Language> suffixLanguageMapping = new HashMap<>(); Map<String, Language> suffixLanguageMapping = new HashMap<>();
suffixLanguageMapping.put("java", Language.JAVA); suffixLanguageMapping.put("java", Language.JAVA);
......
...@@ -290,7 +290,8 @@ public class WorkLoadUtil { ...@@ -290,7 +290,8 @@ public class WorkLoadUtil {
(1.0+(browserDifficulty.getFlash()!=null&&browserDifficulty.getFlash()==1?1.0:0)/100)* (1.0+(browserDifficulty.getFlash()!=null&&browserDifficulty.getFlash()==1?1.0:0)/100)*
(1.0+(browserDifficulty.getOtherDemand()!=null&&browserDifficulty.getOtherDemand()==1?1.0:0)/100); (1.0+(browserDifficulty.getOtherDemand()!=null&&browserDifficulty.getOtherDemand()==1?1.0:0)/100);
List<CompatibleBrowser> compatibleBrowsers = reform.getBrowser().getCompatibleBrowsers(); List<CompatibleBrowser> compatibleBrowsers = reform.getBrowser().getCompatibleBrowsers();
if (compatibleBrowsers!=null&&compatibleBrowsers.contains(CompatibleBrowser.IETRIDENT)) { //if (compatibleBrowsers!=null&&compatibleBrowsers.contains(CompatibleBrowser.IETRIDENT)) {
if (compatibleBrowsers==null||!compatibleBrowsers.contains(CompatibleBrowser.FIREFOX)) {
eBrowser*=1.1; eBrowser*=1.1;
logger.info("浏览器难度包含IE"); logger.info("浏览器难度包含IE");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论