ソースを参照

多返回项目信息

Reiskuchen 5 年 前
コミット
3aa3b95fed

+ 8 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -2,8 +2,10 @@ package com.management.platform.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.management.platform.entity.Project;
 import com.management.platform.entity.Report;
 import com.management.platform.entity.TimeCalculation;
+import com.management.platform.mapper.ProjectMapper;
 import com.management.platform.mapper.ReportMapper;
 import com.management.platform.mapper.TimeCalculationMapper;
 import com.management.platform.mapper.UserMapper;
@@ -42,6 +44,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     private UserMapper userMapper;
     @Resource
     private TimeCalculationMapper timeCalculationMapper;
+    @Resource
+    private ProjectMapper projectMapper;
 
     //获取报告列表
     @Override
@@ -71,7 +75,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             Map<String, Object> resultMap = new HashMap<>();
             //获取某日本人的所有日志
             resultMap.put("report", reportMapper.selectList(new QueryWrapper<Report>()
-                    .eq("creator_id", userId)));
+                    .eq("creator_id", userId)
+                    .eq("date", LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")))));
             //顺便再获取一下可分配时间
             Double totalWorkingTime = 0.0;
             //此处认为0是工作时间
@@ -82,6 +87,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 totalWorkingTime += timeCalculation.getDuration();
             }
             resultMap.put("time", totalWorkingTime);
+            resultMap.put("project", projectMapper.selectList(new QueryWrapper<Project>()
+                    .eq("company_id", userMapper.selectById(userId))));
             httpRespMsg.data = resultMap;
         } catch (NullPointerException e) {
             httpRespMsg.setError("验证失败");