|
@@ -40,6 +40,7 @@ import java.lang.reflect.Method;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -234,7 +235,6 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
@Override
|
|
|
public HttpRespMsg getInfo(Custom custom, HttpServletRequest request) {
|
|
|
Custom custom1 = customMapper.getInfo(custom.getId());
|
|
|
-
|
|
|
// 附件列表
|
|
|
custom1.setFiles(uploadFileMapper.selectByInfoList("custom", custom1.getId()));
|
|
|
//商机列表
|
|
@@ -274,16 +274,24 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
List<Task> tasks = taskMapper.selectList(new QueryWrapper<Task>().in("custom_id", custom1.getId()));
|
|
|
if (tasks.size()>0){
|
|
|
List<String> ids = tasks.stream()
|
|
|
- .flatMap(task -> Arrays.stream(task.getExecutorId().split(",")))
|
|
|
+ .flatMap(task -> Optional.ofNullable(task.getExecutorId())
|
|
|
+ .map(executorIds -> Arrays.stream(executorIds.split(",")))
|
|
|
+ .orElseGet(Stream::empty))
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
- List<User> users = userMapper.selectList(new QueryWrapper<User>().in("id", ids));
|
|
|
- Map<String, String> map = users.stream().collect(Collectors.toMap(User::getId, User::getName));
|
|
|
- for (Task task : tasks) {
|
|
|
- List<String> executorNames = Arrays.stream(task.getExecutorId().split(","))
|
|
|
- .map(map::get)
|
|
|
- .collect(Collectors.toList());
|
|
|
- task.setExecutorNames(executorNames);
|
|
|
+
|
|
|
+ if (!ids.isEmpty()) {
|
|
|
+ List<User> users = userMapper.selectList(new QueryWrapper<User>().in("id", ids));
|
|
|
+ Map<String, String> map = users.stream().collect(Collectors.toMap(User::getId, User::getName));
|
|
|
+
|
|
|
+ for (Task task : tasks) {
|
|
|
+ List<String> executorNames = Optional.ofNullable(task.getExecutorId())
|
|
|
+ .map(idsStr -> Arrays.stream(idsStr.split(","))
|
|
|
+ .map(map::get)
|
|
|
+ .collect(Collectors.toList()))
|
|
|
+ .orElseGet(Collections::emptyList);
|
|
|
+ task.setExecutorNames(executorNames);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -378,7 +386,7 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Value(value = "${upload.file}")
|
|
|
+ @Value(value = "${upload.path}")
|
|
|
private String filePath;
|
|
|
|
|
|
@Override
|
|
@@ -406,7 +414,7 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
long size = file.getSize();
|
|
|
double v = (double) size / (1024 * 1024);
|
|
|
String format = String.format("%.2f MB", v);
|
|
|
- uf.setPath("/file/" + realName);
|
|
|
+ uf.setPath(filePath + realName);
|
|
|
uf.setCode("custom");
|
|
|
System.out.println(format);
|
|
|
uf.setSize(format);
|
|
@@ -461,7 +469,6 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
// 读取文件的字节流
|
|
|
os.write(FileUtil.readFileByBytes(uploadFile1));
|
|
|
os.flush();
|
|
|
-
|
|
|
} catch (IOException e) {
|
|
|
msg.setError(MessageUtils.message("file.error"));
|
|
|
e.printStackTrace();
|