|
@@ -576,7 +576,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<ReportExtraDegree> degreeList = reportExtraDegreeMapper.selectList(new QueryWrapper<ReportExtraDegree>().eq("company_id", companyId));
|
|
|
List<TaskGroup> taskGroups = integerList.size() > 0?taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().in("project_id", integerList)):new ArrayList<>();
|
|
|
List<Stages> stagesList = integerList.size() > 0?stagesMapper.selectList(new QueryWrapper<Stages>().in("project_id", integerList)) : new ArrayList<>();
|
|
|
-
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
//获取当前项目的子项目列表,任务分组,任务列表,项目相关维度列表
|
|
|
reports.forEach(r->{
|
|
|
//设置项目名称
|
|
@@ -676,11 +676,32 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
//项目的审核人
|
|
|
if (reportAuditType == 0) {
|
|
|
- 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) {
|
|
|
+ User user = userMapper.selectById(r.getCreatorId());
|
|
|
+ Department department = departmentMapper.selectById(user.getDepartmentId());
|
|
|
+ if (department != null) {
|
|
|
+ User deptManager = userMapper.selectById(department.getManagerId());
|
|
|
+ List<ProjectAuditor> auditorList1 = new ArrayList<>();
|
|
|
+ ProjectAuditor auditor = new ProjectAuditor();
|
|
|
+ auditor.setAuditorId(deptManager.getId());
|
|
|
+ auditor.setAuditorName(deptManager.getName());
|
|
|
+ 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());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else if (reportAuditType == 1 || reportAuditType == 2) {
|
|
@@ -768,7 +789,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
});
|
|
|
resultMap.put("report", reports);
|
|
|
- TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
boolean showRefresh = false;
|
|
|
if (timeType.getShowDdCardtime() == 1) {
|
|
|
List<UserDingdingTime> dingdingTimes = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>()
|
|
@@ -1385,11 +1405,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
ReportLog log = new ReportLog();
|
|
|
log.setCreatorId(report.getCreatorId());
|
|
|
log.setCreateDate(report.getCreateDate());
|
|
|
+ String msg = opName+"审核通过了日报";
|
|
|
//去重
|
|
|
Optional<ReportLog> oldLog = addLogList.stream().filter(add -> add.getCreateDate().isEqual(log.getCreateDate()) && add.getCreatorId().equals(log.getCreatorId())).findFirst();
|
|
|
if (!oldLog.isPresent()) {
|
|
|
log.setOperatorId(operatorId);
|
|
|
- log.setMsg(opName+"审核通过了日报");
|
|
|
+ log.setMsg(msg);
|
|
|
log.setCompanyId(companyId);
|
|
|
log.setReportIds(report.getId()+"");
|
|
|
addLogList.add(log);
|
|
@@ -1400,10 +1421,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
ReportLogDetail detail = new ReportLogDetail();
|
|
|
detail.setReportId(report.getId());
|
|
|
detail.setWorkDate(log.getCreateDate());
|
|
|
- detail.setOperatorId(log.getOperatorId());
|
|
|
+ detail.setOperatorId(operatorId);
|
|
|
detail.setOperateDate(log.getOperateDate());
|
|
|
detail.setCompanyId(companyId);
|
|
|
- detail.setMsg(log.getMsg());
|
|
|
+ detail.setMsg(msg);
|
|
|
addLogDetailList.add(detail);
|
|
|
}
|
|
|
reportLogService.saveBatch(addLogList);
|
|
@@ -4976,7 +4997,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
int deptColumnExtra = (hasDept?1:0);
|
|
|
//下标从0开始
|
|
|
- int projectNameStartIndex = (withCheckIn==null?2:(6 + deptColumnExtra));
|
|
|
+ int projectNameStartIndex = (withCheckIn==null?2:(7 + deptColumnExtra));
|
|
|
List<User> targetUserList=new ArrayList<>();
|
|
|
HttpRespMsg respMsg=new HttpRespMsg();
|
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
@@ -5059,6 +5080,23 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
} else {
|
|
|
dataCount++;
|
|
|
//数据行
|
|
|
+ //读取工作内容
|
|
|
+ String workContent = null;
|
|
|
+ if (withCheckIn!=null) {
|
|
|
+ int workContentIndex = projectNameStartIndex -1;
|
|
|
+ if (row.getCell(workContentIndex) == null) {
|
|
|
+ //msg.setError("第"+dataCount+"行缺少工作内容");工作内容为必填项
|
|
|
+ msg.setError(MessageUtils.message("data.LackWorkContentByRow",dataCount));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ workContent = row.getCell(workContentIndex).getStringCellValue().trim();
|
|
|
+ if (StringUtils.isEmpty(workContent)) {
|
|
|
+ //msg.setError("第"+dataCount+"行缺少工作内容");
|
|
|
+ msg.setError(MessageUtils.message("data.LackWorkContentByRow",dataCount));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for (int i=1;i<projectNameStartIndex+projectList.size(); i++) {
|
|
|
if (row.getCell(i) != null) {
|
|
|
row.getCell(i).setCellType(CellType.STRING);
|
|
@@ -5110,6 +5148,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
report.setCreatorId(reportCreator.getId());
|
|
|
report.setDeptId(reportCreator.getDepartmentId());
|
|
|
report.setProjectId(project.getId());
|
|
|
+ if (withCheckIn != null) {
|
|
|
+ report.setContent(workContent);
|
|
|
+ }
|
|
|
+
|
|
|
//子项目
|
|
|
if (!StringUtils.isEmpty(subPName)) {
|
|
|
Optional<SubProject> first = allSubProjectList.stream()
|
|
@@ -6095,13 +6137,14 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
item.add("");
|
|
|
}
|
|
|
}
|
|
|
+ String createDate = null;
|
|
|
if (map.get("createDate") instanceof java.sql.Date) {
|
|
|
- item.add(new SimpleDateFormat("yyyy-MM-dd")
|
|
|
- .format((java.sql.Date) map.get("createDate")));
|
|
|
+ createDate = new SimpleDateFormat("yyyy-MM-dd")
|
|
|
+ .format((java.sql.Date) map.get("createDate"));
|
|
|
} else {
|
|
|
- item.add((String)map.get("createDate"));
|
|
|
+ createDate = (String) map.get("createDate");
|
|
|
}
|
|
|
-
|
|
|
+ item.add(createDate);
|
|
|
// item.add(new SimpleDateFormat("yyyy-MM-dd")
|
|
|
// .format((java.sql.Date) map.get("createDate")));
|
|
|
item.add(map.get("duration").toString());
|
|
@@ -6435,8 +6478,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
|
|
|
if (timeType.getEnableNewWeeklyfill() == 1) {
|
|
|
- String createDate = new SimpleDateFormat("yyyy-MM-dd")
|
|
|
- .format((java.sql.Date) map.get("createDate"));
|
|
|
+// String createDate = new SimpleDateFormat("yyyy-MM-dd")
|
|
|
+// .format((java.sql.Date) map.get("createDate"));
|
|
|
ReportBatch batchItem = reportBatchMapper.selectOne(new QueryWrapper<ReportBatch>().eq("creator_id", map.get("creatorId")).eq("start_date", createDate).last("limit 1"));
|
|
|
if (batchItem != null) {
|
|
|
item.add(batchItem.getSummary());
|
|
@@ -9879,15 +9922,93 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg batchDenyHisReport(Integer reportAuditLogId, String reason, HttpServletRequest request) {
|
|
|
- List<ReportAlogMembdate> list = reportAlogMembdateMapper.selectList(new QueryWrapper<ReportAlogMembdate>().eq("rlog_id", reportAuditLogId));
|
|
|
- for (ReportAlogMembdate logMembItem : list) {
|
|
|
- HttpRespMsg msg = denyHisReport(logMembItem.getId(), reason, request);
|
|
|
- if (msg.code.equals("error")) {
|
|
|
- //异常需要跳出
|
|
|
- return msg;
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public HttpRespMsg batchDenyHisReport(Integer reportAuditLogId, String reason, HttpServletRequest request) throws Exception {
|
|
|
+ List<ReportAlogMembdate> dataList = reportAlogMembdateMapper.selectList(new QueryWrapper<ReportAlogMembdate>().eq("rlog_id", reportAuditLogId));
|
|
|
+ for (ReportAlogMembdate item : dataList) {
|
|
|
+ int hisId = item.getId();
|
|
|
+ ReportAlogMembdate log = reportAlogMembdateMapper.selectById(hisId);
|
|
|
+ String userId = log.getUserId();
|
|
|
+ String createDate = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(log.getCreateDate());
|
|
|
+ if (log.getState() != 1) {
|
|
|
+ //已通过的直接跳过
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
+ Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
+ if (reason == null) {
|
|
|
+ reason = "-";
|
|
|
+ }
|
|
|
+ QueryWrapper<Report> eq = new QueryWrapper<Report>().eq("create_date", createDate).eq("creator_id", userId);
|
|
|
+ List<Report> list = reportMapper.selectList(eq);
|
|
|
+ Report oneReport = null;
|
|
|
+ if (list.size() == 0) {
|
|
|
+ //httpRespMsg.setError("日报已不存在");
|
|
|
+ throw new Exception(MessageUtils.message("profession.alreadyNull"));
|
|
|
+ } else {
|
|
|
+ if (list.get(0).getState() == 3) {
|
|
|
+ //只有已通过的历史记录才能撤销
|
|
|
+ continue;
|
|
|
+ } else if (list.get(0).getState() == 2) {
|
|
|
+ //只有已通过的历史记录才能撤销
|
|
|
+ //httpRespMsg.setError("该日报已被撤销,无法重复操作");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ oneReport = list.get(0);
|
|
|
+ //直接进行项目经理审核驳回
|
|
|
+ reportMapper.update(new Report().setState(2)
|
|
|
+ .setRejectReason(reason).setRejectUserid(user.getId()).setRejectUsername(user.getName()),eq);
|
|
|
+
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(company.getId());
|
|
|
+ if (timeType.getReportAuditType() == 2 || timeType.getReportAuditType() == 9) {
|
|
|
+ List<Report> rList = list;
|
|
|
+ //退回任务分组审核状态
|
|
|
+ List<Report> newList = new ArrayList<>();
|
|
|
+ for (Report r : rList) {
|
|
|
+ Report upR = new Report();
|
|
|
+ upR.setId(r.getId());
|
|
|
+ upR.setGroupAuditState(0);
|
|
|
+ String inchargerId = taskGroupMapper.selectById(r.getGroupId()).getInchargerId();
|
|
|
+ upR.setProjectAuditorId(inchargerId);
|
|
|
+ upR.setProjectAuditorName(userMapper.selectById(inchargerId).getName());
|
|
|
+ newList.add(upR);
|
|
|
+ }
|
|
|
+ updateBatchById(newList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改审核记录的状态
|
|
|
+ log.setState(3);
|
|
|
+ reportAlogMembdateMapper.updateById(log);
|
|
|
+
|
|
|
+ saveDenyReportLog(list, user.getId(), user.getName(), reason);
|
|
|
+
|
|
|
+ List<Integer> collect = list.stream().map(Report::getProjectId).collect(Collectors.toList());
|
|
|
+ List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().in("id", collect));
|
|
|
+ String pNames = projectList.stream().map(Project::getProjectName).collect(Collectors.joining(", ", "[", "]"));
|
|
|
+ //String str = "您"+createDate+"填写的日报中"+pNames+"项目被["+user.getName()+"]驳回。原因:" + reason;;
|
|
|
+ String str = MessageUtils.message("report.dailyReject",createDate,pNames,user.getName(),reason);
|
|
|
+ String fillUserId = oneReport.getCreatorId();
|
|
|
+
|
|
|
+ informationMapper.insert(new Information().setType(0).setContent(createDate).setUserId(fillUserId).setMsg(str));
|
|
|
+
|
|
|
+ //发送企业微信通知消息
|
|
|
+ User reporter = userMapper.selectById(fillUserId);
|
|
|
+ String corpwxUserid = reporter.getCorpwxUserid();
|
|
|
+ //先判断钉钉
|
|
|
+ if (reporter.getDingdingUserid() != null) {
|
|
|
+ projectMapper.selectById(oneReport.getProjectId()).getProjectName();
|
|
|
+ companyDingdingService.sendRejectReportMsg(reporter.getCompanyId(), createDate, pNames, reason, user.getName(), reporter.getDingdingUserid());
|
|
|
+ }
|
|
|
+ if (corpwxUserid != null) {
|
|
|
+ WxCorpInfo info = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", company.getId()));
|
|
|
+ wxCorpInfoService.sendWXCorpMsg(info, corpwxUserid, str, null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_DENY);
|
|
|
+ } else if (reporter.getWxOpenid() != null){
|
|
|
+ //发送个人微信通知
|
|
|
+ pushReject(str, reporter, user.getName(), reason);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return new HttpRespMsg();
|
|
|
}
|
|
|
}
|