修正活动管理子系统的一些问题
This commit is contained in:
parent
2cf0ff666f
commit
3181288755
@ -44,14 +44,14 @@ public class ActivityConverter {
|
|||||||
JSONObject jsonObject = json.get();
|
JSONObject jsonObject = json.get();
|
||||||
|
|
||||||
String username = (String) jsonObject.get("creator");
|
String username = (String) jsonObject.get("creator");
|
||||||
User creator = userService.findUserByUsername(username);
|
Optional<User> creator = userService.findUserByUsername(username);
|
||||||
activity.setCreator(creator);
|
activity.setCreator(creator.get());
|
||||||
|
|
||||||
List<String> participateGroupFromJson = (List) jsonObject.get("participate-group");
|
List<String> participateGroupFromJson = (List) jsonObject.get("participate-group");
|
||||||
Set<User> participateGroup = new HashSet<>();
|
Set<User> participateGroup = new HashSet<>();
|
||||||
for (String name : participateGroupFromJson) {
|
for (String name : participateGroupFromJson) {
|
||||||
User user = userService.findUserByUsername(name);
|
Optional<User> user = userService.findUserByUsername(name);
|
||||||
participateGroup.add(user);
|
participateGroup.add(user.get());
|
||||||
}
|
}
|
||||||
activity.setParticipateGroup(participateGroup);
|
activity.setParticipateGroup(participateGroup);
|
||||||
|
|
||||||
@ -59,14 +59,14 @@ public class ActivityConverter {
|
|||||||
activity.setTitle(title);
|
activity.setTitle(title);
|
||||||
|
|
||||||
String chiefManagerName = (String) jsonObject.get("chief-manager");
|
String chiefManagerName = (String) jsonObject.get("chief-manager");
|
||||||
User chiefManager = userService.findUserByUsername(chiefManagerName);
|
Optional<User> chiefManager = userService.findUserByUsername(chiefManagerName);
|
||||||
activity.setChiefManager(chiefManager);
|
activity.setChiefManager(chiefManager.get());
|
||||||
|
|
||||||
List<String> assistManagerFromJSON = (List) jsonObject.get("assist-manager");
|
List<String> assistManagerFromJSON = (List) jsonObject.get("assist-manager");
|
||||||
Set<User> assistManager = new HashSet<>();
|
Set<User> assistManager = new HashSet<>();
|
||||||
for (String name : assistManagerFromJSON) {
|
for (String name : assistManagerFromJSON) {
|
||||||
User user = userService.findUserByUsername(name);
|
Optional<User> user = userService.findUserByUsername(name);
|
||||||
assistManager.add(user);
|
assistManager.add(user.get());
|
||||||
}
|
}
|
||||||
activity.setAssistManagers(assistManager);
|
activity.setAssistManagers(assistManager);
|
||||||
|
|
||||||
@ -91,24 +91,24 @@ public class ActivityConverter {
|
|||||||
List<String> signGroupFromJSON = (List) jsonObject.get("sign-group");
|
List<String> signGroupFromJSON = (List) jsonObject.get("sign-group");
|
||||||
Set<User> signGroup = new HashSet<>();
|
Set<User> signGroup = new HashSet<>();
|
||||||
for (String name : signGroupFromJSON) {
|
for (String name : signGroupFromJSON) {
|
||||||
User user = userService.findUserByUsername(name);
|
Optional<User> user = userService.findUserByUsername(name);
|
||||||
signGroup.add(user);
|
signGroup.add(user.get());
|
||||||
}
|
}
|
||||||
activity.setSignGroup(signGroup);
|
activity.setSignGroup(signGroup);
|
||||||
|
|
||||||
List<String> informGroupFromJSON = (List) jsonObject.get("inform-group");
|
List<String> informGroupFromJSON = (List) jsonObject.get("inform-group");
|
||||||
Set<User> informGroup = new HashSet<>();
|
Set<User> informGroup = new HashSet<>();
|
||||||
for (String name : informGroupFromJSON) {
|
for (String name : informGroupFromJSON) {
|
||||||
User user = userService.findUserByUsername(name);
|
Optional<User> user = userService.findUserByUsername(name);
|
||||||
informGroup.add(user);
|
informGroup.add(user.get());
|
||||||
}
|
}
|
||||||
activity.setInformGroup(informGroup);
|
activity.setInformGroup(informGroup);
|
||||||
|
|
||||||
List<String> visibleGroupFromJSON = (List) jsonObject.get("visible-group");
|
List<String> visibleGroupFromJSON = (List) jsonObject.get("visible-group");
|
||||||
Set<User> visibleGroup = new HashSet<>();
|
Set<User> visibleGroup = new HashSet<>();
|
||||||
for (String name : visibleGroupFromJSON) {
|
for (String name : visibleGroupFromJSON) {
|
||||||
User user = userService.findUserByUsername(name);
|
Optional<User> user = userService.findUserByUsername(name);
|
||||||
visibleGroup.add(user);
|
visibleGroup.add(user.get());
|
||||||
}
|
}
|
||||||
activity.setVisibleGroup(informGroup);
|
activity.setVisibleGroup(informGroup);
|
||||||
|
|
||||||
|
@ -12,4 +12,8 @@ public class DataInvalidFormatException extends RuntimeException {
|
|||||||
super();
|
super();
|
||||||
information = e.getMessage();
|
information = e.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataInvalidFormatException(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,4 +34,8 @@ public class Period {
|
|||||||
this.endTime = endTime;
|
this.endTime = endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Period(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user