Commit 45511f79 authored by nie'hong's avatar nie'hong

删除user中的level

parent bda2c538
...@@ -25,4 +25,6 @@ public interface WorkDeptMapper extends BaseMapper<WorkDept> { ...@@ -25,4 +25,6 @@ public interface WorkDeptMapper extends BaseMapper<WorkDept> {
int updateManagerIdISNullById(Integer id); int updateManagerIdISNullById(Integer id);
List<WorkDept> getDeptByManagerId(Integer userId);
} }
...@@ -3,9 +3,11 @@ package cn.wisenergy.mapper; ...@@ -3,9 +3,11 @@ package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkTypeManager; import cn.wisenergy.model.app.WorkTypeManager;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
public interface WorkTypeManagerMapper extends BaseMapper<WorkTypeManager> {
public interface WorkTypeManagerMapper extends BaseMapper<WorkTypeManager> {
List<WorkTypeManager> getListByManagerId(Integer userId);
} }
...@@ -76,4 +76,10 @@ ORDER BY c.id,d.id ...@@ -76,4 +76,10 @@ ORDER BY c.id,d.id
</select> </select>
<select id="getDeptByManagerId" resultType="cn.wisenergy.model.app.WorkDept">
select <include refid="cols_all"/>
from <include refid="table"/>
where manager_id = #{userId}
</select>
</mapper> </mapper>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
AND statistics_start >= #{firstDayOfMonth} AND statistics_start >= #{firstDayOfMonth}
</if> </if>
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 </if> <if test="centreId != null"> ORDER BY p.dept_id</if>
</select> </select>
......
...@@ -221,9 +221,15 @@ ...@@ -221,9 +221,15 @@
<foreach collection="statusArray" item="workStatus" open="(" close=")" separator=",">#{workStatus} <foreach collection="statusArray" item="workStatus" open="(" close=")" separator=",">#{workStatus}
</foreach> </foreach>
</if> </if>
<if test="typeArray != null"> <if test="typeList != null">
AND `type` IN AND `type` IN
<foreach collection="typeArray" item="type" open="(" close=")" separator=","> <foreach collection="typeList" item="type" open="(" close=")" separator=",">
#{type}
</foreach>
</if>
<if test="deptIdList != null">
AND `type` IN
<foreach collection="deptIdList" item="dept" open="(" close=")" separator=",">
#{type} #{type}
</foreach> </foreach>
</if> </if>
......
...@@ -3,5 +3,9 @@ ...@@ -3,5 +3,9 @@
<mapper namespace="cn.wisenergy.mapper.WorkTypeManagerMapper"> <mapper namespace="cn.wisenergy.mapper.WorkTypeManagerMapper">
<select id="getListByManagerId" resultType="cn.wisenergy.model.app.WorkTypeManager">
select id, name,dept_id,manager_id,type
from work_type_manager
where manager_id = #{userId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
<result column="type" property="type" /> <result column="type" property="type" />
<result column="status" property="status" /> <result column="status" property="status" />
<result column="wx_id" property="wxId" /> <result column="wx_id" property="wxId" />
<result column="level" property="level" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" /> <result column="modify_time" property="modifyTime" />
</resultMap> </resultMap>
...@@ -33,11 +32,11 @@ ...@@ -33,11 +32,11 @@
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
name, oa_user_id, login_name, phone, dept_id, email, role ,type,status,wx_id,level,create_time,modify_time name, oa_user_id, login_name, phone, dept_id, email, role ,type,status,wx_id,create_time,modify_time
</sql> </sql>
<sql id="values"> <sql id="values">
#{name},#{oaUserId},#{loginName},#{phone},#{deptId},#{email},#{role},#{type},#{status},#{wxId},#{level},now(),now() #{name},#{oaUserId},#{loginName},#{phone},#{deptId},#{email},#{role},#{type},#{status},#{wxId},now(),now()
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
...@@ -52,7 +51,6 @@ ...@@ -52,7 +51,6 @@
<if test="type != null">type =#{type},</if> <if test="type != null">type =#{type},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="wxId != null">wx_id =#{wxId},</if> <if test="wxId != null">wx_id =#{wxId},</if>
<if test="level != null">level = #{level},</if>
modify_time =now() modify_time =now()
</sql> </sql>
...@@ -69,7 +67,6 @@ ...@@ -69,7 +67,6 @@
<if test="type != null">and type =#{type}</if> <if test="type != null">and type =#{type}</if>
<if test="status != null">and status = #{status}</if> <if test="status != null">and status = #{status}</if>
<if test="wxId != null">and wx_id =#{wxId},</if> <if test="wxId != null">and wx_id =#{wxId},</if>
<if test="level != null">and level = #{level}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if> <if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="modifyTime != null">and #{modifyTime} &gt;= modify_time</if> <if test="modifyTime != null">and #{modifyTime} &gt;= modify_time</if>
</sql> </sql>
......
...@@ -62,9 +62,6 @@ public class WorkUser implements Serializable { ...@@ -62,9 +62,6 @@ public class WorkUser implements Serializable {
@ApiModelProperty(name = "wxId",value = "微信id") @ApiModelProperty(name = "wxId",value = "微信id")
private String wxId; private String wxId;
@ApiModelProperty(name = "level",value = "权限级别:普通用户:0,项目/商机级别:1,部门级别:2,中心级别:3,系统管理员:4")
private Integer level;
@ApiModelProperty(name = "createTime",value = "创建时间") @ApiModelProperty(name = "createTime",value = "创建时间")
private Date createTime; private Date createTime;
......
...@@ -10,8 +10,7 @@ public enum LevelEnum { ...@@ -10,8 +10,7 @@ public enum LevelEnum {
PROJECT_MANAGER( "项目/商机管理"), PROJECT_MANAGER( "项目/商机管理"),
TIMEEXPORT("工时导出"), TIMEEXPORT("工时导出"),
SYSTEMSETTINGS("系统设置"), SYSTEMSETTINGS("系统设置"),
ACCOUNTMANAGEMENT("账号管理"), ACCOUNTMANAGEMENT("账号管理")
; ;
......
...@@ -70,6 +70,9 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -70,6 +70,9 @@ public class StatisticsServiceImpl implements StatisticsService {
@Autowired @Autowired
private WorkDeptMapper workDeptMapper; private WorkDeptMapper workDeptMapper;
@Autowired
private WorkTypeManagerMapper workTypeManagerMapper;
@Autowired @Autowired
private WorkUserProjectMapper workUserProjectMapper; private WorkUserProjectMapper workUserProjectMapper;
...@@ -84,9 +87,10 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -84,9 +87,10 @@ public class StatisticsServiceImpl implements StatisticsService {
if (param == null) { if (param == null) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL); throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
} }
//管理员用户 // 用户权限名
List<Integer> role = userRoleLevelUtils.getRole(param.getUserId()); List<String> userAuthority = this.getUserAuthority(param.getUserId());
if (!role.contains(ManagerEnum.IS_SYSTEM_MANAGER.getCode())) {
if (!userAuthority.contains(LevelEnum.TIMEEXPORT.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN); throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN);
} }
//默认时间为当月 //默认时间为当月
...@@ -143,7 +147,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -143,7 +147,7 @@ public class StatisticsServiceImpl implements StatisticsService {
public Map<String, Object> getMonthlyStatistics(Integer userId) { public Map<String, Object> getMonthlyStatistics(Integer userId) {
log.info("WorkTimeOrderServiceImpl[]getMonthlyStatistics[]input.param" + userId); log.info("WorkTimeOrderServiceImpl[]getMonthlyStatistics[]input.param" + userId);
WorkUser user = workUserService.getById(userId); WorkUser user = workUserService.getById(userId);
List<Integer> role = userRoleLevelUtils.getRole(user.getId()); List<String> userAuthority = this.getUserAuthority(userId);
//本月第一天 //本月第一天
Date firstDayOfMonth = DateUtil.getCurrentFirstDayOfMonth(); Date firstDayOfMonth = DateUtil.getCurrentFirstDayOfMonth();
// 返回数据对象 // 返回数据对象
...@@ -151,7 +155,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -151,7 +155,7 @@ public class StatisticsServiceImpl implements StatisticsService {
//存放查询条件 //存放查询条件
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
//用户是项目或部门级别,查询审批统计 //用户是项目或部门级别,查询审批统计
if (role.contains(ManagerEnum.IS_PROJECT_DIRECTOR.getCode()) || role.contains(ManagerEnum.IS_DEPARTMENT_DIRECTOR.getCode())) { if (userAuthority.contains(LevelEnum.EXAMINE.getLevelName())) {
//以审批人、审核状态、开始时间查询本月审批数量 //以审批人、审核状态、开始时间查询本月审批数量
map.put("reviewerId", userId); map.put("reviewerId", userId);
map.put("startDay", firstDayOfMonth); map.put("startDay", firstDayOfMonth);
...@@ -161,21 +165,19 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -161,21 +165,19 @@ public class StatisticsServiceImpl implements StatisticsService {
map.put("status", WorkOrderStatus.TURN_DOWN.getCode()); map.put("status", WorkOrderStatus.TURN_DOWN.getCode());
Integer rejectAndNotResubmit = workTimeOrderMapper.getCountByCondition(map); Integer rejectAndNotResubmit = workTimeOrderMapper.getCountByCondition(map);
// 项目级别,获取所管理项目, // 查询用户负责项目
if (role.contains(ManagerEnum.IS_PROJECT_DIRECTOR.getCode())) { List<WorkProject> projects = workProjectService.getUserManageProjects(userId);
List<WorkProject> projects = workProjectService.getUserManageProjects(userId); if (CollectionUtil.isNotEmpty(projects)) {
if (CollectionUtil.isNotEmpty(projects)) { List<Integer> projectIds = projects.stream().map(WorkProject::getId).collect(Collectors.toList());
List<Integer> projectIds = projects.stream().map(WorkProject::getId).collect(Collectors.toList()); map.put("projectIds", projectIds);
map.put("projectIds", projectIds);
}
} }
// 部门级别 List<WorkTypeManager> workTypeManagers = workTypeManagerMapper.getListByManagerId(userId);
if (role.contains(ManagerEnum.IS_DEPARTMENT_DIRECTOR.getCode())) { if (CollectionUtil.isNotEmpty(workTypeManagers)) {
List<Integer> type = workTypeManagers.stream().map(WorkTypeManager::getType).collect(Collectors.toList());
map.put("typeList", type);
map.put("deptId", user.getDeptId()); map.put("deptId", user.getDeptId());
//填报项目类型编码
int[] workOrderTypeArray = {WorkOrderType.EXTERNAL_WORK.getCode(), WorkOrderType.INTERNAL_WORK.getCode(), WorkOrderType.OTHER_NOT_PROJECT_BUSINESS.getCode()};
map.put("typeArray", workOrderTypeArray);
} }
//待审核包括:新提交和重新提交的 //待审核包括:新提交和重新提交的
List<Integer> statusArray = new ArrayList<>(); List<Integer> statusArray = new ArrayList<>();
statusArray.add(WorkOrderStatus.WAIT_AUDIT.getCode()); statusArray.add(WorkOrderStatus.WAIT_AUDIT.getCode());
...@@ -195,7 +197,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -195,7 +197,7 @@ public class StatisticsServiceImpl implements StatisticsService {
// 填报情况 // 填报情况
// 本月应填报日期 // 本月应填报日期
List<Date> currentMonthWorkDays = this.currentMonthWorkDays(firstDayOfMonth); List<Date> currentMonthWorkDays = this.currentMonthWorkDays(firstDayOfMonth,true);
// 本月已填报日期 // 本月已填报日期
List<Date> currentMonthFilledDays = this.currentMonthFilledDays(userId, firstDayOfMonth); List<Date> currentMonthFilledDays = this.currentMonthFilledDays(userId, firstDayOfMonth);
// 本月未填报日期 // 本月未填报日期
...@@ -265,9 +267,11 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -265,9 +267,11 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
// 用户角色 // 用户角色
List<Integer> role = userRoleLevelUtils.getRole(user.getId()); List<Integer> role = UserRoleLevelUtils.getRole(userId);
// 普通用户 // 用户权限
if (role.contains(ManagerEnum.NOT_MANAGER.getCode())) { List<String> userAuthority = this.getUserAuthority(userId);
// 没有小程序工时汇总权限
if (!userAuthority.contains(LevelEnum.EXAMINE.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN); throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN);
} }
...@@ -293,7 +297,6 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -293,7 +297,6 @@ public class StatisticsServiceImpl implements StatisticsService {
WorkDept workDept = workDeptMapper.getById(user.getDeptId()); WorkDept workDept = workDeptMapper.getById(user.getDeptId());
map.put("centreId",workDept.getCentreId() ); map.put("centreId",workDept.getCentreId() );
} }
// 查询项目和商机的工时统计 // 查询项目和商机的工时统计
List<WorkTimeAndCostCollect> collect = workProjectTimeCostMapper.selectList(map); List<WorkTimeAndCostCollect> collect = workProjectTimeCostMapper.selectList(map);
// 获取查询出的类型 // 获取查询出的类型
...@@ -313,26 +316,26 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -313,26 +316,26 @@ public class StatisticsServiceImpl implements StatisticsService {
collect.add(workTimeAndCostCollect); collect.add(workTimeAndCostCollect);
} }
} }
// 用户不为项目级别或不仅为项目级别
if (!role.contains(ManagerEnum.IS_PROJECT_DIRECTOR.getCode()) || role.size() != 1) {
// 部门和中心级别
if (role.contains(ManagerEnum.IS_DEPARTMENT_DIRECTOR.getCode()) || role.contains(ManagerEnum.IS_CENTRE_DIRECTOR.getCode())) {
// 清除查询条件 // 清除查询条件
map.remove("projectIds"); map.remove("projectIds");
map.remove("centreId"); map.remove("centreId");
types.clear(); types.clear();
// 查询条件排除项目和商机 // 查询类型排除项目和商机
for (WorkType workType : workTypes) { for (WorkType workType : workTypes) {
if (!workType.getName().equals(workTypes.get(0).getName()) && !workType.getName().equals(workTypes.get(1).getName())) { if (!workType.getName().equals(workTypes.get(0).getName()) && !workType.getName().equals(workTypes.get(1).getName())) {
types.add(workType.getId()); types.add(workType.getId());
} }
} }
map.put("types", types);
// 用户仅为部门管理,以部门主键作为查询条件之一,否则中心级别查询所有部门 // 用户不为中心级别
if (role.contains(ManagerEnum.IS_DEPARTMENT_DIRECTOR.getCode()) && role.size() == 1) { if (!role.contains(ManagerEnum.IS_CENTRE_DIRECTOR.getCode())) {
map.put("deptId", user.getDeptId()); map.put("deptId", user.getDeptId());
} }
map.put("types", types);
List<WorkTimeAndCostCollect> workTimeAndCostCollect = workTimeOrderMapper.getWorkTimeAndCostCollect(map); List<WorkTimeAndCostCollect> workTimeAndCostCollect = workTimeOrderMapper.getWorkTimeAndCostCollect(map);
// 将查询结果封装在一起 // 将查询结果封装在一起
...@@ -349,6 +352,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -349,6 +352,7 @@ public class StatisticsServiceImpl implements StatisticsService {
collect.add(workTimeAndCostCollect1); collect.add(workTimeAndCostCollect1);
} }
} }
} }
// 给类型赋值类型名称 // 给类型赋值类型名称
for (WorkTimeAndCostCollect timeAndCostCollect : collect) { for (WorkTimeAndCostCollect timeAndCostCollect : collect) {
...@@ -358,11 +362,11 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -358,11 +362,11 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
} }
} }
// 类型总工时
for (WorkTimeAndCostCollect workTimeAndCostCollect : collect) { for (WorkTimeAndCostCollect workTimeAndCostCollect1 : collect) {
// 类型的总工时 // 类型的总工时
BigDecimal typeTotalTime = new BigDecimal("0.0000"); BigDecimal typeTotalTime = new BigDecimal("0.000");
List<DeptProjectWorkTimeAndCost> deptProjectWorkTimeAndCosts = workTimeAndCostCollect.getDeptProjectWorkTimeAndCosts(); List<DeptProjectWorkTimeAndCost> deptProjectWorkTimeAndCosts = workTimeAndCostCollect1.getDeptProjectWorkTimeAndCosts();
if (CollectionUtil.isNotEmpty(deptProjectWorkTimeAndCosts)) { if (CollectionUtil.isNotEmpty(deptProjectWorkTimeAndCosts)) {
for (DeptProjectWorkTimeAndCost deptProjectWorkTimeAndCost : deptProjectWorkTimeAndCosts) { for (DeptProjectWorkTimeAndCost deptProjectWorkTimeAndCost : deptProjectWorkTimeAndCosts) {
List<ProjectWorkTimeAndCostStatistics> projectWorkTimeAndCostStatistics = deptProjectWorkTimeAndCost.getProjectWorkTimeAndCostStatistics(); List<ProjectWorkTimeAndCostStatistics> projectWorkTimeAndCostStatistics = deptProjectWorkTimeAndCost.getProjectWorkTimeAndCostStatistics();
...@@ -371,8 +375,9 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -371,8 +375,9 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
} }
} }
workTimeAndCostCollect.setWorkTime(typeTotalTime); workTimeAndCostCollect1.setWorkTime(typeTotalTime);
} }
Collections.sort(collect); Collections.sort(collect);
return collect; return collect;
} }
...@@ -380,10 +385,12 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -380,10 +385,12 @@ public class StatisticsServiceImpl implements StatisticsService {
@Override @Override
public HSSFWorkbook exportWorkTimeExcel(GetMonthlyCollectParam param) { public HSSFWorkbook exportWorkTimeExcel(GetMonthlyCollectParam param) {
log.info("StatisticsServiceImpl[]exportWorkTimeExcel[]input.param{}" + param); log.info("StatisticsServiceImpl[]exportWorkTimeExcel[]input.param{}" + param);
PageInfo dayWorkTimeOfMonth = getDayWorkTimeOfMonth(param); PageInfo dayWorkTimeOfMonth = this.getDayWorkTimeOfMonth(param);
Date date = DateUtil.convertStrToDate(param.getYear() + "-" + param.getMonth(), "yyyy-MM"); Date date = DateUtil.convertStrToDate(param.getYear() + "-" + param.getMonth(), "yyyy-MM");
// 传参的时间当月总天数 // 传参的时间当月总天数
int dayCount = DateUtil.getMonthDaysArray(date).length; int dayCount = DateUtil.getMonthDaysArray(date).length;
// 当天
Date today = new Date();
// 需要导出的信息 // 需要导出的信息
List<StatisticsTableDto> list = dayWorkTimeOfMonth.getList(); List<StatisticsTableDto> list = dayWorkTimeOfMonth.getList();
// 创建工作簿 // 创建工作簿
...@@ -404,7 +411,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -404,7 +411,7 @@ public class StatisticsServiceImpl implements StatisticsService {
// 第一列列宽 // 第一列列宽
sheet.setColumnWidth(1, EXCEL_WIDTH); sheet.setColumnWidth(1, EXCEL_WIDTH);
// 获取本月应上班日期集合 // 获取本月应上班日期集合
List<Date> dates = this.currentMonthWorkDays(date); List<Date> dates = this.currentMonthWorkDays(date,false);
List<Integer> days = new ArrayList<>(); List<Integer> days = new ArrayList<>();
for (Date date1 : dates) { for (Date date1 : dates) {
days.add(DateUtil.getDay(date1)); days.add(DateUtil.getDay(date1));
...@@ -500,7 +507,8 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -500,7 +507,8 @@ public class StatisticsServiceImpl implements StatisticsService {
public List<UserWorkTimeStatisticsByProject> getUserWorkTimeStatisticsReport(Integer userId, Integer deptId, String startDate, String endDate, Integer isConclusion) { public List<UserWorkTimeStatisticsByProject> getUserWorkTimeStatisticsReport(Integer userId, Integer deptId, String startDate, String endDate, Integer isConclusion) {
log.info("StatisticsServiceImpl[]getUserWorkTimeStatisticsReport[]" + userId + deptId + startDate + endDate + isConclusion); log.info("StatisticsServiceImpl[]getUserWorkTimeStatisticsReport[]" + userId + deptId + startDate + endDate + isConclusion);
List<Integer> role = userRoleLevelUtils.getRole(userId); List<Integer> role = userRoleLevelUtils.getRole(userId);
if (role.contains(ManagerEnum.NOT_MANAGER.getCode())) { List<String> userAuthority = this.getUserAuthority(userId);
if (!userAuthority.contains(LevelEnum.EXAMINE.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN); throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN);
} }
// 不是中心级不能选择部门 // 不是中心级不能选择部门
...@@ -581,8 +589,10 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -581,8 +589,10 @@ public class StatisticsServiceImpl implements StatisticsService {
@Override @Override
public List<ProjectStatisticsByMonth> getProjectStatistics(Integer userId, Integer deptId, Integer year, Integer projectId) { public List<ProjectStatisticsByMonth> getProjectStatistics(Integer userId, Integer deptId, Integer year, Integer projectId) {
log.info("StatisticsServiceImpl[]getProjectStatistics[]input.param" + userId + deptId + year + projectId); log.info("StatisticsServiceImpl[]getProjectStatistics[]input.param" + userId + deptId + year + projectId);
// 权限判断 // 获取角色
List<Integer> role = userRoleLevelUtils.getRole(userId); List<Integer> role = userRoleLevelUtils.getRole(userId);
// 获取权限
List<String> userAuthority = this.getUserAuthority(userId);
if (!role.contains(ManagerEnum.IS_CENTRE_DIRECTOR.getCode())) { if (!role.contains(ManagerEnum.IS_CENTRE_DIRECTOR.getCode())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.NO_AUTHORITY); throw new BaseCustomException(BASE_RESP_CODE_ENUM.NO_AUTHORITY);
} }
...@@ -637,14 +647,14 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -637,14 +647,14 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
//获取一个月应上班日期,如果是当月,时间截至到当天 //获取一个月应上班日期,如果是当月,时间截至到当天
public List<Date> currentMonthWorkDays(Date date) { public List<Date> currentMonthWorkDays(Date date, boolean toToday) {
log.info("StatisticsServiceImpl[]currentMonthWorkDays[]input.method"); log.info("StatisticsServiceImpl[]currentMonthWorkDays[]input.method");
// 时间为本月,起始时间为参数时间当月第一天,截至时间为当天。否则,截至时间为当月最后一天 // 时间为本月,起始时间为参数时间当月第一天,截至时间为当天。否则,截至时间为当月最后一天
Date startDate = DateUtil.getFirstDayOfMonth(date); Date startDate = DateUtil.getFirstDayOfMonth(date);
Date endDate = null; Date endDate = null;
// 当前时间 // 当前时间
Date now = new Date(); Date now = new Date();
if (DateUtil.getYear(date) == DateUtil.getYear(now) && DateUtil.getMonth(date) == DateUtil.getMonth(now)) { if (DateUtil.getYear(date) == DateUtil.getYear(now) && DateUtil.getMonth(date) == DateUtil.getMonth(now) && toToday) {
endDate = DateUtil.getStartOfDay(now); endDate = DateUtil.getStartOfDay(now);
} else { } else {
endDate = DateUtil.getLastDayOfMonth(date); endDate = DateUtil.getLastDayOfMonth(date);
...@@ -743,4 +753,17 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -743,4 +753,17 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
} }
} }
// 获取用户权限
public List<String> getUserAuthority(Integer userId) {
// 获取用户角色
List<Integer> role = UserRoleLevelUtils.getRole(userId);
// 获取角色对应权限id
List<Integer> list = UserRoleLevelUtils.getlevelIds(role);
// 获取权限对象
List<WorkLevel> workLevels = UserRoleLevelUtils.getlevelByIds(list);
// 获取权限名
List<String> collect = workLevels.stream().map(WorkLevel::getName).collect(Collectors.toList());
return collect;
}
} }
...@@ -480,10 +480,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -480,10 +480,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL); throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
} }
isManager(reviewerId); isManager(reviewerId);
Integer level = workUserService.getById(reviewerId).getLevel();
if (level == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN);
}
int i = workTimeOrderMapper.updateStatusById(reviewerId, id, reason); int i = workTimeOrderMapper.updateStatusById(reviewerId, id, reason);
if (i == 0) { if (i == 0) {
......
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