Commit 124f4f03 authored by nie'hong's avatar nie'hong

完善工时统计

parent 9e6848e1
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
</if> </if>
</where> </where>
GROUP BY type, <if test="centreId == null"> dept_name,</if> <if test="centreId != null"> dept_name,p.dept_id,</if>p.id,project_name GROUP BY type, <if test="centreId == null"> dept_name,</if> <if test="centreId != null"> dept_name,p.dept_id,</if>p.id,project_name
<if test="centreId != null"> ORDER BY p.dept_id</if> <if test="centreId != null"> ORDER BY d.sort</if>
</select> </select>
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
<select id="getWorkTimeAndCostCollect" resultMap="workTimeAndCostCollect" > <select id="getWorkTimeAndCostCollect" resultMap="workTimeAndCostCollect" >
SELECT t.type AS type, t.dept_id AS dept_id,dept_name, SELECT t.type AS type, t.dept_id AS dept_id,dept_name,
t.project_id AS project_id ,IF (YEAR (work_day) = YEAR (NOW()), concat(YEAR (work_day),'年',MONTH (work_day),'月') , concat(YEAR(work_day), '年')) AS statistics_time ,ROUND(SUM(t.work_time)/8,2) AS t.project_id AS project_id ,IF (YEAR (work_day) = YEAR (NOW()), concat(YEAR (work_day),'年',MONTH (work_day),'月') , concat(YEAR(work_day), '年')) AS statistics_time ,SUM(t.work_time)/8 AS
total_time, SUM(t.work_time * s.day_salary)/8 AS cost ,project_name total_time, SUM(t.work_time * s.day_salary)/8 AS cost ,project_name
FROM work_time_order t LEFT JOIN work_project p ON t.project_id=p.id LEFT JOIN work_dept d ON t.dept_id=d.id LEFT JOIN work_user_salary s ON s.user_id = t.user_id FROM work_time_order t LEFT JOIN work_project p ON t.project_id=p.id LEFT JOIN work_dept d ON t.dept_id=d.id LEFT JOIN work_user_salary s ON s.user_id = t.user_id
WHERE status IN (2,5) AND s.create_time &lt; t.work_day AND s.end_time > t.work_day WHERE status IN (2,5) AND s.create_time &lt; t.work_day AND s.end_time > t.work_day
...@@ -319,7 +319,7 @@ ...@@ -319,7 +319,7 @@
t.status in (2,5) AND t.status in (2,5) AND
t.work_day &lt;= #{endDate} t.work_day &lt;= #{endDate}
<if test="startDate != null"> <if test="startDate != null">
AND t.work_day > #{startDate} AND t.work_day >= #{startDate}
</if> </if>
AND project_id in AND project_id in
<foreach collection="projectIds" item="projectId" open="(" close=")" separator=","> <foreach collection="projectIds" item="projectId" open="(" close=")" separator=",">
......
...@@ -579,8 +579,8 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -579,8 +579,8 @@ public class StatisticsServiceImpl implements StatisticsService {
List<UserWorkTimeStatisticsByProject> userProjectWorkTimeStatistics1 = workTimeOrderMapper.getUserProjectWorkTimeStatistics(startDate, endDate, projectIds, true); List<UserWorkTimeStatisticsByProject> userProjectWorkTimeStatistics1 = workTimeOrderMapper.getUserProjectWorkTimeStatistics(startDate, endDate, projectIds, true);
// 部门级别以上的用户可以查询所管理项目的成员所填的其他类型的工单 // 部门级别以上的用户可以查询所管理项目的成员所填的其他类型的工单
List<Integer> userIds = workUserProjectMapper.selectUserIdByProjectIds(projectIds);
if (rank.contains(LevelRankEnum.DEPARTMENT_LEVEL.getRank()) || rank.contains(LevelRankEnum.CENTRAL_LEVEL.getRank())) { if (rank.contains(LevelRankEnum.DEPARTMENT_LEVEL.getRank()) || rank.contains(LevelRankEnum.CENTRAL_LEVEL.getRank())) {
List<Integer> userIds = workUserProjectMapper.selectUserIdByProjectIds(projectIds);
// 获取其他类型统计信息 // 获取其他类型统计信息
List<UserWorkTimeStatisticsByProject> userWorkTimeStatisticsByProjectList = workTimeOrderMapper.selectListByType(startDate, endDate, queryType, userIds, false); List<UserWorkTimeStatisticsByProject> userWorkTimeStatisticsByProjectList = workTimeOrderMapper.selectListByType(startDate, endDate, queryType, userIds, false);
// 获取查询结果的类型 // 获取查询结果的类型
......
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