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

sjq修改的

上级 e5369d6f
...@@ -8,7 +8,7 @@ import org.springframework.data.jpa.repository.Query; ...@@ -8,7 +8,7 @@ import org.springframework.data.jpa.repository.Query;
public interface EvaluationDao extends JpaRepository<Evaluation,String>, JpaSpecificationExecutor<Evaluation> { public interface EvaluationDao extends JpaRepository<Evaluation,String>, JpaSpecificationExecutor<Evaluation> {
Evaluation findByUsernameAndIdNot(String username,String id); Evaluation findByUsernameAndIdNot(String username,String id);
Evaluation findByUsername(String username); Evaluation findByUsername(String username);
@Query(value = "SELECT * FROM evaluation WHERE username=:username AND create_time = (SELECT MAX(create_time) FROM evaluation WHERE username=:username)",nativeQuery = true) @Query(value = "SELECT * FROM master_evaluation WHERE username=:username AND create_time = (SELECT MAX(create_time) FROM evaluation WHERE username=:username)",nativeQuery = true)
Evaluation findByUsernameAndMaxCreateDate(String username); Evaluation findByUsernameAndMaxCreateDate(String username);
......
...@@ -27,6 +27,7 @@ public interface RuleDao extends JpaRepository<Rule,String>,JpaSpecificationExec ...@@ -27,6 +27,7 @@ public interface RuleDao extends JpaRepository<Rule,String>,JpaSpecificationExec
List<Rule> findAllByTarget(String target); List<Rule> findAllByTarget(String target);
Rule findByTarget(String target); Rule findByTarget(String target);
List<Rule> findByTargetIgnoreCase(String target);
Rule findByTargetAndIdNot(String target,String id); Rule findByTargetAndIdNot(String target,String id);
List<Rule> findByTargetAndSuffixEqualsAndTechnologyIdEquals(String target,String suffix,String technologyId); List<Rule> findByTargetAndSuffixEqualsAndTechnologyIdEquals(String target,String suffix,String technologyId);
......
...@@ -20,6 +20,7 @@ import org.apache.tomcat.util.buf.Utf8Encoder; ...@@ -20,6 +20,7 @@ import org.apache.tomcat.util.buf.Utf8Encoder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -462,8 +463,8 @@ public class Inspector { ...@@ -462,8 +463,8 @@ public class Inspector {
if (!ruleSuffixFilePathMap.containsKey(rule.getSuffix())) { if (!ruleSuffixFilePathMap.containsKey(rule.getSuffix())) {
ruleSuffixFilePathMap.put(rule.getSuffix(), new ArrayList<>()); ruleSuffixFilePathMap.put(rule.getSuffix(), new ArrayList<>());
} }
if (!ruleMap.containsKey(rule.getTarget() + ":" + rule.getSuffix())) { if (!ruleMap.containsKey(rule.getTarget().toLowerCase() + ":" + rule.getSuffix())) {
ruleMap.put(rule.getTarget() + ":" + rule.getSuffix(), rule); ruleMap.put(rule.getTarget().toLowerCase() + ":" + rule.getSuffix(), rule);
} }
} }
} }
...@@ -487,30 +488,41 @@ public class Inspector { ...@@ -487,30 +488,41 @@ public class Inspector {
private HashMap<String, List<Warn>> getWarnMap() { private HashMap<String, List<Warn>> getWarnMap() {
List<Technology> technologies = technologyDao.findAll(); List<Technology> technologies = technologyDao.findAll();
HashMap<String, Technology> techMap = new HashMap<>();
for (Technology technology : technologies) { if(!CollectionUtils.isEmpty(technologies)) {
if (!techMap.containsKey(technology.getId())) { HashMap<String, Technology> techMap = new HashMap<>();
techMap.put(technology.getId(), technology); for (Technology technology : technologies) {
if(techMap.get(technology.getId())==null){
techMap.put(technology.getId(), technology);
}
} }
} HashMap<String, List<Warn>> warnMap = new HashMap<>();
HashMap<String, List<Warn>> warnMap = new HashMap<>(); warns.addAll(supportWarns);
warns.addAll(supportWarns); for (Warn warn : warns) {
for (Warn warn : warns) { if (!warnMap.containsKey(warn.getTechnologyName())) {
if (!warnMap.containsKey(warn.getTechnologyName())) { ArrayList<Warn> warns1 = new ArrayList<>();
ArrayList<Warn> warns1 = new ArrayList<>(); warns1.add(warn);
warns1.add(warn); if (techMap.get(warn.getTechnologyId()).getTechnologyName() != null) {
warnMap.put(techMap.get(warn.getTechnologyId()).getTechnologyName(), warns1); warnMap.put(techMap.get(warn.getTechnologyId()).getTechnologyName(), warns1);
} else { }
warnMap.get(warn.getTechnologyName()).add(warn); } else {
if (warn.getTechnologyName() != null) {
if (warnMap.get(warn.getTechnologyName()) == null) {
warnMap.put(warn.getTechnologyName(), new ArrayList<>());
}
warnMap.get(warn.getTechnologyName()).add(warn);
}
}
} }
} for (Technology technology : technologies) {
for (Technology technology : technologies) { if (!warnMap.containsKey(technology.getTechnologyName())) {
if (!warnMap.containsKey(technology.getTechnologyName())) { ArrayList<Warn> warns1 = new ArrayList<>();
ArrayList<Warn> warns1 = new ArrayList<>(); warnMap.put(technology.getTechnologyName(), warns1);
warnMap.put(technology.getTechnologyName(), warns1); }
} }
return warnMap;
} }
return warnMap; return null;
} }
/** /**
...@@ -540,13 +552,13 @@ public class Inspector { ...@@ -540,13 +552,13 @@ public class Inspector {
rule1.setTarget(dependency.getArtifactId()); rule1.setTarget(dependency.getArtifactId());
rule1.setSuffix("*"); rule1.setSuffix("*");
rule1.setId(UUIDUtil.getUUID()); rule1.setId(UUIDUtil.getUUID());
if (!ruleMap.containsKey(dependency.getGroupId() + ":" + rule.getSuffix())) { if (!ruleMap.containsKey(dependency.getGroupId().toLowerCase() + ":" + rule.getSuffix())) {
rules.add(rule); rules.add(rule);
ruleMap.put(dependency.getGroupId() + ":" + rule.getSuffix(), rule); ruleMap.put(dependency.getGroupId().toLowerCase() + ":" + rule.getSuffix(), rule);
} }
if (!ruleMap.containsKey(dependency.getArtifactId() + ":" + rule1.getSuffix())) { if (!ruleMap.containsKey(dependency.getArtifactId().toLowerCase() + ":" + rule1.getSuffix())) {
rules.add(rule1); rules.add(rule1);
ruleMap.put(dependency.getArtifactId() + ":" + rule1.getSuffix(), rule1); ruleMap.put(dependency.getArtifactId().toLowerCase() + ":" + rule1.getSuffix(), rule1);
} }
} }
...@@ -569,7 +581,7 @@ public class Inspector { ...@@ -569,7 +581,7 @@ public class Inspector {
continue; continue;
} }
//匹配字符串 //匹配字符串
int index = KmpUtil.kmpMatch(data, rule.getTarget()); int index = KmpUtil.kmpMatch(data.toLowerCase(), rule.getTarget().toLowerCase());
//当index>0时代表data中有当前规则 //当index>0时代表data中有当前规则
if (index > -1) { if (index > -1) {
//判断当前规则是否是不支持规则 //判断当前规则是否是不支持规则
...@@ -663,7 +675,7 @@ public class Inspector { ...@@ -663,7 +675,7 @@ public class Inspector {
if (!ruleMap.containsKey(patten.toLowerCase() + ":" + rule.getSuffix())) { if (!ruleMap.containsKey(patten.toLowerCase() + ":" + rule.getSuffix())) {
rules.add(rule); rules.add(rule);
ruleMap.put(patten + ":" + rule.getSuffix(), rule); ruleMap.put(patten.toLowerCase() + ":" + rule.getSuffix(), rule);
} }
//设置当前依赖为可支持 //设置当前依赖为可支持
pomDependency.setSupport(1); pomDependency.setSupport(1);
...@@ -679,7 +691,6 @@ public class Inspector { ...@@ -679,7 +691,6 @@ public class Inspector {
try { try {
// List<String> allLines = Files.readAllLines(file); // List<String> allLines = Files.readAllLines(file);
String s = file.toAbsolutePath().toString(); String s = file.toAbsolutePath().toString();
log.info("文件路径:{}",s);
long allLines = FileUtil.readFileNumber(new File(s)); long allLines = FileUtil.readFileNumber(new File(s));
fileLine += allLines; fileLine += allLines;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -18,6 +18,7 @@ import org.springframework.data.jpa.domain.Specification; ...@@ -18,6 +18,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -79,8 +80,11 @@ public class RuleServiceImpl implements RuleService { ...@@ -79,8 +80,11 @@ public class RuleServiceImpl implements RuleService {
if (StringUtils.isEmpty(rule.getTarget())) { if (StringUtils.isEmpty(rule.getTarget())) {
return null; return null;
} }
Rule rule1 = ruleDao.findByTarget(rule.getTarget()); if(rule.getTarget().length()<4){
if (rule1 == null) { return null;
}
List<Rule> rules = ruleDao.findByTargetIgnoreCase(rule.getTarget());
if (CollectionUtils.isEmpty(rules)) {
rule.setId(UUIDUtil.getUUID()); rule.setId(UUIDUtil.getUUID());
Rule save = ruleDao.save(rule); Rule save = ruleDao.save(rule);
return save; return save;
...@@ -95,23 +99,24 @@ public class RuleServiceImpl implements RuleService { ...@@ -95,23 +99,24 @@ public class RuleServiceImpl implements RuleService {
*/ */
@Override @Override
public void addRule(RuleQo ruleQo) { public void addRule(RuleQo ruleQo) {
List<String> suffixes = ruleQo.getSuffix(); if(ruleQo.getTarget().length()>3) {
for (String suffix : suffixes) { List<String> suffixes = ruleQo.getSuffix();
List<Rule> rule1 = ruleDao.findByTargetAndSuffixEqualsAndTechnologyIdEquals(ruleQo.getTarget(), suffix, ruleQo.getTechnologyId()); for (String suffix : suffixes) {
if (rule1 != null && rule1.size() > 0) { List<Rule> rule1 = ruleDao.findByTargetAndSuffixEqualsAndTechnologyIdEquals(ruleQo.getTarget(), suffix, ruleQo.getTechnologyId());
continue; if (rule1 != null && rule1.size() > 0) {
continue;
}
Rule rule = new Rule();
rule.setTarget(ruleQo.getTarget());
rule.setSuffix(suffix);
rule.setTechnologyId(ruleQo.getTechnologyId());
rule.setTechnologyName(ruleQo.getTechnologyName());
rule.setId(UUIDUtil.getUUID());
ruleDao.save(rule);
} }
Rule rule = new Rule(); RuleCollection ruleCollection = dataQo2RuleCollection(ruleQo);
rule.setTarget(ruleQo.getTarget()); ruleCollectionDao.save(ruleCollection);
rule.setSuffix(suffix);
rule.setTechnologyId(ruleQo.getTechnologyId());
rule.setTechnologyName(ruleQo.getTechnologyName());
rule.setId(UUIDUtil.getUUID());
ruleDao.save(rule);
} }
RuleCollection ruleCollection = dataQo2RuleCollection(ruleQo);
ruleCollectionDao.save(ruleCollection);
} }
...@@ -119,14 +124,21 @@ public class RuleServiceImpl implements RuleService { ...@@ -119,14 +124,21 @@ public class RuleServiceImpl implements RuleService {
@Override @Override
public void addListRulePlus(List<Rule> rules) { public void addListRulePlus(List<Rule> rules) {
for (Rule rule : rules) { for (Rule rule : rules) {
addRulePlus(rule); addRulePlus(rule);
} }
} }
@Override @Override
public void addRule(List<Rule> rules) { public void addRule(List<Rule> rules) {
ruleDao.saveAll(rules); List<Rule> ruleList=new ArrayList<>();
List<RuleCollection> ruleCollections = dataList2RuleCollection(rules); for (Rule rule : rules) {
if(rule.getTarget().length()>3){
ruleList.add(rule);
}
}
ruleDao.saveAll(ruleList);
List<RuleCollection> ruleCollections = dataList2RuleCollection(ruleList);
ruleCollectionDao.saveAll(ruleCollections); ruleCollectionDao.saveAll(ruleCollections);
} }
...@@ -199,25 +211,29 @@ public class RuleServiceImpl implements RuleService { ...@@ -199,25 +211,29 @@ public class RuleServiceImpl implements RuleService {
@Override @Override
public void upRule(RuleQo ruleQo) { public void upRule(RuleQo ruleQo) {
RuleQo oldRule = ruleQo.getOldRule(); if(ruleQo.getTarget().length()>3) {
List<Rule> rules = ruleDao.findAllByTechnologyIdEqualsAndTargetEquals(oldRule.getTechnologyId(), oldRule.getTarget()); RuleQo oldRule = ruleQo.getOldRule();
RuleCollection ruleCollection = ruleCollectionDao.findAllByTechnologyIdEqualsAndTargetEquals(oldRule.getTechnologyId(), oldRule.getTarget()); List<Rule> rules = ruleDao.findAllByTechnologyIdEqualsAndTargetEquals(oldRule.getTechnologyId(), oldRule.getTarget());
for (Rule rule : rules) { RuleCollection ruleCollection = ruleCollectionDao.findAllByTechnologyIdEqualsAndTargetEquals(oldRule.getTechnologyId(), oldRule.getTarget());
ruleDao.deleteById(rule.getId()); for (Rule rule : rules) {
} ruleDao.deleteById(rule.getId());
if (ruleCollection != null) { }
ruleCollectionDao.deleteById(ruleCollection.getId()); if (ruleCollection != null) {
ruleCollectionDao.deleteById(ruleCollection.getId());
}
addRule(ruleQo);
} }
addRule(ruleQo);
} }
@Override @Override
public void upRulePlus(Rule rule) { public void upRulePlus(Rule rule) {
Rule rule1 = ruleDao.findByTargetAndIdNot(rule.getTarget(), rule.getId()); if(rule.getTarget().length()>3) {
if (rule1 == null) { Rule rule1 = ruleDao.findByTargetAndIdNot(rule.getTarget(), rule.getId());
ruleDao.save(rule); if (rule1 == null) {
} else { ruleDao.save(rule);
ruleDao.deleteById(rule.getId()); } else {
ruleDao.deleteById(rule.getId());
}
} }
} }
......
...@@ -90,8 +90,11 @@ public class ExcelUtil { ...@@ -90,8 +90,11 @@ public class ExcelUtil {
reform.setTime(11); reform.setTime(11);
} else { } else {
String year = time.replaceAll("年", ""); String year = time.replaceAll("年", "");
Integer newYear = Integer.valueOf(year); try {
reform.setTime(newYear); Integer newYear = Integer.valueOf(year);
reform.setTime(newYear);
}catch (Exception e){
}
} }
} }
String address = getExcelCell(7, 2, sheetAt); String address = getExcelCell(7, 2, sheetAt);
...@@ -113,7 +116,7 @@ public class ExcelUtil { ...@@ -113,7 +116,7 @@ public class ExcelUtil {
String construction = getExcelCell(10, 2, sheetAt); String construction = getExcelCell(10, 2, sheetAt);
reform.setFramework(getFramework(construction)); reform.setFramework(getFramework(construction));
/**容灾**/
String disaster = getExcelCell(11, 2, sheetAt); String disaster = getExcelCell(11, 2, sheetAt);
int i2 = SpecialYesOrNo(disaster); int i2 = SpecialYesOrNo(disaster);
reform.setDisasterTolerance(i2); reform.setDisasterTolerance(i2);
...@@ -134,7 +137,7 @@ public class ExcelUtil { ...@@ -134,7 +137,7 @@ public class ExcelUtil {
} }
DevelopLanguageSystem developLanguageSystem = new DevelopLanguageSystem(); DevelopLanguageSystem developLanguageSystem = new DevelopLanguageSystem();
List<BaseDes> devFrameworks = new ArrayList<>(); List<BaseDes> devFrameworks = new ArrayList<>();
for (int i = 17; i < 22; i++) { for (int i = 17; i < 20; i++) {
String framework = getExcelCell(i, 2, sheetAt); String framework = getExcelCell(i, 2, sheetAt);
if ("".equals(framework)) { if ("".equals(framework)) {
...@@ -159,7 +162,7 @@ public class ExcelUtil { ...@@ -159,7 +162,7 @@ public class ExcelUtil {
List<BaseDes> fontTechnologies = new ArrayList<>(); List<BaseDes> fontTechnologies = new ArrayList<>();
for (int i = 22; i < 29; i++) { for (int i = 20; i < 26; i++) {
String framework = getExcelCell(i, 2, sheetAt); String framework = getExcelCell(i, 2, sheetAt);
if ("".equals(framework)) { if ("".equals(framework)) {
continue; continue;
...@@ -179,7 +182,7 @@ public class ExcelUtil { ...@@ -179,7 +182,7 @@ public class ExcelUtil {
developLanguageSystem.setFontDevTechnologies(fontTechnologies); developLanguageSystem.setFontDevTechnologies(fontTechnologies);
ArrayList<BaseDes> fontDevTechnologies = new ArrayList<BaseDes>(); ArrayList<BaseDes> fontDevTechnologies = new ArrayList<BaseDes>();
for (int i = 28; i < 35; i++) { for (int i = 26; i < 32; i++) {
String framework = getExcelCell(i, 2, sheetAt); String framework = getExcelCell(i, 2, sheetAt);
if ("".equals(framework)) { if ("".equals(framework)) {
continue; continue;
...@@ -200,7 +203,7 @@ public class ExcelUtil { ...@@ -200,7 +203,7 @@ public class ExcelUtil {
List<BaseDes> opGAS = new ArrayList<>(); List<BaseDes> opGAS = new ArrayList<>();
for (int i = 34; i < 39; i++) { for (int i = 32; i < 35; i++) {
String framework = getExcelCell(i, 2, sheetAt); String framework = getExcelCell(i, 2, sheetAt);
if ("".equals(framework)) { if ("".equals(framework)) {
continue; continue;
...@@ -219,12 +222,12 @@ public class ExcelUtil { ...@@ -219,12 +222,12 @@ public class ExcelUtil {
} }
developLanguageSystem.setOpGAs(opGAS); developLanguageSystem.setOpGAs(opGAS);
String language = getExcelCell(39, 2, sheetAt); String language = getExcelCell(35, 2, sheetAt);
developLanguageSystem.setCode(MainLanguageEnum.getByName(language).getCode()); developLanguageSystem.setCode(MainLanguageEnum.getByName(language).getCode());
developLanguageSystem.setName(MainLanguageEnum.getByName(language).getName()); developLanguageSystem.setName(MainLanguageEnum.getByName(language).getName());
ArrayList<BaseDes> devLanguages = new ArrayList<>(); ArrayList<BaseDes> devLanguages = new ArrayList<>();
for (int i = 40; i < 45; i++) { for (int i = 36; i < 39; i++) {
String lan = getExcelCell(i, 2, sheetAt); String lan = getExcelCell(i, 2, sheetAt);
if ("".equals(lan)) { if ("".equals(lan)) {
continue; continue;
...@@ -249,7 +252,7 @@ public class ExcelUtil { ...@@ -249,7 +252,7 @@ public class ExcelUtil {
*/ */
Middleware middleware = new Middleware(); Middleware middleware = new Middleware();
List<BaseDes> middlewareEnums = new ArrayList<>(); List<BaseDes> middlewareEnums = new ArrayList<>();
for (int i = 46; i < 51; i++) { for (int i = 40; i < 45; i++) {
String middleware1 = getExcelCell(i, 2, sheetAt); String middleware1 = getExcelCell(i, 2, sheetAt);
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
...@@ -268,7 +271,7 @@ public class ExcelUtil { ...@@ -268,7 +271,7 @@ public class ExcelUtil {
middleware.setMiddlewareEnums(middlewareEnums); middleware.setMiddlewareEnums(middlewareEnums);
ArrayList<OtherApi> otherApis = new ArrayList<>(); ArrayList<OtherApi> otherApis = new ArrayList<>();
for (int i = 51; i < 62; i++) { for (int i = 45; i < 56; i++) {
String api = getExcelCell(i, 2, sheetAt); String api = getExcelCell(i, 2, sheetAt);
if ("".equals(api)) { if ("".equals(api)) {
continue; continue;
...@@ -286,7 +289,7 @@ public class ExcelUtil { ...@@ -286,7 +289,7 @@ public class ExcelUtil {
middleware.setOtherApis(otherApis); middleware.setOtherApis(otherApis);
List<BaseDes> microServices = new ArrayList<>(); List<BaseDes> microServices = new ArrayList<>();
for (int i = 62; i < 73; i++) { for (int i = 56; i < 67; i++) {
String name = getExcelCell(i, 2, sheetAt); String name = getExcelCell(i, 2, sheetAt);
if (name == null || "".equals(name)) { if (name == null || "".equals(name)) {
continue; continue;
...@@ -309,7 +312,7 @@ public class ExcelUtil { ...@@ -309,7 +312,7 @@ public class ExcelUtil {
//数据库相关 //数据库相关
Database database1 = new Database(); Database database1 = new Database();
ArrayList<DatabaseType> databaseTypes = new ArrayList<>(); ArrayList<DatabaseType> databaseTypes = new ArrayList<>();
for (int i = 74; i < 77; i++) { for (int i = 68; i < 70; i++) {
String database = getExcelCell(i, 2, sheetAt); String database = getExcelCell(i, 2, sheetAt);
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
...@@ -323,34 +326,43 @@ public class ExcelUtil { ...@@ -323,34 +326,43 @@ public class ExcelUtil {
} }
database1.setDatabaseType(databaseTypes); database1.setDatabaseType(databaseTypes);
String tableNum = getExcelCell(77, 2, sheetAt); String tableNum = getExcelCell(71, 2, sheetAt);
if ("".equals(tableNum)) { if ("".equals(tableNum)) {
reform.setTableNum(0); reform.setTableNum(0);
} else { } else {
reform.setTableNum(Integer.valueOf(tableNum)); try {
reform.setTableNum(Integer.valueOf(tableNum));
}catch (Exception e){
reform.setTableNum(0);
}
} }
String sp = getExcelCell(81, 2, sheetAt); String sp = getExcelCell(75, 2, sheetAt);
database1.setSeparate(yesOrNo(sp)); database1.setSeparate(yesOrNo(sp));
String dblink = getExcelCell(82, 2, sheetAt); String dblink = getExcelCell(76, 2, sheetAt);
database1.setDbLink(yesOrNo(dblink)); database1.setDbLink(yesOrNo(dblink));
String view = getExcelCell(83, 2, sheetAt); String view = getExcelCell(77, 2, sheetAt);
database1.setView(yesOrNo(view)); database1.setView(yesOrNo(view));
String storage = getExcelCell(84, 2, sheetAt); String storage = getExcelCell(78, 2, sheetAt);
database1.setStorage(yesOrNo(storage)); database1.setStorage(yesOrNo(storage));
String function = getExcelCell(85, 2, sheetAt); String function = getExcelCell(79, 2, sheetAt);
database1.setFunction(yesOrNo(function)); database1.setFunction(yesOrNo(function));
String timeTask = getExcelCell(86, 2, sheetAt); String timeTask = getExcelCell(80, 2, sheetAt);
database1.setTimeTask(yesOrNo(timeTask)); database1.setTimeTask(yesOrNo(timeTask));
String sequence = getExcelCell(87, 2, sheetAt); String sequence = getExcelCell(81, 2, sheetAt);
database1.setSequence(yesOrNo(sequence)); database1.setSequence(yesOrNo(sequence));
String trigger = getExcelCell(88, 2, sheetAt); /**触发器**/
String trigger = getExcelCell(82, 2, sheetAt);
database1.setTrigger(yesOrNo(trigger)); database1.setTrigger(yesOrNo(trigger));
String disasterTolerance = getExcelCell(89, 2, sheetAt); /**主备容灾**/
String disasterTolerance = getExcelCell(83, 2, sheetAt);
database1.setDisasterTolerance(yesOrNo(disasterTolerance)); database1.setDisasterTolerance(yesOrNo(disasterTolerance));
String safe = getExcelCell(90, 2, sheetAt); /**安全**/
String safe = getExcelCell(84, 2, sheetAt);
database1.setSafe(yesOrNo(safe)); database1.setSafe(yesOrNo(safe));
String performance = getExcelCell(91, 2, sheetAt); /**性能**/
String performance = getExcelCell(85, 2, sheetAt);
if (!"".equals(performance) && !"无".equals(performance)) { if (!"".equals(performance) && !"无".equals(performance)) {
database1.setPerformance(1); database1.setPerformance(1);
} }
...@@ -358,7 +370,7 @@ public class ExcelUtil { ...@@ -358,7 +370,7 @@ public class ExcelUtil {
Browser browser = new Browser(); Browser browser = new Browser();
List<BaseDes> compatibleBrowsers = new ArrayList<>(); List<BaseDes> compatibleBrowsers = new ArrayList<>();
for (int i = 93; i <= 97; i++) { for (int i = 87; i <= 91; i++) {
String brows = getExcelCell(i, 2, sheetAt); String brows = getExcelCell(i, 2, sheetAt);
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
...@@ -375,7 +387,7 @@ public class ExcelUtil { ...@@ -375,7 +387,7 @@ public class ExcelUtil {
ArrayList<BaseDes> browserPlugs = new ArrayList<>(); ArrayList<BaseDes> browserPlugs = new ArrayList<>();
for (int i = 98; i <= 108; i++) { for (int i = 92; i <= 102; i++) {
String plugin = getExcelCell(i, 2, sheetAt); String plugin = getExcelCell(i, 2, sheetAt);
BaseDes browserPlug = new BaseDes(); BaseDes browserPlug = new BaseDes();
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
...@@ -404,45 +416,50 @@ public class ExcelUtil { ...@@ -404,45 +416,50 @@ public class ExcelUtil {
} }
browser.setBrowserPlugs(browserPlugs); browser.setBrowserPlugs(browserPlugs);
reform.setBrowser(browser); reform.setBrowser(browser);
String apply = getExcelCell(110, 2, sheetAt); String apply = getExcelCell(104, 2, sheetAt);
Apply apply1 = new Apply(); Apply apply1 = new Apply();
if (!"".equals(apply)) { if (!"".equals(apply)) {
apply1.setCost(Double.valueOf(apply)); try {
apply1.setCost(Double.valueOf(apply));
}catch (Exception e){
apply1.setCost(0);
}
} }
String remark = getExcelCell(110, 4, sheetAt); String remark = getExcelCell(104, 4, sheetAt);
apply1.setReason(remark); apply1.setReason(remark);
reform.setApply(apply1); reform.setApply(apply1);
SystemStructure systemStructure = new SystemStructure(); SystemStructure systemStructure = new SystemStructure();
Details sysDetails = getSysDetails(113, 2, sheetAt); Details sysDetails = getSysDetails(107, 2, sheetAt);
systemStructure.setApplication(sysDetails); systemStructure.setApplication(sysDetails);
Details rdsdetails = getSysDetails(114, 2, sheetAt); Details rdsdetails = getSysDetails(108, 2, sheetAt);
systemStructure.setDatabase(rdsdetails); systemStructure.setDatabase(rdsdetails);
Details nasdetails = getSysDetails(115, 2, sheetAt); Details nasdetails = getSysDetails(109, 2, sheetAt);
systemStructure.setNas(nasdetails); systemStructure.setNas(nasdetails);
Details slbdetails = getSysDetails(116, 2, sheetAt); Details slbdetails = getSysDetails(110, 2, sheetAt);
systemStructure.setSlb(slbdetails); systemStructure.setSlb(slbdetails);
Details cdndetails = getSysDetails(117, 2, sheetAt); Details cdndetails = getSysDetails(111, 2, sheetAt);
systemStructure.setCdn(cdndetails); systemStructure.setCdn(cdndetails);
Details vpsdetails = getSysDetails(118, 2, sheetAt); Details vpsdetails = getSysDetails(112, 2, sheetAt);
systemStructure.setVps(vpsdetails); systemStructure.setVps(vpsdetails);
Details otherEquipment = getSysDetails(119, 2, sheetAt); Details otherEquipment = getSysDetails(113, 2, sheetAt);
systemStructure.setOtherEquipment(otherEquipment); systemStructure.setOtherEquipment(otherEquipment);
reform.setSystemStructure(systemStructure); reform.setSystemStructure(systemStructure);
String rpo = getExcelCell(121, 2, sheetAt); String rpo = getExcelCell(115, 2, sheetAt);
RtoEnum rtoEnum = RtoEnum.getByName(rpo); RtoEnum rtoEnum = RtoEnum.getByName(rpo);
if (rtoEnum != null) { if (rtoEnum != null) {
reform.setRto(rtoEnum.getCode()); reform.setRto(rtoEnum.getCode());
} }
String rto = getExcelCell(122, 2, sheetAt); String rto = getExcelCell(116, 2, sheetAt);
RpoEnum rpoEnum = RpoEnum.getByName(rto); RpoEnum rpoEnum = RpoEnum.getByName(rto);
if (rpoEnum != null) { if (rpoEnum != null) {
reform.setRpo(rpoEnum.getCode()); reform.setRpo(rpoEnum.getCode());
...@@ -681,17 +698,25 @@ public class ExcelUtil { ...@@ -681,17 +698,25 @@ public class ExcelUtil {
} }
private static int returnNum(String target) { private static int returnNum(String target) {
if (!"".equals(target)) { try {
return Integer.parseInt(target); if (!"".equals(target)) {
} else { return Integer.parseInt(target);
return 0; } else {
return 0;
}
}catch (Exception e){
return 1;
} }
} }
private static double returnDouble(String target) { private static double returnDouble(String target) {
if (!"".equals(target)) { try {
return Double.parseDouble(target); if (!"".equals(target)) {
} else { return Double.parseDouble(target);
} else {
return 0;
}
}catch (Exception e){
return 0; return 0;
} }
} }
......
...@@ -38,11 +38,9 @@ public class FileUtil { ...@@ -38,11 +38,9 @@ public class FileUtil {
while (lnr.readLine() != null){ while (lnr.readLine() != null){
linenumber++; linenumber++;
} }
log.info("Total number of lines : " + linenumber);
lnr.close(); lnr.close();
return linenumber; return linenumber;
}else{ }else{
log.info("File does not exists!"+linenumber);
return linenumber; return linenumber;
} }
}catch(IOException e){ }catch(IOException e){
......
...@@ -68,7 +68,8 @@ spring.freemarker.template-loader-path=classpath:/templates/ ...@@ -68,7 +68,8 @@ spring.freemarker.template-loader-path=classpath:/templates/
##Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09 ##Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09
#spring.redis.password= #spring.redis.password=
#宁波项目服务器ip #宁波项目服务器ip
address=120.55.57.35 #address=120.55.57.35
address=127.0.0.1
# 核心线程池大小、最大线程数、空闲活跃时间、队列容量 # 核心线程池大小、最大线程数、空闲活跃时间、队列容量
thread.pool.corePoolSize=10 thread.pool.corePoolSize=10
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论