!99 feat(fixcontact): 新增EasyExcel模板导入导出及校验接口

Merge pull request !99 from wsm/feature/20260731
This commit is contained in:
wsm
2026-07-31 01:55:41 +00:00
committed by Gitee
17 changed files with 1193 additions and 0 deletions
@@ -0,0 +1,40 @@
package org.jeecg.modules.bg.fixcontact.constant;
/**
* 定点联系模块常量
*/
public final class FixContactConstant {
private FixContactConstant() {
throw new UnsupportedOperationException("This is a constant class and cannot be instantiated");
}
/** 角色编码 */
public static final class RoleCode {
/** 所领导 */
public static final String SLD_ROLE_ID = "2062794430936240130";
/** 部门负责人 */
public static final String DEPT_LEADER_ID = "2044680793306591234";
}
/** 角色编码 */
public static final class DeptId {
/** 所领导 */
public static final String BG_DEPT_ID = "2044677604785229826";
}
/** 流程变量名 */
public static final class FlowVarName {
/** 业务表单ID */
public static final String BUSINESS_KEY = "businessKey";
}
/** 业务状态 */
public static final class BusinessStatus {
/** 已办结 */
public static final String FINISHED = "1";
/** 未办结 */
public static final String UNFINISHED = "0";
}
}
@@ -0,0 +1,239 @@
package org.jeecg.modules.bg.fixcontact.controller;
import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.common.util.excel.ExcelAnnotationUtils;
import org.jeecg.modules.bg.constant.BpmStatus;
import org.jeecg.modules.bg.constant.SupervisionConstant;
import org.jeecg.modules.bg.fixcontact.entity.FixedContact20260730;
import org.jeecg.modules.bg.fixcontact.entity.FixedContactFeedback20260730;
import org.jeecg.modules.bg.fixcontact.service.IFixedContact20260730Service;
import org.jeecg.modules.bg.fixcontact.service.IFixedContactFeedback20260730Service;
import org.jeecg.modules.bg.fixcontact.dto.FixedContact20260730BpmSaveDTO;
import org.jeecg.modules.bg.fixcontact.vo.FixedContact20260730Page;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.flowable.engine.RuntimeService;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.tasktask.entity.TaskTask;
import org.jeecg.modules.tasktask.service.impl.TaskTaskServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@Tag(name = "定点联系单")
@RestController
@RequestMapping("/bg/fixcontact/fixedContact20260730")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@Slf4j
public class FixedContact20260730Controller extends JeecgController<FixedContact20260730, IFixedContact20260730Service> {
private final IFixedContact20260730Service fixedContact20260730Service;
private final IFixedContactFeedback20260730Service fixedContactFeedback20260730Service;
private final RuntimeService runtimeService;
private final TaskTaskServiceImpl taskTaskServiceImpl;
@Operation(summary = "定点联系单-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<FixedContact20260730>> queryPageList(FixedContact20260730 fixedContact20260730,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<FixedContact20260730> queryWrapper = QueryGenerator.initQueryWrapper(fixedContact20260730, req.getParameterMap());
Page<FixedContact20260730> page = new Page<FixedContact20260730>(pageNo, pageSize);
IPage<FixedContact20260730> pageList = fixedContact20260730Service.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "定点联系单-添加")
@Operation(summary = "定点联系单-添加")
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody FixedContact20260730Page fixedContact20260730Page) {
FixedContact20260730 fixedContact20260730 = new FixedContact20260730();
org.springframework.beans.BeanUtils.copyProperties(fixedContact20260730Page, fixedContact20260730);
fixedContact20260730Service.saveMain(fixedContact20260730, fixedContact20260730Page.getFixedContactFeedback20260730List());
return Result.OK("添加成功!");
}
@AutoLog(value = "定点联系单-编辑")
@Operation(summary = "定点联系单-编辑")
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody FixedContact20260730Page fixedContact20260730Page) {
FixedContact20260730 fixedContact20260730 = new FixedContact20260730();
org.springframework.beans.BeanUtils.copyProperties(fixedContact20260730Page, fixedContact20260730);
FixedContact20260730 entity = fixedContact20260730Service.getById(fixedContact20260730.getId());
if (entity == null) {
return Result.error("未找到对应数据");
}
List<FixedContactFeedback20260730> subList = fixedContact20260730Page.getFixedContactFeedback20260730List();
if (subList != null) {
fixedContact20260730Service.updateMain(fixedContact20260730, subList);
} else {
fixedContact20260730Service.updateById(fixedContact20260730);
}
return Result.OK("编辑成功!");
}
@AutoLog(value = "定点联系单-通过id删除")
@Operation(summary = "定点联系单-通过id删除")
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
fixedContact20260730Service.delMain(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "定点联系单-批量删除")
@Operation(summary = "定点联系单-批量删除")
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.fixedContact20260730Service.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "定点联系单-通过id查询")
@GetMapping(value = "/queryById")
public Result<FixedContact20260730> queryById(@RequestParam(name = "id", required = true) String id) {
FixedContact20260730 fixedContact20260730 = fixedContact20260730Service.getById(id);
if (fixedContact20260730 == null) {
return Result.error("未找到对应数据");
}
return Result.OK(fixedContact20260730);
}
@Operation(summary = "反馈子表-主表ID查询")
@GetMapping(value = "/queryFixedContactFeedback20260730ByMainId")
public Result<List<FixedContactFeedback20260730>> queryFixedContactFeedback20260730ListByMainId(@RequestParam(name = "id", required = true) String id) {
List<FixedContactFeedback20260730> fixedContactFeedback20260730List = fixedContactFeedback20260730Service.selectByMainId(id);
return Result.OK(fixedContactFeedback20260730List);
}
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, FixedContact20260730 fixedContact20260730) {
return super.exportXls(request, fixedContact20260730, FixedContact20260730.class, "定点联系单");
}
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, FixedContact20260730.class);
}
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:importExcel")
@RequestMapping(value = "/importExcelByEasyExcel", method = RequestMethod.POST)
public Result<?> importExcelByEasyExcel(HttpServletRequest request) {
return super.importExcelByEasyExcel(request, FixedContact20260730.class,
Map.of(
SupervisionConstant.ClassFieldName.BPM_STATUS_NAME,
BpmStatus.NOT_START.getCode(),
SupervisionConstant.ClassFieldName.DEL_FLAG_NAME,
SupervisionConstant.DelFlag.NORMAL));
}
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:importExcel")
@RequestMapping(value = "/checkExcelByEasyExcel", method = RequestMethod.POST)
public Result<?> checkExcelByEasyExcel(HttpServletRequest request) {
return super.checkExcelByEasyExcel(request, FixedContact20260730.class);
}
@RequiresPermissions("bg.fixcontact:fixed_contact_20260730:exportXls")
@GetMapping(value = "/exportXlsHeaders")
public void exportXlsHeaders(HttpServletResponse response) throws IOException {
FixedContact20260730 example = ExcelAnnotationUtils.buildExample(FixedContact20260730.class);
super.exportXlsWithData(response, FixedContact20260730.class, "定点联系单",
java.util.Collections.singletonList(example));
}
@AutoLog(value = "保存业务数据同时更新流程变量jsonData")
@Operation(summary = "保存业务数据同时更新流程变量jsonData")
@PostMapping(value = "/saveBpmForm")
public Result<String> saveBpmForm(@RequestBody FixedContact20260730BpmSaveDTO 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();
fixedContact20260730Service.updateById(dto.getFormData());
runtimeService.setVariable(dto.getProcessInstanceId(), varField, JSONObject.toJSONString(dto.getFormData()));
return Result.OK("保存成功");
}
@AutoLog(value = "反馈子表-添加")
@Operation(summary = "反馈子表-添加")
@PostMapping(value = "/addFixedContactFeedback20260730")
public Result<String> addFixedContactFeedback20260730(@RequestBody FixedContactFeedback20260730 fixedContactFeedback20260730) {
fixedContactFeedback20260730Service.save(fixedContactFeedback20260730);
return Result.OK("添加成功!");
}
@AutoLog(value = "反馈子表-编辑")
@Operation(summary = "反馈子表-编辑")
@RequestMapping(value = "/editFixedContactFeedback20260730", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> editFixedContactFeedback20260730(@RequestBody FixedContactFeedback20260730 fixedContactFeedback20260730) {
fixedContactFeedback20260730Service.updateById(fixedContactFeedback20260730);
return Result.OK("编辑成功!");
}
@AutoLog(value = "反馈子表-通过id删除")
@Operation(summary = "反馈子表-通过id删除")
@DeleteMapping(value = "/deleteFixedContactFeedback20260730")
public Result<String> deleteFixedContactFeedback20260730(@RequestParam(name = "id", required = true) String id) {
fixedContactFeedback20260730Service.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "定点联系单-删除关联流程")
@Operation(summary = "定点联系单-删除关联流程")
@PostMapping(value = "/withDrawFixContact")
public Result<String> withDrawFixContact(@RequestParam("id") String id) {
LambdaQueryWrapper<TaskTask> queryWrapper = new LambdaQueryWrapper<TaskTask>()
.eq(TaskTask::getBusinessId, id);
List<TaskTask> taskTaskList = taskTaskServiceImpl.list(queryWrapper);
if (taskTaskList == null || taskTaskList.isEmpty()) {
log.warn("【定点联系-删除关联流程】未找到关联流程, businessId: {}", id);
return Result.error("未找到关联流程");
}
for (TaskTask taskTask : taskTaskList) {
if (taskTask.getProcessInstId() != null) {
long count = runtimeService.createProcessInstanceQuery()
.processInstanceId(taskTask.getProcessInstId())
.count();
if (count > 0) {
runtimeService.deleteProcessInstance(taskTask.getProcessInstId(),
"删除定点联系单关联流程, businessId: " + id);
log.info("【定点联系-删除关联流程】已中止运行中的流程实例: {}", taskTask.getProcessInstId());
}
}
}
List<String> ids = taskTaskList.stream()
.map(TaskTask::getId)
.filter(org.apache.commons.lang3.StringUtils::isNotBlank)
.collect(java.util.stream.Collectors.toList());
if (!ids.isEmpty()) {
taskTaskServiceImpl.removeByIds(ids);
log.info("【定点联系-删除关联流程】已清理关联的taskTask记录, ids: {}", ids);
}
return Result.OK("删除关联流程成功");
}
}
@@ -0,0 +1,23 @@
package org.jeecg.modules.bg.fixcontact.dto;
import java.io.Serializable;
import org.jeecg.modules.bg.fixcontact.entity.FixedContact20260730;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "FixedContact20260730 BPM form save DTO")
public class FixedContact20260730BpmSaveDTO 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 = "FixedContact20260730 form data")
private FixedContact20260730 formData;
}
@@ -0,0 +1,135 @@
package org.jeecg.modules.bg.fixcontact.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.util.excel.annotation.ExcelColumn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
@Data
@TableName("fixed_contact_20260730")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "定点联系单")
public class FixedContact20260730 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;
@Schema(description = "所属部门")
private java.lang.String sysOrgCode;
@Excel(name = "序号", width = 15)
@ExcelColumn(name = "序号", width = 15)
@Schema(description = "序号")
private java.lang.String seqNo;
@Excel(name = "表单编号", width = 15)
@ExcelColumn(name = "表单编号", width = 15)
@Schema(description = "表单编号")
private java.lang.String formNo;
@Excel(name = "定点联系所领导", width = 15)
@ExcelColumn(name = "定点联系所领导", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Schema(description = "定点联系所领导")
private java.lang.String contactLeader;
@Excel(name = "联系单位(部门)", width = 15)
@ExcelColumn(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 contactDept;
@Excel(name = "联系时间", width = 15, format = "yyyy-MM-dd")
@ExcelColumn(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 contactTime;
@Excel(name = "座谈地点", width = 15)
@ExcelColumn(name = "座谈地点", width = 15)
@Schema(description = "座谈地点")
private java.lang.String meetingPlace;
@Excel(name = "联系点建议诉求摘要", width = 30)
@ExcelColumn(name = "联系点建议诉求摘要", width = 30)
@Schema(description = "联系点建议诉求摘要")
private java.lang.String suggestionSummary;
@Excel(name = "定点联系所领导审批意见", width = 30)
@ExcelColumn(name = "定点联系所领导审批意见", width = 30)
@Schema(description = "定点联系所领导审批意见")
private java.lang.String leaderOpinion;
@Excel(name = "相关分管所领导批示意见", width = 30)
@ExcelColumn(name = "相关分管所领导批示意见", width = 30)
@Schema(description = "相关分管所领导批示意见")
private java.lang.String relatedLeaderOpinion;
@Excel(name = "相关分管所领导", width = 15)
@ExcelColumn(name = "相关分管所领导", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Schema(description = "相关分管所领导")
private java.lang.String relatedLeader;
@Excel(name = "申请人", width = 15)
@ExcelColumn(name = "申请人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Schema(description = "申请人")
private java.lang.String applicant;
@Excel(name = "主办部门", width = 15)
@ExcelColumn(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 hostDept;
@Excel(name = "协办部门", width = 15)
@ExcelColumn(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 coDept;
@Excel(name = "督办次数", width = 15)
@ExcelColumn(name = "督办次数", width = 15)
@Schema(description = "督办次数")
private java.lang.Integer superviseCount;
@Schema(description = "流程状态:1=未开始,2=督办中,3=已完成")
private java.lang.String bpmStatus;
@Schema(description = "是否所办领导审批:0=否,1=是")
private java.lang.String isNeedAppro;
@Schema(description = "所办领导ID,多个逗号分隔")
private java.lang.String supDeptleaderid;
}
@@ -0,0 +1,76 @@
package org.jeecg.modules.bg.fixcontact.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@TableName("fixed_contact_feedback_20260730")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "反馈子表")
public class FixedContactFeedback20260730 implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private java.lang.String id;
@Schema(description = "主表ID(外键)")
private java.lang.String fixedContact20260730Id;
@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;
@Schema(description = "所属部门")
private java.lang.String sysOrgCode;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "计划完成时间")
private java.util.Date planFinishTime;
@Schema(description = "计划完成情况")
private java.lang.String planFinishStatus;
@Schema(description = "处理意见、承办情况")
private java.lang.String handleOpinion;
@Schema(description = "办结情况")
private java.lang.String finishStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "实际完成时间")
private java.util.Date actualFinishTime;
@Schema(description = "实际完成情况")
private java.lang.String actualFinishStatus;
@Schema(description = "反馈人")
private java.lang.String feedbackUser;
@Schema(description = "反馈部门")
private java.lang.String feedbackDept;
}
@@ -0,0 +1,416 @@
package org.jeecg.modules.bg.fixcontact.flow;
import com.alibaba.fastjson.JSONObject;
import com.jeecg.weibo.exception.BusinessException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.delegate.DelegateExecution;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.modules.bg.fixcontact.constant.FixContactConstant;
import org.jeecg.modules.bg.fixcontact.entity.FixedContact20260730;
import org.jeecg.modules.bg.fixcontact.entity.FixedContactFeedback20260730;
import org.jeecg.modules.bg.fixcontact.service.IFixedContact20260730Service;
import org.jeecg.modules.bg.fixcontact.service.IFixedContactFeedback20260730Service;
import org.jeecg.modules.extbpm.process.common.expression.FlowNodeExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Component("fixContactFlow")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class FixContactFlow {
private final IFixedContact20260730Service fixedContact20260730Service;
private final IFixedContactFeedback20260730Service fixedContactFeedback20260730Service;
private final FlowNodeExpression flowNodeExpression;
private final ISysBaseAPI iSysBaseAPI;
private final RuntimeService runtimeService;
// ===================================================================
// 业务实体查询
// ===================================================================
private FixedContact20260730 getFixedContact(DelegateExecution execution) {
Object businessKey = execution.getVariable("businessKey");
if (businessKey == null || StringUtils.isBlank(businessKey.toString())) {
log.error("【定点联系-流程表达式】未获取到有效的业务表单ID, processInstanceId: {}, businessKey: {}",
execution.getProcessInstanceId(), businessKey);
return null;
}
FixedContact20260730 entity = fixedContact20260730Service.getById(businessKey.toString());
if (entity == null) {
log.error("【定点联系-流程表达式】未查询到业务表单记录, businessKey: {}, processInstanceId: {}",
businessKey, execution.getProcessInstanceId());
} else {
log.info("【定点联系-流程表达式】已查询到业务表单, businessKey: {}", businessKey);
}
return entity;
}
// ===================================================================
// 流程变量读取
// ===================================================================
// ${fixContactFlow.getContactLeader(execution)}
public String getContactLeader(DelegateExecution execution) {
FixedContact20260730 entity = this.getFixedContact(execution);
if (entity == null) {
log.error("【定点联系-流程表达式】未获取到定点联系单, processInstanceId: {}",
execution.getProcessInstanceId());
return null;
}
String contactLeader = entity.getContactLeader();
if (StringUtils.isBlank(contactLeader)) {
log.warn("【定点联系-流程表达式】定点联系所领导为空, businessKey: {}", entity.getId());
}
return contactLeader;
}
// ${fixContactFlow.getRelatedLeader(execution)}
public String getRelatedLeader(DelegateExecution execution) {
FixedContact20260730 entity = this.getFixedContact(execution);
if (entity == null) {
log.error("【定点联系-流程表达式】未获取到定点联系单, processInstanceId: {}",
execution.getProcessInstanceId());
return null;
}
String relatedLeader = entity.getRelatedLeader();
if (StringUtils.isBlank(relatedLeader)) {
log.warn("【定点联系-流程表达式】相关分管所领导为空, businessKey: {}", entity.getId());
}
return relatedLeader;
}
// ${fixContactFlow.getApplicant(execution)}
public String getApplicant(DelegateExecution execution) {
FixedContact20260730 entity = this.getFixedContact(execution);
if (entity == null) {
log.error("【定点联系-流程表达式】未获取到定点联系单, processInstanceId: {}",
execution.getProcessInstanceId());
return null;
}
String applicant = entity.getApplicant();
if (StringUtils.isBlank(applicant)) {
log.warn("【定点联系-流程表达式】申请人为空, businessKey: {}", entity.getId());
}
return applicant;
}
// ${fixContactFlow.getHostDept(execution)}
public String getHostDept(DelegateExecution execution) {
FixedContact20260730 entity = this.getFixedContact(execution);
if (entity == null) {
log.error("【定点联系-流程表达式】未获取到定点联系单, processInstanceId: {}",
execution.getProcessInstanceId());
return null;
}
return entity.getHostDept();
}
// ${fixContactFlow.getCoDept(execution)}
public String getCoDept(DelegateExecution execution) {
FixedContact20260730 entity = this.getFixedContact(execution);
if (entity == null) {
log.error("【定点联系-流程表达式】未获取到定点联系单, processInstanceId: {}",
execution.getProcessInstanceId());
return null;
}
return entity.getCoDept();
}
// ${fixContactFlow.getContactDept(execution)}
public String getContactDept(DelegateExecution execution) {
FixedContact20260730 entity = this.getFixedContact(execution);
if (entity == null) {
log.error("【定点联系-流程表达式】未获取到定点联系单, processInstanceId: {}",
execution.getProcessInstanceId());
return null;
}
return entity.getContactDept();
}
// ===================================================================
// 按部门+角色找人
// ===================================================================
// ${fixContactFlow.getOfficeLeaderList(execution)}
public List<String> getOfficeLeaderList(DelegateExecution execution) {
String deptId = FixContactConstant.DeptId.BG_DEPT_ID;
String roleId = FixContactConstant.RoleCode.SLD_ROLE_ID;
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
log.info("【定点联系-流程表达式】查询到所领导列表, count: {}", userList.size());
return userList;
}
// ${fixContactFlow.getOfficeLeaderListLength(execution)}
public int getOfficeLeaderListLength(DelegateExecution execution) {
return this.getOfficeLeaderList(execution).size();
}
// ${fixContactFlow.getUsersByDeptAndRole(deptId, roleId)}
public List<String> getUsersByDeptAndRole(String deptId, String roleId) {
log.info("【定点联系-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", deptId, roleId);
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
log.info("【定点联系-流程表达式】查询到用户列表, userList: {}", userList);
return userList;
}
// ${fixContactFlow.getUsersByDeptAndRoleCount(deptId, roleId)}
public int getUsersByDeptAndRoleCount(String deptId, String roleId) {
List<String> userList = this.getUsersByDeptAndRole(deptId, roleId);
return userList != null ? userList.size() : 0;
}
// ${fixContactFlow.getHostDeptLeaderList(execution)}
public List<String> getHostDeptLeaderList(DelegateExecution execution) {
FixedContact20260730 entity = this.getFixedContact(execution);
if (entity == null) {
throw new IllegalStateException("无法获取审批人:未找到对应的业务表单数据,流程暂停。");
}
String hostDept = entity.getHostDept();
if (StringUtils.isBlank(hostDept)) {
String errorMsg = String.format("流程流转失败: 业务表单[ID:%s]中的主办部门为空,无法匹配审批人。",
entity.getId());
log.error(errorMsg);
throw new IllegalStateException(errorMsg);
}
log.info("【定点联系-流程表达式】正在查询主办部门: {} 下的领导列表", hostDept);
List<String> leaderList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(hostDept, "ld");
if (CollectionUtils.isEmpty(leaderList)) {
log.warn("【定点联系-流程表达式】主办部门: {} 下未配置角色为ld的用户,审批人列表为空", hostDept);
return Collections.emptyList();
}
log.info("【定点联系-流程表达式】查询到的主办部门领导为:{}", leaderList);
return leaderList;
}
// ${fixContactFlow.getHostDeptLeaderListCount(execution)}
public int getHostDeptLeaderListCount(DelegateExecution execution) {
return this.getHostDeptLeaderList(execution).size();
}
// ===================================================================
// 反馈子表相关
// ===================================================================
// ${fixContactFlow.getFeedbackList(execution)}
public List<FixedContactFeedback20260730> getFeedbackList(DelegateExecution execution) {
FixedContact20260730 entity = this.getFixedContact(execution);
if (entity == null) {
log.error("【定点联系-流程表达式】未获取到定点联系单,无法查询反馈记录, processInstanceId: {}",
execution.getProcessInstanceId());
return Collections.emptyList();
}
List<FixedContactFeedback20260730> feedbackList =
fixedContactFeedback20260730Service.selectByMainId(entity.getId());
log.info("【定点联系-流程表达式】查询到反馈记录数: {}, businessKey: {}",
feedbackList != null ? feedbackList.size() : 0, entity.getId());
return feedbackList != null ? feedbackList : Collections.emptyList();
}
// ${fixContactFlow.getFeedbackCount(execution)}
public int getFeedbackCount(DelegateExecution execution) {
return this.getFeedbackList(execution).size();
}
// ${fixContactFlow.getLatestFeedbackUser(execution)}
public String getLatestFeedbackUser(DelegateExecution execution) {
List<FixedContactFeedback20260730> feedbackList = this.getFeedbackList(execution);
if (CollectionUtils.isEmpty(feedbackList)) {
log.warn("【定点联系-流程表达式】无反馈记录");
return null;
}
FixedContactFeedback20260730 latest = feedbackList.get(feedbackList.size() - 1);
return latest.getFeedbackUser();
}
// ${fixContactFlow.getLatestFeedbackDept(execution)}
public String getLatestFeedbackDept(DelegateExecution execution) {
List<FixedContactFeedback20260730> feedbackList = this.getFeedbackList(execution);
if (CollectionUtils.isEmpty(feedbackList)) {
log.warn("【定点联系-流程表达式】无反馈记录");
return null;
}
FixedContactFeedback20260730 latest = feedbackList.get(feedbackList.size() - 1);
return latest.getFeedbackDept();
}
// ${fixContactFlow.isAllFeedbackFinished(execution)}
public boolean isAllFeedbackFinished(DelegateExecution execution) {
List<FixedContactFeedback20260730> feedbackList = this.getFeedbackList(execution);
if (CollectionUtils.isEmpty(feedbackList)) {
return false;
}
boolean allFinished = feedbackList.stream()
.allMatch(f -> StringUtils.isNotBlank(f.getFinishStatus()));
log.info("【定点联系-流程表达式】所有反馈是否已办结: {}", allFinished);
return allFinished;
}
// ===================================================================
// 流程变量方法
// ===================================================================
// ${fixContactFlow.getVar(execution, varName)}
public String getVar(DelegateExecution execution, String varName) {
Object value = runtimeService.getVariable(execution.getProcessInstanceId(), varName);
return value != null ? value.toString() : null;
}
// ${fixContactFlow.getVarAsList(execution, varName)}
public List<String> getVarAsList(DelegateExecution execution, String varName) {
Object value = runtimeService.getVariable(execution.getProcessInstanceId(), varName);
if (value == null) {
return Collections.emptyList();
}
String str = value.toString();
if (StringUtils.isBlank(str)) {
return Collections.emptyList();
}
return Arrays.stream(str.split(","))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toList());
}
// ${fixContactFlow.getVarAsListCount(execution, varName)}
public int getVarAsListCount(DelegateExecution execution, String varName) {
return this.getVarAsList(execution, varName).size();
}
// ${fixContactFlow.getListSize(data)}
public int getListSize(String data) {
if (StringUtils.isEmpty(data)) {
return 0;
}
return (int) Arrays.stream(data.split(","))
.map(String::trim)
.filter(StringUtils::isNotEmpty)
.count();
}
// ===================================================================
// JSON 数据解析方法(配合流程表单设计器使用)
// ===================================================================
// ${fixContactFlow.getContactLeaderFromJson(jsonData)}
public String getContactLeaderFromJson(Object jsonData) {
return getStringFromData(jsonData, "contactLeader", "定点联系所领导");
}
// ${fixContactFlow.getRelatedLeaderFromJson(jsonData)}
public String getRelatedLeaderFromJson(Object jsonData) {
return getStringFromData(jsonData, "relatedLeader", "相关分管所领导");
}
// ${fixContactFlow.getHostDeptFromJson(jsonData)}
public String getHostDeptFromJson(Object jsonData) {
return getStringFromData(jsonData, "hostDept", "主办部门");
}
// ${fixContactFlow.getCoDeptFromJson(jsonData)}
public String getCoDeptFromJson(Object jsonData) {
return getStringFromData(jsonData, "coDept", "协办部门");
}
// ${fixContactFlow.getApplicantFromJson(jsonData)}
public String getApplicantFromJson(Object jsonData) {
return getStringFromData(jsonData, "applicant", "申请人");
}
// ${fixContactFlow.getContactDeptFromJson(jsonData)}
public String getContactDeptFromJson(Object jsonData) {
return getStringFromData(jsonData, "contactDept", "联系单位");
}
// ${fixContactFlow.getHostDeptLeaderListFromJson(jsonData)}
public List<String> getHostDeptLeaderListFromJson(Object jsonData) {
String hostDept = getStringFromData(jsonData, "hostDept", "主办部门");
if (StringUtils.isBlank(hostDept)) {
log.warn("【定点联系-流程表达式】JSON数据中主办部门为空");
return Collections.emptyList();
}
return getUsersByDeptAndRole(hostDept, "ld");
}
// ${fixContactFlow.getCoDeptLeaderListFromJson(jsonData)}
public List<String> getCoDeptLeaderListFromJson(Object jsonData) {
String coDept = getStringFromData(jsonData, "coDept", "协办部门");
if (StringUtils.isBlank(coDept)) {
log.warn("【定点联系-流程表达式】JSON数据中协办部门为空");
return Collections.emptyList();
}
return getUsersByDeptAndRole(coDept, "ld");
}
// ===================================================================
// 通用工具方法
// ===================================================================
private String getStringFromData(Object jsonData, String codeName, String logLabel) {
if (jsonData == null || StringUtils.isBlank(codeName)) {
return null;
}
try {
JSONObject data;
if (jsonData instanceof JSONObject) {
data = (JSONObject) jsonData;
} else if (jsonData instanceof String) {
String jsonStr = (String) jsonData;
if (StringUtils.isBlank(jsonStr)) return null;
data = JSONObject.parseObject(jsonStr);
} else {
data = JSONObject.parseObject(JSONObject.toJSONString(jsonData));
}
String result = data.getString(codeName);
log.info("【定点联系-流程表达式】{} 解析结果: {}", logLabel, result);
return result;
} catch (Exception e) {
log.warn("【定点联系-流程表达式】JSON解析失败: label={}, key={}", logLabel, codeName, e);
return null;
}
}
private List<String> getListFromData(Object jsonData, String codeName, String logLabel) {
if (jsonData == null || StringUtils.isBlank(codeName)) {
return Collections.emptyList();
}
try {
JSONObject data;
if (jsonData instanceof JSONObject) {
data = (JSONObject) jsonData;
} else if (jsonData instanceof String) {
String jsonStr = (String) jsonData;
if (StringUtils.isBlank(jsonStr)) return Collections.emptyList();
data = JSONObject.parseObject(jsonStr);
} else {
data = JSONObject.parseObject(JSONObject.toJSONString(jsonData));
}
String rawValue = data.getString(codeName);
if (StringUtils.isBlank(rawValue)) {
return Collections.emptyList();
}
List<String> result = Arrays.stream(rawValue.split(","))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toList());
log.info("【定点联系-流程表达式】{} 解析结果: {}", logLabel, result);
return result;
} catch (Exception e) {
log.warn("【定点联系-流程表达式】JSON解析失败: label={}, key={}", logLabel, codeName, e);
return Collections.emptyList();
}
}
}
@@ -0,0 +1,7 @@
package org.jeecg.modules.bg.fixcontact.mapper;
import org.jeecg.modules.bg.fixcontact.entity.FixedContact20260730;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface FixedContact20260730Mapper extends BaseMapper<FixedContact20260730> {
}
@@ -0,0 +1,17 @@
package org.jeecg.modules.bg.fixcontact.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.bg.fixcontact.entity.FixedContactFeedback20260730;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface FixedContactFeedback20260730Mapper extends BaseMapper<FixedContactFeedback20260730> {
@Delete("DELETE FROM fixed_contact_feedback_20260730 WHERE fixed_contact_20260730_id = #{mainId}")
boolean deleteByMainId(@Param("mainId") String mainId);
@Select("SELECT * FROM fixed_contact_feedback_20260730 WHERE fixed_contact_20260730_id = #{mainId}")
List<FixedContactFeedback20260730> selectByMainId(@Param("mainId") String mainId);
}
@@ -0,0 +1,19 @@
package org.jeecg.modules.bg.fixcontact.service;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.jeecg.modules.bg.fixcontact.entity.FixedContact20260730;
import org.jeecg.modules.bg.fixcontact.entity.FixedContactFeedback20260730;
import com.baomidou.mybatisplus.extension.service.IService;
public interface IFixedContact20260730Service extends IService<FixedContact20260730> {
void saveMain(FixedContact20260730 entity, List<FixedContactFeedback20260730> subList);
void updateMain(FixedContact20260730 entity, List<FixedContactFeedback20260730> subList);
void delMain(String id);
void delBatchMain(Collection<? extends Serializable> idList);
}
@@ -0,0 +1,9 @@
package org.jeecg.modules.bg.fixcontact.service;
import java.util.List;
import org.jeecg.modules.bg.fixcontact.entity.FixedContactFeedback20260730;
import com.baomidou.mybatisplus.extension.service.IService;
public interface IFixedContactFeedback20260730Service extends IService<FixedContactFeedback20260730> {
List<FixedContactFeedback20260730> selectByMainId(String mainId);
}
@@ -0,0 +1,62 @@
package org.jeecg.modules.bg.fixcontact.service.impl;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.jeecg.modules.bg.fixcontact.entity.FixedContact20260730;
import org.jeecg.modules.bg.fixcontact.entity.FixedContactFeedback20260730;
import org.jeecg.modules.bg.fixcontact.mapper.FixedContact20260730Mapper;
import org.jeecg.modules.bg.fixcontact.mapper.FixedContactFeedback20260730Mapper;
import org.jeecg.modules.bg.fixcontact.service.IFixedContact20260730Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class FixedContact20260730ServiceImpl extends ServiceImpl<FixedContact20260730Mapper, FixedContact20260730> implements IFixedContact20260730Service {
@Autowired
private FixedContactFeedback20260730Mapper fixedContactFeedback20260730Mapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(FixedContact20260730 entity, List<FixedContactFeedback20260730> subList) {
baseMapper.insert(entity);
if (subList != null && subList.size() > 0) {
for (FixedContactFeedback20260730 sub : subList) {
sub.setFixedContact20260730Id(entity.getId());
fixedContactFeedback20260730Mapper.insert(sub);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(FixedContact20260730 entity, List<FixedContactFeedback20260730> subList) {
baseMapper.updateById(entity);
fixedContactFeedback20260730Mapper.deleteByMainId(entity.getId());
if (subList != null && subList.size() > 0) {
for (FixedContactFeedback20260730 sub : subList) {
sub.setFixedContact20260730Id(entity.getId());
fixedContactFeedback20260730Mapper.insert(sub);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delMain(String id) {
fixedContactFeedback20260730Mapper.deleteByMainId(id);
baseMapper.deleteById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delBatchMain(Collection<? extends Serializable> idList) {
for (Serializable id : idList) {
fixedContactFeedback20260730Mapper.deleteByMainId(id.toString());
baseMapper.deleteById(id);
}
}
}
@@ -0,0 +1,17 @@
package org.jeecg.modules.bg.fixcontact.service.impl;
import java.util.List;
import org.jeecg.modules.bg.fixcontact.entity.FixedContactFeedback20260730;
import org.jeecg.modules.bg.fixcontact.mapper.FixedContactFeedback20260730Mapper;
import org.jeecg.modules.bg.fixcontact.service.IFixedContactFeedback20260730Service;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class FixedContactFeedback20260730ServiceImpl extends ServiceImpl<FixedContactFeedback20260730Mapper, FixedContactFeedback20260730> implements IFixedContactFeedback20260730Service {
@Override
public List<FixedContactFeedback20260730> selectByMainId(String mainId) {
return baseMapper.selectByMainId(mainId);
}
}
@@ -0,0 +1,16 @@
package org.jeecg.modules.bg.fixcontact.vo;
import java.util.List;
import org.jeecg.modules.bg.fixcontact.entity.FixedContact20260730;
import org.jeecg.modules.bg.fixcontact.entity.FixedContactFeedback20260730;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
@Data
@EqualsAndHashCode(callSuper = false)
public class FixedContact20260730Page extends FixedContact20260730 {
@ExcelCollection(name = "反馈子表")
private List<FixedContactFeedback20260730> fixedContactFeedback20260730List;
}
@@ -0,0 +1,39 @@
-- 定点联系单菜单权限
-- 前台目录: views/bg/fixcontact/FixedContact20260730List
-- 主菜单
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
VALUES ('178538143865601', NULL, '定点联系单', '/bg/fixcontact/fixedContact20260730List', 'bg/fixcontact/FixedContact20260730List', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2026-07-30 00:00:00', NULL, NULL, 0);
-- 新增
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('178538143865602', '178538143865601', '添加定点联系单', NULL, NULL, 0, NULL, NULL, 2, 'bg.fixcontact:fixed_contact_20260730:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-07-30 00:00:00', NULL, NULL, 0, 0, '1', 0);
-- 编辑
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('178538143865603', '178538143865601', '编辑定点联系单', NULL, NULL, 0, NULL, NULL, 2, 'bg.fixcontact:fixed_contact_20260730:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-07-30 00:00:00', NULL, NULL, 0, 0, '1', 0);
-- 删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('178538143865604', '178538143865601', '删除定点联系单', NULL, NULL, 0, NULL, NULL, 2, 'bg.fixcontact:fixed_contact_20260730:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-07-30 00:00:00', NULL, NULL, 0, 0, '1', 0);
-- 批量删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('178538143865605', '178538143865601', '批量删除定点联系单', NULL, NULL, 0, NULL, NULL, 2, 'bg.fixcontact:fixed_contact_20260730:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-07-30 00:00:00', NULL, NULL, 0, 0, '1', 0);
-- 导出excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('178538143865606', '178538143865601', '导出excel_定点联系单', NULL, NULL, 0, NULL, NULL, 2, 'bg.fixcontact:fixed_contact_20260730:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-07-30 00:00:00', NULL, NULL, 0, 0, '1', 0);
-- 导入excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('178538143865607', '178538143865601', '导入excel_定点联系单', NULL, NULL, 0, NULL, NULL, 2, 'bg.fixcontact:fixed_contact_20260730:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-07-30 00:00:00', NULL, NULL, 0, 0, '1', 0);
-- 角色授权(admin角色)
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('178538143865608', 'f6817f48af4fb3af11b9e8bf182f618b', '178538143865601', NULL, '2026-07-30 00:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('178538143865609', 'f6817f48af4fb3af11b9e8bf182f618b', '178538143865602', NULL, '2026-07-30 00:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('178538143865610', 'f6817f48af4fb3af11b9e8bf182f618b', '178538143865603', NULL, '2026-07-30 00:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('178538143865611', 'f6817f48af4fb3af11b9e8bf182f618b', '178538143865604', NULL, '2026-07-30 00:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('178538143865612', 'f6817f48af4fb3af11b9e8bf182f618b', '178538143865605', NULL, '2026-07-30 00:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('178538143865613', 'f6817f48af4fb3af11b9e8bf182f618b', '178538143865606', NULL, '2026-07-30 00:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('178538143865614', 'f6817f48af4fb3af11b9e8bf182f618b', '178538143865607', NULL, '2026-07-30 00:00:00', '127.0.0.1');
@@ -0,0 +1,22 @@
DROP PROCEDURE IF EXISTS safe_add_fixcontact_bpm_status;
DELIMITER //
CREATE PROCEDURE safe_add_fixcontact_bpm_status()
BEGIN
DECLARE table_exists INT DEFAULT 0;
DECLARE col_exists INT DEFAULT 0;
SELECT COUNT(*) INTO table_exists FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fixed_contact_20260730';
IF table_exists > 0 THEN
SELECT COUNT(*) INTO col_exists FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fixed_contact_20260730' AND COLUMN_NAME = 'bpm_status';
IF col_exists = 0 THEN
ALTER TABLE fixed_contact_20260730 ADD COLUMN bpm_status varchar(32) DEFAULT NULL COMMENT '流程状态:1=未开始,2=督办中,3=已完成';
END IF;
END IF;
END //
DELIMITER ;
CALL safe_add_fixcontact_bpm_status();
DROP PROCEDURE IF EXISTS safe_add_fixcontact_bpm_status;
@@ -0,0 +1,30 @@
DROP PROCEDURE IF EXISTS safe_add_fixcontact_approval_fields;
DELIMITER //
CREATE PROCEDURE safe_add_fixcontact_approval_fields()
BEGIN
DECLARE table_exists INT DEFAULT 0;
DECLARE col_appro_exists INT DEFAULT 0;
DECLARE col_leader_exists INT DEFAULT 0;
SELECT COUNT(*) INTO table_exists FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fixed_contact_20260730';
IF table_exists > 0 THEN
SELECT COUNT(*) INTO col_appro_exists FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fixed_contact_20260730' AND COLUMN_NAME = 'is_need_appro';
IF col_appro_exists = 0 THEN
ALTER TABLE fixed_contact_20260730 ADD COLUMN is_need_appro varchar(1) DEFAULT '0' COMMENT '是否所办领导审批:0=否,1=是';
END IF;
SELECT COUNT(*) INTO col_leader_exists FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fixed_contact_20260730' AND COLUMN_NAME = 'sup_deptleaderid';
IF col_leader_exists = 0 THEN
ALTER TABLE fixed_contact_20260730 ADD COLUMN sup_deptleaderid varchar(255) DEFAULT NULL COMMENT '所办领导ID,多个逗号分隔';
END IF;
END IF;
END //
DELIMITER ;
CALL safe_add_fixcontact_approval_fields();
DROP PROCEDURE IF EXISTS safe_add_fixcontact_approval_fields;
@@ -0,0 +1,26 @@
DROP PROCEDURE IF EXISTS safe_fix_sup_deptleaderid_column;
DELIMITER //
CREATE PROCEDURE safe_fix_sup_deptleaderid_column()
BEGIN
DECLARE table_exists INT DEFAULT 0;
DECLARE col_wrong_exists INT DEFAULT 0;
DECLARE col_correct_exists INT DEFAULT 0;
SELECT COUNT(*) INTO table_exists FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fixed_contact_20260730';
IF table_exists > 0 THEN
SELECT COUNT(*) INTO col_wrong_exists FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fixed_contact_20260730' AND COLUMN_NAME = 'sup_deptleader_id';
SELECT COUNT(*) INTO col_correct_exists FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fixed_contact_20260730' AND COLUMN_NAME = 'sup_deptleaderid';
IF col_wrong_exists > 0 AND col_correct_exists = 0 THEN
ALTER TABLE fixed_contact_20260730 RENAME COLUMN sup_deptleader_id TO sup_deptleaderid;
END IF;
END IF;
END //
DELIMITER ;
CALL safe_fix_sup_deptleaderid_column();
DROP PROCEDURE IF EXISTS safe_fix_sup_deptleaderid_column;