|
@@ -19,8 +19,10 @@ import cn.iocoder.yudao.module.pms.dal.mysql.iotdevicerunlog.IotDeviceRunLogMapp
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotprojecttask.IotProjectTaskMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotrhdailyreport.IotRhDailyReportMapper;
|
|
|
-import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
|
|
+import cn.iocoder.yudao.module.pms.enums.common.FailureAuditStatusEnum;
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO;
|
|
|
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
|
|
import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
|
|
|
import com.google.gson.Gson;
|
|
@@ -34,15 +36,11 @@ import java.lang.reflect.Type;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
-import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_PROJECT_TASK_NOT_EXISTS;
|
|
|
-import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_RH_DAILY_REPORT_NOT_EXISTS;
|
|
|
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.*;
|
|
|
|
|
|
/**
|
|
|
* 瑞恒日报 Service 实现类
|
|
@@ -67,166 +65,209 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
private IotOpeationFillMapper iotOpeationFillMapper;
|
|
|
@Resource
|
|
|
private IotDeviceRunLogMapper iotDeviceRunLogMapper;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private DeptService deptService;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Long createIotRhDailyReport(IotRhDailyReportSaveReqVO createReqVO) {
|
|
|
// 插入
|
|
|
IotRhDailyReportDO iotRhDailyReport = BeanUtils.toBean(createReqVO, IotRhDailyReportDO.class);
|
|
|
+ LocalDateTime reportDate = createReqVO.getFillOrderCreateTime();
|
|
|
+ if (ObjUtil.isEmpty(reportDate)) {
|
|
|
+ throw exception(IOT_RH_DAILY_REPORT_NO_DATE);
|
|
|
+ }
|
|
|
+ if (ObjUtil.isEmpty(createReqVO.getDeptId())) {
|
|
|
+ throw exception(IOT_RH_DAILY_REPORT_NO_DEPT);
|
|
|
+ }
|
|
|
// 根据日报的 施工队伍 deptId 查询队伍所在的 项目 任务
|
|
|
// 根据日报的施工状态 更新 对应任务的 状态
|
|
|
- if (ObjUtil.isNotEmpty(createReqVO.getDeptId())) {
|
|
|
- Long taskId = Long.MIN_VALUE;
|
|
|
- Set<Long> deviceIds = new HashSet<>();
|
|
|
- IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
|
|
|
- reqVO.setDeptId(createReqVO.getDeptId());
|
|
|
- // 查询包含当前日报施工队伍的任务
|
|
|
- List<IotProjectTaskDO> tasks = iotProjectTaskMapper.selectList(reqVO);
|
|
|
- if (CollUtil.isNotEmpty(tasks)) {
|
|
|
- IotProjectTaskDO task = tasks.get(0);
|
|
|
- // 暂时只考虑1个施工队伍只属于1个任务
|
|
|
- iotRhDailyReport.setProjectId(task.getProjectId());
|
|
|
- iotRhDailyReport.setTaskId(task.getId());
|
|
|
- taskId = task.getId();
|
|
|
- // 根据日报状态 查询 日报所属任务的状态
|
|
|
- if (ObjUtil.isNotEmpty(createReqVO.getConstructionStatus())) {
|
|
|
- task.setStatus(createReqVO.getConstructionStatus());
|
|
|
- // 更新任务状态
|
|
|
- iotProjectTaskMapper.updateById(task);
|
|
|
- }
|
|
|
- // 查询任务的设备列表
|
|
|
- deviceIds = task.getDeviceIds();
|
|
|
+ Long taskId = Long.MIN_VALUE;
|
|
|
+ Set<Long> deviceIds = new HashSet<>();
|
|
|
+ IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
|
|
|
+ reqVO.setDeptId(createReqVO.getDeptId());
|
|
|
+ // 查询包含当前日报施工队伍的任务
|
|
|
+ List<IotProjectTaskDO> tasks = iotProjectTaskMapper.selectList(reqVO);
|
|
|
+ if (CollUtil.isNotEmpty(tasks)) {
|
|
|
+ IotProjectTaskDO task = tasks.get(0);
|
|
|
+ // 暂时只考虑1个施工队伍只属于1个任务
|
|
|
+ iotRhDailyReport.setProjectId(task.getProjectId());
|
|
|
+ iotRhDailyReport.setTaskId(task.getId());
|
|
|
+ taskId = task.getId();
|
|
|
+ // 根据日报状态 查询 日报所属任务的状态
|
|
|
+ if (ObjUtil.isNotEmpty(createReqVO.getConstructionStatus())) {
|
|
|
+ task.setStatus(createReqVO.getConstructionStatus());
|
|
|
+ // 更新任务状态
|
|
|
+ iotProjectTaskMapper.updateById(task);
|
|
|
}
|
|
|
+ // 查询任务的设备列表
|
|
|
+ deviceIds = task.getDeviceIds();
|
|
|
+ } else {
|
|
|
+ // 当前队伍没有关联任务 不生成日报
|
|
|
+ throw exception(IOT_PROJECT_TASK_NOT_RELATED);
|
|
|
+ }
|
|
|
|
|
|
- // 查询当前任务下关联的所有设备 查询这些设备的当日注气量 进而计算累计注气量
|
|
|
- IotDevicePageReqVO deptDeviceReqVO = new IotDevicePageReqVO();
|
|
|
- deptDeviceReqVO.setDeptId(createReqVO.getDeptId());
|
|
|
- List<IotDeviceDO> deptDevices = iotDeviceMapper.selectList(deptDeviceReqVO);
|
|
|
- Set<String> deviceCodes = new HashSet<>();
|
|
|
- if (CollUtil.isNotEmpty(deptDevices)) {
|
|
|
- deptDevices.forEach(device -> {
|
|
|
- deviceCodes.add(device.getDeviceCode());
|
|
|
+ // 查询当前任务下关联的所有设备 查询这些设备的当日注气量 进而计算累计注气量
|
|
|
+ IotDevicePageReqVO deptDeviceReqVO = new IotDevicePageReqVO();
|
|
|
+ deptDeviceReqVO.setDeptId(createReqVO.getDeptId());
|
|
|
+ List<IotDeviceDO> deptDevices = iotDeviceMapper.selectList(deptDeviceReqVO);
|
|
|
+ Set<String> deviceCodes = new HashSet<>();
|
|
|
+ if (CollUtil.isNotEmpty(deptDevices)) {
|
|
|
+ deptDevices.forEach(device -> {
|
|
|
+ deviceCodes.add(device.getDeviceCode());
|
|
|
+ });
|
|
|
+ // 查询当前小队在运行记录填报结果表中 生产日报虚拟设备id 查询当年的日报
|
|
|
+ // 然后根据 虚拟设备id 在 rq_iot_device_run_log 表中查询 日报中填写的 当日注气量
|
|
|
+ List<IotOpeationFillDO> reports = iotOpeationFillMapper.selectReportsByYear(createReqVO.getDeptId(), LocalDateTime.now().getYear());
|
|
|
+ Set<Long> reportDeviceIds = new HashSet<>();
|
|
|
+ if (CollUtil.isNotEmpty(reports)) {
|
|
|
+ reports.forEach(report -> {
|
|
|
+ reportDeviceIds.add(report.getDeviceId());
|
|
|
});
|
|
|
- // 查询当前小队在运行记录填报结果表中 生产日报虚拟设备id 查询当年的日报
|
|
|
- // 然后根据 虚拟设备id 在 rq_iot_device_run_log 表中查询 日报中填写的 当日注气量
|
|
|
- List<IotOpeationFillDO> reports = iotOpeationFillMapper.selectReportsByYear(createReqVO.getDeptId(), LocalDateTime.now().getYear());
|
|
|
- Set<Long> reportDeviceIds = new HashSet<>();
|
|
|
- if (CollUtil.isNotEmpty(reports)) {
|
|
|
- reports.forEach(report -> {
|
|
|
- reportDeviceIds.add(report.getDeviceId());
|
|
|
- });
|
|
|
- // 累计注气量
|
|
|
- BigDecimal currentYearFillContentSum = iotDeviceRunLogMapper.selectCurrentYearFillContentSum(createReqVO.getDeptId(), reportDeviceIds);
|
|
|
- iotRhDailyReport.setTotalGasInjection(currentYearFillContentSum);
|
|
|
- }
|
|
|
+ // 累计注气量
|
|
|
+ BigDecimal currentYearFillContentSum = iotDeviceRunLogMapper.selectCurrentYearFillContentSum(createReqVO.getDeptId(), reportDeviceIds);
|
|
|
+ iotRhDailyReport.setTotalGasInjection(currentYearFillContentSum);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 找到当前小队下的 电驱增压机 分类下设备的产能 计算 运行时效
|
|
|
- DictTypeDO dictType = dictTypeService.getDictType("rq_iot_charger_device_category");
|
|
|
- AtomicReference<BigDecimal> capacity = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
- if (ObjUtil.isNotEmpty(dictType)) {
|
|
|
- if (StrUtil.isNotBlank(dictType.getRemark())) {
|
|
|
- IotDevicePageReqVO capacityReqVO = new IotDevicePageReqVO();
|
|
|
- capacityReqVO.setDeptId(createReqVO.getDeptId());
|
|
|
- capacityReqVO.setAssetClass(Long.valueOf(dictType.getRemark()));
|
|
|
- List<IotDeviceDO> capacityDevices = iotDeviceMapper.selectList(capacityReqVO);
|
|
|
- if (CollUtil.isNotEmpty(capacityDevices)) {
|
|
|
- // 解析每个设备的 扩展属性 找出 已经设置 了产能的设备并提取值
|
|
|
- capacityDevices.forEach(device -> {
|
|
|
- if (StrUtil.isNotBlank(device.getTemplateJson())) {
|
|
|
- Gson gson = new Gson();
|
|
|
- Type listType = new TypeToken<List<IotDeviceProperty>>(){}.getType();
|
|
|
- List<IotDeviceProperty> deviceProperties = gson.fromJson(device.getTemplateJson(), listType);
|
|
|
- if (CollUtil.isNotEmpty(deviceProperties)) {
|
|
|
- deviceProperties.forEach(property -> {
|
|
|
- if ("产能".equals(property.getName()) && StrUtil.isNotBlank(property.getValue())) {
|
|
|
- // 当前扩展属性已经维护了 产能 值
|
|
|
- capacity.set(new BigDecimal(property.getValue()));
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ BigDecimal capacity = queryCapacity(createReqVO.getDeptId());
|
|
|
+ // 计算运行时效 当日注气量/产能
|
|
|
+ if (ObjUtil.isNotEmpty(createReqVO.getDailyGasInjection()) && (capacity.compareTo(BigDecimal.ZERO)>0)) {
|
|
|
+ // 将当日注气量单位 换算成 万方
|
|
|
+ // 将当日注气量单位由"方"换算成"万方"
|
|
|
+ iotRhDailyReport.setTransitTime(createReqVO.getDailyGasInjection().divide(capacity, 4, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询当前日报所属任务关联的设备 更新设备状态
|
|
|
+ /* if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
+ // 查询当前任务下关联的所有设备
|
|
|
+ IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
|
|
|
+ // deviceReqVO.setDeptId(createReqVO.getDeptId());
|
|
|
+ deviceReqVO.setDeviceIds(new ArrayList<>(deviceIds));
|
|
|
+ List<IotDeviceDO> devices = iotDeviceMapper.selectList(deviceReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(devices)) {
|
|
|
+ AtomicReference<String> deviceNewStatus = new AtomicReference<>(StrUtil.EMPTY);
|
|
|
+ // 日报状态 与 设备状态 对应关系
|
|
|
+ // 动迁 施工 现场待命/驻地待命(待命) pms_device_status
|
|
|
+ List<DictDataDO> dictDatas = dictDataService.getDictDataListByDictType("constructionStatus");
|
|
|
+ AtomicReference<String> dailyDictLabel = new AtomicReference<>(StrUtil.EMPTY);
|
|
|
+ List<DictDataDO> deviceDictDatas = dictDataService.getDictDataListByDictType("pms_device_status");
|
|
|
+ if (CollUtil.isNotEmpty(dictDatas)) {
|
|
|
+ dictDatas.forEach(data -> {
|
|
|
+ if (createReqVO.getConstructionStatus().equals(Integer.valueOf(data.getValue()))) {
|
|
|
+ dailyDictLabel.set(data.getLabel());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (CollUtil.isNotEmpty(deviceDictDatas)) {
|
|
|
+ deviceDictDatas.forEach(data -> {
|
|
|
+ if (dailyDictLabel.equals(data.getLabel())) {
|
|
|
+ // 动迁 施工
|
|
|
+ deviceNewStatus.set(data.getValue());
|
|
|
+ }
|
|
|
+ if (data.getLabel().contains(dailyDictLabel.get())) {
|
|
|
+ // 现场待命/驻地待命(待命)
|
|
|
+ deviceNewStatus.set(data.getValue());
|
|
|
}
|
|
|
});
|
|
|
- // 计算运行时效 当日注气量/产能
|
|
|
- if (ObjUtil.isNotEmpty(createReqVO.getDailyGasInjection()) && (capacity.get().compareTo(BigDecimal.ZERO)>0)) {
|
|
|
- // 将当日注气量单位 换算成 万方
|
|
|
- // 将当日注气量单位由"方"换算成"万方"
|
|
|
- /* BigDecimal dailyGasInjectionInTenThousand = createReqVO.getDailyGasInjection()
|
|
|
- .divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP); */
|
|
|
- iotRhDailyReport.setTransitTime(createReqVO.getDailyGasInjection().divide(capacity.get(), 4, RoundingMode.HALF_UP));
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
+ // 批量更新设备状态
|
|
|
+ devices.forEach(device -> {
|
|
|
+ device.setDeviceStatus(deviceNewStatus.get());
|
|
|
+ });
|
|
|
+ iotDeviceMapper.updateBatch(devices);
|
|
|
}
|
|
|
+ } */
|
|
|
|
|
|
- // todo 根据当日注气量 计算累计注气量
|
|
|
+ // 当天如果已经有此小队的记录 新增 当天如果没有此小队的日报记录 修改
|
|
|
+ // deptId - taskId - createTime(yyyy-MM-dd) 确定唯一一条记录 不能使用 LocalDateTime.now() 来查询,应该使用 运行记录工单的创建日期查询
|
|
|
+ IotRhDailyReportDO existReport = iotRhDailyReportMapper.selectExistReport(createReqVO.getDeptId(), taskId, reportDate);
|
|
|
+ if (ObjUtil.isEmpty(existReport)) {
|
|
|
+ // 今天下午4点
|
|
|
+ LocalDateTime today4pm = reportDate.withHour(16).withMinute(0).withSecond(0).withNano(0);
|
|
|
+ // 昨天下午4点
|
|
|
+ LocalDateTime yesterday4pm = today4pm.minusDays(1);
|
|
|
+ iotRhDailyReport.setConstructionStartDate(yesterday4pm);
|
|
|
+ iotRhDailyReport.setConstructionEndDate(today4pm);
|
|
|
+ iotRhDailyReport.setCreateTime(reportDate);
|
|
|
+ iotRhDailyReport.setUpdateTime(reportDate);
|
|
|
+ iotRhDailyReportMapper.insert(iotRhDailyReport);
|
|
|
+ } else {
|
|
|
+ // 修改现有记录
|
|
|
+ iotRhDailyReport.setId(existReport.getId());
|
|
|
+ iotRhDailyReportMapper.updateById(iotRhDailyReport);
|
|
|
+ }
|
|
|
+ // 返回
|
|
|
+ return iotRhDailyReport.getId();
|
|
|
+ }
|
|
|
|
|
|
- // 查询当前日报所属任务关联的设备 更新设备状态
|
|
|
- if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
- // 查询当前任务下关联的所有设备
|
|
|
- IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
|
|
|
- // deviceReqVO.setDeptId(createReqVO.getDeptId());
|
|
|
- deviceReqVO.setDeviceIds(new ArrayList<>(deviceIds));
|
|
|
- List<IotDeviceDO> devices = iotDeviceMapper.selectList(deviceReqVO);
|
|
|
- if (CollUtil.isNotEmpty(devices)) {
|
|
|
- AtomicReference<String> deviceNewStatus = new AtomicReference<>(StrUtil.EMPTY);
|
|
|
- // 日报状态 与 设备状态 对应关系
|
|
|
- // 动迁 施工 现场待命/驻地待命(待命) pms_device_status
|
|
|
- List<DictDataDO> dictDatas = dictDataService.getDictDataListByDictType("constructionStatus");
|
|
|
- AtomicReference<String> dailyDictLabel = new AtomicReference<>(StrUtil.EMPTY);
|
|
|
- List<DictDataDO> deviceDictDatas = dictDataService.getDictDataListByDictType("pms_device_status");
|
|
|
- if (CollUtil.isNotEmpty(dictDatas)) {
|
|
|
- dictDatas.forEach(data -> {
|
|
|
- if (createReqVO.getConstructionStatus().equals(Integer.valueOf(data.getValue()))) {
|
|
|
- dailyDictLabel.set(data.getLabel());
|
|
|
+ /***
|
|
|
+ * 计算指定队伍下包含的 增压机设备的产能
|
|
|
+ */
|
|
|
+ public BigDecimal queryCapacity(Long deptId) {
|
|
|
+ // 找到当前小队下的 电驱增压机 分类下设备的产能 计算 运行时效
|
|
|
+ DictTypeDO dictType = dictTypeService.getDictType("rq_iot_charger_device_category");
|
|
|
+ AtomicReference<BigDecimal> capacity = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
+ if (ObjUtil.isNotEmpty(dictType)) {
|
|
|
+ if (StrUtil.isNotBlank(dictType.getRemark())) {
|
|
|
+ IotDevicePageReqVO capacityReqVO = new IotDevicePageReqVO();
|
|
|
+ capacityReqVO.setDeptId(deptId);
|
|
|
+ capacityReqVO.setAssetClass(Long.valueOf(dictType.getRemark()));
|
|
|
+ List<IotDeviceDO> capacityDevices = iotDeviceMapper.selectList(capacityReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(capacityDevices)) {
|
|
|
+ // 解析每个设备的 扩展属性 找出 已经设置 了产能的设备并提取值
|
|
|
+ capacityDevices.forEach(device -> {
|
|
|
+ if (StrUtil.isNotBlank(device.getTemplateJson())) {
|
|
|
+ Gson gson = new Gson();
|
|
|
+ Type listType = new TypeToken<List<IotDeviceProperty>>(){}.getType();
|
|
|
+ List<IotDeviceProperty> deviceProperties = gson.fromJson(device.getTemplateJson(), listType);
|
|
|
+ if (CollUtil.isNotEmpty(deviceProperties)) {
|
|
|
+ deviceProperties.forEach(property -> {
|
|
|
+ if ("产能".equals(property.getName()) && StrUtil.isNotBlank(property.getValue())) {
|
|
|
+ // 当前扩展属性已经维护了 产能 值
|
|
|
+ capacity.set(new BigDecimal(property.getValue()));
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
- if (CollUtil.isNotEmpty(deviceDictDatas)) {
|
|
|
- deviceDictDatas.forEach(data -> {
|
|
|
- if (dailyDictLabel.equals(data.getLabel())) {
|
|
|
- // 动迁 施工
|
|
|
- deviceNewStatus.set(data.getValue());
|
|
|
- }
|
|
|
- if (data.getLabel().contains(dailyDictLabel.get())) {
|
|
|
- // 现场待命/驻地待命(待命)
|
|
|
- deviceNewStatus.set(data.getValue());
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
- }
|
|
|
- // 批量更新设备状态
|
|
|
- devices.forEach(device -> {
|
|
|
- device.setDeviceStatus(deviceNewStatus.get());
|
|
|
});
|
|
|
- iotDeviceMapper.updateBatch(devices);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ return capacity.get();
|
|
|
+ }
|
|
|
|
|
|
- // 当天如果已经有此小队的记录 新增 当天如果没有此小队的日报记录 修改
|
|
|
- // deptId - taskId - createTime(yyyy-MM-dd) 确定唯一一条记录
|
|
|
- IotRhDailyReportDO existReport = iotRhDailyReportMapper.selectExistReport(createReqVO.getDeptId(), taskId, LocalDateTime.now());
|
|
|
- if (ObjUtil.isEmpty(existReport)) {
|
|
|
- // 设置任务时间范围 昨天下午4点到今天下午4点
|
|
|
- // 设置任务时间范围 昨天下午4点到今天下午4点
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
- // 今天下午4点
|
|
|
- LocalDateTime today4pm = now.withHour(16).withMinute(0).withSecond(0).withNano(0);
|
|
|
- // 昨天下午4点
|
|
|
- LocalDateTime yesterday4pm = today4pm.minusDays(1);
|
|
|
- iotRhDailyReport.setConstructionStartDate(yesterday4pm);
|
|
|
- iotRhDailyReport.setConstructionEndDate(today4pm);
|
|
|
|
|
|
- iotRhDailyReportMapper.insert(iotRhDailyReport);
|
|
|
- } else {
|
|
|
- // 修改现有记录
|
|
|
- iotRhDailyReport.setId(existReport.getId());
|
|
|
- iotRhDailyReportMapper.updateById(iotRhDailyReport);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageResult<IotRhDailyReportDO> dailyReportSummary(IotRhDailyReportPageReqVO pageReqVO) {
|
|
|
+ // 查询 瑞恒兴域 下所有项目部级别的部门
|
|
|
+ // 组装成 map key项目部id value项目部下包含的部门集合
|
|
|
+ Set<Long> projectDeptIds = new HashSet<>();
|
|
|
+ Map<Long, Set<Long>> projectSubDeptPair = new HashMap<>();
|
|
|
+ Map<Long, String> deptMap = new HashMap<>();
|
|
|
+ Set<Long> rhChildDeptIds = deptService.getChildDeptIdListFromCache(157l);
|
|
|
+ List<DeptDO> depts =deptService.getDeptList(rhChildDeptIds);
|
|
|
+ // 找出名称中包含 项目部 的部门
|
|
|
+ if (CollUtil.isNotEmpty(depts)) {
|
|
|
+ depts.forEach(dept -> {
|
|
|
+ if (dept.getName().contains("项目部")) {
|
|
|
+ projectDeptIds.add(dept.getId());
|
|
|
+ }
|
|
|
+ deptMap.put(dept.getId(), dept.getName());
|
|
|
+ });
|
|
|
+ // 查询每个项目部下所有子部门 小队
|
|
|
+ if (CollUtil.isNotEmpty(projectDeptIds)) {
|
|
|
+ projectDeptIds.forEach(deptId -> {
|
|
|
+ Set<Long> tempDeptIds = deptService.getChildDeptIdListFromCache(deptId);
|
|
|
+ tempDeptIds.add(deptId);
|
|
|
+ projectSubDeptPair.put(deptId, tempDeptIds);
|
|
|
+ });
|
|
|
}
|
|
|
- }
|
|
|
+ // 查询所有瑞恒日报数据
|
|
|
|
|
|
- // 返回
|
|
|
- return iotRhDailyReport.getId();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -235,6 +276,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
validateIotRhDailyReportExists(updateReqVO.getId());
|
|
|
// 更新
|
|
|
IotRhDailyReportDO updateObj = BeanUtils.toBean(updateReqVO, IotRhDailyReportDO.class);
|
|
|
+ // 编辑后 直接设置 已经 审核通过
|
|
|
+ updateObj.setAuditStatus(FailureAuditStatusEnum.APPROVE.getStatus());
|
|
|
iotRhDailyReportMapper.updateById(updateObj);
|
|
|
}
|
|
|
|
|
@@ -271,10 +314,12 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
IotRhDailyReportPageReqVO reportReqVO = new IotRhDailyReportPageReqVO();
|
|
|
reportReqVO.setTaskId(reqVO.getTaskId());
|
|
|
List<IotRhDailyReportDO> dailyReports = iotRhDailyReportMapper.selectListGrouped(reportReqVO);
|
|
|
- if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
-
|
|
|
- }
|
|
|
return dailyReports;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<IotRhDailyReportDO> relocationDays(IotRhDailyReportPageReqVO reqVO) {
|
|
|
+ return iotRhDailyReportMapper.relocationDays(reqVO);
|
|
|
+ }
|
|
|
+
|
|
|
}
|