This commit is contained in:
lcj
2025-08-25 20:20:43 +08:00
parent 57a39ad727
commit 508d81bedf
25 changed files with 379 additions and 172 deletions

View File

@ -84,9 +84,9 @@ public class DemoTest {
Boolean result = progressCategoryService.insertByTemplate(1906557369562726402L, matrixList, null);
}
@Test
/* @Test
void testDeptProject() {
deptService.selectProjectIdById(100L);
deptService.selectProjectIdById(1937478258803171329L);
}
}*/
}

View File

@ -122,7 +122,7 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl<BusPurchaseDocMapper,
Page<BusPurchaseDocVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
result.getRecords().forEach(v -> {
BusMrpBase byId = mrpBaseService.getById(v.getMrpBaseId());
if (byId != null){
if (byId != null) {
v.setPlanCode(byId.getPlanCode());
}
});
@ -378,6 +378,9 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl<BusPurchaseDocMapper,
throw new ServiceException("获取物资采购联系单详情失败,错误信息: " + e.getMessage());
} catch (IOException e) {
throw new ServiceException("保存PDF文件失败错误信息: " + e.getMessage());
} catch (Exception e) {
log.error("保存PDF文件失败错误信息: {}", e.getMessage());
throw new ServiceException("保存PDF文件失败系统异常");
}
}
}

View File

