|
@@ -2015,7 +2015,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
allRangeUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
}
|
|
|
List<UserMonthWork> userMonthWorks = new ArrayList<UserMonthWork>();
|
|
|
- List<UserDailyWorkItem> noReportDataList = new ArrayList<UserDailyWorkItem>();
|
|
|
//准备部门数据
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
//获取所有同步的企业微信数据
|
|
@@ -2023,13 +2022,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Map> userCorpwxTimeMapList = userCorpwxTimeMapper.selectByAsk(companyId,startDate,endDate);
|
|
|
LocalDateTime b=LocalDateTime.now();
|
|
|
long l = Duration.between(a, b).toMillis();
|
|
|
- System.out.println("查询耗时======================"+l+"毫秒");
|
|
|
String lastUserId = null;
|
|
|
UserMonthWork lastUserData = null;
|
|
|
- List<String> fillReportUserIds = new ArrayList<>();
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- System.out.println("初始数据========="+userCorpwxTimeMapList.toString()+"=========size"+userCorpwxTimeMapList.size());
|
|
|
- final CopyOnWriteArrayList<Map> cowList = new CopyOnWriteArrayList<Map>(userCorpwxTimeMapList);
|
|
|
for (Map<String, Object> data : list) {
|
|
|
String id = (String)data.get("id");
|
|
|
String name = (String)data.get("name");
|
|
@@ -2037,27 +2031,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
String date = new SimpleDateFormat("yyyy-MM-dd").format((Date)data.get("createDate"));
|
|
|
String corpwxUserid = (String) data.get("corpwxUserId");
|
|
|
- List<Map> userCorpwxListOn = userCorpwxTimeMapList.stream().filter(mapList -> mapList.get("create_date").toString().equals(data.get("createDate").toString())
|
|
|
- && mapList.get("corpwx_userid").equals(corpwxUserid)).collect(Collectors.toList());
|
|
|
- if(!userCorpwxListOn.isEmpty()){
|
|
|
- Map mapCheck=userCorpwxListOn.get(0);
|
|
|
- for (Map item : cowList) {
|
|
|
- if (item.get("corpwx_userid").equals(mapCheck.get("corpwx_userid"))&&item.get("create_date").toString().equals(mapCheck.get("create_date").toString())) {
|
|
|
- cowList.remove(item);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(!userCorpwxListOn.isEmpty()){
|
|
|
- userCorpwxTimeMapList.remove(userCorpwxListOn.get(0));
|
|
|
- }
|
|
|
- if(!userCorpwxListOn.isEmpty()&&(double) data.get("workingTime")==0){
|
|
|
- if ("woy9TkCAAAge3jSm5ofTLXBdizZIIFCg".equals(corpwxUserid)) {
|
|
|
- System.out.println("======吕伟===请假111");
|
|
|
- }
|
|
|
- map.put("workingTime", "请假");
|
|
|
- }else{
|
|
|
- map.put("workingTime", data.get("workingTime"));
|
|
|
- }
|
|
|
+ map.put("workingTime", data.get("workingTime"));
|
|
|
map.put("createDate", date);
|
|
|
if (id.equals(lastUserId)) {
|
|
|
//同一个用户的数据
|
|
@@ -2075,24 +2049,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
lastUserId = id;
|
|
|
}
|
|
|
- System.out.println("结束数据=========="+userCorpwxTimeMapList.toString()+"=========size"+userCorpwxTimeMapList.size());
|
|
|
- for(UserMonthWork userMonthWork:userMonthWorks){
|
|
|
- for(Map map:userCorpwxTimeMapList){
|
|
|
- if(map.get("corpwx_userid").equals(userMonthWork.corpwxUserId)){
|
|
|
- Map mapIt=new HashMap();
|
|
|
- if ("woy9TkCAAAge3jSm5ofTLXBdizZIIFCg".equals(userMonthWork.corpwxUserId)) {
|
|
|
- System.out.println("======吕伟===请假");
|
|
|
- }
|
|
|
- mapIt.put("workingTime", "请假");
|
|
|
- String date = new SimpleDateFormat("yyyy-MM-dd").format((Date)map.get("create_date"));
|
|
|
- mapIt.put("createDate", date);
|
|
|
- userMonthWork.worktimeList.add(mapIt);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
LocalDateTime c=LocalDateTime.now();
|
|
|
- long l1 = Duration.between(b, c).toMillis();
|
|
|
- System.out.println("数据处理耗时==========="+l1+"毫秒");
|
|
|
//计算未填的人员
|
|
|
List<User> noReportUserList = allRangeUserList.stream()
|
|
|
.filter(au->!userMonthWorks.stream().anyMatch(mon->mon.userId.equals(au.getId())))
|
|
@@ -2102,6 +2060,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
UserMonthWork mon = new UserMonthWork();
|
|
|
mon.userId = noR.getId();
|
|
|
mon.name = noR.getName();
|
|
|
+ mon.corpwxUserId = noR.getCorpwxUserid();
|
|
|
Optional<Department> find = departmentList.stream().filter(dept->dept.getDepartmentId().equals(noR.getDepartmentId())).findFirst();
|
|
|
if (find.isPresent()) {
|
|
|
mon.departmentName = find.get().getDepartmentName();
|
|
@@ -2111,7 +2070,35 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
mon.worktimeList = new ArrayList<>();
|
|
|
userMonthWorks.add(mon);
|
|
|
});
|
|
|
-
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ //对于全部的用户已填日报,对比请假的数据,进行填充
|
|
|
+ for (UserMonthWork userMonthWork : userMonthWorks) {
|
|
|
+ List<Map<String, Object>> worktimeList = userMonthWork.worktimeList;
|
|
|
+ //获取到该员工请假的数据
|
|
|
+ List<Map<String, Object>> curUserCorpTime = new ArrayList<>();
|
|
|
+ for (Map<String, Object> corpWx : userCorpwxTimeMapList) {
|
|
|
+ if (((String)corpWx.get("corpwx_userid")).equals(userMonthWork.corpwxUserId)) {
|
|
|
+ curUserCorpTime.add(corpWx);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ curUserCorpTime.forEach(corpTime->{
|
|
|
+ java.sql.Date leaveDate = (java.sql.Date)corpTime.get("create_date");
|
|
|
+ String leaveDateStr = sdf.format(leaveDate);
|
|
|
+ Optional<Map<String, Object>> find = worktimeList.stream().filter(w->((String)w.get("createDate")).equals(leaveDateStr)).findFirst();
|
|
|
+ if (find.isPresent()) {
|
|
|
+ //打卡的有记录,加上请假
|
|
|
+ String newStr = (double)find.get().get("workingTime")+"(请假"+(corpTime.get("ask_leave_time"))+"h)";
|
|
|
+ find.get().put("workingTime", newStr);
|
|
|
+ } else {
|
|
|
+ //没有对应的打卡记录,直接加上当天请假
|
|
|
+ Map<String, Object> leaveMap = new HashMap<>();
|
|
|
+ leaveMap.put("createDate", leaveDateStr);
|
|
|
+ leaveMap.put("workingTime", "请假"+corpTime.get("ask_leave_time")+"h");
|
|
|
+ worktimeList.add(leaveMap);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
HashMap map = new HashMap();
|
|
|
List<HashMap> days = new ArrayList<HashMap>();
|
|
|
DateTimeFormatter standFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
@@ -2911,7 +2898,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (!list.stream().anyMatch(item->item.get("id").equals(curUser.getId())&&sdf.format((java.sql.Date)item.get("createDate")).equals(dateStr))) {
|
|
|
UserDailyWorkItem noRecord = new UserDailyWorkItem();
|
|
|
noRecord.userId = curUser.getId();
|
|
|
- List<Map> userCorpwxListOn = userCorpwxTimeMapList.stream().filter(mapList -> mapList.get("create_date").toString().equals(dateStr)
|
|
|
+ List<Map> userCorpwxListOn = userCorpwxTimeMapList.stream().filter(mapList -> sdf.format((java.sql.Date)mapList.get("create_date")).equals(dateStr)
|
|
|
&& mapList.get("corpwx_userid").equals(curUser.getCorpwxUserid())).collect(Collectors.toList());
|
|
|
if(!userCorpwxListOn.isEmpty()){
|
|
|
noRecord.createDate = dtf.format(date)+"/请假";
|