mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 05:19:00 +08:00
♻️ Refactoring code. pigx-oa 适配最新V5 UI
This commit is contained in:
1 parent
1ddacb086e
commit
27604385a3
19 files changed
+266
-48
No files matched your search
+49
-6
@@ -17,6 +17,10 @@
|
||||
|
||||
package com.pig4cloud.pigx.act.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.act.entity.LeaveBill;
|
||||
@@ -24,11 +28,20 @@ import com.pig4cloud.pigx.act.service.LeaveBillService;
|
||||
import com.pig4cloud.pigx.act.service.ProcessService;
|
||||
import com.pig4cloud.pigx.common.core.constant.enums.TaskStatusEnum;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel;
|
||||
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
|
||||
import com.pig4cloud.pigx.common.xss.core.XssCleanIgnore;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请假流程
|
||||
*
|
||||
@@ -36,8 +49,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
* @date 2018-09-27 15:20:44
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/leave-bill")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(description = "leave-bill", name = "leave-bill表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class LeaveBillController {
|
||||
|
||||
private final LeaveBillService leaveBillService;
|
||||
@@ -51,8 +66,13 @@ public class LeaveBillController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@PreAuthorize("@pms.hasPermission('oa_leave_bill_view')")
|
||||
public R getLeaveBillPage(Page page, LeaveBill leaveBill) {
|
||||
return R.ok(leaveBillService.page(page, Wrappers.query(leaveBill)));
|
||||
LambdaQueryWrapper<LeaveBill> wrapper = Wrappers.<LeaveBill>lambdaQuery()
|
||||
.like(StrUtil.isNotBlank(leaveBill.getUsername()), LeaveBill::getUsername, leaveBill.getUsername())
|
||||
.eq(StrUtil.isNotBlank(leaveBill.getState()), LeaveBill::getState, leaveBill.getState());
|
||||
return R.ok(leaveBillService.page(page, wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,6 +81,8 @@ public class LeaveBillController {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{leaveId}")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@PreAuthorize("@pms.hasPermission('oa_leave_bill_view')")
|
||||
public R getById(@PathVariable("leaveId") Long leaveId) {
|
||||
return R.ok(leaveBillService.getById(leaveId));
|
||||
}
|
||||
@@ -72,6 +94,8 @@ public class LeaveBillController {
|
||||
*/
|
||||
@PostMapping
|
||||
@XssCleanIgnore
|
||||
@Operation(summary = "保存", description = "保存")
|
||||
@PreAuthorize("@pms.hasPermission('oa_leave_bill_add')")
|
||||
public R save(@RequestBody LeaveBill leaveBill) {
|
||||
leaveBill.setUsername(SecurityUtils.getUser().getUsername());
|
||||
leaveBill.setState(TaskStatusEnum.UNSUBMIT.getStatus());
|
||||
@@ -85,18 +109,22 @@ public class LeaveBillController {
|
||||
*/
|
||||
@PutMapping
|
||||
@XssCleanIgnore
|
||||
@Operation(summary = "修改", description = "修改")
|
||||
@PreAuthorize("@pms.hasPermission('oa_leave_bill_edit')")
|
||||
public R updateById(@RequestBody LeaveBill leaveBill) {
|
||||
return R.ok(leaveBillService.updateById(leaveBill));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param leaveId
|
||||
* @param ids
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping("/{leaveId}")
|
||||
public R removeById(@PathVariable Long leaveId) {
|
||||
return R.ok(leaveBillService.removeById(leaveId));
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除请假工单", description = "删除请假工单")
|
||||
@PreAuthorize("@pms.hasPermission('oa_leave_bill_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(leaveBillService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,8 +133,23 @@ public class LeaveBillController {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/submit/{leaveId}")
|
||||
@Operation(summary = "提交请假流程", description = "提交请假流程")
|
||||
@PreAuthorize("@pms.hasPermission('oa_leave_bill_view')")
|
||||
public R submit(@PathVariable("leaveId") Long leaveId) {
|
||||
return R.ok(processService.saveStartProcess(leaveId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param leaveBill
|
||||
* @return R
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出", description = "导出")
|
||||
@PreAuthorize("@pms.hasPermission('oa_leave_bill_export')")
|
||||
public List<LeaveBill> export(LeaveBill leaveBill) {
|
||||
return leaveBillService.list(Wrappers.query(leaveBill));
|
||||
}
|
||||
|
||||
}
|
||||
+22
-4
@@ -20,7 +20,13 @@ package com.pig4cloud.pigx.act.controller;
|
||||
import com.pig4cloud.pigx.act.dto.ModelForm;
|
||||
import com.pig4cloud.pigx.act.service.ModelService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -32,35 +38,47 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/model")
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@Tag(description = "model", name = "model表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class ModelController {
|
||||
|
||||
private final ModelService modelService;
|
||||
|
||||
@PostMapping(value = "/insert")
|
||||
@Operation(summary = "新增Model", description = "新增Model")
|
||||
@PreAuthorize("@pms.hasPermission('oa_model_add')")
|
||||
public R<Boolean> insertForm(@RequestBody @Valid ModelForm form) {
|
||||
modelService.create(form.getName(), form.getKey(), form.getDesc(), form.getCategory());
|
||||
return R.ok(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Model", description = "新增Model")
|
||||
@PreAuthorize("@pms.hasPermission('oa_model_add')")
|
||||
public R createModel(@RequestParam String name, @RequestParam String key, @RequestParam String desc,
|
||||
@RequestParam String category) {
|
||||
return R.ok(modelService.create(name, key, desc, category));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "条件查询", description = "条件查询")
|
||||
@PreAuthorize("@pms.hasPermission('oa_model_view')")
|
||||
public R getModelPage(@RequestParam Map<String, Object> params) {
|
||||
return R.ok(modelService.getModelPage(params));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public R removeModelById(@PathVariable("id") String id) {
|
||||
return R.ok(modelService.removeModelById(id));
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除模型", description = "删除模型")
|
||||
@PreAuthorize("@pms.hasPermission('oa_model_del')")
|
||||
public R removeModelById(@RequestBody String[] ids) {
|
||||
return R.ok(modelService.removeModelById(ids));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/deploy/{id}")
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@PreAuthorize("@pms.hasPermission('oa_model_view')")
|
||||
public R deploy(@PathVariable("id") String id) {
|
||||
return modelService.deploy(id) ? R.ok() : R.failed();
|
||||
}
|
||||
|
||||
+19
-8
@@ -21,12 +21,15 @@ import cn.hutool.core.io.IoUtil;
|
||||
import com.pig4cloud.pigx.act.service.ProcessService;
|
||||
import com.pig4cloud.pigx.common.core.constant.enums.ResourceTypeEnum;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.security.annotation.Inner;
|
||||
import lombok.AllArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -37,22 +40,26 @@ import java.util.Map;
|
||||
* @date 2018/9/25
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/process")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(description = "process", name = "process表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class ProcessController {
|
||||
|
||||
private final ProcessService processService;
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "条件查询", description = "条件查询")
|
||||
@PreAuthorize("@pms.hasPermission('oa_process_view')")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
return R.ok(processService.getProcessByPage(params));
|
||||
}
|
||||
|
||||
@Inner(value = false)
|
||||
@GetMapping(value = "/resource/{proInsId}/{procDefId}/{resType}")
|
||||
@Operation(summary = "查询", description = "查询")
|
||||
@PreAuthorize("@pms.hasPermission('oa_process_view')")
|
||||
public ResponseEntity resourceRead(@PathVariable String procDefId, @PathVariable String proInsId,
|
||||
@PathVariable String resType) {
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
|
||||
if (ResourceTypeEnum.XML.getType().equals(resType)) {
|
||||
@@ -67,13 +74,17 @@ public class ProcessController {
|
||||
}
|
||||
|
||||
@PutMapping("/status/{procDefId}/{status}")
|
||||
@Operation(summary = "修改", description = "修改")
|
||||
@PreAuthorize("@pms.hasPermission('oa_process_edit')")
|
||||
public R updateState(@PathVariable String procDefId, @PathVariable String status) {
|
||||
return R.ok(processService.updateStatus(status, procDefId));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{deploymentId}")
|
||||
public R deleteProcIns(@PathVariable String deploymentId) {
|
||||
return R.ok(processService.removeProcIns(deploymentId));
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除流程", description = "删除流程")
|
||||
@PreAuthorize("@pms.hasPermission('oa_process_del')")
|
||||
public R deleteProcIns(@RequestBody String[] ids) {
|
||||
return R.ok(processService.removeProcIns(ids));
|
||||
}
|
||||
|
||||
}
|
||||
+27
-2
@@ -19,19 +19,23 @@ package com.pig4cloud.pigx.act.controller;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.pig4cloud.pigx.act.dto.LeaveBillDto;
|
||||
import com.pig4cloud.pigx.act.dto.TaskDTO;
|
||||
import com.pig4cloud.pigx.act.service.ActTaskService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.security.annotation.Inner;
|
||||
import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel;
|
||||
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
|
||||
import com.pig4cloud.pigx.common.xss.core.XssCleanIgnore;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -46,23 +50,27 @@ public class TaskController {
|
||||
private final ActTaskService actTaskService;
|
||||
|
||||
@GetMapping("/todo")
|
||||
@Operation(summary = "条件查询", description = "条件查询")
|
||||
public R todo(@RequestParam Map<String, Object> params) {
|
||||
return R.ok(actTaskService.getTaskByName(params, SecurityUtils.getUser().getUsername()));
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "id查询", description = "id查询")
|
||||
public R getTaskById(@PathVariable String id) {
|
||||
return R.ok(actTaskService.getTaskById(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@XssCleanIgnore
|
||||
@Operation(summary = "新增", description = "新增")
|
||||
@PreAuthorize("@pms.hasPermission('oa_task_add')")
|
||||
public R submitTask(@RequestBody LeaveBillDto leaveBillDto) {
|
||||
return R.ok(actTaskService.submitTask(leaveBillDto));
|
||||
}
|
||||
|
||||
@Inner(value = false)
|
||||
@GetMapping("/view/{id}")
|
||||
@Operation(summary = "查询", description = "查询")
|
||||
public ResponseEntity viewCurrentImage(@PathVariable String id) {
|
||||
InputStream imageStream = actTaskService.viewByTaskId(id);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -71,8 +79,25 @@ public class TaskController {
|
||||
}
|
||||
|
||||
@GetMapping("/comment/{id}")
|
||||
@Operation(summary = "查询", description = "查询")
|
||||
@PreAuthorize("@pms.hasPermission('oa_task_view')")
|
||||
public R commitList(@PathVariable String id) {
|
||||
return R.ok(actTaskService.getCommentByTaskId(id));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除", description = "删除")
|
||||
@PreAuthorize("@pms.hasPermission('oa_task_del')")
|
||||
public R submitTask(@RequestBody String[] ids) {
|
||||
actTaskService.delTasks(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出", description = "导出")
|
||||
public List<TaskDTO> export(TaskDTO taskDTO) {
|
||||
return actTaskService.list(taskDTO);
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.pig4cloud.pigx.act.mapper;
|
||||
|
||||
import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 请假流程
|
||||
*
|
||||
* @author 冷冷
|
||||
* @date 2018-09-27 15:20:44
|
||||
*/
|
||||
@Mapper
|
||||
public interface ActTaskMapper extends PigxBaseMapper<Model> {
|
||||
|
||||
void delTasks(@Param("ids") String[] ids);
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.pig4cloud.pigx.act.mapper;
|
||||
|
||||
import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 请假流程
|
||||
*
|
||||
* @author 冷冷
|
||||
* @date 2018-09-27 15:20:44
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProcessMapper extends PigxBaseMapper<Model> {
|
||||
|
||||
void deleteByIds(@Param("ids") String[] ids);
|
||||
|
||||
}
|
||||
+10
@@ -20,6 +20,7 @@ package com.pig4cloud.pigx.act.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.pig4cloud.pigx.act.dto.CommentDto;
|
||||
import com.pig4cloud.pigx.act.dto.LeaveBillDto;
|
||||
import com.pig4cloud.pigx.act.dto.TaskDTO;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
@@ -67,4 +68,13 @@ public interface ActTaskService {
|
||||
*/
|
||||
InputStream viewByTaskId(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void delTasks(String[] ids);
|
||||
|
||||
List<TaskDTO> list(TaskDTO taskDTO);
|
||||
|
||||
}
|
||||
+2
-2
@@ -47,10 +47,10 @@ public interface ModelService {
|
||||
|
||||
/**
|
||||
* 删除流程
|
||||
* @param id
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean removeModelById(String id);
|
||||
Boolean removeModelById(String[] ids);
|
||||
|
||||
/**
|
||||
* 部署流程
|
||||
|
||||
+2
-2
@@ -55,10 +55,10 @@ public interface ProcessService {
|
||||
|
||||
/**
|
||||
* 删除流程实例
|
||||
* @param deploymentId
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean removeProcIns(String deploymentId);
|
||||
Boolean removeProcIns(String[] ids);
|
||||
|
||||
/**
|
||||
* 启动流程、更新请假单状态
|
||||
|
||||
+33
@@ -17,6 +17,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.act.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -25,6 +26,7 @@ import com.pig4cloud.pigx.act.dto.CommentDto;
|
||||
import com.pig4cloud.pigx.act.dto.LeaveBillDto;
|
||||
import com.pig4cloud.pigx.act.dto.TaskDTO;
|
||||
import com.pig4cloud.pigx.act.entity.LeaveBill;
|
||||
import com.pig4cloud.pigx.act.mapper.ActTaskMapper;
|
||||
import com.pig4cloud.pigx.act.mapper.LeaveBillMapper;
|
||||
import com.pig4cloud.pigx.act.service.ActTaskService;
|
||||
import com.pig4cloud.pigx.common.core.constant.PaginationConstants;
|
||||
@@ -225,6 +227,37 @@ public class ActTaskServiceImpl implements ActTaskService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
public void delTasks(String[] ids) {
|
||||
for (String taskId : ids) {
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
|
||||
runtimeService.suspendProcessInstanceById(task.getProcessInstanceId());
|
||||
runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "Deleted");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List list(TaskDTO taskDTO) {
|
||||
|
||||
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||
List<TaskDTO> taskDTOList = taskQuery.orderByTaskCreateTime().desc().list().stream().map(task -> {
|
||||
TaskDTO dto = new TaskDTO();
|
||||
dto.setTaskId(task.getId());
|
||||
dto.setTaskName(task.getName());
|
||||
dto.setProcessInstanceId(task.getProcessInstanceId());
|
||||
dto.setNodeKey(task.getTaskDefinitionKey());
|
||||
dto.setCategory(task.getCategory());
|
||||
dto.setTime(task.getCreateTime());
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
return taskDTOList;
|
||||
}
|
||||
|
||||
private List<String> findOutFlagListByTaskId(Task task, ProcessInstance pi) {
|
||||
// 查询ProcessDefinitionEntiy对象
|
||||
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) repositoryService
|
||||
|
||||
+8
-4
@@ -33,6 +33,7 @@ import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.repository.Deployment;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.activiti.engine.repository.ModelQuery;
|
||||
@@ -117,7 +118,8 @@ public class ModelServiceImpl implements ModelService {
|
||||
.orderByLastUpdateTime().desc();
|
||||
String category = (String) params.get("category");
|
||||
if (StrUtil.isNotBlank(category)) {
|
||||
modelQuery.modelCategory(category);
|
||||
// like '%category%'
|
||||
modelQuery.modelCategoryLike(StrUtil.concat(true, "%", category, "%"));
|
||||
}
|
||||
|
||||
int page = MapUtil.getInt(params, PaginationConstants.CURRENT);
|
||||
@@ -131,12 +133,14 @@ public class ModelServiceImpl implements ModelService {
|
||||
|
||||
/**
|
||||
* 删除流程
|
||||
* @param id
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean removeModelById(String id) {
|
||||
repositoryService.deleteModel(id);
|
||||
public Boolean removeModelById(String[] ids) {
|
||||
for (String id : ids) {
|
||||
repositoryService.deleteModel(id);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
+9
-3
@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.act.dto.ProcessDefDTO;
|
||||
import com.pig4cloud.pigx.act.entity.LeaveBill;
|
||||
import com.pig4cloud.pigx.act.mapper.LeaveBillMapper;
|
||||
import com.pig4cloud.pigx.act.mapper.ProcessMapper;
|
||||
import com.pig4cloud.pigx.act.service.ProcessService;
|
||||
import com.pig4cloud.pigx.common.core.constant.PaginationConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.enums.ProcessStatusEnum;
|
||||
@@ -59,6 +60,8 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
|
||||
private final LeaveBillMapper leaveBillMapper;
|
||||
|
||||
private final ProcessMapper processMapper;
|
||||
|
||||
/**
|
||||
* 分页流程列表
|
||||
* @param params
|
||||
@@ -72,6 +75,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
String category = MapUtil.getStr(params, "category");
|
||||
if (StrUtil.isNotBlank(category)) {
|
||||
query.processDefinitionCategory(category);
|
||||
query.processDefinitionCategoryLike(StrUtil.concat(true, "%", category, "%"));
|
||||
}
|
||||
|
||||
int page = MapUtil.getInt(params, PaginationConstants.CURRENT);
|
||||
@@ -81,6 +85,8 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
result.setTotal(query.count());
|
||||
|
||||
List<ProcessDefDTO> deploymentList = query.listPage((page - 1) * limit, limit).stream()
|
||||
.filter(processDefinition -> repositoryService.createDeploymentQuery()
|
||||
.deploymentId(processDefinition.getDeploymentId()).singleResult() != null)
|
||||
.map(processDefinition -> {
|
||||
Deployment deployment = repositoryService.createDeploymentQuery()
|
||||
.deploymentId(processDefinition.getDeploymentId()).singleResult();
|
||||
@@ -140,12 +146,12 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
|
||||
/**
|
||||
* 删除部署的流程,级联删除流程实例
|
||||
* @param deploymentId
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean removeProcIns(String deploymentId) {
|
||||
repositoryService.deleteDeployment(deploymentId, true);
|
||||
public Boolean removeProcIns(String[] ids) {
|
||||
processMapper.deleteByIds(ids);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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="com.pig4cloud.pigx.act.mapper.ActTaskMapper">
|
||||
|
||||
<delete id="delTasks" >
|
||||
delete from act_ru_task where ID_ in
|
||||
<foreach collection="ids" open="(" close=")" item="item" separator="," >
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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="com.pig4cloud.pigx.act.mapper.ProcessMapper">
|
||||
|
||||
<delete id="deleteByIds" >
|
||||
delete from act_re_procdef where ID_ in
|
||||
<foreach collection="ids" open="(" close=")" item="item" separator="," >
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -21,5 +21,5 @@
|
||||
var ACTIVITI = ACTIVITI || {};
|
||||
|
||||
ACTIVITI.CONFIG = {
|
||||
'contextRoot' : '/act/service',
|
||||
'contextRoot' : '/api/act/service',
|
||||
};
|
||||
@@ -95,15 +95,17 @@ activitiModeler
|
||||
/* Helper method to fetch model from server (always needed) */
|
||||
function fetchModel(modelId) {
|
||||
var tenantId = 1
|
||||
if (localStorage.getItem('pigx-tenantId')) {
|
||||
tenantId = JSON.parse(localStorage.getItem('pigx-tenantId')).content
|
||||
if (localStorage.getItem('tenantId')) {
|
||||
tenantId = JSON.parse(localStorage.getItem('tenantId'))
|
||||
}
|
||||
|
||||
var token = ''
|
||||
if (sessionStorage.getItem('pigx-access_token')){
|
||||
token = JSON.parse(sessionStorage.getItem('pigx-access_token')).content
|
||||
if (sessionStorage.getItem('token')){
|
||||
token = JSON.parse(sessionStorage.getItem('token'))
|
||||
}
|
||||
|
||||
debugger
|
||||
|
||||
var modelUrl = KISBPM.URL.getModel(modelId);
|
||||
|
||||
$http({method: 'GET',
|
||||
|
||||
+4
-4
@@ -378,13 +378,13 @@ var SaveModelCtrl = [ '$rootScope', '$scope', '$http', '$route', '$location',
|
||||
};
|
||||
|
||||
var tenantId = 1
|
||||
if (localStorage.getItem('pigx-tenantId')) {
|
||||
tenantId = JSON.parse(localStorage.getItem('pigx-tenantId')).content
|
||||
if (localStorage.getItem('tenantId')) {
|
||||
tenantId = JSON.parse(localStorage.getItem('tenantId'))
|
||||
}
|
||||
|
||||
var token = ''
|
||||
if (sessionStorage.getItem('pigx-access_token')){
|
||||
token = JSON.parse(sessionStorage.getItem('pigx-access_token')).content
|
||||
if (sessionStorage.getItem('token')){
|
||||
token = JSON.parse(sessionStorage.getItem('token'))
|
||||
}
|
||||
|
||||
// Update
|
||||
|
||||
+4
-4
@@ -1062,13 +1062,13 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
|
||||
|
||||
setRequestHeaders: function() {
|
||||
var tenantId = 1
|
||||
if (localStorage.getItem('pigx-tenantId')) {
|
||||
tenantId = JSON.parse(localStorage.getItem('pigx-tenantId')).content
|
||||
if (localStorage.getItem('tenantId')) {
|
||||
tenantId = JSON.parse(localStorage.getItem('tenantId'))
|
||||
}
|
||||
|
||||
var token = ''
|
||||
if (sessionStorage.getItem('pigx-access_token')){
|
||||
token = JSON.parse(sessionStorage.getItem('pigx-access_token')).content
|
||||
if (sessionStorage.getItem('token')){
|
||||
token = JSON.parse(sessionStorage.getItem('token'))
|
||||
}
|
||||
|
||||
var headers = {
|
||||
|
||||
+4
-4
@@ -63,13 +63,13 @@ angular.module('activitiModeler')
|
||||
StencilSet items
|
||||
*/
|
||||
var tenantId = 1
|
||||
if (localStorage.getItem('pigx-tenantId')) {
|
||||
tenantId = JSON.parse(localStorage.getItem('pigx-tenantId')).content
|
||||
if (localStorage.getItem('tenantId')) {
|
||||
tenantId = JSON.parse(localStorage.getItem('tenantId'))
|
||||
}
|
||||
|
||||
var token = ''
|
||||
if (sessionStorage.getItem('pigx-access_token')){
|
||||
token = JSON.parse(sessionStorage.getItem('pigx-access_token')).content
|
||||
if (sessionStorage.getItem('token')){
|
||||
token = JSON.parse(sessionStorage.getItem('token'))
|
||||
}
|
||||
|
||||
$http({method: 'GET',
|
||||
|
||||
Reference in new issue
Block a user