|
|
@ -203,4 +203,88 @@ public class DataAnalysis {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
//res = String.valueOf(cal.get(Calendar.HOUR_OF_DAY));
|
|
|
|
//res = String.valueOf(cal.get(Calendar.HOUR_OF_DAY));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/place/{userid}")
|
|
|
|
|
|
|
|
public List<Map<String, String>> Place(@PathVariable("userid") String userid) {
|
|
|
|
|
|
|
|
List<LeaveDetail> LDs = leaveDetailRepository.findAll();
|
|
|
|
|
|
|
|
List<Map<String, String>> result = new ArrayList<>();
|
|
|
|
|
|
|
|
List<String> place = new ArrayList<>();
|
|
|
|
|
|
|
|
List<Integer> value = new ArrayList<>();
|
|
|
|
|
|
|
|
Map<String, String> temp = new HashMap<String, String>();
|
|
|
|
|
|
|
|
int len = LDs.size();
|
|
|
|
|
|
|
|
LeaveDetail LD;
|
|
|
|
|
|
|
|
for (int i = 0; i < len; i++) {
|
|
|
|
|
|
|
|
LD = LDs.get(i);
|
|
|
|
|
|
|
|
if (!userid.equals("*")) {
|
|
|
|
|
|
|
|
if (!LD.getUserid().toString().equals(userid)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String tempPlace = LDs.get(i).getPlace();
|
|
|
|
|
|
|
|
int check = -1;
|
|
|
|
|
|
|
|
for (int j = 0; j < place.size(); j++) {
|
|
|
|
|
|
|
|
if (place.get(j).equals(tempPlace)) {
|
|
|
|
|
|
|
|
check = j;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (check == -1) {
|
|
|
|
|
|
|
|
place.add(tempPlace);
|
|
|
|
|
|
|
|
value.add(1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
value.set(check, value.get(check) + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int len_place = place.size();
|
|
|
|
|
|
|
|
for (int i = 0; i < len_place; i++) {
|
|
|
|
|
|
|
|
temp.put("place", place.get(i));
|
|
|
|
|
|
|
|
temp.put("value", value.get(i).toString());
|
|
|
|
|
|
|
|
Map<String, String> temp_cpy = new HashMap<String, String>();
|
|
|
|
|
|
|
|
mapCopy(temp, temp_cpy);
|
|
|
|
|
|
|
|
result.add(temp_cpy);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/reason/{userid}")
|
|
|
|
|
|
|
|
public List<Map<String, String>> Reason(@PathVariable("userid") String userid) {
|
|
|
|
|
|
|
|
List<LeaveDetail> LDs = leaveDetailRepository.findAll();
|
|
|
|
|
|
|
|
List<Map<String, String>> result = new ArrayList<>();
|
|
|
|
|
|
|
|
List<String> reason = new ArrayList<>();
|
|
|
|
|
|
|
|
List<Integer> value = new ArrayList<>();
|
|
|
|
|
|
|
|
Map<String, String> temp = new HashMap<String, String>();
|
|
|
|
|
|
|
|
int len = LDs.size();
|
|
|
|
|
|
|
|
LeaveDetail LD;
|
|
|
|
|
|
|
|
for (int i = 0; i < len; i++) {
|
|
|
|
|
|
|
|
LD = LDs.get(i);
|
|
|
|
|
|
|
|
if (!userid.equals("*")) {
|
|
|
|
|
|
|
|
if (!LD.getUserid().toString().equals(userid)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String tempPlace = LDs.get(i).getReason();
|
|
|
|
|
|
|
|
int check = -1;
|
|
|
|
|
|
|
|
for (int j = 0; j < reason.size(); j++) {
|
|
|
|
|
|
|
|
if (reason.get(j).equals(tempPlace)) {
|
|
|
|
|
|
|
|
check = j;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (check == -1) {
|
|
|
|
|
|
|
|
reason.add(tempPlace);
|
|
|
|
|
|
|
|
value.add(1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
value.set(check, value.get(check) + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int len_place = reason.size();
|
|
|
|
|
|
|
|
for (int i = 0; i < len_place; i++) {
|
|
|
|
|
|
|
|
temp.put("reason", reason.get(i));
|
|
|
|
|
|
|
|
temp.put("value", value.get(i).toString());
|
|
|
|
|
|
|
|
Map<String, String> temp_cpy = new HashMap<String, String>();
|
|
|
|
|
|
|
|
mapCopy(temp, temp_cpy);
|
|
|
|
|
|
|
|
result.add(temp_cpy);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|