Commit 86d31ace authored by nie'hong's avatar nie'hong

完善工时统计

parent 0d9a3b77
...@@ -34,6 +34,13 @@ public interface WorkProjectTimeCostMapper { ...@@ -34,6 +34,13 @@ public interface WorkProjectTimeCostMapper {
*/ */
List<ProjectStatisticsByMonth> selectListByMonth(@Param("year") Integer year,@Param("deptId") Integer deptId,@Param("projectId") Integer projectId); List<ProjectStatisticsByMonth> selectListByMonth(@Param("year") Integer year,@Param("deptId") Integer deptId,@Param("projectId") Integer projectId);
/**
* 部门编号不为空,查询部门下所有项目所有人员统计。部门主键为空时,查询项目下的所有人员的统计
* @param year
* @param deptId
* @param projectId
* @return
*/
List<ProjectStatisticsByMonth> selectListStatistics(@Param("year") Integer year,@Param("deptId") Integer deptId,@Param("projectId") Integer projectId); List<ProjectStatisticsByMonth> selectListStatistics(@Param("year") Integer year,@Param("deptId") Integer deptId,@Param("projectId") Integer projectId);
......
...@@ -7,7 +7,7 @@ package cn.wisenergy.model.enums; ...@@ -7,7 +7,7 @@ package cn.wisenergy.model.enums;
public enum LevelEnum { public enum LevelEnum {
EXAMINE("工时审批"), EXAMINE("工时审批"),
USER_STATISTICS("人员统计报表"), USER_STATISTICS("人员统计报表"),
PROJECT_STATITSTICS("项目统计报表"), PROJECT_STATISTICS("项目统计报表"),
PROJECT_MANAGER( "项目/商机管理"), PROJECT_MANAGER( "项目/商机管理"),
TIMEEXPORT("工时导出"), TIMEEXPORT("工时导出"),
SYSTEMSETTINGS("系统设置"), SYSTEMSETTINGS("系统设置"),
......
...@@ -394,8 +394,6 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -394,8 +394,6 @@ public class StatisticsServiceImpl implements StatisticsService {
Date date = DateUtil.convertStrToDate(param.getYear() + "-" + param.getMonth(), "yyyy-MM"); Date date = DateUtil.convertStrToDate(param.getYear() + "-" + param.getMonth(), "yyyy-MM");
// 传参的时间当月总天数 // 传参的时间当月总天数
int dayCount = DateUtil.getMonthDaysArray(date).length; int dayCount = DateUtil.getMonthDaysArray(date).length;
// 当天
Date today = new Date();
// 需要导出的信息 // 需要导出的信息
List<StatisticsTableDto> list = dayWorkTimeOfMonth.getList(); List<StatisticsTableDto> list = dayWorkTimeOfMonth.getList();
// 创建工作簿 // 创建工作簿
...@@ -404,6 +402,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -404,6 +402,7 @@ public class StatisticsServiceImpl implements StatisticsService {
HSSFSheet sheet = sheets.createSheet("Sheet1"); HSSFSheet sheet = sheets.createSheet("Sheet1");
// 普通样式对象 // 普通样式对象
HSSFCellStyle cellStyle = this.createOrdinaryCellStyle(sheets); HSSFCellStyle cellStyle = this.createOrdinaryCellStyle(sheets);
cellStyle.setFillForegroundColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex());
// 节假日样式,底色为绿色,其余样式与普通相同 // 节假日样式,底色为绿色,其余样式与普通相同
HSSFCellStyle cellStyle1 = this.createOrdinaryCellStyle(sheets); HSSFCellStyle cellStyle1 = this.createOrdinaryCellStyle(sheets);
...@@ -513,7 +512,9 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -513,7 +512,9 @@ public class StatisticsServiceImpl implements StatisticsService {
log.info("StatisticsServiceImpl[]getUserWorkTimeStatisticsReport[]" + userId + deptId + startDate + endDate + isConclusion); log.info("StatisticsServiceImpl[]getUserWorkTimeStatisticsReport[]" + userId + deptId + startDate + endDate + isConclusion);
List<Integer> role = UserRoleLevelUtils.getRole(userId); List<Integer> role = UserRoleLevelUtils.getRole(userId);
// 判断是否有该权限 // 判断是否有该权限
UserRoleLevelUtils.isManagerLevel(userId,LevelEnum.PROJECT_STATITSTICS.getLevelName()); if (!UserRoleLevelUtils.isManagerLevel(userId, LevelEnum.USER_STATISTICS.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.NO_AUTHORITY);
}
// 获取用户信息 // 获取用户信息
WorkUser user = workUserService.getById(userId); WorkUser user = workUserService.getById(userId);
// 获取用户权限的级别 // 获取用户权限的级别
...@@ -610,14 +611,17 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -610,14 +611,17 @@ public class StatisticsServiceImpl implements StatisticsService {
public List<ProjectStatisticsByMonth> getProjectStatistics(Integer userId, Integer deptId, Integer year, Integer projectId) { public List<ProjectStatisticsByMonth> getProjectStatistics(Integer userId, Integer deptId, Integer year, Integer projectId) {
log.info("StatisticsServiceImpl[]getProjectStatistics[]input.param" + userId + deptId + year + projectId); log.info("StatisticsServiceImpl[]getProjectStatistics[]input.param" + userId + deptId + year + projectId);
// 获取权限 // 获取权限
UserRoleLevelUtils.isManagerLevel(userId, LevelEnum.PROJECT_STATITSTICS.getLevelName()); if (!UserRoleLevelUtils.isManagerLevel(userId, LevelEnum.PROJECT_STATISTICS.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.NO_AUTHORITY);
}
// 默认查询时间为当前 // 默认查询时间为当前
if (year == null) { if (year == null) {
year = DateUtil.getYear(new Date()); year = DateUtil.getYear(new Date());
} }
// 部门主键和项目主键不能同时为空 // 部门主键和项目主键不能同时为空
if (deptId == null && projectId == null) { if (deptId == null && projectId == null) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL); deptId = DEFAULT_DEPT_ID;
} }
// 部门为空,查询某个项目的全周期统计,不为空,查询部门在某年的全部项目按月总计信息 // 部门为空,查询某个项目的全周期统计,不为空,查询部门在某年的全部项目按月总计信息
......
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