|
@@ -91,6 +91,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
private TaskGroupMapper taskGroupMapper;
|
|
|
@Resource
|
|
|
private ReportDeleteService reportDeleteService;
|
|
|
+ @Resource
|
|
|
+ private UserFvTimeMapper userFvTimeMapper;
|
|
|
|
|
|
@Resource
|
|
|
private DepartmentService departmentService;
|
|
@@ -111,8 +113,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
@Resource
|
|
|
private SysFunctionMapper sysFunctionMapper;
|
|
|
@Resource
|
|
|
- private UserFvTimeMapper userFvTimeMapper;
|
|
|
- @Resource
|
|
|
private ProjectBasecostSettingMapper projectBasecostSettingMapper;
|
|
|
@Resource
|
|
|
private UserDingdingTimeMapper userDingdingTimeMapper;
|
|
@@ -229,6 +229,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
private CompanyDictMapper companyDictMapper;
|
|
|
@Value(value = "${upload.path}")
|
|
|
private String path;
|
|
|
+ @Autowired
|
|
|
+ private BusinessTripMapper businessTripMapper;
|
|
|
+ @Autowired
|
|
|
+ private BustripProjectMapper bustripProjectMapper;
|
|
|
|
|
|
|
|
|
//获取报告列表
|
|
@@ -848,6 +852,19 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
});
|
|
|
resultMap.put("report", reports);
|
|
|
+ if(CollectionUtils.isEmpty(reports)){
|
|
|
+ List<BustripProject> businessTrips = bustripProjectMapper.getByDate(date,userId);
|
|
|
+// List<BusinessTrip> businessTrips = bustripProjectMapper.selectList(new LambdaQueryWrapper<BusinessTrip>()
|
|
|
+// .eq(BusinessTrip::getOwnerId, userId)
|
|
|
+// .lt(BusinessTrip::getStartDate,date)
|
|
|
+// .gt(BusinessTrip::getEndDate,date)
|
|
|
+// );
|
|
|
+// if(CollectionUtils.isNotEmpty(businessTrips)){
|
|
|
+// resultMap.put("businessTrips",businessTrips);
|
|
|
+// }
|
|
|
+ resultMap.put("businessTrips",businessTrips);
|
|
|
+
|
|
|
+ }
|
|
|
boolean showRefresh = false;
|
|
|
if (timeType.getShowDdCardtime() == 1) {
|
|
|
List<UserDingdingTime> dingdingTimes = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>()
|
|
@@ -1321,6 +1338,44 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ //如果是实时提醒审核,需要立即发送消息通知
|
|
|
+ if (timeType.getAlertAuditMode() == 1 && reportList.get(0).getState() == 0) {
|
|
|
+ //检查是否为企业微信用户
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
|
|
|
+ if (wxCorpInfo != null) {
|
|
|
+ for (Report report : reportList) {
|
|
|
+ String corpwxUserid = userMapper.selectById(report.getProjectAuditorId()).getCorpwxUserid();
|
|
|
+ //推送到企业微信
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
+ JSONArray dataJson=new JSONArray();
|
|
|
+ JSONObject jsonObj=new JSONObject();
|
|
|
+ if (timeType.getAlertType() == 4) {
|
|
|
+ jsonObj.put("key", "提示");
|
|
|
+ String msgContent = timeType.getAlertCheckMsg();
|
|
|
+ if (StringUtils.isEmpty(msgContent)) {
|
|
|
+ msgContent = "待审核数量:"+1;
|
|
|
+ } else {
|
|
|
+ msgContent = msgContent.replace("{0}", "1");
|
|
|
+ }
|
|
|
+ jsonObj.put("value",msgContent);
|
|
|
+ } else {
|
|
|
+ jsonObj.put("key", "待审核数量");
|
|
|
+ jsonObj.put("value","1");
|
|
|
+ }
|
|
|
+ dataJson.add(jsonObj);
|
|
|
+// if(isPrivateDeploy){
|
|
|
+// json.put("content","待审核数量: "+1+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri="+pcUrl+"/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去审核</a>");
|
|
|
+// }else {
|
|
|
+ String templateId = timeType.getAlertType() == 4 ? "tty9TkCAAAtDDCqY796mGulF9c5Jmwng":"tty9TkCAAAuPvPjabDdQXGocnG0K24EQ";
|
|
|
+ json.put("template_id",templateId);
|
|
|
+ json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=review#wechat_redirect");
|
|
|
+ json.put("content_item",dataJson);
|
|
|
+// }
|
|
|
+// System.out.println("发送企业微信消息==用户:"+corpwxUserid+", "+json.toJSONString());
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
//没有需要更新的,则
|
|
|
}
|
|
@@ -1993,6 +2048,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//获取待审核项目报告列表
|
|
|
@Override
|
|
|
public HttpRespMsg getListByState(Integer state, Integer departmentId,
|
|
@@ -10775,83 +10832,166 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getReportTimeLessThanCardTimeList(String date, Integer deptId, String userId) {
|
|
|
+ public void checkAndAlertFVReportTimeLessThanCardTimeList(LocalDate startDate, LocalDate endDate, Integer companyId) {
|
|
|
+ List<Map<String, Object>> data = getReportTimeLessThanCardTimeList(startDate, endDate, null,null, companyId, true);
|
|
|
+ if (data.size() > 0) {
|
|
|
+ //发送企业微信消息提醒,给员工和系统管理员
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
+ String wxUserIds = userList.stream().map(User::getCorpwxUserid).collect(Collectors.joining("|"));
|
|
|
+ wxCorpInfoService.sendWXCorpMsg(wxCorpInfo, wxUserIds, "您最近一周内考勤工时填报存在异常,请及时修正!", null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_ABNOEMAL);
|
|
|
+
|
|
|
+// for (Map<String, Object> map : data) {
|
|
|
+// String userId = String.valueOf(map.get("userId"));
|
|
|
+// String userName = String.valueOf(map.get("userName"));
|
|
|
+// }
|
|
|
+ //给管理员发送
|
|
|
+ List<User> adminList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).eq("role_name", "系统管理员"));
|
|
|
+ String adminIds = adminList.stream().map(User::getCorpwxUserid).collect(Collectors.joining("|"));
|
|
|
+ wxCorpInfoService.sendWXCorpMsg(wxCorpInfo, adminIds, "员工最近一周内考勤工时填报存在异常,请关注!", null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_ABNOEMAL);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getReportTimeLessThanCardTimeList(LocalDate firstDay, LocalDate lastDay, Integer deptId, String userId, Integer companyId, boolean getAll) {
|
|
|
//获取自己的考勤未填满的记录
|
|
|
- User user = userMapper.selectById(request.getHeader("token"));
|
|
|
- Integer companyId = user.getCompanyId();
|
|
|
- //获取考勤表记录
|
|
|
- List<UserCorpwxTime> userCorpwxTimeList = new ArrayList<>();
|
|
|
- //date格式为2024-09, 需要获取该月的第一天和最后一天
|
|
|
- LocalDate firstDay = LocalDate.parse(date + "-01");
|
|
|
- LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
|
|
|
- //检查权限,有查看全公司数值的权限
|
|
|
- boolean canViewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全公司工时");
|
|
|
+ boolean canViewAll = getAll;
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
+ User user = !canViewAll ? userMapper.selectById(request.getHeader("token")) : null;
|
|
|
+ if (!canViewAll) {
|
|
|
+ //检查权限,有查看全公司数值的权限
|
|
|
+ canViewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全公司工时");
|
|
|
+ }
|
|
|
+
|
|
|
List<User> manageUserList = new ArrayList<>();
|
|
|
- if (canViewAll) {
|
|
|
- if (!StringUtils.isEmpty(userId)) {
|
|
|
- User findUser = userMapper.selectById(userId);
|
|
|
- if (findUser != null) {
|
|
|
- userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).eq("corpwx_userid", findUser.getCorpwxUserid()).between("create_date", firstDay, lastDay));
|
|
|
- manageUserList.add(findUser);
|
|
|
- }
|
|
|
- } else if (deptId != null) {
|
|
|
- //按部门过滤
|
|
|
- List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
- List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
- manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
|
|
|
- if (manageUserList.size() > 0) {
|
|
|
- List<String> collect = manageUserList.stream().map(User::getCorpwxUserid).collect(Collectors.toList());
|
|
|
- userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).in("corpwx_userid", collect).between("create_date", firstDay, lastDay));
|
|
|
- }
|
|
|
- } else {
|
|
|
- userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).between("create_date", firstDay, lastDay));
|
|
|
- manageUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
- }
|
|
|
- } else {
|
|
|
- //是否是部门负责人
|
|
|
- List<Integer> allDeptIds = getAllVisibleDeptIdList(user, departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId)));
|
|
|
- if (allDeptIds.size() > 0) {
|
|
|
+ List<UserCorpwxTime> userCorpwxTimeList = new ArrayList<>();
|
|
|
+ List<UserFvTime> userFvTimeList = new ArrayList<>();
|
|
|
+ if (timeType.getSyncCorpwxTime() == 1) {
|
|
|
+ //获取考勤表记录
|
|
|
+ if (canViewAll) {
|
|
|
if (!StringUtils.isEmpty(userId)) {
|
|
|
User findUser = userMapper.selectById(userId);
|
|
|
if (findUser != null) {
|
|
|
+ userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).eq("corpwx_userid", findUser.getCorpwxUserid()).between("create_date", firstDay, lastDay));
|
|
|
manageUserList.add(findUser);
|
|
|
}
|
|
|
- } else if (deptId != null) {
|
|
|
+ } else if (deptId != null) {
|
|
|
//按部门过滤
|
|
|
- if (allDeptIds.contains(deptId)) {
|
|
|
- List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
- List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
- manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
|
|
|
+ if (manageUserList.size() > 0) {
|
|
|
+ List<String> collect = manageUserList.stream().map(User::getCorpwxUserid).collect(Collectors.toList());
|
|
|
+ userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).in("corpwx_userid", collect).between("create_date", firstDay, lastDay));
|
|
|
}
|
|
|
} else {
|
|
|
- //取部门的人员
|
|
|
- manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds));
|
|
|
+ userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).between("create_date", firstDay, lastDay));
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
}
|
|
|
- //如果自己不在manageUserList中,加进去
|
|
|
- if (!manageUserList.stream().anyMatch(u -> u.getId().equals(user.getId()))) {
|
|
|
+ } else {
|
|
|
+ //是否是部门负责人
|
|
|
+ List<Integer> allDeptIds = getAllVisibleDeptIdList(user, departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId)));
|
|
|
+ if (allDeptIds.size() > 0) {
|
|
|
+ if (!StringUtils.isEmpty(userId)) {
|
|
|
+ User findUser = userMapper.selectById(userId);
|
|
|
+ if (findUser != null) {
|
|
|
+ manageUserList.add(findUser);
|
|
|
+ }
|
|
|
+ } else if (deptId != null) {
|
|
|
+ //按部门过滤
|
|
|
+ if (allDeptIds.contains(deptId)) {
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //取部门的人员
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds));
|
|
|
+ }
|
|
|
+ //如果自己不在manageUserList中,加进去
|
|
|
+ if (!manageUserList.stream().anyMatch(u -> u.getId().equals(user.getId()))) {
|
|
|
+ manageUserList.add(user);
|
|
|
+ }
|
|
|
+ List<String> userCorpwxidList = manageUserList.stream().filter(u->u.getCorpwxUserid() != null).map(User::getCorpwxUserid).collect(Collectors.toList());
|
|
|
+ if (userCorpwxidList.size() > 0) {
|
|
|
+ userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).in("corpwx_userid", userCorpwxidList).between("create_date", firstDay, lastDay));
|
|
|
+ }
|
|
|
+ //如果存在corpwxUserid位空的用户,按姓名匹配
|
|
|
+ List<String> nameList = manageUserList.stream().filter(u->u.getCorpwxUserid() == null).map(User::getName).collect(Collectors.toList());
|
|
|
+ if (nameList.size() == 0) {
|
|
|
+ userCorpwxTimeList.addAll(userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).in("name", nameList).between("create_date", firstDay, lastDay)));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //个人看自己的
|
|
|
+ if (user.getCorpwxUserid() != null) {
|
|
|
+ userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).eq("corpwx_userid", user.getCorpwxUserid()).between("create_date", firstDay, lastDay));
|
|
|
+ } else {
|
|
|
+ userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).eq("name", user.getName()).between("create_date", firstDay, lastDay));
|
|
|
+ }
|
|
|
manageUserList.add(user);
|
|
|
}
|
|
|
- List<String> userCorpwxidList = manageUserList.stream().filter(u->u.getCorpwxUserid() != null).map(User::getCorpwxUserid).collect(Collectors.toList());
|
|
|
- if (userCorpwxidList.size() > 0) {
|
|
|
- userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).in("corpwx_userid", userCorpwxidList).between("create_date", firstDay, lastDay));
|
|
|
- }
|
|
|
- //如果存在corpwxUserid位空的用户,按姓名匹配
|
|
|
- List<String> nameList = manageUserList.stream().filter(u->u.getCorpwxUserid() == null).map(User::getName).collect(Collectors.toList());
|
|
|
- if (nameList.size() == 0) {
|
|
|
- userCorpwxTimeList.addAll(userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).in("name", nameList).between("create_date", firstDay, lastDay)));
|
|
|
+ }
|
|
|
+ } else if (timeType.getSyncFanwei() == 1) {
|
|
|
+ //获取user_fv_time表的考勤记录
|
|
|
+ if (canViewAll) {
|
|
|
+ if (!StringUtils.isEmpty(userId)) {
|
|
|
+ User findUser = userMapper.selectById(userId);
|
|
|
+ if (findUser != null) {
|
|
|
+ userFvTimeList = userFvTimeMapper.selectList(new QueryWrapper<UserFvTime>().eq("company_id", companyId).eq("user_id", userId).between("create_date", firstDay, lastDay));
|
|
|
+ manageUserList.add(findUser);
|
|
|
+ }
|
|
|
+ } else if (deptId != null) {
|
|
|
+ //按部门过滤
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
|
|
|
+ if (manageUserList.size() > 0) {
|
|
|
+ List<String> collect = manageUserList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
+ userFvTimeList = userFvTimeMapper.selectList(new QueryWrapper<UserFvTime>().eq("company_id", companyId).in("user_id", collect).between("create_date", firstDay, lastDay));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ userFvTimeList = userFvTimeMapper.selectList(new QueryWrapper<UserFvTime>().eq("company_id", companyId).between("create_date", firstDay, lastDay));
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
}
|
|
|
} else {
|
|
|
- //个人看自己的
|
|
|
- if (user.getCorpwxUserid() != null) {
|
|
|
- userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).eq("corpwx_userid", user.getCorpwxUserid()).between("create_date", firstDay, lastDay));
|
|
|
+ //是否是部门负责人
|
|
|
+ List<Integer> allDeptIds = getAllVisibleDeptIdList(user, departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId)));
|
|
|
+ if (allDeptIds.size() > 0) {
|
|
|
+ if (!StringUtils.isEmpty(userId)) {
|
|
|
+ User findUser = userMapper.selectById(userId);
|
|
|
+ if (findUser != null) {
|
|
|
+ manageUserList.add(findUser);
|
|
|
+ }
|
|
|
+ } else if (deptId != null) {
|
|
|
+ //按部门过滤
|
|
|
+ if (allDeptIds.contains(deptId)) {
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //取部门的人员
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds));
|
|
|
+ }
|
|
|
+ //如果自己不在manageUserList中,加进去
|
|
|
+ if (!manageUserList.stream().anyMatch(u -> u.getId().equals(user.getId()))) {
|
|
|
+ manageUserList.add(user);
|
|
|
+ }
|
|
|
+ List<String> userIdList = manageUserList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
+ if (userIdList.size() > 0) {
|
|
|
+ userFvTimeList = userFvTimeMapper.selectList(new QueryWrapper<UserFvTime>().eq("company_id", companyId).in("user_id", userIdList).between("create_date", firstDay, lastDay));
|
|
|
+ }
|
|
|
} else {
|
|
|
- userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).eq("name", user.getName()).between("create_date", firstDay, lastDay));
|
|
|
+ //个人看自己的
|
|
|
+ userFvTimeList = userFvTimeMapper.selectList(new QueryWrapper<UserFvTime>().eq("company_id", companyId).eq("user_id", user.getId()).between("create_date", firstDay, lastDay));
|
|
|
+ manageUserList.add(user);
|
|
|
}
|
|
|
- manageUserList.add(user);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
//获取填报工时记录表
|
|
|
List<Report> reportList = new ArrayList<>();
|
|
|
if (canViewAll && StringUtils.isEmpty(userId) && deptId == null) {
|
|
@@ -10871,47 +11011,82 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//比对userCorpwxTimeList和reportList,找出工时未填满的记录
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- for (UserCorpwxTime corpwxTime : userCorpwxTimeList) {
|
|
|
- boolean isMatch = true;
|
|
|
- double reportTime = 0;
|
|
|
- User targetUser = null;
|
|
|
- if (corpwxTime.getCorpwxUserid() != null) {
|
|
|
- Optional<User> first = manageUserList.stream().filter(u -> corpwxTime.getCorpwxUserid().equals(u.getCorpwxUserid())).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- targetUser = first.get();
|
|
|
+ if (timeType.getSyncCorpwxTime() == 1) {
|
|
|
+ for (UserCorpwxTime corpwxTime : userCorpwxTimeList) {
|
|
|
+ boolean isMatch = true;
|
|
|
+ double reportTime = 0;
|
|
|
+ User targetUser = null;
|
|
|
+ if (corpwxTime.getCorpwxUserid() != null) {
|
|
|
+ Optional<User> first = manageUserList.stream().filter(u -> corpwxTime.getCorpwxUserid().equals(u.getCorpwxUserid())).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ targetUser = first.get();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Optional<User> first = manageUserList.stream().filter(u -> u.getName().equals(corpwxTime.getName())).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ targetUser = first.get();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (targetUser != null) {
|
|
|
+ for (Report report : reportList) {
|
|
|
+ if (report.getCreatorId().equals(targetUser.getId()) && corpwxTime.getCreateDate().isEqual(report.getCreateDate())) {
|
|
|
+ reportTime = report.getWorkingTime();
|
|
|
+ //不一致
|
|
|
+ if (Math.abs(corpwxTime.getWorkHours() - report.getWorkingTime()) > 0.01) {
|
|
|
+ isMatch = false;
|
|
|
+ //设置人员姓名
|
|
|
+ if (corpwxTime.getName() == null) {
|
|
|
+ corpwxTime.setName(targetUser.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- Optional<User> first = manageUserList.stream().filter(u -> u.getName().equals(corpwxTime.getName())).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- targetUser = first.get();
|
|
|
+
|
|
|
+ if (!isMatch) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (targetUser != null) {
|
|
|
+ map.put("userId", targetUser.getId());
|
|
|
+ }
|
|
|
+ map.put("name", corpwxTime.getName());
|
|
|
+ map.put("createDate", dateTimeFormatter.format(corpwxTime.getCreateDate()));
|
|
|
+ map.put("workHours", corpwxTime.getWorkHours());
|
|
|
+ map.put("reportTime", reportTime);
|
|
|
+ resultList.add(map);
|
|
|
}
|
|
|
}
|
|
|
- if (targetUser != null) {
|
|
|
- for (Report report : reportList) {
|
|
|
- if (report.getCreatorId().equals(targetUser.getId()) && corpwxTime.getCreateDate().isEqual(report.getCreateDate())) {
|
|
|
- reportTime = report.getWorkingTime();
|
|
|
- //不一致
|
|
|
- if (Math.abs(corpwxTime.getWorkHours() - report.getWorkingTime()) > 0.01) {
|
|
|
- isMatch = false;
|
|
|
- //设置人员姓名
|
|
|
- if (corpwxTime.getName() == null) {
|
|
|
- corpwxTime.setName(targetUser.getName());
|
|
|
+ } else if (timeType.getSyncFanwei() == 1) {
|
|
|
+ for (UserFvTime fvTime : userFvTimeList) {
|
|
|
+ boolean isMatch = true;
|
|
|
+ double reportTime = 0;
|
|
|
+ User targetUser = manageUserList.stream().filter(u -> fvTime.getUserId().equals(u.getId())).findFirst().get();;
|
|
|
+ if (targetUser != null) {
|
|
|
+ for (Report report : reportList) {
|
|
|
+ if (report.getCreatorId().equals(targetUser.getId()) && fvTime.getWorkDate().isEqual(report.getCreateDate())) {
|
|
|
+ reportTime = report.getWorkingTime();
|
|
|
+ //不一致
|
|
|
+ if (Math.abs(fvTime.getWorkHours() - report.getWorkingTime()) > 0.01) {
|
|
|
+ isMatch = false;
|
|
|
+ fvTime.setName(targetUser.getName());
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (!isMatch) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("name", corpwxTime.getName());
|
|
|
- map.put("createDate", dateTimeFormatter.format(corpwxTime.getCreateDate()));
|
|
|
- map.put("workHours", corpwxTime.getWorkHours());
|
|
|
- map.put("reportTime", reportTime);
|
|
|
- resultList.add(map);
|
|
|
+ if (!isMatch) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("userId", fvTime.getUserId());
|
|
|
+ map.put("name", fvTime.getName());
|
|
|
+ map.put("createDate", dateTimeFormatter.format(fvTime.getWorkDate()));
|
|
|
+ map.put("workHours", fvTime.getWorkHours());
|
|
|
+ map.put("reportTime", reportTime);
|
|
|
+ resultList.add(map);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//反向,检测有填报日报但是没有考勤的数据
|
|
|
for (Report report : reportList) {
|
|
|
boolean hasCardTime = false;
|
|
@@ -10920,29 +11095,42 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
continue;
|
|
|
}
|
|
|
User targetUser = first.get();
|
|
|
- for (UserCorpwxTime corpwxTime : userCorpwxTimeList) {
|
|
|
- if ((targetUser.getCorpwxUserid() != null && targetUser.getCorpwxUserid().equals(corpwxTime.getCorpwxUserid()))
|
|
|
- || (targetUser.getCorpwxUserid() == null && targetUser.getName().equals(corpwxTime.getName()))) {
|
|
|
- //人员匹配上了,匹配日期
|
|
|
- if (corpwxTime.getCreateDate().isEqual(report.getCreateDate())) {
|
|
|
- if (corpwxTime.getWorkHours() > 0) {
|
|
|
+ if (timeType.getSyncCorpwxTime() == 1) {
|
|
|
+ for (UserCorpwxTime corpwxTime : userCorpwxTimeList) {
|
|
|
+ if ((targetUser.getCorpwxUserid() != null && targetUser.getCorpwxUserid().equals(corpwxTime.getCorpwxUserid()))
|
|
|
+ || (targetUser.getCorpwxUserid() == null && targetUser.getName().equals(corpwxTime.getName()))) {
|
|
|
+ //人员匹配上了,匹配日期
|
|
|
+ if (corpwxTime.getCreateDate().isEqual(report.getCreateDate())) {
|
|
|
+ if (corpwxTime.getWorkHours() > 0) {
|
|
|
+ hasCardTime = true;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (timeType.getSyncFanwei() == 1) {
|
|
|
+ for (UserFvTime fvTime : userFvTimeList) {
|
|
|
+ //人员/日期匹配
|
|
|
+ if (targetUser.getId().equals(fvTime.getUserId()) && fvTime.getWorkDate().isEqual(report.getCreateDate())) {
|
|
|
+ if (fvTime.getWorkHours() > 0) {
|
|
|
hasCardTime = true;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (!hasCardTime) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("name", user.getName());
|
|
|
+ map.put("userId", targetUser.getId());
|
|
|
+ map.put("name", targetUser.getName());
|
|
|
map.put("createDate", dateTimeFormatter.format(report.getCreateDate()));
|
|
|
map.put("workHours", 0);
|
|
|
map.put("reportTime", report.getWorkingTime());
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
}
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setData(resultList);
|
|
|
- return msg;
|
|
|
+
|
|
|
+ return resultList;
|
|
|
}
|
|
|
}
|