|
|
@@ -6,18 +6,24 @@ import cn.hutool.core.util.ObjUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotattachment.vo.IotAttachmentSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojectinfo.vo.IotProjectInfoPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotattachment.IotAttachmentDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojectinfo.IotProjectInfoDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotattachment.IotAttachmentMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotprojectinfo.IotProjectInfoMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotprojecttask.IotProjectTaskMapper;
|
|
|
+import cn.iocoder.yudao.module.pms.enums.AttachmentCategoryEnum;
|
|
|
+import cn.iocoder.yudao.module.pms.enums.AttachmentTypeEnum;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotprojectinfo.IotProjectInfoService;
|
|
|
import cn.iocoder.yudao.module.supplier.service.product.SupplierService;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -53,6 +59,8 @@ public class IotProjectTaskServiceImpl implements IotProjectTaskService {
|
|
|
private IotProjectInfoMapper iotProjectInfoMapper;
|
|
|
@Resource
|
|
|
private DeptMapper deptMapper;
|
|
|
+ @Resource
|
|
|
+ private IotAttachmentMapper attachmentMapper;
|
|
|
|
|
|
@Override
|
|
|
public Long createIotProjectTask(IotProjectTaskSaveReqVO createReqVO) {
|
|
|
@@ -132,7 +140,7 @@ public class IotProjectTaskServiceImpl implements IotProjectTaskService {
|
|
|
List<Long> deletedTaskIds = new ArrayList<>();
|
|
|
// 本次保存中包含的任务id集合
|
|
|
List<Long> currentTaskIds = new ArrayList<>();
|
|
|
- for (IotProjectTaskSaveReqVO saveReqVO:list) {
|
|
|
+ for (IotProjectTaskSaveReqVO saveReqVO : list) {
|
|
|
IotProjectTaskDO updateObj = BeanUtils.toBean(saveReqVO, IotProjectTaskDO.class);
|
|
|
// 校验施工区域 下拉列表数据字典 是否包含在 已有的数据字典值集合中
|
|
|
// 如果不包含 新增数据字典值
|
|
|
@@ -155,6 +163,35 @@ public class IotProjectTaskServiceImpl implements IotProjectTaskService {
|
|
|
// 非平台井 设置 platformWell = 0 兼容 之前是平台井然后再取消选中的情况
|
|
|
updateObj.setPlatformGroup(uuid);
|
|
|
}
|
|
|
+ // 瑞鹰 上传多种类型的附件
|
|
|
+ List<IotAttachmentSaveReqVO> attachmentsSaveReqVOS = saveReqVO.getAttachments();
|
|
|
+ List<IotAttachmentDO> attachmentDOS = new ArrayList<>();
|
|
|
+ if (CollUtil.isNotEmpty(attachmentsSaveReqVOS)) {
|
|
|
+ attachmentsSaveReqVOS.forEach(att -> {
|
|
|
+ IotAttachmentDO attachment = new IotAttachmentDO();
|
|
|
+ attachment.setBizId(updateObj.getId());
|
|
|
+ attachment.setCategory(AttachmentCategoryEnum.DAILY_REPORT.getCode());
|
|
|
+ // 瑞鹰任务附件 工程设计 地质设计 完井报告
|
|
|
+ attachment.setType(att.getType());
|
|
|
+ attachment.setFilePath(att.getFilePath());
|
|
|
+ attachment.setFileSize(att.getFileSize());
|
|
|
+ attachment.setFilename(att.getFilename());
|
|
|
+ attachment.setFileType(att.getFileType());
|
|
|
+ attachment.setRemark(att.getRemark());
|
|
|
+ attachmentDOS.add(attachment);
|
|
|
+ });
|
|
|
+ // 先删除已有数据再新增
|
|
|
+ if (CollUtil.isNotEmpty(attachmentDOS)) {
|
|
|
+ List<String> types = Arrays.asList(AttachmentTypeEnum.CONSTRUCTION_DESIGN.getCode(),
|
|
|
+ AttachmentTypeEnum.GEOLOGICAL_DESIGN.getCode(), AttachmentTypeEnum.COMPLETION_REPORT.getCode());
|
|
|
+ LambdaQueryWrapper<IotAttachmentDO> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(IotAttachmentDO::getCategory, AttachmentCategoryEnum.DAILY_REPORT.getCode())
|
|
|
+ .eq(IotAttachmentDO::getBizId, updateObj.getId())
|
|
|
+ .in(IotAttachmentDO::getType, types);
|
|
|
+ int count = attachmentMapper.delete(wrapper);
|
|
|
+ attachmentMapper.insertBatch(attachmentDOS);
|
|
|
+ }
|
|
|
+ }
|
|
|
taskDOS.add(updateObj);
|
|
|
}
|
|
|
if (ObjUtil.isNotEmpty(saveReqVO.getId())) {
|