|
@@ -5,12 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.management.platform.entity.Project;
|
|
import com.management.platform.entity.Project;
|
|
import com.management.platform.entity.Report;
|
|
import com.management.platform.entity.Report;
|
|
import com.management.platform.entity.TimeCalculation;
|
|
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;
|
|
|
|
|
|
+import com.management.platform.entity.TimeCalculationShow;
|
|
|
|
+import com.management.platform.mapper.*;
|
|
import com.management.platform.service.ReportService;
|
|
import com.management.platform.service.ReportService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.management.platform.service.TimeCalculationService;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -50,6 +49,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
@Resource
|
|
@Resource
|
|
private ProjectMapper projectMapper;
|
|
private ProjectMapper projectMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private TimeCalculationShowMapper timeCalculationShowMapper;
|
|
|
|
+
|
|
|
|
+
|
|
@Value(value = "${upload.path}")
|
|
@Value(value = "${upload.path}")
|
|
private String path;
|
|
private String path;
|
|
|
|
|
|
@@ -63,10 +66,28 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
userMapper.selectById(request.getHeader("Token")).getCompanyId());
|
|
userMapper.selectById(request.getHeader("Token")).getCompanyId());
|
|
for (Map<String, Object> map : nameList) {
|
|
for (Map<String, Object> map : nameList) {
|
|
//再根据人分别获取当天的报告
|
|
//再根据人分别获取当天的报告
|
|
- map.put("data", reportMapper.getReportByDate(date, (String) map.get("id")));
|
|
|
|
|
|
+ List<Map<String, Object>> list = reportMapper.getReportByDate(date, (String) map.get("id"));
|
|
|
|
+ map.put("data", list);
|
|
|
|
+ double reportTime = 0;
|
|
|
|
+ for (Map<String, Object> m : list) {
|
|
|
|
+ double t = (double) m.get("time");
|
|
|
|
+ reportTime += t;
|
|
|
|
+ }
|
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
+ map.put("reportTime", df.format(reportTime));
|
|
|
|
+ List<TimeCalculationShow> timeList = timeCalculationShowMapper.selectList(new QueryWrapper<TimeCalculationShow>().eq("user_id", (String) map.get("id")).eq("date", date));
|
|
|
|
+ int calculateTime = 0;
|
|
|
|
+ for (TimeCalculationShow show : timeList) {
|
|
|
|
+ calculateTime += show.getDuration();
|
|
|
|
+ }
|
|
|
|
+ //数据库是秒,时间转换为小时;
|
|
|
|
+ double d = calculateTime*1.0/3600;
|
|
|
|
+ map.put("calculateTime", df.format(d));
|
|
}
|
|
}
|
|
|
|
+
|
|
httpRespMsg.data = nameList;
|
|
httpRespMsg.data = nameList;
|
|
} catch (NullPointerException e) {
|
|
} catch (NullPointerException e) {
|
|
|
|
+ e.printStackTrace();
|
|
httpRespMsg.setError("验证失败");
|
|
httpRespMsg.setError("验证失败");
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|