Commit 8c13667a authored by nie'hong's avatar nie'hong

完善工时统计

parent 8209cac5
......@@ -169,12 +169,14 @@ public class StatisticsServiceImpl implements StatisticsService {
// 移除查询审批人和状态条件
map.remove("reviewerId");
map.remove("status");
map.remove("startModifyTime");
//待审核包括:新提交和重新提交的
List<Integer> statusArray = new ArrayList<>();
statusArray.add(WorkOrderStatus.WAIT_AUDIT.getCode());
statusArray.add(WorkOrderStatus.RE_SUBMIT.getCode());
//本月未审批数量查询
map.put("startWorkTime", firstDayOfMonth);
map.put("statusArray", statusArray);
// 查询用户负责的项目和商机id
......@@ -191,7 +193,7 @@ public class StatisticsServiceImpl implements StatisticsService {
List<Integer> rank = this.getUserRank(workLevels, LevelEnum.EXAMINE.getLevelName());
// 查询用户负责审批的除项目合商机的其余类型
Integer notCompletedCount2 = 0;
if (CollectionUtil.isNotEmpty(rank) && rank.contains(LevelRankEnum.DEPARTMENT_LEVEL.getRank())) {
if (rank.contains(LevelRankEnum.DEPARTMENT_LEVEL.getRank())) {
map.remove("projectIdList");
List<WorkType> allType = workTypeMapper.getAll();
List<Integer> type = new ArrayList<>();
......@@ -817,15 +819,20 @@ public class StatisticsServiceImpl implements StatisticsService {
String startDate = new String();
String endDate = new String();
if (deptId == null) {
if (projectId != null) {
// 整个项目所占时间,未结项目截止时间为当月,已结项目截止时间为最后一次统计的时间
startDate = projectStatisticsByMonths.get(0).getStatisticsDateAndWorkTimes().get(0).getDate();
endDate = workProjectMapper.getLastDate(projectId);
} else {
startDate = DateUtil.convertDateToStr(DateUtil.getFirstDayOfYear(new Date()), "yyyy年M月");
endDate = DateUtil.convertDateToStr(new Date(), "yyyy年M月");
if (year < DateUtil.getYear(new Date())) {
startDate = year + "年1月";
endDate = year + "年12月";
}else {
startDate = DateUtil.convertDateToStr(DateUtil.getFirstDayOfYear(new Date()), "yyyy年M月");
endDate = DateUtil.convertDateToStr(new Date(), "yyyy年M月");
}
}
// 项目的周期年月集合
List<String> yearMonthList = this.getYearMonthList(startDate, endDate);
// 部门主键不为空时,日期格式只有某月。为空时,日期格式为某年统计的第一个月为某年某月,其余为某月
......@@ -944,24 +951,16 @@ public class StatisticsServiceImpl implements StatisticsService {
public void conversionDateFormat(List<ProjectStatisticsByMonth> projectStatisticsByMonths, List<String> yearMonthList, Integer projectId) {
for (ProjectStatisticsByMonth projectStatisticsByMonth : projectStatisticsByMonths) {
List<ProjectStatisticsByMonth.StatisticsDateAndWorkTime> statisticsDateAndWorkTimes = projectStatisticsByMonth.getStatisticsDateAndWorkTimes();
// 部门主键不为空时,日期格式只有某月
// if (deptId != null) {
// for (ProjectStatisticsByMonth.StatisticsDateAndWorkTime statisticsDateAndWorkTime : statisticsDateAndWorkTimes) {
// String date = statisticsDateAndWorkTime.getDate();
// StringBuilder stringBuilder = new StringBuilder(date);
// // 删除年份
// stringBuilder.delete(0, 5);
// statisticsDateAndWorkTime.setDate(stringBuilder.toString());
// }
// } else {
for (int i = 0; i < yearMonthList.size(); i++) {
String s = yearMonthList.get(i);
String date = new String();
if (i < statisticsDateAndWorkTimes.size()) {
date = statisticsDateAndWorkTimes.get(i).getDate();
} else {
break;
}
// 项目统计报表中截至当前月份中如果某个月份没有统计数据,补充当月工时为0
// else {
// break;
// }
// 时间不连续,创建对象
if (!s.equals(date)) {
ProjectStatisticsByMonth.StatisticsDateAndWorkTime statisticsDateAndWorkTime = new ProjectStatisticsByMonth.StatisticsDateAndWorkTime();
......@@ -989,19 +988,6 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
// for (int i = statisticsDateAndWorkTimes.size() - 1; i > 0; i--) {
// String date1 = statisticsDateAndWorkTimes.get(i).getDate();
// String date2 = statisticsDateAndWorkTimes.get(i - 1).getDate();
//
// // 如果不为当年统计数据的第一个月,则删除年份
// if (date1.charAt(2) == date2.charAt(2) && date1.charAt(3) == date2.charAt(3)) {
// StringBuilder dateBuilder1 = new StringBuilder(date1);
// // 删除年份
// dateBuilder1.delete(0, 5);
// statisticsDateAndWorkTimes.get(i).setDate(dateBuilder1.toString());
// }
// }
// }
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment