工程量清单
This commit is contained in:
@ -49,7 +49,7 @@ public class BusCailiaoshebeiController extends BaseController {
|
||||
* 设计-新增批次号
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:cailiaoshebei:pcAdd")
|
||||
@Log(title = "设计-批次号列表", businessType = BusinessType.INSERT)
|
||||
@Log(title = "设计-新增批次号", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/pcAdd")
|
||||
public R<Void> pcAdd(@Validated(AddGroup.class) @RequestBody BusCailiaoshebeiPiciAddReq bo) {
|
||||
|
||||
@ -11,4 +11,9 @@ public interface MinioPathConstant {
|
||||
String ContactNotice = "contactNotice";
|
||||
// 联系单模板
|
||||
String ContactNoticeTemplate = "contactNotice/template";
|
||||
|
||||
// 设计
|
||||
String Design = "design";
|
||||
// 设计工程量清单
|
||||
String BillOfQuantities = Design+"/billOfQuantities";
|
||||
}
|
||||
|
||||
@ -0,0 +1,105 @@
|
||||
package org.dromara.design.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
import org.dromara.design.domain.bo.BusBillofquantitiesBo;
|
||||
import org.dromara.design.service.IBusBillofquantitiesService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 工程量清单
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/design/billofquantities")
|
||||
public class BusBillofquantitiesController extends BaseController {
|
||||
|
||||
private final IBusBillofquantitiesService busBillofquantitiesService;
|
||||
|
||||
/**
|
||||
* 查询工程量清单列表
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantities:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BusBillofquantitiesVo> list(BusBillofquantitiesBo bo, PageQuery pageQuery) {
|
||||
return busBillofquantitiesService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工程量清单列表
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantities:export")
|
||||
@Log(title = "工程量清单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BusBillofquantitiesBo bo, HttpServletResponse response) {
|
||||
List<BusBillofquantitiesVo> list = busBillofquantitiesService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "工程量清单", BusBillofquantitiesVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程量清单详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantities:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<BusBillofquantitiesVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(busBillofquantitiesService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工程量清单
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantities:add")
|
||||
@Log(title = "工程量清单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusBillofquantitiesBo bo) {
|
||||
return toAjax(busBillofquantitiesService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工程量清单
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantities:edit")
|
||||
@Log(title = "工程量清单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusBillofquantitiesBo bo) {
|
||||
return toAjax(busBillofquantitiesService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工程量清单
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantities:remove")
|
||||
@Log(title = "工程量清单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(busBillofquantitiesService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
package org.dromara.design.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.design.domain.bo.ImportExcelFileReq;
|
||||
import org.dromara.design.domain.bo.ObtainAllVersionNumbersReq;
|
||||
import org.dromara.design.domain.bo.ObtainTheListReq;
|
||||
import org.dromara.design.domain.dto.ObtainTheListRes;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVersionsVo;
|
||||
import org.dromara.design.domain.bo.BusBillofquantitiesVersionsBo;
|
||||
import org.dromara.design.service.IBusBillofquantitiesVersionsService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 工程量清单版本
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/design/billofquantitiesVersions")
|
||||
public class BusBillofquantitiesVersionsController extends BaseController {
|
||||
|
||||
private final IBusBillofquantitiesVersionsService busBillofquantitiesVersionsService;
|
||||
|
||||
/**
|
||||
* 查询工程量清单版本列表
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BusBillofquantitiesVersionsVo> list(BusBillofquantitiesVersionsBo bo, PageQuery pageQuery) {
|
||||
return busBillofquantitiesVersionsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工程量清单版本列表
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:export")
|
||||
@Log(title = "工程量清单版本", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BusBillofquantitiesVersionsBo bo, HttpServletResponse response) {
|
||||
List<BusBillofquantitiesVersionsVo> list = busBillofquantitiesVersionsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "工程量清单版本", BusBillofquantitiesVersionsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程量清单版本详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<BusBillofquantitiesVersionsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(busBillofquantitiesVersionsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工程量清单版本
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:add")
|
||||
@Log(title = "工程量清单版本", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusBillofquantitiesVersionsBo bo) {
|
||||
return toAjax(busBillofquantitiesVersionsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工程量清单版本
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:edit")
|
||||
@Log(title = "工程量清单版本", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusBillofquantitiesVersionsBo bo) {
|
||||
return toAjax(busBillofquantitiesVersionsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工程量清单版本
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:remove")
|
||||
@Log(title = "工程量清单版本", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(busBillofquantitiesVersionsService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入excel
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:importExcelFile")
|
||||
@Log(title = "导入excel", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/importExcelFile")
|
||||
public R<Void> importExcelFile(ImportExcelFileReq bo, @RequestParam("file") MultipartFile file) throws IOException {
|
||||
return toAjax(busBillofquantitiesVersionsService.importExcelFile(bo,file));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有版本号
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:obtainAllVersionNumbers")
|
||||
@GetMapping("/obtainAllVersionNumbers")
|
||||
public TableDataInfo<BusBillofquantitiesVersionsVo> obtainAllVersionNumbers(ObtainAllVersionNumbersReq bo, PageQuery pageQuery) {
|
||||
return busBillofquantitiesVersionsService.obtainAllVersionNumbers(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程量清单
|
||||
*/
|
||||
@SaCheckPermission("design:billofquantitiesVersions:obtainTheList")
|
||||
@GetMapping("/obtainTheList")
|
||||
public R<List<ObtainTheListRes>> obtainTheList(ObtainTheListReq bo, PageQuery pageQuery) {
|
||||
return R.ok(busBillofquantitiesVersionsService.obtainTheList(bo));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package org.dromara.design.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 工程量清单对象 bus_billofquantities
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("bus_billofquantities")
|
||||
public class BusBillofquantities extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private String versions;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String sheet;
|
||||
|
||||
/**
|
||||
* 子ID
|
||||
*/
|
||||
private String sid;
|
||||
|
||||
/**
|
||||
* 父ID
|
||||
*/
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String num;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private int quantity;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package org.dromara.design.domain;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 工程量清单版本对象 bus_billofquantities_versions
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("bus_billofquantities_versions")
|
||||
@Accessors(chain = true)
|
||||
public class BusBillofquantitiesVersions extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工单类型(字典)
|
||||
*/
|
||||
private String workOrderType;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private String versions;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package org.dromara.design.domain.bo;
|
||||
|
||||
import org.dromara.design.domain.BusBillofquantities;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 工程量清单业务对象 bus_billofquantities
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BusBillofquantities.class, reverseConvertGenerate = false)
|
||||
public class BusBillofquantitiesBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
@NotBlank(message = "版本号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String versions;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
@NotBlank(message = "表名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String sheet;
|
||||
|
||||
|
||||
/**
|
||||
* 子ID
|
||||
*/
|
||||
private String sid;
|
||||
|
||||
/**
|
||||
* 父ID
|
||||
*/
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String num;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Long quantity;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package org.dromara.design.domain.bo;
|
||||
|
||||
import org.dromara.design.domain.BusBillofquantitiesVersions;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 工程量清单版本业务对象 bus_billofquantities_versions
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BusBillofquantitiesVersions.class, reverseConvertGenerate = false)
|
||||
public class BusBillofquantitiesVersionsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工单类型(字典)
|
||||
*/
|
||||
@NotBlank(message = "工单类型(字典)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String workOrderType;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
@NotBlank(message = "版本号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String versions;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package org.dromara.design.domain.bo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/8/11 18:20
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ImportExcelFileReq implements Serializable {
|
||||
/**
|
||||
* 工单类型(字典)
|
||||
*/
|
||||
@NotBlank(message = "工单类型(字典)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String workOrderType;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package org.dromara.design.domain.bo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/8/11 20:18
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ObtainAllVersionNumbersReq implements Serializable {
|
||||
/**
|
||||
* 工单类型(字典)
|
||||
*/
|
||||
@NotBlank(message = "工单类型(字典)不能为空")
|
||||
private String workOrderType;
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package org.dromara.design.domain.bo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/8/11 20:14
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ObtainTheListReq implements Serializable {
|
||||
|
||||
// /**
|
||||
// * 工单类型(字典)
|
||||
// */
|
||||
// @NotBlank(message = "工单类型(字典)不能为空")
|
||||
// private String workOrderType;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
@NotBlank(message = "版本号不能为空")
|
||||
private String versions;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
@NotBlank(message = "表名不能为空")
|
||||
private String sheet;
|
||||
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package org.dromara.design.domain.dto;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/8/11 20:48
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ObtainTheListRes implements Serializable {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
@ExcelProperty(value = "版本号")
|
||||
private String versions;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
@ExcelProperty(value = "表名")
|
||||
private String sheet;
|
||||
|
||||
/**
|
||||
* 父子ID
|
||||
*/
|
||||
@ExcelProperty(value = "父子ID")
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@ExcelProperty(value = "编号")
|
||||
private String num;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ExcelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@ExcelProperty(value = "规格")
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ExcelProperty(value = "单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ExcelProperty(value = "数量")
|
||||
private Long quantity;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<ObtainTheListRes> children = new ArrayList<>();
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package org.dromara.design.domain.vo;
|
||||
|
||||
import org.dromara.design.domain.BusBillofquantitiesVersions;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 工程量清单版本视图对象 bus_billofquantities_versions
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BusBillofquantitiesVersions.class)
|
||||
public class BusBillofquantitiesVersionsVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工单类型(字典)
|
||||
*/
|
||||
@ExcelProperty(value = "工单类型(字典)", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "work_order_type")
|
||||
private String workOrderType;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
@ExcelProperty(value = "版本号")
|
||||
private String versions;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package org.dromara.design.domain.vo;
|
||||
|
||||
import org.dromara.design.domain.BusBillofquantities;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 工程量清单视图对象 bus_billofquantities
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BusBillofquantities.class)
|
||||
public class BusBillofquantitiesVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
@ExcelProperty(value = "版本号")
|
||||
private String versions;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
@ExcelProperty(value = "表名")
|
||||
private String sheet;
|
||||
|
||||
/**
|
||||
* 父子ID
|
||||
*/
|
||||
@ExcelProperty(value = "父子ID")
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@ExcelProperty(value = "编号")
|
||||
private String num;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ExcelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@ExcelProperty(value = "规格")
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ExcelProperty(value = "单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ExcelProperty(value = "数量")
|
||||
private Long quantity;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.design.mapper;
|
||||
|
||||
import org.dromara.design.domain.BusBillofquantities;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 工程量清单Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
public interface BusBillofquantitiesMapper extends BaseMapperPlus<BusBillofquantities, BusBillofquantitiesVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package org.dromara.design.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.design.domain.BusBillofquantitiesVersions;
|
||||
import org.dromara.design.domain.bo.ObtainTheListReq;
|
||||
import org.dromara.design.domain.dto.ObtainTheListRes;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVersionsVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程量清单版本Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
public interface BusBillofquantitiesVersionsMapper extends BaseMapperPlus<BusBillofquantitiesVersions, BusBillofquantitiesVersionsVo> {
|
||||
|
||||
/**
|
||||
* 分页查询工程量清单版本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工程量清单版本列表
|
||||
*/
|
||||
List<ObtainTheListRes> obtainTheList(@Param("bo") ObtainTheListReq bo);
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package org.dromara.design.service;
|
||||
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
import org.dromara.design.domain.bo.BusBillofquantitiesBo;
|
||||
import org.dromara.design.domain.BusBillofquantities;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程量清单Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
public interface IBusBillofquantitiesService extends IService<BusBillofquantities>{
|
||||
|
||||
/**
|
||||
* 查询工程量清单
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 工程量清单
|
||||
*/
|
||||
BusBillofquantitiesVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询工程量清单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工程量清单分页列表
|
||||
*/
|
||||
TableDataInfo<BusBillofquantitiesVo> queryPageList(BusBillofquantitiesBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的工程量清单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工程量清单列表
|
||||
*/
|
||||
List<BusBillofquantitiesVo> queryList(BusBillofquantitiesBo bo);
|
||||
|
||||
/**
|
||||
* 新增工程量清单
|
||||
*
|
||||
* @param bo 工程量清单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BusBillofquantitiesBo bo);
|
||||
|
||||
/**
|
||||
* 修改工程量清单
|
||||
*
|
||||
* @param bo 工程量清单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BusBillofquantitiesBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除工程量清单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package org.dromara.design.service;
|
||||
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.design.domain.bo.ImportExcelFileReq;
|
||||
import org.dromara.design.domain.bo.ObtainAllVersionNumbersReq;
|
||||
import org.dromara.design.domain.bo.ObtainTheListReq;
|
||||
import org.dromara.design.domain.dto.ObtainTheListRes;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVersionsVo;
|
||||
import org.dromara.design.domain.bo.BusBillofquantitiesVersionsBo;
|
||||
import org.dromara.design.domain.BusBillofquantitiesVersions;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程量清单版本Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
public interface IBusBillofquantitiesVersionsService extends IService<BusBillofquantitiesVersions>{
|
||||
|
||||
/**
|
||||
* 查询工程量清单版本
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 工程量清单版本
|
||||
*/
|
||||
BusBillofquantitiesVersionsVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询工程量清单版本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工程量清单版本分页列表
|
||||
*/
|
||||
TableDataInfo<BusBillofquantitiesVersionsVo> queryPageList(BusBillofquantitiesVersionsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的工程量清单版本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工程量清单版本列表
|
||||
*/
|
||||
List<BusBillofquantitiesVersionsVo> queryList(BusBillofquantitiesVersionsBo bo);
|
||||
|
||||
/**
|
||||
* obtainTheList
|
||||
*
|
||||
* @param bo 工程量清单版本
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BusBillofquantitiesVersionsBo bo);
|
||||
|
||||
/**
|
||||
* 修改工程量清单版本
|
||||
*
|
||||
* @param bo 工程量清单版本
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BusBillofquantitiesVersionsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除工程量清单版本信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 导入excel
|
||||
*/
|
||||
Boolean importExcelFile(ImportExcelFileReq bo, MultipartFile file) throws IOException;
|
||||
|
||||
/**
|
||||
* 获取所有版本号
|
||||
*/
|
||||
TableDataInfo<BusBillofquantitiesVersionsVo> obtainAllVersionNumbers(ObtainAllVersionNumbersReq bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 获取工程量清单
|
||||
*/
|
||||
List<ObtainTheListRes> obtainTheList(ObtainTheListReq bo);
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
package org.dromara.design.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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.springframework.stereotype.Service;
|
||||
import org.dromara.design.domain.bo.BusBillofquantitiesBo;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
import org.dromara.design.domain.BusBillofquantities;
|
||||
import org.dromara.design.mapper.BusBillofquantitiesMapper;
|
||||
import org.dromara.design.service.IBusBillofquantitiesService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 工程量清单Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BusBillofquantitiesServiceImpl extends ServiceImpl<BusBillofquantitiesMapper, BusBillofquantities> implements IBusBillofquantitiesService {
|
||||
|
||||
private final BusBillofquantitiesMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询工程量清单
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 工程量清单
|
||||
*/
|
||||
@Override
|
||||
public BusBillofquantitiesVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询工程量清单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工程量清单分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BusBillofquantitiesVo> queryPageList(BusBillofquantitiesBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<BusBillofquantities> lqw = buildQueryWrapper(bo);
|
||||
Page<BusBillofquantitiesVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的工程量清单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工程量清单列表
|
||||
*/
|
||||
@Override
|
||||
public List<BusBillofquantitiesVo> queryList(BusBillofquantitiesBo bo) {
|
||||
LambdaQueryWrapper<BusBillofquantities> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BusBillofquantities> buildQueryWrapper(BusBillofquantitiesBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<BusBillofquantities> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(BusBillofquantities::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getVersions()), BusBillofquantities::getVersions, bo.getVersions());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSheet()), BusBillofquantities::getSheet, bo.getSheet());
|
||||
lqw.eq(bo.getPid() != null, BusBillofquantities::getPid, bo.getPid());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getNum()), BusBillofquantities::getNum, bo.getNum());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), BusBillofquantities::getName, bo.getName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSpecification()), BusBillofquantities::getSpecification, bo.getSpecification());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), BusBillofquantities::getUnit, bo.getUnit());
|
||||
lqw.eq(bo.getQuantity() != null, BusBillofquantities::getQuantity, bo.getQuantity());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工程量清单
|
||||
*
|
||||
* @param bo 工程量清单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BusBillofquantitiesBo bo) {
|
||||
BusBillofquantities add = MapstructUtils.convert(bo, BusBillofquantities.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工程量清单
|
||||
*
|
||||
* @param bo 工程量清单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BusBillofquantitiesBo bo) {
|
||||
BusBillofquantities update = MapstructUtils.convert(bo, BusBillofquantities.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BusBillofquantities entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除工程量清单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,320 @@
|
||||
package org.dromara.design.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.excel.coryUtils.ExcelReader;
|
||||
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.utils.BatchNumberGenerator;
|
||||
import org.dromara.design.domain.BusBillofquantities;
|
||||
import org.dromara.design.domain.bo.ImportExcelFileReq;
|
||||
import org.dromara.design.domain.bo.ObtainAllVersionNumbersReq;
|
||||
import org.dromara.design.domain.bo.ObtainTheListReq;
|
||||
import org.dromara.design.domain.dto.ObtainTheListRes;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVo;
|
||||
import org.dromara.design.mapper.BusBillofquantitiesMapper;
|
||||
import org.dromara.design.service.IBusBillofquantitiesService;
|
||||
import org.dromara.system.domain.vo.SysOssUploadVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.design.domain.bo.BusBillofquantitiesVersionsBo;
|
||||
import org.dromara.design.domain.vo.BusBillofquantitiesVersionsVo;
|
||||
import org.dromara.design.domain.BusBillofquantitiesVersions;
|
||||
import org.dromara.design.mapper.BusBillofquantitiesVersionsMapper;
|
||||
import org.dromara.design.service.IBusBillofquantitiesVersionsService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.dromara.common.constant.MinioPathConstant.BillOfQuantities;
|
||||
|
||||
/**
|
||||
* 工程量清单版本Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillofquantitiesVersionsMapper, BusBillofquantitiesVersions> implements IBusBillofquantitiesVersionsService {
|
||||
|
||||
private final BusBillofquantitiesVersionsMapper baseMapper;
|
||||
private final IBusBillofquantitiesService busBillofquantitiesService;
|
||||
|
||||
@Autowired
|
||||
private ISysOssService ossService;
|
||||
|
||||
/**
|
||||
* 查询工程量清单版本
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 工程量清单版本
|
||||
*/
|
||||
@Override
|
||||
public BusBillofquantitiesVersionsVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询工程量清单版本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工程量清单版本分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BusBillofquantitiesVersionsVo> queryPageList(BusBillofquantitiesVersionsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<BusBillofquantitiesVersions> lqw = buildQueryWrapper(bo);
|
||||
Page<BusBillofquantitiesVersionsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的工程量清单版本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工程量清单版本列表
|
||||
*/
|
||||
@Override
|
||||
public List<BusBillofquantitiesVersionsVo> queryList(BusBillofquantitiesVersionsBo bo) {
|
||||
LambdaQueryWrapper<BusBillofquantitiesVersions> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BusBillofquantitiesVersions> buildQueryWrapper(BusBillofquantitiesVersionsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<BusBillofquantitiesVersions> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(BusBillofquantitiesVersions::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getWorkOrderType()), BusBillofquantitiesVersions::getWorkOrderType, bo.getWorkOrderType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getVersions()), BusBillofquantitiesVersions::getVersions, bo.getVersions());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工程量清单版本
|
||||
*
|
||||
* @param bo 工程量清单版本
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BusBillofquantitiesVersionsBo bo) {
|
||||
BusBillofquantitiesVersions add = MapstructUtils.convert(bo, BusBillofquantitiesVersions.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工程量清单版本
|
||||
*
|
||||
* @param bo 工程量清单版本
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BusBillofquantitiesVersionsBo bo) {
|
||||
BusBillofquantitiesVersions update = MapstructUtils.convert(bo, BusBillofquantitiesVersions.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BusBillofquantitiesVersions entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除工程量清单版本信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入excel
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean importExcelFile(ImportExcelFileReq bo, MultipartFile file) throws IOException {
|
||||
//0、创建版本
|
||||
// SysOssUploadVo wordEntity = ossService.uploadWithNoSave(file, ossService.minioFileName(BillOfQuantities,file));
|
||||
String banBen = BatchNumberGenerator.generateBatchNumber("GCLBB-");
|
||||
int insert = baseMapper.insert(new BusBillofquantitiesVersions().
|
||||
setWorkOrderType(bo.getWorkOrderType()).
|
||||
setVersions(banBen));
|
||||
if(insert<=0){
|
||||
throw new ServiceException("创建版本失败");
|
||||
}
|
||||
//1、获取到解析数据
|
||||
ExcelReader.ExcelData excelData = ExcelReader.readExcelFromMultipartFile(file);
|
||||
// 2. 解析所有工作表,转换为带父子关系的ExcelMaterial列表 解析所有Sheet数据,按规则生成sid和pid
|
||||
List<BusBillofquantities> allMaterials = new ArrayList<>();
|
||||
for (ExcelReader.SheetData sheetData : excelData.getSheetDataList()) {
|
||||
String sheetName = sheetData.getSheetName();
|
||||
List<List<String>> rowDataList = sheetData.getData();
|
||||
|
||||
// 构建当前Sheet的树形结构(复用ExcelReader的buildTree方法)
|
||||
ExcelReader.TreeNode rootNode = ExcelReader.buildTree(rowDataList);
|
||||
|
||||
// 存储节点映射:TreeNode → ExcelMaterial(用于子节点关联父节点)
|
||||
Map<ExcelReader.TreeNode, BusBillofquantities> nodeMap = new HashMap<>();
|
||||
|
||||
// 递归遍历树形结构,生成sid和pid
|
||||
traverseTree(rootNode, nodeMap, allMaterials, sheetName,banBen);
|
||||
}
|
||||
// 3. 批量插入数据库
|
||||
return busBillofquantitiesService.saveBatch(allMaterials);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<BusBillofquantitiesVersionsVo> obtainAllVersionNumbers(ObtainAllVersionNumbersReq bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<BusBillofquantitiesVersions> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(BusBillofquantitiesVersions::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getWorkOrderType()), BusBillofquantitiesVersions::getWorkOrderType, bo.getWorkOrderType());
|
||||
lqw.last("create_time desc");
|
||||
Page<BusBillofquantitiesVersionsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ObtainTheListRes> obtainTheList(ObtainTheListReq bo) {
|
||||
// 1. 从数据库查询所有符合条件的扁平数据
|
||||
List<ObtainTheListRes> flatList = baseMapper.obtainTheList(bo);
|
||||
if (flatList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 2. 构建父子映射:key=父节点pid,value=该父节点的所有子节点
|
||||
Map<Long, List<ObtainTheListRes>> parentMap = flatList.stream()
|
||||
.collect(Collectors.groupingBy(ObtainTheListRes::getPid));
|
||||
|
||||
// 3. 递归组装树形结构,从顶级节点(pid=0)开始
|
||||
List<ObtainTheListRes> treeList = buildTree(0L, parentMap);
|
||||
|
||||
return treeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归构建树形结构
|
||||
* @param parentId 父节点ID(顶级节点为0)
|
||||
* @param parentMap 父子映射表(key=pid,value=子节点列表)
|
||||
* @return 组装好的子树列表
|
||||
*/
|
||||
private List<ObtainTheListRes> buildTree(Long parentId, Map<Long, List<ObtainTheListRes>> parentMap) {
|
||||
// 获取当前父节点的所有直接子节点
|
||||
List<ObtainTheListRes> children = parentMap.getOrDefault(parentId, Collections.emptyList());
|
||||
if (children.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 为每个子节点递归设置其下一级子节点
|
||||
for (ObtainTheListRes child : children) {
|
||||
// 递归查询当前子节点的子节点,设置为它的子树
|
||||
List<ObtainTheListRes> subChildren = buildTree(child.getId(), parentMap);
|
||||
// 注意:需要在Vo中添加子节点列表字段,用于存储子树
|
||||
child.setChildren(subChildren);
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归遍历树形结构,生成sid和pid
|
||||
* 规则:A列为中文数字(一、二、三...)的节点为顶级节点,pid=0
|
||||
*/
|
||||
private void traverseTree(ExcelReader.TreeNode currentNode,
|
||||
Map<ExcelReader.TreeNode, BusBillofquantities> nodeMap,
|
||||
List<BusBillofquantities> allMaterials,
|
||||
String sheetName,
|
||||
String banBen) {
|
||||
// 跳过空节点(无实际数据的中间节点)
|
||||
if (currentNode.getData().isEmpty()) {
|
||||
for (ExcelReader.TreeNode child : currentNode.getChildren()) {
|
||||
traverseTree(child, nodeMap, allMaterials, sheetName,banBen);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取当前节点A列的值(num)
|
||||
List<String> rowData = currentNode.getData();
|
||||
String aNum = rowData.size() >= 1 ? rowData.get(0).trim() : "";
|
||||
|
||||
// 生成当前节点的sid
|
||||
String sid = BatchNumberGenerator.generateBatchNumber("GCLQD-");
|
||||
|
||||
// 确定pid:顶级节点(A列为中文数字)pid=0,否则pid=父节点的sid
|
||||
String pid = determineParentId(currentNode, aNum, nodeMap);
|
||||
|
||||
// 封装数据到实体类
|
||||
BusBillofquantities material = new BusBillofquantities();
|
||||
material.setSheet(sheetName);
|
||||
material.setSid(sid);
|
||||
material.setPid(pid);
|
||||
material.setNum(aNum);
|
||||
material.setName(rowData.size() >= 2 ? rowData.get(1).trim() : "");
|
||||
material.setUnit(rowData.size() >= 3 ? rowData.get(2).trim() : "");
|
||||
material.setQuantity(Integer.parseInt(rowData.size() >= 4 ? rowData.get(3).trim() : ""));
|
||||
material.setRemark(rowData.size() >= 5 ? rowData.get(4).trim() : "");
|
||||
|
||||
// 存储映射关系(供子节点查询父sid)
|
||||
nodeMap.put(currentNode, material);
|
||||
allMaterials.add(material);
|
||||
|
||||
// 递归处理子节点
|
||||
for (ExcelReader.TreeNode child : currentNode.getChildren()) {
|
||||
traverseTree(child, nodeMap, allMaterials, sheetName,banBen);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定当前节点的pid
|
||||
* 1. 若为顶级节点(A列为中文数字),pid=0
|
||||
* 2. 否则,pid=父节点的sid
|
||||
*/
|
||||
private String determineParentId(ExcelReader.TreeNode currentNode,
|
||||
String aNum,
|
||||
Map<ExcelReader.TreeNode, BusBillofquantities> nodeMap) {
|
||||
// 检查是否为顶级节点(A列为中文数字:一、二、三...)
|
||||
if (aNum.matches(ExcelReader.CHINESE_NUMBERS_REGEX)) {
|
||||
return "0"; // 顶级节点pid固定为0
|
||||
}
|
||||
|
||||
// 非顶级节点:查找父节点的sid
|
||||
// 遍历nodeMap找到当前节点的父节点(通过Tree结构的父子关系反向查找)
|
||||
for (Map.Entry<ExcelReader.TreeNode, BusBillofquantities> entry : nodeMap.entrySet()) {
|
||||
ExcelReader.TreeNode parentNode = entry.getKey();
|
||||
if (parentNode.getChildren().contains(currentNode)) {
|
||||
return entry.getValue().getSid(); // 父节点的sid
|
||||
}
|
||||
}
|
||||
|
||||
// 异常情况:未找到父节点(默认顶级节点处理,避免数据丢失)
|
||||
return "0";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.design.mapper.BusBillofquantitiesMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.design.mapper.BusBillofquantitiesVersionsMapper">
|
||||
|
||||
<select id="obtainTheList" resultType="org.dromara.design.domain.dto.ObtainTheListRes">>
|
||||
select
|
||||
*
|
||||
from
|
||||
bus_billofquantities
|
||||
<where>
|
||||
<if test="versions != null">
|
||||
bo.versions = #{versions}
|
||||
</if>
|
||||
<if test="sheet != null">
|
||||
bo.sheet = #{sheet}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user