|
@@ -211,6 +211,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
|
BigDecimal totalWorkTime = BigDecimal.ZERO;
|
|
|
LocalDateTime dateTime = LocalDateTime.now();
|
|
|
+ LocalDate reportDate = dateTime.toLocalDate();
|
|
|
LocalDateTime timingTime = pmWorkReport.getTimingTime();
|
|
|
LocalDateTime currentTimePlusMinutes = dateTime.plusMinutes(5);
|
|
|
String ccTo = pmWorkReport.getCcTo();
|
|
@@ -219,13 +220,13 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
|
|
|
|
List<PmWorkContent> workContents = pmWorkReport.getWorkContents();
|
|
|
if (workContents == null) {
|
|
|
- throw new BusinessException("报告内容不能为空,请检查!");
|
|
|
+ throw new BusinessException("报告内容不能为空,请检查后提交!");
|
|
|
} else {
|
|
|
for (PmWorkContent workContent : workContents) {
|
|
|
BigDecimal workTime = workContent.getWorkTime();
|
|
|
// 单个工时大于零
|
|
|
if (workTime == null) {
|
|
|
- throw new BusinessException("工时不能为空,请检查!");
|
|
|
+ throw new BusinessException("工时不能为空,请检查后提交!");
|
|
|
} else if (workTime.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
throw new BusinessException("工时必须大于零!");
|
|
|
} else if (workTime.scale() > 1) {
|
|
@@ -237,14 +238,14 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
|
String workContent1 = workContent.getWorkContent();
|
|
|
// 工作内容不允许为空或空字符串
|
|
|
if (StringUtils.isBlank(workContent1)) {
|
|
|
- throw new BusinessException("工作内容不能为空,请检查!");
|
|
|
+ throw new BusinessException("工作内容不能为空,请检查后提交!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Set<Integer> projectIds2 = new HashSet<>();
|
|
|
for (PmWorkContent workContent : pmWorkReport.getWorkContents()) {
|
|
|
if (!projectIds2.add(workContent.getProjectId())) {
|
|
|
- throw new BusinessException("存在重复项目,请检查!");
|
|
|
+ throw new BusinessException("存在重复项目,请检查后提交!");
|
|
|
}
|
|
|
}
|
|
|
for (PmWorkContent a : pmWorkReport.getWorkContents()) {
|
|
@@ -253,7 +254,15 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
|
// 判断总工时是否超过24h
|
|
|
BigDecimal maxWorkTimePerDay = BigDecimal.valueOf(24);
|
|
|
if (totalWorkTime.compareTo(maxWorkTimePerDay) >= 0) {
|
|
|
- throw new BusinessException("一天24小时都不够你用,请检查当日总工时!");
|
|
|
+ throw new BusinessException("总工时超过24小时,请检查后提交!");
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaQueryWrapper<PmWorkReport> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(PmWorkReport::getReportDate, reportDate)
|
|
|
+ .eq(PmWorkReport::getSubmitterId, userId)
|
|
|
+ .eq(PmWorkReport::getTenantId, tenantId);
|
|
|
+ if (!pmWorkReportMapper.selectList(wrapper).isEmpty()) {
|
|
|
+ throw new BusinessException("今天已提交工作报告,请勿重复提交!");
|
|
|
}
|
|
|
|
|
|
// 判断是否携带reportId,不写带则为新增报告,携带则为编辑(更新)报告
|
|
@@ -280,7 +289,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
|
newReport.setTimingTime(timingTime);
|
|
|
newReport.setReportStatus(0);
|
|
|
} else {
|
|
|
- throw new BusinessException("定时发送支持选中5分钟后的时间,请重新选择时间!");
|
|
|
+ throw new BusinessException("定时发送支持选中5分钟后的时间,请重新选择时间");
|
|
|
}
|
|
|
}
|
|
|
try {
|
|
@@ -288,7 +297,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- throw new BusinessException("已存在重复数据,一人一天一篇报告!");
|
|
|
+ throw new BusinessException("新增报告异常!请联系管理员");
|
|
|
}
|
|
|
|
|
|
// 获取报告中所有项目id
|