feat(web): 增加审批快照的生成
This commit is contained in:
@@ -270,6 +270,12 @@ export const checkOverMapping = [
|
|||||||
mappingItem('已办结', 'COMPLETED', 'bg-success'),
|
mappingItem('已办结', 'COMPLETED', 'bg-success'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const checkActionMapping = [
|
||||||
|
mappingItem('同意', 'APPROVE', 'bg-green-500'),
|
||||||
|
mappingItem('驳回', 'REJECT', 'bg-red-500'),
|
||||||
|
mappingItem('撤回', 'TERMINAL', 'bg-blue-500'),
|
||||||
|
]
|
||||||
|
|
||||||
function api(method, url) {
|
function api(method, url) {
|
||||||
return {
|
return {
|
||||||
method: method,
|
method: method,
|
||||||
|
|||||||
@@ -1,16 +1,49 @@
|
|||||||
import {
|
import {
|
||||||
apiGet,
|
apiGet,
|
||||||
|
checkActionMapping,
|
||||||
checkOverMapping,
|
checkOverMapping,
|
||||||
checkTypeMapping,
|
checkTypeMapping,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
mappingField,
|
mappingField,
|
||||||
operationField,
|
operationField,
|
||||||
|
readOnlyDialogOptions,
|
||||||
stringField,
|
stringField,
|
||||||
timeField,
|
timeField,
|
||||||
} from "../../components/constants.js";
|
} from "../../components/constants.js";
|
||||||
import {authenticationDetailDialog, confirmationDetailDialog} from "../../components/permission/dialog-permission.js";
|
import {authenticationDetailDialog, confirmationDetailDialog} from "../../components/permission/dialog-permission.js";
|
||||||
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
|
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
|
||||||
|
|
||||||
|
function detailDialog() {
|
||||||
|
return {
|
||||||
|
actionType: 'dialog',
|
||||||
|
dialog: {
|
||||||
|
title: '详情',
|
||||||
|
size: 'md',
|
||||||
|
...readOnlyDialogOptions(),
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
type: 'amis',
|
||||||
|
name: 'parameters.snapshot',
|
||||||
|
},
|
||||||
|
{type: 'divider'},
|
||||||
|
{
|
||||||
|
type: 'crud',
|
||||||
|
api: apiGet('${base}/check_order/history/${instanceId}'),
|
||||||
|
...crudCommonOptions(),
|
||||||
|
headerToolbar: [
|
||||||
|
'reload',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
mappingField('action', '类型', checkActionMapping),
|
||||||
|
stringField('comment', '描述'),
|
||||||
|
timeField('createdTime', '操作时间'),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function tabCheck() {
|
export function tabCheck() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -30,6 +63,13 @@ export function tabCheck() {
|
|||||||
timeField('modifiedTime', '最后修改时间'),
|
timeField('modifiedTime', '最后修改时间'),
|
||||||
stringField('modifiedUsername', '最后操作人', 100),
|
stringField('modifiedUsername', '最后操作人', 100),
|
||||||
operationField('操作', undefined, [
|
operationField('操作', undefined, [
|
||||||
|
{
|
||||||
|
visibleOn: "${state === 'COMPLETED'}",
|
||||||
|
type: 'action',
|
||||||
|
label: '查看',
|
||||||
|
level: 'link',
|
||||||
|
...detailDialog(),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
visibleOn: "${type === 'CONFIRMATION' && state === 'RUNNING'}",
|
visibleOn: "${type === 'CONFIRMATION' && state === 'RUNNING'}",
|
||||||
type: 'action',
|
type: 'action',
|
||||||
@@ -57,13 +97,6 @@ export function tabCheck() {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
visibleOn: "${type === 'CONFIRMATION' && state !== NORMAL}",
|
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
level: 'link',
|
|
||||||
...confirmationDetailDialog('parameters.confirmationId'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
visibleOn: "${type === 'AUTHENTICATION' && state === 'RUNNING'}",
|
visibleOn: "${type === 'AUTHENTICATION' && state === 'RUNNING'}",
|
||||||
type: 'action',
|
type: 'action',
|
||||||
@@ -91,13 +124,6 @@ export function tabCheck() {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
visibleOn: "${type === 'AUTHENTICATION' && state !== NORMAL}",
|
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
level: 'link',
|
|
||||||
...authenticationDetailDialog('parameters.authenticationId'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
visibleOn: "${type === 'WARE' && state === 'RUNNING'}",
|
visibleOn: "${type === 'WARE' && state === 'RUNNING'}",
|
||||||
type: 'action',
|
type: 'action',
|
||||||
@@ -125,13 +151,6 @@ export function tabCheck() {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
visibleOn: "${type === 'WARE' && state !== NORMAL}",
|
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
level: 'link',
|
|
||||||
...wareDetailDialog('parameters.wareId'),
|
|
||||||
},
|
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,4 +19,6 @@ public abstract class CheckingService<ENTITY extends LogicDeleteEntity> extends
|
|||||||
abstract public void submit(Long id) throws Exception;
|
abstract public void submit(Long id) throws Exception;
|
||||||
|
|
||||||
abstract public void retract(Long id) throws Exception;
|
abstract public void retract(Long id) throws Exception;
|
||||||
|
|
||||||
|
abstract protected Object archive(ENTITY entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ 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.base.controller.query.Query;
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
import com.eshore.gringotts.web.domain.service.UserService;
|
import com.eshore.gringotts.web.domain.service.UserService;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableHistory;
|
||||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -78,6 +80,11 @@ public class CheckOrderController implements ListController<CheckOrderController
|
|||||||
return AmisResponse.responseSuccess();
|
return AmisResponse.responseSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/history/{instanceId}")
|
||||||
|
public AmisResponse<List<FlowableHistory>> history(@PathVariable String instanceId) {
|
||||||
|
return AmisResponse.responseSuccess(flowableManager.listHistories(instanceId));
|
||||||
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private ListItem toListItem(FlowableInstance instance) {
|
private ListItem toListItem(FlowableInstance instance) {
|
||||||
FlowableNode node = flowableManager.getNode(instance.getCurrentNodeId());
|
FlowableNode node = flowableManager.getNode(instance.getCurrentNodeId());
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
import com.eshore.gringotts.web.domain.entity.Authentication;
|
import com.eshore.gringotts.web.domain.entity.Authentication;
|
||||||
import com.eshore.gringotts.web.domain.entity.Authentication_;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
import com.eshore.gringotts.web.domain.flowable.CheckRoleAssessor;
|
import com.eshore.gringotts.web.domain.flowable.CheckRoleAssessor;
|
||||||
@@ -18,14 +17,9 @@ import com.lanyuanxiaoyao.flowable.core.model.FlowableMetadata;
|
|||||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.factory.Maps;
|
import org.eclipse.collections.api.factory.Maps;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -68,17 +62,6 @@ public class AuthenticationService extends CheckingService<Authentication> {
|
|||||||
flowableManager.create(userCheckNode, roleCheckNode);
|
flowableManager.create(userCheckNode, roleCheckNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<Authentication> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
||||||
User loginUser = userService.currentLoginUser();
|
|
||||||
if (User.isAdministrator(loginUser)) {
|
|
||||||
return Lists.immutable.empty();
|
|
||||||
}
|
|
||||||
return Lists.immutable.of(builder.or(
|
|
||||||
builder.equal(root.get(Authentication_.createdUser), loginUser)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long save(Authentication entity) {
|
public Long save(Authentication entity) {
|
||||||
if (ObjectUtil.isNull(entity.getId()) && authenticationRepository.findOne(
|
if (ObjectUtil.isNull(entity.getId()) && authenticationRepository.findOne(
|
||||||
@@ -97,7 +80,7 @@ public class AuthenticationService extends CheckingService<Authentication> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void submit(Long id) throws Exception {
|
public void submit(Long id) {
|
||||||
User user = userService.currentLoginUser();
|
User user = userService.currentLoginUser();
|
||||||
Authentication authentication = detailOrThrow(id);
|
Authentication authentication = detailOrThrow(id);
|
||||||
String instanceId = flowableManager.start(
|
String instanceId = flowableManager.start(
|
||||||
@@ -116,11 +99,16 @@ public class AuthenticationService extends CheckingService<Authentication> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void retract(Long id) throws Exception {
|
public void retract(Long id) {
|
||||||
Authentication authentication = detailOrThrow(id);
|
Authentication authentication = detailOrThrow(id);
|
||||||
flowableManager.terminal(authentication.getFlowableInstanceId());
|
flowableManager.terminal(authentication.getFlowableInstanceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object archive(Authentication entity) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public static final class AuthenticationDuplicatedException extends RuntimeException {
|
public static final class AuthenticationDuplicatedException extends RuntimeException {
|
||||||
public AuthenticationDuplicatedException() {
|
public AuthenticationDuplicatedException() {
|
||||||
super("数据资源已绑定该账号的授权申请,无法再次申请");
|
super("数据资源已绑定该账号的授权申请,无法再次申请");
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ import cn.hutool.core.map.MapUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
||||||
import com.eshore.gringotts.web.domain.entity.Confirmation_;
|
import com.eshore.gringotts.web.domain.entity.DataResource;
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
import com.eshore.gringotts.web.domain.flowable.CheckRoleAssessor;
|
import com.eshore.gringotts.web.domain.flowable.CheckRoleAssessor;
|
||||||
import com.eshore.gringotts.web.domain.repository.ConfirmationRepository;
|
import com.eshore.gringotts.web.domain.repository.ConfirmationRepository;
|
||||||
|
import com.eshore.gringotts.web.helper.AmisHelper;
|
||||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
|
||||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableListener;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableListener;
|
||||||
@@ -15,13 +16,8 @@ import com.lanyuanxiaoyao.flowable.core.model.FlowableMetadata;
|
|||||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -53,24 +49,15 @@ public class ConfirmationService extends CheckingService<Confirmation> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<Confirmation> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
public void submit(Long id) {
|
||||||
User loginUser = userService.currentLoginUser();
|
Confirmation confirmation = detailOrThrow(id);
|
||||||
if (User.isAdministrator(loginUser)) {
|
|
||||||
return Lists.immutable.empty();
|
|
||||||
}
|
|
||||||
return Lists.immutable.of(builder.or(
|
|
||||||
builder.equal(root.get(Confirmation_.createdUser), loginUser)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void submit(Long id) throws Exception {
|
|
||||||
User user = userService.currentLoginUser();
|
User user = userService.currentLoginUser();
|
||||||
String instanceId = flowableManager.start(
|
String instanceId = flowableManager.start(
|
||||||
CONFIRMATION_FLOW_ID,
|
CONFIRMATION_FLOW_ID,
|
||||||
MapUtil.<String, Object>builder()
|
MapUtil.<String, Object>builder()
|
||||||
.put("confirmationId", id)
|
.put("confirmationId", id)
|
||||||
.put("type", "CONFIRMATION")
|
.put("type", "CONFIRMATION")
|
||||||
|
.put("snapshot", archive(confirmation))
|
||||||
.put("createdUsername", user.getUsername())
|
.put("createdUsername", user.getUsername())
|
||||||
.put("modifiedUsername", user.getUsername())
|
.put("modifiedUsername", user.getUsername())
|
||||||
.build(),
|
.build(),
|
||||||
@@ -81,11 +68,28 @@ public class ConfirmationService extends CheckingService<Confirmation> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void retract(Long id) throws Exception {
|
public void retract(Long id) {
|
||||||
Confirmation confirmation = detailOrThrow(id);
|
Confirmation confirmation = detailOrThrow(id);
|
||||||
flowableManager.terminal(confirmation.getFlowableInstanceId());
|
flowableManager.terminal(confirmation.getFlowableInstanceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object archive(Confirmation entity) {
|
||||||
|
DataResource resource = entity.getTarget();
|
||||||
|
return AmisHelper.wrapper(
|
||||||
|
AmisHelper.property(
|
||||||
|
AmisHelper.propertyItem("资源名称", resource.getName(), 3),
|
||||||
|
AmisHelper.propertyItem("资源描述", resource.getDescription(), 3)
|
||||||
|
),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(resource.getType()),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(resource.getFormat()),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(entity)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long save(Confirmation entity) {
|
public Long save(Confirmation entity) {
|
||||||
if (ObjectUtil.isNull(entity.getId()) && confirmationRepository.existsByTarget_Id(entity.getTarget().getId())) {
|
if (ObjectUtil.isNull(entity.getId()) && confirmationRepository.existsByTarget_Id(entity.getTarget().getId())) {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import com.eshore.gringotts.web.domain.entity.type.ResourceType;
|
|||||||
import com.eshore.gringotts.web.domain.repository.DataResourceRepository;
|
import com.eshore.gringotts.web.domain.repository.DataResourceRepository;
|
||||||
import com.eshore.gringotts.web.domain.repository.ResourceFormatRepository;
|
import com.eshore.gringotts.web.domain.repository.ResourceFormatRepository;
|
||||||
import com.eshore.gringotts.web.domain.repository.ResourceTypeRepository;
|
import com.eshore.gringotts.web.domain.repository.ResourceTypeRepository;
|
||||||
import com.eshore.gringotts.web.helper.EntityHelper;
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
@@ -56,26 +55,8 @@ public class DataResourceService extends LogicDeleteService<DataResource> {
|
|||||||
return Lists.immutable.empty();
|
return Lists.immutable.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
Subquery<Confirmation> confirmationSubquery = query.subquery(Confirmation.class);
|
|
||||||
Root<Confirmation> confirmationRoot = confirmationSubquery.from(Confirmation.class);
|
|
||||||
confirmationSubquery.select(confirmationRoot)
|
|
||||||
.where(
|
|
||||||
builder.equal(confirmationRoot.get(Confirmation_.target), root),
|
|
||||||
EntityHelper.checkNeededEntityPrediction(confirmationRoot, builder, loginUser)
|
|
||||||
);
|
|
||||||
|
|
||||||
Subquery<Authentication> authenticationSubquery = query.subquery(Authentication.class);
|
|
||||||
Root<Authentication> authenticationRoot = authenticationSubquery.from(Authentication.class);
|
|
||||||
authenticationSubquery.select(authenticationRoot)
|
|
||||||
.where(
|
|
||||||
builder.equal(authenticationRoot.get(Authentication_.target), root),
|
|
||||||
EntityHelper.checkNeededEntityPrediction(authenticationRoot, builder, loginUser)
|
|
||||||
);
|
|
||||||
|
|
||||||
return Lists.immutable.of(builder.or(
|
return Lists.immutable.of(builder.or(
|
||||||
builder.equal(root.get(DataResource_.createdUser), loginUser),
|
builder.equal(root.get(DataResource_.createdUser), loginUser)
|
||||||
builder.exists(confirmationSubquery),
|
|
||||||
builder.exists(authenticationSubquery)
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class WareService extends CheckingService<Ware> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void submit(Long id) throws Exception {
|
public void submit(Long id) {
|
||||||
User user = userService.currentLoginUser();
|
User user = userService.currentLoginUser();
|
||||||
Ware ware = detailOrThrow(id);
|
Ware ware = detailOrThrow(id);
|
||||||
String instanceId = flowableManager.start(
|
String instanceId = flowableManager.start(
|
||||||
@@ -74,11 +74,16 @@ public class WareService extends CheckingService<Ware> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void retract(Long id) throws Exception {
|
public void retract(Long id) {
|
||||||
Ware ware = detailOrThrow(id);
|
Ware ware = detailOrThrow(id);
|
||||||
flowableManager.terminal(ware.getFlowableInstanceId());
|
flowableManager.terminal(ware.getFlowableInstanceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object archive(Ware entity) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public static final class WareFlowUserCheckListener extends FlowableListener.AbstractFlowableListener {
|
public static final class WareFlowUserCheckListener extends FlowableListener.AbstractFlowableListener {
|
||||||
private final WareRepository wareRepository;
|
private final WareRepository wareRepository;
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.eshore.gringotts.web.helper;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapBuilder;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.format.ResourceFormat;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.type.ApiResourceType;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.type.ResourceType;
|
||||||
|
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.list.MutableList;
|
||||||
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20250108
|
||||||
|
*/
|
||||||
|
public class AmisHelper {
|
||||||
|
@SafeVarargs
|
||||||
|
public static ImmutableMap<Object, Object> wrapper(ImmutableMap<Object, Object>... body) {
|
||||||
|
MapBuilder<Object, Object> builder = MapUtil.builder();
|
||||||
|
builder.put("type", "wrapper");
|
||||||
|
builder.put("size", "none");
|
||||||
|
builder.put("body", body);
|
||||||
|
return Maps.immutable.ofMap(builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> divider() {
|
||||||
|
return Maps.immutable.of("type", "divider");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public static ImmutableMap<Object, Object> property(ImmutableMap<Object, Object>... items) {
|
||||||
|
return property(null, items);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(ImmutableList<ImmutableMap<Object, Object>> items) {
|
||||||
|
return property(null, items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public static ImmutableMap<Object, Object> property(String title, ImmutableMap<Object, Object>... items) {
|
||||||
|
return property(title, Lists.immutable.of(items));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(String title, ImmutableList<ImmutableMap<Object, Object>> items) {
|
||||||
|
MapBuilder<Object, Object> builder = MapUtil.builder();
|
||||||
|
builder.put("type", "property");
|
||||||
|
if (StrUtil.isNotBlank(title)) {
|
||||||
|
builder.put("title", title);
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(items)) {
|
||||||
|
builder.put("items", items);
|
||||||
|
}
|
||||||
|
return Maps.immutable.ofMap(builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(ResourceType type) {
|
||||||
|
type = Hibernate.unproxy(type, ResourceType.class);
|
||||||
|
MutableList<ImmutableMap<Object, Object>> items = Lists.mutable.empty();
|
||||||
|
switch (type.getResourceType()) {
|
||||||
|
case API:
|
||||||
|
ApiResourceType apiResourceType = (ApiResourceType) type;
|
||||||
|
items.add(propertyItem("资源类型", "API", 3));
|
||||||
|
items.add(propertyItem("用户名", apiResourceType.getUsername(), 1));
|
||||||
|
items.add(propertyItem("密码", apiResourceType.getPassword(), 2));
|
||||||
|
items.add(propertyItem("地址", apiResourceType.getUrl(), 3));
|
||||||
|
break;
|
||||||
|
case FILE:
|
||||||
|
items.add(propertyItem("资源类型", "文件"));
|
||||||
|
break;
|
||||||
|
case DATABASE:
|
||||||
|
items.add(propertyItem("资源类型", "数据库"));
|
||||||
|
break;
|
||||||
|
case HDFS:
|
||||||
|
items.add(propertyItem("资源类型", "HDFS"));
|
||||||
|
break;
|
||||||
|
case FTP:
|
||||||
|
items.add(propertyItem("资源类型", "FTP"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return property("资源类型定义", items.toImmutable());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(ResourceFormat format) {
|
||||||
|
format = Hibernate.unproxy(format, ResourceFormat.class);
|
||||||
|
MutableList<ImmutableMap<Object, Object>> items = Lists.mutable.empty();
|
||||||
|
switch (format.getFormatType()) {
|
||||||
|
case NONE:
|
||||||
|
items.add(propertyItem("格式类型", "文件", 3));
|
||||||
|
break;
|
||||||
|
case LINE:
|
||||||
|
items.add(propertyItem("格式类型", "文本行", 3));
|
||||||
|
break;
|
||||||
|
case JSON:
|
||||||
|
items.add(propertyItem("格式类型", "Json"));
|
||||||
|
break;
|
||||||
|
case JSON_LINE:
|
||||||
|
items.add(propertyItem("格式类型", "Json Line"));
|
||||||
|
break;
|
||||||
|
case CSV:
|
||||||
|
items.add(propertyItem("格式类型", "CSV文本"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return property("资源格式定义", items.toImmutable());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(SimpleEntity entity) {
|
||||||
|
return property(
|
||||||
|
propertyItem("创建人", entity.getCreatedUser().getUsername(), 2),
|
||||||
|
propertyItem("创建时间", entity.getCreatedTime()),
|
||||||
|
propertyItem("修改人", entity.getModifiedUser().getUsername(), 2),
|
||||||
|
propertyItem("修改时间", entity.getModifiedTime())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> propertyItem(String label, Object content) {
|
||||||
|
return propertyItem(label, content, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> propertyItem(String label, Object content, Integer span) {
|
||||||
|
MapBuilder<Object, Object> builder = MapUtil.builder();
|
||||||
|
builder.put("label", label);
|
||||||
|
builder.put("content", content);
|
||||||
|
if (ObjectUtil.isNotNull(span)) {
|
||||||
|
builder.put("span", span);
|
||||||
|
}
|
||||||
|
return Maps.immutable.ofMap(builder.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,9 +2,6 @@ package com.eshore.gringotts.web.helper;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity_;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder_;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
@@ -28,14 +25,14 @@ public class EntityHelper {
|
|||||||
|
|
||||||
public static Predicate checkNeededEntityPrediction(Root<? extends CheckingNeededEntity> root, CriteriaBuilder builder, User loginUser) {
|
public static Predicate checkNeededEntityPrediction(Root<? extends CheckingNeededEntity> root, CriteriaBuilder builder, User loginUser) {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.and(
|
/* builder.and(
|
||||||
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
||||||
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.targetRole), loginUser.getRole())
|
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.targetRole), loginUser.getRole())
|
||||||
),
|
),
|
||||||
builder.and(
|
builder.and(
|
||||||
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.target), CheckOrder.Target.USER),
|
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.target), CheckOrder.Target.USER),
|
||||||
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.targetUser), loginUser)
|
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.targetUser), loginUser)
|
||||||
)
|
) */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user