|
@@ -216,6 +216,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//首先根据日期获取当天所有提交过日志的人
|
|
|
String userId = request.getHeader("Token");
|
|
|
User user = userMapper.selectById(userId);
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
List<Map<String, Object>> nameList = new ArrayList<>();
|
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
|
|
|
if (functionList.size() == 0) {
|
|
@@ -329,7 +330,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//担任项目经理或者日报审核人,查找相关的人员的日报
|
|
|
List<Map<String, Object>> puserNames = reportMapper.getReportNameByDate(date, user.getCompanyId(), leaderId);
|
|
|
List<Map<String, Object>> inchargeReportList= reportMapper.getInchargeReportByDate(date, leaderId, null);
|
|
|
- TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
+
|
|
|
if ((timeType.getReportAuditType() == 5 || timeType.getReportAuditType() == 6)&& timeType.getReportCc() == 1) {
|
|
|
//存在抄送人的设置,需要把抄送人的项目相关日报也加上
|
|
|
List<Map<String, Object>> viewUserNames = reportMapper.getCcReportNameByDate(date, user.getCompanyId(),leaderId);
|
|
@@ -542,6 +543,35 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (timeType.getEnableNewWeeklyfill() == 1) {
|
|
|
+ //新版按周填报有周总结
|
|
|
+ List<Integer> batchIds = new ArrayList<>();
|
|
|
+ for (Map map : nameList) {
|
|
|
+ List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
+ for (Map<String, Object> report : reportList) {
|
|
|
+ Integer batchId = (Integer)report.get("batchId");
|
|
|
+ if (!batchIds.contains(batchId)) {
|
|
|
+ batchIds.add(batchId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (batchIds.size() > 0) {
|
|
|
+ List<ReportBatch> batchList = reportBatchMapper.selectList(new QueryWrapper<ReportBatch>().in("id", batchIds));
|
|
|
+ DateTimeFormatter sdf = DateTimeFormatter.ofPattern("MM/dd");
|
|
|
+ for (Map map : nameList) {
|
|
|
+ List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
+ if (reportList.size() > 0) {
|
|
|
+ Integer batchId = (Integer)((Map)reportList.get(0)).get("batchId");
|
|
|
+ Optional<ReportBatch> first = batchList.stream().filter(b -> b.getId().equals(batchId)).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ ReportBatch batchItem = first.get();
|
|
|
+ map.put("summaryTitle", sdf.format(batchItem.getStartDate())+"至"+sdf.format(batchItem.getEndDate())+"周总结:");
|
|
|
+ map.put("summary", batchItem.getSummary());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
httpRespMsg.data = nameList;
|
|
|
} catch (NullPointerException e) {
|
|
|
e.printStackTrace();
|
|
@@ -798,6 +828,227 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getReportById(Integer reportId, HttpServletRequest request) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ try {
|
|
|
+ String userId = request.getHeader("Token");
|
|
|
+ Integer companyId = userMapper.selectById(userId).getCompanyId();
|
|
|
+ Company company = companyMapper.selectById(companyId);
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ //查日报
|
|
|
+ Report report = reportMapper.selectById(reportId);
|
|
|
+ LocalDate date = report.getCreateDate();
|
|
|
+ Integer projectId = report.getProjectId();
|
|
|
+ List<SubProject> subProjectList = subProjectMapper.selectList(new QueryWrapper<SubProject>().eq("project_id",projectId));
|
|
|
+ List<ProjectAuditor> auditorList = projectAuditorMapper.selectList(new QueryWrapper<ProjectAuditor>().eq("project_id", projectId));
|
|
|
+
|
|
|
+ List<Profession> professions = professionMapper.selectList(new QueryWrapper<Profession>().eq("company_id", companyId));
|
|
|
+
|
|
|
+ List<ReportExtraDegree> degreeList = reportExtraDegreeMapper.selectList(new QueryWrapper<ReportExtraDegree>().eq("company_id", companyId));
|
|
|
+ List<TaskGroup> taskGroups = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().eq("project_id", projectId));
|
|
|
+ List<Stages> stagesList =stagesMapper.selectList(new QueryWrapper<Stages>().eq("project_id", projectId));
|
|
|
+
|
|
|
+ //获取当前项目的子项目列表,任务分组,任务列表,项目相关维度列表
|
|
|
+ Report r = report;
|
|
|
+ r.setSubProjectList(subProjectList.stream().filter(s->s.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
|
|
|
+ r.setTaskList(taskMapper.recentSimpleList(r.getProjectId(), userId));
|
|
|
+ //获取当前项目的工程专业进度
|
|
|
+ List<ReportProfessionProgress> progressList = reportProfessionProgressService.list(new QueryWrapper<ReportProfessionProgress>().eq("report_id", r.getId()));
|
|
|
+ //去掉当前项目上已经不存在的专业
|
|
|
+ List<ProjectProfession> projectProfessions = projectProfessionMapper.selectList(new QueryWrapper<ProjectProfession>().eq("project_id", r.getProjectId()));
|
|
|
+ progressList = progressList.stream().filter(p->projectProfessions.stream().anyMatch(pp->pp.getProfessionId().equals(p.getProfessionId()))).collect(Collectors.toList());
|
|
|
+ progressList.stream().forEach(p->{
|
|
|
+ p.setProfessionName(professions.stream().filter(m->m.getId().equals(p.getProfessionId())).findFirst().get().getName());
|
|
|
+ });
|
|
|
+ r.setProfessionProgressList(progressList);
|
|
|
+ //获取任务阶段列表
|
|
|
+ if (company.getPackageProject() == 1 && r.getGroupId() != null && r.getGroupId() != 0) {
|
|
|
+ r.setStages(stagesList.stream().filter(s->s.getGroupId() !=null && s.getGroupId().equals(r.getGroupId())).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ //处理图片
|
|
|
+ if (!StringUtils.isEmpty(r.getPicStr()) && !r.getPicStr().equals("@")) {
|
|
|
+ JSONArray array = JSONArray.parseArray(r.getPicStr().replaceAll("@", ","));
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ for (int i=0;i<array.size(); i++) {
|
|
|
+ String picName = array.getString(i);
|
|
|
+ if (!picName.contains(".")) {
|
|
|
+ picName += ".jpg";
|
|
|
+ }
|
|
|
+ list.add("/upload/"+picName);
|
|
|
+ }
|
|
|
+ r.setPics(list);
|
|
|
+ }
|
|
|
+ if (r.getMultiWorktime() == 1) {
|
|
|
+ //设置多个工时情况下的报告列表
|
|
|
+ String timeStr = r.getContent();
|
|
|
+ if (timeStr != null) {
|
|
|
+ JSONArray parse = JSONArray.parseArray(timeStr);
|
|
|
+ List<WorktimeItem> list = new ArrayList<>();
|
|
|
+ for (int i=0;i<parse.size(); i++) {
|
|
|
+ JSONObject obj = parse.getJSONObject(i);
|
|
|
+ list.add(JSONObject.toJavaObject(obj, WorktimeItem.class));
|
|
|
+ }
|
|
|
+ r.setWorktimeList(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理维度列表数据
|
|
|
+ if (timeTypeMapper.selectById(companyId).getCustomDegreeActive() == 1) {
|
|
|
+ Project project = projectMapper.selectById(projectId);
|
|
|
+ String associateDegrees = project.getAssociateDegrees();
|
|
|
+ List<HashMap> degreeMapList = new ArrayList<>();
|
|
|
+ if (associateDegrees != null) {
|
|
|
+ String[] split = associateDegrees.split("\\,");
|
|
|
+ for (int i=0;i<split.length; i++) {
|
|
|
+ HashMap map = new HashMap();
|
|
|
+ if (!StringUtils.isEmpty(split[i])) {
|
|
|
+ Integer id = Integer.parseInt(split[i]);
|
|
|
+ map.put("id", id);
|
|
|
+ map.put("name", degreeList.stream().filter(d->d.getId().equals(id)).findFirst().get().getName());
|
|
|
+ degreeMapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ r.setDegreeList(degreeMapList);
|
|
|
+ }
|
|
|
+ //检查是否是按照任务分组负责人审核
|
|
|
+ int reportAuditType = timeTypeMapper.selectById(companyId).getReportAuditType();
|
|
|
+ //分组
|
|
|
+ if (company.getPackageProject() == 1) {
|
|
|
+ //如果是按照任务分组负责人审核,取参与的分组
|
|
|
+ if (reportAuditType == 1 || reportAuditType == 2){
|
|
|
+ List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>().eq("user_id", r.getCreatorId()));
|
|
|
+ if (groupParticipatorList.size() > 0) {
|
|
|
+ List<Integer> groupIds = groupParticipatorList.stream().map(GroupParticipator::getGroupId).collect(Collectors.toList());
|
|
|
+ List<TaskGroup> findGroups = taskGroups.stream().filter(tg->groupIds.contains(tg.getId()) || userId.equals(tg.getInchargerId())).collect(Collectors.toList());
|
|
|
+ r.setTaskGroups(findGroups);
|
|
|
+ if (r.getGroupId() != null && r.getGroupId() != 0) {
|
|
|
+ Optional<TaskGroup> optinal = taskGroups.stream().filter(tg->tg.getId().equals(r.getGroupId())).findFirst();
|
|
|
+ if (optinal.isPresent()) {
|
|
|
+ r.setGroupName(optinal.get().getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //取该项目下的全部分组数据
|
|
|
+ r.setTaskGroups(taskGroups.stream().filter(tg->tg.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
|
|
|
+ if (r.getGroupId() != null && r.getGroupId() != 0) {
|
|
|
+ Optional<TaskGroup> optinal = taskGroups.stream().filter(tg->tg.getId().equals(r.getGroupId())).findFirst();
|
|
|
+ if (optinal.isPresent()) {
|
|
|
+ r.setGroupName(optinal.get().getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //项目的审核人
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (reportAuditType == 1 || reportAuditType == 2) {
|
|
|
+ if (r.getGroupId() != null && r.getGroupId() != 0) {
|
|
|
+ //直接获取分组的负责人作为审核人
|
|
|
+ Optional<TaskGroup> tgoup = taskGroups.stream().filter(tg->tg.getId().equals(r.getGroupId())).findFirst();
|
|
|
+ if (tgoup.isPresent()) {
|
|
|
+ TaskGroup curGroup = tgoup.get();
|
|
|
+ if (curGroup.getInchargerId() != null) {
|
|
|
+ User user = userMapper.selectById(curGroup.getInchargerId());
|
|
|
+ HashMap map = new HashMap();
|
|
|
+ map.put("auditorId", user.getId());
|
|
|
+ map.put("auditorName", user.getName());
|
|
|
+ List list = new ArrayList();
|
|
|
+ list.add(map);
|
|
|
+ r.setAuditUserList(list);
|
|
|
+ if (r.getProjectAuditorId() != null) {
|
|
|
+ r.setProjectAuditorName(user.selectById(r.getProjectAuditorId()).getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (reportAuditType == 3) {
|
|
|
+ //获取日报对应已经设置好的审核人和抄送人
|
|
|
+ ReportAuditorSetting reportAuditorSetting = reportAuditorSettingMapper.selectById(r.getId());
|
|
|
+ r.setAuditorSetting(reportAuditorSetting);
|
|
|
+ //手机端数据
|
|
|
+ if (reportAuditorSetting.getAuditorFirst() != null) {
|
|
|
+ User auditorItem = userMapper.selectOne(new QueryWrapper<User>().select("id, name").eq("id", reportAuditorSetting.getAuditorFirst()));
|
|
|
+ r.setAuditorFirst(auditorItem);
|
|
|
+ }
|
|
|
+ if (reportAuditorSetting.getAuditorSec() != null) {
|
|
|
+ User auditorItem = userMapper.selectOne(new QueryWrapper<User>().select("id, name").eq("id", reportAuditorSetting.getAuditorSec()));
|
|
|
+ r.setAuditorSec(auditorItem);
|
|
|
+ }
|
|
|
+ if (reportAuditorSetting.getAuditorThird() != null) {
|
|
|
+ User auditorItem = userMapper.selectOne(new QueryWrapper<User>().select("id, name").eq("id", reportAuditorSetting.getAuditorThird()));
|
|
|
+ r.setAuditorThird(auditorItem);
|
|
|
+ }
|
|
|
+ if (reportAuditorSetting.getCcUserid() != null) {
|
|
|
+ User auditorItem = userMapper.selectOne(new QueryWrapper<User>().select("id, name").eq("id", reportAuditorSetting.getCcUserid()));
|
|
|
+ r.setCcUserid(auditorItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //昱众要返回工作内容下拉选项
|
|
|
+ if (companyId == 3385) {
|
|
|
+ HttpRespMsg funWorkContextList = projectService.getFunWorkContextList(r.getExtraField2());
|
|
|
+ List<ProFunWorkContext> workContentList = ((List<ProFunWorkContext>)funWorkContextList.data);
|
|
|
+ r.setWorkContentList(workContentList);
|
|
|
+ }
|
|
|
+ resultMap.put("report", report);
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
+ if (timeType.getShowDdCardtime() == 1) {
|
|
|
+ List<UserDingdingTime> dingdingTimes = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>()
|
|
|
+ .eq("user_id", userId).eq("work_date", date));
|
|
|
+ if (dingdingTimes.size() > 0) {
|
|
|
+ UserDingdingTime time = dingdingTimes.get(0);
|
|
|
+ resultMap.put("time", time);
|
|
|
+ }
|
|
|
+ }else if(timeType.getSyncFanwei()==1){
|
|
|
+ List<UserFvTime> userFvTimeList = userFvTimeMapper.selectList(new QueryWrapper<UserFvTime>()
|
|
|
+ .eq("user_id", userId).eq("work_date", date));
|
|
|
+ if (userFvTimeList.size() > 0) {
|
|
|
+ UserFvTime time = userFvTimeList.get(0);
|
|
|
+ resultMap.put("time", time);
|
|
|
+ }
|
|
|
+ } else if (timeType.getShowCorpwxCardtime() == 1) {
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ List<UserCorpwxTime> corpwxTimes = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>()
|
|
|
+ .eq("corpwx_userid", user.getCorpwxUserid()).eq("create_date", date));
|
|
|
+ if (corpwxTimes.size() > 0) {
|
|
|
+ UserCorpwxTime time = corpwxTimes.get(0);
|
|
|
+ resultMap.put("time", time);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //顺便返回公司的工作时间设置
|
|
|
+ resultMap.put("timeType",timeType);
|
|
|
+ //返回公司的项目工时预警的成本项列表
|
|
|
+ List<ProjectBasecostSetting> timeBasecostList = new ArrayList<>();
|
|
|
+ if (company.getPackageProject() == 1) {
|
|
|
+ timeBasecostList = projectBasecostSettingMapper.selectList(new QueryWrapper<ProjectBasecostSetting>().eq("company_id", companyId).eq("alarm_type", 1));
|
|
|
+ }
|
|
|
+ //当天是否是工作日
|
|
|
+ boolean isWorkDay = companyId == 817 ? WorkDayCalculateUtils.isWorkDayExceptSaturday(date) : WorkDayCalculateUtils.isWorkDay(date);
|
|
|
+ resultMap.put("isWorkDay", isWorkDay);
|
|
|
+ resultMap.put("timeBasecostList",timeBasecostList);
|
|
|
+ httpRespMsg.data = resultMap;
|
|
|
+ } catch (NullPointerException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ //httpRespMsg.setError("验证失败");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("Company.validationError"));
|
|
|
+ return httpRespMsg;
|
|
|
+ } catch (DateTimeParseException e) {
|
|
|
+ //httpRespMsg.setError("日期格式有误");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("date.formatError"));
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg getCardTime(String date, HttpServletRequest request) {
|
|
|
String userId = request.getHeader("TOKEN");
|
|
@@ -832,7 +1083,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
|
|
|
//新增或编辑报告
|
|
|
@Override
|
|
|
- public HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId) {
|
|
|
+ public HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId, String summary) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
//删除不在本次更新名单中的老记录
|
|
@@ -893,7 +1144,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//成都明夷电子,需要生成批量记录
|
|
|
Company company = companyMapper.selectById(companyId);
|
|
|
System.out.println(company.getCompanyName()+", date==="+date);
|
|
|
- if (company.getCompanyName().equals("成都明夷电子科技有限公司")) {
|
|
|
+
|
|
|
+ if (company.getCompanyName().equals("成都明夷电子科技有限公司") || timeType.getEnableNewWeeklyfill() == 1) {//物奇需要填写周总结
|
|
|
if (date.contains("@")) {
|
|
|
//批量填报
|
|
|
String[] split = date.split("\\@");
|
|
@@ -919,42 +1171,46 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//每日或按周填报,为每天生成一条记录; 每日或者按周填报时,填报人就是操作人自己,不存在代填的情况
|
|
|
List<LocalDate> dateList = reportList.stream().map(Report::getCreateDate).distinct().collect(Collectors.toList());
|
|
|
String creatorId = reportList.get(0).getCreatorId();
|
|
|
- for (LocalDate curDate : dateList) {
|
|
|
+ if (timeType.getEnableNewWeeklyfill() == 1) {
|
|
|
+ //按周填报,需要保存周总结
|
|
|
+ LocalDate minDate = dateList.stream().min(LocalDate::compareTo).get();
|
|
|
+ LocalDate maxDate = dateList.stream().max(LocalDate::compareTo).get();
|
|
|
//删除已有的记录
|
|
|
- reportBatchMapper.delete(new QueryWrapper<ReportBatch>().eq("start_date", curDate).eq("end_date", curDate).eq("creator_id", creatorId));
|
|
|
+ reportBatchMapper.delete(new QueryWrapper<ReportBatch>().eq("start_date", minDate).eq("end_date", maxDate).eq("creator_id", creatorId));
|
|
|
ReportBatch batch = new ReportBatch();
|
|
|
batch.setCreatorId(creatorId);
|
|
|
batch.setState(0);
|
|
|
batch.setCompanyId(companyId);
|
|
|
- batch.setStartDate(curDate);
|
|
|
- batch.setEndDate(curDate);
|
|
|
- batch.setTotalWorkTime(reportList.stream().filter(item->item.getCreateDate().equals(curDate) && item.getCreatorId().equals(creatorId)).mapToDouble(Report::getWorkingTime).sum());
|
|
|
+ batch.setStartDate(minDate);
|
|
|
+ batch.setEndDate(maxDate);
|
|
|
+ //周总结
|
|
|
+ batch.setSummary(summary);
|
|
|
+ batch.setTotalWorkTime(reportList.stream().filter(item->item.getCreatorId().equals(creatorId)).mapToDouble(Report::getWorkingTime).sum());
|
|
|
reportBatchMapper.insert(batch);
|
|
|
-
|
|
|
//更新batchId
|
|
|
- List<Integer> curDateReportIds = reportList.stream().filter(item -> item.getCreateDate().equals(curDate) && item.getCreatorId().equals(creatorId)).map(Report::getId).collect(Collectors.toList());
|
|
|
+ List<Integer> curDateReportIds = reportList.stream().map(Report::getId).collect(Collectors.toList());
|
|
|
reportMapper.update(new Report().setBatchId(batch.getId()), new QueryWrapper<Report>().in("id", curDateReportIds));
|
|
|
+ } else {
|
|
|
+ for (LocalDate curDate : dateList) {
|
|
|
+ //删除已有的记录
|
|
|
+ reportBatchMapper.delete(new QueryWrapper<ReportBatch>().eq("start_date", curDate).eq("end_date", curDate).eq("creator_id", creatorId));
|
|
|
+ ReportBatch batch = new ReportBatch();
|
|
|
+ batch.setCreatorId(creatorId);
|
|
|
+ batch.setState(0);
|
|
|
+ batch.setCompanyId(companyId);
|
|
|
+ batch.setStartDate(curDate);
|
|
|
+ batch.setEndDate(curDate);
|
|
|
+ //周总结
|
|
|
+ batch.setSummary(summary);
|
|
|
+ batch.setTotalWorkTime(reportList.stream().filter(item->item.getCreateDate().equals(curDate) && item.getCreatorId().equals(creatorId)).mapToDouble(Report::getWorkingTime).sum());
|
|
|
+ reportBatchMapper.insert(batch);
|
|
|
+
|
|
|
+ //更新batchId
|
|
|
+ List<Integer> curDateReportIds = reportList.stream().filter(item -> item.getCreateDate().equals(curDate) && item.getCreatorId().equals(creatorId)).map(Report::getId).collect(Collectors.toList());
|
|
|
+ reportMapper.update(new Report().setBatchId(batch.getId()), new QueryWrapper<Report>().in("id", curDateReportIds));
|
|
|
+ }
|
|
|
}
|
|
|
-// for (Report r : reportList) {
|
|
|
-// LocalDate curDate = r.getCreateDate();
|
|
|
-// //删除已有的记录; //TODO: 一天多个项目会导致删除其他项目的记录, 需要修复
|
|
|
-// reportBatchMapper.delete(new QueryWrapper<ReportBatch>().eq("start_date", curDate).eq("end_date", curDate).eq("creator_id", r.getCreatorId()));
|
|
|
-//
|
|
|
-// ReportBatch batch = new ReportBatch();
|
|
|
-// batch.setCreatorId(reportList.get(0).getCreatorId());
|
|
|
-// batch.setState(0);
|
|
|
-// batch.setCompanyId(companyId);
|
|
|
-// batch.setStartDate(curDate);
|
|
|
-// batch.setEndDate(curDate);
|
|
|
-// batch.setTotalWorkTime(reportList.stream().filter(item->item.getCreateDate().equals(curDate) && item.getCreatorId().equals(r.getCreatorId())).mapToDouble(Report::getWorkingTime).sum());
|
|
|
-// reportBatchMapper.insert(batch);
|
|
|
-// //更新batchId
|
|
|
-// Report uItem = new Report();
|
|
|
-// uItem.setId(r.getId());
|
|
|
-// uItem.setBatchId(batch.getId());
|
|
|
-// updateBIdList.add(uItem);
|
|
|
-// }
|
|
|
-// reportService.updateBatchById(updateBIdList);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -6717,6 +6973,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
.eq("creator_id", userId).between("create_date", startDate, endDate).groupBy("create_date"));
|
|
|
//获取日报详情
|
|
|
List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().eq("creator_id", userId).between("create_date", startDate, endDate).orderByAsc("create_date"));
|
|
|
+
|
|
|
List<Integer> collect = reportList.stream().map(Report::getProjectId).collect(Collectors.toList());
|
|
|
//加载这段时间内已填报过的项目
|
|
|
List<Project> projectList = new ArrayList<>();
|
|
@@ -6729,6 +6986,13 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
projectList = projectMapper.selectList(new QueryWrapper<Project>().in("id", oldReport.stream().map(Report::getProjectId).collect(Collectors.toList())));
|
|
|
}
|
|
|
}
|
|
|
+//
|
|
|
+// List<TaskGroup> allGroupList = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().in("project_id", projectList.stream().map(Project::getId).collect(Collectors.toList())));
|
|
|
+// //获取当前日报项目下的所有任务分组
|
|
|
+// for (Report report : reportList) {
|
|
|
+// Integer targetPid = report.getProjectId();
|
|
|
+// report.setTaskGroups(allGroupList.stream().filter(tg->tg.getProjectId().equals(targetPid)).collect(Collectors.toList()));
|
|
|
+// }
|
|
|
|
|
|
List cardTimeList = new ArrayList();
|
|
|
if (timeType.getShowDdCardtime() == 1) {
|
|
@@ -6945,8 +7209,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (user.getIsActive()==0 && leaveDate != null && leaveDate.isBefore(lastDayOfWeek)) {
|
|
|
lastDayOfWeek = leaveDate;
|
|
|
}
|
|
|
- Map<String, List> reportMap = new HashMap<>();
|
|
|
+ Map<String, Object> reportMap = new HashMap<>();
|
|
|
if (needFill) {
|
|
|
+ String summary = null;
|
|
|
String startDate = firstDayOfWeek.format(dtf);
|
|
|
String endDate = lastDayOfWeek.format(dtf);
|
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
@@ -6954,6 +7219,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().eq("creator_id", userId).between("create_date", startDate, endDate).orderByAsc("create_date"));
|
|
|
//已填日报设置审核人姓名
|
|
|
if (reportList.size() > 0) {
|
|
|
+ Integer batchId = reportList.get(0).getBatchId();
|
|
|
+ if (batchId != null) {
|
|
|
+ //获取周总结
|
|
|
+ summary = reportBatchMapper.selectById(batchId).getSummary();
|
|
|
+ }
|
|
|
List<String> collect = reportList.stream().map(Report::getProjectAuditorId).distinct().collect(Collectors.toList());
|
|
|
if (collect.size() > 0) {
|
|
|
List<User> auditorUserList = userMapper.selectList(new QueryWrapper<User>().in("id", collect));
|
|
@@ -6981,7 +7251,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (joinGroupList.size() > 0) {
|
|
|
List<TaskGroup> taskGroups = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().in("project_id", collect).in("id", joinGroupList));
|
|
|
//获取负责人的用户集合
|
|
|
- List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", taskGroups.stream().map(TaskGroup::getInchargerId).collect(Collectors.toList())));
|
|
|
+ List<String> inchargerIds = taskGroups.stream().map(TaskGroup::getInchargerId).collect(Collectors.toList());
|
|
|
+ if (inchargerIds.size() == 0) {
|
|
|
+ inchargerIds.add("-1");
|
|
|
+ }
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", inchargerIds));
|
|
|
reportList.forEach(r->{
|
|
|
r.setTaskGroups(taskGroups.stream().filter(tg->tg.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
|
|
|
for (TaskGroup gp : r.getTaskGroups()) {
|
|
@@ -7047,9 +7321,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
}
|
|
|
reportMap.put("dateList", dateList);
|
|
|
+ reportMap.put("summary", summary);
|
|
|
} else {
|
|
|
reportMap.put("dateList", new ArrayList());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
msg.data = reportMap;
|
|
|
return msg;
|
|
|
}
|