|
@@ -205,45 +205,48 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
|
|
|
if (functionList.size() == 0) {
|
|
|
String leaderId = user.getId();
|
|
|
-
|
|
|
- //查看自己的日报
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("id", user.getId());
|
|
|
- map.put("name", user.getName());
|
|
|
//不是项目经理,只看自己的报告
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
- list = reportMapper.getReportByDate(date, (String) map.get("id"));
|
|
|
- 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 (targetUid == null || targetUid.equals(user.getId())) {
|
|
|
+ //查看自己的日报
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", user.getId());
|
|
|
+ map.put("name", user.getName());
|
|
|
+ list = reportMapper.getReportByDate(date, (String) map.get("id"));
|
|
|
+ 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 (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);
|
|
|
}
|
|
|
- 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 = getAllVisibleDeptIdList(user, null);
|
|
|
//需要看可见部门(部门主要负责人和其他负责人以及查看本部门工时权限)所有人员的日报
|
|
|
if (allVisibleDeptIdList.size() > 0) {
|
|
@@ -1492,15 +1495,22 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
for (int m=0;m<settings.size(); m++) {
|
|
|
if (settings.get(m).getIsDeptAudit()== 0) {//找到项目审核的那个节点
|
|
|
- AuditWorkflowTimeSetting nextNode = settings.get(m + 1);
|
|
|
- upR.setIsDeptAudit(nextNode.getIsDeptAudit());
|
|
|
- if (upR.getIsDeptAudit() == 1) {
|
|
|
- upR.setAuditDeptid(nextNode.getAuditDeptId());
|
|
|
- upR.setAuditDeptManagerid(allDepts.stream()
|
|
|
- .filter(ad->ad.getDepartmentId().equals(nextNode.getAuditDeptId())).findFirst().get().getManagerId());
|
|
|
+ //有些情况下,人员切换部门,之前是项目审核后进入部门审核,isFinalAudit 非1,就走到这里来了。这时候需要判断下个节点是否存在
|
|
|
+ if (m + 1< settings.size()) {
|
|
|
+ AuditWorkflowTimeSetting nextNode = settings.get(m + 1);
|
|
|
+ upR.setIsDeptAudit(nextNode.getIsDeptAudit());
|
|
|
+ if (upR.getIsDeptAudit() == 1) {
|
|
|
+ upR.setAuditDeptid(nextNode.getAuditDeptId());
|
|
|
+ upR.setAuditDeptManagerid(allDepts.stream()
|
|
|
+ .filter(ad->ad.getDepartmentId().equals(nextNode.getAuditDeptId())).findFirst().get().getManagerId());
|
|
|
+ }
|
|
|
+ upR.setIsFinalAudit(nextNode.getIsFinal());
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ System.out.println("存在换部门情况,新的部门审批流项目审核后无节点,无需处理");
|
|
|
+ upR.setIsFinalAudit(1);
|
|
|
+ upR.setState(1);
|
|
|
}
|
|
|
- upR.setIsFinalAudit(nextNode.getIsFinal());
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
//判断下一个审核节点(部门审核)的审核人和当前审核的是不是同一个人,如果是的,则可直接进入下一步审核或者结束
|