|
|
@@ -107,6 +107,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
@Resource
|
|
|
private UserFvTimeMapper userFvTimeMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private AuditWorkflowTimeSettingService auditWorkflowTimeSettingService;
|
|
|
@Resource
|
|
|
private DepartmentService departmentService;
|
|
|
@Resource
|
|
|
@@ -451,32 +453,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //雷电公司,需要显示工时占比,临时计算一下
|
|
|
- if (companyId == 7030) {
|
|
|
- for (Map map : nameList) {
|
|
|
- List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
- double total = 0;
|
|
|
- for (Map<String, Object> report : reportList) {
|
|
|
- total += (double)report.get("time");
|
|
|
- }
|
|
|
- //计算占比
|
|
|
- int progressTotal = 0;
|
|
|
- for (int i = 0; i< reportList.size(); i++) {
|
|
|
- Map<String, Object> report = reportList.get(i);
|
|
|
- double progress = 100*(double)report.get("time")/total;
|
|
|
- int pInt = new BigDecimal(progress).setScale(0, RoundingMode.HALF_UP).intValue();
|
|
|
- if (i < reportList.size() -1) {
|
|
|
- progressTotal += pInt;
|
|
|
- //对progress四舍五入到整数位
|
|
|
- report.put("progress", pInt);
|
|
|
- } else {
|
|
|
- //最后一个,反算,避免四舍五入造成的误差导致总和不是100
|
|
|
- report.put("progress", 100 - progressTotal);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
//设置照片
|
|
|
for (Map map : nameList) {
|
|
|
List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
@@ -649,7 +625,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
String userId = request.getHeader("Token");
|
|
|
- Integer companyId = userMapper.selectById(userId).getCompanyId();
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
Company company = companyMapper.selectById(companyId);
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
//获取某日本人的所有日志
|
|
|
@@ -778,49 +755,67 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
//项目的审核人
|
|
|
if (reportAuditType == 0) {
|
|
|
- //对于简单模式的非项目,直接获取部门主管作为审核人
|
|
|
- if (company.getNonProjectSimple() == 1 && project.getIsPublic() == 1) {
|
|
|
- User user = userMapper.selectById(r.getCreatorId());
|
|
|
- //优先取个人的非项目审核人
|
|
|
- String superiorId = user.getSuperiorId();
|
|
|
- //其次取员工的部门主要负责人
|
|
|
- boolean isDirectSuperior = true;
|
|
|
- if (superiorId == null) {
|
|
|
- isDirectSuperior = false;
|
|
|
- Integer departmentId = user.getDepartmentId();
|
|
|
- Department department = departmentMapper.selectById(departmentId);
|
|
|
- if (department != null) {
|
|
|
- superiorId = department.getManagerId();
|
|
|
- }
|
|
|
- }
|
|
|
- if (superiorId != null) {
|
|
|
- User superior = userMapper.selectById(superiorId);
|
|
|
- if (superior != null) {
|
|
|
- List<ProjectAuditor> auditorList1 = new ArrayList<>();
|
|
|
- ProjectAuditor auditor = new ProjectAuditor();
|
|
|
- auditor.setAuditorId(superiorId);
|
|
|
- auditor.setAuditorName(superior.getName());
|
|
|
- if (isDirectSuperior) {
|
|
|
- Integer deptId = user.getDepartmentId();
|
|
|
- Department department = departmentMapper.selectById(deptId);
|
|
|
- auditor.setAuditorDeptName(department != null? department.getDepartmentName(): null);
|
|
|
+ if (timeType.getReportWorkflow() == 1) {
|
|
|
+ //带审批流的模式
|
|
|
+ List<AuditWorkflowTimeSetting> auditWorkflowTimeSettings = auditWorkflowTimeSettingService.getWorkFlowListForReport(user, company, timeType, project.getId());
|
|
|
+ r.setAuditWorkflow(auditWorkflowTimeSettings);
|
|
|
+ for (AuditWorkflowTimeSetting auditWorkflowTimeSetting : auditWorkflowTimeSettings) {
|
|
|
+ if (auditWorkflowTimeSetting.getIsDeptAudit() == 0) {
|
|
|
+ r.setAuditUserList(auditWorkflowTimeSetting.getProjectAuditors());
|
|
|
+ if (r.getProjectAuditorId() != null) {
|
|
|
+ Optional<ProjectAuditor> auItem = auditWorkflowTimeSetting.getProjectAuditors().stream().filter(au->au.getAuditorId().equals(r.getProjectAuditorId())).findFirst();
|
|
|
+ if (auItem.isPresent()) {
|
|
|
+ r.setProjectAuditorName(auItem.get().getAuditorName());
|
|
|
+ }
|
|
|
}
|
|
|
- auditorList1.add(auditor);
|
|
|
- r.setAuditUserList(auditorList1);
|
|
|
- }
|
|
|
- }
|
|
|
- if (r.getProjectAuditorId() != null) {
|
|
|
- Optional<ProjectAuditor> auItem = r.getAuditUserList().stream().filter(au->au.getAuditorId().equals(r.getProjectAuditorId())).findFirst();
|
|
|
- if (auItem.isPresent()) {
|
|
|
- r.setProjectAuditorName(auItem.get().getAuditorName());
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- r.setAuditUserList(auditorList.stream().filter(au->au.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
|
|
|
- if (r.getProjectAuditorId() != null) {
|
|
|
- Optional<ProjectAuditor> auItem = auditorList.stream().filter(au->au.getAuditorId().equals(r.getProjectAuditorId())).findFirst();
|
|
|
- if (auItem.isPresent()) {
|
|
|
- r.setProjectAuditorName(auItem.get().getAuditorName());
|
|
|
+ //不带审批流的模式
|
|
|
+ //对于简单模式的非项目,直接获取部门主管作为审核人
|
|
|
+ if (company.getNonProjectSimple() == 1 && project.getIsPublic() == 1) {
|
|
|
+ //优先取个人的非项目审核人
|
|
|
+ String superiorId = user.getSuperiorId();
|
|
|
+ //其次取员工的部门主要负责人
|
|
|
+ boolean isDirectSuperior = true;
|
|
|
+ if (superiorId == null) {
|
|
|
+ isDirectSuperior = false;
|
|
|
+ Integer departmentId = user.getDepartmentId();
|
|
|
+ Department department = departmentMapper.selectById(departmentId);
|
|
|
+ if (department != null) {
|
|
|
+ superiorId = department.getManagerId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (superiorId != null) {
|
|
|
+ User superior = userMapper.selectById(superiorId);
|
|
|
+ if (superior != null) {
|
|
|
+ List<ProjectAuditor> auditorList1 = new ArrayList<>();
|
|
|
+ ProjectAuditor auditor = new ProjectAuditor();
|
|
|
+ auditor.setAuditorId(superiorId);
|
|
|
+ auditor.setAuditorName(superior.getName());
|
|
|
+ if (isDirectSuperior) {
|
|
|
+ Integer deptId = user.getDepartmentId();
|
|
|
+ Department department = departmentMapper.selectById(deptId);
|
|
|
+ auditor.setAuditorDeptName(department != null? department.getDepartmentName(): null);
|
|
|
+ }
|
|
|
+ auditorList1.add(auditor);
|
|
|
+ r.setAuditUserList(auditorList1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (r.getProjectAuditorId() != null) {
|
|
|
+ Optional<ProjectAuditor> auItem = r.getAuditUserList().stream().filter(au->au.getAuditorId().equals(r.getProjectAuditorId())).findFirst();
|
|
|
+ if (auItem.isPresent()) {
|
|
|
+ r.setProjectAuditorName(auItem.get().getAuditorName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ r.setAuditUserList(auditorList.stream().filter(au->au.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
|
|
|
+ if (r.getProjectAuditorId() != null) {
|
|
|
+ Optional<ProjectAuditor> auItem = auditorList.stream().filter(au->au.getAuditorId().equals(r.getProjectAuditorId())).findFirst();
|
|
|
+ if (auItem.isPresent()) {
|
|
|
+ r.setProjectAuditorName(auItem.get().getAuditorName());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -831,15 +826,15 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (tgoup.isPresent()) {
|
|
|
TaskGroup curGroup = tgoup.get();
|
|
|
if (!StringUtils.isEmpty(curGroup.getInchargerId())) {
|
|
|
- User user = userMapper.selectById(curGroup.getInchargerId());
|
|
|
+ User auditor = userMapper.selectById(curGroup.getInchargerId());
|
|
|
HashMap map = new HashMap();
|
|
|
- map.put("auditorId", user.getId());
|
|
|
- map.put("auditorName", user.getName());
|
|
|
+ map.put("auditorId", auditor.getId());
|
|
|
+ map.put("auditorName", auditor.getName());
|
|
|
List list = new ArrayList();
|
|
|
list.add(map);
|
|
|
r.setAuditUserList(list);
|
|
|
if (r.getProjectAuditorId() != null) {
|
|
|
- r.setProjectAuditorName(user.selectById(r.getProjectAuditorId()).getName());
|
|
|
+ r.setProjectAuditorName(userMapper.selectById(r.getProjectAuditorId()).getName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -942,7 +937,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
showRefresh = true;
|
|
|
} else if (timeType.getShowCorpwxCardtime() == 1) {
|
|
|
- User user = userMapper.selectById(userId);
|
|
|
List<UserCorpwxTime> corpwxTimes = null;
|
|
|
if (user.getCorpwxUserid() != null) {
|
|
|
corpwxTimes = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>()
|
|
|
@@ -1250,7 +1244,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public HttpRespMsg getMissingCardTimeUserList(String startDate, String endDate, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg getMissingCardTimeUserList(String startDate, String endDate, Integer departmentId, HttpServletRequest request) {
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
User user = userMapper.selectById(token);
|
|
|
int companyId = user.getCompanyId();
|
|
|
@@ -1258,17 +1252,31 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
LocalDate start = LocalDate.parse(startDate);
|
|
|
LocalDate end = LocalDate.parse(endDate);
|
|
|
+ if (end.isAfter(LocalDate.now())) {
|
|
|
+ end = LocalDate.now();//最大到今天
|
|
|
+ }
|
|
|
//间隔不能超过31天
|
|
|
if (start.until(end, ChronoUnit.DAYS) > 31) {
|
|
|
msg.setError("日期间隔不能超过31天");
|
|
|
return msg;
|
|
|
}
|
|
|
- List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId)
|
|
|
+ //部门筛选
|
|
|
+ List<Integer> departmentIdList = null;
|
|
|
+ if (departmentId != null) {
|
|
|
+ List<Department> allDeptList = departmentService.list(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ departmentIdList = departmentService.getDeptIncludeSubDeptIds(departmentId, allDeptList);
|
|
|
+ }
|
|
|
+ QueryWrapper<User> userWrapper = new QueryWrapper<User>().eq("company_id", companyId).eq("report_status", 0)
|
|
|
.and(wrapper->wrapper.eq("is_active", 1)
|
|
|
- .or(w2->w2.eq("is_active", 0).ge("inactive_date", startDate))));
|
|
|
+ .or(w2->w2.eq("is_active", 0).ge("inactive_date", startDate)));
|
|
|
+ if (departmentIdList != null) {
|
|
|
+ userWrapper.in("department_id", departmentIdList);
|
|
|
+ }
|
|
|
+ List<User> userList = userMapper.selectList(userWrapper);
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
List<UserWorkDayVO> retDataList = new ArrayList<>();
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- if (timeType.getShowDdCardtime() == 1) {
|
|
|
+ if (timeType.getSyncDingding() == 1) {
|
|
|
List<UserDingdingTime> dingdingTimeList = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>().eq("company_id", companyId)
|
|
|
.between("work_date", startDate, endDate));
|
|
|
while (!start.isAfter(end)) {
|
|
|
@@ -1281,6 +1289,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
userCorpwxTime.setUserId(curUser.getId());
|
|
|
userCorpwxTime.setUserName(curUser.getName());
|
|
|
userCorpwxTime.setWorkDate(startStr);
|
|
|
+ Department department = departmentList.stream().filter(d -> d.getDepartmentId().equals(curUser.getDepartmentId())).findFirst().orElse(null);
|
|
|
+ if (department != null) {
|
|
|
+ userCorpwxTime.setDepartmentName(department.getDepartmentName());
|
|
|
+ }
|
|
|
retDataList.add(userCorpwxTime);
|
|
|
}
|
|
|
}
|
|
|
@@ -1290,7 +1302,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}else if(timeType.getSyncFanwei()==1){
|
|
|
List<UserFvTime> userFvTimeList = userFvTimeMapper.selectList(new QueryWrapper<UserFvTime>().eq("company_id", companyId)
|
|
|
.between("work_date", startDate, endDate));
|
|
|
- while (start.isBefore(end)) {
|
|
|
+ while (!start.isAfter(end)) {
|
|
|
String startStr = df.format(start);
|
|
|
for (User curUser : userList) {
|
|
|
boolean find = userFvTimeList.stream().anyMatch(time->time.getUserId().equals(curUser.getId()) && df.format(time.getWorkDate()).equals(startStr));
|
|
|
@@ -1299,6 +1311,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
userCorpwxTime.setUserId(curUser.getId());
|
|
|
userCorpwxTime.setUserName(curUser.getName());
|
|
|
userCorpwxTime.setWorkDate(startStr);
|
|
|
+ Department department = departmentList.stream().filter(d -> d.getDepartmentId().equals(curUser.getDepartmentId())).findFirst().orElse(null);
|
|
|
+ if (department != null) {
|
|
|
+ userCorpwxTime.setDepartmentName(department.getDepartmentName());
|
|
|
+ }
|
|
|
retDataList.add(userCorpwxTime);
|
|
|
}
|
|
|
}
|
|
|
@@ -1307,7 +1323,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}else if (timeType.getSyncCorpwxTime() == 1) {
|
|
|
List<UserCorpwxTime> corpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId)
|
|
|
.between("create_date", startDate, endDate));
|
|
|
- while (start.isBefore(end)) {
|
|
|
+ while (!start.isAfter(end)) {
|
|
|
String startStr = df.format(start);
|
|
|
for (User curUser : userList) {
|
|
|
boolean find = corpwxTimeList.stream().anyMatch(time -> time.getCorpwxUserid().equals(curUser.getCorpwxUserid()) && df.format(time.getCreateDate()).equals(startStr));
|
|
|
@@ -1316,6 +1332,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
userCorpwxTime.setUserId(curUser.getId());
|
|
|
userCorpwxTime.setUserName(curUser.getName());
|
|
|
userCorpwxTime.setWorkDate(startStr);
|
|
|
+ Department department = departmentList.stream().filter(d -> d.getDepartmentId().equals(curUser.getDepartmentId())).findFirst().orElse(null);
|
|
|
+ if (department != null) {
|
|
|
+ userCorpwxTime.setDepartmentName(department.getDepartmentName());
|
|
|
+ }
|
|
|
retDataList.add(userCorpwxTime);
|
|
|
}
|
|
|
}
|
|
|
@@ -6656,6 +6676,13 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
titles.add("部门主要负责人");
|
|
|
titles.add(MessageUtils.message("entry.projectId"));
|
|
|
titles.add(MessageUtils.message("entry.projectName"));
|
|
|
+ //景昱增加项目描述
|
|
|
+ List<Project> allProjectList = null;
|
|
|
+ if (companyId == 5978) {
|
|
|
+ titles.add("项目描述");
|
|
|
+ allProjectList = projectMapper.selectList(new QueryWrapper<Project>().select("project_code, project_desc").eq("company_id", companyId));
|
|
|
+ }
|
|
|
+
|
|
|
if(companyId == 7536){
|
|
|
titles.add("工单号");
|
|
|
titles.add("行号");
|
|
|
@@ -7003,8 +7030,18 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
item.add(departmentService.getSupDepartment(dept,departments));
|
|
|
item.add(managerName != null?managerName:"");
|
|
|
}
|
|
|
- item.add((String) map.get("projectCode"));
|
|
|
+ String projectCode = (String) map.get("projectCode");
|
|
|
+ item.add(projectCode);
|
|
|
item.add((String) map.get("project"));
|
|
|
+ //景昱增加项目描述
|
|
|
+ if (companyId == 5978 && allProjectList != null) {
|
|
|
+ Project curProject = allProjectList.stream().filter(p->p.getProjectCode() != null && p.getProjectCode().equals(projectCode)).findFirst().orElse(null);
|
|
|
+ if (curProject != null) {
|
|
|
+ item.add(curProject.getProjectDesc());
|
|
|
+ } else {
|
|
|
+ item.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
//泓浒,增加工单号和行号
|
|
|
if(companyId == 7536){
|
|
|
item.add((String) map.get("extraField4"));
|
|
|
@@ -9160,43 +9197,63 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
//项目的审核人
|
|
|
if (reportAuditType == 0) {
|
|
|
- int mode = 0;
|
|
|
- if (company.getNonProjectSimple() == 1) {
|
|
|
- //启用了简易模式
|
|
|
- Optional<Project> pOption = allProjectList.stream().filter(p->p.getId().equals(r.getProjectId())).findFirst();
|
|
|
- if (pOption.isPresent()) {
|
|
|
- Project project = pOption.get();
|
|
|
- List<ProjectAuditor> pAuditorList = new ArrayList<>();
|
|
|
- if (project.getIsPublic() == 1) {
|
|
|
- //非项目,该员工的部门主要负责人审核
|
|
|
- mode = 1;
|
|
|
- //优先取员工的上级领导
|
|
|
- String superiorId = user.getSuperiorId();
|
|
|
- if (superiorId == null) {
|
|
|
- Integer departmentId = user.getDepartmentId();
|
|
|
- Department department = departmentMapper.selectById(departmentId);
|
|
|
- if (department != null) {
|
|
|
- superiorId = department.getManagerId();
|
|
|
+ if (timeType.getReportWorkflow() == 1) {
|
|
|
+ //带审批流的模式
|
|
|
+ List<AuditWorkflowTimeSetting> auditWorkflowTimeSettings = auditWorkflowTimeSettingService.getWorkFlowListForReport(user, company, timeType, r.getProjectId());
|
|
|
+ r.setAuditWorkflow(auditWorkflowTimeSettings);
|
|
|
+ for (AuditWorkflowTimeSetting auditWorkflowTimeSetting : auditWorkflowTimeSettings) {
|
|
|
+ if (auditWorkflowTimeSetting.getIsDeptAudit() == 0) {
|
|
|
+ r.setAuditUserList(auditWorkflowTimeSetting.getProjectAuditors());
|
|
|
+ if (r.getProjectAuditorId() != null) {
|
|
|
+ Optional<ProjectAuditor> auItem = auditWorkflowTimeSetting.getProjectAuditors().stream().filter(au->au.getAuditorId().equals(r.getProjectAuditorId())).findFirst();
|
|
|
+ if (auItem.isPresent()) {
|
|
|
+ r.setProjectAuditorName(auItem.get().getAuditorName());
|
|
|
}
|
|
|
}
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //不带审批流的模式
|
|
|
+ int mode = 0;
|
|
|
+ if (company.getNonProjectSimple() == 1) {
|
|
|
+ //启用了简易模式
|
|
|
+ Optional<Project> pOption = allProjectList.stream().filter(p->p.getId().equals(r.getProjectId())).findFirst();
|
|
|
+ if (pOption.isPresent()) {
|
|
|
+ Project project = pOption.get();
|
|
|
+ List<ProjectAuditor> pAuditorList = new ArrayList<>();
|
|
|
+ if (project.getIsPublic() == 1) {
|
|
|
+ //非项目,该员工的部门主要负责人审核
|
|
|
+ mode = 1;
|
|
|
+ //优先取员工的上级领导
|
|
|
+ String superiorId = user.getSuperiorId();
|
|
|
+ if (superiorId == null) {
|
|
|
+ Integer departmentId = user.getDepartmentId();
|
|
|
+ Department department = departmentMapper.selectById(departmentId);
|
|
|
+ if (department != null) {
|
|
|
+ superiorId = department.getManagerId();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (superiorId != null) {
|
|
|
- User superior = userMapper.selectById(superiorId);
|
|
|
- if (superior != null) {
|
|
|
- ProjectAuditor auditor = new ProjectAuditor();
|
|
|
- auditor.setAuditorId(superiorId);
|
|
|
- auditor.setAuditorName(superior.getName());
|
|
|
- pAuditorList.add(auditor);
|
|
|
+ if (superiorId != null) {
|
|
|
+ User superior = userMapper.selectById(superiorId);
|
|
|
+ if (superior != null) {
|
|
|
+ ProjectAuditor auditor = new ProjectAuditor();
|
|
|
+ auditor.setAuditorId(superiorId);
|
|
|
+ auditor.setAuditorName(superior.getName());
|
|
|
+ pAuditorList.add(auditor);
|
|
|
+ }
|
|
|
}
|
|
|
+ r.setAuditUserList(pAuditorList);
|
|
|
}
|
|
|
- r.setAuditUserList(pAuditorList);
|
|
|
}
|
|
|
}
|
|
|
+ if (mode == 0) {
|
|
|
+ List<ProjectAuditor> pAuditorList = auditorList.stream().filter(au->au.getProjectId().equals(r.getProjectId())).collect(Collectors.toList());
|
|
|
+ r.setAuditUserList(pAuditorList);
|
|
|
+ }
|
|
|
}
|
|
|
- if (mode == 0) {
|
|
|
- List<ProjectAuditor> pAuditorList = auditorList.stream().filter(au->au.getProjectId().equals(r.getProjectId())).collect(Collectors.toList());
|
|
|
- r.setAuditUserList(pAuditorList);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
if (r.getProjectAuditorId() != null) {
|
|
|
List<ProjectAuditor> auList = r.getAuditUserList();
|
|
|
@@ -13527,6 +13584,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
userDdTimeList = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>()
|
|
|
.eq("company_id", companyId)
|
|
|
.eq("dingding_userid", targetUser.getDingdingUserid())
|
|
|
+ .gt("work_hours", 0)
|
|
|
.between("work_date", localStart, localEnd));
|
|
|
}
|
|
|
|
|
|
@@ -13664,6 +13722,154 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg exportAbnormalReportList(String startDate, String endDate, String userId, HttpServletRequest request) {
|
|
|
+ // 调用getAbnormalReportList获取数据,不分页
|
|
|
+ HttpRespMsg msg = getAbnormalReportList(startDate, endDate, userId, null, null);
|
|
|
+ if (msg.data == null) {
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> dataMap = (Map<String, Object>) msg.data;
|
|
|
+ List<Map<String, Object>> reportMapList = (List<Map<String, Object>>) dataMap.get("result");
|
|
|
+
|
|
|
+ String token = request.getHeader("TOKEN");
|
|
|
+ User user = userMapper.selectById(token);
|
|
|
+ Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", company.getId()));
|
|
|
+ CompanyDingding dingding = companyDingdingService.getOne(new QueryWrapper<CompanyDingding>().eq("company_id", company.getId()));
|
|
|
+
|
|
|
+ // 准备导出数据
|
|
|
+ List<List<String>> dataList = new ArrayList<>();
|
|
|
+ // 添加表头
|
|
|
+ List<String> header = new ArrayList<>();
|
|
|
+ header.add("姓名");
|
|
|
+ header.add("部门");
|
|
|
+ header.add("日期");
|
|
|
+ header.add("项目名称");
|
|
|
+ header.add("工作内容");
|
|
|
+ header.add("工作时长(h)");
|
|
|
+ header.add("状态");
|
|
|
+ dataList.add(header);
|
|
|
+
|
|
|
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
+ // 填充数据
|
|
|
+ for (Map<String, Object> reportMap : reportMapList) {
|
|
|
+ List<String> dataItem = new ArrayList<>();
|
|
|
+
|
|
|
+ // 姓名
|
|
|
+ dataItem.add(reportMap.get("userName") != null ? String.valueOf(reportMap.get("userName")) : "");
|
|
|
+
|
|
|
+ // 部门
|
|
|
+ dataItem.add(reportMap.get("departmentName") != null ? String.valueOf(reportMap.get("departmentName")) : "");
|
|
|
+
|
|
|
+ // 日期
|
|
|
+ if (reportMap.get("createDate") != null) {
|
|
|
+ if (reportMap.get("createDate") instanceof java.sql.Date) {
|
|
|
+ dataItem.add(sdf.format((java.sql.Date)reportMap.get("createDate")));
|
|
|
+ } else {
|
|
|
+ dataItem.add(String.valueOf(reportMap.get("createDate")));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ dataItem.add("");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 项目名称
|
|
|
+ dataItem.add(reportMap.get("projectName") != null ? String.valueOf(reportMap.get("projectName")) : "");
|
|
|
+
|
|
|
+ // 工作内容
|
|
|
+ String content = reportMap.get("content") != null ? String.valueOf(reportMap.get("content")) : "";
|
|
|
+ dataItem.add(content);
|
|
|
+
|
|
|
+ // 工作时长
|
|
|
+ dataItem.add(reportMap.get("workingTime") != null ? String.valueOf(reportMap.get("workingTime")) : "0");
|
|
|
+
|
|
|
+ // 状态
|
|
|
+ String state = "";
|
|
|
+ if (reportMap.get("state") != null) {
|
|
|
+ Integer stateValue = (Integer)reportMap.get("state");
|
|
|
+ switch (stateValue) {
|
|
|
+ case 0:
|
|
|
+ state = "待审核";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ state = "已通过";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ state = "已驳回";
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ state = "草稿";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ state = "未知";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataItem.add(state);
|
|
|
+
|
|
|
+ dataList.add(dataItem);
|
|
|
+ }
|
|
|
+
|
|
|
+ String fileName = "异常工时列表_" + System.currentTimeMillis();
|
|
|
+ String exportPath = company.getId() + "/exportFile/";
|
|
|
+
|
|
|
+ try {
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo, dingding, fileName, dataList, exportPath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ HttpRespMsg errorMsg = new HttpRespMsg();
|
|
|
+ errorMsg.setError("导出失败:" + e.getMessage());
|
|
|
+ return errorMsg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public HttpRespMsg exportMissingCardTimeUserList(String startDate, String endDate, Integer departmentId, HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = getMissingCardTimeUserList(startDate, endDate, departmentId, request);
|
|
|
+ List<UserWorkDayVO> retDataList = (List<UserWorkDayVO>)msg.data;
|
|
|
+ //导出到Excel中
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("TOKEN")).getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
+ CompanyDingding dingding = companyDingdingService.getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
|
|
|
+
|
|
|
+ List<List<String>> dataList = new ArrayList<>();
|
|
|
+ List<String> titleList = new ArrayList<>();
|
|
|
+ titleList.add(MessageUtils.message("entry.serialNo"));//序号
|
|
|
+ titleList.add(MessageUtils.message("entry.name"));//姓名
|
|
|
+ titleList.add(MessageUtils.message("excel.department"));//部门
|
|
|
+ titleList.add("缺勤日期");//工作日期
|
|
|
+ dataList.add(titleList);
|
|
|
+
|
|
|
+ for (int i = 0; i < retDataList.size(); i++) {
|
|
|
+ UserWorkDayVO userWorkDay = retDataList.get(i);
|
|
|
+ List<String> dataItem = new ArrayList<>();
|
|
|
+ dataItem.add("" + (i + 1));
|
|
|
+
|
|
|
+ if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
|
|
|
+ dataItem.add("$userName=" + (userWorkDay.getUserId() == null ? "" : userWorkDay.getUserId()) + "$");
|
|
|
+ dataItem.add("$departmentName=" + (userWorkDay.getDepartmentName() == null ? "" : userWorkDay.getDepartmentName()) + "$");
|
|
|
+ } else if (dingding != null && dingding.getContactNeedTranslate() == 1) {
|
|
|
+ dataItem.add("$userName=" + (userWorkDay.getUserName() == null ? "" : userWorkDay.getUserName()) + "$");
|
|
|
+ dataItem.add("$departmentName=" + (userWorkDay.getDepartmentName() == null ? "" : userWorkDay.getDepartmentName()) + "$");
|
|
|
+ } else {
|
|
|
+ dataItem.add(userWorkDay.getUserName());
|
|
|
+ dataItem.add(userWorkDay.getDepartmentName());
|
|
|
+ }
|
|
|
+ dataItem.add(userWorkDay.getWorkDate());
|
|
|
+ dataList.add(dataItem);
|
|
|
+ }
|
|
|
+
|
|
|
+ //生成excel文件导出
|
|
|
+ String fileName = "缺勤人员列表_" + startDate+"至" + endDate + "_" + System.currentTimeMillis();
|
|
|
+ try {
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo, dingding, fileName, dataList, path);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
public String getWeek(DayOfWeek dayOfWeek){
|
|
|
//获取中文形式的星期几
|
|
|
String dayOfWeekChinese = "";
|