|
@@ -13,6 +13,7 @@ import com.management.platform.entity.vo.WorktimeItem;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.*;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
+import com.management.platform.util.MessageUtils;
|
|
|
import com.management.platform.util.WorkDayCalculateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -183,14 +184,15 @@ public class ReportController {
|
|
|
//检查当前人员账号是否停用
|
|
|
if (user.getIsActive() == 0) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("您的账号已停用,无法操作");
|
|
|
+ msg.setError(MessageUtils.message("user.AccountDeactivation"));
|
|
|
return msg;
|
|
|
}
|
|
|
List<String> targetUidList = null;
|
|
|
List<User> targetUserList = null;
|
|
|
if (projectId == null) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("项目不能为空");
|
|
|
+ //msg.setError("项目不能为空");
|
|
|
+ msg.setError(MessageUtils.message("project.emptyError"));
|
|
|
return msg;
|
|
|
}
|
|
|
if (subProjectId == null) {
|
|
@@ -282,12 +284,14 @@ public class ReportController {
|
|
|
if (!createDate[i].contains("@")) {
|
|
|
if (curP.getStatus() == 2) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("项目["+curP.getProjectName()+"]已完成。");
|
|
|
+ //msg.setError("项目["+curP.getProjectName()+"]已完成。");
|
|
|
+ msg.setError(MessageUtils.message("project.complete",curP.getProjectName()));
|
|
|
return msg;
|
|
|
}
|
|
|
if (curP.getStatus() == 3) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("项目["+curP.getProjectName()+"]已撤销。");
|
|
|
+ //msg.setError("项目["+curP.getProjectName()+"]已撤销。");
|
|
|
+ msg.setError(MessageUtils.message("project.revoke",curP.getProjectName()));
|
|
|
return msg;
|
|
|
}
|
|
|
} else {
|
|
@@ -296,12 +300,14 @@ public class ReportController {
|
|
|
for (String curDate : dateArr) {
|
|
|
if (curP.getStatus() == 2) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("项目["+curP.getProjectName()+"]已完成。");
|
|
|
+ //msg.setError("项目["+curP.getProjectName()+"]已完成。");
|
|
|
+ msg.setError(MessageUtils.message("project.complete",curP.getProjectName()));
|
|
|
return msg;
|
|
|
}
|
|
|
if (curP.getStatus() == 3) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("项目["+curP.getProjectName()+"]已撤销。");
|
|
|
+ //msg.setError("项目["+curP.getProjectName()+"]已撤销。");
|
|
|
+ msg.setError(MessageUtils.message("project.revoke",curP.getProjectName()));
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
@@ -430,7 +436,8 @@ public class ReportController {
|
|
|
}
|
|
|
if (isForbidden) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("补填日报不可早于"+dateTimeFormatter.format(targetDate)+",请联系系统管理员代填。");
|
|
|
+ //msg.setError("补填日报不可早于"+dateTimeFormatter.format(targetDate)+",请联系系统管理员代填。");
|
|
|
+ msg.setError(MessageUtils.message("profession.repairError",dateTimeFormatter.format(targetDate)));
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
@@ -475,14 +482,16 @@ public class ReportController {
|
|
|
String s = sb.toString();
|
|
|
s = s.substring(0, s.length() -1);
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("已存在填写日报: " + s+", 请重新选择日期范围");
|
|
|
+ //msg.setError("已存在填写日报: " + s+", 请重新选择日期范围");
|
|
|
+ msg.setError(MessageUtils.message("profession.repeatError",s));
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
List<LocalDate> workDaysListInRange = WorkDayCalculateUtils.getWorkDaysListInRange(startDate, endDate, comTimeType.getIncludeWeekends());
|
|
|
if (workDaysListInRange.size() == 0) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("工作日天数为0,无法提交。(批量填报会自动跳过节假日,请尝试填写日报或者重新选择日期范围)");
|
|
|
+ //msg.setError("工作日天数为0,无法提交。(批量填报会自动跳过节假日,请尝试填写日报或者重新选择日期范围)");
|
|
|
+ msg.setError(MessageUtils.message("profession.SubmitErrorByDay"));
|
|
|
return msg;
|
|
|
}
|
|
|
//获取当前填报人所在部门的自定义审核流程
|
|
@@ -661,7 +670,8 @@ public class ReportController {
|
|
|
/*后续需要加入状态*/
|
|
|
if (createDate[i] == null || projectId[i] == null) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("缺少数据");
|
|
|
+ //httpRespMsg.setError("缺少数据");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("other.MissingData"));
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
} else {
|
|
@@ -742,7 +752,8 @@ public class ReportController {
|
|
|
/*后续需要加入状态*/
|
|
|
if (createDate[i] == null || projectId[i] == null) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("缺少数据");
|
|
|
+ //httpRespMsg.setError("缺少数据");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("other.MissingData"));
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
}
|
|
@@ -752,25 +763,29 @@ public class ReportController {
|
|
|
} catch (NullPointerException e) {
|
|
|
e.printStackTrace();
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("验证失败");
|
|
|
+ //httpRespMsg.setError("验证失败");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("access.verificationError"));
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
//校验工作时长
|
|
|
for (Report report : reportList) {
|
|
|
if (report.getWorkingTime() == null || report.getWorkingTime() <= 0.0) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("请填写工作时长");
|
|
|
+ //httpRespMsg.setError("请填写工作时长");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("profession.duration"));
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
if (report.getIsOvertime() != null && report.getIsOvertime() == 1) {
|
|
|
if (report.getOvertimeHours() <= 0) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("加班时长必须大于0");
|
|
|
+ //httpRespMsg.setError("加班时长必须大于0");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("profession.workDurationError"));
|
|
|
return httpRespMsg;
|
|
|
} else if (report.getOvertimeHours() > report.getWorkingTime()) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("加班时长("+report.getOvertimeHours()+"h)不能超过工作时长("+report.getWorkingTime()+"h)");
|
|
|
+ //httpRespMsg.setError("加班时长("+report.getOvertimeHours()+"h)不能超过工作时长("+report.getWorkingTime()+"h)");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("profession.OvertimeHoursError",report.getOvertimeHours(),report.getWorkingTime()));
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
}
|
|
@@ -786,7 +801,8 @@ public class ReportController {
|
|
|
|
|
|
if (dailyWorktime > comTimeType.getAllday()) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
|
+ //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("profession.MaxReportTimeError",comTimeType.getAllday()));
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
}
|
|
@@ -808,7 +824,8 @@ public class ReportController {
|
|
|
//数据库中已经填报过的工时
|
|
|
if (dailyWorktime > comTimeType.getMaxReportTime()) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getMaxReportTime()+"小时");
|
|
|
+ //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getMaxReportTime()+"小时");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("profession.MaxReportTimeError",comTimeType.getMaxReportTime()));
|
|
|
return httpRespMsg;
|
|
|
} else {
|
|
|
//查找数据库中可能已有老的记录
|
|
@@ -821,7 +838,8 @@ public class ReportController {
|
|
|
dailyWorktime += existingWorktime;
|
|
|
if (dailyWorktime > comTimeType.getMaxReportTime()) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getMaxReportTime()+"小时");
|
|
|
+ //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getMaxReportTime()+"小时");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("profession.MaxReportTimeError",comTimeType.getMaxReportTime()));
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
}
|
|
@@ -884,7 +902,8 @@ public class ReportController {
|
|
|
//超支了,不能填报
|
|
|
// String name = projectList.stream().filter(p->p.getId().equals(item.getProjectId())).findFirst().get().getProjectName();
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("项目["+name+"]的["+item.getBaseName()+"]预算不足,请联系管理人员下拨预算");
|
|
|
+ //msg.setError("项目["+name+"]的["+item.getBaseName()+"]预算不足,请联系管理人员下拨预算");
|
|
|
+ msg.setError(MessageUtils.message("project.InsufficientBudget",name,item.getBaseName()));
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
@@ -933,7 +952,8 @@ public class ReportController {
|
|
|
double sum = allReportList.stream().filter(re -> re.getCreateDate().isEqual(date)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
if (sum > allday) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("无法提交:"+date.format(dtf)+"日合计工作时长为" + sum+"h, 超过"+allday+"h");
|
|
|
+ //msg.setError("无法提交:"+date.format(dtf)+"日合计工作时长为" + sum+"h, 超过"+allday+"h");
|
|
|
+ msg.setError(MessageUtils.message("profession.workTimeError",date.format(dtf),sum,allday));
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
@@ -1208,7 +1228,8 @@ public class ReportController {
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
if (token == null) {
|
|
|
//
|
|
|
- msg.setError("请求非法");
|
|
|
+ //msg.setError("请求非法");
|
|
|
+ msg.setError(MessageUtils.message("request.illegal"));
|
|
|
System.err.println("==有非法请求==="+startDate);
|
|
|
} else {
|
|
|
User byId = userService.getById(token);
|
|
@@ -1217,9 +1238,11 @@ public class ReportController {
|
|
|
now = now.plusMonths(1);
|
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
if (startDate.compareTo("2020-01-01") < 0 || endDate.compareTo(dtf.format(now)) > 0) {
|
|
|
- msg.setError("日期不得早于2020-01-01或者超过当前一个月");
|
|
|
+ //msg.setError("日期不得早于2020-01-01或者超过当前一个月");
|
|
|
+ msg.setError(MessageUtils.message("date.dateEarly"));
|
|
|
} else if (startDate.compareTo(endDate) > 0) {
|
|
|
- msg.setError("开始日期不能大于结束日期");
|
|
|
+ //msg.setError("开始日期不能大于结束日期");
|
|
|
+ msg.setError(MessageUtils.message("date.startThanEnd"));
|
|
|
} else {
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate localStartDate = LocalDate.parse(startDate, dateTimeFormatter);
|
|
@@ -1228,7 +1251,8 @@ public class ReportController {
|
|
|
//时间间隔不得超过365天
|
|
|
long until = localStartDate.until(localEndDate, ChronoUnit.DAYS);
|
|
|
if (until > 365) {
|
|
|
- msg.setError("日期间隔不得超过365天");
|
|
|
+ //msg.setError("日期间隔不得超过365天");
|
|
|
+ msg.setError(MessageUtils.message("date.dateThan365"));
|
|
|
} else {
|
|
|
msg.data = WorkDayCalculateUtils.getWorkDaysCountInRange(startDate, endDate, timeType.getIncludeWeekends());
|
|
|
}
|