#
vincentlu
2 天以前 a7776fec737860a69cb39e947ea61af30c127fcf
#
12个文件已添加
4个文件已修改
989 ■■■■■ 已修改文件
zy-acs-flow/src/i18n/en.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/i18n/zh.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/ResourceContent.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx 164 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/guarantee/GuaranteeList.jsx 166 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/guarantee/GuaranteePanel.jsx 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/guarantee/index.jsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/GuaranteeController.java 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Guarantee.java 197 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/mapper/GuaranteeMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/GuaranteeService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/GuaranteeServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/guarantee.sql 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/resources/mapper/manager/GuaranteeMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/i18n/en.js
@@ -161,6 +161,7 @@
        staReserve: 'Sta Reserve',
        lane: 'Lane',
        integrationRecord: 'Integration',
        guarantee: 'Guarantee',
    },
    table: {
        field: {
@@ -623,7 +624,16 @@
                result: "result",
                costMs: "costMs",
            },
            guarantee: {
                uuid: "uuid",
                name: "name",
                scopeType: "scope type",
                scopeValue: "scope value",
                cronExpr: "cron expression",
                requiredCount: "required count",
                minSoc: "min soc",
                leadTime: "lead time(minute)",
            },
        }
    },
    page: {
zy-acs-flow/src/i18n/zh.js
@@ -161,6 +161,7 @@
        staReserve: '站点预约',
        lane: '巷道管理',
        integrationRecord: '集成交互',
        guarantee: '产能保障',
    },
    table: {
        field: {
@@ -623,7 +624,16 @@
                result: "结果",
                costMs: "耗时(ms)",
            },
            guarantee: {
                uuid: "编号",
                name: "计划名称",
                scopeType: "作用范围",
                scopeValue: "范围值",
                cronExpr: "调度时间",
                requiredCount: "目标数量",
                minSoc: "最低电量",
                leadTime: "准备时间(分钟)",
            },
        }
    },
    page: {
zy-acs-flow/src/page/ResourceContent.js
@@ -44,6 +44,7 @@
import staReserve from './staReserve';
import lane from './lane';
import integrationRecord from './integrationRecord';
import guarantee from './guarantee';
const ResourceContent = (node) => {
    switch (node.component) {
@@ -127,6 +128,8 @@
            return lane;
        case 'integrationRecord':
            return integrationRecord;
        case 'guarantee':
            return guarantee;
        default:
            return {
                list: ListGuesser,
zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx
New file
@@ -0,0 +1,164 @@
import React, { useState, useRef, useEffect, useMemo } from "react";
import {
    CreateBase,
    useTranslate,
    TextInput,
    NumberInput,
    BooleanInput,
    DateInput,
    SaveButton,
    SelectInput,
    ReferenceInput,
    ReferenceArrayInput,
    AutocompleteInput,
    Toolbar,
    required,
    useDataProvider,
    useNotify,
    Form,
    useCreateController,
} from 'react-admin';
import {
    Dialog,
    DialogActions,
    DialogContent,
    DialogTitle,
    Stack,
    Grid,
    Box,
} from '@mui/material';
import DialogCloseButton from "../components/DialogCloseButton";
import StatusSelectInput from "../components/StatusSelectInput";
import MemoInput from "../components/MemoInput";
const GuaranteeCreate = (props) => {
    const { open, setOpen } = props;
    const translate = useTranslate();
    const notify = useNotify();
    const handleClose = (event, reason) => {
        if (reason !== "backdropClick") {
            setOpen(false);
        }
    };
    const handleSuccess = async (data) => {
        setOpen(false);
        notify('common.response.success');
    };
    const handleError = async (error) => {
        notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } });
    };
    return (
        <>
            <CreateBase
                record={{}}
                transform={(data) => {
                    return data;
                }}
                mutationOptions={{ onSuccess: handleSuccess, onError: handleError }}
            >
                <Dialog
                    open={open}
                    onClose={handleClose}
                    aria-labelledby="form-dialog-title"
                    fullWidth
                    disableRestoreFocus
                    maxWidth="md"   // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
                >
                    <Form>
                        <DialogTitle id="form-dialog-title" sx={{
                            position: 'sticky',
                            top: 0,
                            backgroundColor: 'background.paper',
                            zIndex: 1000
                        }}
                        >
                            {translate('create.title')}
                            <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}>
                                <DialogCloseButton onClose={handleClose} />
                            </Box>
                        </DialogTitle>
                        <DialogContent>
                            <Grid container rowSpacing={2} columnSpacing={2}>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <TextInput
                                        label="table.field.guarantee.uuid"
                                        source="uuid"
                                        parse={v => v}
                                        autoFocus
                                    />
                                </Grid>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <TextInput
                                        label="table.field.guarantee.name"
                                        source="name"
                                        parse={v => v}
                                    />
                                </Grid>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <TextInput
                                        label="table.field.guarantee.scopeType"
                                        source="scopeType"
                                        parse={v => v}
                                    />
                                </Grid>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <TextInput
                                        label="table.field.guarantee.scopeValue"
                                        source="scopeValue"
                                        parse={v => v}
                                    />
                                </Grid>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <TextInput
                                        label="table.field.guarantee.cronExpr"
                                        source="cronExpr"
                                        parse={v => v}
                                    />
                                </Grid>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <NumberInput
                                        label="table.field.guarantee.requiredCount"
                                        source="requiredCount"
                                    />
                                </Grid>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <NumberInput
                                        label="table.field.guarantee.minSoc"
                                        source="minSoc"
                                    />
                                </Grid>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <NumberInput
                                        label="table.field.guarantee.leadTime"
                                        source="leadTime"
                                    />
                                </Grid>
                                <Grid item xs={6} display="flex" gap={1}>
                                    <StatusSelectInput />
                                </Grid>
                                <Grid item xs={12} display="flex" gap={1}>
                                    <Stack direction="column" spacing={1} width={'100%'}>
                                        <MemoInput />
                                    </Stack>
                                </Grid>
                            </Grid>
                        </DialogContent>
                        <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
                            <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }}  >
                                <SaveButton />
                            </Toolbar>
                        </DialogActions>
                    </Form>
                </Dialog>
            </CreateBase>
        </>
    )
}
export default GuaranteeCreate;
zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx
New file
@@ -0,0 +1,136 @@
import React, { useState, useRef, useEffect, useMemo } from "react";
import {
    Edit,
    SimpleForm,
    FormDataConsumer,
    useTranslate,
    TextInput,
    NumberInput,
    BooleanInput,
    DateInput,
    SelectInput,
    ReferenceInput,
    ReferenceArrayInput,
    AutocompleteInput,
    SaveButton,
    Toolbar,
    Labeled,
    NumberField,
    required,
    useRecordContext,
    DeleteButton,
} from 'react-admin';
import { useWatch, useFormContext } from "react-hook-form";
import { Stack, Grid, Box, Typography } from '@mui/material';
import * as Common from '@/utils/common';
import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting';
import EditBaseAside from "../components/EditBaseAside";
import CustomerTopToolBar from "../components/EditTopToolBar";
import MemoInput from "../components/MemoInput";
import StatusSelectInput from "../components/StatusSelectInput";
const FormToolbar = () => {
    const { getValues } = useFormContext();
    return (
        <Toolbar sx={{ justifyContent: 'space-between' }}>
            <SaveButton />
            <DeleteButton mutationMode="optimistic" />
        </Toolbar>
    )
}
const GuaranteeEdit = () => {
    const translate = useTranslate();
    return (
        <Edit
            redirect="list"
            mutationMode={EDIT_MODE}
            actions={<CustomerTopToolBar />}
            aside={<EditBaseAside />}
        >
            <SimpleForm
                shouldUnregister
                warnWhenUnsavedChanges
                toolbar={<FormToolbar />}
                mode="onTouched"
                defaultValues={{}}
            // validate={(values) => { }}
            >
                <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
                    <Grid item xs={12} md={8}>
                        <Typography variant="h6" gutterBottom>
                            {translate('common.edit.title.main')}
                        </Typography>
                        <Stack direction='row' gap={2}>
                            <TextInput
                                label="table.field.guarantee.uuid"
                                source="uuid"
                                parse={v => v}
                                autoFocus
                            />
                        </Stack>
                        <Stack direction='row' gap={2}>
                            <TextInput
                                label="table.field.guarantee.name"
                                source="name"
                                parse={v => v}
                            />
                        </Stack>
                        <Stack direction='row' gap={2}>
                            <TextInput
                                label="table.field.guarantee.scopeType"
                                source="scopeType"
                                parse={v => v}
                            />
                        </Stack>
                        <Stack direction='row' gap={2}>
                            <TextInput
                                label="table.field.guarantee.scopeValue"
                                source="scopeValue"
                                parse={v => v}
                            />
                        </Stack>
                        <Stack direction='row' gap={2}>
                            <TextInput
                                label="table.field.guarantee.cronExpr"
                                source="cronExpr"
                                parse={v => v}
                            />
                        </Stack>
                        <Stack direction='row' gap={2}>
                            <NumberInput
                                label="table.field.guarantee.requiredCount"
                                source="requiredCount"
                            />
                        </Stack>
                        <Stack direction='row' gap={2}>
                            <NumberInput
                                label="table.field.guarantee.minSoc"
                                source="minSoc"
                            />
                        </Stack>
                        <Stack direction='row' gap={2}>
                            <NumberInput
                                label="table.field.guarantee.leadTime"
                                source="leadTime"
                            />
                        </Stack>
                    </Grid>
                    <Grid item xs={12} md={4}>
                        <Typography variant="h6" gutterBottom>
                            {translate('common.edit.title.common')}
                        </Typography>
                        <StatusSelectInput />
                        <Box mt="2em" />
                        <MemoInput />
                    </Grid>
                </Grid>
            </SimpleForm>
        </Edit >
    )
}
export default GuaranteeEdit;
zy-acs-flow/src/page/guarantee/GuaranteeList.jsx
New file
@@ -0,0 +1,166 @@
import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
import { useNavigate } from 'react-router-dom';
import {
    List,
    DatagridConfigurable,
    SearchInput,
    TopToolbar,
    SelectColumnsButton,
    EditButton,
    FilterButton,
    CreateButton,
    ExportButton,
    BulkDeleteButton,
    WrapperField,
    useRecordContext,
    useTranslate,
    useNotify,
    useListContext,
    FunctionField,
    TextField,
    NumberField,
    DateField,
    BooleanField,
    ReferenceField,
    TextInput,
    DateTimeInput,
    DateInput,
    SelectInput,
    NumberInput,
    ReferenceInput,
    ReferenceArrayInput,
    AutocompleteInput,
    DeleteButton,
} from 'react-admin';
import { Box, Typography, Card, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
import GuaranteeCreate from "./GuaranteeCreate";
import GuaranteePanel from "./GuaranteePanel";
import EmptyData from "../components/EmptyData";
import MyCreateButton from "../components/MyCreateButton";
import MyExportButton from '../components/MyExportButton';
import PageDrawer from "../components/PageDrawer";
import MyField from "../components/MyField";
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
import * as Common from '@/utils/common';
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
    '& .css-1vooibu-MuiSvgIcon-root': {
        height: '.9em'
    },
    '& .RaDatagrid-row': {
        cursor: 'auto'
    },
    '& .column-name': {
    },
    '& .opt': {
        width: 200
    },
}));
const filters = [
    <SearchInput source="condition" alwaysOn />,
    <DateInput label='common.time.after' source="timeStart" alwaysOn />,
    <DateInput label='common.time.before' source="timeEnd" alwaysOn />,
    <TextInput source="uuid" label="table.field.guarantee.uuid" />,
    <TextInput source="name" label="table.field.guarantee.name" />,
    <TextInput source="scopeType" label="table.field.guarantee.scopeType" />,
    <TextInput source="scopeValue" label="table.field.guarantee.scopeValue" />,
    <TextInput source="cronExpr" label="table.field.guarantee.cronExpr" />,
    <NumberInput source="requiredCount" label="table.field.guarantee.requiredCount" />,
    <NumberInput source="minSoc" label="table.field.guarantee.minSoc" />,
    <NumberInput source="leadTime" label="table.field.guarantee.leadTime" />,
    <TextInput label="common.field.memo" source="memo" />,
    <SelectInput
        label="common.field.status"
        source="status"
        choices={[
            { id: '1', name: 'common.enums.statusTrue' },
            { id: '0', name: 'common.enums.statusFalse' },
        ]}
        resettable
    />,
]
const GuaranteeList = () => {
    const translate = useTranslate();
    const [createDialog, setCreateDialog] = useState(false);
    const [drawerVal, setDrawerVal] = useState(false);
    return (
        <Box display="flex">
            <List
                sx={{
                    flexGrow: 1,
                    transition: (theme) =>
                        theme.transitions.create(['all'], {
                            duration: theme.transitions.duration.enteringScreen,
                        }),
                    marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
                }}
                title={"menu.guarantee"}
                empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
                filters={filters}
                sort={{ field: "create_time", order: "desc" }}
                actions={(
                    <TopToolbar>
                        <FilterButton />
                        <MyCreateButton onClick={() => { setCreateDialog(true) }} />
                        <SelectColumnsButton preferenceKey='guarantee' />
                        <MyExportButton />
                    </TopToolbar>
                )}
                perPage={DEFAULT_PAGE_SIZE}
            >
                <StyledDatagrid
                    preferenceKey='guarantee'
                    bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
                    rowClick={(id, resource, record) => false}
                    expand={() => <GuaranteePanel />}
                    expandSingle={true}
                    omit={['id', 'createTime', 'createBy', 'memo']}
                >
                    <NumberField source="id" />
                    <TextField source="uuid" label="table.field.guarantee.uuid" />
                    <TextField source="name" label="table.field.guarantee.name" />
                    <TextField source="scopeType" label="table.field.guarantee.scopeType" />
                    <TextField source="scopeValue" label="table.field.guarantee.scopeValue" />
                    <TextField source="cronExpr" label="table.field.guarantee.cronExpr" />
                    <NumberField source="requiredCount" label="table.field.guarantee.requiredCount" />
                    <NumberField source="minSoc" label="table.field.guarantee.minSoc" />
                    <NumberField source="leadTime" label="table.field.guarantee.leadTime" />
                    <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}>
                        <TextField source="nickname" />
                    </ReferenceField>
                    <DateField source="updateTime" label="common.field.updateTime" showTime />
                    <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}>
                        <TextField source="nickname" />
                    </ReferenceField>
                    <DateField source="createTime" label="common.field.createTime" showTime />
                    <BooleanField source="statusBool" label="common.field.status" sortable={false} />
                    <TextField source="memo" label="common.field.memo" sortable={false} />
                    <WrapperField cellClassName="opt" label="common.field.opt">
                        <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
                        <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
                    </WrapperField>
                </StyledDatagrid>
            </List>
            <GuaranteeCreate
                open={createDialog}
                setOpen={setCreateDialog}
            />
            <PageDrawer
                title='Guarantee Detail'
                drawerVal={drawerVal}
                setDrawerVal={setDrawerVal}
            >
            </PageDrawer>
        </Box>
    )
}
export default GuaranteeList;
zy-acs-flow/src/page/guarantee/GuaranteePanel.jsx
New file
@@ -0,0 +1,99 @@
import React, { useState, useRef, useEffect, useMemo } from "react";
import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material';
import {
    useTranslate,
    useRecordContext,
} from 'react-admin';
import PanelTypography from "../components/PanelTypography";
import * as Common from '@/utils/common'
const GuaranteePanel = () => {
    const record = useRecordContext();
    if (!record) return null;
    const translate = useTranslate();
    return (
        <>
            <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}>
                <CardContent>
                    <Grid container spacing={2}>
                        <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}>
                            <Typography variant="h6" gutterBottom align="left" sx={{
                                maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' },
                                whiteSpace: 'nowrap',
                                overflow: 'hidden',
                                textOverflow: 'ellipsis',
                            }}>
                                {Common.camelToPascalWithSpaces(translate('table.field.guarantee.name'))}: {record.name}
                            </Typography>
                            {/*  inherit, primary, secondary, textPrimary, textSecondary, error */}
                            <Typography variant="h6" gutterBottom align="right" >
                                ID: {record.id}
                            </Typography>
                        </Grid>
                    </Grid>
                    <Grid container spacing={2}>
                        <Grid item xs={12} container alignContent="flex-end">
                            <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}>
                                {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo}
                            </Typography>
                        </Grid>
                    </Grid>
                    <Box height={20}>&nbsp;</Box>
                    <Grid container spacing={2}>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.guarantee.uuid"
                                property={record.uuid}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.guarantee.name"
                                property={record.name}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.guarantee.scopeType"
                                property={record.scopeType}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.guarantee.scopeValue"
                                property={record.scopeValue}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.guarantee.cronExpr"
                                property={record.cronExpr}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.guarantee.requiredCount"
                                property={record.requiredCount}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.guarantee.minSoc"
                                property={record.minSoc}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.guarantee.leadTime"
                                property={record.leadTime}
                            />
                        </Grid>
                    </Grid>
                </CardContent>
            </Card >
        </>
    );
};
export default GuaranteePanel;
zy-acs-flow/src/page/guarantee/index.jsx
New file
@@ -0,0 +1,18 @@
import React, { useState, useRef, useEffect, useMemo } from "react";
import {
    ListGuesser,
    EditGuesser,
    ShowGuesser,
} from "react-admin";
import GuaranteeList from "./GuaranteeList";
import GuaranteeEdit from "./GuaranteeEdit";
export default {
    list: GuaranteeList,
    edit: GuaranteeEdit,
    show: ShowGuesser,
    recordRepresentation: (record) => {
        return `${record.name}`
    }
};
zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java
@@ -22,8 +22,8 @@
//        generator.username="sa";priority
//        generator.password="Zoneyung@zy56$";
        generator.table="man_integration_record";
        generator.tableDesc="Integration Record";
        generator.table="man_guarantee";
        generator.tableDesc="Guarantee";
        generator.packagePath="com.zy.acs.manager.manager";
        generator.build();
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/GuaranteeController.java
New file
@@ -0,0 +1,111 @@
package com.zy.acs.manager.manager.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.common.R;
import com.zy.acs.manager.common.utils.ExcelUtil;
import com.zy.acs.manager.common.annotation.OperationLog;
import com.zy.acs.manager.common.domain.BaseParam;
import com.zy.acs.manager.common.domain.KeyValVo;
import com.zy.acs.manager.common.domain.PageParam;
import com.zy.acs.manager.manager.entity.Guarantee;
import com.zy.acs.manager.manager.service.GuaranteeService;
import com.zy.acs.manager.system.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@RequestMapping("/api")
public class GuaranteeController extends BaseController {
    @Autowired
    private GuaranteeService guaranteeService;
    @PreAuthorize("hasAuthority('manager:guarantee:list')")
    @PostMapping("/guarantee/page")
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<Guarantee, BaseParam> pageParam = new PageParam<>(baseParam, Guarantee.class);
        return R.ok().add(guaranteeService.page(pageParam, pageParam.buildWrapper(true)));
    }
    @PreAuthorize("hasAuthority('manager:guarantee:list')")
    @PostMapping("/guarantee/list")
    public R list(@RequestBody Map<String, Object> map) {
        return R.ok().add(guaranteeService.list());
    }
    @PreAuthorize("hasAuthority('manager:guarantee:list')")
    @PostMapping({"/guarantee/many/{ids}", "/guarantees/many/{ids}"})
    public R many(@PathVariable Long[] ids) {
        return R.ok().add(guaranteeService.listByIds(Arrays.asList(ids)));
    }
    @PreAuthorize("hasAuthority('manager:guarantee:list')")
    @GetMapping("/guarantee/{id}")
    public R get(@PathVariable("id") Long id) {
        return R.ok().add(guaranteeService.getById(id));
    }
    @PreAuthorize("hasAuthority('manager:guarantee:save')")
    @OperationLog("Create Guarantee")
    @PostMapping("/guarantee/save")
    public R save(@RequestBody Guarantee guarantee) {
        guarantee.setCreateBy(getLoginUserId());
        guarantee.setCreateTime(new Date());
        guarantee.setUpdateBy(getLoginUserId());
        guarantee.setUpdateTime(new Date());
        if (!guaranteeService.save(guarantee)) {
            return R.error("Save Fail");
        }
        return R.ok("Save Success").add(guarantee);
    }
    @PreAuthorize("hasAuthority('manager:guarantee:update')")
    @OperationLog("Update Guarantee")
    @PostMapping("/guarantee/update")
    public R update(@RequestBody Guarantee guarantee) {
        guarantee.setUpdateBy(getLoginUserId());
        guarantee.setUpdateTime(new Date());
        if (!guaranteeService.updateById(guarantee)) {
            return R.error("Update Fail");
        }
        return R.ok("Update Success").add(guarantee);
    }
    @PreAuthorize("hasAuthority('manager:guarantee:remove')")
    @OperationLog("Delete Guarantee")
    @PostMapping("/guarantee/remove/{ids}")
    public R remove(@PathVariable Long[] ids) {
        if (!guaranteeService.removeByIds(Arrays.asList(ids))) {
            return R.error("Delete Fail");
        }
        return R.ok("Delete Success").add(ids);
    }
    @PreAuthorize("hasAuthority('manager:guarantee:list')")
    @PostMapping("/guarantee/query")
    public R query(@RequestParam(required = false) String condition) {
        List<KeyValVo> vos = new ArrayList<>();
        LambdaQueryWrapper<Guarantee> wrapper = new LambdaQueryWrapper<>();
        if (!Cools.isEmpty(condition)) {
            wrapper.like(Guarantee::getName, condition);
        }
        guaranteeService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
                item -> vos.add(new KeyValVo(item.getId(), item.getName()))
        );
        return R.ok().add(vos);
    }
    @PreAuthorize("hasAuthority('manager:guarantee:list')")
    @PostMapping("/guarantee/export")
    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        ExcelUtil.build(ExcelUtil.create(guaranteeService.list(), Guarantee.class), response);
    }
}
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Guarantee.java
New file
@@ -0,0 +1,197 @@
package com.zy.acs.manager.manager.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zy.acs.framework.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@TableName("man_guarantee")
public class Guarantee implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 标识
     */
    @ApiModelProperty(value= "标识")
    private String uuid;
    /**
     * 名称
     */
    @ApiModelProperty(value= "名称")
    private String name;
    /**
     * 作用范围
     */
    @ApiModelProperty(value= "作用范围")
    private String scopeType;
    /**
     * 范围值
     */
    @ApiModelProperty(value= "范围值")
    private String scopeValue;
    /**
     * 调度时间
     */
    @ApiModelProperty(value= "调度时间")
    private String cronExpr;
    /**
     * 目标数量
     */
    @ApiModelProperty(value= "目标数量")
    private Integer requiredCount;
    /**
     * 最低电量
     */
    @ApiModelProperty(value= "最低电量")
    private Integer minSoc;
    /**
     * 准备时间
     */
    @ApiModelProperty(value= "准备时间")
    private Integer leadTime;
    /**
     * 状态 1: 正常  0: 冻结
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    @TableLogic
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Integer tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public Guarantee() {}
    public Guarantee(String uuid,String name,String scopeType,String scopeValue,String cronExpr,Integer requiredCount,Integer minSoc,Integer leadTime,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) {
        this.uuid = uuid;
        this.name = name;
        this.scopeType = scopeType;
        this.scopeValue = scopeValue;
        this.cronExpr = cronExpr;
        this.requiredCount = requiredCount;
        this.minSoc = minSoc;
        this.leadTime = leadTime;
        this.status = status;
        this.deleted = deleted;
        this.tenantId = tenantId;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
        this.memo = memo;
    }
//    Guarantee guarantee = new Guarantee(
//            null,    // 标识
//            null,    // 名称
//            null,    // 作用范围
//            null,    // 范围值
//            null,    // 调度时间
//            null,    // 目标数量
//            null,    // 最低电量
//            null,    // 准备时间
//            null,    // 状态[非空]
//            null,    // 是否删除[非空]
//            null,    // 租户
//            null,    // 添加人员
//            null,    // 添加时间[非空]
//            null,    // 修改人员
//            null,    // 修改时间
//            null    // 备注
//    );
    public String getCreateTime$(){
        if (Cools.isEmpty(this.createTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
    public String getUpdateTime$(){
        if (Cools.isEmpty(this.updateTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/mapper/GuaranteeMapper.java
New file
@@ -0,0 +1,12 @@
package com.zy.acs.manager.manager.mapper;
import com.zy.acs.manager.manager.entity.Guarantee;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface GuaranteeMapper extends BaseMapper<Guarantee> {
}
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/GuaranteeService.java
New file
@@ -0,0 +1,8 @@
package com.zy.acs.manager.manager.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.manager.manager.entity.Guarantee;
public interface GuaranteeService extends IService<Guarantee> {
}
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/GuaranteeServiceImpl.java
New file
@@ -0,0 +1,12 @@
package com.zy.acs.manager.manager.service.impl;
import com.zy.acs.manager.manager.mapper.GuaranteeMapper;
import com.zy.acs.manager.manager.entity.Guarantee;
import com.zy.acs.manager.manager.service.GuaranteeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service("guaranteeService")
public class GuaranteeServiceImpl extends ServiceImpl<GuaranteeMapper, Guarantee> implements GuaranteeService {
}
zy-acs-manager/src/main/java/guarantee.sql
New file
@@ -0,0 +1,30 @@
-- save guarantee record
-- mysql
--  BatteryChargingFull
insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.guarantee', '0', '/manager/guarantee', 'guarantee', '0' , '0', '1' , '1');
insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query Guarantee', '', '1', 'manager:guarantee:list', '0', '1', '1');
insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create Guarantee', '', '1', 'manager:guarantee:save', '1', '1', '1');
insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update Guarantee', '', '1', 'manager:guarantee:update', '2', '1', '1');
insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete Guarantee', '', '1', 'manager:guarantee:remove', '3', '1', '1');
-- locale menu name
guarantee: 'Guarantee',
-- locale field
guarantee: {
    uuid: "uuid",
    name: "name",
    scopeType: "scopeType",
    scopeValue: "scopeValue",
    cronExpr: "cronExpr",
    requiredCount: "requiredCount",
    minSoc: "minSoc",
    leadTime: "leadTime",
},
-- ResourceContent
import guarantee from './guarantee';
case 'guarantee':
    return guarantee;
zy-acs-manager/src/main/resources/mapper/manager/GuaranteeMapper.xml
New file
@@ -0,0 +1,5 @@
<?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.zy.acs.manager.manager.mapper.GuaranteeMapper">
</mapper>