Commit a12787df authored by nie'hong's avatar nie'hong

完善项目工时统计

parent 145e31b8
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
<select id="selectListByMonth" resultMap="projectStatisticsByMonth"> <select id="selectListByMonth" resultMap="projectStatisticsByMonth">
select '合计' AS project_name, group_CONCAT(DISTINCT YEAR (statistics_start),'年',MONTH (statistics_start),'月') AS date,sum(total_time) AS total_time, sum(cost) AS cost select <if test="deptId != null">'合计' AS project_name,</if> <if test="projectId != null"> project_name,</if> group_CONCAT(DISTINCT YEAR (statistics_start),'年',MONTH (statistics_start),'月') AS date,sum(total_time) AS total_time, sum(cost) AS cost
from work_project_time_cost ptc join work_project p on ptc.project_id = p.id join work_dept d on ptc.dept_id = d.id from work_project_time_cost ptc join work_project p on ptc.project_id = p.id join work_dept d on ptc.dept_id = d.id
<where> <where>
<if test="projectId != null "> <if test="projectId != null ">
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
AND p.dept_id = #{deptId} AND year(statistics_start) = #{year} AND p.dept_id = #{deptId} AND year(statistics_start) = #{year}
</if> </if>
</where> </where>
group by year(statistics_start),MONTH(statistics_start) group by <if test="projectId != null"> project_name,</if> year(statistics_start),MONTH(statistics_start)
</select> </select>
<select id="selectListStatistics" resultMap="projectStatisticsByMonth"> <select id="selectListStatistics" resultMap="projectStatisticsByMonth">
......
...@@ -501,6 +501,10 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -501,6 +501,10 @@ public class StatisticsServiceImpl implements StatisticsService {
if (!role.contains(ManagerEnum.IS_CENTRE_DIRECTOR.getCode()) && deptId != null) { if (!role.contains(ManagerEnum.IS_CENTRE_DIRECTOR.getCode()) && deptId != null) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.NO_AUTHORITY); throw new BaseCustomException(BASE_RESP_CODE_ENUM.NO_AUTHORITY);
} }
// 中心级权限默认查询部门
if (role.contains(ManagerEnum.IS_CENTRE_DIRECTOR.getCode()) && deptId == null) {
deptId = DEFAULT_DEPT_ID;
}
// 默认统计截至时间为前一天 // 默认统计截至时间为前一天
if (StringUtil.isEmpty(endDate)) { if (StringUtil.isEmpty(endDate)) {
...@@ -623,7 +627,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -623,7 +627,7 @@ public class StatisticsServiceImpl implements StatisticsService {
statisticsDateAndWorkTime1.setCost(cost); statisticsDateAndWorkTime1.setCost(cost);
statisticsDateAndWorkTimes.add(statisticsDateAndWorkTime1); statisticsDateAndWorkTimes.add(statisticsDateAndWorkTime1);
} }
return projectStatisticsByMonths1; return projectStatistics;
} }
//获取一个月应上班日期,如果是当月,时间截至到当天 //获取一个月应上班日期,如果是当月,时间截至到当天
......
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