文件名优化
This commit is contained in:
parent
fddfd688a7
commit
e61f3a5392
|
|
@ -121,6 +121,11 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
} /*else if (item.getFileType().equals(Long.valueOf(EXAMINATION_PDF))) {
|
||||
devInfoVo.getExaminationPdf().add(item);
|
||||
}*/ else if (item.getFileType().equals(Long.valueOf(INSURANCE_PDF))) {
|
||||
String result = "";
|
||||
if (StringUtils.isNotBlank(item.getFileName())) {
|
||||
result = extracted(item.getFileName());
|
||||
}
|
||||
item.setFileName("合格证" + result);
|
||||
devInfoVo.getInsurancePdf().add(item);
|
||||
}
|
||||
|
||||
|
|
@ -137,6 +142,13 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
table.setCheckDate(qc.getQcTime());
|
||||
table.setNextCheckDate(qc.getNextCheckTime());
|
||||
List<BmFileInfo> info = bmFileInfoMapper.getInfoByMaIdAndTaskId(qc);
|
||||
for (BmFileInfo fileInfo : info) {
|
||||
String result = "";
|
||||
if (StringUtils.isNotBlank(fileInfo.getFileName())) {
|
||||
result = extracted(fileInfo.getFileName());
|
||||
}
|
||||
fileInfo.setFileName("检测证明" + result);
|
||||
}
|
||||
devInfoVo.getExaminationPdf().addAll(info);
|
||||
}
|
||||
tableList.add(table);
|
||||
|
|
@ -187,6 +199,23 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
return devInfoVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件名截取文件名
|
||||
* @param fileName
|
||||
*/
|
||||
private String extracted(String fileName) {
|
||||
String result = "";
|
||||
// 找到最后一个下划线的索引位置
|
||||
int underscoreIndex = fileName.lastIndexOf("_");
|
||||
// 找到点号的索引位置
|
||||
int dotIndex = fileName.lastIndexOf(".");
|
||||
if (underscoreIndex != -1 && dotIndex != -1) {
|
||||
// 从下划线的下一个位置开始截取到点号的位置
|
||||
result = fileName.substring(underscoreIndex + 1, dotIndex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备搜索量
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue