|
|
@@ -14,6 +14,7 @@ import com.management.platform.mapper.DepartmentMapper;
|
|
|
import com.management.platform.mapper.OvertimeSettingMapper;
|
|
|
import com.management.platform.mapper.UserMapper;
|
|
|
import com.management.platform.service.OvertimeSettingService;
|
|
|
+import com.management.platform.service.SysFunctionService;
|
|
|
import com.management.platform.service.WorkOvertimeService;
|
|
|
import com.management.platform.util.ExcelUtil;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
@@ -54,6 +55,8 @@ public class WorkOvertimeController {
|
|
|
private DepartmentMapper departmentMapper;
|
|
|
@Resource
|
|
|
private OvertimeSettingMapper overtimeSettingMapper;
|
|
|
+ @Resource
|
|
|
+ private SysFunctionService sysFunctionService;
|
|
|
|
|
|
@Value(value = "${upload.path}")
|
|
|
private String path;
|
|
|
@@ -82,6 +85,28 @@ public class WorkOvertimeController {
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
|
+ //生产车间主任代工位提交加班申请,只会按照同一工位依次提交,若申请中员工id不为同一工位,则报错返回,若相同则设置为申请工位id
|
|
|
+ if (user.getRoleId() == 33) {
|
|
|
+ String[] employeeIds = workOvertime.getEmployeeIds().split(",");
|
|
|
+ Integer Workstaion = null;
|
|
|
+ for (int i = 0; i < employeeIds.length; i++) {
|
|
|
+ if (Workstaion == null) {
|
|
|
+ Workstaion = userMapper.selectById(employeeIds[i]).getDepartmentId();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if(!Workstaion.equals(userMapper.selectById(employeeIds[i]).getDepartmentId())){
|
|
|
+ msg.setError("车间主任代工位提交加班申请,所选员工需要为同一工位");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Workstaion == null) {
|
|
|
+ workOvertime.setWorkstationId(Workstaion);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ workOvertime.setWorkstationId(user.getDepartmentId());
|
|
|
+ }
|
|
|
msg.data = workOvertimeService.saveOrUpdate(workOvertime);
|
|
|
return msg;
|
|
|
}
|
|
|
@@ -102,8 +127,8 @@ public class WorkOvertimeController {
|
|
|
|
|
|
User targetUser = userMapper.selectById(token);
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", targetUser.getCompanyId()));
|
|
|
- //非管理员只能看到自己的
|
|
|
- if (!targetUser.getRoleName().equals("超级管理员") && !targetUser.getRoleName().equals("系统管理员")) {
|
|
|
+ //没有配置对应权限的非管理员只能看到自己的,
|
|
|
+ if (!targetUser.getRoleName().equals("超级管理员") && !targetUser.getRoleName().equals("系统管理员") && !sysFunctionService.hasPriviledge(targetUser.getRoleId(),"查看全部人员加班")) {
|
|
|
applicant = token;
|
|
|
}
|
|
|
// 按申请人过滤
|
|
|
@@ -180,7 +205,7 @@ public class WorkOvertimeController {
|
|
|
Company company = companyMapper.selectById(targetUser.getCompanyId());
|
|
|
|
|
|
//非管理员只能看到自己的
|
|
|
- if (!targetUser.getRoleName().equals("超级管理员") && !targetUser.getRoleName().equals("系统管理员")) {
|
|
|
+ if (!targetUser.getRoleName().equals("超级管理员") && !targetUser.getRoleName().equals("系统管理员") && !sysFunctionService.hasPriviledge(targetUser.getRoleId(),"查看全部人员加班")) {
|
|
|
applicant = token;
|
|
|
}
|
|
|
|
|
|
@@ -282,7 +307,6 @@ public class WorkOvertimeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
exportDataList.add(new ExcelUtil.OvertimeStatisticsData(date, workstationDataList));
|
|
|
}
|
|
|
}
|