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

人员工时统计报表,项目统计报表

parent 02912147
......@@ -76,6 +76,7 @@ public enum BASE_RESP_CODE_ENUM {
REPEAT_WITH_OLDTIME("654", "日期与旧时间冲突"),
BUDGET_CANNOT_BELESSTHAN_ZERO("655", "预算不能小于0"),
ITEMOADUPLICATE("656", "项目OA重复"),
NO_AUTHORITY("657","暂无该权限")
;
......
......@@ -81,10 +81,10 @@
select <include refid="Base_Column_List"/>
from <include refid="table"/>
<where>
<if test="manager_id != null">
<if test="managerId != null">
manager_id = #{managerId}
</if>
<if test="dept_id != null">
<if test="deptId != null">
OR dept_id = #{deptId}
</if>
<if test="deptIds != null">
......@@ -95,6 +95,7 @@
</if>
</where>
</select>
<select id="getProjectsByIds" resultType="cn.wisenergy.model.app.WorkProject">
select <include refid="Base_Column_List"/>
from <include refid="table"/>
......
......@@ -50,20 +50,20 @@
INSERT INTO work_project_time_cost (
project_id,
user_id,
is_overtime,
statistics_start,
statistics_end,
total_time,
cost
cost,
create_time
)
SELECT
project_id,
t.user_id,
is_overtime,
min(work_day),
max(work_day),
sum(work_time / 8),
sum(work_time / 8 * s.day_salary)
sum(work_time / 8 * s.day_salary),
now() AS create_time
FROM
work_time_order t
JOIN work_user_salary s ON t.user_id = s.user_id
......@@ -76,8 +76,8 @@
is_overtime,
YEAR (work_day),
MONTH (work_day)
ON DUPLICATE KEY UPDATE is_overtime =
VALUES(is_overtime),
ON DUPLICATE KEY UPDATE create_time =
VALUES(create_time),
statistics_end =
VALUES(statistics_end),
total_time =
......
......@@ -23,6 +23,7 @@
FROM work_user_role
WHERE user_id = #{userId}
</select>
<select id="getRoleUserLevel" resultType="cn.wisenergy.model.dto.UserRoleLevelDto">
select ur.user_id as 'user_id',r.id as 'role_id',l.name as 'level_name',l.rank as 'rank'
from work_user_role ur join work_role r on ur.role_id = r.id
......
......@@ -28,7 +28,7 @@ public interface StatisticsService {
List<Object> getMonthlyStatistics(Integer userId);
/**
* 获取负责项目在本月的工时汇总:花费工时,工时成本
* 获取负责项目的工时汇总:花费工时,工时成本
*
* @param userId
*/
......@@ -44,7 +44,7 @@ public interface StatisticsService {
HSSFWorkbook exportWorkTimeExcel(GetMonthlyCollectParam param);
/**
* 获取用户所在未结项目的工时统计
* 获取用户管理项目人员工时统计
*
* @param startDate
* @param endDate
......@@ -58,7 +58,8 @@ public interface StatisticsService {
*
* @param userId
* @param deptId
* @param date
* @param year
* @param projectId
* @return
*/
List<ProjectStatisticsByMonth> getProjectStatistics(Integer userId, Integer deptId, Integer year, Integer projectId);
......
......@@ -66,7 +66,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
private WorkProjectChangeService workProjectChangeService;
@Autowired
private WorkUserDeptService workUserDeptService;
private UserRoleLevelUtils userRoleLevelUtils;
/**
* 功能:根据项目id获取项目
......@@ -145,8 +145,9 @@ public class WorkProjectServiceImpl implements WorkProjectService {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
WorkUser user = workUserService.getById(userId);
List<Integer> role = userRoleLevelUtils.getRole(user.getId());
//普通用户
if (user.getLevel().equals(ManagerEnum.NOT_MANAGER)) {
if (role.contains(ManagerEnum.NOT_MANAGER.getCode())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN);
}
//存放项目列表
......@@ -154,14 +155,15 @@ public class WorkProjectServiceImpl implements WorkProjectService {
//存放查询条件
HashMap<String, Object> map = new HashMap<>();
// 查询项目表中管理为用户的项目集合,用户为项目经理,但level可能不为1
// 查询项目表中管理为用户的项目集合,
map.put("managerId", userId);
//用户是部门级别,查询该部门下的所有项目
if (user.getLevel().equals(ManagerEnum.IS_DEPARTMENT_DIRECTOR.getCode())) {
if (role.contains(ManagerEnum.IS_DEPARTMENT_DIRECTOR.getCode())) {
map.remove("managerId");
map.put("deptId", user.getDeptId());
}
//中心级别的用户查看中心下所有部门的所有项目
if (user.getLevel().equals(ManagerEnum.IS_CENTRE_DIRECTOR.getCode())) {
if (role.contains(ManagerEnum.IS_CENTRE_DIRECTOR.getCode())) {
//获取中心信息
WorkCentre workCentre = workCentreMapper.getByManagerId(user.getId());
if (workCentre == null) {
......
......@@ -128,5 +128,4 @@ public class StatisticsController extends BaseController {
return getResult(projectStatisticsByMonths);
}
}
\ No newline at end of file
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