新增JeecgBoot BPM流程自动生成器,包含流程创建、修改及审批人配置功能,支持自然语言描述转化为BPMN XML,并通过API与JeecgBoot系统交互。

This commit is contained in:
geht
2026-04-08 16:24:41 +08:00
parent 7c60acd679
commit 67104af7de
168 changed files with 207167 additions and 8 deletions

View File

@@ -103,7 +103,7 @@
<groupId>com.yomahub</groupId>
<artifactId>liteflow-script-graaljs</artifactId>
<version>${liteflow.version}</version>
<scope>provided</scope>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yomahub</groupId>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jeecg-boot-module</artifactId>
<groupId>org.jeecgframework.boot3</groupId>
<version>3.9.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-module-print</artifactId>
<name>jeecg-module-print</name>
<description>可视化打印模板vue-plugin-hiprint</description>
<dependencies>
<dependency>
<groupId>org.jeecgframework.boot3</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,164 @@
package org.jeecg.modules.print.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.print.entity.PrintTemplate;
import org.jeecg.modules.print.service.IPrintTemplateService;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 打印模板维护Hiprint
*/
@Slf4j
@Tag(name = "打印模板")
@RestController
@RequestMapping("/print/template")
public class PrintTemplateController extends JeecgController<PrintTemplate, IPrintTemplateService> {
/**
* 分页列表
*/
@Operation(summary = "打印模板-分页列表")
@GetMapping(value = "/list")
@RequiresPermissions("print:template:list")
public Result<IPage<PrintTemplate>> list(PrintTemplate query,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<PrintTemplate> qw = QueryGenerator.initQueryWrapper(query, req.getParameterMap());
qw.orderByDesc("create_time");
Page<PrintTemplate> page = new Page<>(pageNo, pageSize);
return Result.OK(service.page(page, qw));
}
/**
* 添加
*/
@AutoLog(value = "打印模板-添加")
@Operation(summary = "打印模板-添加")
@PostMapping(value = "/add")
@RequiresPermissions("print:template:add")
public Result<String> add(@RequestBody PrintTemplate entity) {
if (StringUtils.isBlank(entity.getTemplateCode())) {
return Result.error("模板编码不能为空");
}
if (service.getByCode(entity.getTemplateCode()) != null) {
return Result.error("模板编码已存在");
}
if (StringUtils.isBlank(entity.getTemplateJson())) {
entity.setTemplateJson("{}");
}
service.save(entity);
return Result.OK("添加成功");
}
/**
* 编辑(基础字段,不含大 JSON 时可单独调 saveJson
*/
@AutoLog(value = "打印模板-编辑")
@Operation(summary = "打印模板-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
@RequiresPermissions("print:template:edit")
public Result<String> edit(@RequestBody PrintTemplate entity) {
PrintTemplate db = service.getById(entity.getId());
if (db == null) {
return Result.error("记录不存在");
}
if (StringUtils.isNotBlank(entity.getTemplateCode()) && !entity.getTemplateCode().equals(db.getTemplateCode())) {
if (service.getByCode(entity.getTemplateCode()) != null) {
return Result.error("模板编码已存在");
}
}
service.updateById(entity);
return Result.OK("修改成功");
}
/**
* 仅保存 Hiprint 模板 JSON设计器保存
*/
@AutoLog(value = "打印模板-保存JSON")
@Operation(summary = "打印模板-保存模板JSON")
@PostMapping(value = "/saveJson")
@RequiresPermissions("print:template:edit")
public Result<String> saveJson(@RequestBody Map<String, String> body) {
String id = body.get("id");
String templateJson = body.get("templateJson");
if (StringUtils.isBlank(id)) {
return Result.error("id 不能为空");
}
if (templateJson == null) {
return Result.error("templateJson 不能为空");
}
PrintTemplate db = service.getById(id);
if (db == null) {
return Result.error("记录不存在");
}
db.setTemplateJson(templateJson);
service.updateById(db);
return Result.OK("保存成功");
}
/**
* 通过 id 删除
*/
@AutoLog(value = "打印模板-删除")
@Operation(summary = "打印模板-删除")
@DeleteMapping(value = "/delete")
@RequiresPermissions("print:template:delete")
public Result<String> delete(@RequestParam(name = "id") String id) {
service.removeById(id);
return Result.OK("删除成功");
}
/**
* 批量删除
*/
@AutoLog(value = "打印模板-批量删除")
@Operation(summary = "打印模板-批量删除")
@DeleteMapping(value = "/deleteBatch")
@RequiresPermissions("print:template:delete")
public Result<String> deleteBatch(@RequestParam(name = "ids") String ids) {
if (StringUtils.isBlank(ids)) {
return Result.error("参数 ids 不能为空");
}
service.removeByIds(java.util.Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功");
}
/**
* 通过 id 查询
*/
@Operation(summary = "打印模板-通过id查询")
@GetMapping(value = "/queryById")
@RequiresPermissions("print:template:list")
public Result<PrintTemplate> queryById(@RequestParam(name = "id") String id) {
return Result.OK(service.getById(id));
}
/**
* 通过编码查询(业务单据打印时调用)
*/
@Operation(summary = "打印模板-通过编码查询")
@GetMapping(value = "/queryByCode")
@RequiresPermissions("print:template:list")
public Result<PrintTemplate> queryByCode(@RequestParam(name = "code") String code) {
PrintTemplate t = service.getByCode(code);
if (t == null) {
return Result.error("未找到模板: " + code);
}
return Result.OK(t);
}
}

View File

@@ -0,0 +1,63 @@
package org.jeecg.modules.print.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 打印模板Hiprint JSON 存储)
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "打印模板")
@TableName("print_template")
public class PrintTemplate extends JeecgEntity implements Serializable {
@Excel(name = "模板编码", width = 20)
@Schema(description = "模板编码,业务调用唯一标识")
@TableField("template_code")
private String templateCode;
@Excel(name = "模板名称", width = 25)
@Schema(description = "模板名称")
@TableField("template_name")
private String templateName;
@Excel(name = "分类", width = 12)
@Schema(description = "barcode=条码标签 form=表单套打 report=报表")
@TableField("category")
private String category;
@Schema(description = "纸张宽度(mm)")
@TableField("paper_width_mm")
private BigDecimal paperWidthMm;
@Schema(description = "纸张高度(mm)")
@TableField("paper_height_mm")
private BigDecimal paperHeightMm;
@Excel(name = "方向", width = 10)
@Schema(description = "portrait 纵向 landscape 横向")
@TableField("paper_orientation")
private String paperOrientation;
@Schema(description = "Hiprint 模板 JSON")
@TableField("template_json")
private String templateJson;
@Excel(name = "备注", width = 30)
@Schema(description = "备注")
@TableField("remark")
private String remark;
}

