yxk-20260605-我为四所把把脉
1、新增 BgTakepulseBpmSaveDTO,用于 BPM 表单保存时传递流程实例 ID、流程变量名和业务表单数据。 2、在 BgTakepulseController 新增 /saveBpmForm 接口,保存主表业务数据的同时同步流程变量 json_data。 3、在 BgTakepulseController 新增反馈分页查询接口 /listBgTakepulseFeedbackByMainId,支持按主表 ID 和流程实例 ID 查询反馈。 4、新增反馈新增、编辑、删除、批量删除接口,支撑 BPM 办理页里的反馈维护功能。 5、调整原编辑接口逻辑:当只回写主表状态和督办次数、未传子表数据时,只更新主表,避免误删已有反馈子表数据。
This commit is contained in:
+109
-5
@@ -1,18 +1,17 @@
|
|||||||
package org.jeecg.modules.demo.bqtakepulse.controller;
|
package org.jeecg.modules.demo.bqtakepulse.controller;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.flowable.engine.RuntimeService;
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||||
@@ -24,6 +23,7 @@ import org.jeecg.common.api.vo.Result;
|
|||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.demo.bqtakepulse.dto.BgTakepulseBpmSaveDTO;
|
||||||
import org.jeecg.modules.demo.bqtakepulse.entity.BgTakepulseFeedback;
|
import org.jeecg.modules.demo.bqtakepulse.entity.BgTakepulseFeedback;
|
||||||
import org.jeecg.modules.demo.bqtakepulse.entity.BgTakepulse;
|
import org.jeecg.modules.demo.bqtakepulse.entity.BgTakepulse;
|
||||||
import org.jeecg.modules.demo.bqtakepulse.vo.BgTakepulsePage;
|
import org.jeecg.modules.demo.bqtakepulse.vo.BgTakepulsePage;
|
||||||
@@ -39,7 +39,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
@@ -61,6 +60,8 @@ public class BgTakepulseController {
|
|||||||
private IBgTakepulseService bgTakepulseService;
|
private IBgTakepulseService bgTakepulseService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBgTakepulseFeedbackService bgTakepulseFeedbackService;
|
private IBgTakepulseFeedbackService bgTakepulseFeedbackService;
|
||||||
|
@Autowired
|
||||||
|
protected RuntimeService runtimeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
@@ -124,9 +125,36 @@ public class BgTakepulseController {
|
|||||||
if(bgTakepulseEntity==null) {
|
if(bgTakepulseEntity==null) {
|
||||||
return Result.error("未找到对应数据");
|
return Result.error("未找到对应数据");
|
||||||
}
|
}
|
||||||
bgTakepulseService.updateMain(bgTakepulse, bgTakepulsePage.getBgTakepulseFeedbackList());
|
// 列表发起督办后只回写主表状态和督办次数,不应因为未传子表而清空已有反馈。
|
||||||
|
if (bgTakepulsePage.getBgTakepulseFeedbackList() == null) {
|
||||||
|
bgTakepulseService.updateById(bgTakepulse);
|
||||||
|
} else {
|
||||||
|
bgTakepulseService.updateMain(bgTakepulse, bgTakepulsePage.getBgTakepulseFeedbackList());
|
||||||
|
}
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存BPM办理页主表,同时同步流程变量json_data。
|
||||||
|
*
|
||||||
|
* @param dto BPM表单数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "保存我为四所把把脉业务数据同时更新流程变量jsonData")
|
||||||
|
@Operation(summary="保存我为四所把把脉业务数据同时更新流程变量jsonData")
|
||||||
|
@PostMapping(value = "/saveBpmForm")
|
||||||
|
public Result<String> saveBpmForm(@RequestBody BgTakepulseBpmSaveDTO dto) {
|
||||||
|
if (dto == null || dto.getFormData() == null || oConvertUtils.isEmpty(dto.getFormData().getId())) {
|
||||||
|
return Result.error("表单数据不存在");
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(dto.getProcessInstanceId())) {
|
||||||
|
return Result.error("流程实例ID不能为空");
|
||||||
|
}
|
||||||
|
String varField = oConvertUtils.isEmpty(dto.getVarField()) ? "json_data" : dto.getVarField();
|
||||||
|
bgTakepulseService.updateById(dto.getFormData());
|
||||||
|
runtimeService.setVariable(dto.getProcessInstanceId(), varField, JSONObject.toJSONString(dto.getFormData()));
|
||||||
|
return Result.OK("保存成功");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
@@ -190,6 +218,82 @@ public class BgTakepulseController {
|
|||||||
return Result.OK(bgTakepulseFeedbackList);
|
return Result.OK(bgTakepulseFeedbackList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BPM办理页按主表和流程实例分页查询反馈。
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Operation(summary="执行情况反馈-通过主表ID和流程实例ID查询")
|
||||||
|
@GetMapping(value = "/listBgTakepulseFeedbackByMainId")
|
||||||
|
public Result<IPage<BgTakepulseFeedback>> listBgTakepulseFeedbackByMainId(BgTakepulseFeedback bgTakepulseFeedback,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<BgTakepulseFeedback> queryWrapper = QueryGenerator.initQueryWrapper(bgTakepulseFeedback, req.getParameterMap());
|
||||||
|
Page<BgTakepulseFeedback> page = new Page<BgTakepulseFeedback>(pageNo, pageSize);
|
||||||
|
IPage<BgTakepulseFeedback> pageList = bgTakepulseFeedbackService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增执行情况反馈。
|
||||||
|
*
|
||||||
|
* @param bgTakepulseFeedback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "执行情况反馈-添加")
|
||||||
|
@Operation(summary="执行情况反馈-添加")
|
||||||
|
@PostMapping(value = "/addBgTakepulseFeedback")
|
||||||
|
public Result<String> addBgTakepulseFeedback(@RequestBody BgTakepulseFeedback bgTakepulseFeedback) {
|
||||||
|
if (oConvertUtils.isEmpty(bgTakepulseFeedback.getDelFlag())) {
|
||||||
|
bgTakepulseFeedback.setDelFlag("0");
|
||||||
|
}
|
||||||
|
bgTakepulseFeedbackService.save(bgTakepulseFeedback);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑执行情况反馈。
|
||||||
|
*
|
||||||
|
* @param bgTakepulseFeedback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "执行情况反馈-编辑")
|
||||||
|
@Operation(summary="执行情况反馈-编辑")
|
||||||
|
@RequestMapping(value = "/editBgTakepulseFeedback", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||||
|
public Result<String> editBgTakepulseFeedback(@RequestBody BgTakepulseFeedback bgTakepulseFeedback) {
|
||||||
|
bgTakepulseFeedbackService.updateById(bgTakepulseFeedback);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除执行情况反馈。
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "执行情况反馈-通过id删除")
|
||||||
|
@Operation(summary="执行情况反馈-通过id删除")
|
||||||
|
@DeleteMapping(value = "/deleteBgTakepulseFeedback")
|
||||||
|
public Result<String> deleteBgTakepulseFeedback(@RequestParam(name="id",required=true) String id) {
|
||||||
|
bgTakepulseFeedbackService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除执行情况反馈。
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "执行情况反馈-批量删除")
|
||||||
|
@Operation(summary="执行情况反馈-批量删除")
|
||||||
|
@DeleteMapping(value = "/deleteBatchBgTakepulseFeedback")
|
||||||
|
public Result<String> deleteBatchBgTakepulseFeedback(@RequestParam(name="ids",required=true) String ids) {
|
||||||
|
bgTakepulseFeedbackService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
*
|
*
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package org.jeecg.modules.demo.bqtakepulse.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.jeecg.modules.demo.bqtakepulse.entity.BgTakepulse;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "BgTakepulse BPM form save DTO")
|
||||||
|
public class BgTakepulseBpmSaveDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "Process instance id")
|
||||||
|
private String processInstanceId;
|
||||||
|
|
||||||
|
@Schema(description = "Process variable name")
|
||||||
|
private String varField;
|
||||||
|
|
||||||
|
@Schema(description = "BgTakepulse form data")
|
||||||
|
private BgTakepulse formData;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user