feat(web): 增加确权状态审查
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
const information = {
|
const information = {
|
||||||
debug: false,
|
debug: true,
|
||||||
// baseUrl: '',
|
// baseUrl: '',
|
||||||
baseUrl: 'http://127.0.0.1:20080',
|
baseUrl: 'http://127.0.0.1:20080',
|
||||||
title: '可信供给中心',
|
title: '可信供给中心',
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
size100MB
|
size100MB
|
||||||
} from "../constants.js";
|
} from "../constants.js";
|
||||||
import {resourceList} from "../../pages/index/tab-data.js";
|
import {resourceList} from "../../pages/index/tab-data.js";
|
||||||
|
import {resourceDetailDialog} from "../resource/dialog-resource.js";
|
||||||
|
|
||||||
function detailForm(showCreatedUserAndModifiedUser = false) {
|
function detailForm(showCreatedUserAndModifiedUser = false) {
|
||||||
return {
|
return {
|
||||||
@@ -36,6 +37,20 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
source: apiGet('${base}/data_resource/list'),
|
source: apiGet('${base}/data_resource/list'),
|
||||||
pickerSchema: {
|
pickerSchema: {
|
||||||
...resourceList(),
|
...resourceList(),
|
||||||
|
},
|
||||||
|
staticSchema: {
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: "<span class='text-primary' style='cursor: pointer'>${targetName}</span>",
|
||||||
|
onEvent: {
|
||||||
|
click: {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
actionType: 'dialog',
|
||||||
|
...resourceDetailDialog('targetId'),
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -88,13 +103,13 @@ export function permissionAddDialog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function permissionDetailDialog(field = 'id') {
|
export function permissionDetailDialog(field = 'id', actions = []) {
|
||||||
return {
|
return {
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: {
|
dialog: {
|
||||||
title: '确权申请详情',
|
title: '确权申请详情',
|
||||||
size: 'md',
|
size: 'md',
|
||||||
actions: [],
|
actions: actions,
|
||||||
body: {
|
body: {
|
||||||
...detailForm(true),
|
...detailForm(true),
|
||||||
initApi: apiGet(`\${base}/confirmation/detail/\${${field}}`),
|
initApi: apiGet(`\${base}/confirmation/detail/\${${field}}`),
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ export function resourceAddDialog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resourceDetailDialog() {
|
export function resourceDetailDialog(field = 'id') {
|
||||||
return {
|
return {
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: {
|
dialog: {
|
||||||
@@ -337,7 +337,7 @@ export function resourceDetailDialog() {
|
|||||||
body: {
|
body: {
|
||||||
...detailForm(true),
|
...detailForm(true),
|
||||||
static: true,
|
static: true,
|
||||||
initApi: apiGet('${base}/data_resource/detail/${id}'),
|
initApi: apiGet(`\${base}/data_resource/detail/\${${field}}`),
|
||||||
data: {
|
data: {
|
||||||
detail: true,
|
detail: true,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ useAmis(information => {
|
|||||||
tabs: [
|
tabs: [
|
||||||
// tabOverview(),
|
// tabOverview(),
|
||||||
// tabMarket(),
|
// tabMarket(),
|
||||||
|
tabCheck(),
|
||||||
tabData(),
|
tabData(),
|
||||||
tabPermissions(),
|
tabPermissions(),
|
||||||
tabCheck(),
|
|
||||||
tabUser(),
|
tabUser(),
|
||||||
tabSettings(),
|
tabSettings(),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {checkerOnly} from "../../components/constants.js";
|
import {apiGet, apiPost, checkerOnly, crudCommonOptions} from "../../components/constants.js";
|
||||||
|
import {permissionDetailDialog} from "../../components/permission/dialog-permission.js";
|
||||||
|
|
||||||
export function tabCheck() {
|
export function tabCheck() {
|
||||||
return {
|
return {
|
||||||
@@ -6,7 +7,53 @@ export function tabCheck() {
|
|||||||
title: '审核审查',
|
title: '审核审查',
|
||||||
icon: 'fa fa-shield-halved',
|
icon: 'fa fa-shield-halved',
|
||||||
body: [
|
body: [
|
||||||
'hello world'
|
{
|
||||||
|
type: 'crud',
|
||||||
|
api: apiGet('${base}/check/list'),
|
||||||
|
...crudCommonOptions(),
|
||||||
|
headerToolbar: [
|
||||||
|
'reload',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
label: '描述',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '操作',
|
||||||
|
width: 100,
|
||||||
|
type: 'operation',
|
||||||
|
fixed: 'right',
|
||||||
|
className: 'nowrap',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '查看',
|
||||||
|
level: 'link',
|
||||||
|
...permissionDetailDialog(
|
||||||
|
'parameters.confirmationId',
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: 'each',
|
||||||
|
name: 'operations',
|
||||||
|
items: {
|
||||||
|
type: 'action',
|
||||||
|
label: '${item.name}',
|
||||||
|
level: '${item.level}',
|
||||||
|
actionType: 'ajax',
|
||||||
|
api: {
|
||||||
|
...apiPost('${base}/check/operation/${item.operation}'),
|
||||||
|
data: '${parameters}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.base.service;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Value;
|
||||||
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要审查
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-28
|
||||||
|
*/
|
||||||
|
public interface CheckingService {
|
||||||
|
ImmutableList<CheckOrder> checkingList();
|
||||||
|
|
||||||
|
void onChecked(String operation, ImmutableMap<String, Object> parameters);
|
||||||
|
|
||||||
|
@Value
|
||||||
|
class CheckOrder {
|
||||||
|
String name;
|
||||||
|
ImmutableList<CheckOperation> operations;
|
||||||
|
ImmutableMap<String, Object> parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
class CheckOperation {
|
||||||
|
/**
|
||||||
|
* 全局唯一
|
||||||
|
*/
|
||||||
|
private final String operation;
|
||||||
|
private final String name;
|
||||||
|
private final String level;
|
||||||
|
|
||||||
|
public CheckOperation(String operation, String name) {
|
||||||
|
this(operation, name, "default");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckOperation(String operation, String name, String level) {
|
||||||
|
this.operation = operation;
|
||||||
|
this.name = name;
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.check.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
||||||
|
import com.eshore.gringotts.web.domain.base.controller.ListController;
|
||||||
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
|
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.eclipse.collections.api.map.MutableMap;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监管
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-28
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("check")
|
||||||
|
public class CheckController implements ListController<CheckingService.CheckOrder> {
|
||||||
|
private final ImmutableList<CheckingService> checkingServices;
|
||||||
|
private final MutableMap<String, CheckingService> serviceMap = Maps.mutable.<String, CheckingService>empty().asSynchronized();
|
||||||
|
|
||||||
|
public CheckController(ApplicationContext applicationContext) {
|
||||||
|
this.checkingServices = Lists.immutable.ofAll(applicationContext.getBeansOfType(CheckingService.class).values());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Override
|
||||||
|
public AmisResponse<ImmutableList<CheckingService.CheckOrder>> list() throws Exception {
|
||||||
|
return AmisResponse.responseSuccess(
|
||||||
|
checkingServices.flatCollect(checkingService -> {
|
||||||
|
ImmutableList<CheckingService.CheckOrder> orders = checkingService.checkingList();
|
||||||
|
orders.flatCollect(CheckingService.CheckOrder::getOperations)
|
||||||
|
.forEach(operation -> serviceMap.put(operation.getOperation(), checkingService));
|
||||||
|
return orders;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/operation/{operation}")
|
||||||
|
public AmisResponse<Object> operation(@PathVariable String operation, @RequestBody ImmutableMap<String, Object> data) {
|
||||||
|
log.info("Check operation: {} data: {} target: {}", operation, data, serviceMap.get(operation).getClass().getSimpleName());
|
||||||
|
CheckingService service = serviceMap.getOrDefault(operation, null);
|
||||||
|
if (ObjectUtil.isNull(service)) {
|
||||||
|
throw new RuntimeException("服务未找到");
|
||||||
|
}
|
||||||
|
service.onChecked(operation, data);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,10 @@ import org.springframework.stereotype.Repository;
|
|||||||
@SuppressWarnings("NullableProblems")
|
@SuppressWarnings("NullableProblems")
|
||||||
@Repository
|
@Repository
|
||||||
public interface ConfirmationRepository extends SimpleRepository<Confirmation, Long> {
|
public interface ConfirmationRepository extends SimpleRepository<Confirmation, Long> {
|
||||||
|
@Override
|
||||||
|
@EntityGraph(value = "confirmation.list", type = EntityGraph.EntityGraphType.FETCH)
|
||||||
|
List<Confirmation> findAll(Specification<Confirmation> specification);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@EntityGraph(value = "confirmation.list", type = EntityGraph.EntityGraphType.FETCH)
|
@EntityGraph(value = "confirmation.list", type = EntityGraph.EntityGraphType.FETCH)
|
||||||
List<Confirmation> findAll(Specification<Confirmation> specification, Sort sort);
|
List<Confirmation> findAll(Specification<Confirmation> specification, Sort sort);
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
package com.eshore.gringotts.web.domain.confirmation.service;
|
package com.eshore.gringotts.web.domain.confirmation.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
||||||
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
||||||
import com.eshore.gringotts.web.domain.confirmation.repository.ConfirmationRepository;
|
import com.eshore.gringotts.web.domain.confirmation.repository.ConfirmationRepository;
|
||||||
import com.eshore.gringotts.web.domain.user.service.UserService;
|
import com.eshore.gringotts.web.domain.user.service.UserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +20,7 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class ConfirmationService extends SimpleServiceSupport<Confirmation> {
|
public class ConfirmationService extends SimpleServiceSupport<Confirmation> implements CheckingService {
|
||||||
private final ConfirmationRepository confirmationRepository;
|
private final ConfirmationRepository confirmationRepository;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
@@ -40,6 +46,36 @@ public class ConfirmationService extends SimpleServiceSupport<Confirmation> {
|
|||||||
confirmationRepository.updateStateById(id, Confirmation.State.DRAFT, userService.currentLoginUser());
|
confirmationRepository.updateStateById(id, Confirmation.State.DRAFT, userService.currentLoginUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImmutableList<CheckOrder> checkingList() {
|
||||||
|
return Lists.immutable.ofAll(
|
||||||
|
confirmationRepository.findAll(
|
||||||
|
(root, query, builder) -> builder.equal(root.get("state"), Confirmation.State.CHECKING)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.collect(confirmation -> new CheckOrder(
|
||||||
|
StrUtil.format("资源名为「{}」的确权申请", confirmation.getTarget().getName()),
|
||||||
|
Lists.immutable.of(
|
||||||
|
new CheckOperation("confirmation_check_apply", "通过"),
|
||||||
|
new CheckOperation("confirmation_check_reject", "拒绝", "danger")
|
||||||
|
),
|
||||||
|
Maps.immutable.of("confirmationId", confirmation.getId())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChecked(String operation, ImmutableMap<String, Object> parameters) {
|
||||||
|
Long id = (Long) parameters.get("confirmationId");
|
||||||
|
switch (operation) {
|
||||||
|
case "confirmation_check_apply":
|
||||||
|
confirmationRepository.updateStateById(id, Confirmation.State.NORMAL, userService.currentLoginUser());
|
||||||
|
break;
|
||||||
|
case "confirmation_check_reject":
|
||||||
|
confirmationRepository.updateStateById(id, Confirmation.State.DRAFT, userService.currentLoginUser());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static final class ConfirmationDuplicatedException extends RuntimeException {
|
public static final class ConfirmationDuplicatedException extends RuntimeException {
|
||||||
public ConfirmationDuplicatedException() {
|
public ConfirmationDuplicatedException() {
|
||||||
super("数据资源已绑定确权申请,无法再次申请");
|
super("数据资源已绑定确权申请,无法再次申请");
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.eshore.gringotts.web.domain.order.entity;
|
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.EntityListeners;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工单
|
|
||||||
*
|
|
||||||
* @author lanyuanxiaoyao
|
|
||||||
* @date 2024-11-27
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
|
||||||
@Entity
|
|
||||||
@EntityListeners(AuditingEntityListener.class)
|
|
||||||
@DynamicUpdate
|
|
||||||
@Table(name = Constants.TABLE_PREFIX + "work_order")
|
|
||||||
public class WorkOrder extends SimpleEntity {
|
|
||||||
@Column(nullable = false)
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user