新增习讲话树形表单,新增对发起流程中间表的写接口,待测试
This commit is contained in:
+298
@@ -0,0 +1,298 @@
|
||||
package org.jeecg.modules.bg.xispeak.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||
import org.jeecg.modules.bg.xispeak.service.IBgXiSpeakService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 习总书记重要讲话指示批示情况
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="习总书记重要讲话指示批示情况")
|
||||
@RestController
|
||||
@RequestMapping("/bg/xispeak/bgXiSpeak")
|
||||
@Slf4j
|
||||
public class BgXiSpeakController extends JeecgController<BgXiSpeak, IBgXiSpeakService>{
|
||||
@Autowired
|
||||
private IBgXiSpeakService bgXiSpeakService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param bgXiSpeak
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "习总书记重要讲话指示批示情况-分页列表查询")
|
||||
@Operation(summary="习总书记重要讲话指示批示情况-分页列表查询")
|
||||
@GetMapping(value = "/rootList")
|
||||
public Result<IPage<BgXiSpeak>> queryPageList(BgXiSpeak bgXiSpeak,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
String hasQuery = req.getParameter("hasQuery");
|
||||
if(hasQuery != null && "true".equals(hasQuery)){
|
||||
QueryWrapper<BgXiSpeak> queryWrapper = QueryGenerator.initQueryWrapper(bgXiSpeak, req.getParameterMap());
|
||||
List<BgXiSpeak> list = bgXiSpeakService.queryTreeListNoPage(queryWrapper);
|
||||
IPage<BgXiSpeak> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}else{
|
||||
String parentId = bgXiSpeak.getPid();
|
||||
if (oConvertUtils.isEmpty(parentId)) {
|
||||
parentId = "0";
|
||||
}
|
||||
bgXiSpeak.setPid(null);
|
||||
QueryWrapper<BgXiSpeak> queryWrapper = QueryGenerator.initQueryWrapper(bgXiSpeak, req.getParameterMap());
|
||||
// 使用 eq 防止模糊查询
|
||||
queryWrapper.eq("pid", parentId);
|
||||
Page<BgXiSpeak> page = new Page<BgXiSpeak>(pageNo, pageSize);
|
||||
IPage<BgXiSpeak> pageList = bgXiSpeakService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】加载节点的子数据
|
||||
*
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET)
|
||||
public Result<List<SelectTreeModel>> loadTreeChildren(@RequestParam(name = "pid") String pid) {
|
||||
Result<List<SelectTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<SelectTreeModel> ls = bgXiSpeakService.queryListByPid(pid);
|
||||
result.setResult(ls);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.setMessage(e.getMessage());
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】加载一级节点/如果是同步 则所有数据
|
||||
*
|
||||
* @param async
|
||||
* @param pcode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET)
|
||||
public Result<List<SelectTreeModel>> loadTreeRoot(@RequestParam(name = "async") Boolean async, @RequestParam(name = "pcode") String pcode) {
|
||||
Result<List<SelectTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<SelectTreeModel> ls = bgXiSpeakService.queryListByCode(pcode);
|
||||
if (!async) {
|
||||
loadAllChildren(ls);
|
||||
}
|
||||
result.setResult(ls);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.setMessage(e.getMessage());
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】递归求子节点 同步加载用到
|
||||
*
|
||||
* @param ls
|
||||
*/
|
||||
private void loadAllChildren(List<SelectTreeModel> ls) {
|
||||
for (SelectTreeModel tsm : ls) {
|
||||
List<SelectTreeModel> temp = bgXiSpeakService.queryListByPid(tsm.getKey());
|
||||
if (temp != null && temp.size() > 0) {
|
||||
tsm.setChildren(temp);
|
||||
loadAllChildren(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子数据
|
||||
* @param bgXiSpeak
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "习总书记重要讲话指示批示情况-获取子数据")
|
||||
@Operation(summary="习总书记重要讲话指示批示情况-获取子数据")
|
||||
@GetMapping(value = "/childList")
|
||||
public Result<IPage<BgXiSpeak>> queryPageList(BgXiSpeak bgXiSpeak,HttpServletRequest req) {
|
||||
QueryWrapper<BgXiSpeak> queryWrapper = QueryGenerator.initQueryWrapper(bgXiSpeak, req.getParameterMap());
|
||||
List<BgXiSpeak> list = bgXiSpeakService.list(queryWrapper);
|
||||
IPage<BgXiSpeak> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询子节点
|
||||
* @param parentIds 父ID(多个采用半角逗号分割)
|
||||
* @return 返回 IPage
|
||||
* @param parentIds
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "习总书记重要讲话指示批示情况-批量获取子数据")
|
||||
@Operation(summary="习总书记重要讲话指示批示情况-批量获取子数据")
|
||||
@GetMapping("/getChildListBatch")
|
||||
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) {
|
||||
try {
|
||||
QueryWrapper<BgXiSpeak> queryWrapper = new QueryWrapper<>();
|
||||
List<String> parentIdList = Arrays.asList(parentIds.split(","));
|
||||
queryWrapper.in("pid", parentIdList);
|
||||
List<BgXiSpeak> list = bgXiSpeakService.list(queryWrapper);
|
||||
IPage<BgXiSpeak> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("批量查询子节点失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bgXiSpeak
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "习总书记重要讲话指示批示情况-添加")
|
||||
@Operation(summary="习总书记重要讲话指示批示情况-添加")
|
||||
@RequiresPermissions("bg.xispeak:bg_xi_speak:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody BgXiSpeak bgXiSpeak) {
|
||||
bgXiSpeakService.addBgXiSpeak(bgXiSpeak);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param bgXiSpeak
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "习总书记重要讲话指示批示情况-编辑")
|
||||
@Operation(summary="习总书记重要讲话指示批示情况-编辑")
|
||||
@RequiresPermissions("bg.xispeak:bg_xi_speak:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody BgXiSpeak bgXiSpeak) {
|
||||
bgXiSpeakService.updateBgXiSpeak(bgXiSpeak);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "习总书记重要讲话指示批示情况-通过id删除")
|
||||
@Operation(summary="习总书记重要讲话指示批示情况-通过id删除")
|
||||
@RequiresPermissions("bg.xispeak:bg_xi_speak:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
bgXiSpeakService.deleteBgXiSpeak(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "习总书记重要讲话指示批示情况-批量删除")
|
||||
@Operation(summary="习总书记重要讲话指示批示情况-批量删除")
|
||||
@RequiresPermissions("bg.xispeak:bg_xi_speak:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.bgXiSpeakService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "习总书记重要讲话指示批示情况-通过id查询")
|
||||
@Operation(summary="习总书记重要讲话指示批示情况-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<BgXiSpeak> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BgXiSpeak bgXiSpeak = bgXiSpeakService.getById(id);
|
||||
if(bgXiSpeak==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bgXiSpeak);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param bgXiSpeak
|
||||
*/
|
||||
@RequiresPermissions("bg.xispeak:bg_xi_speak:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, BgXiSpeak bgXiSpeak) {
|
||||
return super.exportXls(request, bgXiSpeak, BgXiSpeak.class, "习总书记重要讲话指示批示情况");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("bg.xispeak:bg_xi_speak:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, BgXiSpeak.class);
|
||||
}
|
||||
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
package org.jeecg.modules.bg.xispeak.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: 习总书记重要讲话指示批示情况
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("bg_xi_speak")
|
||||
@Schema(description="习总书记重要讲话指示批示情况")
|
||||
public class BgXiSpeak implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**父级节点*/
|
||||
@Excel(name = "父级节点", width = 15)
|
||||
@Schema(description = "父级节点")
|
||||
private java.lang.String pid;
|
||||
/**是否有子节点*/
|
||||
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
|
||||
@Dict(dicCode = "yn")
|
||||
@Schema(description = "是否有子节点")
|
||||
private java.lang.String hasChild;
|
||||
/**习近平总书记重要讲话指示批示情况*/
|
||||
@Excel(name = "习近平总书记重要讲话指示批示情况", width = 15)
|
||||
@Schema(description = "习近平总书记重要讲话指示批示情况")
|
||||
private java.lang.String speakStatus;
|
||||
/**时间*/
|
||||
@Excel(name = "时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@Schema(description = "时间")
|
||||
private java.util.Date time;
|
||||
/**企业负责同志批示情况*/
|
||||
@Excel(name = "企业负责同志批示情况", width = 15)
|
||||
@Schema(description = "企业负责同志批示情况")
|
||||
private java.lang.String elmComment;
|
||||
/**学习传达研究部署情况*/
|
||||
@Excel(name = "学习传达研究部署情况", width = 15)
|
||||
@Schema(description = "学习传达研究部署情况")
|
||||
private java.lang.String status;
|
||||
/**责任人*/
|
||||
@Excel(name = "责任人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||
@Schema(description = "责任人")
|
||||
private java.lang.String responsiblePerson;
|
||||
/**落实方案*/
|
||||
@Excel(name = "落实方案", width = 15)
|
||||
@Schema(description = "落实方案")
|
||||
private java.lang.String implPlan;
|
||||
/**牵头部门*/
|
||||
@Excel(name = "牵头部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
|
||||
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
|
||||
@Schema(description = "牵头部门")
|
||||
private java.lang.String leadDepartment;
|
||||
/**贯彻落实措施*/
|
||||
@Excel(name = "贯彻落实措施", width = 15)
|
||||
@Schema(description = "贯彻落实措施")
|
||||
private java.lang.String implMeasures;
|
||||
/**会议决策数*/
|
||||
@Excel(name = "会议决策数", width = 15)
|
||||
@Schema(description = "会议决策数")
|
||||
private java.lang.Integer numberOfResolutions;
|
||||
/**落实情况*/
|
||||
@Excel(name = "落实情况", width = 15)
|
||||
@Schema(description = "落实情况")
|
||||
private java.lang.String implStatus;
|
||||
/**落实条数*/
|
||||
@Excel(name = "落实条数", width = 15)
|
||||
@Schema(description = "落实条数")
|
||||
private java.lang.Integer implCount;
|
||||
/**已闭环数量*/
|
||||
@Excel(name = "已闭环数量", width = 15)
|
||||
@Schema(description = "已闭环数量")
|
||||
private java.lang.Integer closedCount;
|
||||
/**报告反馈情况*/
|
||||
@Excel(name = "报告反馈情况", width = 15)
|
||||
@Schema(description = "报告反馈情况")
|
||||
private java.lang.String reportFeedbackStatus;
|
||||
/**是否存在完成风险(0不存在,1存在)*/
|
||||
@Excel(name = "是否存在完成风险(0不存在,1存在)", width = 15)
|
||||
@Schema(description = "是否存在完成风险(0不存在,1存在)")
|
||||
private java.lang.Integer isCompletionRisk;
|
||||
/**拖期风险应对措施*/
|
||||
@Excel(name = "拖期风险应对措施", width = 15)
|
||||
@Schema(description = "拖期风险应对措施")
|
||||
private java.lang.String delayRiskMitigation;
|
||||
/**完成状态(0推进中,1已完成)*/
|
||||
@Excel(name = "完成状态(0推进中,1已完成)", width = 15)
|
||||
@Schema(description = "完成状态(0推进中,1已完成)")
|
||||
private java.lang.Integer completionStatus;
|
||||
/**落实部门id*/
|
||||
@Excel(name = "落实部门id", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
|
||||
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
|
||||
@Schema(description = "落实部门id")
|
||||
private java.lang.String implDept;
|
||||
/**层深(最顶层节点层深为0)*/
|
||||
@Excel(name = "层深(最顶层节点层深为0)", width = 15)
|
||||
@Schema(description = "层深(最顶层节点层深为0)")
|
||||
private java.lang.Integer treeDepth;
|
||||
/**同级数据排序号*/
|
||||
@Excel(name = "同级数据排序号", width = 15)
|
||||
@Schema(description = "同级数据排序号")
|
||||
private java.lang.Integer sortOrder;
|
||||
/**逻辑删除flag(0保留,1删除)*/
|
||||
@Excel(name = "逻辑删除flag(0保留,1删除)", width = 15)
|
||||
@Schema(description = "逻辑删除flag(0保留,1删除)")
|
||||
@TableLogic
|
||||
private java.lang.Integer delFlag;
|
||||
/**流程引擎状态字段*/
|
||||
@Excel(name = "流程引擎状态字段", width = 15)
|
||||
@Schema(description = "流程引擎状态字段")
|
||||
private java.lang.Integer bpmStatus;
|
||||
/**督办次数*/
|
||||
@Excel(name = "督办次数", width = 15)
|
||||
@Schema(description = "督办次数")
|
||||
private java.lang.Integer supervisionCount;
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package org.jeecg.modules.bg.xispeak.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 习总书记重要讲话指示批示情况
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface BgXiSpeakMapper extends BaseMapper<BgXiSpeak> {
|
||||
|
||||
/**
|
||||
* 编辑节点状态
|
||||
* @param id
|
||||
* @param status
|
||||
*/
|
||||
void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据父级ID查询树节点数据
|
||||
*
|
||||
* @param pid
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByPid(@Param("pid") String pid, @Param("query") Map<String, String> query);
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?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.jeecg.modules.bg.xispeak.mapper.BgXiSpeakMapper">
|
||||
|
||||
<update id="updateTreeNodeStatus" parameterType="java.lang.String">
|
||||
update bg_xi_speak set has_child = #{status} where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 【vue3专用】 -->
|
||||
<select id="queryListByPid" parameterType="java.lang.Object" resultType="org.jeecg.common.system.vo.SelectTreeModel">
|
||||
select
|
||||
id as "key",
|
||||
impl_status as "title",
|
||||
(case when has_child = '1' then 0 else 1 end) as isLeaf,
|
||||
pid as parentId
|
||||
from bg_xi_speak
|
||||
where pid = #{pid}
|
||||
<if test="query != null">
|
||||
<foreach collection="query.entrySet()" item="value" index="key">
|
||||
and ${key} = #{value}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package org.jeecg.modules.bg.xispeak.service;
|
||||
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 习总书记重要讲话指示批示情况
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBgXiSpeakService extends IService<BgXiSpeak> {
|
||||
|
||||
/**根节点父ID的值*/
|
||||
public static final String ROOT_PID_VALUE = "0";
|
||||
|
||||
/**树节点有子节点状态值*/
|
||||
public static final String HASCHILD = "1";
|
||||
|
||||
/**树节点无子节点状态值*/
|
||||
public static final String NOCHILD = "0";
|
||||
|
||||
/**
|
||||
* 新增节点
|
||||
*
|
||||
* @param bgXiSpeak
|
||||
*/
|
||||
void addBgXiSpeak(BgXiSpeak bgXiSpeak);
|
||||
|
||||
/**
|
||||
* 修改节点
|
||||
*
|
||||
* @param bgXiSpeak
|
||||
* @throws JeecgBootException
|
||||
*/
|
||||
void updateBgXiSpeak(BgXiSpeak bgXiSpeak) throws JeecgBootException;
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*
|
||||
* @param id
|
||||
* @throws JeecgBootException
|
||||
*/
|
||||
void deleteBgXiSpeak(String id) throws JeecgBootException;
|
||||
|
||||
/**
|
||||
* 查询所有数据,无分页
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @return List<BgXiSpeak>
|
||||
*/
|
||||
List<BgXiSpeak> queryTreeListNoPage(QueryWrapper<BgXiSpeak> queryWrapper);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据父级编码加载分类字典的数据
|
||||
*
|
||||
* @param parentCode
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByCode(String parentCode);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据pid查询子节点集合
|
||||
*
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByPid(String pid);
|
||||
|
||||
}
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
package org.jeecg.modules.bg.xispeak.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||
import org.jeecg.modules.bg.xispeak.mapper.BgXiSpeakMapper;
|
||||
import org.jeecg.modules.bg.xispeak.service.IBgXiSpeakService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 习总书记重要讲话指示批示情况
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BgXiSpeakServiceImpl extends ServiceImpl<BgXiSpeakMapper, BgXiSpeak> implements IBgXiSpeakService {
|
||||
|
||||
@Override
|
||||
public void addBgXiSpeak(BgXiSpeak bgXiSpeak) {
|
||||
//新增时设置hasChild为0
|
||||
bgXiSpeak.setHasChild(IBgXiSpeakService.NOCHILD);
|
||||
if(oConvertUtils.isEmpty(bgXiSpeak.getPid())){
|
||||
bgXiSpeak.setPid(IBgXiSpeakService.ROOT_PID_VALUE);
|
||||
}else{
|
||||
//如果当前节点父ID不为空 则设置父节点的hasChildren 为1
|
||||
BgXiSpeak parent = baseMapper.selectById(bgXiSpeak.getPid());
|
||||
if(parent!=null && !"1".equals(parent.getHasChild())){
|
||||
parent.setHasChild("1");
|
||||
baseMapper.updateById(parent);
|
||||
}
|
||||
}
|
||||
baseMapper.insert(bgXiSpeak);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBgXiSpeak(BgXiSpeak bgXiSpeak) {
|
||||
BgXiSpeak entity = this.getById(bgXiSpeak.getId());
|
||||
if(entity==null) {
|
||||
throw new JeecgBootException("未找到对应实体");
|
||||
}
|
||||
String old_pid = entity.getPid();
|
||||
String new_pid = bgXiSpeak.getPid();
|
||||
if(!old_pid.equals(new_pid)) {
|
||||
updateOldParentNode(old_pid);
|
||||
if(oConvertUtils.isEmpty(new_pid)){
|
||||
bgXiSpeak.setPid(IBgXiSpeakService.ROOT_PID_VALUE);
|
||||
}
|
||||
if(!IBgXiSpeakService.ROOT_PID_VALUE.equals(bgXiSpeak.getPid())) {
|
||||
baseMapper.updateTreeNodeStatus(bgXiSpeak.getPid(), IBgXiSpeakService.HASCHILD);
|
||||
}
|
||||
}
|
||||
baseMapper.updateById(bgXiSpeak);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteBgXiSpeak(String id) throws JeecgBootException {
|
||||
//查询选中节点下所有子节点一并删除
|
||||
id = this.queryTreeChildIds(id);
|
||||
if(id.indexOf(",")>0) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String[] idArr = id.split(",");
|
||||
for (String idVal : idArr) {
|
||||
if(idVal != null){
|
||||
BgXiSpeak bgXiSpeak = this.getById(idVal);
|
||||
String pidVal = bgXiSpeak.getPid();
|
||||
//查询此节点上一级是否还有其他子节点
|
||||
List<BgXiSpeak> dataList = baseMapper.selectList(new QueryWrapper<BgXiSpeak>().eq("pid", pidVal).notIn("id",Arrays.asList(idArr)));
|
||||
boolean flag = (dataList == null || dataList.size() == 0) && !Arrays.asList(idArr).contains(pidVal) && !sb.toString().contains(pidVal);
|
||||
if(flag){
|
||||
//如果当前节点原本有子节点 现在木有了,更新状态
|
||||
sb.append(pidVal).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
//批量删除节点
|
||||
baseMapper.deleteBatchIds(Arrays.asList(idArr));
|
||||
//修改已无子节点的标识
|
||||
String[] pidArr = sb.toString().split(",");
|
||||
for(String pid : pidArr){
|
||||
this.updateOldParentNode(pid);
|
||||
}
|
||||
}else{
|
||||
BgXiSpeak bgXiSpeak = this.getById(id);
|
||||
if(bgXiSpeak==null) {
|
||||
throw new JeecgBootException("未找到对应实体");
|
||||
}
|
||||
updateOldParentNode(bgXiSpeak.getPid());
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BgXiSpeak> queryTreeListNoPage(QueryWrapper<BgXiSpeak> queryWrapper) {
|
||||
List<BgXiSpeak> dataList = baseMapper.selectList(queryWrapper);
|
||||
List<BgXiSpeak> mapList = new ArrayList<>();
|
||||
for(BgXiSpeak data : dataList){
|
||||
String pidVal = data.getPid();
|
||||
//递归查询子节点的根节点
|
||||
if(pidVal != null && !IBgXiSpeakService.NOCHILD.equals(pidVal)){
|
||||
BgXiSpeak rootVal = this.getTreeRoot(pidVal);
|
||||
if(rootVal != null && !mapList.contains(rootVal)){
|
||||
mapList.add(rootVal);
|
||||
}
|
||||
}else{
|
||||
if(!mapList.contains(data)){
|
||||
mapList.add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectTreeModel> queryListByCode(String parentCode) {
|
||||
String pid = ROOT_PID_VALUE;
|
||||
if (oConvertUtils.isNotEmpty(parentCode)) {
|
||||
LambdaQueryWrapper<BgXiSpeak> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BgXiSpeak::getPid, parentCode);
|
||||
List<BgXiSpeak> list = baseMapper.selectList(queryWrapper);
|
||||
if (list == null || list.size() == 0) {
|
||||
throw new JeecgBootException("该编码【" + parentCode + "】不存在,请核实!");
|
||||
}
|
||||
if (list.size() > 1) {
|
||||
throw new JeecgBootException("该编码【" + parentCode + "】存在多个,请核实!");
|
||||
}
|
||||
pid = list.get(0).getId();
|
||||
}
|
||||
return baseMapper.queryListByPid(pid, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectTreeModel> queryListByPid(String pid) {
|
||||
if (oConvertUtils.isEmpty(pid)) {
|
||||
pid = ROOT_PID_VALUE;
|
||||
}
|
||||
return baseMapper.queryListByPid(pid, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据所传pid查询旧的父级节点的子节点并修改相应状态值
|
||||
* @param pid
|
||||
*/
|
||||
private void updateOldParentNode(String pid) {
|
||||
if(!IBgXiSpeakService.ROOT_PID_VALUE.equals(pid)) {
|
||||
Long count = baseMapper.selectCount(new QueryWrapper<BgXiSpeak>().eq("pid", pid));
|
||||
if(count==null || count<=1) {
|
||||
baseMapper.updateTreeNodeStatus(pid, IBgXiSpeakService.NOCHILD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询节点的根节点
|
||||
* @param pidVal
|
||||
* @return
|
||||
*/
|
||||
private BgXiSpeak getTreeRoot(String pidVal){
|
||||
BgXiSpeak data = baseMapper.selectById(pidVal);
|
||||
if(data != null && !IBgXiSpeakService.ROOT_PID_VALUE.equals(data.getPid())){
|
||||
return this.getTreeRoot(data.getPid());
|
||||
}else{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询所有子节点id
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
private String queryTreeChildIds(String ids) {
|
||||
//获取id数组
|
||||
String[] idArr = ids.split(",");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (String pidVal : idArr) {
|
||||
if(pidVal != null){
|
||||
if(!sb.toString().contains(pidVal)){
|
||||
if(sb.toString().length() > 0){
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(pidVal);
|
||||
this.getTreeChildIds(pidVal,sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询所有子节点
|
||||
* @param pidVal
|
||||
* @param sb
|
||||
* @return
|
||||
*/
|
||||
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){
|
||||
List<BgXiSpeak> dataList = baseMapper.selectList(new QueryWrapper<BgXiSpeak>().eq("pid", pidVal));
|
||||
if(dataList != null && dataList.size()>0){
|
||||
for(BgXiSpeak tree : dataList) {
|
||||
if(!sb.toString().contains(tree.getId())){
|
||||
sb.append(",").append(tree.getId());
|
||||
}
|
||||
this.getTreeChildIds(tree.getId(),sb);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package org.jeecg.modules.tasktask.constant;
|
||||
|
||||
public final class FlowConstants {
|
||||
private FlowConstants() {
|
||||
}
|
||||
public static final class Strategy {
|
||||
/** 立即发起 */
|
||||
public static final Integer IMMEDIATE_ONLY = 1;
|
||||
|
||||
/** 周期发起 */
|
||||
public static final Integer RECURRING_ONLY = 2;
|
||||
|
||||
/** 延迟发起 */
|
||||
public static final Integer IMMEDIATE_AND_RECURRING = 3;
|
||||
}
|
||||
public static final class IntervalType {
|
||||
/**
|
||||
* 每天
|
||||
*/
|
||||
public static final Integer EVERY_DAY = 1;
|
||||
/**
|
||||
* 每周
|
||||
*/
|
||||
public static final Integer EVERY_WEEK = 2;
|
||||
/**
|
||||
* 每两周
|
||||
*/
|
||||
public static final Integer EVERY_TWO_WEEKS = 3;
|
||||
/**
|
||||
* 每月
|
||||
*/
|
||||
public static final Integer EVERY_MONTH = 4;
|
||||
/**
|
||||
* 每季
|
||||
*/
|
||||
public static final Integer EVERY_QUARTER = 5;
|
||||
}
|
||||
public static final class taskCount{
|
||||
public static final Integer MAX = 24;
|
||||
public static final Integer MIN = 0;
|
||||
}
|
||||
}
|
||||
+82
-4
@@ -1,20 +1,25 @@
|
||||
package org.jeecg.modules.tasktask.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.extbpm.process.service.impl.BpmBaseExtApiImpl;
|
||||
import org.jeecg.modules.tasktask.constant.FlowConstants;
|
||||
import org.jeecg.modules.tasktask.entity.TaskTask;
|
||||
import org.jeecg.modules.tasktask.mapper.TaskTaskMapper;
|
||||
import org.jeecg.modules.tasktask.service.ITaskTaskService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -28,6 +33,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -38,6 +44,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 事项任务计划表(发起流程)
|
||||
* @Author: jeecg-boot
|
||||
@@ -97,6 +104,77 @@ public class TaskTaskController extends JeecgController<TaskTask, ITaskTaskServi
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param taskTask
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "事项任务计划表(发起周期性流程)-添加")
|
||||
@Operation(summary = "事项任务计划表(发起周期性流程)-添加")
|
||||
@RequiresPermissions("tasktask:task_task:add")
|
||||
@PostMapping(value = "/flow-schedules")
|
||||
public Result<String> addRecurringTask(@RequestBody TaskTask taskTask,
|
||||
@RequestParam(name = "intervalType", required = false) Integer intervalType,
|
||||
@RequestParam(name = "startCount", required = false) Integer startCount) throws Exception {
|
||||
if (taskTask.getTriggerType() == null) {
|
||||
return Result.error("触发类型不能为空");
|
||||
}
|
||||
Integer triggerType = taskTask.getTriggerType();
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser.getUsername() == null || sysUser.getUsername().isEmpty()) {
|
||||
return Result.error("无法获取当前流程发起人信息");
|
||||
}
|
||||
if (startCount > FlowConstants.taskCount.MAX) return Result.error("单词生成周期任务不能超过100个");
|
||||
|
||||
if (FlowConstants.Strategy.IMMEDIATE_ONLY.equals(triggerType)) {
|
||||
if (taskTaskService.singleFlowStart(taskTask, sysUser.getUsername())) {
|
||||
return Result.ok("单次流程发起成功");
|
||||
}
|
||||
return Result.error("立即发起流程失败");
|
||||
} else if (FlowConstants.Strategy.RECURRING_ONLY.equals(triggerType)) {
|
||||
//向中间表写入n个待发起流程,由定时器扫描发起
|
||||
List<TaskTask> temTaskList = new ArrayList<>();
|
||||
Date baseDate = Optional.ofNullable(taskTask.getStartTime())
|
||||
.orElseThrow(() -> new IllegalArgumentException("周期性流程开始时间不能为空!"));
|
||||
|
||||
LocalDateTime currentLdt = baseDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
|
||||
for (int i = 0; i < startCount; i++) {
|
||||
// 计算下一次执行时间
|
||||
if (FlowConstants.IntervalType.EVERY_DAY.equals(intervalType)) {
|
||||
currentLdt = currentLdt.plusDays(1);
|
||||
} else if (FlowConstants.IntervalType.EVERY_WEEK.equals(intervalType)) {
|
||||
currentLdt = currentLdt.plusWeeks(1);
|
||||
} else if (FlowConstants.IntervalType.EVERY_TWO_WEEKS.equals(intervalType)) {
|
||||
currentLdt = currentLdt.plusWeeks(2);
|
||||
} else if (FlowConstants.IntervalType.EVERY_MONTH.equals(intervalType)) {
|
||||
currentLdt = currentLdt.plusMonths(1);
|
||||
} else if (FlowConstants.IntervalType.EVERY_QUARTER.equals(intervalType)) {
|
||||
currentLdt = currentLdt.plusMonths(3);
|
||||
} else {
|
||||
throw new IllegalArgumentException("未知的周期类型: " + intervalType);
|
||||
}
|
||||
|
||||
// 2. 创建新的任务对象并添加到列表
|
||||
TaskTask newTask = new TaskTask();
|
||||
// 复制基础属性 (建议使用 BeanUtils.copyProperties)
|
||||
BeanUtils.copyProperties(taskTask, newTask);
|
||||
|
||||
// 设置计算后的触发时间
|
||||
Date nextExecutionDate = Date.from(currentLdt.atZone(ZoneId.systemDefault()).toInstant());
|
||||
newTask.setStartTime(nextExecutionDate);
|
||||
|
||||
temTaskList.add(newTask);
|
||||
}
|
||||
taskTaskService.saveBatch(temTaskList);
|
||||
} else {
|
||||
// 这个 else 很重要,处理那些“意料之外”的数值
|
||||
return Result.error("非法的触发类型数值: " + triggerType);
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
|
||||
+3
@@ -231,6 +231,9 @@ public class TaskTask implements Serializable {
|
||||
/**流程变量*/
|
||||
@Excel(name = "流程变量", width = 15)
|
||||
private transient java.lang.String jsonDataString;
|
||||
@Excel(name = "是否立即发起流程", width = 15)
|
||||
@Schema(description = "1立即发起且非周期性发起,2不立即发起但周期性发起,3立即发起且周期性发起")
|
||||
private java.lang.Integer triggerType;
|
||||
|
||||
private byte[] jsonData;
|
||||
|
||||
|
||||
+1
-1
@@ -10,5 +10,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ITaskTaskService extends IService<TaskTask> {
|
||||
|
||||
boolean singleFlowStart(TaskTask taskTask,String userName) throws Exception;
|
||||
}
|
||||
|
||||
+30
@@ -1,11 +1,22 @@
|
||||
package org.jeecg.modules.tasktask.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.util.Assert;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.extbpm.process.exception.BpmException;
|
||||
import org.jeecg.modules.extbpm.process.service.impl.BpmBaseExtApiImpl;
|
||||
import org.jeecg.modules.tasktask.entity.TaskTask;
|
||||
import org.jeecg.modules.tasktask.mapper.TaskTaskMapper;
|
||||
import org.jeecg.modules.tasktask.service.ITaskTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @Description: 事项任务计划表(发起流程)
|
||||
@@ -15,5 +26,24 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
*/
|
||||
@Service
|
||||
public class TaskTaskServiceImpl extends ServiceImpl<TaskTaskMapper, TaskTask> implements ITaskTaskService {
|
||||
@Autowired
|
||||
private BpmBaseExtApiImpl bpmBaseExtApiImpl;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean singleFlowStart(TaskTask taskTask, String userName) throws Exception {
|
||||
if (StringUtils.isBlank(taskTask.getFlowCode())) {
|
||||
throw new IllegalArgumentException("flowCode不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(taskTask.getBusinessId())) {
|
||||
throw new IllegalArgumentException("businessId不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(taskTask.getFormUrl())) {
|
||||
throw new IllegalArgumentException("formUrl不能为空");
|
||||
}
|
||||
String jsonString = Optional.ofNullable(taskTask.getJsonData())
|
||||
.map(JSON::toJSONString) // 使用 Fastjson 或 Jackson
|
||||
.orElse("{}");
|
||||
Result<String> res = bpmBaseExtApiImpl.startMutilProcess(taskTask.getFlowCode(), taskTask.getBusinessId(), taskTask.getFormUrl(), taskTask.getFormUrl(), userName, jsonString);
|
||||
return res.isSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user