diff --git a/gringotts-frontend/components/constants.js b/gringotts-frontend/components/constants.js
index 74d48f5..efa067d 100644
--- a/gringotts-frontend/components/constants.js
+++ b/gringotts-frontend/components/constants.js
@@ -261,13 +261,13 @@ export const permissionStateMapping = [
export const checkTypeMapping = [
mappingItem('确权审查', 'CONFIRMATION', 'bg-blue-500'),
mappingItem('授权审查', 'AUTHENTICATION', 'bg-purple-500'),
- mappingItem('上架审查', 'MARKET', 'bg-green-500'),
+ mappingItem('上架审查', 'WARE', 'bg-green-500'),
]
export const checkOverMapping = [
- mappingItem('进行中', 'CHECKING', 'bg-warning'),
- mappingItem('已撤销', 'RETRACT', 'bg-primary'),
- mappingItem('已办结', 'OVER', 'bg-success'),
+ mappingItem('进行中', 'RUNNING', 'bg-warning'),
+ mappingItem('已撤销', 'TERMINAL', 'bg-primary'),
+ mappingItem('已办结', 'COMPLETED', 'bg-success'),
]
function api(method, url) {
diff --git a/gringotts-frontend/pages/index/tab-check.js b/gringotts-frontend/pages/index/tab-check.js
index d0af8c4..ae4e96a 100644
--- a/gringotts-frontend/pages/index/tab-check.js
+++ b/gringotts-frontend/pages/index/tab-check.js
@@ -31,7 +31,7 @@ export function tabCheck() {
stringField('modifiedUsername', '最后操作人', 100),
operationField('操作', undefined, [
{
- visibleOn: "${type === 'CONFIRMATION' && state === 'CHECKING'}",
+ visibleOn: "${type === 'CONFIRMATION' && state === 'RUNNING'}",
type: 'action',
label: '处理',
level: 'link',
@@ -43,7 +43,7 @@ export function tabCheck() {
label: '同意',
actionType: 'ajax',
close: true,
- api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
+ api: apiGet('${base}/check_order/approve/${instanceId}'),
reload: 'check_order_list',
},
{
@@ -51,7 +51,7 @@ export function tabCheck() {
label: '拒绝',
actionType: 'ajax',
close: true,
- api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
+ api: apiGet('${base}/check_order/reject/${instanceId}'),
reload: 'check_order_list',
},
],
@@ -65,7 +65,7 @@ export function tabCheck() {
...confirmationDetailDialog('parameters.confirmationId'),
},
{
- visibleOn: "${type === 'AUTHENTICATION' && state === 'CHECKING'}",
+ visibleOn: "${type === 'AUTHENTICATION' && state === 'RUNNING'}",
type: 'action',
label: '处理',
level: 'link',
@@ -77,7 +77,7 @@ export function tabCheck() {
label: '同意',
actionType: 'ajax',
close: true,
- api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
+ api: apiGet('${base}/check_order/approve/${instanceId}'),
reload: 'check_order_list',
},
{
@@ -85,7 +85,7 @@ export function tabCheck() {
label: '拒绝',
actionType: 'ajax',
close: true,
- api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
+ api: apiGet('${base}/check_order/reject/${instanceId}'),
reload: 'check_order_list',
},
],
@@ -99,7 +99,7 @@ export function tabCheck() {
...authenticationDetailDialog('parameters.authenticationId'),
},
{
- visibleOn: "${type === 'MARKET' && state === 'CHECKING'}",
+ visibleOn: "${type === 'WARE' && state === 'RUNNING'}",
type: 'action',
label: '处理',
level: 'link',
@@ -111,7 +111,7 @@ export function tabCheck() {
label: '同意',
actionType: 'ajax',
close: true,
- api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
+ api: apiGet('${base}/check_order/approve/${instanceId}'),
reload: 'check_order_list',
},
{
@@ -119,14 +119,14 @@ export function tabCheck() {
label: '拒绝',
actionType: 'ajax',
close: true,
- api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
+ api: apiGet('${base}/check_order/reject/${instanceId}'),
reload: 'check_order_list',
},
],
),
},
{
- visibleOn: "${type === 'MARKET' && state !== NORMAL}",
+ visibleOn: "${type === 'WARE' && state !== NORMAL}",
type: 'action',
label: '查看',
level: 'link',
diff --git a/gringotts-web/pom.xml b/gringotts-web/pom.xml
index 5fad3e2..8a6a2b2 100644
--- a/gringotts-web/pom.xml
+++ b/gringotts-web/pom.xml
@@ -20,6 +20,10 @@
com.eshore
gringotts-forest
+
+ com.lanyuanxiaoyao
+ flowable-spring-boot-jpa-starter
+
org.springframework.boot
spring-boot-starter-data-jpa
diff --git a/gringotts-web/src/main/java/com/eshore/gringotts/web/WebApplication.java b/gringotts-web/src/main/java/com/eshore/gringotts/web/WebApplication.java
index c6063f1..7676f40 100644
--- a/gringotts-web/src/main/java/com/eshore/gringotts/web/WebApplication.java
+++ b/gringotts-web/src/main/java/com/eshore/gringotts/web/WebApplication.java
@@ -8,6 +8,7 @@ import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
@@ -21,7 +22,14 @@ import org.springframework.scheduling.annotation.EnableAsync;
* @author lanyuanxiaoyao
* @date 2024-11-14
*/
-@SpringBootApplication(scanBasePackages = {"com.eshore.gringotts"})
+@SpringBootApplication(scanBasePackages = {
+ "com.eshore.gringotts",
+ "com.lanyuanxiaoyao.flowable.jpa"
+})
+@EntityScan({
+ "com.eshore.gringotts.web.domain.entity",
+ "com.lanyuanxiaoyao.flowable.jpa.entity"
+})
@EnableFenix
@EnableJpaAuditing
@EnableAsync
diff --git a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/CheckingNeededEntity.java b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/CheckingNeededEntity.java
index f978ad5..1427b05 100644
--- a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/CheckingNeededEntity.java
+++ b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/CheckingNeededEntity.java
@@ -1,14 +1,10 @@
package com.eshore.gringotts.web.domain.base.entity;
-import com.eshore.gringotts.web.domain.entity.CheckOrder;
-import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
import javax.persistence.MappedSuperclass;
-import javax.persistence.OneToOne;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@@ -26,9 +22,7 @@ public class CheckingNeededEntity extends LogicDeleteEntity {
@Enumerated(EnumType.STRING)
private State state = State.DRAFT;
- @OneToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
- @ToString.Exclude
- private CheckOrder order;
+ private String flowableInstanceId;
public enum State {
/**
diff --git a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/service/CheckingService.java b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/service/CheckingService.java
index 14c22f8..1aa0adb 100644
--- a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/service/CheckingService.java
+++ b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/service/CheckingService.java
@@ -2,10 +2,8 @@ package com.eshore.gringotts.web.domain.base.service;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
-import com.eshore.gringotts.web.domain.entity.CheckOrder;
import com.eshore.gringotts.web.domain.service.UserService;
import javax.persistence.EntityManager;
-import org.eclipse.collections.api.map.ImmutableMap;
/**
* 需要审查
@@ -21,8 +19,4 @@ public abstract class CheckingService extends
abstract public void submit(Long id) throws Exception;
abstract public void retract(Long id) throws Exception;
-
- abstract public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap parameters);
-
- abstract public ImmutableMap archive(ENTITY entity);
}
diff --git a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/controller/CheckOrderController.java b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/controller/CheckOrderController.java
index 24dab6f..cbf2b8f 100644
--- a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/controller/CheckOrderController.java
+++ b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/controller/CheckOrderController.java
@@ -3,18 +3,19 @@ package com.eshore.gringotts.web.domain.controller;
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
import com.eshore.gringotts.web.domain.base.controller.ListController;
import com.eshore.gringotts.web.domain.base.controller.query.Query;
-import com.eshore.gringotts.web.domain.entity.CheckOrder;
-import com.eshore.gringotts.web.domain.service.CheckOrderService;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import com.eshore.gringotts.web.domain.entity.User;
+import com.eshore.gringotts.web.domain.service.UserService;
+import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
+import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
+import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
+import org.eclipse.collections.api.factory.Lists;
+import org.eclipse.collections.api.factory.Maps;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.map.ImmutableMap;
-import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@@ -32,55 +33,76 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("check_order")
public class CheckOrderController implements ListController {
- private final CheckOrderService checkOrderService;
- private final ObjectMapper mapper;
+ private final UserService userService;
+ private final SpringFlowableManager flowableManager;
- public CheckOrderController(CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
- this.checkOrderService = checkOrderService;
- this.mapper = builder.build();
+ public CheckOrderController(UserService userService, SpringFlowableManager flowableManager) {
+ this.userService = userService;
+ this.flowableManager = flowableManager;
}
@GetMapping("/list")
@Override
public AmisResponse> list() throws Exception {
- return AmisResponse.responseSuccess(checkOrderService.list().collect(this::toListItem));
+ User user = userService.currentLoginUser();
+ return AmisResponse.responseSuccess(
+ Lists.immutable.ofAll(flowableManager.listInstances(
+ (root, query, builder) -> {
+ if (User.isAdministrator(user)) {
+ return null;
+ }
+ return builder.or(
+ builder.like(root.get("extra"), user.getRole().name()),
+ builder.like(root.get("extra"), user.getId().toString())
+ );
+ }
+ )).collect(this::toListItem)
+ );
}
@PostMapping("/list")
@Override
public AmisResponse> list(@RequestBody Query query) throws Exception {
- return AmisResponse.responseSuccess(checkOrderService.list().collect(this::toListItem));
+ throw new UnsupportedOperationException();
+ }
+
+ @GetMapping("/approve/{instanceId}")
+ public AmisResponse