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

完善项目工时统计

parent 1898c2b4
...@@ -55,4 +55,11 @@ public interface WorkProjectMapper extends BaseMapper<WorkProject> { ...@@ -55,4 +55,11 @@ public interface WorkProjectMapper extends BaseMapper<WorkProject> {
List<Integer> getProjectIdByManager(Integer userId); List<Integer> getProjectIdByManager(Integer userId);
List<WorkProject> getListByCentreIdAndIsConclusion(@Param("centreId") Integer centreId,@Param("isConclusion") Integer isConclusion); List<WorkProject> getListByCentreIdAndIsConclusion(@Param("centreId") Integer centreId,@Param("isConclusion") Integer isConclusion);
/**
* 如果项目为已结项,返回最后一次统计时间的年月。为未结项,返回当前年月
* @param projectId
* @return
*/
String getLastDate(Integer projectId);
} }
...@@ -191,7 +191,18 @@ ...@@ -191,7 +191,18 @@
from from
<include refid="table"/> <include refid="table"/>
<where> <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> </where>
</select> </select>
...@@ -212,5 +223,19 @@ ...@@ -212,5 +223,19 @@
</if> </if>
</select> </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> </mapper>
...@@ -26,7 +26,7 @@ public class AutoStatistics { ...@@ -26,7 +26,7 @@ public class AutoStatistics {
private WorkProjectTimeCostMapper workProjectTimeCostMapper; private WorkProjectTimeCostMapper workProjectTimeCostMapper;
@Transactional @Transactional
@Scheduled(cron = "0 0 0 * * ?") @Scheduled(cron = "0 5 0 * * ?")
public void autoStatistics(){ public void autoStatistics(){
log.info("AutoStatistics[]autoStatistics[]自动统计任务"); log.info("AutoStatistics[]autoStatistics[]自动统计任务");
Date date = DateUtil.add(new Date(), Calendar.MONTH, -3); 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