View File

@@ -0,0 +1,10 @@
package org.jeecg.modules.print.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.print.entity.PrintTemplate;
/**
* 打印模板 Mapper
*/
public interface PrintTemplateMapper extends BaseMapper<PrintTemplate> {
}

View File

@@ -0,0 +1,15 @@
package org.jeecg.modules.print.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.print.entity.PrintTemplate;
/**
* 打印模板 Service
*/
public interface IPrintTemplateService extends IService<PrintTemplate> {
/**
* 按编码查询(未删除)
*/
PrintTemplate getByCode(String templateCode);
}

View File

@@ -0,0 +1,23 @@
package org.jeecg.modules.print.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.print.entity.PrintTemplate;
import org.jeecg.modules.print.mapper.PrintTemplateMapper;
import org.jeecg.modules.print.service.IPrintTemplateService;
import org.springframework.stereotype.Service;
/**
* 打印模板 Service 实现
*/
@Service
public class PrintTemplateServiceImpl extends ServiceImpl<PrintTemplateMapper, PrintTemplate> implements IPrintTemplateService {
@Override
public PrintTemplate getByCode(String templateCode) {
LambdaQueryWrapper<PrintTemplate> q = new LambdaQueryWrapper<>();
q.eq(PrintTemplate::getTemplateCode, templateCode);
q.last("LIMIT 1");
return getOne(q);
}
}

View File

@@ -15,6 +15,7 @@
<modules>
<module>jeecg-module-demo</module>
<module>jeecg-boot-module-airag</module>
<module>jeecg-module-print</module>
</modules>