|
@@ -204,6 +204,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
private ExcelExportService excelExportService;
|
|
private ExcelExportService excelExportService;
|
|
@Resource
|
|
@Resource
|
|
private ProjectMainMapper projectMainMapper;
|
|
private ProjectMainMapper projectMainMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private HolidaySettingService holidaySettingService;
|
|
@Autowired
|
|
@Autowired
|
|
RestTemplate restTemplate;
|
|
RestTemplate restTemplate;
|
|
|
|
|
|
@@ -237,206 +239,39 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
//首先根据日期获取当天所有提交过日志的人
|
|
//首先根据日期获取当天所有提交过日志的人
|
|
String userId = request.getHeader("Token");
|
|
String userId = request.getHeader("Token");
|
|
User user = userMapper.selectById(userId);
|
|
User user = userMapper.selectById(userId);
|
|
- TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
|
|
|
+ String viewUserId = user.getId();
|
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
List<Map<String, Object>> nameList = new ArrayList<>();
|
|
List<Map<String, Object>> nameList = new ArrayList<>();
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
|
|
Integer totalMembCount = 0;
|
|
Integer totalMembCount = 0;
|
|
if (functionList.size() == 0) {
|
|
if (functionList.size() == 0) {
|
|
- String leaderId = user.getId();
|
|
|
|
- //不是项目经理,只看自己的报告
|
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
- //没有指定员工或者指定的就是自己
|
|
|
|
- if (targetUid == null || targetUid.equals(user.getId())) {
|
|
|
|
- //查看自己的日报
|
|
|
|
- if (pageIndex != null && pageIndex == 0) {
|
|
|
|
- //仅第一页显示自己的
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- map.put("id", user.getId());
|
|
|
|
- map.put("name", user.getName());
|
|
|
|
- List<String> uids = new ArrayList<>();
|
|
|
|
- uids.add(user.getId());
|
|
|
|
- list = reportMapper.getUserReportByDateOrId(date, uids, null);
|
|
|
|
- if (list.size() > 0) {
|
|
|
|
- //个人日报
|
|
|
|
- nameList.add(map);
|
|
|
|
- map.put("data", list);
|
|
|
|
- double reportTime = 0;
|
|
|
|
- BigDecimal total = new BigDecimal(0);
|
|
|
|
- int state = (int)list.get(0).get("state");
|
|
|
|
- boolean hasDeny = false;
|
|
|
|
- boolean hasWaiting = false;
|
|
|
|
- for (Map<String, Object> m : list) {
|
|
|
|
- double t = (double) m.get("time");
|
|
|
|
- reportTime += t;
|
|
|
|
- total = total.add((BigDecimal)m.get("cost"));
|
|
|
|
- int curState = (int)m.get("state");
|
|
|
|
- if (curState == 2) {
|
|
|
|
- hasDeny = true;
|
|
|
|
- }
|
|
|
|
- if (curState == 0) {
|
|
|
|
- hasWaiting = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(hasDeny) {
|
|
|
|
- state = 2;
|
|
|
|
- } else if (hasWaiting) {
|
|
|
|
- state = 0;
|
|
|
|
- }
|
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
- map.put("reportTime", df.format(reportTime));
|
|
|
|
- map.put("cost", total);
|
|
|
|
- map.put("state", state);
|
|
|
|
- }
|
|
|
|
|
|
+ List<Integer> allVisibleDeptIdList = null;
|
|
|
|
+ if (deptId != null) {
|
|
|
|
+ //指定了部门进行查看
|
|
|
|
+ allVisibleDeptIdList = new ArrayList<>();
|
|
|
|
+ allVisibleDeptIdList.add(deptId);
|
|
|
|
+ //找到该部门的所有子部门
|
|
|
|
+ List<Department> allDepts = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
|
+ Optional<Department> first = allDepts.stream().filter(d -> d.getDepartmentId().equals(deptId)).findFirst();
|
|
|
|
+ if (first.isPresent()) {
|
|
|
|
+ Department department = first.get();
|
|
|
|
+ //递归获取全部子部门
|
|
|
|
+ List<Department> deptList = getSubDepts(department, allDepts);
|
|
|
|
+ deptList.add(department);
|
|
|
|
+ List<Integer> ids = deptList.stream().map(Department::getDepartmentId).collect(Collectors.toList());
|
|
|
|
+ allVisibleDeptIdList.addAll(ids);
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ allVisibleDeptIdList = getAllVisibleDeptIdList(user, null);
|
|
}
|
|
}
|
|
-
|
|
|
|
- List<Integer> allVisibleDeptIdList = getAllVisibleDeptIdList(user, null);
|
|
|
|
//需要看可见部门(部门主要负责人和其他负责人以及查看本部门工时权限)所有人员的日报
|
|
//需要看可见部门(部门主要负责人和其他负责人以及查看本部门工时权限)所有人员的日报
|
|
- if (allVisibleDeptIdList.size() > 0) {
|
|
|
|
- if (nameList.size() > 0) {
|
|
|
|
- //自己填写的日报
|
|
|
|
- List<Map<String, Object>> deptNameList = reportMapper.getReportNameByDateAndDept(date,
|
|
|
|
- allVisibleDeptIdList, targetUid, null, pageStart, pageSize);
|
|
|
|
- totalMembCount = reportMapper.getReportNameByDateAndDeptCount(date, allVisibleDeptIdList, targetUid, null);
|
|
|
|
- for (Map<String, Object> deptNameItem : deptNameList) {
|
|
|
|
- if (!deptNameItem.get("id").equals(user.getId())) {
|
|
|
|
- nameList.add(deptNameItem);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- nameList = reportMapper.getReportNameByDateAndDept(date,
|
|
|
|
- allVisibleDeptIdList, targetUid, null, pageStart, pageSize);
|
|
|
|
- totalMembCount = reportMapper.getReportNameByDateAndDeptCount(date, allVisibleDeptIdList, targetUid, null);
|
|
|
|
- }
|
|
|
|
- if (nameList.size() > 0) {
|
|
|
|
- List<String> userIds = new ArrayList<>();
|
|
|
|
- nameList.forEach(n->{
|
|
|
|
- String id = (String) n.get("id");
|
|
|
|
- userIds.add(id);
|
|
|
|
- });
|
|
|
|
- List<Map<String, Object>> reportList = reportMapper.getUserReportByDateOrId(date, userIds, null);
|
|
|
|
- for (Map<String, Object> memb : nameList) {
|
|
|
|
- //再根据人分别获取当天的报告
|
|
|
|
- List<Map<String, Object>> rList = new ArrayList<Map<String, Object>>();
|
|
|
|
- BigDecimal total = new BigDecimal(0);
|
|
|
|
- for (Map<String, Object> report : reportList) {
|
|
|
|
- if (((String)report.get("creatorId")).equals((String)memb.get("id"))) {
|
|
|
|
- rList.add(report);
|
|
|
|
- total = total.add((BigDecimal) report.get("cost"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- memb.put("data", rList);
|
|
|
|
- memb.put("cost", total);
|
|
|
|
- double reportTime = 0;
|
|
|
|
- if (rList.size() > 0) {
|
|
|
|
- int state = 1;
|
|
|
|
- for (Map<String, Object> m : rList) {
|
|
|
|
- double t = (double) m.get("time");
|
|
|
|
- reportTime += t;
|
|
|
|
-
|
|
|
|
- //取最低的状态
|
|
|
|
- if (state == 2) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if (state == 0) {
|
|
|
|
- if ((int)m.get("state") == 2) {
|
|
|
|
- state = 2;
|
|
|
|
- } else {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- state = (int)m.get("state");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- memb.put("state", state);
|
|
|
|
- }
|
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
- memb.put("reportTime", df.format(reportTime));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(deptId==null&&targetUid==null){
|
|
|
|
- //担任项目经理或者日报审核人,查找相关的人员的日报
|
|
|
|
- List<Map<String, Object>> puserNames = reportMapper.getReportNameByDate(date, user.getCompanyId(), leaderId);
|
|
|
|
- List<Map<String, Object>> inchargeReportList= reportMapper.getInchargeReportByDate(date, leaderId, null);
|
|
|
|
-
|
|
|
|
- if ((timeType.getReportAuditType() == 5 || timeType.getReportAuditType() == 6)&& timeType.getReportCc() == 1) {
|
|
|
|
- //存在抄送人的设置,需要把抄送人的项目相关日报也加上
|
|
|
|
- List<Map<String, Object>> viewUserNames = reportMapper.getCcReportNameByDate(date, user.getCompanyId(),leaderId);
|
|
|
|
- for (Map<String, Object> viewItem : viewUserNames) {
|
|
|
|
- boolean exists = false;
|
|
|
|
- for (Map<String, Object> u : puserNames) {
|
|
|
|
- if (u.get("id").equals(viewItem.get("id"))) {
|
|
|
|
- exists = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!exists) {
|
|
|
|
- puserNames.add(viewItem);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<Map<String, Object>> viewReportList = reportMapper.getCcReportByDate(date, leaderId, null);
|
|
|
|
- for (Map<String, Object> viewItem : viewReportList) {
|
|
|
|
- boolean exists = false;
|
|
|
|
- for (Map<String, Object> u : inchargeReportList) {
|
|
|
|
- if (u.get("id").equals(viewItem.get("id"))) {
|
|
|
|
- exists = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!exists) {
|
|
|
|
- inchargeReportList.add(viewItem);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- for (Map<String, Object> map2 : puserNames) {
|
|
|
|
-
|
|
|
|
- if (nameList.size() > 0) {
|
|
|
|
- String myUserId = (String)nameList.get(0).get("id");
|
|
|
|
- if (myUserId.equals(map2.get("id"))) {
|
|
|
|
- //自己的报告,之前已经添加过了,排重
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- List<Object> collect = nameList.stream().map(nl -> nl.get("")).collect(Collectors.toList());
|
|
|
|
- if(!collect.contains(map2.get("id"))){
|
|
|
|
- nameList.add(map2);
|
|
|
|
- }
|
|
|
|
- //再根据人分别获取当天的报告
|
|
|
|
- List<Map<String, Object>> list2 =
|
|
|
|
- inchargeReportList.stream().filter(i->i.get("creatorId").equals(map2.get("id"))).collect(Collectors.toList());
|
|
|
|
- map2.put("data", list2);
|
|
|
|
-
|
|
|
|
- double reportTime = 0;
|
|
|
|
- BigDecimal total = new BigDecimal(0);
|
|
|
|
- int state = 1;
|
|
|
|
- for (Map<String, Object> m : list2) {
|
|
|
|
- double t = (double) m.get("time");
|
|
|
|
- reportTime += t;
|
|
|
|
- total = total.add((BigDecimal)m.get("cost"));
|
|
|
|
- //取最低的状态
|
|
|
|
- if (state == 2) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if (state == 0) {
|
|
|
|
- if ((int)m.get("state") == 2) {
|
|
|
|
- state = 2;
|
|
|
|
- } else {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- state = (int)m.get("state");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
- map2.put("reportTime", df.format(reportTime));
|
|
|
|
- map2.put("cost", total);
|
|
|
|
- map2.put("state", state);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ nameList = reportMapper.getReportNameByDateAndDept(date,
|
|
|
|
+ allVisibleDeptIdList.size() > 0?allVisibleDeptIdList:null, targetUid, companyId, (deptId == null?viewUserId:null), pageStart, pageSize);
|
|
|
|
+ totalMembCount = reportMapper.getReportNameByDateAndDeptCount(date, allVisibleDeptIdList.size() > 0?allVisibleDeptIdList:null, targetUid, companyId, (deptId == null?viewUserId:null));
|
|
} else {
|
|
} else {
|
|
- Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
|
|
|
|
+ //查看全公司的数据
|
|
List<Integer> ids = null;
|
|
List<Integer> ids = null;
|
|
if (deptId != null) {
|
|
if (deptId != null) {
|
|
if (deptId == 0) {
|
|
if (deptId == 0) {
|
|
@@ -457,53 +292,53 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
nameList = reportMapper.getReportNameByDateAndDept(date,
|
|
nameList = reportMapper.getReportNameByDateAndDept(date,
|
|
- ids, targetUid, companyId, pageStart, pageSize);
|
|
|
|
- totalMembCount = reportMapper.getReportNameByDateAndDeptCount(date, ids, targetUid, companyId);
|
|
|
|
- if (nameList.size() > 0) {
|
|
|
|
- List<String> userIds = new ArrayList<>();
|
|
|
|
- nameList.forEach(n->{
|
|
|
|
- String id = (String) n.get("id");
|
|
|
|
- userIds.add(id);
|
|
|
|
- });
|
|
|
|
- List<Map<String, Object>> reportList = reportMapper.getUserReportByDateOrId(date, userIds, null);
|
|
|
|
- for (Map<String, Object> map : nameList) {
|
|
|
|
- //再根据人分别获取当天的报告
|
|
|
|
- List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
|
|
- BigDecimal total = new BigDecimal(0);
|
|
|
|
- for (Map<String, Object> report : reportList) {
|
|
|
|
- if (((String)report.get("creatorId")).equals((String)map.get("id"))) {
|
|
|
|
- list.add(report);
|
|
|
|
- total = total.add((BigDecimal) report.get("cost"));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ ids, targetUid, companyId, null, pageStart, pageSize);
|
|
|
|
+ totalMembCount = reportMapper.getReportNameByDateAndDeptCount(date, ids, targetUid, companyId, null);
|
|
|
|
+ }
|
|
|
|
+ if (nameList.size() > 0) {
|
|
|
|
+ List<String> userIds = new ArrayList<>();
|
|
|
|
+ nameList.forEach(n->{
|
|
|
|
+ String id = (String) n.get("id");
|
|
|
|
+ userIds.add(id);
|
|
|
|
+ });
|
|
|
|
+ List<Map<String, Object>> reportList = reportMapper.getUserReportByDateOrId(date, userIds, null);
|
|
|
|
+ for (Map<String, Object> memb : nameList) {
|
|
|
|
+ //再根据人分别获取当天的报告
|
|
|
|
+ List<Map<String, Object>> rList = new ArrayList<Map<String, Object>>();
|
|
|
|
+ BigDecimal total = new BigDecimal(0);
|
|
|
|
+ for (Map<String, Object> report : reportList) {
|
|
|
|
+ if (((String)report.get("creatorId")).equals((String)memb.get("id"))) {
|
|
|
|
+ rList.add(report);
|
|
|
|
+ total = total.add((BigDecimal) report.get("cost"));
|
|
}
|
|
}
|
|
- map.put("data", list);
|
|
|
|
- map.put("cost", total);
|
|
|
|
- double reportTime = 0;
|
|
|
|
- if (list.size() > 0) {
|
|
|
|
- int state = 1;
|
|
|
|
- for (Map<String, Object> m : list) {
|
|
|
|
- double t = (double) m.get("time");
|
|
|
|
- reportTime += t;
|
|
|
|
- //取最低的状态
|
|
|
|
- if (state == 2) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if (state == 0) {
|
|
|
|
- if ((int)m.get("state") == 2) {
|
|
|
|
- state = 2;
|
|
|
|
- } else {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ memb.put("data", rList);
|
|
|
|
+ memb.put("cost", total);
|
|
|
|
+ double reportTime = 0;
|
|
|
|
+ if (rList.size() > 0) {
|
|
|
|
+ int state = 1;
|
|
|
|
+ for (Map<String, Object> m : rList) {
|
|
|
|
+ double t = (double) m.get("time");
|
|
|
|
+ reportTime += t;
|
|
|
|
+
|
|
|
|
+ //取最低的状态
|
|
|
|
+ if (state == 2) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (state == 0) {
|
|
|
|
+ if ((int)m.get("state") == 2) {
|
|
|
|
+ state = 2;
|
|
} else {
|
|
} else {
|
|
- state = (int)m.get("state");
|
|
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ state = (int)m.get("state");
|
|
}
|
|
}
|
|
- map.put("state", state);
|
|
|
|
}
|
|
}
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
- map.put("reportTime", df.format(reportTime));
|
|
|
|
|
|
+ memb.put("state", state);
|
|
}
|
|
}
|
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
+ memb.put("reportTime", df.format(reportTime));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4152,11 +3987,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
Class<User> aClass = User.class;
|
|
Class<User> aClass = User.class;
|
|
Method method = aClass.getMethod(getter);
|
|
Method method = aClass.getMethod(getter);
|
|
String invoke = (String) method.invoke(targetUser);
|
|
String invoke = (String) method.invoke(targetUser);
|
|
- if(invoke.equals("有加班费")){
|
|
|
|
|
|
+ if(invoke==null||invoke.equals("有加班费")){
|
|
if(!(Double.valueOf(String.valueOf(map.get("workingTime"))).equals(Double.valueOf(first.get().getWorkHours())))){
|
|
if(!(Double.valueOf(String.valueOf(map.get("workingTime"))).equals(Double.valueOf(first.get().getWorkHours())))){
|
|
map.put("exceedCardTime",1);
|
|
map.put("exceedCardTime",1);
|
|
}
|
|
}
|
|
- }else if(invoke.equals("无加班费")){
|
|
|
|
|
|
+ }else{
|
|
if((Double.valueOf(String.valueOf(map.get("workingTime")))<first.get().getWorkHours())){
|
|
if((Double.valueOf(String.valueOf(map.get("workingTime")))<first.get().getWorkHours())){
|
|
map.put("exceedCardTime",1);
|
|
map.put("exceedCardTime",1);
|
|
}
|
|
}
|
|
@@ -4376,8 +4211,35 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
User user = userMapper.selectById(token);
|
|
User user = userMapper.selectById(token);
|
|
Integer companyId = user.getCompanyId();
|
|
Integer companyId = user.getCompanyId();
|
|
Company company = companyMapper.selectById(companyId);
|
|
Company company = companyMapper.selectById(companyId);
|
|
|
|
+ //准备部门数据
|
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
List<UserFvTime> userFvTimeList = userFvTimeMapper.selectList(new LambdaQueryWrapper<UserFvTime>().between(UserFvTime::getWorkDate, startDate, endDate));
|
|
List<UserFvTime> userFvTimeList = userFvTimeMapper.selectList(new LambdaQueryWrapper<UserFvTime>().between(UserFvTime::getWorkDate, startDate, endDate));
|
|
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, company.getId()));
|
|
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, company.getId()));
|
|
|
|
+ //处理特殊节假日设置
|
|
|
|
+ //特殊节假日配置
|
|
|
|
+ List<HolidaySetting> holidaySettingList = holidaySettingService.list(new LambdaQueryWrapper<HolidaySetting>().eq(HolidaySetting::getCompanyId, companyId));
|
|
|
|
+ //针对全员生效的日期
|
|
|
|
+ List<LocalDate> holidayForAllUser = holidaySettingList.stream().filter(h -> h.getRangeType() == 0).collect(Collectors.toList()).stream().map(HolidaySetting::getHolidayDate).distinct().collect(Collectors.toList());
|
|
|
|
+ //针对指定人员的日期
|
|
|
|
+ List<LocalDate> holidayForTarget = holidaySettingList.stream().filter(h -> h.getRangeType() == 1).collect(Collectors.toList()).stream().map(HolidaySetting::getHolidayDate).distinct().collect(Collectors.toList());
|
|
|
|
+ //针对指定人员的人员已经部门
|
|
|
|
+ String userIdStr = holidaySettingList.stream().filter(f -> f.getRangeType() == 1).collect(Collectors.toList()).stream().map(HolidaySetting::getTargetUsers).collect(Collectors.joining(","));
|
|
|
|
+ String deptIdStr = holidaySettingList.stream().filter(f -> f.getRangeType() == 1).collect(Collectors.toList()).stream().map(HolidaySetting::getTargetDepts).collect(Collectors.joining(","));
|
|
|
|
+ List<Integer> targetDeptIds=new ArrayList<>();
|
|
|
|
+ if(!StringUtils.isEmpty(deptIdStr)&&!deptIdStr.equals("")){
|
|
|
|
+ String[] deptSplit = deptIdStr.split(",");
|
|
|
|
+ List<String> deptArray = Arrays.asList(deptSplit);
|
|
|
|
+ for (String deptId : deptArray) {
|
|
|
|
+ List<Integer> subDeptIds = getBranchDepartment(Integer.valueOf(deptId), departmentList);
|
|
|
|
+ targetDeptIds.add(Integer.valueOf(deptId));
|
|
|
|
+ targetDeptIds.addAll(subDeptIds);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<String> targetUserIds=new ArrayList<>();
|
|
|
|
+ if(!StringUtils.isEmpty(userIdStr)&&!userIdStr.equals("")){
|
|
|
|
+ String[] userSplit = userIdStr.split(",");
|
|
|
|
+ targetUserIds = Arrays.asList(userSplit);
|
|
|
|
+ }
|
|
List<UserCustom> userCustomList = userCustomMapper.selectList(new LambdaQueryWrapper<UserCustom>().eq(UserCustom::getCompanyId, companyId));
|
|
List<UserCustom> userCustomList = userCustomMapper.selectList(new LambdaQueryWrapper<UserCustom>().eq(UserCustom::getCompanyId, companyId));
|
|
DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
//String[] weekDayCHN = {"周一","周二","周三","周四","周五","周六","周日"};
|
|
//String[] weekDayCHN = {"周一","周二","周三","周四","周五","周六","周日"};
|
|
@@ -4422,8 +4284,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<UserMonthWork> userMonthWorks = new ArrayList<UserMonthWork>();
|
|
List<UserMonthWork> userMonthWorks = new ArrayList<UserMonthWork>();
|
|
- //准备部门数据
|
|
|
|
- List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
|
//获取所有同步的企业微信数据
|
|
//获取所有同步的企业微信数据
|
|
List<Map> userCorpwxTimeMapList = userCorpwxTimeMapper.selectByAsk(companyId,startDate,endDate);
|
|
List<Map> userCorpwxTimeMapList = userCorpwxTimeMapper.selectByAsk(companyId,startDate,endDate);
|
|
String lastUserId = null;
|
|
String lastUserId = null;
|
|
@@ -4432,6 +4292,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
String id = (String)data.get("id");
|
|
String id = (String)data.get("id");
|
|
String name = (String)data.get("name");
|
|
String name = (String)data.get("name");
|
|
String departmentName = (String) data.get("departmentName");
|
|
String departmentName = (String) data.get("departmentName");
|
|
|
|
+ String deptId = String.valueOf(data.get("deptId"));
|
|
String corpwxUserId = (String) data.get("corpwxUserId");
|
|
String corpwxUserId = (String) data.get("corpwxUserId");
|
|
Integer corpwxDeptId = (Integer) data.get("corpwxDeptId");
|
|
Integer corpwxDeptId = (Integer) data.get("corpwxDeptId");
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -4455,11 +4316,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
Class<User> aClass = User.class;
|
|
Class<User> aClass = User.class;
|
|
Method method = aClass.getMethod(getter);
|
|
Method method = aClass.getMethod(getter);
|
|
String invoke = (String) method.invoke(targetUser);
|
|
String invoke = (String) method.invoke(targetUser);
|
|
- if(invoke.equals("有加班费")){
|
|
|
|
|
|
+ if(invoke==null||invoke.equals("有加班费")){
|
|
if(!(Double.valueOf(String.valueOf(data.get("workingTime"))).equals(Double.valueOf(first.get().getWorkHours())))){
|
|
if(!(Double.valueOf(String.valueOf(data.get("workingTime"))).equals(Double.valueOf(first.get().getWorkHours())))){
|
|
map.put("exceedCardTime",1);
|
|
map.put("exceedCardTime",1);
|
|
}
|
|
}
|
|
- }else if(invoke.equals("无加班费")){
|
|
|
|
|
|
+ }else{
|
|
if((Double.valueOf(String.valueOf(data.get("workingTime")))<first.get().getWorkHours())){
|
|
if((Double.valueOf(String.valueOf(data.get("workingTime")))<first.get().getWorkHours())){
|
|
map.put("exceedCardTime",1);
|
|
map.put("exceedCardTime",1);
|
|
}
|
|
}
|
|
@@ -4477,6 +4338,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
lastUserData.userId = id;
|
|
lastUserData.userId = id;
|
|
lastUserData.name = name;
|
|
lastUserData.name = name;
|
|
lastUserData.departmentName = departmentName;
|
|
lastUserData.departmentName = departmentName;
|
|
|
|
+ lastUserData.deptId = deptId;
|
|
lastUserData.corpwxUserId = corpwxUserId;
|
|
lastUserData.corpwxUserId = corpwxUserId;
|
|
lastUserData.corpwxDeptId = String.valueOf(corpwxDeptId);
|
|
lastUserData.corpwxDeptId = String.valueOf(corpwxDeptId);
|
|
lastUserData.worktimeList = new ArrayList<>();
|
|
lastUserData.worktimeList = new ArrayList<>();
|
|
@@ -4587,6 +4449,26 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ if(worktimeList!=null&&worktimeList.size()>0){
|
|
|
|
+ Iterator<Map<String, Object>> iterator = worktimeList.iterator();
|
|
|
|
+ while (iterator.hasNext()){
|
|
|
|
+ Map<String, Object> w = iterator.next();
|
|
|
|
+ if(holidayForAllUser.size()>0){
|
|
|
|
+ boolean match = holidayForAllUser.stream().anyMatch(h -> h.isEqual(LocalDate.parse(String.valueOf(w.get("createDate")), df)));
|
|
|
|
+ if(match){
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(holidayForTarget.size()>0){
|
|
|
|
+ boolean dayMatch = holidayForTarget.stream().anyMatch(h -> h.isEqual(LocalDate.parse(String.valueOf(w.get("createDate")), df)));
|
|
|
|
+ if(dayMatch){
|
|
|
|
+ if((userMonthWork.deptId!=null&&targetDeptIds.contains(Integer.valueOf(userMonthWork.deptId)))||targetUserIds.contains(userMonthWork.userId)){
|
|
|
|
+ iterator.remove();
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
HashMap map = new HashMap();
|
|
HashMap map = new HashMap();
|
|
List<HashMap> days = new ArrayList<HashMap>();
|
|
List<HashMap> days = new ArrayList<HashMap>();
|
|
@@ -7067,6 +6949,36 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
if (defaultDegree!=null && "-1".equals(defaultDegree.get("id").toString())){
|
|
if (defaultDegree!=null && "-1".equals(defaultDegree.get("id").toString())){
|
|
defaultDegree = null;
|
|
defaultDegree = null;
|
|
}
|
|
}
|
|
|
|
+ //如果该项目已经没有绑定该维度,则取消
|
|
|
|
+ if (defaultDegree != null) {
|
|
|
|
+ Integer degreeId = (Integer) defaultDegree.get("id");
|
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
|
+ List<ReportExtraDegree> extraDegreeList = reportExtraDegreeMapper.selectList(new QueryWrapper<ReportExtraDegree>().eq("company_id", companyId));
|
|
|
|
+ String associateDegrees = "";
|
|
|
|
+ List<String> associateDegreeList = new ArrayList<>();
|
|
|
|
+ if(timeType.getCustomDegreeWithPro()==0){
|
|
|
|
+ associateDegrees=extraDegreeList.stream().map(a->String.valueOf(a.getId())).collect(Collectors.joining(","));
|
|
|
|
+ }else {
|
|
|
|
+ Project project = projectMapper.selectById(projectId);
|
|
|
|
+ associateDegrees = project.getAssociateDegrees();
|
|
|
|
+ }
|
|
|
|
+ boolean find = false;
|
|
|
|
+ if (!StringUtils.isEmpty(associateDegrees)) {
|
|
|
|
+ String[] id = associateDegrees.split("\\,");
|
|
|
|
+ for (int i=0;i<id.length; i++) {
|
|
|
|
+ if (id[i].equals(degreeId.toString())) {
|
|
|
|
+ find = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!find) {
|
|
|
|
+ //该维度已不存在,或者从项目上解绑了
|
|
|
|
+ defaultDegree = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
httpRespMsg.data = defaultDegree;
|
|
httpRespMsg.data = defaultDegree;
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
@@ -9066,19 +8978,19 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
ww.put("workingTime",0);
|
|
ww.put("workingTime",0);
|
|
worktimeList.add(ww);
|
|
worktimeList.add(ww);
|
|
}
|
|
}
|
|
- if(worktimeList.size()>0){
|
|
|
|
- worktimeList.forEach(w->{
|
|
|
|
- Optional<UserFvTime> first = userFvTimeList.stream().filter(u -> u.getWorkDate().isEqual(date) && u.getUserId().equals(m.userId)).findFirst();
|
|
|
|
- if(first.isPresent()){
|
|
|
|
- w.put("cardTime",first.get().getWorkHours());
|
|
|
|
- }
|
|
|
|
- w.put("name",m.name);
|
|
|
|
- w.put("corpwxDeptId",m.corpwxDeptId);
|
|
|
|
- w.put("corpwxUserId",m.corpwxUserId);
|
|
|
|
- w.put("departmentName",m.departmentName);
|
|
|
|
- w.put("userId",m.userId);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ if(worktimeList.size()>0){
|
|
|
|
+ worktimeList.forEach(w->{
|
|
|
|
+ Optional<UserFvTime> first = userFvTimeList.stream().filter(u -> u.getWorkDate().isEqual(LocalDate.parse(String.valueOf(w.get("createDate")),df)) && u.getUserId().equals(m.userId)).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ w.put("cardTime",first.get().getWorkHours());
|
|
|
|
+ }
|
|
|
|
+ w.put("name",m.name);
|
|
|
|
+ w.put("corpwxDeptId",m.corpwxDeptId);
|
|
|
|
+ w.put("corpwxUserId",m.corpwxUserId);
|
|
|
|
+ w.put("departmentName",m.departmentName);
|
|
|
|
+ w.put("userId",m.userId);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
result.addAll(worktimeList);
|
|
result.addAll(worktimeList);
|
|
});
|
|
});
|