@ -2,13 +2,17 @@ package org.dromara.design.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
@ -18,52 +22,41 @@ import org.dromara.common.core.service.DictService;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.file.FileUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.oss.core.OssClient;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.oss.exception.OssException;
import org.dromara.common.oss.factory.OssFactory;
import org.dromara.common.utils.DocumentUtil;
import org.dromara.design.constant.DesDesignConstant;
import org.dromara.design.domain.DesCollect;
import org.dromara.design.domain.DesCollectCatalogue;
import org.dromara.design.domain.DesDrawing;
import org.dromara.design.domain.bo.DesCollectBo;
import org.dromara.design.domain.bo.DesCollectCatalogueBo;
import org.dromara.design.domain.dto.desCollect.DesCollectBatchDto;
import org.dromara.design.domain.dto.desCollect.DesCollectCatalogueWordDto;
import org.dromara.design.domain.dto.desCollect.DesCollectWordDto;
import org.dromara.design.domain.vo.DesCollectCatalogueVo;
import org.dromara.design.domain.vo.DesCollectVo;
import org.dromara.design.mapper.DesCollectMapper;
import org.dromara.design.service.IDesCollectCatalogueService;
import org.dromara.materials.constants.MatMaterialsConstant;
import org.dromara.materials.domain.MatMaterialIssue;
import org.dromara.materials.domain.MatMaterialIssueItem;
import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueWordDto;
import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemWordDto;
import org.dromara.design.service.IDesCollectService;
import org.dromara.project.service.IBusProjectService;
import org.dromara.system.domain.vo.SysOssVo;
import org.springframework.beans.BeanUtils;
import org.springframework.context.event.EventListener;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.dromara.design.domain.bo.DesCollectBo;
import org.dromara.design.domain.vo.DesCollectVo;
import org.dromara.design.domain.DesCollect;
import org.dromara.design.mapper.DesCollectMapper;
import org.dromara.design.service.IDesCollectService;
import org.springframework.transaction.annotation.Transactional;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.zip.ZipOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 收资清单Service业务层处理
@ -91,7 +84,7 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
* @return 收资清单
*/
@Override
public DesCollectVo queryById(Long id){
public DesCollectVo queryById(Long id) {
return baseMapper.selectVoById(id);
}
@ -167,7 +160,7 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(DesCollect entity){
private void validEntityBeforeSave(DesCollect entity) {
//TODO 做一些数据校验,如唯一约束
}
@ -180,7 +173,7 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
@ -191,14 +184,14 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
public Boolean batchAddOrUpdate(DesCollectBatchDto dto) {
DesCollect convert = MapstructUtils.convert(dto.getDesCollectBo(), DesCollect.class);
boolean b = super.saveOrUpdate(convert);
if(CollectionUtil.isNotEmpty(dto.getCatalogueList())){
if (CollectionUtil.isNotEmpty(dto.getCatalogueList())) {
dto.getCatalogueList().forEach(item -> {
item.setCollectId(convert.getId());
item.setProjectId(convert.getProjectId());
}
item.setCollectId(convert.getId());
item.setProjectId(convert.getProjectId());
}
);
collectCatalogueService.batchAddOrUpdate(dto.getCatalogueList(),convert.getProjectId());
collectCatalogueService.batchAddOrUpdate(dto.getCatalogueList(), convert.getProjectId());
}
return b;
}
@ -222,14 +215,15 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
@Override
public void exportWordById(Long id, HttpServletResponse response) {
DesCollect descCollect = this.getById(id);
DesCollect descCollect = this.getById(id);
if (descCollect == null) {
throw new ServiceException("数据不存在");
}
Path targetDir = Paths.get(DesDesignConstant.getDesignCollectFileUrl(descCollect));
// 如果存在目录则直接返回,不存在则生成文件并返回
if (!Files.exists(targetDir)) {
// 清理旧文件
Path targetFile = targetDir.resolve(DesDesignConstant.getDesignCollectFileName(descCollect));
// 如果文件不存在则生成
if (!Files.exists(targetFile)) {
// 清理旧目录
String baseUrl = DesDesignConstant.DESIGN_COLLECT_FILE_URL + descCollect.getId();
try {
Path dirPath = Paths.get(baseUrl);
@ -240,11 +234,12 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
log.error("文件目录:{},清理失败", baseUrl, e);
}
// 准备数据
List<DesCollectCatalogue> itemList = collectCatalogueService.list(Wrappers.
<DesCollectCatalogue>lambdaQuery().eq(DesCollectCatalogue::getCollectId, id));
DesCollectWordDto data = this.getReplacementDto(descCollect, itemList);
List<DesCollectCatalogue> itemList = collectCatalogueService.list(
Wrappers.<DesCollectCatalogue>lambdaQuery().eq(DesCollectCatalogue::getCollectId, id));
DesCollectWordDto data = this.getReplacementDto(descCollect, itemList);
// 生成文件
try (InputStream is = getClass().getClassLoader().getResourceAsStream(DesDesignConstant.DESIGN_COLLECT_TEMPLATE_PATH)) {
try (InputStream is = getClass().getClassLoader()
.getResourceAsStream(DesDesignConstant.DESIGN_COLLECT_TEMPLATE_PATH)) {
if (is == null) {
throw new ServiceException("模板文件不存在");
}
@ -256,10 +251,8 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
if (!Files.exists(targetDir)) {
Files.createDirectories(targetDir);
}
// 组合目标文件
String fileName = DesDesignConstant.getDesignCollectFileName(descCollect);
// 保存修改后的文件
try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) {
// 保存文件
try (FileOutputStream fos = new FileOutputStream(targetFile.toFile())) {
template.write(fos);
}
template.close();
@ -267,18 +260,21 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
throw new OssException("生成Word文件失败错误信息: " + e.getMessage());
}
}
// 设置响应头,返回ZIP文件
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) {
DocumentUtil.zipDirectory(targetDir, targetDir, zos);
zos.flush();
// 设置响应头,直接返回 Word 文件
String fileName = targetFile.getFileName().toString();
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8));
try (InputStream fis = Files.newInputStream(targetFile);
OutputStream os = response.getOutputStream()) {
IOUtils.copy(fis, os);
os.flush();
} catch (Exception e) {
throw new OssException("生成ZIP文件失败,错误信息: " + e.getMessage());
throw new OssException("导出Word文件失败,错误信息: " + e.getMessage());
}
}
/**
* 根据实体获取替换数据
*/
@ -300,15 +296,6 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
}
/**
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
* 正常使用只需#processEvent.flowCode=='leave1'
@ -356,12 +343,4 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
}
}

View File

@ -3,12 +3,17 @@ package org.dromara.design.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
@ -18,49 +23,45 @@ import org.dromara.common.core.service.DictService;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.file.FileUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.oss.exception.OssException;
import org.dromara.common.utils.DocumentUtil;
import org.dromara.design.constant.DesDesignConstant;
import org.dromara.design.domain.*;
import org.dromara.design.domain.bo.DesCollectFileBo;
import org.dromara.design.domain.DesExtract;
import org.dromara.design.domain.DesExtractCatalogue;
import org.dromara.design.domain.DesVolumeFile;
import org.dromara.design.domain.bo.DesExtractBo;
import org.dromara.design.domain.bo.DesExtractCatalogueBo;
import org.dromara.design.domain.dto.desCollect.DesCollectCatalogueWordDto;
import org.dromara.design.domain.dto.desCollect.DesCollectWordDto;
import org.dromara.design.domain.dto.desExtract.DesExtractBatchDto;
import org.dromara.design.domain.vo.DesCollectFileVo;
import org.dromara.design.domain.vo.DesExtractCatalogueVo;
import org.dromara.design.service.IDesCollectFileService;
import org.dromara.design.domain.vo.DesExtractVo;
import org.dromara.design.mapper.DesExtractMapper;
import org.dromara.design.service.IDesExtractCatalogueService;
import org.dromara.design.service.IDesExtractService;
import org.dromara.design.service.IDesVolumeFileService;
import org.dromara.project.service.IBusProjectService;
import org.dromara.system.service.ISysOssService;
import org.springframework.beans.BeanUtils;
import org.springframework.context.event.EventListener;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.dromara.design.domain.bo.DesExtractBo;
import org.dromara.design.domain.vo.DesExtractVo;
import org.dromara.design.mapper.DesExtractMapper;
import org.dromara.design.service.IDesExtractService;
import org.springframework.transaction.annotation.Transactional;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.zip.ZipOutputStream;
/**
* 提资清单Service业务层处理
@ -84,6 +85,7 @@ public class DesExtractServiceImpl extends ServiceImpl<DesExtractMapper, DesExtr
private final IDesVolumeFileService volumeFileService;
private final ISysOssService ossService;
/**
* 查询提资清单
*
@ -220,10 +222,12 @@ public class DesExtractServiceImpl extends ServiceImpl<DesExtractMapper, DesExtr
if (desExtract == null) {
throw new ServiceException("数据不存在");
}
// 目标目录 & 文件路径
Path targetDir = Paths.get(DesDesignConstant.getDesignExtractFileUrl(desExtract));
// 如果存在目录则直接返回,不存在则生成文件并返回
if (!Files.exists(targetDir)) {
// 清理旧文件
Path targetFile = targetDir.resolve(DesDesignConstant.getDesignExtractFileName(desExtract));
// 如果文件不存在则生成
if (!Files.exists(targetFile)) {
// 清理旧目录
String baseUrl = DesDesignConstant.DESIGN_EXTRACT_FILE_URL + desExtract.getId();
try {
Path dirPath = Paths.get(baseUrl);
@ -234,11 +238,12 @@ public class DesExtractServiceImpl extends ServiceImpl<DesExtractMapper, DesExtr
log.error("文件目录:{},清理失败", baseUrl, e);
}
// 准备数据
List<DesExtractCatalogue> itemList = extractCatalogueService.list(Wrappers.
<DesExtractCatalogue>lambdaQuery().eq(DesExtractCatalogue::getExtractId, id));
List<DesExtractCatalogue> itemList = extractCatalogueService.list(
Wrappers.<DesExtractCatalogue>lambdaQuery().eq(DesExtractCatalogue::getExtractId, id));
DesCollectWordDto data = this.getReplacementDto(desExtract, itemList);
// 生成文件
try (InputStream is = getClass().getClassLoader().getResourceAsStream(DesDesignConstant.DESIGN_EXTRACT_TEMPLATE_PATH)) {
try (InputStream is = getClass().getClassLoader()
.getResourceAsStream(DesDesignConstant.DESIGN_EXTRACT_TEMPLATE_PATH)) {
if (is == null) {
throw new ServiceException("模板文件不存在");
}
@ -250,10 +255,8 @@ public class DesExtractServiceImpl extends ServiceImpl<DesExtractMapper, DesExtr
if (!Files.exists(targetDir)) {
Files.createDirectories(targetDir);
}
// 组合目标文件
String fileName = DesDesignConstant.getDesignExtractFileName(desExtract);
// 保存修改后的文件
try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) {
// 保存文件
try (FileOutputStream fos = new FileOutputStream(targetFile.toFile())) {
template.write(fos);
}
template.close();
@ -261,13 +264,17 @@ public class DesExtractServiceImpl extends ServiceImpl<DesExtractMapper, DesExtr
throw new OssException("生成Word文件失败错误信息: " + e.getMessage());
}
}
// 设置响应头,返回ZIP文件
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) {
DocumentUtil.zipDirectory(targetDir, targetDir, zos);
zos.flush();
// 设置响应头,直接返回 Word 文件
String fileName = targetFile.getFileName().toString();
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader("Content-Disposition", "attachment; filename=" +
URLEncoder.encode(fileName, StandardCharsets.UTF_8));
try (InputStream fis = Files.newInputStream(targetFile);
OutputStream os = response.getOutputStream()) {
IOUtils.copy(fis, os);
os.flush();
} catch (Exception e) {
throw new OssException("生成ZIP文件失败,错误信息: " + e.getMessage());
throw new OssException("导出Word文件失败,错误信息: " + e.getMessage());
}
}
@ -295,12 +302,12 @@ public class DesExtractServiceImpl extends ServiceImpl<DesExtractMapper, DesExtr
public List<DesCollectFileVo> fileList(Long id) {
List<Long> catalogIds = extractCatalogueService.list(Wrappers.<DesExtractCatalogue>lambdaQuery()
.eq(DesExtractCatalogue::getExtractId, id)).stream().map(DesExtractCatalogue::getVolumeCatalogId).toList();
if(catalogIds.isEmpty()){
if (catalogIds.isEmpty()) {
return new ArrayList<>();
}
List<DesVolumeFile> list = volumeFileService.list(Wrappers.<DesVolumeFile>lambdaQuery().in(DesVolumeFile::getVolumeCatalogId, catalogIds));
ArrayList<DesCollectFileVo> desCollectFileVos = new ArrayList<>();
for (DesVolumeFile desVolumeFile : list){
for (DesVolumeFile desVolumeFile : list) {
DesCollectFileVo desCollectFileVo = BeanUtil.copyProperties(desVolumeFile, DesCollectFileVo.class);
desCollectFileVo.setFileUrl(ossService.getById(desVolumeFile.getFileId()).getUrl());
desCollectFileVos.add(desCollectFileVo);

View File

@ -66,6 +66,17 @@ public class PgsProgressCategoryController extends BaseController {
return R.ok(list);
}
/**
* 根据子项目获取进度类别模版顶级目录列表
*/
@SaCheckPermission("progress:progressCategory:listTopBySubProjectId")
@GetMapping("/listTopBySubProjectId/{subProjectId}")
public R<List<PgsProgressCategoryVo>> listTopBySubProjectId(@NotNull(message = "项目id不能为空")
@PathVariable Long subProjectId) {
List<PgsProgressCategoryVo> list = pgsProgressCategoryService.getTopListByProjectId(subProjectId);
return R.ok(list);
}
/**
* 导出进度类别列表
*/
@ -277,11 +288,4 @@ public class PgsProgressCategoryController extends BaseController {
return toAjax(pgsProgressCategoryService.deleteWithValidByIds(List.of(ids), true));
}
/***
* 分项工程方阵导出
*/
// @SaCheckPermission("progress:progressCategory:export")
// @Log(title = "分项工程方阵导出", businessType = BusinessType.EXPORT)
// @GetMapping("/export")
}

