|
@ -789,4 +789,55 @@ public class HuzhouPlaninfofileServiceImpl extends ServiceImpl<HuzhouPlaninfofil |
|
|
return resultList; |
|
|
return resultList; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Double getUploadFileRate(String projectId) { |
|
|
|
|
|
List<HuzhouPlaninfo> planInfoList = planinfoService.getListByProjectId(projectId); |
|
|
|
|
|
double rate =0.0; |
|
|
|
|
|
int totalFileCount = 0; |
|
|
|
|
|
int unFinishFileCount = 0; |
|
|
|
|
|
if (CollectionUtil.isNotEmpty(planInfoList)) { |
|
|
|
|
|
for (HuzhouPlaninfo planInfo : planInfoList) { |
|
|
|
|
|
String taskFile = planInfo.getTaskFile(); |
|
|
|
|
|
totalFileCount += countFiles(taskFile); |
|
|
|
|
|
} |
|
|
|
|
|
LambdaQueryWrapper<HuzhouPlaninfo> qw = new LambdaQueryWrapper<>(); |
|
|
|
|
|
qw.eq(HuzhouPlaninfo::getProjectId,projectId) |
|
|
|
|
|
.eq(HuzhouPlaninfo::getIsfinish,"0"); |
|
|
|
|
|
List<HuzhouPlaninfo> unFinishPlanInfoList = planinfoService.list(qw); |
|
|
|
|
|
for (HuzhouPlaninfo planInfo : unFinishPlanInfoList) { |
|
|
|
|
|
String taskFile = planInfo.getTaskFile(); |
|
|
|
|
|
if (StrUtil.isNotBlank(taskFile)){ |
|
|
|
|
|
unFinishFileCount += countFiles(taskFile); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
int uploadFileCount = totalFileCount - unFinishFileCount; |
|
|
|
|
|
rate = (double) uploadFileCount / totalFileCount * 100; |
|
|
|
|
|
//double roundedRate = Math.round(rate * 100.0) / 100.0;
|
|
|
|
|
|
double roundedRate = Math.round(rate) ; |
|
|
|
|
|
log.info("{}:上传文件比率为:{}---总数:{},完成:{}", projectId, roundedRate, totalFileCount, uploadFileCount); |
|
|
|
|
|
return roundedRate; |
|
|
|
|
|
} |
|
|
|
|
|
return rate; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 辅助方法:计算给定字符串中《》的数量来确定文件数
|
|
|
|
|
|
private int countFiles(String taskFile) { |
|
|
|
|
|
if (taskFile == null || taskFile.trim().isEmpty()) { |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
// 去除首尾可能存在的空格和其他字符
|
|
|
|
|
|
taskFile = taskFile.trim(); |
|
|
|
|
|
// 将字符串按逗号分割成多个部分,然后计算每部分中书名号的数量
|
|
|
|
|
|
String[] files = taskFile.split("》,"); |
|
|
|
|
|
int fileCount = 0; |
|
|
|
|
|
for (String file : files) { |
|
|
|
|
|
file = file.trim().replace("《", "").replace("》", ""); |
|
|
|
|
|
if (!file.isEmpty()) { |
|
|
|
|
|
fileCount++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return fileCount; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|