|
@@ -78,8 +78,7 @@ import java.util.stream.Stream;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
|
-import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_PROJECT_TASK_NOT_EXISTS;
|
|
|
|
|
-import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_RD_DAILY_REPORT_NOT_EXISTS;
|
|
|
|
|
|
|
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.*;
|
|
|
import static cn.iocoder.yudao.module.pms.framework.config.MultiThreadConfiguration.PMS_THREAD_POOL_TASK_EXECUTOR;
|
|
import static cn.iocoder.yudao.module.pms.framework.config.MultiThreadConfiguration.PMS_THREAD_POOL_TASK_EXECUTOR;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -126,6 +125,8 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Long createIotRdDailyReport(IotRdDailyReportSaveReqVO createReqVO) {
|
|
public Long createIotRdDailyReport(IotRdDailyReportSaveReqVO createReqVO) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 插入
|
|
// 插入
|
|
|
IotRdDailyReportDO iotRdDailyReport = BeanUtils.toBean(createReqVO, IotRdDailyReportDO.class);
|
|
IotRdDailyReportDO iotRdDailyReport = BeanUtils.toBean(createReqVO, IotRdDailyReportDO.class);
|
|
|
// 如果没有传递 deptId 则默认使用当前登录人的 部门
|
|
// 如果没有传递 deptId 则默认使用当前登录人的 部门
|
|
@@ -143,6 +144,17 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
if (ObjUtil.isNotEmpty(dept)) {
|
|
if (ObjUtil.isNotEmpty(dept)) {
|
|
|
String todayDateStr = LocalDateTimeUtil.format(tempDateTime, DatePattern.NORM_DATE_PATTERN);
|
|
String todayDateStr = LocalDateTimeUtil.format(tempDateTime, DatePattern.NORM_DATE_PATTERN);
|
|
|
iotRdDailyReport.setReportName(dept.getName() + "/" + todayDateStr + "日报");
|
|
iotRdDailyReport.setReportName(dept.getName() + "/" + todayDateStr + "日报");
|
|
|
|
|
+
|
|
|
|
|
+ // 唯一性校验 每个施工队伍 每天只能有1份无工作量日报
|
|
|
|
|
+ if (ObjUtil.isEmpty(createReqVO.getProjectId()) || ObjUtil.isEmpty(createReqVO.getTaskId())) {
|
|
|
|
|
+ // 查询瑞都日报列表中 当前施工队伍 当前日期todayDateStr 是否存在记录
|
|
|
|
|
+ IotRdDailyReportDO existedReport = iotRdDailyReportMapper.selectExistReport(createReqVO.getDeptId(), null, todayDateStr);
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(existedReport) && ObjUtil.isEmpty(existedReport.getProjectId())
|
|
|
|
|
+ && ObjUtil.isEmpty(existedReport.getTaskId()) ) {
|
|
|
|
|
+ // 施工队伍 指定日期 已经存在了无工作量的日报
|
|
|
|
|
+ throw exception(IOT_RD_NO_WORK_DAILY_REPORT_EXISTS);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 临时新建的日报 审批状态 默认为 审批通过 status 赋值为1 填写完成
|
|
// 临时新建的日报 审批状态 默认为 审批通过 status 赋值为1 填写完成
|