Commit f5961ece by 林冲

判断补日报的权限

1 parent 5938dd5c
...@@ -504,17 +504,13 @@ public class StaffSalaryAppealApplyRecordService { ...@@ -504,17 +504,13 @@ public class StaffSalaryAppealApplyRecordService {
} }
private void setAppealAvailability(StaffSalaryAppealSummaryDTO dto, StaffSalaryAppealSummaryDTO result, String appealMonth) { private void setAppealAvailability(StaffSalaryAppealSummaryDTO dto, StaffSalaryAppealSummaryDTO result, String appealMonth) {
if (dto.getIsSuper() != null && dto.getIsSuper() || Objects.equals(dto.getLoginRole(), 3)) {
result.setAttendanceAppealable(false);
result.setPadAppealable(false);
result.setDailyReportable(false);
return;
}
// 获取上个月月份字符串 // 获取上个月月份字符串
String lastMonth = DateUtils.getLastMonthString(new Date()); String lastMonth = DateUtils.getLastMonthString(new Date());
// 判断appealMonth是否等于上个月 // 判断appealMonth是否等于上个月
boolean isLastMonth = Objects.equals(appealMonth, lastMonth); boolean isLastMonth = Objects.equals(appealMonth, lastMonth);
// 判断是否为驻店人员(loginRole=5)
boolean isStoreStaff = Objects.equals(dto.getLoginRole(), 5);
// 获取T3时间配置(考勤申诉周期) // 获取T3时间配置(考勤申诉周期)
PerformanceTimeCycleDTO t3Cycle = PerformanceTimeCycleDTO t3Cycle =
...@@ -524,10 +520,10 @@ public class StaffSalaryAppealApplyRecordService { ...@@ -524,10 +520,10 @@ public class StaffSalaryAppealApplyRecordService {
Date now = new Date(); Date now = new Date();
inT3Period = !now.before(t3Cycle.getStartDate()) && !now.after(t3Cycle.getEndDate()); inT3Period = !now.before(t3Cycle.getStartDate()) && !now.after(t3Cycle.getEndDate());
} }
// 考勤申诉:只允许在T3周期内申诉上个月的 // 考勤申诉:只允许驻店人员在T3周期内申诉上个月的
result.setAttendanceAppealable(isLastMonth && inT3Period); result.setAttendanceAppealable(isStoreStaff && isLastMonth && inT3Period);
// 平板申诉:只允许在T3周期内申诉上个月的 // 平板申诉:只允许驻店人员在T3周期内申诉上个月的
result.setPadAppealable(isLastMonth && inT3Period); result.setPadAppealable(isStoreStaff && isLastMonth && inT3Period);
// 获取T1-T5时间配置(补日报周期) // 获取T1-T5时间配置(补日报周期)
boolean inT1ToT5Period = false; boolean inT1ToT5Period = false;
...@@ -681,30 +677,24 @@ public class StaffSalaryAppealApplyRecordService { ...@@ -681,30 +677,24 @@ public class StaffSalaryAppealApplyRecordService {
return false; return false;
} }
// 2. 超级管理员和角色3不允许补填日报
if (dto.getIsSuper() != null && dto.getIsSuper() || Objects.equals(dto.getLoginRole(), 3)) {
log.info("超级管理员或角色3不允许补填日报");
return false;
}
try { try {
// 3. 解析补填日期,获取所属月份 yyyy-MM // 2. 解析补填日期,获取所属月份 yyyy-MM
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date fillDate = sdf.parse(dto.getFillDate()); Date fillDate = sdf.parse(dto.getFillDate());
SimpleDateFormat monthFormat = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat monthFormat = new SimpleDateFormat("yyyy-MM");
String fillMonth = monthFormat.format(fillDate); String fillMonth = monthFormat.format(fillDate);
// 4. 获取上个月月份字符串 // 3. 获取上个月月份字符串
String lastMonth = DateUtils.getLastMonthString(new Date()); String lastMonth = DateUtils.getLastMonthString(new Date());
// 5. 判断fillMonth是否等于上个月 // 4. 判断fillMonth是否等于上个月
boolean isLastMonth = Objects.equals(fillMonth, lastMonth); boolean isLastMonth = Objects.equals(fillMonth, lastMonth);
if (!isLastMonth) { if (!isLastMonth) {
log.info("补填日期{}不是上个月,不允许补填", dto.getFillDate()); log.info("补填日期{}不是上个月,不允许补填", dto.getFillDate());
return false; return false;
} }
// 6. 检查是否在T1到T5的任意一个周期内 // 5. 检查是否在T1到T5的任意一个周期内
String[] tCodes = { String[] tCodes = {
PerformanceTimeCycleCodeEnum.T1.getCode(), PerformanceTimeCycleCodeEnum.T1.getCode(),
PerformanceTimeCycleCodeEnum.T2.getCode(), PerformanceTimeCycleCodeEnum.T2.getCode(),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!