Commit 58170ac7 authored by nie'hong's avatar nie'hong

完善项目工时统计

parent 1898c2b4
......@@ -55,4 +55,11 @@ public interface WorkProjectMapper extends BaseMapper<WorkProject> {
List<Integer> getProjectIdByManager(Integer userId);
List<WorkProject> getListByCentreIdAndIsConclusion(@Param("centreId") Integer centreId,@Param("isConclusion") Integer isConclusion);
/**
* 如果项目为已结项,返回最后一次统计时间的年月。为未结项,返回当前年月
* @param projectId
* @return
*/
String getLastDate(Integer projectId);
}
......@@ -191,7 +191,18 @@
from
<include refid="table"/>
<where>
<include refid="criteria"/>
<if test="isConclusion != null">
AND is_conclusion = #{isConclusion}
</if>
<if test="deptId != null and managerId == null">
AND dept_id = #{deptId}
</if>
<if test="deptId != null and managerId != null">
AND (dept_id = #{deptId} OR manager_id = #{managerId})
</if>
<if test="managerId != null and deptId == null">
AND manager_id = #{managerId}
</if>
</where>
</select>
......@@ -212,5 +223,19 @@
</if>
</select>
<select id="getLastDate" resultType="java.lang.String">
SELECT
CONCAT(YEAR (IF (is_conclusion = 0,max(work_day),now())),
'年',
MONTH (IF (is_conclusion = 0,max(work_day),now())),
'月'
)
FROM
work_project p
JOIN work_time_order t ON p.id = t.project_id
WHERE
p.id = #{projectId}
</select>
</mapper>
......@@ -26,7 +26,7 @@ public class AutoStatistics {
private WorkProjectTimeCostMapper workProjectTimeCostMapper;
@Transactional
@Scheduled(cron = "0 0 0 * * ?")
@Scheduled(cron = "0 5 0 * * ?")
public void autoStatistics(){
log.info("AutoStatistics[]autoStatistics[]自动统计任务");
Date date = DateUtil.add(new Date(), Calendar.MONTH, -3);
......
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