Bladeren bron

草稿箱删除

dzx 10 maanden geleden
bovenliggende
commit
9733b58cfe

+ 14 - 7
src/main/java/com/xjrsoft/module/hikvision/util/ApiUtil.java

@@ -19,11 +19,12 @@ public class ApiUtil {
     /**
      * 调用海康接口(该方法内部实现了登入认证逻辑)
      * @param apiPath 接口地址
-     * @param paramJson body参数
+     * @param body body参数
      * @param querys 查询参数
+     * @param header header参数
      * @return 接口调用结果
      */
-    public String doPost(String apiPath, String paramJson, Map<String, String> querys){
+    public String doPost(String apiPath, String body, Map<String, String> querys, Map<String, String> header){
         /**
          * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
          */
@@ -51,11 +52,17 @@ public class ApiUtil {
          */
         String contentType = "application/json";
 
-        /**
-         * STEP5:组装请求参数
-         */
-        String body = paramJson;
+        return ArtemisHttpUtil.doPostStringArtemis(path, body, querys, null, contentType , header);// post请求application/json类型参数
+    }
 
-        return ArtemisHttpUtil.doPostStringArtemis(path, body, querys, null, contentType , null);// post请求application/json类型参数
+    /**
+     * 调用海康接口(该方法内部实现了登入认证逻辑)
+     * @param apiPath 接口地址
+     * @param body body参数
+     * @param querys 查询参数
+     * @return 接口调用结果
+     */
+    public String doPost(String apiPath, String body, Map<String, String> querys){
+        return doPost(apiPath, body, querys, null);
     }
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/hikvision/util/DataUtil.java

@@ -44,7 +44,7 @@ public class DataUtil {
             idCodeMap.put(department.getCode(), department.getId());
         }
 
-        String result = apiUtil.doPost(apiPath, dataArray.toString(), null);
+        String result = apiUtil.doPost(apiPath, dataArray.toString(), null, null);
         JsonElement parse = jsonParser.parse(result);
         JsonObject resultJson = parse.getAsJsonObject();
         if(resultJson.get("code").getAsInt() == 0 && "success".equals(resultJson.get("msg").getAsString())){

+ 6 - 1
src/main/java/com/xjrsoft/module/workflow/mapper/WorkflowExtraMapper.java

@@ -1,8 +1,11 @@
 package com.xjrsoft.module.workflow.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.workflow.entity.WorkflowExtra;
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Update;
 
 /**
  * <p>
@@ -13,6 +16,8 @@ import org.apache.ibatis.annotations.Mapper;
  * @since 2022-10-11
  */
 @Mapper
-public interface WorkflowExtraMapper extends BaseMapper<WorkflowExtra> {
+public interface WorkflowExtraMapper extends MPJBaseMapper<WorkflowExtra> {
 
+    @Delete("delete from #{tableName} where id = #{dataId}")
+    void deleteFormData(String tableName, String dataId);
 }

+ 1 - 0
src/main/java/com/xjrsoft/module/workflow/service/IWorkflowDraftService.java

@@ -13,4 +13,5 @@ import com.xjrsoft.module.workflow.entity.WorkflowDraft;
  */
 public interface IWorkflowDraftService extends MPJBaseService<WorkflowDraft> {
 
+    void deleteFormData(String tableName, String dataId);
 }

+ 8 - 1
src/main/java/com/xjrsoft/module/workflow/service/impl/WorkflowDraftServiceImpl.java

@@ -3,7 +3,9 @@ package com.xjrsoft.module.workflow.service.impl;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.xjrsoft.module.workflow.entity.WorkflowDraft;
 import com.xjrsoft.module.workflow.mapper.WorkflowDraftMapper;
+import com.xjrsoft.module.workflow.mapper.WorkflowExtraMapper;
 import com.xjrsoft.module.workflow.service.IWorkflowDraftService;
+import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
 /**
@@ -15,6 +17,11 @@ import org.springframework.stereotype.Service;
  * @since 2023-10-11
  */
 @Service
+@AllArgsConstructor
 public class WorkflowDraftServiceImpl extends MPJBaseServiceImpl<WorkflowDraftMapper, WorkflowDraft> implements IWorkflowDraftService {
-
+    private final WorkflowExtraMapper workflowExtraMapper;
+    @Override
+    public void deleteFormData(String tableName, String dataId) {
+        workflowExtraMapper.deleteFormData(tableName, dataId);
+    }
 }

+ 165 - 10
src/main/java/com/xjrsoft/module/workflow/service/impl/WorkflowExecuteServiceImpl.java

@@ -23,8 +23,22 @@ import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.yulichang.toolkit.MPJWrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import com.xjrsoft.common.constant.GlobalConstant;
-import com.xjrsoft.common.enums.*;
+import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.common.enums.FormTemplateType;
+import com.xjrsoft.common.enums.WorkflowApproveType;
+import com.xjrsoft.common.enums.WorkflowAutoAgreeType;
+import com.xjrsoft.common.enums.WorkflowIsPrevChooseNextType;
+import com.xjrsoft.common.enums.WorkflowIsRecycleType;
+import com.xjrsoft.common.enums.WorkflowMultiInstanceFinishType;
+import com.xjrsoft.common.enums.WorkflowMultiInstanceType;
+import com.xjrsoft.common.enums.WorkflowNoHandlerType;
+import com.xjrsoft.common.enums.WorkflowRelationAuthType;
+import com.xjrsoft.common.enums.YesOrNoEnum;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
@@ -48,15 +62,115 @@ import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.system.entity.Stamp;
 import com.xjrsoft.module.system.service.IFileService;
 import com.xjrsoft.module.system.service.IStampService;
-import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.workflow.constant.WorkflowConstant;
-import com.xjrsoft.module.workflow.dto.*;
-import com.xjrsoft.module.workflow.entity.*;
-import com.xjrsoft.module.workflow.mapper.*;
-import com.xjrsoft.module.workflow.model.*;
-import com.xjrsoft.module.workflow.service.*;
+import com.xjrsoft.module.workflow.dto.AddOrSubSignDto;
+import com.xjrsoft.module.workflow.dto.ApproveDto;
+import com.xjrsoft.module.workflow.dto.ApproveMultiDto;
+import com.xjrsoft.module.workflow.dto.ApproveMultiInfoDto;
+import com.xjrsoft.module.workflow.dto.ApproveRecordListDto;
+import com.xjrsoft.module.workflow.dto.ApproveUserDto;
+import com.xjrsoft.module.workflow.dto.ApproveUserMultiDto;
+import com.xjrsoft.module.workflow.dto.CirculatedTaskPageDto;
+import com.xjrsoft.module.workflow.dto.DeployDto;
+import com.xjrsoft.module.workflow.dto.DraftPageDto;
+import com.xjrsoft.module.workflow.dto.FinishedTaskPageDto;
+import com.xjrsoft.module.workflow.dto.FormFinishedTaskDto;
+import com.xjrsoft.module.workflow.dto.GetAssigneeDto;
+import com.xjrsoft.module.workflow.dto.LaunchDto;
+import com.xjrsoft.module.workflow.dto.LaunchRelationTaskDto;
+import com.xjrsoft.module.workflow.dto.MonitorPageDto;
+import com.xjrsoft.module.workflow.dto.MoveRecycleDto;
+import com.xjrsoft.module.workflow.dto.MyExaminePageDto;
+import com.xjrsoft.module.workflow.dto.MyProcessPageDto;
+import com.xjrsoft.module.workflow.dto.PendingTaskPageDto;
+import com.xjrsoft.module.workflow.dto.ReLaunchDto;
+import com.xjrsoft.module.workflow.dto.RecycleDeleteDto;
+import com.xjrsoft.module.workflow.dto.RecycleProcessPageDto;
+import com.xjrsoft.module.workflow.dto.RejectNodeDto;
+import com.xjrsoft.module.workflow.dto.RelationTaskInfoDto;
+import com.xjrsoft.module.workflow.dto.RelationTaskPageDto;
+import com.xjrsoft.module.workflow.dto.RestartDto;
+import com.xjrsoft.module.workflow.dto.SaveDraftDto;
+import com.xjrsoft.module.workflow.dto.SetAssigneeDto;
+import com.xjrsoft.module.workflow.dto.SetSuspendedDto;
+import com.xjrsoft.module.workflow.dto.TransferDto;
+import com.xjrsoft.module.workflow.dto.UpdateDraftDto;
+import com.xjrsoft.module.workflow.dto.WithdrawDto;
+import com.xjrsoft.module.workflow.entity.WorkflowApproveRecord;
+import com.xjrsoft.module.workflow.entity.WorkflowCirculated;
+import com.xjrsoft.module.workflow.entity.WorkflowDelegate;
+import com.xjrsoft.module.workflow.entity.WorkflowDraft;
+import com.xjrsoft.module.workflow.entity.WorkflowExtra;
+import com.xjrsoft.module.workflow.entity.WorkflowFormRelation;
+import com.xjrsoft.module.workflow.entity.WorkflowRecord;
+import com.xjrsoft.module.workflow.entity.WorkflowSchema;
+import com.xjrsoft.module.workflow.entity.WorkflowSchemaHistory;
+import com.xjrsoft.module.workflow.entity.XjrWorkflowOperateRecord;
+import com.xjrsoft.module.workflow.mapper.WorkflowDelegateMapper;
+import com.xjrsoft.module.workflow.mapper.WorkflowExtraMapper;
+import com.xjrsoft.module.workflow.mapper.WorkflowRecordMapper;
+import com.xjrsoft.module.workflow.mapper.WorkflowSchemaHistoryMapper;
+import com.xjrsoft.module.workflow.mapper.WorkflowSchemaMapper;
+import com.xjrsoft.module.workflow.mapper.XjrWorkflowExtraMapper;
+import com.xjrsoft.module.workflow.mapper.XjrWorkflowOperateRecordMapper;
+import com.xjrsoft.module.workflow.model.ApiConfig;
+import com.xjrsoft.module.workflow.model.ApiRequestParamsConfig;
+import com.xjrsoft.module.workflow.model.AuthConfig;
+import com.xjrsoft.module.workflow.model.ButtonConfig;
+import com.xjrsoft.module.workflow.model.FormAssignmentConfig;
+import com.xjrsoft.module.workflow.model.FormConfig;
+import com.xjrsoft.module.workflow.model.MemberConfig;
+import com.xjrsoft.module.workflow.model.NoticePolicyParam;
+import com.xjrsoft.module.workflow.model.ProcessParamConfig;
+import com.xjrsoft.module.workflow.model.RelationProcessConfig;
+import com.xjrsoft.module.workflow.model.StartNodeConfig;
+import com.xjrsoft.module.workflow.model.UserTaskConfig;
+import com.xjrsoft.module.workflow.model.WorkflowSchemaConfig;
+import com.xjrsoft.module.workflow.service.IWorkflowApproveRecordService;
+import com.xjrsoft.module.workflow.service.IWorkflowCirculatedService;
+import com.xjrsoft.module.workflow.service.IWorkflowDraftService;
+import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
+import com.xjrsoft.module.workflow.service.IWorkflowExtraService;
+import com.xjrsoft.module.workflow.service.IWorkflowFormRelationService;
+import com.xjrsoft.module.workflow.service.IWorkflowRecordService;
+import com.xjrsoft.module.workflow.service.IWorkflowSchemaService;
+import com.xjrsoft.module.workflow.service.IXjrWorkflowOperateRecordService;
 import com.xjrsoft.module.workflow.utils.WorkFlowUtil;
-import com.xjrsoft.module.workflow.vo.*;
+import com.xjrsoft.module.workflow.vo.AllRecordListVo;
+import com.xjrsoft.module.workflow.vo.ApproveMultiInfoVo;
+import com.xjrsoft.module.workflow.vo.ApproveMultiVo;
+import com.xjrsoft.module.workflow.vo.CirculatedTaskPageVo;
+import com.xjrsoft.module.workflow.vo.DraftInfoVo;
+import com.xjrsoft.module.workflow.vo.DraftPageVo;
+import com.xjrsoft.module.workflow.vo.FinishedTaskPageVo;
+import com.xjrsoft.module.workflow.vo.FinishedTaskVo;
+import com.xjrsoft.module.workflow.vo.FormFinishedTaskVo;
+import com.xjrsoft.module.workflow.vo.GetAssigneeVo;
+import com.xjrsoft.module.workflow.vo.GetCountVo;
+import com.xjrsoft.module.workflow.vo.HistoryTaskVo;
+import com.xjrsoft.module.workflow.vo.LaunchAndApproveVo;
+import com.xjrsoft.module.workflow.vo.MonitorPageVo;
+import com.xjrsoft.module.workflow.vo.MyProcessPageVo;
+import com.xjrsoft.module.workflow.vo.PendingTaskVo;
+import com.xjrsoft.module.workflow.vo.ProcessInfoVo;
+import com.xjrsoft.module.workflow.vo.ProcessRecordListVo;
+import com.xjrsoft.module.workflow.vo.RecycleProcessInfoVo;
+import com.xjrsoft.module.workflow.vo.RecycleProcessPageVo;
+import com.xjrsoft.module.workflow.vo.RejectNodeVo;
+import com.xjrsoft.module.workflow.vo.RelationFormInfoVo;
+import com.xjrsoft.module.workflow.vo.RelationTaskInfoVo;
+import com.xjrsoft.module.workflow.vo.RelationTaskPageVo;
+import com.xjrsoft.module.workflow.vo.RestartVo;
+import com.xjrsoft.module.workflow.vo.StartNodeFormInfoVo;
+import com.xjrsoft.module.workflow.vo.StartProcessInfoVo;
+import com.xjrsoft.module.workflow.vo.StartProcessRelationTaskVo;
+import com.xjrsoft.module.workflow.vo.TaskInfoRelationTaskVo;
+import com.xjrsoft.module.workflow.vo.TaskInfoVo;
+import com.xjrsoft.module.workflow.vo.UserDefinedProcessRecordListVo;
+import com.xjrsoft.module.workflow.vo.UserTaskFormInfoVo;
+import com.xjrsoft.module.workflow.vo.UserTaskInfoVo;
+import com.xjrsoft.module.workflow.vo.UserTaskRelationTaskVo;
+import com.xjrsoft.module.workflow.vo.WorkflowSchemaInfoVo;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
@@ -66,7 +180,14 @@ import org.camunda.bpm.engine.HistoryService;
 import org.camunda.bpm.engine.RepositoryService;
 import org.camunda.bpm.engine.RuntimeService;
 import org.camunda.bpm.engine.TaskService;
-import org.camunda.bpm.engine.history.*;
+import org.camunda.bpm.engine.history.HistoricActivityInstance;
+import org.camunda.bpm.engine.history.HistoricDetail;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.camunda.bpm.engine.history.HistoricProcessInstanceQuery;
+import org.camunda.bpm.engine.history.HistoricTaskInstance;
+import org.camunda.bpm.engine.history.HistoricTaskInstanceQuery;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.history.HistoricVariableUpdate;
 import org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity;
 import org.camunda.bpm.engine.impl.persistence.entity.TaskEntity;
 import org.camunda.bpm.engine.repository.Deployment;
@@ -88,7 +209,17 @@ import org.springframework.transaction.annotation.Transactional;
 import org.ssssssss.magicapi.core.service.MagicAPIService;
 
 import java.time.LocalDateTime;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -3980,6 +4111,30 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
 
     @Override
     public boolean deleteDraft(List<Long> ids) {
+        //根据草稿箱查询对应的流程
+        List<WorkflowDraft> list = workflowDraftService.list(
+            new QueryWrapper<WorkflowDraft>()
+            .lambda().eq(WorkflowDraft::getId, ids)
+        );
+        JsonParser parser = new JsonParser();
+        for (WorkflowDraft workflowDraft : list) {
+            WorkflowSchema schema = workflowSchemaMapper.selectById(workflowDraft.getSchemaId());
+            JsonObject JsonContent = parser.parse(schema.getJsonContent()).getAsJsonObject();
+            JsonObject processConfig = JsonContent.get("processConfig").getAsJsonObject();
+            String formId = processConfig.get("formInitConfig").getAsJsonObject().get("formId").getAsString();
+            FormTemplate formTemplate = formTemplateMapper.selectById(formId);
+
+            JsonObject formJson = parser.parse(formTemplate.getFormJson()).getAsJsonObject();
+            JsonArray tableConfigs = formJson.get("tableConfigs").getAsJsonArray();
+
+            for (JsonElement tableConfig : tableConfigs) {
+                JsonObject table = tableConfig.getAsJsonObject();
+                if(workflowDraft.getDataId() != null &&  !"".equals(workflowDraft.getDataId())){
+                    workflowDraftService.deleteFormData(table.get("tableName").getAsString(), workflowDraft.getDataId());
+                }
+            }
+        }
+
         return workflowDraftService.removeBatchByIds(ids);
     }