Commit d4ad2bb3 by 谢春璐

fix

parent 12a5c28b
...@@ -21,6 +21,11 @@ public class Staff { ...@@ -21,6 +21,11 @@ public class Staff {
private String name; private String name;
/** /**
* 部门
*/
private String department;
/**
* 出勤列表 * 出勤列表
*/ */
private List<WorkCheck> workCheckList = new ArrayList<>(); private List<WorkCheck> workCheckList = new ArrayList<>();
......
...@@ -31,6 +31,11 @@ public class WorkCheck { ...@@ -31,6 +31,11 @@ public class WorkCheck {
private String state; private String state;
/** /**
* 审批
*/
private String approve = "";
/**
* 出勤时长(小时为单位) * 出勤时长(小时为单位)
*/ */
private Double duration; private Double duration;
......
...@@ -48,6 +48,8 @@ public class FileServiceImpl implements FileService { ...@@ -48,6 +48,8 @@ public class FileServiceImpl implements FileService {
staff.setName(entry.getKey()); staff.setName(entry.getKey());
entry.getValue().forEach(col -> { entry.getValue().forEach(col -> {
staff.setDepartment(col[3]);
WorkCheck workCheck = new WorkCheck(); WorkCheck workCheck = new WorkCheck();
workCheck.setDate(col[0]); workCheck.setDate(col[0]);
workCheck.setOnTime(col[0].concat(" ").concat(col[4])); workCheck.setOnTime(col[0].concat(" ").concat(col[4]));
...@@ -81,6 +83,8 @@ public class FileServiceImpl implements FileService { ...@@ -81,6 +83,8 @@ public class FileServiceImpl implements FileService {
staff.setName(entry.getKey()); staff.setName(entry.getKey());
entry.getValue().forEach(col -> { entry.getValue().forEach(col -> {
staff.setDepartment(col[3]);
WorkCheck workCheck = new WorkCheck(); WorkCheck workCheck = new WorkCheck();
workCheck.setDate(col[0]); workCheck.setDate(col[0]);
if (col[11].contains("--")) { if (col[11].contains("--")) {
...@@ -95,6 +99,7 @@ public class FileServiceImpl implements FileService { ...@@ -95,6 +99,7 @@ public class FileServiceImpl implements FileService {
workCheck.setOffTime(col[0].concat(" ").concat(col[14])); workCheck.setOffTime(col[0].concat(" ").concat(col[14]));
} }
workCheck.setState(caculateWorkState(workCheck)); workCheck.setState(caculateWorkState(workCheck));
workCheck.setApprove(col[7].contains("--") ? "" : col[7]);
staff.getWorkCheckList().add(workCheck); staff.getWorkCheckList().add(workCheck);
}); });
...@@ -186,7 +191,8 @@ public class FileServiceImpl implements FileService { ...@@ -186,7 +191,8 @@ public class FileServiceImpl implements FileService {
entry.getValue().entrySet().forEach(entry2 -> { entry.getValue().entrySet().forEach(entry2 -> {
List<Date> dateList = entry2.getValue().stream().map(e -> DateUtils.parseDate(e[4].concat(" ").concat(e[5]))) List<Date> dateList = entry2.getValue().stream()
.map(e -> DateUtils.parseDate(e[4].concat(" ").concat(e[5])))
.collect(Collectors.toList()); .collect(Collectors.toList());
WorkCheck workCheck = new WorkCheck(); WorkCheck workCheck = new WorkCheck();
...@@ -269,6 +275,7 @@ public class FileServiceImpl implements FileService { ...@@ -269,6 +275,7 @@ public class FileServiceImpl implements FileService {
List<WorkCheck> workChecks = new ArrayList<>(); List<WorkCheck> workChecks = new ArrayList<>();
value.forEach(s -> { value.forEach(s -> {
staff.setDepartment(s.getDepartment());
workChecks.addAll(s.getWorkCheckList()); workChecks.addAll(s.getWorkCheckList());
} }
); );
...@@ -288,6 +295,11 @@ public class FileServiceImpl implements FileService { ...@@ -288,6 +295,11 @@ public class FileServiceImpl implements FileService {
w.setOffTime(offTime); w.setOffTime(offTime);
w.setDate(entry.getKey()); w.setDate(entry.getKey());
w.setState(caculateWorkState(w)); w.setState(caculateWorkState(w));
List<WorkCheck> approveList = singleDateWorkCheck.stream()
.filter(wc -> StringUtils.isNotBlank(wc.getApprove()))
.collect(Collectors.toList());
w.setApprove(approveList.size() > 0 ? approveList.get(0).getApprove() : "");
newWorkCheckList.add(w); newWorkCheckList.add(w);
}); });
...@@ -296,7 +308,7 @@ public class FileServiceImpl implements FileService { ...@@ -296,7 +308,7 @@ public class FileServiceImpl implements FileService {
newStaffList.add(staff); newStaffList.add(staff);
}); });
newStaffList.sort(Comparator.comparing(Staff::getName)); newStaffList.sort(Comparator.comparing(Staff::getDepartment));
return newStaffList; return newStaffList;
} }
...@@ -344,7 +356,7 @@ public class FileServiceImpl implements FileService { ...@@ -344,7 +356,7 @@ public class FileServiceImpl implements FileService {
for (String title : titleList) { for (String title : titleList) {
if ("姓名".equalsIgnoreCase(title)) { if ("姓名".equalsIgnoreCase(title)) {
d[0] = staff.getName(); d[0] = staff.getName().concat("(").concat(staff.getDepartment()).concat(")");
} else { } else {
int index = titleList.indexOf(title); int index = titleList.indexOf(title);
boolean isExist = false; boolean isExist = false;
...@@ -357,9 +369,14 @@ public class FileServiceImpl implements FileService { ...@@ -357,9 +369,14 @@ public class FileServiceImpl implements FileService {
if (title.substring(0, title.indexOf("(")).equalsIgnoreCase( if (title.substring(0, title.indexOf("(")).equalsIgnoreCase(
DateUtils.format(DateUtils.parseDate(check.getDate()), DateUtils.yyyyMMdd))) { DateUtils.format(DateUtils.parseDate(check.getDate()), DateUtils.yyyyMMdd))) {
isExist = true;
String detail = ""; String detail = "";
if (!isWeekend) { if (!isWeekend) {
detail = check.getState(); detail = check.getState().concat(",").concat(check.getApprove());
}
if (isExist && isWeekend) {
detail = "加班";
} }
d[index] = detail.concat("(") d[index] = detail.concat("(")
...@@ -370,15 +387,16 @@ public class FileServiceImpl implements FileService { ...@@ -370,15 +387,16 @@ public class FileServiceImpl implements FileService {
new BigDecimal(check.getDuration()).setScale(2, BigDecimal.ROUND_HALF_UP) new BigDecimal(check.getDuration()).setScale(2, BigDecimal.ROUND_HALF_UP)
.doubleValue())) .doubleValue()))
.concat(")")); .concat(")"));
isExist = true;
} }
} }
if (!isExist) { if (!isExist) {
if (!isWeekend) { if (!isWeekend) {
d[index] = "无考勤记录"; d[index] = "无记录";
} else { } else {
d[index] = ""; d[index] = "未加班";
} }
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" <link rel="stylesheet" href="css/bootstrap.min.css">
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" <script src="js/bootstrap.min.js"></script>
crossorigin="anonymous">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>考勤</title> <title>考勤</title>
</head> </head>
...@@ -14,10 +13,10 @@ ...@@ -14,10 +13,10 @@
<div class="row align-items-center"> <div class="row align-items-center">
<table class="table table-bordered"> <table class="table table-bordered">
<tbody> <tbody>
<tr> <!--<tr>
<th scope="row">打卡机考勤记录:</th> <th scope="row">打卡机考勤记录:</th>
<td><input type="file" name="file"/></td> <td><input type="file" name="file"/></td>
</tr> </tr>-->
<tr> <tr>
<th scope="row">企业微信上下班打卡记录:</th> <th scope="row">企业微信上下班打卡记录:</th>
<td><input type="file" name="file"/></td> <td><input type="file" name="file"/></td>
...@@ -26,10 +25,10 @@ ...@@ -26,10 +25,10 @@
<th scope="row">企业微信外出打卡记录:</th> <th scope="row">企业微信外出打卡记录:</th>
<td><input type="file" name="file"/></td> <td><input type="file" name="file"/></td>
</tr> </tr>
<tr> <!--<tr>-->
<th scope="row">钉钉打卡记录:</th> <!--<th scope="row">钉钉打卡记录:</th>-->
<td><input type="file" name="file"/></td> <!--<td><input type="file" name="file"/></td>-->
</tr> <!--</tr>-->
</tbody> </tbody>
</table> </table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment