|
@ -11,16 +11,14 @@ import com.inscloudtech.common.helper.LoginHelper; |
|
|
import com.inscloudtech.functional.domain.FuncCarApi; |
|
|
import com.inscloudtech.functional.domain.FuncCarApi; |
|
|
import com.inscloudtech.functional.domain.TestReport; |
|
|
import com.inscloudtech.functional.domain.TestReport; |
|
|
import com.inscloudtech.functional.domain.TestReportSubmit; |
|
|
import com.inscloudtech.functional.domain.TestReportSubmit; |
|
|
import com.inscloudtech.functional.mapper.SysDictDataMapper; |
|
|
|
|
|
|
|
|
import com.inscloudtech.functional.mapper.DictDataMapper; |
|
|
import com.inscloudtech.functional.mapper.TestReportMapper; |
|
|
import com.inscloudtech.functional.mapper.TestReportMapper; |
|
|
|
|
|
import com.inscloudtech.functional.mapper.TestReportSubmitMapper; |
|
|
import com.inscloudtech.functional.service.TestReportService; |
|
|
import com.inscloudtech.functional.service.TestReportService; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -32,7 +30,9 @@ import java.util.stream.Collectors; |
|
|
@RequiredArgsConstructor |
|
|
@RequiredArgsConstructor |
|
|
public class TestReportServiceImpl extends ServiceImpl<TestReportMapper, TestReport> implements TestReportService { |
|
|
public class TestReportServiceImpl extends ServiceImpl<TestReportMapper, TestReport> implements TestReportService { |
|
|
|
|
|
|
|
|
private final SysDictDataMapper sysDictDataMapper; |
|
|
|
|
|
|
|
|
private final DictDataMapper dictDataMapper; |
|
|
|
|
|
|
|
|
|
|
|
private final TestReportSubmitMapper testReportSubmitMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -192,25 +192,68 @@ public class TestReportServiceImpl extends ServiceImpl<TestReportMapper, TestRep |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void add(TestReportSubmit vo) { |
|
|
|
|
|
|
|
|
public TestReportSubmit add(TestReportSubmit vo) { |
|
|
|
|
|
|
|
|
|
|
|
TestReportSubmit add = new TestReportSubmit(); |
|
|
|
|
|
add.setReportOptionResult1(getApiErrorRateResult(vo.getReportOption1())); |
|
|
|
|
|
add.setReportOptionResult2(getCpuResultXn(vo.getReportOption2())); |
|
|
|
|
|
add.setReportOptionResult3(getCpuResultTemperature(vo.getReportOption3())); |
|
|
|
|
|
add.setReportOptionResult4(getMemorySizeResult(vo.getReportOption4())); |
|
|
|
|
|
add.setReportOptionResult5(getDiskReadAndWriteSpeedResult(vo.getReportOption5())); |
|
|
|
|
|
add.setReportOptionResult6(getNetSpeedResult(vo.getReportOption6())); |
|
|
|
|
|
add.setReportOptionResult7(getFlawCountResult(vo.getReportOption7())); |
|
|
|
|
|
|
|
|
List<SysDictData> sysDictDataList = sysDictDataMapper.selectList( |
|
|
|
|
|
|
|
|
setReportOptionLabel(add,vo); |
|
|
|
|
|
|
|
|
|
|
|
testReportSubmitMapper.insert(add); |
|
|
|
|
|
return add; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setReportOptionLabel(TestReportSubmit add,TestReportSubmit vo ){ |
|
|
|
|
|
List<SysDictData> sysDictDataList = dictDataMapper.selectList( |
|
|
new LambdaQueryWrapper<SysDictData>() |
|
|
new LambdaQueryWrapper<SysDictData>() |
|
|
.eq(SysDictData::getStatus, UserConstants.DICT_NORMAL) |
|
|
.eq(SysDictData::getStatus, UserConstants.DICT_NORMAL) |
|
|
.in(SysDictData::getDictType, dictTypeList) |
|
|
.in(SysDictData::getDictType, dictTypeList) |
|
|
.orderByAsc(SysDictData::getDictSort)); |
|
|
.orderByAsc(SysDictData::getDictSort)); |
|
|
|
|
|
|
|
|
Map<String, List<SysDictData>> groupByType = sysDictDataList.stream().collect(Collectors.groupingBy(SysDictData::getDictType)); |
|
|
Map<String, List<SysDictData>> groupByType = sysDictDataList.stream().collect(Collectors.groupingBy(SysDictData::getDictType)); |
|
|
|
|
|
for (String option : groupByType.keySet()) { |
|
|
|
|
|
List<SysDictData> report_option_1 = groupByType.get("report_option_1"); |
|
|
|
|
|
Optional<SysDictData> first = report_option_1.stream().filter(item -> item.getDictValue().equals(vo.getReportOption1())).findFirst(); |
|
|
|
|
|
if (!first.isPresent()) { |
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
getApiErrorRateResult(vo.getReportOption1()); |
|
|
|
|
|
getCpuResultXn(vo.getReportOption2()); |
|
|
|
|
|
getCpuResultTemperature(vo.getReportOption3()); |
|
|
|
|
|
getMemorySizeResult(vo.getReportOption4()); |
|
|
|
|
|
getDiskReadAndWriteSpeedResult(vo.getReportOption5()); |
|
|
|
|
|
getNetSpeedResult(vo.getReportOption6()); |
|
|
|
|
|
getFlawCountResult(vo.getReportOption7()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 使用找到的对象 |
|
|
|
|
|
} |
|
|
|
|
|
SysDictData item = first.get(); |
|
|
|
|
|
String reportOptionLabel = item.getDictLabel(); |
|
|
|
|
|
switch (option){ |
|
|
|
|
|
case "report_option_1": |
|
|
|
|
|
add.setReportOption1(reportOptionLabel); |
|
|
|
|
|
break; |
|
|
|
|
|
case "report_option_2": |
|
|
|
|
|
add.setReportOption2(reportOptionLabel); |
|
|
|
|
|
break; |
|
|
|
|
|
case "report_option_3": |
|
|
|
|
|
add.setReportOption3(reportOptionLabel); |
|
|
|
|
|
break; |
|
|
|
|
|
case "report_option_4": |
|
|
|
|
|
add.setReportOption4(reportOptionLabel); |
|
|
|
|
|
break; |
|
|
|
|
|
case "report_option_5": |
|
|
|
|
|
add.setReportOption5(reportOptionLabel); |
|
|
|
|
|
break; |
|
|
|
|
|
case "report_option_6": |
|
|
|
|
|
add.setReportOption6(reportOptionLabel); |
|
|
|
|
|
break; |
|
|
|
|
|
case "report_option_7": |
|
|
|
|
|
add.setReportOption7(reportOptionLabel); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|