| | |
| | | if (token) { |
| | | setToken(token); |
| | | } |
| | | console.log(response); |
| | | console.log(response?.data); |
| | | return response; |
| | | } |
| | | ] |
| | |
| | | import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; |
| | | import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, UnlockOutlined } from '@ant-design/icons'; |
| | | import { getLogininforList, removeLogininfor, exportLogininfor, unlockLogininfor, cleanLogininfor } from '@/services/monitor/logininfor'; |
| | | import DictTag from '@/components/DictTag'; |
| | | import { getDictValueEnum } from '@/services/system/dict'; |
| | | import { request } from '@umijs/max'; |
| | | |
| | | |
| | |
| | | const [selectedRows, setSelectedRows] = useState([]); |
| | | const [statusOptions, setStatusOptions] = useState([]); |
| | | |
| | | const access = useAccess(); |
| | | |
| | | /** 国际化配置 */ |
| | | const intl = useIntl(); |
| | | |
| | | useEffect(() => { |
| | | getDictValueEnum('sys_common_status', true).then((data) => { |
| | | setStatusOptions(data); |
| | | }); |
| | | // getDictValueEnum('sys_common_status', true).then((data) => { |
| | | // setStatusOptions(data); |
| | | // }); |
| | | }, []); |
| | | |
| | | const columns = [ |
| | |
| | | dataIndex: 'status', |
| | | valueType: 'select', |
| | | valueEnum: statusOptions, |
| | | render: (_, record) => { |
| | | return (<DictTag enums={statusOptions} value={record.status} />); |
| | | }, |
| | | // render: (_, record) => { |
| | | // return (<DictTag enums={statusOptions} value={record.status} />); |
| | | // }, |
| | | }, |
| | | { |
| | | title: <FormattedMessage id="monitor.logininfor.msg" defaultMessage="提示消息" />, |
| | |
| | | <Button |
| | | key="remove" |
| | | danger |
| | | hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:remove')} |
| | | hidden={selectedRows?.length === 0} |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: '是否确认删除所选数据项?', |
| | |
| | | type="primary" |
| | | key="clean" |
| | | danger |
| | | hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:remove')} |
| | | hidden={selectedRows?.length === 0} |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: '是否确认清空所有数据项?', |
| | |
| | | <Button |
| | | type="primary" |
| | | key="unlock" |
| | | hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:unlock')} |
| | | hidden={selectedRows?.length === 0} |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: '是否确认解锁该用户的数据项?', |
| | |
| | | <Button |
| | | type="primary" |
| | | key="export" |
| | | hidden={!access.hasPerms('monitor:logininfor:export')} |
| | | onClick={async () => { |
| | | handleExport(); |
| | | }} |
| | |
| | | <FormattedMessage id="pages.searchTable.export" defaultMessage="导出" /> |
| | | </Button>, |
| | | ]} |
| | | request={(params) => |
| | | request={(params) => { |
| | | request('/api/role/page', { |
| | | method: 'POST', |
| | | headers: { |
| | |
| | | }; |
| | | return result; |
| | | }) |
| | | |
| | | // getLogininforList({ ...params }).then((res) => { |
| | | // const result = { |
| | | // data: res.rows, |
| | | // total: res.total, |
| | | // success: true, |
| | | // }; |
| | | // return result; |
| | | // }) |
| | | } |
| | | } |
| | | columns={columns} |
| | | rowSelection={{ |
| | |
| | | > |
| | | <Button |
| | | key="remove" |
| | | hidden={!access.hasPerms('monitor:logininfor:remove')} |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: '删除', |
New file |
| | |
| | | import { request } from '@umijs/max'; |
| | | |
| | | // 查询系统访问记录列表 |
| | | export async function getLogininforList(params?: API.Monitor.LogininforListParams) { |
| | | return request<API.Monitor.LogininforPageResult>('/api/system/logininfor/list', { |
| | | method: 'GET', |
| | | headers: { |
| | | 'Content-Type': 'application/json;charset=UTF-8', |
| | | }, |
| | | params |
| | | }); |
| | | } |
| | | |
| | | // 查询系统访问记录详细 |
| | | export function getLogininfor(infoId: number) { |
| | | return request<API.Monitor.LogininforInfoResult>(`/api/system/logininfor/${infoId}`, { |
| | | method: 'GET' |
| | | }); |
| | | } |
| | | |
| | | // 新增系统访问记录 |
| | | export async function addLogininfor(params: API.Monitor.Logininfor) { |
| | | return request<API.Result>('/api/system/logininfor', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json;charset=UTF-8', |
| | | }, |
| | | data: params |
| | | }); |
| | | } |
| | | |
| | | // 修改系统访问记录 |
| | | export async function updateLogininfor(params: API.Monitor.Logininfor) { |
| | | return request<API.Result>('/api/system/logininfor', { |
| | | method: 'PUT', |
| | | headers: { |
| | | 'Content-Type': 'application/json;charset=UTF-8', |
| | | }, |
| | | data: params |
| | | }); |
| | | } |
| | | |
| | | // 删除系统访问记录 |
| | | export async function removeLogininfor(ids: string) { |
| | | return request<API.Result>(`/api/system/logininfor/${ids}`, { |
| | | method: 'DELETE' |
| | | }); |
| | | } |
| | | |
| | | // 导出系统访问记录 |
| | | export function exportLogininfor(params?: API.Monitor.LogininforListParams) { |
| | | return request<API.Result>(`/api/system/logininfor/export`, { |
| | | method: 'GET', |
| | | params |
| | | }); |
| | | } |
| | | |
| | | // 解锁用户登录状态 |
| | | export function unlockLogininfor(userName: string) { |
| | | return request<API.Result>('/api/system/logininfor/unlock/' + userName, { |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // 清空登录日志 |
| | | export function cleanLogininfor() { |
| | | return request<API.Result>('/api/system/logininfor/clean', { |
| | | method: 'delete' |
| | | }) |
| | | } |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | private void saveLog(JoinPoint joinPoint, Object result, Exception e) { |
| | | OperationRecord record = new OperationRecord(); |
| | | Long endTime = startTime.get(); |
| | | record.setCreateTime(new Date()); |
| | | // 记录操作耗时 |
| | | if (endTime != null) { |
| | | record.setSpendTime((int) (System.currentTimeMillis() - endTime)); |
| | |
| | | return R.error("密码错误"); |
| | | } |
| | | userLoginService.saveAsync(user.getId(), UserLogin.TYPE_LOGIN, null, hostId, request); |
| | | String accessToken = JwtUtil.buildToken(new JwtSubject(username, hostId), |
| | | String accessToken = JwtUtil.buildToken(new JwtSubject(username, user.getHostId()), |
| | | configProperties.getTokenExpireTime(), configProperties.getTokenKey()); |
| | | return R.ok("登录成功").add(new LoginResult(accessToken, user)); |
| | | } |
| | |
| | | |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wcs.common.annotation.OperationLog; |
| | | import com.zy.asrs.wcs.sys.entity.User; |
| | | import com.zy.asrs.wcs.sys.controller.param.PageParam; |
| | | import com.zy.asrs.wcs.sys.entity.Role; |
| | | import com.zy.asrs.wcs.sys.service.RoleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2/13/2024 |
| | |
| | | @RequestMapping("/api") |
| | | public class RoleController extends BaseController { |
| | | |
| | | @PreAuthorize("hasAuthority('sys:auth:user')") |
| | | @Autowired |
| | | private RoleService roleService; |
| | | |
| | | @PreAuthorize("hasAuthority('sys:role:list')") |
| | | @OperationLog |
| | | @PutMapping("/role/page") |
| | | public R updateInfo(@RequestBody User user) { |
| | | return R.ok(); |
| | | @PostMapping("/role/page") |
| | | public R updateInfo(@RequestBody PageParam param) { |
| | | List<Role> list = roleService.list(); |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.wcs.sys.controller.param; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * Created by vincent on 2/13/2024 |
| | | */ |
| | | @Data |
| | | public class PageParam { |
| | | public class PageParam extends HashMap<String, Object> implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer pageIdx; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer pageSize; |
| | | |
| | | @TableField(exist = false) |
| | | private String timeStart; |
| | | |
| | | @TableField(exist = false) |
| | | private String timeEnd; |
| | | |
| | | @TableField(exist = false) |
| | | private String condition; |
| | | |
| | | } |