| | |
| | | |
| | | postForm('/api/loc/search/like/locNo', { |
| | | locNo: sourceLocNo.value, |
| | | test: "123", |
| | | quer: "" |
| | | }).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
New file |
| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const formTable = ref(null); |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | |
| | | const emit = defineEmits(['tableReload']) |
| | | |
| | | const handleOk = (e) => { |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | | submitButton.value.$el.click(); |
| | | }, 100); |
| | | }); |
| | | }; |
| | | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | post(isSave.value ? '/api/cacheStatistics/save' : '/api/cacheStatistics/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(isSave.value ? formatMessage('page.add.success', '新增成功') : formatMessage('page.update.success', '更新成功')); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | nextTick(() => { |
| | | formTable.value.resetFields() |
| | | }) |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | const userQueryList = ref(null); |
| | | userQuery(); |
| | | function userQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | userQueryList.value = result.data; |
| | | }) |
| | | } |
| | | |
| | | |
| | | defineExpose({ |
| | | open, |
| | | formData, |
| | | initFormData, |
| | | isSave, |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '系统缓存统计-edit' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.ymd', '统计时间') " |
| | | name="ymd" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.ymd" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.cache_key', '缓存路径') " |
| | | name="cacheKey" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.cacheKey" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.hit', '命中次数') " |
| | | name="hit" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.hit" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.miss', '未命中次数') " |
| | | name="miss" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.miss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.status', '状态') " |
| | | name="status" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.status" |
| | | :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.create_time', '添加时间') " |
| | | name="createTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.createTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.create_by', '添加人员') " |
| | | name="createBy" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.createBy" |
| | | :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="userQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.update_time', '修改时间') " |
| | | name="updateTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.updateTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.update_by', '修改人员') " |
| | | name="updateBy" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.updateBy" |
| | | :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="userQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.sys_cache_statistics.memo', '备注') " |
| | | name="memo" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.memo" |
| | | /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | | style="visibility: hidden;">Submit</a-button> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
New file |
| | |
| | | <script setup> |
| | | import { getCurrentInstance, ref, computed, reactive } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { get, post, postBlob } from '@/utils/request.js' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | import { logout } from '@/config.js'; |
| | | import EditView from './edit.vue' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-cacheStatistics'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | | |
| | | const { |
| | | getColumnSearchProps, |
| | | handleResizeColumn, |
| | | } = useTableSearch(); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.ymd', '统计时间'), |
| | | dataIndex: 'ymd', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('ymd'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.cache_key', '缓存路径'), |
| | | dataIndex: 'cacheKey', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('cacheKey'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.hit', '命中次数'), |
| | | dataIndex: 'hit', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('hit'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.miss', '未命中次数'), |
| | | dataIndex: 'miss', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('miss'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('status$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.create_by', '添加人员'), |
| | | dataIndex: 'createBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_cache_statistics.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('memo'), |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | fixed: 'right', |
| | | }, |
| | | ]; |
| | | |
| | | const hasSelected = computed(() => state.selectedRowKeys.length > 0); |
| | | const start = () => { |
| | | state.loading = true; |
| | | // ajax request after empty completing |
| | | setTimeout(() => { |
| | | state.loading = false; |
| | | state.selectedRowKeys = []; |
| | | }, 1000); |
| | | }; |
| | | const onSelectChange = selectedRowKeys => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | }; |
| | | |
| | | function getPage() { |
| | | state.loading = true; |
| | | post('/api/cacheStatistics/page', { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchInput.value |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | tableData.value = data; |
| | | |
| | | state.loading = false; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleEdit = (item) => { |
| | | editChild.value.open = true; |
| | | editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item)); |
| | | editChild.value.isSave = item == null; |
| | | } |
| | | |
| | | const handleDel = (rows) => { |
| | | Modal.confirm({ |
| | | title: formatMessage('page.delete', '删除'), |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/cacheStatistics/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | const handleExport = async (intl) => { |
| | | postBlob('/api/cacheStatistics/export', {}).then(result => { |
| | | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | return true; |
| | | }) |
| | | }; |
| | | |
| | | const onSearch = () => { |
| | | // console.log('search'); |
| | | getPage() |
| | | } |
| | | |
| | | const onPageChange = (page, size) => { |
| | | currentPage = page; |
| | | pageSize = size; |
| | | getPage(); |
| | | } |
| | | |
| | | function handleTableReload(value) { |
| | | getPage() |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '系统缓存统计' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <EditView ref="editChild" @tableReload="handleTableReload" /> |
| | | <div class="table-header"> |
| | | <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" |
| | | style="width: 200px;" @search="onSearch" /> |
| | | <div class="table-header-right"> |
| | | <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> |
| | | <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button> |
| | | </div> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" |
| | | :pagination="{ total: tableData.total, onChange: onPageChange }" |
| | | :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" @resizeColumn="handleResizeColumn" :loading="state.loading"> |
| | | <template #bodyCell="{ column, text, record }"> |
| | | <template v-if="column.dataIndex === 'oper'"> |
| | | <div style="display: flex;justify-content: space-evenly;"> |
| | | <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button> |
| | | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除') |
| | | }}</a-button> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-fileupload</groupId> |
| | | <artifactId>commons-fileupload</artifactId> |
| | | <version>1.4</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>2.8.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.asrs.entity.CacheStatistics; |
| | | import com.zy.asrs.wms.asrs.service.CacheStatisticsService; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | | import com.zy.asrs.wms.utils.ExcelUtil; |
| | | 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.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class CacheStatisticsController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CacheStatisticsService cacheStatisticsService; |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheStatistics:list')") |
| | | @PostMapping("/cacheStatistics/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<CacheStatistics, BaseParam> pageParam = new PageParam<>(baseParam, CacheStatistics.class); |
| | | return R.ok().add(cacheStatisticsService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheStatistics:list')") |
| | | @PostMapping("/cacheStatistics/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(cacheStatisticsService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheStatistics:list')") |
| | | @GetMapping("/cacheStatistics/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(cacheStatisticsService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheStatistics:save')") |
| | | @OperationLog("添加系统缓存统计") |
| | | @PostMapping("/cacheStatistics/save") |
| | | public R save(@RequestBody CacheStatistics cacheStatistics) { |
| | | if (!cacheStatisticsService.save(cacheStatistics)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheStatistics:update')") |
| | | @OperationLog("修改系统缓存统计") |
| | | @PostMapping("/cacheStatistics/update") |
| | | public R update(@RequestBody CacheStatistics cacheStatistics) { |
| | | if (!cacheStatisticsService.updateById(cacheStatistics)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheStatistics:remove')") |
| | | @OperationLog("删除系统缓存统计") |
| | | @PostMapping("/cacheStatistics/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!cacheStatisticsService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheStatistics:list')") |
| | | @PostMapping("/cacheStatistics/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<CacheStatistics> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(CacheStatistics::getId, condition); |
| | | } |
| | | cacheStatisticsService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheStatistics:list')") |
| | | @PostMapping("/cacheStatistics/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(cacheStatisticsService.list(), CacheStatistics.class), response); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.wms.asrs.service.MatService; |
| | | import com.zy.asrs.wms.asrs.service.TaskDetlLogService; |
| | | import com.zy.asrs.wms.asrs.service.TaskLogService; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | private MatService matService; |
| | | |
| | | @PostMapping("/charts/loc/use") |
| | | @CacheData(tableName = {"man_loc"}) |
| | | public R locUse(){ |
| | | List<EChartPieBean> list = new ArrayList<>(); |
| | | |
| | |
| | | } |
| | | |
| | | @PostMapping("/charts/loc/line") |
| | | @CacheData(tableName = {"man_task_log"}) |
| | | public R locIoLineCharts(){ |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | |
| | | } |
| | | |
| | | @PostMapping("/charts/information") |
| | | @CacheData(tableName = {"man_mat", "man_task", "man_task_log"}) |
| | | public R information() { |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | long matCount = matService.count(); |
| | |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | ViewInOut viewInOut = viewInOutMapper.selectOne(new LambdaQueryWrapper<ViewInOut>().eq(ViewInOut::getYmd, format.format(new Date())).orderByDesc(ViewInOut::getYmd).last("limit 0,1")); |
| | | if(viewInOut != null) { |
| | | if (viewInOut != null) { |
| | | inQty = viewInOut.getInQty(); |
| | | outQty = viewInOut.getOutQty(); |
| | | totalQty = viewInOut.getTotalQty(); |
| | |
| | | } |
| | | |
| | | @PostMapping("/charts/information/top") |
| | | @CacheData(tableName = {"man_task_detl_log"}) |
| | | public R informationTop() { |
| | | List<InformationTop> topIn = taskDetlLogService.getInformationTopIn(10); |
| | | List<InformationTop> topOut = taskDetlLogService.getInformationTopOut(10); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locArea:list')") |
| | | @PostMapping("/locArea/page") |
| | | @CacheData(tableName = {"man_loc_area"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<LocArea, BaseParam> pageParam = new PageParam<>(baseParam, LocArea.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locArea:list')") |
| | | @PostMapping("/locArea/list") |
| | | @CacheData(tableName = {"man_loc_area"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locAreaService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locArea:list')") |
| | | @GetMapping("/locArea/{id}") |
| | | @CacheData(tableName = {"man_loc_area"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locAreaService.getById(id)); |
| | | } |
| | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.asrs.entity.Tag; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locAreaType:list')") |
| | | @PostMapping("/locAreaType/page") |
| | | @CacheData(tableName = {"man_loc_area_type"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<LocAreaType, BaseParam> pageParam = new PageParam<>(baseParam, LocAreaType.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locAreaType:list')") |
| | | @PostMapping("/locAreaType/tree") |
| | | @CacheData(tableName = {"man_loc_area_type"}) |
| | | public R tree(@RequestBody Map<String, Object> map) { |
| | | List<LocAreaType> locAreaTypeList = locAreaTypeService.list(new LambdaQueryWrapper<LocAreaType>().orderByAsc(LocAreaType::getSort)); |
| | | List<LocAreaType> treeData = Utils.toTreeData(locAreaTypeList, 0L, LocAreaType::getParentId, LocAreaType::getId, LocAreaType::setChildren); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locAreaType:list')") |
| | | @PostMapping("/locAreaType/list") |
| | | @CacheData(tableName = {"man_loc_area_type"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locAreaTypeService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locAreaType:list')") |
| | | @GetMapping("/locAreaType/{id}") |
| | | @CacheData(tableName = {"man_loc_area_type"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locAreaTypeService.getById(id)); |
| | | } |
| | |
| | | import com.zy.asrs.wms.asrs.entity.LocDetl; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocStsType; |
| | | import com.zy.asrs.wms.asrs.service.LocDetlService; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:loc:list')") |
| | | @PostMapping("/loc/page") |
| | | @CacheData(tableName = {"man_loc"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Loc, BaseParam> pageParam = new PageParam<>(baseParam, Loc.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:loc:list')") |
| | | @PostMapping("/loc/list") |
| | | @CacheData(tableName = {"man_loc"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:loc:list')") |
| | | @GetMapping("/loc/{id}") |
| | | @CacheData(tableName = {"man_loc"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:loc:list')") |
| | | @PostMapping("/loc/search/locNo") |
| | | @CacheData(tableName = {"man_loc"}) |
| | | public R get(@RequestParam("locNo") String locNo) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, locNo)); |
| | | if(loc == null) { |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:loc:list')") |
| | | @PostMapping("/loc/search/like/locNo") |
| | | @CacheData(tableName = {"man_loc"}) |
| | | public R search(@RequestParam("locNo") String locNo) { |
| | | if (Cools.isEmpty(locNo)) { |
| | | return R.ok().add(new ArrayList<>()); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:loc:list')") |
| | | @PostMapping("/loc/search/empty/locNo") |
| | | @CacheData(tableName = {"man_loc"}) |
| | | public R searchEmpty(@RequestParam("locNo") String locNo) { |
| | | if (Cools.isEmpty(locNo)) { |
| | | return R.ok().add(locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getLocStsId, LocStsType.O.val()))); |
| | |
| | | import com.zy.asrs.wms.asrs.service.LocDetlFieldService; |
| | | import com.zy.asrs.wms.asrs.service.LocService; |
| | | import com.zy.asrs.wms.asrs.service.MatFieldService; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @PostMapping("/locDetl/page") |
| | | @CacheData(tableName = {"man_loc_detl"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @PostMapping("/locDetl/outPage") |
| | | @CacheData(tableName = {"man_loc_detl"}) |
| | | public R outPage(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @PostMapping("/locDetl/list") |
| | | @CacheData(tableName = {"man_loc_detl"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | List<LocDetl> list = locDetlService.getLocDetlList(map); |
| | | return R.ok().add(list); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @PostMapping("/locDetl/listByIds") |
| | | @CacheData(tableName = {"man_loc_detl"}) |
| | | public R listByIds(@RequestBody List<Long> ids) { |
| | | List<LocDetl> list = locDetlService.listByIds(ids); |
| | | List<LocDetl> locDetls = locDetlService.parseLocDetl(list); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @GetMapping("/locDetl/locId/{locId}") |
| | | @CacheData(tableName = {"man_loc_detl"}) |
| | | public R list(@PathVariable("locId") Long locId) { |
| | | List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locId)); |
| | | List<LocDetl> locDetls = locDetlService.parseLocDetl(list); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @GetMapping("/locDetl/locNo/{locNo}") |
| | | @CacheData(tableName = {"man_loc_detl"}) |
| | | public R list(@PathVariable("locNo") String locNo) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, locNo)); |
| | | if (loc == null) { |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @GetMapping("/locDetl/{id}") |
| | | @CacheData(tableName = {"man_loc_detl"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locDetlService.getById(id)); |
| | | } |
| | |
| | | import com.zy.asrs.wms.asrs.service.MatFieldService; |
| | | import com.zy.asrs.wms.asrs.service.MatFieldValueService; |
| | | import com.zy.asrs.wms.asrs.service.TagService; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:mat:list')") |
| | | @PostMapping("/mat/page") |
| | | @CacheData(tableName = {"man_mat"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Mat, BaseParam> pageParam = new PageParam<>(baseParam, Mat.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:mat:list')") |
| | | @PostMapping("/mat/list") |
| | | @CacheData(tableName = {"man_mat"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(matService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:mat:list')") |
| | | @GetMapping("/mat/{id}") |
| | | @CacheData(tableName = {"man_mat"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(matService.getById(id)); |
| | | } |
| | |
| | | import com.zy.asrs.wms.asrs.entity.template.OrderTemplate; |
| | | import com.zy.asrs.wms.asrs.service.MatFieldService; |
| | | import com.zy.asrs.wms.asrs.service.OrderTypeService; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:order:list')") |
| | | @PostMapping("/order/page") |
| | | @CacheData(tableName = {"man_order"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Order, BaseParam> pageParam = new PageParam<>(baseParam, Order.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:order:list')") |
| | | @PostMapping("/order/in/page") |
| | | @CacheData(tableName = {"man_order", "man_order_type"}) |
| | | public R pageIn(@RequestBody Map<String, Object> map) { |
| | | String condition = map.getOrDefault("condition", "").toString(); |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | |
| | | } |
| | | |
| | | Object paramObj = map.get("_param"); |
| | | if(paramObj != null) { |
| | | if (paramObj != null) { |
| | | Map param = (Map) paramObj; |
| | | for (Object value : param.entrySet()) { |
| | | Map.Entry entry = (Map.Entry) value; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:order:list')") |
| | | @PostMapping("/order/out/page") |
| | | @CacheData(tableName = {"man_order", "man_order_type"}) |
| | | public R pageOut(@RequestBody Map<String, Object> map) { |
| | | String condition = map.getOrDefault("condition", "").toString(); |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:order:list')") |
| | | @PostMapping("/order/list") |
| | | @CacheData(tableName = {"man_order"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(orderService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:order:list')") |
| | | @GetMapping("/order/{id}") |
| | | @CacheData(tableName = {"man_order"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(orderService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetl:list')") |
| | | @PostMapping("/orderDetl/page") |
| | | @CacheData(tableName = {"man_order_detl"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OrderDetl, BaseParam> pageParam = new PageParam<>(baseParam, OrderDetl.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetl:list')") |
| | | @PostMapping("/orderDetl/list") |
| | | @CacheData(tableName = {"man_order_detl"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(orderDetlService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetl:list')") |
| | | @GetMapping("/orderDetl/orderId/{orderId}") |
| | | @CacheData(tableName = {"man_order_detl", "man_order_detl_field"}) |
| | | public R list(@PathVariable("orderId") Long orderId) { |
| | | return R.ok().add(orderDetlService.getOrderDetlByOrderId(orderId)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetl:list')") |
| | | @GetMapping("/orderDetl/{id}") |
| | | @CacheData(tableName = {"man_order_detl"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(orderDetlService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetlField:list')") |
| | | @PostMapping("/orderDetlField/page") |
| | | @CacheData(tableName = {"man_order_detl_field"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OrderDetlField, BaseParam> pageParam = new PageParam<>(baseParam, OrderDetlField.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetlField:list')") |
| | | @PostMapping("/orderDetlField/list") |
| | | @CacheData(tableName = {"man_order_detl_field"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(orderDetlFieldService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetlField:list')") |
| | | @GetMapping("/orderDetlField/{id}") |
| | | @CacheData(tableName = {"man_order_detl_field"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(orderDetlFieldService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetlFieldLog:list')") |
| | | @PostMapping("/orderDetlFieldLog/page") |
| | | @CacheData(tableName = {"man_order_detl_field_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OrderDetlFieldLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderDetlFieldLog.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetlFieldLog:list')") |
| | | @PostMapping("/orderDetlFieldLog/list") |
| | | @CacheData(tableName = {"man_order_detl_field_log"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(orderDetlFieldLogService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetlFieldLog:list')") |
| | | @GetMapping("/orderDetlFieldLog/{id}") |
| | | @CacheData(tableName = {"man_order_detl_field_log"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(orderDetlFieldLogService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetlLog:list')") |
| | | @PostMapping("/orderDetlLog/page") |
| | | @CacheData(tableName = {"man_order_detl_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OrderDetlLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderDetlLog.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetlLog:list')") |
| | | @PostMapping("/orderDetlLog/list") |
| | | @CacheData(tableName = {"man_order_detl_log"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(orderDetlLogService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderDetl:list')") |
| | | @GetMapping("/orderDetlLog/orderId/{orderId}") |
| | | @CacheData(tableName = {"man_order_detl_log"}) |
| | | public R list(@PathVariable("orderId") Long orderId) { |
| | | return R.ok().add(orderDetlLogService.getOrderDetlByOrderId(orderId)); |
| | | } |
| | |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.asrs.entity.OrderType; |
| | | import com.zy.asrs.wms.asrs.service.OrderTypeService; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderLog:list')") |
| | | @PostMapping("/orderLog/page") |
| | | @CacheData(tableName = {"man_order_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderLog:list')") |
| | | @PostMapping("/orderLog/in/page") |
| | | @CacheData(tableName = {"man_order_log", "man_order_type"}) |
| | | public R pageIn(@RequestBody Map<String, Object> map) { |
| | | String condition = map.getOrDefault("condition", "").toString(); |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | |
| | | } |
| | | |
| | | Object paramObj = map.get("_param"); |
| | | if(paramObj != null) { |
| | | if (paramObj != null) { |
| | | Map param = (Map) paramObj; |
| | | for (Object value : param.entrySet()) { |
| | | Map.Entry entry = (Map.Entry) value; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderLog:list')") |
| | | @PostMapping("/orderLog/out/page") |
| | | @CacheData(tableName = {"man_order_log", "man_order_type"}) |
| | | public R pageOut(@RequestBody Map<String, Object> map) { |
| | | String condition = map.getOrDefault("condition", "").toString(); |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderLog:list')") |
| | | @PostMapping("/orderLog/list") |
| | | @CacheData(tableName = {"man_order_log"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(orderLogService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderLog:list')") |
| | | @GetMapping("/orderLog/{id}") |
| | | @CacheData(tableName = {"man_order_log"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(orderLogService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderSettle:list')") |
| | | @PostMapping("/orderSettle/page") |
| | | @CacheData(tableName = {"man_order_settle"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OrderSettle, BaseParam> pageParam = new PageParam<>(baseParam, OrderSettle.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderSettle:list')") |
| | | @PostMapping("/orderSettle/list") |
| | | @CacheData(tableName = {"man_order_settle"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(orderSettleService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderSettle:list')") |
| | | @GetMapping("/orderSettle/{id}") |
| | | @CacheData(tableName = {"man_order_settle"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(orderSettleService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderType:list')") |
| | | @PostMapping("/orderType/page") |
| | | @CacheData(tableName = {"man_order_type"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OrderType, BaseParam> pageParam = new PageParam<>(baseParam, OrderType.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderType:list')") |
| | | @PostMapping("/orderType/list") |
| | | @CacheData(tableName = {"man_order_type"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(orderTypeService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:orderType:list')") |
| | | @GetMapping("/orderType/{id}") |
| | | @CacheData(tableName = {"man_order_type"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(orderTypeService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @PostMapping("/tag/page") |
| | | @CacheData(tableName = {"man_tag"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Tag, BaseParam> pageParam = new PageParam<>(baseParam, Tag.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @PostMapping("/tag/tree") |
| | | @CacheData(tableName = {"man_tag"}) |
| | | public R tree(@RequestBody Map<String, Object> map) { |
| | | List<Tag> tagList = tagService.list(new LambdaQueryWrapper<Tag>().orderByAsc(Tag::getSort)); |
| | | List<Tag> treeData = Utils.toTreeData(tagList, 0L, Tag::getParentId, Tag::getId, Tag::setChildren); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @PostMapping("/tag/list") |
| | | @CacheData(tableName = {"man_tag"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(tagService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @GetMapping("/tag/{id}") |
| | | @CacheData(tableName = {"man_tag"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(tagService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskDetlFieldLog:list')") |
| | | @PostMapping("/taskDetlFieldLog/page") |
| | | @CacheData(tableName = {"man_task_detl_field_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<TaskDetlFieldLog, BaseParam> pageParam = new PageParam<>(baseParam, TaskDetlFieldLog.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskDetlFieldLog:list')") |
| | | @PostMapping("/taskDetlFieldLog/list") |
| | | @CacheData(tableName = {"man_task_detl_field_log"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(taskDetlFieldLogService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskDetlFieldLog:list')") |
| | | @GetMapping("/taskDetlFieldLog/{id}") |
| | | @CacheData(tableName = {"man_task_detl_field_log"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(taskDetlFieldLogService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskDetlLog:list')") |
| | | @PostMapping("/taskDetlLog/page") |
| | | @CacheData(tableName = {"man_task_detl_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<TaskDetlLog, BaseParam> pageParam = new PageParam<>(baseParam, TaskDetlLog.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskDetlLog:list')") |
| | | @PostMapping("/taskDetlLog/list") |
| | | @CacheData(tableName = {"man_task_detl_log"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(taskDetlLogService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskDetlLog:list')") |
| | | @GetMapping("/taskDetlLog/{id}") |
| | | @CacheData(tableName = {"man_task_detl_log"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(taskDetlLogService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskDetlLog:list')") |
| | | @GetMapping("/taskDetlLog/taskId/{id}") |
| | | @CacheData(tableName = {"man_task_detl_log"}) |
| | | public R getByTaskId(@PathVariable("id") Long id) { |
| | | return R.ok().add(taskDetlLogService.getTaskDetlLogByTaskId(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskLog:list')") |
| | | @PostMapping("/taskLog/page") |
| | | @CacheData(tableName = {"man_task_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<TaskLog, BaseParam> pageParam = new PageParam<>(baseParam, TaskLog.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskLog:list')") |
| | | @PostMapping("/taskLog/list") |
| | | @CacheData(tableName = {"man_task_log"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(taskLogService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:taskLog:list')") |
| | | @GetMapping("/taskLog/{id}") |
| | | @CacheData(tableName = {"man_task_log"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(taskLogService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinLog:list')") |
| | | @PostMapping("/waitPakinLog/page") |
| | | @CacheData(tableName = {"man_wait_pakin_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<WaitPakinLog, BaseParam> pageParam = new PageParam<>(baseParam, WaitPakinLog.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinLog:list')") |
| | | @PostMapping("/waitPakinLog/list") |
| | | @CacheData(tableName = {"man_wait_pakin_log"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(waitPakinLogService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinLog:list')") |
| | | @GetMapping("/waitPakinLog/{id}") |
| | | @CacheData(tableName = {"man_wait_pakin_log"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(waitPakinLogService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:zpalletBarcode:list')") |
| | | @PostMapping("/zpalletBarcode/page") |
| | | @CacheData(tableName = {"man_zpallet_barcode","loc_detl"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ZpalletBarcode, BaseParam> pageParam = new PageParam<>(baseParam, ZpalletBarcode.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:zpalletBarcode:list')") |
| | | @PostMapping("/zpalletBarcode/list") |
| | | @CacheData(tableName = {"man_zpallet_barcode"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(zpalletBarcodeService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:zpalletBarcode:list')") |
| | | @GetMapping("/zpalletBarcode/{id}") |
| | | @CacheData(tableName = {"man_zpallet_barcode"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(zpalletBarcodeService.getById(id)); |
| | | } |
| | |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.asrs.entity.statistics.ViewInOut; |
| | | import com.zy.asrs.wms.asrs.mapper.statistics.ViewInOutMapper; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewInOut:list')") |
| | | @PostMapping("/viewInOut/page") |
| | | @CacheData(tableName = {"view_in_out", "man_task", "man_task_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewInOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewInOut.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewInOut:list')") |
| | | @PostMapping("/viewInOut/export") |
| | | @CacheData(tableName = {"view_in_out", "man_task", "man_task_log"}) |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | QueryWrapper<ViewInOut> wrapper = new QueryWrapper<>(); |
| | | ExcelUtil.build(ExcelUtil.create(viewInOutMapper.selectList(wrapper), ViewInOut.class), response); |
| | |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.asrs.entity.statistics.ViewStayTime; |
| | | import com.zy.asrs.wms.asrs.mapper.statistics.ViewStayTimeMapper; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewStayTime:list')") |
| | | @PostMapping("/viewStayTime/page") |
| | | @CacheData(tableName = {"view_stay_time", "man_loc_detl", "man_loc"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewStayTime, BaseParam> pageParam = new PageParam<>(baseParam, ViewStayTime.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewStayTime:list')") |
| | | @PostMapping("/viewStayTime/export") |
| | | @CacheData(tableName = {"view_stay_time", "man_loc_detl", "man_loc"}) |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | QueryWrapper<ViewStayTime> wrapper = new QueryWrapper<>(); |
| | | ExcelUtil.build(ExcelUtil.create(viewStayTimeMapper.selectList(wrapper), ViewStayTime.class), response); |
| | |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.asrs.entity.statistics.ViewWorkCountIn; |
| | | import com.zy.asrs.wms.asrs.mapper.statistics.ViewWorkCountInMapper; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewWorkCountIn:list')") |
| | | @PostMapping("/viewWorkCountIn/page") |
| | | @CacheData(tableName = {"view_work_count_in", "man_task_log", "man_task_detl_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewWorkCountIn, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkCountIn.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewWorkCountIn:list')") |
| | | @PostMapping("/viewWorkCountIn/export") |
| | | @CacheData(tableName = {"view_work_count_in", "man_task_log", "man_task_detl_log"}) |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | QueryWrapper<ViewWorkCountIn> wrapper = new QueryWrapper<>(); |
| | | ExcelUtil.build(ExcelUtil.create(viewWorkCountInMapper.selectList(wrapper), ViewWorkCountIn.class), response); |
| | |
| | | import com.zy.asrs.wms.asrs.entity.statistics.ViewWorkCountOut; |
| | | import com.zy.asrs.wms.asrs.mapper.statistics.ViewWorkCountInMapper; |
| | | import com.zy.asrs.wms.asrs.mapper.statistics.ViewWorkCountOutMapper; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewWorkCountOut:list')") |
| | | @PostMapping("/viewWorkCountOut/page") |
| | | @CacheData(tableName = {"view_work_count_out", "man_task_log", "man_task_detl_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewWorkCountOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkCountOut.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewWorkCountOut:list')") |
| | | @PostMapping("/viewWorkCountOut/export") |
| | | @CacheData(tableName = {"view_work_count_out", "man_task_log", "man_task_detl_log"}) |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | QueryWrapper<ViewWorkCountOut> wrapper = new QueryWrapper<>(); |
| | | ExcelUtil.build(ExcelUtil.create(viewWorkCountOutMapper.selectList(wrapper), ViewWorkCountOut.class), response); |
| | |
| | | import com.zy.asrs.wms.asrs.entity.statistics.ViewWorkIn; |
| | | import com.zy.asrs.wms.asrs.mapper.statistics.ViewWorkInMapper; |
| | | import com.zy.asrs.wms.asrs.service.TaskDetlFieldLogService; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewWorkIn:list')") |
| | | @PostMapping("/viewWorkIn/page") |
| | | @CacheData(tableName = {"view_work_in", "man_task_log", "man_task_detl_log", "man_task_detl_field_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewWorkIn, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkIn.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewWorkIn:list')") |
| | | @PostMapping("/viewWorkIn/export") |
| | | @CacheData(tableName = {"view_work_in", "man_task_log", "man_task_detl_log"}) |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | QueryWrapper<ViewWorkIn> wrapper = new QueryWrapper<>(); |
| | | ExcelUtil.build(ExcelUtil.create(viewWorkInMapper.selectList(wrapper), ViewWorkIn.class), response); |
| | |
| | | import com.zy.asrs.wms.asrs.entity.statistics.ViewWorkOut; |
| | | import com.zy.asrs.wms.asrs.mapper.statistics.ViewWorkOutMapper; |
| | | import com.zy.asrs.wms.asrs.service.TaskDetlFieldLogService; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewWorkOut:list')") |
| | | @PostMapping("/viewWorkOut/page") |
| | | @CacheData(tableName = {"view_work_out", "man_task_log", "man_task_detl_log", "man_task_detl_field_log"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewWorkOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkOut.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:viewWorkOut:list')") |
| | | @PostMapping("/viewWorkOut/export") |
| | | @CacheData(tableName = {"view_work_out", "man_task_log", "man_task_detl_log"}) |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | QueryWrapper<ViewWorkOut> wrapper = new QueryWrapper<>(); |
| | | ExcelUtil.build(ExcelUtil.create(viewWorkOutMapper.selectList(wrapper), ViewWorkOut.class), response); |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wms.system.entity.Host; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | 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 io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.wms.system.service.UserService; |
| | | import com.zy.asrs.wms.system.service.HostService; |
| | | import com.zy.asrs.common.utils.Synchro; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("sys_cache_statistics") |
| | | public class CacheStatistics 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 ymd; |
| | | |
| | | /** |
| | | * 缓存路径 |
| | | */ |
| | | @ApiModelProperty(value= "缓存路径") |
| | | private String cacheKey; |
| | | |
| | | /** |
| | | * 命中次数 |
| | | */ |
| | | @ApiModelProperty(value= "命中次数") |
| | | private Integer hit; |
| | | |
| | | /** |
| | | * 未命中次数 |
| | | */ |
| | | @ApiModelProperty(value= "未命中次数") |
| | | private Integer miss; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public CacheStatistics() {} |
| | | |
| | | public CacheStatistics(String ymd,String cacheKey,Integer hit,Integer miss,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | | this.ymd = ymd; |
| | | this.cacheKey = cacheKey; |
| | | this.hit = hit; |
| | | this.miss = miss; |
| | | this.hostId = hostId; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | | this.createTime = createTime; |
| | | this.createBy = createBy; |
| | | this.updateTime = updateTime; |
| | | this.updateBy = updateBy; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // CacheStatistics cacheStatistics = new CacheStatistics( |
| | | // null, // 统计时间 |
| | | // null, // 缓存路径 |
| | | // null, // 命中次数 |
| | | // null, // 未命中次数 |
| | | // null, // 所属机构 |
| | | // null, // 状态 |
| | | // null, // 是否删除 |
| | | // null, // 添加时间 |
| | | // null, // 添加人员 |
| | | // null, // 修改时间 |
| | | // null, // 修改人员 |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getHostId$(){ |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | | Host host = service.getById(this.hostId); |
| | | if (!Cools.isEmpty(host)){ |
| | | return String.valueOf(host.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "禁用"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getDeleted$(){ |
| | | if (null == this.deleted){ return null; } |
| | | switch (this.deleted){ |
| | | case 1: |
| | | return "是"; |
| | | case 0: |
| | | return "否"; |
| | | default: |
| | | return String.valueOf(this.deleted); |
| | | } |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public void sync(Object source) { |
| | | Synchro.Copy(source, this); |
| | | } |
| | | } |
| | |
| | | * 字段类型 0: 物料 1: 库存 |
| | | */ |
| | | @ApiModelProperty(value= "字段类型 0: 物料 1: 库存") |
| | | @TableField("`field_type`") |
| | | @TableField("field_type") |
| | | private Integer fieldType; |
| | | |
| | | /** |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.mapper; |
| | | |
| | | import com.zy.asrs.wms.asrs.entity.CacheStatistics; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface CacheStatisticsMapper extends BaseMapper<CacheStatistics> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wms.asrs.entity.CacheStatistics; |
| | | |
| | | public interface CacheStatisticsService extends IService<CacheStatistics> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.zy.asrs.wms.asrs.mapper.CacheStatisticsMapper; |
| | | import com.zy.asrs.wms.asrs.entity.CacheStatistics; |
| | | import com.zy.asrs.wms.asrs.service.CacheStatisticsService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("cacheStatisticsService") |
| | | public class CacheStatisticsServiceImpl extends ServiceImpl<CacheStatisticsMapper, CacheStatistics> implements CacheStatisticsService { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.timer; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wms.asrs.entity.CacheStatistics; |
| | | import com.zy.asrs.wms.asrs.service.CacheStatisticsService; |
| | | import com.zy.asrs.wms.common.constant.RedisConstants; |
| | | import com.zy.asrs.wms.common.domain.CacheHitDto; |
| | | import com.zy.asrs.wms.utils.RedisUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Set; |
| | | |
| | | @Component |
| | | public class CacheStatisticsTimer { |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private CacheStatisticsService cacheStatisticsService; |
| | | |
| | | /** |
| | | * 将缓存统计保存至数据库 |
| | | * 每30分钟扫描一次 |
| | | */ |
| | | @Scheduled(cron = "0 30 * * * ? ") |
| | | public void run() { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String now = format.format(new Date()); |
| | | Set<String> keys = redisUtil.searchRedisKeys(RedisConstants.STATISTICS_CACHE_DATA); |
| | | for (String key : keys) { |
| | | if(key.contains(now)){ |
| | | continue; |
| | | } |
| | | |
| | | try { |
| | | String[] split = key.split(":"); |
| | | String ymd = split[1]; |
| | | String cacheKey = split[2]; |
| | | Object object = redisUtil.get(key); |
| | | if(object == null){ |
| | | continue; |
| | | } |
| | | |
| | | CacheHitDto cacheHitDto = JSON.parseObject(object.toString(), CacheHitDto.class); |
| | | CacheStatistics cacheStatistics = cacheStatisticsService.getOne(new LambdaQueryWrapper<CacheStatistics>().eq(CacheStatistics::getYmd, ymd).eq(CacheStatistics::getCacheKey, cacheKey)); |
| | | if (cacheStatistics == null) { |
| | | cacheStatistics = new CacheStatistics(); |
| | | cacheStatistics.setYmd(ymd); |
| | | cacheStatistics.setCacheKey(cacheKey); |
| | | cacheStatistics.setHit(0); |
| | | cacheStatistics.setMiss(0); |
| | | cacheStatisticsService.save(cacheStatistics); |
| | | } |
| | | |
| | | cacheStatistics.setHit(cacheStatistics.getHit() + cacheHitDto.getHit()); |
| | | cacheStatistics.setMiss(cacheStatistics.getMiss() + cacheHitDto.getMiss()); |
| | | cacheStatisticsService.updateById(cacheStatistics); |
| | | |
| | | redisUtil.del(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.common.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | @Target({ElementType.METHOD}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface CacheData { |
| | | |
| | | String[] tableName() default {}; |
| | | |
| | | boolean cache() default true; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; |
| | | import com.zy.asrs.wms.common.interceptor.DataChangeInterceptor; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import com.zy.asrs.wms.system.entity.UserLogin; |
| | | import net.sf.jsqlparser.expression.Expression; |
| | |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | |
| | | "man_task_sts", |
| | | "man_task_type", |
| | | "man_order_settle", |
| | | "view_man_loc_detl_field" |
| | | "view_man_loc_detl_field", |
| | | "sys_cache_statistics" |
| | | ).contains(tableName); |
| | | } |
| | | |
| | |
| | | return configuration -> configuration.setObjectWrapperFactory(new MybatisMapWrapperFactory()); |
| | | } |
| | | |
| | | @Bean |
| | | public DataChangeInterceptor sqlStatementInterceptor() { |
| | | return new DataChangeInterceptor(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.common.config; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.PropertyAccessor; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.cache.annotation.CachingConfigurerSupport; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.core.*; |
| | | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | | /** |
| | | * Redis配置类 |
| | | * Created by vincent on 2019-12-23 |
| | | */ |
| | | @Configuration |
| | | //@EnableCaching // 开启数据缓存机制 |
| | | public class RedisConfig extends CachingConfigurerSupport { |
| | | |
| | | |
| | | /** |
| | | * RedisTemplate相关配置 |
| | | */ |
| | | @Bean |
| | | public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { |
| | | |
| | | RedisTemplate<String, Object> template = new RedisTemplate<>(); |
| | | // 配置连接工厂 |
| | | template.setConnectionFactory(factory); |
| | | |
| | | //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式) |
| | | Jackson2JsonRedisSerializer<Object> jacksonSerializer = new Jackson2JsonRedisSerializer<>(Object.class); |
| | | |
| | | ObjectMapper om = new ObjectMapper(); |
| | | // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public |
| | | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
| | | // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常 |
| | | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); |
| | | jacksonSerializer.setObjectMapper(om); |
| | | |
| | | // 值采用json序列化 |
| | | template.setValueSerializer(jacksonSerializer); |
| | | //使用StringRedisSerializer来序列化和反序列化redis的key值 |
| | | template.setKeySerializer(new StringRedisSerializer()); |
| | | |
| | | // 设置hash key 和value序列化模式 |
| | | template.setHashKeySerializer(new StringRedisSerializer()); |
| | | template.setHashValueSerializer(jacksonSerializer); |
| | | template.afterPropertiesSet(); |
| | | |
| | | return template; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 对redis字符串类型数据操作 |
| | | */ |
| | | @Bean |
| | | public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForValue(); |
| | | } |
| | | |
| | | /** |
| | | * 对hash类型的数据操作 |
| | | */ |
| | | @Bean |
| | | public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForHash(); |
| | | } |
| | | |
| | | /** |
| | | * 对链表类型的数据操作 |
| | | */ |
| | | @Bean |
| | | public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForList(); |
| | | } |
| | | |
| | | /** |
| | | * 对无序集合类型的数据操作 |
| | | */ |
| | | @Bean |
| | | public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForSet(); |
| | | } |
| | | |
| | | /** |
| | | * 对有序集合类型的数据操作 |
| | | */ |
| | | @Bean |
| | | public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForZSet(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.common.constant; |
| | | |
| | | public class RedisConstants { |
| | | |
| | | public static final String CACHE_DATA = "CACHE_DATA"; |
| | | |
| | | public static final String STATISTICS_CACHE_DATA = "STATISTICS_CACHE_DATA"; |
| | | |
| | | public static String getCacheKey(String prefix, String[] tables, String uri, String md5, Long roleId) { |
| | | String tablesStr = ""; |
| | | if (tables != null) { |
| | | tablesStr = String.join(";", tables); |
| | | } |
| | | |
| | | String roleKey = "roleId:" + roleId.toString(); |
| | | String key = prefix + ":" + roleKey + ":" + tablesStr + ":" + uri + ":" + md5; |
| | | return key; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.common.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CacheHitDto { |
| | | |
| | | private Integer hit; |
| | | |
| | | private Integer miss; |
| | | |
| | | public CacheHitDto(Integer hit, Integer miss) { |
| | | this.hit = hit; |
| | | this.miss = miss; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.common.interceptor; |
| | | |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.wms.common.constant.RedisConstants; |
| | | import com.zy.asrs.wms.utils.RedisUtil; |
| | | import org.apache.ibatis.executor.statement.StatementHandler; |
| | | import org.apache.ibatis.plugin.*; |
| | | import java.sql.Connection; |
| | | import java.util.Properties; |
| | | import java.util.Set; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Intercepts({ |
| | | @Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class}) |
| | | }) |
| | | public class DataChangeInterceptor implements Interceptor { |
| | | |
| | | @Override |
| | | public Object intercept(Invocation invocation) throws Throwable { |
| | | StatementHandler statementHandler = (StatementHandler) invocation.getTarget(); |
| | | String sql = statementHandler.getBoundSql().getSql(); |
| | | if (sql != null) { |
| | | String trimmedSql = sql.trim().toUpperCase(); |
| | | // System.out.println("SQL: " + sql); |
| | | if (trimmedSql.startsWith("INSERT")) { |
| | | clearRedisCache(trimmedSql); |
| | | } else if (trimmedSql.startsWith("UPDATE")) { |
| | | clearRedisCache(trimmedSql); |
| | | } else if (trimmedSql.startsWith("DELETE")) { |
| | | clearRedisCache(trimmedSql); |
| | | } |
| | | } |
| | | |
| | | // 根据需要进行SQL解析 |
| | | return invocation.proceed(); |
| | | } |
| | | |
| | | @Override |
| | | public Object plugin(Object target) { |
| | | return Plugin.wrap(target, this); |
| | | } |
| | | |
| | | @Override |
| | | public void setProperties(Properties properties) {} |
| | | |
| | | public static String extractTableName(String sql) { |
| | | if (sql == null || sql.trim().isEmpty()) { |
| | | return "无效的SQL语句"; |
| | | } |
| | | |
| | | String trimmedSql = sql.trim().toUpperCase(); |
| | | String tableName = ""; |
| | | |
| | | // 定义正则表达式 |
| | | Pattern insertPattern = Pattern.compile("INSERT INTO (\\S+)", Pattern.CASE_INSENSITIVE); |
| | | Pattern updatePattern = Pattern.compile("UPDATE (\\S+)", Pattern.CASE_INSENSITIVE); |
| | | Pattern deletePattern = Pattern.compile("DELETE FROM (\\S+)", Pattern.CASE_INSENSITIVE); |
| | | |
| | | Matcher matcher; |
| | | |
| | | // 检查INSERT语句 |
| | | matcher = insertPattern.matcher(trimmedSql); |
| | | if (matcher.find()) { |
| | | tableName = matcher.group(1); |
| | | } else { |
| | | // 检查UPDATE语句 |
| | | matcher = updatePattern.matcher(trimmedSql); |
| | | if (matcher.find()) { |
| | | tableName = matcher.group(1); |
| | | } else { |
| | | // 检查DELETE语句 |
| | | matcher = deletePattern.matcher(trimmedSql); |
| | | if (matcher.find()) { |
| | | tableName = matcher.group(1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (tableName.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | return tableName; |
| | | } |
| | | |
| | | private void clearRedisCache(String sql) { |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | if (redisUtil == null) { |
| | | return; |
| | | } |
| | | |
| | | String tableName = extractTableName(sql); |
| | | if (tableName == null) { |
| | | return; |
| | | } |
| | | |
| | | tableName = tableName.toLowerCase(); |
| | | |
| | | Set<String> keys = redisUtil.searchRedisKeys(tableName); |
| | | for (String key : keys) { |
| | | if (!key.startsWith(RedisConstants.CACHE_DATA)) { |
| | | continue; |
| | | } |
| | | redisUtil.del(key); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.common.security; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.constant.Constants; |
| | | import com.zy.asrs.wms.common.constant.RedisConstants; |
| | | import com.zy.asrs.wms.common.domain.CacheHitDto; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import com.zy.asrs.wms.system.entity.UserLogin; |
| | | import com.zy.asrs.wms.system.service.UserService; |
| | | import com.zy.asrs.wms.utils.EncryptUtils; |
| | | import com.zy.asrs.wms.utils.HttpUtils; |
| | | import com.zy.asrs.wms.utils.RedisUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.filter.OncePerRequestFilter; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.HandlerExecutionChain; |
| | | import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; |
| | | |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Method; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | public class CacheFilter extends OncePerRequestFilter { |
| | | |
| | | @Value("${system.enableCache}") |
| | | private Boolean enableCache; |
| | | @Autowired |
| | | private RequestMappingHandlerMapping handlerMapping; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Override |
| | | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { |
| | | // 获取当前请求的处理器方法 |
| | | HandlerExecutionChain handlerChain; |
| | | try { |
| | | handlerChain = handlerMapping.getHandler(request); |
| | | if (handlerChain != null) { |
| | | Object handler = handlerChain.getHandler(); |
| | | if (handler instanceof HandlerMethod) { |
| | | HandlerMethod handlerMethod = (HandlerMethod) handler; |
| | | Method method = handlerMethod.getMethod(); |
| | | if (method.isAnnotationPresent(CacheData.class)) { |
| | | CacheData cacheData = method.getAnnotation(CacheData.class); |
| | | if (enableCache && cacheData.cache()) { |
| | | // 创建一个包装请求体的 HttpServletRequestWrapper |
| | | CachedBodyHttpServletRequest cachedBodyHttpServletRequest = new CachedBodyHttpServletRequest(request); |
| | | // 创建一个包装响应体的 HttpServletResponseWrapper |
| | | CachedBodyHttpServletResponse cachedBodyHttpServletResponse = new CachedBodyHttpServletResponse(response); |
| | | String requestParamCode = getRequestParamCode(cachedBodyHttpServletRequest); |
| | | |
| | | User user = getUser(); |
| | | ArrayList<Long> roleIds = new ArrayList<>(); |
| | | if (user == null) { |
| | | roleIds.add(0L); |
| | | }else { |
| | | roleIds.addAll(Arrays.asList(user.getUserRoleIds())); |
| | | } |
| | | |
| | | Object object = null; |
| | | for (Long roleId : roleIds) { |
| | | Object obj = redisUtil.get(RedisConstants.getCacheKey(RedisConstants.CACHE_DATA, cacheData.tableName(), request.getRequestURI(), requestParamCode, roleId)); |
| | | if(obj != null){ |
| | | object = obj; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (object == null) { |
| | | chain.doFilter(cachedBodyHttpServletRequest, cachedBodyHttpServletResponse); |
| | | |
| | | // 获取响应内容 |
| | | byte[] responseContent = cachedBodyHttpServletResponse.getContent(); |
| | | String responseBody = new String(responseContent); |
| | | |
| | | JSONObject result = JSON.parseObject(responseBody); |
| | | if (Integer.parseInt(result.get("code").toString()) == 200) { |
| | | for (Long roleId : roleIds) { |
| | | redisUtil.set(RedisConstants.getCacheKey(RedisConstants.CACHE_DATA, cacheData.tableName(), request.getRequestURI(), requestParamCode, roleId), responseBody, 60 * 60 * 24); |
| | | } |
| | | } |
| | | |
| | | // 将响应内容写回原始的 HttpServletResponse |
| | | response.getOutputStream().write(responseContent); |
| | | response.setContentLength(responseContent.length); |
| | | }else { |
| | | // 将响应内容写回原始的 HttpServletResponse |
| | | byte[] responseContent = object.toString().getBytes(); |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | response.getOutputStream().write(responseContent); |
| | | response.setContentLength(responseContent.length); |
| | | } |
| | | |
| | | statisticsCacheHitCount(object, cacheData.tableName(), request.getRequestURI()); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | chain.doFilter(request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | HttpUtils.responseError(response, Constants.BAD_CREDENTIALS_CODE, Constants.BAD_CREDENTIALS_MSG, |
| | | e.toString()); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | private String getRequestParamCode(CachedBodyHttpServletRequest request) throws IOException { |
| | | // 获取请求方法 |
| | | String requestMethod = request.getMethod(); |
| | | String md5 = ""; |
| | | // 检查请求方法并处理 |
| | | if ("POST".equalsIgnoreCase(requestMethod)) { |
| | | // 检查是否为 form-data 类型 |
| | | String contentType = request.getContentType(); |
| | | if (contentType != null && (contentType.startsWith("application/x-www-form-urlencoded") || contentType.startsWith("multipart/form-data"))) { |
| | | // 处理 form-data 参数 |
| | | Map<String, String[]> parameterMap = request.getParameterMap(); |
| | | String jsonString = JSON.toJSONString(parameterMap); |
| | | md5 = EncryptUtils.md5(jsonString); |
| | | } else { |
| | | // 读取请求体中的 JSON 数据 |
| | | String jsonRequestBody = request.getReader().lines().collect(Collectors.joining(System.lineSeparator())); |
| | | md5 = EncryptUtils.md5(jsonRequestBody); |
| | | } |
| | | } else if ("GET".equalsIgnoreCase(requestMethod)) { |
| | | Map<String, String[]> map = request.getParameterMap(); |
| | | String jsonString = JSON.toJSONString(map); |
| | | md5 = EncryptUtils.md5(jsonString); |
| | | } |
| | | return md5; |
| | | } |
| | | |
| | | private User getUser() { |
| | | try { |
| | | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
| | | if (authentication != null) { |
| | | Object object = authentication.getPrincipal(); |
| | | if (object instanceof User) { |
| | | return (User) object; |
| | | } |
| | | if(object instanceof UserLogin) { |
| | | UserLogin userLogin = (UserLogin) object; |
| | | User user = userService.superGetById(userLogin.getUserId()); |
| | | return user; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void statisticsCacheHitCount(Object object, String[] tableNames, String requestURI) { |
| | | statisticsCacheSaveRedis(object, requestURI); |
| | | for (String tableName : tableNames) { |
| | | statisticsCacheSaveRedis(object, tableName); |
| | | } |
| | | } |
| | | |
| | | private void statisticsCacheSaveRedis(Object object, String key) { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String now = format.format(new Date()); |
| | | |
| | | String urlKey = RedisConstants.STATISTICS_CACHE_DATA + ":" + now + ":" + key; |
| | | Object urlCache = redisUtil.get(urlKey); |
| | | CacheHitDto cacheHitDto = new CacheHitDto(0, 0); |
| | | if (urlCache != null) { |
| | | cacheHitDto = JSON.parseObject(urlCache.toString(), CacheHitDto.class); |
| | | } |
| | | |
| | | if (object == null) { |
| | | cacheHitDto.setMiss(cacheHitDto.getMiss() + 1); |
| | | }else { |
| | | cacheHitDto.setHit(cacheHitDto.getHit() + 1); |
| | | } |
| | | |
| | | redisUtil.set(urlKey, JSON.toJSONString(cacheHitDto)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.common.security; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.zy.asrs.wms.utils.EncryptUtils; |
| | | import com.zy.asrs.wms.utils.WebkitParseUtils; |
| | | import javax.servlet.ReadListener; |
| | | import javax.servlet.ServletInputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletRequestWrapper; |
| | | import java.io.*; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class CachedBodyHttpServletRequest extends HttpServletRequestWrapper { |
| | | private final byte[] cachedBody; |
| | | private final Map<String, String[]> parameterMap; |
| | | |
| | | public CachedBodyHttpServletRequest(HttpServletRequest request) throws IOException { |
| | | super(request); |
| | | String requestMethod = request.getMethod(); |
| | | if ("GET".equalsIgnoreCase(requestMethod)) { |
| | | Map<String, String[]> map = request.getParameterMap(); |
| | | String jsonString = JSON.toJSONString(map); |
| | | this.cachedBody = jsonString.getBytes(); |
| | | this.parameterMap = map; |
| | | }else { |
| | | // 读取请求体并缓存 |
| | | InputStream inputStream = request.getInputStream(); |
| | | // 方法来读取所有字节 |
| | | this.cachedBody = readBytesFromInputStream(inputStream); |
| | | |
| | | this.parameterMap = new HashMap<>(); |
| | | // 读取并解析表单数据 |
| | | parseRequestParameters(); |
| | | } |
| | | } |
| | | |
| | | private byte[] readBytesFromInputStream(InputStream inputStream) throws IOException { |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead; |
| | | while ((bytesRead = inputStream.read(buffer)) != -1) { |
| | | byteArrayOutputStream.write(buffer, 0, bytesRead); |
| | | } |
| | | return byteArrayOutputStream.toByteArray(); |
| | | } |
| | | |
| | | @Override |
| | | public ServletInputStream getInputStream() { |
| | | return new CachedBodyServletInputStream(cachedBody); |
| | | } |
| | | |
| | | @Override |
| | | public BufferedReader getReader() { |
| | | return new BufferedReader(new InputStreamReader(getInputStream())); |
| | | } |
| | | |
| | | @Override |
| | | public String getParameter(String name) { |
| | | String[] values = parameterMap.get(name); |
| | | return (values != null && values.length > 0) ? values[0] : null; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String[]> getParameterMap() { |
| | | return parameterMap; |
| | | } |
| | | |
| | | @Override |
| | | public String[] getParameterValues(String name) { |
| | | return parameterMap.get(name); |
| | | } |
| | | |
| | | private static class CachedBodyServletInputStream extends ServletInputStream { |
| | | private final ByteArrayInputStream inputStream; |
| | | |
| | | public CachedBodyServletInputStream(byte[] cachedBody) { |
| | | this.inputStream = new ByteArrayInputStream(cachedBody); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isFinished() { |
| | | return inputStream.available() == 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isReady() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public void setReadListener(ReadListener listener) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public int read() { |
| | | return inputStream.read(); |
| | | } |
| | | } |
| | | |
| | | private void parseRequestParameters() { |
| | | String string = new String(cachedBody); |
| | | HashMap<String, Object> formData = WebkitParseUtils.getFormData(string); |
| | | for (Map.Entry<String, Object> entry : formData.entrySet()) { |
| | | parameterMap.put(entry.getKey(), new String[]{entry.getValue().toString()}); |
| | | } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.zy.asrs.wms.common.security; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.WriteListener; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpServletResponseWrapper; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.PrintWriter; |
| | | |
| | | public class CachedBodyHttpServletResponse extends HttpServletResponseWrapper { |
| | | private final ByteArrayOutputStream cachedBody; |
| | | private final PrintWriter writer; |
| | | |
| | | public CachedBodyHttpServletResponse(HttpServletResponse response) { |
| | | super(response); |
| | | this.cachedBody = new ByteArrayOutputStream(); |
| | | this.writer = new PrintWriter(cachedBody); |
| | | } |
| | | |
| | | @Override |
| | | public PrintWriter getWriter() { |
| | | return writer; |
| | | } |
| | | |
| | | @Override |
| | | public ServletOutputStream getOutputStream() { |
| | | return new ServletOutputStream() { |
| | | @Override |
| | | public void write(int b) { |
| | | cachedBody.write(b); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isReady() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public void setWriteListener(WriteListener writeListener) { |
| | | |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public byte[] getContent() { |
| | | writer.flush(); |
| | | return cachedBody.toByteArray(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.security.web.AuthenticationEntryPoint; |
| | | import org.springframework.security.web.access.AccessDeniedHandler; |
| | | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| | | import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint; |
| | | @Resource |
| | | private JwtAuthenticationFilter jwtAuthenticationFilter; |
| | | @Resource |
| | | private CacheFilter cacheFilter; |
| | | |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | |
| | | .accessDeniedHandler(jwtAccessDeniedHandler) |
| | | .authenticationEntryPoint(jwtAuthenticationEntryPoint) |
| | | .and() |
| | | .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); |
| | | .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) |
| | | .addFilterBefore(cacheFilter, BasicAuthenticationFilter.class); |
| | | } |
| | | |
| | | @Bean |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:dept:list')") |
| | | @PostMapping("/dept/page") |
| | | @CacheData(tableName = {"sys_dept"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Dept, BaseParam> pageParam = new PageParam<>(baseParam, Dept.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:dept:list')") |
| | | @PostMapping("/dept/list") |
| | | @CacheData(tableName = {"sys_dept"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(deptService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:dept:list')") |
| | | @PostMapping("/dept/tree") |
| | | @CacheData(tableName = {"sys_dept"}) |
| | | public R tree(@RequestBody Map<String, Object> map) { |
| | | // PageParam<Dept, BaseParam> param = new PageParam<>(buildParam(map, BaseParam.class), Dept.class); |
| | | // QueryWrapper<Dept> wrapper = param.buildWrapper(true, queryWrapper -> queryWrapper.orderByAsc("sort")); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:dept:list')") |
| | | @GetMapping("/dept/{id}") |
| | | @CacheData(tableName = {"sys_dept"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(deptService.getById(id)); |
| | | } |
| | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:host:list')") |
| | | @PostMapping("/host/page") |
| | | @CacheData(tableName = {"sys_host"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Host, BaseParam> pageParam = new PageParam<>(baseParam, Host.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:host:list')") |
| | | @PostMapping("/host/list") |
| | | @CacheData(tableName = {"sys_host"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(hostService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:host:list')") |
| | | @GetMapping("/host/{id}") |
| | | @CacheData(tableName = {"sys_host"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(hostService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:language:list')") |
| | | @PostMapping("/language/page") |
| | | @CacheData(tableName = {"sys_language"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Language, BaseParam> pageParam = new PageParam<>(baseParam, Language.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:language:list')") |
| | | @PostMapping("/language/list") |
| | | @CacheData(tableName = {"sys_language"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(languageService.list()); |
| | | } |
| | | |
| | | @PostMapping("/language/json") |
| | | @CacheData(tableName = {"sys_language"}) |
| | | public R json(@RequestBody Map<String, Object> map) { |
| | | LambdaQueryWrapper<Language> wrapper = new LambdaQueryWrapper<>(); |
| | | if(map.containsKey("locale")){ |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:language:list')") |
| | | @GetMapping("/language/{id}") |
| | | @CacheData(tableName = {"sys_language"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(languageService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:menu:list')") |
| | | @PostMapping("/menu/page") |
| | | @CacheData(tableName = {"sys_menu"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Menu, BaseParam> pageParam = new PageParam<>(baseParam, Menu.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:menu:list')") |
| | | @PostMapping("/menu/list") |
| | | @CacheData(tableName = {"sys_menu"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(menuService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:menu:list')") |
| | | @PostMapping("/menu/tree") |
| | | @CacheData(tableName = {"sys_menu"}) |
| | | public R tree(@RequestBody Map<String, Object> map) { |
| | | // PageParam<Menu, BaseParam> param = new PageParam<>(buildParam(map, BaseParam.class), Menu.class); |
| | | // QueryWrapper<Menu> wrapper = param.buildWrapper(true, queryWrapper -> queryWrapper.orderByAsc("sort")); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:menu:list')") |
| | | @GetMapping("/menu/get/route") |
| | | @CacheData(tableName = {"sys_menu"}) |
| | | public R getByRoute(@RequestParam("route") String route) { |
| | | Menu menu = menuService.getOne(new LambdaQueryWrapper<Menu>().eq(Menu::getRoute, route).eq(Menu::getStatus, 1).last("limit 1")); |
| | | if (menu == null) { |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:menu:list')") |
| | | @GetMapping("/menu/{id}") |
| | | @CacheData(tableName = {"sys_menu"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(menuService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:operationRecord:list')") |
| | | @PostMapping("/operationRecord/page") |
| | | @CacheData(tableName = {"sys_operation_record"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OperationRecord, BaseParam> pageParam = new PageParam<>(baseParam, OperationRecord.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:operationRecord:list')") |
| | | @PostMapping("/operationRecord/list") |
| | | @CacheData(tableName = {"sys_operation_record"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(operationRecordService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:operationRecord:list')") |
| | | @GetMapping("/operationRecord/{id}") |
| | | @CacheData(tableName = {"sys_operation_record"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(operationRecordService.getById(id)); |
| | | } |
| | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:role:list')") |
| | | @PostMapping("/role/page") |
| | | @CacheData(tableName = {"sys_role"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Role, BaseParam> pageParam = new PageParam<>(baseParam, Role.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:role:list')") |
| | | @PostMapping("/role/list") |
| | | @CacheData(tableName = {"sys_role"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(roleService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:role:list')") |
| | | @GetMapping("/role/{id}") |
| | | @CacheData(tableName = {"sys_role"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(roleService.getById(id)); |
| | | } |
| | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:user:list')") |
| | | @PostMapping("/user/page") |
| | | @CacheData(tableName = {"sys_user"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<User, BaseParam> pageParam = new PageParam<>(baseParam, User.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:user:list')") |
| | | @PostMapping("/user/page1") |
| | | @CacheData(tableName = {"sys_user"}) |
| | | public R page1(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<User, BaseParam> pageParam = new PageParam<>(baseParam, User.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:user:list')") |
| | | @PostMapping("/user/list") |
| | | @CacheData(tableName = {"sys_user"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(userService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:user:list')") |
| | | @GetMapping("/user/{id}") |
| | | @CacheData(tableName = {"sys_user"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(userService.getById(id)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.CacheData; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:userLogin:list')") |
| | | @PostMapping("/userLogin/page") |
| | | @CacheData(tableName = {"sys_user_login"}) |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<UserLogin, BaseParam> pageParam = new PageParam<>(baseParam, UserLogin.class); |
| | |
| | | |
| | | @PreAuthorize("hasAuthority('system:userLogin:list')") |
| | | @PostMapping("/userLogin/list") |
| | | @CacheData(tableName = {"sys_user_login"}) |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(userLoginService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:userLogin:list')") |
| | | @GetMapping("/userLogin/{id}") |
| | | @CacheData(tableName = {"sys_user_login"}) |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(userLoginService.getById(id)); |
| | | } |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_platform_detl_log"; |
| | | generator.tableName="集货区域库存历史"; |
| | | generator.table="sys_cache_statistics"; |
| | | generator.tableName="系统缓存统计"; |
| | | generator.rootPackagePath="com.zy.asrs.wms"; |
| | | generator.packagePath="com.zy.asrs.wms.asrs"; |
| | | |
New file |
| | |
| | | package com.zy.asrs.wms.utils; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.MessageDigest; |
| | | |
| | | public class EncryptUtils { |
| | | |
| | | public static String md5(String plainString) { |
| | | String cipherString = null; |
| | | try { |
| | | // 获取实例 |
| | | MessageDigest messageDigest = MessageDigest.getInstance("MD5"); |
| | | // 计算摘要 |
| | | byte[] cipherBytes = messageDigest.digest(plainString.getBytes(StandardCharsets.UTF_8)); |
| | | // 输出为16进制字符串 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (byte b : cipherBytes) { |
| | | sb.append(String.format("%02x", b)); |
| | | } |
| | | cipherString = sb.toString(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return cipherString; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.utils; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * redisTemplate封装 |
| | | * |
| | | */ |
| | | @Component |
| | | public class RedisUtil { |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | public RedisTemplate getRedisTemplate() { |
| | | return redisTemplate; |
| | | } |
| | | |
| | | public RedisUtil(RedisTemplate redisTemplate) { |
| | | this.redisTemplate = redisTemplate; |
| | | } |
| | | |
| | | /** |
| | | * 指定缓存失效时间 |
| | | * |
| | | * @param key 键 |
| | | * @param time 时间(秒) |
| | | * @return |
| | | */ |
| | | public boolean expire(String key, long time) { |
| | | try { |
| | | if (time > 0) { |
| | | redisTemplate.expire(key, time, TimeUnit.SECONDS); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据key 获取过期时间 |
| | | * |
| | | * @param key 键 不能为null |
| | | * @return 时间(秒) 返回0代表为永久有效 |
| | | */ |
| | | public long getExpire(String key) { |
| | | return redisTemplate.getExpire(key, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | /** |
| | | * 判断key是否存在 |
| | | * |
| | | * @param key 键 |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean hasKey(String key) { |
| | | try { |
| | | return redisTemplate.hasKey(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除缓存 |
| | | * |
| | | * @param key 可以传一个值 或多个 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public void del(String... key) { |
| | | if (key != null && key.length > 0) { |
| | | if (key.length == 1) { |
| | | redisTemplate.delete(key[0]); |
| | | } else { |
| | | redisTemplate.delete(CollectionUtils.arrayToList(key)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //============================ String ============================= |
| | | |
| | | /** |
| | | * 普通缓存获取 |
| | | * |
| | | * @param key 键 |
| | | * @return 值 |
| | | */ |
| | | public Object get(String key) { |
| | | return key == null ? null : redisTemplate.opsForValue().get(key); |
| | | } |
| | | |
| | | /** |
| | | * 获取全部数据 |
| | | * @return |
| | | */ |
| | | public HashMap<Object, Object> getRedis() { |
| | | Set<String> keys = redisTemplate.keys("*"); |
| | | HashMap<Object, Object> map = new HashMap<>(); |
| | | for (String key : keys) { |
| | | Object value = redisTemplate.opsForValue().get(key); |
| | | map.put(key, value); |
| | | } |
| | | |
| | | return map;//返回全部数据集合 |
| | | } |
| | | |
| | | /** |
| | | * 模糊查询数据 |
| | | */ |
| | | public HashMap<Object, Object> searchRedis(String data) { |
| | | Set<String> keys = redisTemplate.keys("*" + data + "*"); |
| | | HashMap<Object, Object> map = new HashMap<>(); |
| | | for (String key : keys) { |
| | | Object value = redisTemplate.opsForValue().get(key); |
| | | map.put(key, value); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 模糊查询数据 |
| | | */ |
| | | public Set<String> searchRedisKeys(String data) { |
| | | Set<String> keys = redisTemplate.keys("*" + data + "*"); |
| | | return keys; |
| | | } |
| | | |
| | | /** |
| | | * 普通缓存放入 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return true成功 false失败 |
| | | */ |
| | | public boolean set(String key, Object value) { |
| | | try { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | long start = System.currentTimeMillis(); |
| | | while (System.currentTimeMillis() - start < 10000) {//有效期10s |
| | | Object o = redisTemplate.opsForValue().get(key); |
| | | if (o == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (o.equals(value)) { |
| | | break; |
| | | } |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 普通缓存放入-异步 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return true成功 false失败 |
| | | */ |
| | | public boolean setAsync(String key, Object value) { |
| | | try { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 普通缓存放入并设置时间 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 |
| | | * @return true成功 false 失败 |
| | | */ |
| | | public boolean set(String key, Object value, long time) { |
| | | try { |
| | | if (time > 0) { |
| | | redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); |
| | | } else { |
| | | set(key, value); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 递增 |
| | | * |
| | | * @param key 键 |
| | | * @param delta 要增加几(大于0) |
| | | * @return |
| | | */ |
| | | public long incr(String key, long delta) { |
| | | if (delta < 0) { |
| | | throw new RuntimeException("递增因子必须大于0"); |
| | | } |
| | | return redisTemplate.opsForValue().increment(key, delta); |
| | | } |
| | | |
| | | /** |
| | | * 递减 |
| | | * |
| | | * @param key 键 |
| | | * @param delta 要减少几(小于0) |
| | | * @return |
| | | */ |
| | | public long decr(String key, long delta) { |
| | | if (delta < 0) { |
| | | throw new RuntimeException("递减因子必须大于0"); |
| | | } |
| | | return redisTemplate.opsForValue().increment(key, -delta); |
| | | } |
| | | |
| | | //================================ Hash ================================= |
| | | |
| | | /** |
| | | * HashGet |
| | | * |
| | | * @param key 键 不能为null |
| | | * @param item 项 不能为null |
| | | * @return 值 |
| | | */ |
| | | public Object hget(String key, String item) { |
| | | return redisTemplate.opsForHash().get(key, item); |
| | | } |
| | | |
| | | /** |
| | | * 获取hashKey对应的所有键值 |
| | | * |
| | | * @param key 键 |
| | | * @return 对应的多个键值 |
| | | */ |
| | | public Map<Object, Object> hmget(String key) { |
| | | return redisTemplate.opsForHash().entries(key); |
| | | } |
| | | |
| | | /** |
| | | * HashSet |
| | | * |
| | | * @param key 键 |
| | | * @param map 对应多个键值 |
| | | * @return true 成功 false 失败 |
| | | */ |
| | | public boolean hmset(String key, Map<String, Object> map) { |
| | | try { |
| | | redisTemplate.opsForHash().putAll(key, map); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * HashSet 并设置时间 |
| | | * |
| | | * @param key 键 |
| | | * @param map 对应多个键值 |
| | | * @param time 时间(秒) |
| | | * @return true成功 false失败 |
| | | */ |
| | | public boolean hmset(String key, Map<String, Object> map, long time) { |
| | | try { |
| | | redisTemplate.opsForHash().putAll(key, map); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 向一张hash表中放入数据,如果不存在将创建 |
| | | * |
| | | * @param key 键 |
| | | * @param item 项 |
| | | * @param value 值 |
| | | * @return true 成功 false失败 |
| | | */ |
| | | public boolean hset(String key, String item, Object value) { |
| | | try { |
| | | redisTemplate.opsForHash().put(key, item, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 向一张hash表中放入数据,如果不存在将创建 |
| | | * |
| | | * @param key 键 |
| | | * @param item 项 |
| | | * @param value 值 |
| | | * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 |
| | | * @return true 成功 false失败 |
| | | */ |
| | | public boolean hset(String key, String item, Object value, long time) { |
| | | try { |
| | | redisTemplate.opsForHash().put(key, item, value); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除hash表中的值 |
| | | * |
| | | * @param key 键 不能为null |
| | | * @param item 项 可以使多个 不能为null |
| | | */ |
| | | public void hdel(String key, Object... item) { |
| | | redisTemplate.opsForHash().delete(key, item); |
| | | } |
| | | |
| | | /** |
| | | * 判断hash表中是否有该项的值 |
| | | * |
| | | * @param key 键 不能为null |
| | | * @param item 项 不能为null |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean hHasKey(String key, String item) { |
| | | return redisTemplate.opsForHash().hasKey(key, item); |
| | | } |
| | | |
| | | /** |
| | | * hash递增 如果不存在,就会创建一个 并把新增后的值返回 |
| | | * |
| | | * @param key 键 |
| | | * @param item 项 |
| | | * @param by 要增加几(大于0) |
| | | * @return |
| | | */ |
| | | public double hincr(String key, String item, double by) { |
| | | return redisTemplate.opsForHash().increment(key, item, by); |
| | | } |
| | | |
| | | /** |
| | | * hash递减 |
| | | * |
| | | * @param key 键 |
| | | * @param item 项 |
| | | * @param by 要减少记(小于0) |
| | | * @return |
| | | */ |
| | | public double hdecr(String key, String item, double by) { |
| | | return redisTemplate.opsForHash().increment(key, item, -by); |
| | | } |
| | | |
| | | //============================ set ============================= |
| | | |
| | | /** |
| | | * 根据key获取Set中的所有值 |
| | | * |
| | | * @param key 键 |
| | | * @return |
| | | */ |
| | | public Set<Object> sGet(String key) { |
| | | try { |
| | | return redisTemplate.opsForSet().members(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据value从一个set中查询,是否存在 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean sHasKey(String key, Object value) { |
| | | try { |
| | | return redisTemplate.opsForSet().isMember(key, value); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将数据放入set缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param values 值 可以是多个 |
| | | * @return 成功个数 |
| | | */ |
| | | public long sSet(String key, Object... values) { |
| | | try { |
| | | return redisTemplate.opsForSet().add(key, values); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将set数据放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param time 时间(秒) |
| | | * @param values 值 可以是多个 |
| | | * @return 成功个数 |
| | | */ |
| | | public long sSetAndTime(String key, long time, Object... values) { |
| | | try { |
| | | Long count = redisTemplate.opsForSet().add(key, values); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return count; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取set缓存的长度 |
| | | * |
| | | * @param key 键 |
| | | * @return |
| | | */ |
| | | public long sGetSetSize(String key) { |
| | | try { |
| | | return redisTemplate.opsForSet().size(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 移除值为value的 |
| | | * |
| | | * @param key 键 |
| | | * @param values 值 可以是多个 |
| | | * @return 移除的个数 |
| | | */ |
| | | public long setRemove(String key, Object... values) { |
| | | try { |
| | | Long count = redisTemplate.opsForSet().remove(key, values); |
| | | return count; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | //===============================list================================= |
| | | |
| | | /** |
| | | * 获取list缓存的内容 |
| | | * |
| | | * @param key 键 |
| | | * @param start 开始 |
| | | * @param end 结束 0 到 -1代表所有值 |
| | | * @return |
| | | */ |
| | | public List<Object> lGet(String key, long start, long end) { |
| | | try { |
| | | return redisTemplate.opsForList().range(key, start, end); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取list缓存的长度 |
| | | * |
| | | * @param key 键 |
| | | * @return |
| | | */ |
| | | public long lGetListSize(String key) { |
| | | try { |
| | | return redisTemplate.opsForList().size(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通过索引 获取list中的值 |
| | | * |
| | | * @param key 键 |
| | | * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 |
| | | * @return |
| | | */ |
| | | public Object lGetIndex(String key, long index) { |
| | | try { |
| | | return redisTemplate.opsForList().index(key, index); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将list放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return |
| | | */ |
| | | public boolean lSet(String key, Object value) { |
| | | try { |
| | | redisTemplate.opsForList().rightPush(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将list放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @param time 时间(秒) |
| | | * @return |
| | | */ |
| | | public boolean lSet(String key, Object value, long time) { |
| | | try { |
| | | redisTemplate.opsForList().rightPush(key, value); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将list放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return |
| | | */ |
| | | public boolean lSet(String key, List<Object> value) { |
| | | try { |
| | | redisTemplate.opsForList().rightPushAll(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将list放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @param time 时间(秒) |
| | | * @return |
| | | */ |
| | | public boolean lSet(String key, List<Object> value, long time) { |
| | | try { |
| | | redisTemplate.opsForList().rightPushAll(key, value); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据索引修改list中的某条数据 |
| | | * |
| | | * @param key 键 |
| | | * @param index 索引 |
| | | * @param value 值 |
| | | * @return |
| | | */ |
| | | public boolean lUpdateIndex(String key, long index, Object value) { |
| | | try { |
| | | redisTemplate.opsForList().set(key, index, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 移除N个值为value |
| | | * |
| | | * @param key 键 |
| | | * @param count 移除多少个 |
| | | * @param value 值 |
| | | * @return 移除的个数 |
| | | */ |
| | | public long lRemove(String key, long count, Object value) { |
| | | try { |
| | | Long remove = redisTemplate.opsForList().remove(key, count, value); |
| | | return remove; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 模糊查询获取key值 |
| | | * |
| | | * @param pattern |
| | | * @return |
| | | */ |
| | | public Set keys(String pattern) { |
| | | return redisTemplate.keys(pattern); |
| | | } |
| | | |
| | | /** |
| | | * 使用Redis的消息队列 |
| | | * |
| | | * @param channel |
| | | * @param message 消息内容 |
| | | */ |
| | | public void convertAndSend(String channel, Object message) { |
| | | redisTemplate.convertAndSend(channel, message); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | sb.append(c); |
| | | } |
| | | |
| | | return sb.toString(); |
| | | return "`" + sb.toString() + "`"; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.zy.asrs.wms.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class WebkitParseUtils { |
| | | |
| | | private static final Pattern BOUNDARY_PATTERN = Pattern.compile("--WebKitFormBoundary([A-Za-z0-9+/]+)"); |
| | | private static final Pattern NAME_PATTERN = Pattern.compile("Content-Disposition: form-data; name=\"([^\"]+)\""); |
| | | private static final Pattern VALUE_PATTERN = Pattern.compile("Content-Disposition: form-data; name=\"[^\"]+\"\\s*\\n\\s*\\n\\s*([^\\n]+)"); |
| | | |
| | | // 解析WebKitFormBoundary字符串数据 |
| | | public static String parseBoundary(String input) { |
| | | Matcher matcher = BOUNDARY_PATTERN.matcher(input); |
| | | if (matcher.find()) { |
| | | return matcher.group(1); // 返回捕获的字符串 |
| | | } |
| | | return null; // 如果没有匹配,则返回null |
| | | } |
| | | |
| | | // 解析所有name的值 |
| | | public static List<String> parseNames(String input) { |
| | | List<String> names = new ArrayList<>(); |
| | | Matcher matcher = NAME_PATTERN.matcher(input); |
| | | while (matcher.find()) { |
| | | names.add(matcher.group(1)); // 添加捕获到的name值到列表 |
| | | } |
| | | return names; // 返回所有匹配到的name值 |
| | | } |
| | | |
| | | // 解析所有值部分 |
| | | public static List<String> parseValues(String input) { |
| | | List<String> values = new ArrayList<>(); |
| | | Matcher matcher = VALUE_PATTERN.matcher(input); |
| | | while (matcher.find()) { |
| | | String trim = matcher.group(1).trim(); |
| | | Matcher matcher2 = BOUNDARY_PATTERN.matcher(trim); |
| | | if(matcher2.find()) { |
| | | trim = ""; |
| | | } |
| | | values.add(trim); // 添加捕获到的值到列表,并去掉前后的空白 |
| | | } |
| | | return values; // 返回所有匹配到的值 |
| | | } |
| | | |
| | | public static HashMap<String, Object> getFormData(String input) { |
| | | // // 解析WebKitFormBoundary字符串 |
| | | // String boundary = parseBoundary(input); |
| | | // System.out.println("解析出的WebKitFormBoundary字符串是: " + boundary); |
| | | |
| | | // 解析所有name的值 |
| | | List<String> nameValues = parseNames(input); |
| | | // System.out.println("解析出的所有name值是: " + nameValues); |
| | | |
| | | // 解析所有值 |
| | | List<String> values = parseValues(input); |
| | | // System.out.println("解析出的所有值是: " + values); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | for (int i = 0; i < nameValues.size(); i++) { |
| | | String key = nameValues.get(i); |
| | | // 确保即使值为空也能正常存入map |
| | | String value = i < values.size() ? values.get(i) : ""; |
| | | map.put(key, value); |
| | | } |
| | | |
| | | // System.out.println(JSON.toJSONString(map)); |
| | | return map; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String input = "------WebKitFormBoundarySOfEJLg0rR0hf3mm\n" + |
| | | "Content-Disposition: form-data; name=\"locNo\"\n" + |
| | | "\n" + |
| | | "1\n" + |
| | | "------WebKitFormBoundarySOfEJLg0rR0hf3mm\n" + |
| | | "Content-Disposition: form-data; name=\"test\"\n" + |
| | | "\n" + |
| | | "123\n" + |
| | | "------WebKitFormBoundarySOfEJLg0rR0hf3mm\n" + |
| | | "Content-Disposition: form-data; name=\"quer\"\n" + |
| | | "\n" + |
| | | "111\n" + |
| | | "------WebKitFormBoundarySOfEJLg0rR0hf3mm--"; |
| | | |
| | | getFormData(input); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | multipart: |
| | | maxFileSize: 100MB |
| | | maxRequestSize: 100MB |
| | | redis: |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | database: 6 |
| | | # password: 123456 |
| | | |
| | | mybatis-plus: |
| | | mapper-locations: classpath:mapper/*/*.xml |
| | |
| | | publicAlias: publicCert |
| | | storePass: public_zhongyang_123456789 |
| | | licensePath: license.lic |
| | | publicKeysStorePath: publicCerts.keystore |
| | | publicKeysStorePath: publicCerts.keystore |
| | | |
| | | #接口缓存 |
| | | system: |
| | | enableCache: true |
New file |
| | |
| | | <?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.asrs.wms.asrs.mapper.CacheStatisticsMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | -- save cacheStatistics record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '系统缓存统计管理', '0', '/asrs/cacheStatistics', '/asrs/cacheStatistics', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询系统缓存统计', '', '1', 'asrs:cacheStatistics:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加系统缓存统计', '', '1', 'asrs:cacheStatistics:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改系统缓存统计', '', '1', 'asrs:cacheStatistics:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除系统缓存统计', '', '1', 'asrs:cacheStatistics:remove', '3', '1', '1'); |
| | | |