View File

@ -58,6 +58,15 @@ public class PgsProgressCategoryTemplateController extends BaseController {
return R.ok(list);
}
/**
* 获取系统顶级进度类别模版列表
*/
@SaCheckPermission("progress:progressCategoryTemplate:listSystemTop")
@GetMapping("/listSystemTop")
public R<List<PgsProgressCategoryTemplateVo>> listSystemTop() {
return R.ok(pgsProgressCategoryTemplateService.listSystemTop());
}
/**
* 导出进度类别模版列表
*/

View File

@ -114,6 +114,11 @@ public class PgsProgressCategory extends BaseEntity {
*/
private String ancestors;
/**
* 关联结构(1子项目 2方阵)
*/
private String relevancyStructure;
/**
* 工作类型
*/

View File

@ -47,6 +47,11 @@ public class PgsProgressCategoryTemplate implements Serializable {
*/
private String workType;
/**
* 关联结构(1子项目 2方阵)
*/
private String relevancyStructure;
/**
* 项目id0表示共用
*/

View File

@ -1,5 +1,6 @@
package org.dromara.progress.domain.dto.progresscategory;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@ -18,6 +19,11 @@ public class PgsProgressCategoryCreatePriceReq {
@NotNull(message = "类别id不能为空")
private Long id;
/**
* 类别名称
*/
private String name;
/**
* 计量单位
*/
@ -33,9 +39,19 @@ public class PgsProgressCategoryCreatePriceReq {
*/
private BigDecimal constructionPrice;
/**
* 计量方式0无 1数量 2百分比
*/
private String unitType;
/**
* 总数量
*/
private BigDecimal total;
/**
* 备注
*/
private String remark;
}

View File

@ -60,6 +60,12 @@ public class PgsProgressCategoryCreateReq implements Serializable {
@NotNull(message = "综合单价(分包)不能为空")
private BigDecimal constructionPrice;
/**
* 关联结构(1子项目 2方阵)
*/
@NotBlank(message = "关联结构不能为空")
private String relevancyStructure;
/**
* 总数量
*/

View File

@ -19,4 +19,9 @@ public class PgsProgressCategoryQueryReq {
*/
private Long matrixId;
/**
* 关联结构(1子项目 2方阵)
*/
private String relevancyStructure;
}

View File

@ -38,6 +38,11 @@ public class PgsProgressCategoryUpdateReq {
*/
private BigDecimal total;
/**
* 关联结构(1子项目 2方阵)
*/
private String relevancyStructure;
/**
* 备注
*/

View File

@ -39,4 +39,9 @@ public class PgsProgressCategoryTemplateQueryReq implements Serializable {
*/
private String constructionType;
/**
* 关联结构(1子项目 2方阵)
*/
private String relevancyStructure;
}

View File

@ -0,0 +1,24 @@
package org.dromara.progress.domain.enums;
import lombok.Getter;
/**
* @author lilemy
* @date 2025-08-25 18:58
*/
@Getter
public enum PgsRelevancyStructureEnum {
SUB_PROJECT("子项目", "1"),
MATRIX("方阵", "2");
private final String text;
private final String value;
PgsRelevancyStructureEnum(String text, String value) {
this.text = text;
this.value = value;
}
}

View File

@ -142,6 +142,13 @@ public class PgsProgressCategoryVo implements Serializable {
*/
private BigDecimal constructionOutputValue;
/**
* 关联结构(1子项目 2方阵)
*/
@ExcelProperty(value = "关联结构", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=子项目,2=方阵")
private String relevancyStructure;
/**
* 工作类型
*/

View File

@ -46,6 +46,11 @@ public class PgsProgressCategoryTemplateVo implements Serializable {
*/
private String workType;
/**
* 关联结构(1子项目 2方阵)
*/
private String relevancyStructure;
/**
* 项目id0表示共用
*/

View File

@ -49,6 +49,14 @@ public interface IPgsProgressCategoryService extends IService<PgsProgressCategor
*/
PgsProgressCategoryLastTimeVo queryLastTimeById(Long id);
/**
* 根据子项目id获取顶级进度类别模版
*
* @param subProjectId 子项目id
* @return 顶级进度类别模版
*/
List<PgsProgressCategoryVo> getTopListByProjectId(Long subProjectId);
/**
* 新增进度类别
*
@ -142,7 +150,7 @@ public interface IPgsProgressCategoryService extends IService<PgsProgressCategor
/***
* 获取方阵id及对应数量
*/
List<Map<String,Object>> getMatrixIdAndNumber(Long projectId);
List<Map<String, Object>> getMatrixIdAndNumber(Long projectId);
PgsProgressCategory convertVoToEntity(PgsProgressCategoryVo vo);

View File

@ -80,6 +80,13 @@ public interface IPgsProgressCategoryTemplateService extends IService<PgsProgres
*/
Boolean initTemplateByProject(Long projectId);
/**
* 获取系统顶级进度类别模版
*
* @return 系统顶级进度类别模版
*/
List<PgsProgressCategoryTemplateVo> listSystemTop();
/**
* 获取进度类别模版视图对象
*

View File

@ -28,6 +28,7 @@ import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdat
import org.dromara.progress.domain.enums.PgsCoordinateTypeEnum;
import org.dromara.progress.domain.enums.PgsFinishStatusEnum;
import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum;
import org.dromara.progress.domain.enums.PgsRelevancyStructureEnum;
import org.dromara.progress.domain.vo.progresscategory.*;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailDateVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
@ -167,11 +168,33 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
if (progressPlan != null && progressPlan.getEndDate().after(date)) {
lastTimeVo.setEndDate(progressPlan.getEndDate());
} else {
lastTimeVo.setEndDate(date);
LocalDate yesterday = now.minusDays(1);
Date y = DateUtils.toDate(yesterday);
lastTimeVo.setEndDate(y);
}
return lastTimeVo;
}
/**
* 根据子项目id获取顶级进度类别模版
*
* @param subProjectId 子项目id
* @return 顶级进度类别模版
*/
@Override
public List<PgsProgressCategoryVo> getTopListByProjectId(Long subProjectId) {
List<PgsProgressCategory> list = this.lambdaQuery()
.eq(PgsProgressCategory::getProjectId, subProjectId)
.eq(PgsProgressCategory::getParentId, PgsProgressCategoryConstant.TOP_PARENT_ID)
.list();
if (CollUtil.isEmpty(list)) {
return List.of();
}
return list.stream()
.map(this::getVo)
.collect(Collectors.toList());
}
/**
* 新增进度类别
*
@ -263,25 +286,39 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
throw new ServiceException("该分项工程不存在", HttpStatus.BAD_REQUEST);
}
// 计算产值
String unitType = req.getUnitType();
// 无计量方式
if (unitType.equals(PgsProgressUnitTypeEnum.NULL.getValue()) ||
progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NULL.getValue())) {
progressCategory.setName(req.getName());
progressCategory.setUnitType(unitType);
progressCategory.setRemark(req.getRemark());
// 写入数据库
return this.updateById(progressCategory);
}
BigDecimal ownerPrice = req.getOwnerPrice();
BigDecimal constructionPrice = req.getConstructionPrice();
BigDecimal ownerOutputValue = BigDecimal.ZERO;
BigDecimal constructionOutputValue = BigDecimal.ZERO;
if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
if (unitType.equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue()) ||
progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
progressCategory.setTotal(req.getTotal());
ownerOutputValue = req.getTotal().multiply(ownerPrice);
constructionOutputValue = req.getTotal().multiply(constructionPrice);
} else if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NUMBER.getValue()) && progressCategory.getWorkType() != null) {
} else if (((unitType.equals(PgsProgressUnitTypeEnum.NUMBER.getValue())) ||
(progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NUMBER.getValue())))
&& progressCategory.getWorkType() != null) {
BigDecimal total = progressCategory.getTotal();
if (total == null || total.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("请导入分项工程数量后再添加单价", HttpStatus.BAD_REQUEST);
}
ownerOutputValue = total.multiply(ownerPrice);
constructionOutputValue = total.multiply(constructionPrice);
} else if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NUMBER.getValue())) {
BigDecimal total = progressCategory.getTotal();
} else if (unitType.equals(PgsProgressUnitTypeEnum.NUMBER.getValue()) ||
progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NUMBER.getValue())) {
BigDecimal total = req.getTotal();
if (total == null || total.compareTo(BigDecimal.ZERO) <= 0) {
total = req.getTotal();
total = progressCategory.getTotal();
}
if (total == null || total.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("请输入分项工程数量", HttpStatus.BAD_REQUEST);
@ -290,11 +327,14 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
constructionOutputValue = total.multiply(constructionPrice);
}
// 填入数据
progressCategory.setName(req.getName());
progressCategory.setUnit(req.getUnit());
progressCategory.setUnitType(unitType);
progressCategory.setOwnerPrice(ownerPrice);
progressCategory.setConstructionPrice(constructionPrice);
progressCategory.setOwnerOutputValue(ownerOutputValue);
progressCategory.setConstructionOutputValue(constructionOutputValue);
progressCategory.setRemark(req.getRemark());
// 写入数据库
return this.updateById(progressCategory);
}
@ -429,9 +469,11 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
}
Long projectId = req.getProjectId();
Long matrixId = req.getMatrixId();
String relevancyStructure = req.getRelevancyStructure();
// 精确查询
lqw.eq(ObjectUtils.isNotEmpty(projectId), PgsProgressCategory::getProjectId, projectId);
lqw.eq(ObjectUtils.isNotEmpty(matrixId), PgsProgressCategory::getMatrixId, matrixId);
lqw.eq(StringUtils.isNotBlank(relevancyStructure), PgsProgressCategory::getRelevancyStructure, relevancyStructure);
return lqw;
}
@ -562,12 +604,19 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
List<FacPercentageFacility> percentageFacilityList = new ArrayList<>();
List<PgsProgressPlan> newPlanList = new ArrayList<>();
List<PgsProgressPlanDetail> newPlanDetailList = new ArrayList<>();
// 获取关联子项目的进度
List<PgsProgressCategoryTemplate> subTemplateList = categoryTemplateList.stream()
.filter(template -> template.getConstructionType().equals(PgsRelevancyStructureEnum.SUB_PROJECT.getValue()))
.toList();
List<PgsProgressCategoryTemplate> matrixTemplateList = categoryTemplateList.stream()
.filter(template -> template.getConstructionType().equals(PgsRelevancyStructureEnum.MATRIX.getValue()))
.toList();
// 每个 matrixId 对应一套新的 ID 映射
for (FacMatrix matrix : matrixList) {
// templateId -> newId
Map<Long, Long> localIdMap = new HashMap<>();
List<PgsProgressCategory> localList = new ArrayList<>();
for (PgsProgressCategoryTemplate template : categoryTemplateList) {
for (PgsProgressCategoryTemplate template : matrixTemplateList) {
Long newId = IdWorker.getId();
localIdMap.put(template.getId(), newId);
PgsProgressCategory newCategory = new PgsProgressCategory();
@ -632,6 +681,10 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
}
}
newList.addAll(localList);
}
// 新增关联子项目进度的数据
for (PgsProgressCategoryTemplate template : subTemplateList) {
}
// 删除旧进度类别
LambdaQueryWrapper<PgsProgressCategory> lqw = new LambdaQueryWrapper<>();
@ -945,12 +998,12 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
}
@Override
public List<Map<String,Object>> getMatrixIdAndNumber(Long projectId){
public List<Map<String, Object>> getMatrixIdAndNumber(Long projectId) {
return baseMapper.getMatrixIdAndNumber(projectId);
}
@Override
public PgsProgressCategory convertVoToEntity(PgsProgressCategoryVo vo){
public PgsProgressCategory convertVoToEntity(PgsProgressCategoryVo vo) {
if (vo == null) {
return null;
}

View File

@ -29,6 +29,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* 进度类别模版Service业务层处理
@ -271,6 +272,25 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
return true;
}
/**
* 获取系统顶级进度类别模版
*
* @return 系统顶级进度类别模版
*/
@Override
public List<PgsProgressCategoryTemplateVo> listSystemTop() {
List<PgsProgressCategoryTemplate> list = this.lambdaQuery()
.eq(PgsProgressCategoryTemplate::getProjectId, PgsProgressCategoryConstant.TOP_PARENT_ID)
.eq(PgsProgressCategoryTemplate::getParentId, PgsProgressCategoryConstant.TOP_PARENT_ID)
.list();
if (CollUtil.isEmpty(list)) {
return List.of();
}
return list.stream()
.map(this::getVo)
.collect(Collectors.toList());
}
/**
* 获取进度类别模版视图对象
*
@ -309,6 +329,7 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
String unitType = req.getUnitType();
Long projectId = req.getProjectId();
String constructionType = req.getConstructionType();
String relevancyStructure = req.getRelevancyStructure();
// 模糊查询
lqw.like(StringUtils.isNotBlank(name), PgsProgressCategoryTemplate::getName, name);
// 精确查询
@ -316,6 +337,7 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
lqw.eq(StringUtils.isNotBlank(unitType), PgsProgressCategoryTemplate::getUnitType, unitType);
lqw.eq(ObjectUtils.isNotEmpty(parentId), PgsProgressCategoryTemplate::getParentId, parentId);
lqw.eq(StringUtils.isNotBlank(constructionType), PgsProgressCategoryTemplate::getConstructionType, constructionType);
lqw.eq(StringUtils.isNotBlank(relevancyStructure), PgsProgressCategoryTemplate::getRelevancyStructure, relevancyStructure);
return lqw;
}

View File

@ -78,23 +78,44 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
@Select("""
WITH RECURSIVE dept_tree AS (
SELECT dept_id, parent_id, project_id, dept_type
FROM sys_dept
WHERE dept_id = #{deptId}
WITH RECURSIVE dept_tree AS (
SELECT dept_id, parent_id, project_id, dept_type
FROM sys_dept
WHERE dept_id = #{deptId}
UNION ALL
UNION ALL
SELECT d.dept_id, d.parent_id, d.project_id, d.dept_type
FROM sys_dept d
INNER JOIN dept_tree dt ON d.parent_id = dt.dept_id
)
SELECT DISTINCT project_id
FROM dept_tree
WHERE dept_type = '3' AND project_id IS NOT NULL
""")
SELECT d.dept_id, d.parent_id, d.project_id, d.dept_type
FROM sys_dept d
INNER JOIN dept_tree dt ON d.parent_id = dt.dept_id
)
SELECT DISTINCT project_id
FROM dept_tree
WHERE dept_type = '4' AND project_id IS NOT NULL
""")
List<Long> getProjectIdsByDept(@Param("deptId") Long deptId);
@Select("""
WITH RECURSIVE dept_tree AS (
-- 第一步:找到传入 deptId 的同级部门(同一个 parent_id
SELECT d.dept_id, d.parent_id, d.project_id, d.dept_type
FROM sys_dept d
WHERE d.parent_id = (SELECT parent_id FROM sys_dept WHERE dept_id = #{deptId})
UNION ALL
-- 第二步:递归查找这些部门的所有子部门
SELECT sd.dept_id, sd.parent_id, sd.project_id, sd.dept_type
FROM sys_dept sd
INNER JOIN dept_tree dt ON sd.parent_id = dt.dept_id
)
SELECT DISTINCT project_id
FROM dept_tree
WHERE dept_type = '4' AND project_id IS NOT NULL
""")
List<Long> getProjectIdsByDeptSiblingsAndChildren(@Param("deptId") Long deptId);
/**
* 根据部门ID获取到顶级部门
*

View File

@ -70,10 +70,11 @@ public interface ISysDeptService {
/**
* 根据部门ID查询所属项目ID列表
*
* @param deptId 部门id
* @param deptId 部门id
* @param deptType 部门类型
* @return 项目id列表
*/
List<Long> selectProjectIdById(Long deptId);
List<Long> selectProjectIdById(Long deptId, String deptType);
/**

View File

@ -260,11 +260,15 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
/**
* 根据部门ID查询所属项目ID列表
*
* @param deptId 部门id
* @param deptId 部门id
* @param deptType 部门类型
* @return 项目id列表
*/
@Override
public List<Long> selectProjectIdById(Long deptId) {
public List<Long> selectProjectIdById(Long deptId, String deptType) {
if (deptType.equals(SysDeptTypeEnum.SPECIAL.getCode())) {
return baseMapper.getProjectIdsByDeptSiblingsAndChildren(deptId);
}
return baseMapper.getProjectIdsByDept(deptId);
}

View File

@ -373,7 +373,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
}
} else {
// 关联部门所属项目
List<Long> projectIds = deptService.selectProjectIdById(deptId);
List<Long> projectIds = deptService.selectProjectIdById(deptId, deptType);
String userType = "1";
if (deptType.equals(SysDeptTypeEnum.COMPANY.getCode()) || deptType.equals(SysDeptTypeEnum.SUB_COMPANY.getCode())) {
userType = "2";
@ -447,7 +447,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
// 先删除旧关联
userProjectRelevancyService.deleteByUserId(user.getUserId());
// 添加新关联
List<Long> projectIds = deptService.selectProjectIdById(user.getDeptId());
List<Long> projectIds = deptService.selectProjectIdById(user.getDeptId(), deptType);
String userType = "1";
if (deptType.equals(SysDeptTypeEnum.COMPANY.getCode()) || deptType.equals(SysDeptTypeEnum.SUB_COMPANY.getCode())) {
userType = "2";
@ -688,6 +688,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
/**
* 获取当前用户所在部门的所有用户
*
* @return
*/
@Override

View File

@ -1,29 +1,28 @@
package org.dromara.tender.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.utils.excel.ExcelDynamicReader;
import org.dromara.tender.domain.BusBillofquantitiesLimitList;
import org.dromara.tender.domain.bo.BusBLimitListVersionsBo;
import org.dromara.tender.domain.bo.BusBillofquantitiesLimitListBo;
import org.dromara.tender.domain.bo.TenderAllVersionNumbersReq;
import org.dromara.tender.domain.vo.BusBLimitListVersionsVo;
import org.dromara.tender.domain.vo.BusBillofquantitiesLimitListVo;
import org.dromara.tender.enums.LimitListTypeEnum;
import org.dromara.tender.mapper.BusBillofquantitiesLimitListMapper;
import org.dromara.tender.service.IBusBLimitListVersionsService;
import org.dromara.tender.service.IBusBillofquantitiesLimitListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.dromara.tender.domain.bo.BusBillofquantitiesLimitListBo;
import org.dromara.tender.domain.vo.BusBillofquantitiesLimitListVo;
import org.dromara.tender.domain.BusBillofquantitiesLimitList;
import org.dromara.tender.mapper.BusBillofquantitiesLimitListMapper;
import org.dromara.tender.service.IBusBillofquantitiesLimitListService;
import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal;
@ -54,7 +53,7 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
* @return 限价一览
*/
@Override
public BusBillofquantitiesLimitListVo queryById(Long id){
public BusBillofquantitiesLimitListVo queryById(Long id) {
return baseMapper.selectVoById(id);
}
@ -87,9 +86,14 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
private LambdaQueryWrapper<BusBillofquantitiesLimitList> buildQueryWrapper(BusBillofquantitiesLimitListBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<BusBillofquantitiesLimitList> lqw = Wrappers.lambdaQuery();
String versions = bo.getVersions();
if (StringUtils.isNotBlank(versions) && versions.contains("_")) {
System.out.println("字符串包含 _");
versions = versions.split("_")[0];
}
// lqw.orderByDesc(BusBillofquantitiesLimitList::getId);
lqw.eq(bo.getProjectId() != null, BusBillofquantitiesLimitList::getProjectId, bo.getProjectId());
lqw.eq(StringUtils.isNotBlank(bo.getVersions()), BusBillofquantitiesLimitList::getVersions, bo.getVersions());
lqw.eq(StringUtils.isNotBlank(versions), BusBillofquantitiesLimitList::getVersions, versions);
lqw.eq(StringUtils.isNotBlank(bo.getSheet()), BusBillofquantitiesLimitList::getSheet, bo.getSheet());
lqw.eq(StringUtils.isNotBlank(bo.getSid()), BusBillofquantitiesLimitList::getSid, bo.getSid());
lqw.eq(StringUtils.isNotBlank(bo.getPid()), BusBillofquantitiesLimitList::getPid, bo.getPid());
@ -136,7 +140,7 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(BusBillofquantitiesLimitList entity){
private void validEntityBeforeSave(BusBillofquantitiesLimitList entity) {
//TODO 做一些数据校验,如唯一约束
}
@ -149,7 +153,7 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
@ -160,12 +164,12 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
//获取所有数据
List<BusBillofquantitiesLimitListVo> listVoList = queryList(bo);
//过滤数量和单价为空的数据并计算总价
listVoList.stream().filter(vo -> vo.getUnitPrice() !=null && vo.getUnitPrice().compareTo(BigDecimal.ZERO) != 0)
.filter(vo ->vo.getQuantity() !=null && vo.getQuantity().compareTo(BigDecimal.ZERO) != 0)
listVoList.stream().filter(vo -> vo.getUnitPrice() != null && vo.getUnitPrice().compareTo(BigDecimal.ZERO) != 0)
.filter(vo -> vo.getQuantity() != null && vo.getQuantity().compareTo(BigDecimal.ZERO) != 0)
.forEach(item -> {
item.setPrice(item.getUnitPrice().multiply(item.getQuantity()).setScale(2, RoundingMode.HALF_UP));
});
if (bo.getType().equals(LimitListTypeEnum.SPECIAL.getCode())){
if (bo.getType().equals(LimitListTypeEnum.SPECIAL.getCode())) {
return listVoList;
}
@ -204,7 +208,7 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
}
@Override
public Boolean importExcelFile(BusBillofquantitiesLimitListBo bo, MultipartFile file) throws Exception{
public Boolean importExcelFile(BusBillofquantitiesLimitListBo bo, MultipartFile file) throws Exception {
// 跳过1行表头读取0到6列共7列映射到ExcelData实体类
@ -215,19 +219,19 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
13, // 到第5列结束
BusBillofquantitiesLimitListBo.class // 目标实体类
);
List<BusBillofquantitiesLimitList> busBillofquantities = new ArrayList<BusBillofquantitiesLimitList>();
List<BusBillofquantitiesLimitList> busBillofquantities = new ArrayList<BusBillofquantitiesLimitList>();
dataList.stream()
.filter(Objects::nonNull) // 过滤掉 null 对象
.filter(data-> data.getUnitPrice() !=null && data.getUnitPrice().compareTo(BigDecimal.ZERO) != 0)//过滤单价为空的数据
.filter(data ->data.getQuantity() !=null && data.getQuantity().compareTo(BigDecimal.ZERO) != 0)//过滤数量为空的数据
.filter(data -> data.getUnitPrice() != null && data.getUnitPrice().compareTo(BigDecimal.ZERO) != 0)//过滤单价为空的数据
.filter(data -> data.getQuantity() != null && data.getQuantity().compareTo(BigDecimal.ZERO) != 0)//过滤数量为空的数据
.forEach(item -> {
BusBillofquantitiesLimitList limitList = new BusBillofquantitiesLimitList();
limitList.setId(item.getId());
limitList.setProjectId(bo.getProjectId());
limitList.setType(bo.getType());
limitList.setUnitPrice(item.getUnitPrice());
busBillofquantities.add(limitList);
});
BusBillofquantitiesLimitList limitList = new BusBillofquantitiesLimitList();
limitList.setId(item.getId());
limitList.setProjectId(bo.getProjectId());
limitList.setType(bo.getType());
limitList.setUnitPrice(item.getUnitPrice());
busBillofquantities.add(limitList);
});
return baseMapper.updateBatchById(busBillofquantities);
}
@ -254,7 +258,8 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
/**
* 递归构建树形结构
* @param parentId 父节点ID顶级节点为0
*
* @param parentId 父节点ID顶级节点为0
* @param parentMap 父子映射表key=pidvalue=子节点列表)
* @return 组装好的子树列表
*/