feat(wms): 新增报表导出文件管理功能
新增报表导出文件管理模块,包含后端接口和前端页面 在各类报表页面添加保存报表功能 优化CoilSelector和CoilCard组件显示 调整分页大小和表格高度 统一各产线报表配置 修复文件预览组件高度问题
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.domain.vo.ReportExportFileVo;
|
||||
import com.klp.domain.bo.ReportExportFileBo;
|
||||
import com.klp.service.IReportExportFileService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 报导出文件
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-04-11
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/exportFile")
|
||||
public class ReportExportFileController extends BaseController {
|
||||
|
||||
private final IReportExportFileService iReportExportFileService;
|
||||
|
||||
/**
|
||||
* 查询报导出文件列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ReportExportFileVo> list(ReportExportFileBo bo, PageQuery pageQuery) {
|
||||
return iReportExportFileService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出报导出文件列表
|
||||
*/
|
||||
@Log(title = "报导出文件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ReportExportFileBo bo, HttpServletResponse response) {
|
||||
List<ReportExportFileVo> list = iReportExportFileService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "报导出文件", ReportExportFileVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报导出文件详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<ReportExportFileVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(iReportExportFileService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报导出文件
|
||||
*/
|
||||
@Log(title = "报导出文件", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ReportExportFileBo bo) {
|
||||
return toAjax(iReportExportFileService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报导出文件
|
||||
*/
|
||||
@Log(title = "报导出文件", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ReportExportFileBo bo) {
|
||||
return toAjax(iReportExportFileService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报导出文件
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@Log(title = "报导出文件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iReportExportFileService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
}
|
||||
65
klp-wms/src/main/java/com/klp/domain/ReportExportFile.java
Normal file
65
klp-wms/src/main/java/com/klp/domain/ReportExportFile.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 报导出文件对象 report_export_file
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-04-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("report_export_file")
|
||||
public class ReportExportFile extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 报表标题
|
||||
*/
|
||||
private String reportTitle;
|
||||
/**
|
||||
* 报表名称(唯一)
|
||||
*/
|
||||
private String reportName;
|
||||
/**
|
||||
* 报表查询参数(JSON格式)
|
||||
*/
|
||||
private String reportParams;
|
||||
/**
|
||||
* 相关产线
|
||||
*/
|
||||
private String productionLine;
|
||||
/**
|
||||
* 附件(文件存储路径/URL)
|
||||
*/
|
||||
private String attachment;
|
||||
/**
|
||||
* 附件ID
|
||||
*/
|
||||
private String ossId;
|
||||
/**
|
||||
* 报表类型(如:Excel/PDF/Word)
|
||||
*/
|
||||
private String reportType;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标志 0-未删除 1-已删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 报导出文件业务对象 report_export_file
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-04-11
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ReportExportFileBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报表标题
|
||||
*/
|
||||
@NotBlank(message = "报表标题不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String reportTitle;
|
||||
|
||||
/**
|
||||
* 报表名称(唯一)
|
||||
*/
|
||||
@NotBlank(message = "报表名称(唯一)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 报表查询参数(JSON格式)
|
||||
*/
|
||||
private String reportParams;
|
||||
|
||||
private String productionLine;
|
||||
|
||||
/**
|
||||
* 附件ID
|
||||
*/
|
||||
@NotBlank(message = "附件ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String ossId;
|
||||
|
||||
/**
|
||||
* 附件(文件存储路径/URL)
|
||||
*/
|
||||
@NotBlank(message = "附件不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String attachment;
|
||||
|
||||
/**
|
||||
* 报表类型(如:日报表/月报表/年报表)
|
||||
*/
|
||||
@NotBlank(message = "报表类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String reportType;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.klp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 报导出文件视图对象 report_export_file
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-04-11
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ReportExportFileVo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报表标题
|
||||
*/
|
||||
@ExcelProperty(value = "报表标题")
|
||||
private String reportTitle;
|
||||
|
||||
/**
|
||||
* 报表名称(唯一)
|
||||
*/
|
||||
@ExcelProperty(value = "报表名称(唯一)")
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 报表查询参数(JSON格式)
|
||||
*/
|
||||
@ExcelProperty(value = "报表查询参数(JSON格式)")
|
||||
private String reportParams;
|
||||
|
||||
/**
|
||||
* 相关产线
|
||||
*/
|
||||
@ExcelProperty(value = "相关产线")
|
||||
private String productionLine;
|
||||
|
||||
/**
|
||||
* 附件ID
|
||||
*/
|
||||
private String ossId;
|
||||
|
||||
/**
|
||||
* 附件(文件存储路径/URL)
|
||||
*/
|
||||
@ExcelProperty(value = "附件(文件存储路径/URL)")
|
||||
private String attachment;
|
||||
|
||||
/**
|
||||
* 报表类型(如:Excel/PDF/Word)
|
||||
*/
|
||||
@ExcelProperty(value = "报表类型(如:Excel/PDF/Word)")
|
||||
private String reportType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.ReportExportFile;
|
||||
import com.klp.domain.vo.ReportExportFileVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 报导出文件Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-04-11
|
||||
*/
|
||||
public interface ReportExportFileMapper extends BaseMapperPlus<ReportExportFileMapper, ReportExportFile, ReportExportFileVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.ReportExportFile;
|
||||
import com.klp.domain.vo.ReportExportFileVo;
|
||||
import com.klp.domain.bo.ReportExportFileBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报导出文件Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-04-11
|
||||
*/
|
||||
public interface IReportExportFileService {
|
||||
|
||||
/**
|
||||
* 查询报导出文件
|
||||
*/
|
||||
ReportExportFileVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询报导出文件列表
|
||||
*/
|
||||
TableDataInfo<ReportExportFileVo> queryPageList(ReportExportFileBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询报导出文件列表
|
||||
*/
|
||||
List<ReportExportFileVo> queryList(ReportExportFileBo bo);
|
||||
|
||||
/**
|
||||
* 新增报导出文件
|
||||
*/
|
||||
Boolean insertByBo(ReportExportFileBo bo);
|
||||
|
||||
/**
|
||||
* 修改报导出文件
|
||||
*/
|
||||
Boolean updateByBo(ReportExportFileBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除报导出文件信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.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 com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.ReportExportFileBo;
|
||||
import com.klp.domain.vo.ReportExportFileVo;
|
||||
import com.klp.domain.ReportExportFile;
|
||||
import com.klp.mapper.ReportExportFileMapper;
|
||||
import com.klp.service.IReportExportFileService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 报导出文件Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-04-11
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ReportExportFileServiceImpl implements IReportExportFileService {
|
||||
|
||||
private final ReportExportFileMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询报导出文件
|
||||
*/
|
||||
@Override
|
||||
public ReportExportFileVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询报导出文件列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ReportExportFileVo> queryPageList(ReportExportFileBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<ReportExportFile> lqw = buildQueryWrapper(bo);
|
||||
Page<ReportExportFileVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询报导出文件列表
|
||||
*/
|
||||
@Override
|
||||
public List<ReportExportFileVo> queryList(ReportExportFileBo bo) {
|
||||
LambdaQueryWrapper<ReportExportFile> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ReportExportFile> buildQueryWrapper(ReportExportFileBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<ReportExportFile> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getReportTitle()), ReportExportFile::getReportTitle, bo.getReportTitle());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getReportName()), ReportExportFile::getReportName, bo.getReportName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReportParams()), ReportExportFile::getReportParams, bo.getReportParams());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getProductionLine()), ReportExportFile::getProductionLine, bo.getProductionLine());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getAttachment()), ReportExportFile::getAttachment, bo.getAttachment());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getReportType()), ReportExportFile::getReportType, bo.getReportType());
|
||||
lqw.orderByDesc(ReportExportFile::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报导出文件
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(ReportExportFileBo bo) {
|
||||
ReportExportFile add = BeanUtil.toBean(bo, ReportExportFile.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报导出文件
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(ReportExportFileBo bo) {
|
||||
ReportExportFile update = BeanUtil.toBean(bo, ReportExportFile.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ReportExportFile entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除报导出文件
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user