Browse Source

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

# Conflicts:
#	fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java
seyason 5 years ago
parent
commit
14839f87c3

+ 5 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -120,7 +120,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             style.setDataFormat(HSSFDataFormat.getBuiltinFormat("yy/mm/dd hh:mm"));
             //新增数据行 并且装填数据
             int rowNum = 1;
-            for (Map<String, Object> map : reportMapper.getAllReportByDate(date)) {
+            List<Map<String, Object>> allReportByDate = reportMapper.getAllReportByDate(date);
+            for (Map<String, Object> map : allReportByDate) {
                 HSSFRow row = sheet.createRow(rowNum);
                 row.createCell(0).setCellValue(rowNum);
                 row.createCell(1).setCellValue((String) map.get("name"));
@@ -167,10 +168,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             //以下区间被认为是工作时间
             Integer[] workType = {-1, 0, 1, 2, 3, 4, 5};
             //工作时间筛选
-            for (TimeCalculation timeCalculation : timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
+            List<TimeCalculation> timeCalculations = timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
                     .eq("date", LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")))
                     .eq("user_id", userId)
-                    .in("action_type", workType))) {
+                    .in("action_type", workType));
+            for (TimeCalculation timeCalculation : timeCalculations) {
                 totalWorkingTime += timeCalculation.getDuration();
             }
             //把总秒数转为double后换算为小时并保留两位小数

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

@@ -447,7 +447,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
     }
 
     public static void main(String[] args) throws Exception {
-//        String b = isIM(new File("C:\\Users\\seya\\Desktop\\im.jpg"));
+//        String b = isDevelop(new File("C:\\Users\\seya\\Desktop\\wtt.jpg"));
 //        System.out.println("结果:"+b);
     }
 

+ 7 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java

@@ -55,9 +55,10 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
         //时间占比 预先定义好长度为10的数组再向里面添加
         Integer[] timeArray = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
         //把当天所有行为分别加在一起装进数组
-        for (TimeCalculation timeCalculation : timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
+        List<TimeCalculation> list = timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
                 .eq("user_id", userId)
-                .eq("date", todayDate))) {
+                .eq("date", todayDate));
+        for (TimeCalculation timeCalculation : list) {
             timeArray[timeCalculation.getActionType() + 1] += timeCalculation.getDuration();
         }
         resultMap.put("timeDistribution", timeArray);
@@ -105,8 +106,9 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
                 //然后根据日期和用户id获取到所有的记录 然后手动累加在一起
                 Long[] timeArray = {0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
                 //其他 编程 上网 文档 设计 美工 运营 看小说 影视娱乐 听音乐
-                for (Map<String, Object> dataMap : timeCalculationMapper
-                        .getTodayStatistics((String) userMap.get("id"), date, companyId)) {
+                List<Map<String, Object>> tatistics = timeCalculationMapper
+                        .getTodayStatistics((String) userMap.get("id"), date, companyId);
+                for (Map<String, Object> dataMap : tatistics) {
                     timeArray[(int) dataMap.get("type") + 1] += (Long) dataMap.get("duration");
                 }
                 Long[] resultArray = new Long[6];
@@ -180,7 +182,7 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
                         total += todayTime;
                         list.add(map);
                     }
-                    /*这个时间复杂度巨几把高的for循环可以用某种算法优化 至少计算过的应该排除才对*/
+                    /*后续可以用迭代器把重复数据删掉*/
                 }
                 dataMap.put("time", list);
                 //这里检查如果只需要一天记录的话 说明是pc端界面那个地方 那就再多计算一个当天总工作时间