diff --git a/doc/adnc_cus_dev.sql b/doc/adnc_cus_dev.sql index 47a4c2685..d1e23df11 100644 --- a/doc/adnc_cus_dev.sql +++ b/doc/adnc_cus_dev.sql @@ -27,6 +27,7 @@ CREATE TABLE `customer` ( `modifyby` bigint(20) NULL DEFAULT NULL, `modifytime` datetime(6) NULL DEFAULT NULL, `account` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `password` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `nickname` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `realname` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE diff --git a/doc/adnc_usr_dev.sql b/doc/adnc_usr_dev.sql index 799be1f51..7bfb74548 100644 --- a/doc/adnc_usr_dev.sql +++ b/doc/adnc_usr_dev.sql @@ -79,57 +79,61 @@ CREATE TABLE `sysmenu` ( -- ---------------------------- -- Records of sysmenu -- ---------------------------- -INSERT INTO `sysmenu` VALUES (1600000000001, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2021-02-08 23:40:04.403976', 'usr', 'layout', b'0', 'peoples', b'1', NULL, 1, '用户中心', '0', '[0],', b'1', NULL, '/usr', 0); -INSERT INTO `sysmenu` VALUES (1600000000003, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2021-02-08 23:39:40.812082', 'maintain', 'layout', b'0', 'operation', b'1', NULL, 1, '运维中心', '0', '[0],', b'1', NULL, '/maintain', 1); -INSERT INTO `sysmenu` VALUES (1600000000004, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 00:21:11.459114', 'user', 'views/usr/user/index', b'0', 'user', b'1', NULL, 2, '用户管理', 'usr', '[0],[usr]', b'1', NULL, '/user', 0); -INSERT INTO `sysmenu` VALUES (1600000000005, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 00:21:23.738379', 'userAdd', NULL, b'0', '', b'0', NULL, 3, '添加用户', 'user', '[0],[usr][user]', b'1', NULL, '/user/add', 0); -INSERT INTO `sysmenu` VALUES (1600000000006, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 00:21:44.038549', 'userEdit', NULL, b'0', '', b'0', NULL, 3, '修改用户', 'user', '[0],[usr][user]', b'1', NULL, '/user/edit', 0); -INSERT INTO `sysmenu` VALUES (1600000000007, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userDelete', NULL, b'0', NULL, b'0', b'0', 3, '删除用户', 'user', '[0],[usr],[user],', b'1', NULL, '/user/delete', 0); -INSERT INTO `sysmenu` VALUES (1600000000008, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userReset', NULL, b'0', NULL, b'0', b'0', 3, '重置密码', 'user', '[0],[usr],[user],', b'1', NULL, '/user/reset', 0); -INSERT INTO `sysmenu` VALUES (1600000000009, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 00:21:48.244064', 'userFreeze', NULL, b'0', '', b'0', NULL, 3, '冻结用户', 'user', '[0],[usr][user]', b'1', NULL, '/user/freeze', 0); -INSERT INTO `sysmenu` VALUES (1600000000010, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userUnfreeze', NULL, b'0', NULL, b'0', b'0', 3, '解除冻结用户', 'user', '[0],[usr],[user],', b'1', NULL, '/user/unfreeze', 0); -INSERT INTO `sysmenu` VALUES (1600000000011, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userSetRole', NULL, b'0', NULL, b'0', b'0', 3, '分配角色', 'user', '[0],[usr],[user],', b'1', NULL, '/user/setRole', 0); -INSERT INTO `sysmenu` VALUES (1600000000012, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'role', 'views/usr/role/index', b'0', 'people', b'1', NULL, 2, '角色管理', 'usr', '[0],[usr]', b'1', NULL, '/role', 0); -INSERT INTO `sysmenu` VALUES (1600000000013, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'roleAdd', NULL, b'0', NULL, b'0', b'0', 3, '添加角色', 'role', '[0],[usr],[role],', b'1', NULL, '/role/add', 0); -INSERT INTO `sysmenu` VALUES (1600000000014, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'roleEdit', NULL, b'0', NULL, b'0', b'0', 3, '修改角色', 'role', '[0],[usr],[role],', b'1', NULL, '/role/edit', 0); -INSERT INTO `sysmenu` VALUES (1600000000015, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'roleDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除角色', 'role', '[0],[usr],[role]', b'1', NULL, '/role/delete', 0); -INSERT INTO `sysmenu` VALUES (1600000000016, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'roleSetAuthority', NULL, b'0', NULL, b'0', b'0', 3, '配置权限', 'role', '[0],[usr],[role],', b'1', NULL, '/role/setAuthority', 0); -INSERT INTO `sysmenu` VALUES (1600000000017, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menu', 'views/usr/menu/index', b'0', 'menu', b'1', NULL, 2, '菜单管理', 'usr', '[0],[usr]', b'1', NULL, '/menu', 0); -INSERT INTO `sysmenu` VALUES (1600000000018, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menuAdd', NULL, b'0', NULL, b'0', b'0', 3, '添加菜单', 'menu', '[0],[usr],[menu],', b'1', NULL, '/menu/add', 0); -INSERT INTO `sysmenu` VALUES (1600000000019, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menuEdit', NULL, b'0', NULL, b'0', b'0', 3, '修改菜单', 'menu', '[0],[usr],[menu],', b'1', NULL, '/menu/edit', 0); -INSERT INTO `sysmenu` VALUES (1600000000020, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menuDelete', NULL, b'0', NULL, b'0', b'0', 3, '删除菜单', 'menu', '[0],[usr],[menu],', b'1', NULL, '/menu/remove', 0); -INSERT INTO `sysmenu` VALUES (1600000000021, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dept', 'views/usr/dept/index', b'0', 'dept', b'1', NULL, 2, '部门管理', 'usr', '[0],[usr],', b'1', NULL, '/dept', 0); -INSERT INTO `sysmenu` VALUES (1600000000022, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dict', 'views/maintain/dict/index', b'0', 'dict', b'1', NULL, 2, '字典管理', 'maintain', '[0],[maintain],', b'1', NULL, '/dict', 0); -INSERT INTO `sysmenu` VALUES (1600000000023, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'deptEdit', NULL, b'0', NULL, b'0', NULL, 3, '修改部门', 'dept', '[0],[usr],[dept],', b'1', NULL, '/dept/update', 0); -INSERT INTO `sysmenu` VALUES (1600000000024, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'deptDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除部门', 'dept', '[0],[usr],[dept],', b'1', NULL, '/dept/delete', 0); -INSERT INTO `sysmenu` VALUES (1600000000025, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-24 23:45:06.337465', 'dictAdd', NULL, b'0', '', b'0', NULL, 3, '添加字典', 'dict', '[0],[maintain],[dict]', b'1', NULL, '/dict/add', 0); -INSERT INTO `sysmenu` VALUES (1600000000026, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dictEdit', NULL, b'0', NULL, b'0', NULL, 3, '修改字典', 'dict', '[0],[maintain],[dict],', b'1', NULL, '/dict/update', 0); -INSERT INTO `sysmenu` VALUES (1600000000027, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dictDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除字典', 'dict', '[0],[maintain],[dict],', b'1', NULL, '/dict/delete', 0); -INSERT INTO `sysmenu` VALUES (1600000000028, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'deptList', NULL, b'0', NULL, b'0', NULL, 3, '部门列表', 'dept', '[0],[usr],[dept],', b'1', NULL, '/dept/list', 0); -INSERT INTO `sysmenu` VALUES (1600000000030, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dictList', NULL, b'0', NULL, b'0', NULL, 3, '字典列表', 'dict', '[0],[maintain],[dict],', b'1', NULL, '/dict/list', 0); -INSERT INTO `sysmenu` VALUES (1600000000032, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'deptAdd', NULL, b'0', NULL, b'0', NULL, 3, '添加部门', 'dept', '[0],[usr],[dept],', b'1', NULL, '/dept/add', 0); -INSERT INTO `sysmenu` VALUES (1600000000033, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfg', 'views/maintain/cfg/index', b'0', 'cfg', b'1', NULL, 2, '参数管理', 'maintain', '[0],[maintain]', b'1', NULL, '/cfg', 0); -INSERT INTO `sysmenu` VALUES (1600000000034, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfgAdd', NULL, b'0', NULL, b'0', NULL, 3, '添加系统参数', 'cfg', '[0],[maintain],[cfg],', b'1', NULL, '/cfg/add', 0); -INSERT INTO `sysmenu` VALUES (1600000000035, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfgEdit', NULL, b'0', NULL, b'0', NULL, 3, '修改系统参数', 'cfg', '[0],[maintain],[cfg],', b'1', NULL, '/cfg/update', 0); -INSERT INTO `sysmenu` VALUES (1600000000036, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfgDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除系统参数', 'cfg', '[0],[maintain],[cfg],', b'1', NULL, '/cfg/delete', 0); -INSERT INTO `sysmenu` VALUES (1600000000037, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2021-02-02 12:45:20.451193', 'task', 'views/maintain/task/index', b'1', 'task', b'1', NULL, 2, '任务管理', 'maintain', '[0],[maintain]', b'1', NULL, '/task', 0); -INSERT INTO `sysmenu` VALUES (1600000000038, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskAdd', NULL, b'0', NULL, b'0', NULL, 3, '添加任务', 'task', '[0],[maintain],[task],', b'1', NULL, '/task/add', 0); -INSERT INTO `sysmenu` VALUES (1600000000039, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskEdit', NULL, b'0', NULL, b'0', NULL, 3, '修改任务', 'task', '[0],[maintain],[task],', b'1', NULL, '/task/update', 0); -INSERT INTO `sysmenu` VALUES (1600000000040, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除任务', 'task', '[0],[maintain],[task],', b'1', NULL, '/task/delete', 0); -INSERT INTO `sysmenu` VALUES (1600000000047, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskLog', 'views/maintain/task/taskLog', b'1', 'task', b'1', NULL, 3, '任务日志', 'task', '[0],[maintain],[task],', b'1', NULL, '/task/taskLog', 0); -INSERT INTO `sysmenu` VALUES (1600000000048, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'opsLog', 'views/maintain/opslog/index', b'0', 'log', b'1', NULL, 2, '操作日志', 'maintain', '[0],[maintain]', b'1', NULL, '/opslog', 0); -INSERT INTO `sysmenu` VALUES (1600000000049, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'loginLog', 'views/maintain/loginlog/index', b'0', 'logininfor', b'1', NULL, 2, '登录日志', 'maintain', '[0],[maintain]', b'1', NULL, '/loginlog', 0); -INSERT INTO `sysmenu` VALUES (1600000000054, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2021-01-11 00:01:02.425962', 'druid', 'layout', b'0', 'link', b'1', NULL, 2, '性能检测', 'maintain', '[0],[maintain]', b'1', NULL, 'http://106.14.139.201:18886', 0); -INSERT INTO `sysmenu` VALUES (1600000000055, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 19:30:04.982175', 'swagger', 'views/maintain/swagger/index', b'0', 'swagger', b'1', NULL, 2, '接口文档', 'maintain', '[0],[maintain]', b'1', NULL, '/swagger', 0); -INSERT INTO `sysmenu` VALUES (1600000000071, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-24 23:44:04.045778', 'nlogLog', 'views/maintain/nloglog/index', b'0', 'logininfor', b'1', NULL, 2, 'Nlog日志', 'maintain', '[0],[maintain]', b'1', NULL, '/nloglogs', 0); -INSERT INTO `sysmenu` VALUES (1600000000072, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'health', 'layout', b'0', 'monitor', b'1', NULL, 2, '健康检测', 'maintain', '[0],[maintain]', b'1', NULL, 'http://106.14.139.201:8666/healthchecks-ui', 0); -INSERT INTO `sysmenu` VALUES (1600000000073, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menuList', NULL, b'0', '', b'0', NULL, 3, '菜单列表', 'menu', '[0],[usr][menu]', b'1', NULL, '/menu/list', 0); -INSERT INTO `sysmenu` VALUES (1600000000074, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2021-02-08 23:29:43.628024', 'roleList', NULL, b'0', '', b'0', NULL, 3, '角色列表', 'role', '[0],[usr][role]', b'1', NULL, '/role/list', 1); -INSERT INTO `sysmenu` VALUES (1600000000075, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userList', NULL, b'0', '', b'0', NULL, 3, '用户列表', 'user', '[0],[usr][user]', b'1', NULL, 'user/list', 0); -INSERT INTO `sysmenu` VALUES (1600000000076, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfgList', NULL, b'0', '', b'0', NULL, 3, '系统参数列表', 'cfg', '[0],[maintain][cfg]', b'1', NULL, '/cfg/list', 0); -INSERT INTO `sysmenu` VALUES (1600000000077, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskList', NULL, b'0', NULL, b'0', NULL, 3, '任务列表', 'task', '[0],[maintain][task]', b'1', NULL, '/task/list', 0); -INSERT INTO `sysmenu` VALUES (1600000000078, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-24 23:43:13.041844', 'eventBus', 'layout', b'0', 'server', b'1', NULL, 2, 'EventBus', 'maintain', '[0],[maintain]', b'1', NULL, 'http://106.14.139.201:8888/cus/cap/', 0); - +INSERT INTO `sysmenu` (`id`, `createby`, `createtime`, `modifyby`, `modifytime`, `code`, `component`, `hidden`, `icon`, `ismenu`, `isopen`, `levels`, `name`, `pcode`, `pcodes`, `status`, `tips`, `url`, `ordinal`) VALUES + (1600000000001, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2021-02-08 23:40:04.403976', 'usr', 'layout', b'0', 'peoples', b'1', NULL, 1, '用户中心', '0', '[0],', b'1', NULL, '/usr', 0), + (1600000000003, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2021-02-08 23:39:40.812082', 'maintain', 'layout', b'0', 'operation', b'1', NULL, 1, '运维中心', '0', '[0],', b'1', NULL, '/maintain', 1), + (1600000000004, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 00:21:11.459114', 'user', 'views/usr/user/index', b'0', 'user', b'1', NULL, 2, '用户管理', 'usr', '[0],[usr]', b'1', NULL, '/user', 0), + (1600000000005, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 00:21:23.738379', 'userAdd', NULL, b'0', '', b'0', NULL, 3, '添加用户', 'user', '[0],[usr][user]', b'1', NULL, '/user/add', 0), + (1600000000006, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 00:21:44.038549', 'userEdit', NULL, b'0', '', b'0', NULL, 3, '修改用户', 'user', '[0],[usr][user]', b'1', NULL, '/user/edit', 0), + (1600000000007, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userDelete', NULL, b'0', NULL, b'0', b'0', 3, '删除用户', 'user', '[0],[usr],[user],', b'1', NULL, '/user/delete', 0), + (1600000000008, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userReset', NULL, b'0', NULL, b'0', b'0', 3, '重置密码', 'user', '[0],[usr],[user],', b'1', NULL, '/user/reset', 0), + (1600000000009, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 00:21:48.244064', 'userFreeze', NULL, b'0', '', b'0', NULL, 3, '冻结用户', 'user', '[0],[usr][user]', b'1', NULL, '/user/freeze', 0), + (1600000000010, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userUnfreeze', NULL, b'0', NULL, b'0', b'0', 3, '解除冻结用户', 'user', '[0],[usr],[user],', b'1', NULL, '/user/unfreeze', 0), + (1600000000011, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userSetRole', NULL, b'0', NULL, b'0', b'0', 3, '分配角色', 'user', '[0],[usr],[user],', b'1', NULL, '/user/setRole', 0), + (1600000000012, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'role', 'views/usr/role/index', b'0', 'people', b'1', NULL, 2, '角色管理', 'usr', '[0],[usr]', b'1', NULL, '/role', 0), + (1600000000013, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'roleAdd', NULL, b'0', NULL, b'0', b'0', 3, '添加角色', 'role', '[0],[usr],[role],', b'1', NULL, '/role/add', 0), + (1600000000014, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'roleEdit', NULL, b'0', NULL, b'0', b'0', 3, '修改角色', 'role', '[0],[usr],[role],', b'1', NULL, '/role/edit', 0), + (1600000000015, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'roleDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除角色', 'role', '[0],[usr],[role]', b'1', NULL, '/role/delete', 0), + (1600000000016, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'roleSetAuthority', NULL, b'0', NULL, b'0', b'0', 3, '配置权限', 'role', '[0],[usr],[role],', b'1', NULL, '/role/setAuthority', 0), + (1600000000017, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menu', 'views/usr/menu/index', b'0', 'menu', b'1', NULL, 2, '菜单管理', 'usr', '[0],[usr]', b'1', NULL, '/menu', 0), + (1600000000018, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menuAdd', NULL, b'0', NULL, b'0', b'0', 3, '添加菜单', 'menu', '[0],[usr],[menu],', b'1', NULL, '/menu/add', 0), + (1600000000019, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menuEdit', NULL, b'0', NULL, b'0', b'0', 3, '修改菜单', 'menu', '[0],[usr],[menu],', b'1', NULL, '/menu/edit', 0), + (1600000000020, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menuDelete', NULL, b'0', NULL, b'0', b'0', 3, '删除菜单', 'menu', '[0],[usr],[menu],', b'1', NULL, '/menu/remove', 0), + (1600000000021, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dept', 'views/usr/dept/index', b'0', 'dept', b'1', NULL, 2, '部门管理', 'usr', '[0],[usr],', b'1', NULL, '/dept', 0), + (1600000000022, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dict', 'views/maintain/dict/index', b'0', 'dict', b'1', NULL, 2, '字典管理', 'maintain', '[0],[maintain],', b'1', NULL, '/dict', 0), + (1600000000023, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'deptEdit', NULL, b'0', NULL, b'0', NULL, 3, '修改部门', 'dept', '[0],[usr],[dept],', b'1', NULL, '/dept/update', 0), + (1600000000024, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'deptDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除部门', 'dept', '[0],[usr],[dept],', b'1', NULL, '/dept/delete', 0), + (1600000000025, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2022-08-15 11:03:42.351551', 'dictAdd', NULL, b'0', '', b'0', NULL, 3, '添加字典', 'dict', '[0],[maintain],[dict]', b'1', NULL, '/dict/add', 0), + (1600000000026, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dictEdit', NULL, b'0', NULL, b'0', NULL, 3, '修改字典', 'dict', '[0],[maintain],[dict],', b'1', NULL, '/dict/update', 0), + (1600000000027, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dictDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除字典', 'dict', '[0],[maintain],[dict],', b'1', NULL, '/dict/delete', 0), + (1600000000028, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'deptList', NULL, b'0', NULL, b'0', NULL, 3, '部门列表', 'dept', '[0],[usr],[dept],', b'1', NULL, '/dept/list', 0), + (1600000000030, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'dictList', NULL, b'0', NULL, b'0', NULL, 3, '字典列表', 'dict', '[0],[maintain],[dict],', b'1', NULL, '/dict/list', 0), + (1600000000032, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'deptAdd', NULL, b'0', NULL, b'0', NULL, 3, '添加部门', 'dept', '[0],[usr],[dept],', b'1', NULL, '/dept/add', 0), + (1600000000033, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfg', 'views/maintain/cfg/index', b'0', 'cfg', b'1', NULL, 2, '参数管理', 'maintain', '[0],[maintain]', b'1', NULL, '/cfg', 0), + (1600000000034, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfgAdd', NULL, b'0', NULL, b'0', NULL, 3, '添加系统参数', 'cfg', '[0],[maintain],[cfg],', b'1', NULL, '/cfg/add', 0), + (1600000000035, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfgEdit', NULL, b'0', NULL, b'0', NULL, 3, '修改系统参数', 'cfg', '[0],[maintain],[cfg],', b'1', NULL, '/cfg/update', 0), + (1600000000036, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfgDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除系统参数', 'cfg', '[0],[maintain],[cfg],', b'1', NULL, '/cfg/delete', 0), + (1600000000037, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2022-08-15 11:04:10.021053', 'task', 'views/maintain/task/index', b'1', 'task', b'1', NULL, 2, '任务管理', 'maintain', '[0],[maintain]', b'0', NULL, '/task', 0), + (1600000000038, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskAdd', NULL, b'0', NULL, b'0', NULL, 3, '添加任务', 'task', '[0],[maintain],[task],', b'1', NULL, '/task/add', 0), + (1600000000039, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskEdit', NULL, b'0', NULL, b'0', NULL, 3, '修改任务', 'task', '[0],[maintain],[task],', b'1', NULL, '/task/update', 0), + (1600000000040, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskDelete', NULL, b'0', NULL, b'0', NULL, 3, '删除任务', 'task', '[0],[maintain],[task],', b'1', NULL, '/task/delete', 0), + (1600000000047, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskLog', 'views/maintain/task/taskLog', b'1', 'task', b'1', NULL, 3, '任务日志', 'task', '[0],[maintain],[task],', b'1', NULL, '/task/taskLog', 0), + (1600000000048, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'opsLog', 'views/maintain/opslog/index', b'0', 'log', b'1', NULL, 2, '操作日志', 'maintain', '[0],[maintain]', b'1', NULL, '/opslog', 0), + (1600000000049, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'loginLog', 'views/maintain/loginlog/index', b'0', 'logininfor', b'1', NULL, 2, '登录日志', 'maintain', '[0],[maintain]', b'1', NULL, '/loginlog', 0), + (1600000000054, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2022-08-15 11:07:15.272200', 'druid', 'layout', b'0', 'link', b'1', NULL, 2, '性能检测', 'maintain', '[0],[maintain]', b'1', NULL, 'http://skywalking.aspdotnetcore.net', 0), + (1600000000055, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-11-25 19:30:04.982175', 'swagger', 'views/maintain/swagger/index', b'0', 'swagger', b'1', NULL, 2, '接口文档', 'maintain', '[0],[maintain]', b'1', NULL, '/swagger', 0), + (1600000000071, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2022-08-15 11:07:03.454784', 'nlogLog', 'layout', b'0', 'logininfor', b'1', NULL, 2, 'Nlog日志', 'maintain', '[0],[maintain]', b'1', NULL, 'http://loki.aspdotnetcore.net', 0), + (1600000000072, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2022-08-15 11:05:35.278971', 'health', 'layout', b'0', 'monitor', b'1', NULL, 2, '健康检测', 'maintain', '[0],[maintain]', b'1', NULL, 'http://prometheus.aspdotnetcore.net', 0), + (1600000000073, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'menuList', NULL, b'0', '', b'0', NULL, 3, '菜单列表', 'menu', '[0],[usr][menu]', b'1', NULL, '/menu/list', 0), + (1600000000074, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2021-02-08 23:29:43.628024', 'roleList', NULL, b'0', '', b'0', NULL, 3, '角色列表', 'role', '[0],[usr][role]', b'1', NULL, '/role/list', 1), + (1600000000075, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'userList', NULL, b'0', '', b'0', NULL, 3, '用户列表', 'user', '[0],[usr][user]', b'1', NULL, 'user/list', 0), + (1600000000076, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'cfgList', NULL, b'0', '', b'0', NULL, 3, '系统参数列表', 'cfg', '[0],[maintain][cfg]', b'1', NULL, '/cfg/list', 0), + (1600000000077, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2020-08-08 08:08:08.888888', 'taskList', NULL, b'0', NULL, b'0', NULL, 3, '任务列表', 'task', '[0],[maintain][task]', b'1', NULL, '/task/list', 0), + (1600000000078, 1600000000000, '2020-08-08 08:08:08.888888', 1600000000000, '2022-08-15 11:05:57.235325', 'eventBus', 'layout', b'0', 'server', b'1', NULL, 2, 'EventBus', 'maintain', '[0],[maintain]', b'1', NULL, 'http://114.132.157.167:8888/cus/cap/', 0), + (324234353984645, 1600000000000, '2022-08-24 14:52:59.958191', NULL, NULL, 'cus', 'layout', b'1', 'wechat', b'1', NULL, 1, '客户中心', '0', '[0],', b'0', NULL, '/cus', 1), + (324234861724805, 1600000000000, '2022-08-24 14:55:03.809432', 1600000000000, '2022-08-24 14:58:10.931952', 'customer', 'views/usr/user/index', b'1', 'peoples', b'1', NULL, 2, '客户管理', 'cus', '[0],[cus]', b'1', NULL, '/customer', 1), + (324235389097093, 1600000000000, '2022-08-24 14:57:12.562108', 1600000000000, '2022-08-24 14:58:54.985811', 'customerList', NULL, b'0', '', b'0', NULL, 3, '客户列表', 'customer', '[0],[cus][customer]', b'1', NULL, '/customer/list', 1), + (324236388873349, 1600000000000, '2022-08-24 15:01:16.647958', 1600000000000, '2022-08-24 15:02:54.797116', 'customerRecharge', '', b'0', 'contacts', b'0', NULL, 3, '充值', 'customer', '[0],[cus][customer]', b'1', NULL, '/customer/recharge', 1); -- ---------------------------- -- Table structure for sysrelation -- ---------------------------- @@ -198,6 +202,10 @@ INSERT INTO `sysrelation` VALUES (1606193510047, 1600000000055, 1600000000010); INSERT INTO `sysrelation` VALUES (1606193510048, 1600000000071, 1600000000010); INSERT INTO `sysrelation` VALUES (1606193510049, 1600000000072, 1600000000010); INSERT INTO `sysrelation` VALUES (1606193510050, 1600000000078, 1600000000010); +INSERT INTO `sysrelation` VALUES (1607193510049, 324234353984645, 1600000000010); +INSERT INTO `sysrelation` VALUES (1607193510050, 324234861724805, 1600000000010); +INSERT INTO `sysrelation` VALUES (1607193510051, 324235389097093, 1600000000010); +INSERT INTO `sysrelation` VALUES (1607193510052, 324236388873349, 1600000000010); INSERT INTO `sysrelation` VALUES (1610294626091, 1600000000003, 1606156061057); INSERT INTO `sysrelation` VALUES (1610294626092, 1600000000022, 1606156061057); INSERT INTO `sysrelation` VALUES (1610294626093, 1600000000025, 1606156061057); diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Adnc.Infra.Repository.csproj b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Adnc.Infra.Repository.csproj index 861f39f89..bd595aae4 100644 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Adnc.Infra.Repository.csproj +++ b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Adnc.Infra.Repository.csproj @@ -5,8 +5,11 @@ True - - + + + + + diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/AbstractEntityInfo.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/AbstractEntityInfo.cs deleted file mode 100644 index 399069fb2..000000000 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/AbstractEntityInfo.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Adnc.Infra.Entities -{ - public abstract class AbstractEntityInfo : IEntityInfo - { - protected virtual IEnumerable GetEntityTypes(Assembly assembly) - { - var efEntities = assembly.GetTypes().Where(m => - m.FullName != null - && typeof(EfEntity).IsAssignableFrom(m) - && !m.IsAbstract); - - return efEntities; - } - - public abstract IEnumerable GetEntitiesTypeInfo(); - public abstract IEnumerable GetConfigAssemblys(); - } -} \ No newline at end of file diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Config/EntityProperty.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Config/EntityProperty.cs deleted file mode 100644 index 49966aeac..000000000 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Config/EntityProperty.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Adnc.Infra.Entities.Config -{ - public struct EntityProperty - { - public readonly int MaxLength; - - public readonly bool IsRequired; - - private EntityProperty(bool isRequired, int maxLength) - { - IsRequired = isRequired; - MaxLength = maxLength; - } - - public static implicit operator EntityProperty((bool IsRequired, int MaxLength) info) - { - return new EntityProperty(info.IsRequired, info.MaxLength); - } - } -} \ No newline at end of file diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Extensions/PropertyBuilderExtension.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Extensions/PropertyBuilderExtension.cs deleted file mode 100644 index 392a6b091..000000000 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Extensions/PropertyBuilderExtension.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Adnc.Infra.Entities.Config; - -namespace Microsoft.EntityFrameworkCore.Metadata.Builders -{ - public static class PropertyBuilderExtension - { - public static PropertyBuilder IsRequiredAndMaxLength(this PropertyBuilder builder, EntityProperty entConst) - { - builder.IsRequired(entConst.IsRequired); - builder.HasMaxLength(entConst.MaxLength); - return builder; - } - } -} \ No newline at end of file diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/LoggingLog.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/LoggingLog.cs deleted file mode 100644 index 5c49b958c..000000000 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/LoggingLog.cs +++ /dev/null @@ -1,63 +0,0 @@ -using MongoDB.Bson.Serialization.Attributes; - -namespace Adnc.Infra.Entities -{ - /// - /// 异常日志 - /// - //the driver would ignore any extra fields instead of throwing an exception - [BsonIgnoreExtraElements] - public class LoggingLog : MongoEntity - { - [BsonDateTimeOptions(Kind = DateTimeKind.Local)] - public DateTime Date { get; set; } - - public string Level { get; set; } = default!; - - public string Message { get; set; } = default!; - - public string Logger { get; set; } = default!; - - public string Exception { get; set; } = default!; - - public int ThreadID { get; set; } = default!; - - public string ThreadName { get; set; } = default!; - - public int ProcessID { get; set; } = default!; - - public string ProcessName { get; set; } = default!; - - public SysNloglogProperty Properties { get; set; } = default!; - } - - [BsonIgnoreExtraElements] - public class SysNloglogProperty - { - public string TraceIdentifier { get; set; } = default!; - - public string ConnectionId { get; set; } = default!; - - public string EventId_Id { get; set; } = default!; - - public string EventId_Name { get; set; } = default!; - - public string EventId { get; set; } = default!; - - public string RemoteIpAddress { get; set; } = default!; - - public string BaseDir { get; set; } = default!; - - public string QueryUrl { get; set; } = default!; - - public string RequestMethod { get; set; } = default!; - - public string Controller { get; set; } = default!; - - public string Method { get; set; } = default!; - - public string FormContent { get; set; } = default!; - - public string QueryContent { get; set; } = default!; - } -} \ No newline at end of file diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/LoginLog.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/LoginLog.cs deleted file mode 100644 index fc3a96d5f..000000000 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/LoginLog.cs +++ /dev/null @@ -1,29 +0,0 @@ -using MongoDB.Bson.Serialization.Attributes; - -namespace Adnc.Infra.Entities -{ - /// - /// 登录日志 - /// - public class LoginLog : MongoEntity - { - public string Device { get; set; } = default!; - - public string Message { get; set; } = default!; - - public bool Succeed { get; set; } = default!; - - public int StatusCode { get; set; } = default!; - - public long? UserId { get; set; } = default!; - - public string Account { get; set; } = default!; - - public string UserName { get; set; } = default!; - - public string RemoteIpAddress { get; set; } = default!; - - [BsonDateTimeOptions(Kind = DateTimeKind.Local)] - public DateTime? CreateTime { get; set; } - } -} \ No newline at end of file diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/OperationLog.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/OperationLog.cs deleted file mode 100644 index 87d8e8a58..000000000 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/MongoEntities/OperationLog.cs +++ /dev/null @@ -1,33 +0,0 @@ -using MongoDB.Bson.Serialization.Attributes; - -namespace Adnc.Infra.Entities -{ - /// - /// 操作日志 - /// - public class OperationLog : MongoEntity - { - public string ClassName { get; set; } = default!; - - [BsonDateTimeOptions(Kind = DateTimeKind.Local)] - public DateTime? CreateTime { get; set; } - - public string LogName { get; set; } = default!; - - public string LogType { get; set; } = default!; - - public string Message { get; set; } = default!; - - public string Method { get; set; } = default!; - - public string Succeed { get; set; } = default!; - - public long? UserId { get; set; } = default!; - - public string Account { get; set; } = default!; - - public string UserName { get; set; } = default!; - - public string RemoteIpAddress { get; set; } = default!; - } -} \ No newline at end of file diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/GlobalUsings.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/GlobalUsings.cs index 93424467e..8b217b522 100644 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/GlobalUsings.cs +++ b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/GlobalUsings.cs @@ -1,6 +1,3 @@ -global using Adnc.Infra.Entities; -global using Microsoft.EntityFrameworkCore; -global using Microsoft.EntityFrameworkCore.Metadata.Builders; -global using System.Data; +global using System.Data; global using System.Linq.Expressions; global using System.Reflection; diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfBaseRepository.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfBaseRepository.cs index 75dc25eb6..cfb304629 100644 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfBaseRepository.cs +++ b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfBaseRepository.cs @@ -1,4 +1,6 @@ -namespace Adnc.Infra.IRepositories; +using Adnc.Infra.Entities; + +namespace Adnc.Infra.IRepositories; /// /// Ef仓储的基类接口 diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfBasicRepository.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfBasicRepository.cs index f3add2485..121c76230 100644 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfBasicRepository.cs +++ b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfBasicRepository.cs @@ -1,4 +1,6 @@ -namespace Adnc.Infra.IRepositories; +using Adnc.Infra.Entities; + +namespace Adnc.Infra.IRepositories; /// /// Ef简单的、基础的,初级的仓储接口 diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfRepository.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfRepository.cs index f021281ed..80e79c2ae 100644 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfRepository.cs +++ b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IEfRepository.cs @@ -1,4 +1,6 @@ -namespace Adnc.Infra.IRepositories; +using Adnc.Infra.Entities; + +namespace Adnc.Infra.IRepositories; /// /// Ef默认的、全功能的仓储接口 diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IMongoRepository.cs b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IMongoRepository.cs index 58e823b1d..a6b1c317b 100644 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IMongoRepository.cs +++ b/src/ServerApi/Infrastructures/Adnc.Infra.Repository/IRepositories/IMongoRepository.cs @@ -1,4 +1,5 @@ -using MongoDB.Driver; +using Adnc.Infra.Entities; +using MongoDB.Driver; namespace Adnc.Infra.IRepositories; diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application.Contracts/Dtos/CustomerRegisterDto.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application.Contracts/Dtos/CustomerRegisterDto.cs index 7c5d8523c..68fb22bd7 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application.Contracts/Dtos/CustomerRegisterDto.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application.Contracts/Dtos/CustomerRegisterDto.cs @@ -4,6 +4,8 @@ public class CustomerRegisterDto : IInputDto { public string Account { get; set; } + public string Password { get; set; } + public string Nickname { get; set; } public string Realname { get; set; } diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application.Contracts/Services/ICustomerAppService.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application.Contracts/Services/ICustomerAppService.cs index 0e44044bb..47a476abc 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application.Contracts/Services/ICustomerAppService.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application.Contracts/Services/ICustomerAppService.cs @@ -2,20 +2,49 @@ public interface ICustomerAppService : IAppService { + /// + /// 注册 + /// + /// + /// [OperateLog(LogName = "注册")] Task> RegisterAsync(CustomerRegisterDto input); + /// + /// 充值 + /// + /// + /// + /// [OperateLog(LogName = "充值")] [UnitOfWork(SharedToCap = true)] Task>> RechargeAsync(long id, CustomerRechargeDto input); + /// + /// 处理充值 + /// + /// + /// + /// [OperateLog(LogName = "处理充值")] [UnitOfWork] Task ProcessRechargingAsync(CustomerRechargedEvent eventDto, IMessageTracker tracker); + /// + /// 处理付款 + /// + /// + /// + /// + /// [OperateLog(LogName = "处理付款")] [UnitOfWork(SharedToCap = true)] Task ProcessPayingAsync(long transactionLogId, long customerId, decimal amount); + /// + /// 分页列表 + /// + /// + /// Task>> GetPagedAsync(CustomerSearchPagedDto search); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/Caching/CacheService.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/Caching/CacheService.cs index d03f205c7..ab04fb988 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/Caching/CacheService.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/Caching/CacheService.cs @@ -2,7 +2,9 @@ public sealed class CacheService : AbstractCacheService, ICachePreheatable { - public CacheService(Lazy cacheProvider, Lazy serviceProvider) + public CacheService( + Lazy cacheProvider, + Lazy serviceProvider) : base(cacheProvider, serviceProvider) { } diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/GlobalUsings.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/GlobalUsings.cs index 6fd2b4056..84dbfbb51 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/GlobalUsings.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/GlobalUsings.cs @@ -5,8 +5,10 @@ global using Adnc.Infra.Caching; global using Adnc.Infra.Caching.Configurations; global using Adnc.Infra.EventBus; +global using Adnc.Infra.Helper; global using Adnc.Infra.IdGenerater.Yitter; global using Adnc.Infra.IRepositories; +global using Adnc.Infra.Mapper; global using Adnc.Shared.Application.BloomFilter; global using Adnc.Shared.Application.Caching; global using Adnc.Shared.Application.Contracts.Dtos; @@ -27,4 +29,4 @@ global using MongoDB.Driver; global using System.Linq.Expressions; global using System.Net; -global using System.Reflection; \ No newline at end of file +global using System.Reflection; diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/Services/CustomerAppService.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/Services/CustomerAppService.cs index 27f080da3..4a83bad61 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/Services/CustomerAppService.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Application/Services/CustomerAppService.cs @@ -1,4 +1,8 @@ -namespace Adnc.Cus.Application.Services; +using Adnc.Cus.Application.Services.Caching; +using Adnc.Shared.Application.Channels; +using Adnc.Shared.Repository.MongoEntities; + +namespace Adnc.Cus.Application.Services; /// /// 客户管理服务 @@ -8,34 +12,32 @@ public class CustomerAppService : AbstractAppService, ICustomerAppService private readonly IEfRepository _customerRepo; private readonly IEfRepository _cusFinaceRepo; private readonly IEfRepository _cusTransactionLogRepo; + private readonly CacheService _cacheService; private readonly IEventPublisher _eventPublisher; public CustomerAppService( IEfRepository customerRepo, IEfRepository cusFinaceRepo, IEfRepository cusTransactionLogRepo, + CacheService cacheService, IEventPublisher eventPublisher) { _customerRepo = customerRepo; _cusFinaceRepo = cusFinaceRepo; _cusTransactionLogRepo = cusTransactionLogRepo; + _cacheService = cacheService; _eventPublisher = eventPublisher; } - /// - /// 注册 - /// - /// - /// public async Task> RegisterAsync(CustomerRegisterDto input) { var exists = await _customerRepo.AnyAsync(t => t.Account == input.Account); if (exists) return Problem(HttpStatusCode.Forbidden, "该账号已经存在"); - var customer = Mapper.Map(input); + var customer = Mapper.Map(input, IdGenerater.GetNextId()); + customer.Password = InfraHelper.Security.MD5(customer.Password); - customer.Id = IdGenerater.GetNextId(); customer.FinanceInfo = new CustomerFinance() { Account = customer.Account, @@ -49,12 +51,6 @@ public async Task> RegisterAsync(CustomerRegisterDto i return dto; } - /// - /// 充值 - /// - /// - /// - /// public async Task>> RechargeAsync(long id, CustomerRechargeDto input) { var customer = await _customerRepo.FindAsync(id); @@ -66,10 +62,10 @@ public async Task>> RechargeAsync(long id, Custom Id = IdGenerater.GetNextId(), CustomerId = customer.Id, Account = customer.Account, - ExchangeType = ExchangeTypeEnum.Recharge, + ExchangeType = ExchangeBehavior.Recharge, Remark = "", Amount = input.Amount, - ExchageStatus = ExchageStatusEnum.Processing + ExchageStatus = ExchageStatus.Processing }; await _cusTransactionLogRepo.InsertAsync(cusTransactionLog); @@ -82,12 +78,6 @@ public async Task>> RechargeAsync(long id, Custom return new SimpleDto(cusTransactionLog.Id.ToString()); } - /// - /// 处理充值 - /// - /// - /// - /// public async Task ProcessRechargingAsync(CustomerRechargedEvent eventDto, IMessageTracker tracker) { var customerId = eventDto.Data.CustomerId; @@ -105,7 +95,7 @@ public async Task ProcessRechargingAsync(CustomerRechargedEvent ev finance.Balance = newBalance; await _cusFinaceRepo.UpdateAsync(finance); - transLog.ExchageStatus = ExchageStatusEnum.Finished; + transLog.ExchageStatus = ExchageStatus.Finished; transLog.ChangingAmount = originalBalance; transLog.ChangedAmount = newBalance; await _cusTransactionLogRepo.UpdateAsync(transLog); @@ -114,13 +104,6 @@ public async Task ProcessRechargingAsync(CustomerRechargedEvent ev return AppSrvResult(); } - /// - /// 处理付款 - /// - /// - /// - /// - /// public async Task ProcessPayingAsync(long transactionLogId, long customerId, decimal amount) { var transLog = await _cusTransactionLogRepo.FindAsync(transactionLogId); @@ -145,8 +128,8 @@ public async Task ProcessPayingAsync(long transactionLogId, long c ChangingAmount = originalBalance, Amount = 0 - amount, ChangedAmount = newBalance, - ExchangeType = ExchangeTypeEnum.Order, - ExchageStatus = ExchageStatusEnum.Finished + ExchangeType = ExchangeBehavior.Order, + ExchageStatus = ExchageStatus.Finished }; await _cusTransactionLogRepo.InsertAsync(transLog); @@ -155,11 +138,6 @@ public async Task ProcessPayingAsync(long transactionLogId, long c return AppSrvResult(); } - /// - /// 分页列表 - /// - /// - /// public async Task>> GetPagedAsync(CustomerSearchPagedDto search) { var whereCondition = ExpressionCreator diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerConfig.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerConfig.cs index cf9b5e37e..62eab8494 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerConfig.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerConfig.cs @@ -1,21 +1,16 @@ -using Microsoft.EntityFrameworkCore; +namespace Adnc.Cus.Entities.Config; -namespace Adnc.Cus.Entities.Config; - -public class CustomerConfig : EntityTypeConfiguration +public class CustomerConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { base.Configure(builder); builder.HasOne(d => d.FinanceInfo).WithOne(p => p.Customer).HasForeignKey(d => d.Id).OnDelete(DeleteBehavior.Cascade); - builder.HasMany(d => d.TransactionLogs).WithOne().HasForeignKey(p => p.CustomerId).OnDelete(DeleteBehavior.Cascade); - - builder.Property(x => x.Account).IsRequired().HasMaxLength(CustConsts.Account_MaxLength); - - builder.Property(x => x.Nickname).IsRequired().HasMaxLength(CustConsts.Nickname_MaxLength); - - builder.Property(x => x.Realname).IsRequired().HasMaxLength(CustConsts.Realname_Maxlength); + builder.Property(x => x.Account).IsRequired().HasMaxLength(CustomerConsts.Account_MaxLength); + builder.Property(x => x.Password).IsRequired().HasMaxLength(CustomerConsts.Password_Maxlength); + builder.Property(x => x.Nickname).IsRequired().HasMaxLength(CustomerConsts.Nickname_MaxLength); + builder.Property(x => x.Realname).IsRequired().HasMaxLength(CustomerConsts.Realname_Maxlength); } } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerFinanceConfig.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerFinanceConfig.cs index f7de63969..0074f1430 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerFinanceConfig.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerFinanceConfig.cs @@ -1,8 +1,6 @@ -using Microsoft.EntityFrameworkCore; +namespace Adnc.Cus.Entities.Config; -namespace Adnc.Cus.Entities.Config; - -public class CustomerFinanceConfig : EntityTypeConfiguration +public class CustomerFinanceConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerTransactionLogConfig.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerTransactionLogConfig.cs index bc1b7880d..8b13ecd95 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerTransactionLogConfig.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Config/CustomerTransactionLogConfig.cs @@ -1,8 +1,6 @@ -using Microsoft.EntityFrameworkCore; +namespace Adnc.Cus.Entities.Config; -namespace Adnc.Cus.Entities.Config; - -public class CustomerTransactionLogConfig : EntityTypeConfiguration +public class CustomerTransactionLogConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Customer.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Customer.cs index 24007d438..292813cad 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Customer.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/Customer.cs @@ -7,6 +7,8 @@ public class Customer : EfFullAuditEntity { public string Account { get; set; } + public string Password { get; set; } + public string Nickname { get; set; } public string Realname { get; set; } diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/CustomerTransactionLog.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/CustomerTransactionLog.cs index 9dbe0c3a0..e56fc1d6b 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/CustomerTransactionLog.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/CustomerTransactionLog.cs @@ -9,9 +9,9 @@ public class CustomerTransactionLog : EfBasicAuditEntity public string Account { get; set; } - public ExchangeTypeEnum ExchangeType { get; set; } + public ExchangeBehavior ExchangeType { get; set; } - public ExchageStatusEnum ExchageStatus { get; set; } + public ExchageStatus ExchageStatus { get; set; } public decimal ChangingAmount { get; set; } @@ -22,14 +22,14 @@ public class CustomerTransactionLog : EfBasicAuditEntity public string Remark { get; set; } } -public enum ExchangeTypeEnum +public enum ExchangeBehavior { Recharge = 8000 , Order = 8008 } -public enum ExchageStatusEnum +public enum ExchageStatus { Processing = 2000 , diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/EntityInfo.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/EntityInfo.cs index 86d495d5a..6da96ed62 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/EntityInfo.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/Entities/EntityInfo.cs @@ -1,19 +1,13 @@ -using System.Reflection; +namespace Adnc.Cus.Entities; -namespace Adnc.Cus.Entities; - -public class EntityInfo : Shared.Entities.AbstracSharedEntityInfo +public class EntityInfo : AbstracSharedEntityInfo { - public override IEnumerable GetEntitiesTypeInfo() - { - var assembly = typeof(EntityInfo).Assembly; - var typeList = GetEntityTypes(assembly); - return typeList.Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); - } + private readonly Assembly _assembly = typeof(EntityInfo).Assembly; + + public override IEnumerable GetEntitiesTypeInfo() => + GetEntityTypes(_assembly).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); + - public override IEnumerable GetConfigAssemblys() - { - var assembly = typeof(EntityInfo).Assembly; - return GetConfigAssemblys(assembly); - } + public override IEnumerable GetConfigAssemblys() => + GetConfigAssemblys(_assembly); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/GlobalUsings.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/GlobalUsings.cs index 471e24c7b..00f8297dc 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/GlobalUsings.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.Repository/GlobalUsings.cs @@ -1,4 +1,7 @@ global using Adnc.Infra.Entities; -global using Adnc.Infra.Entities.Config; global using Adnc.Shared.Consts.Entity.Cust; -global using Microsoft.EntityFrameworkCore.Metadata.Builders; \ No newline at end of file +global using Adnc.Shared.Repository.EfEntities; +global using Adnc.Shared.Repository.EfEntities.Config; +global using Microsoft.EntityFrameworkCore; +global using Microsoft.EntityFrameworkCore.Metadata.Builders; +global using System.Reflection; diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/AccountController.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/AccountController.cs deleted file mode 100644 index 5d1f6f3b0..000000000 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/AccountController.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Adnc.Shared.Rpc.Grpc.Messages; -using Adnc.Shared.Rpc.Grpc.Services; - -namespace Adnc.Cus.WebApi.Controllers; - -[Route("cus/session")] -[ApiController] -public class AccountController : AdncControllerBase -{ - private readonly IAuthRestClient _authRestClient; - private readonly AuthGrpc.AuthGrpcClient _authGrpcClinet; - - public AccountController(IAuthRestClient authRestClient, AuthGrpc.AuthGrpcClient authGrpcClient) - { - _authRestClient = authRestClient; - _authGrpcClinet = authGrpcClient; - } - - /// - /// for debugging purposes - /// - /// - /// - [AllowAnonymous] - [HttpPost()] - public async Task Login([FromBody] LoginInputRto input) - { - var result = await _authRestClient.LoginAsync(input); - - if (result.IsSuccessStatusCode) - return Ok(result.Content); - - return Problem(result.Error); - } - - /// - /// for debugging purposes(grpc) - /// - /// - /// - [AllowAnonymous] - [HttpPost("grpc")] - public async Task LoginGrpcAsync([FromBody] LoginRequest input) - { - var result = await _authGrpcClinet.LoginAsync(input); - - if (result.IsSuccessStatusCode && result.Content.Is(LoginReply.Descriptor)) - { - var outputDto = result.Content.Unpack(); - return Ok(outputDto); - } - return BadRequest(result); - } -} \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/CustomerController.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/CustomerController.cs index 27d958117..f717e8e87 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/CustomerController.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/CustomerController.cs @@ -1,16 +1,18 @@ -namespace Adnc.Cus.WebApi.Controllers; +using Adnc.Shared.Consts.Permissions.Cust; +using Adnc.Shared.WebApi.Authorization; + +namespace Adnc.Cus.WebApi.Controllers; /// /// 客户管理 /// -[Route("cus/customer")] +[Route("cus/customers")] [ApiController] public class CustomerController : AdncControllerBase { - private readonly ICustomerAppService _cusService; + private readonly ICustomerAppService _customerService; - public CustomerController(ICustomerAppService cusService) - => _cusService = cusService; + public CustomerController(ICustomerAppService customerService) => _customerService = customerService; /// /// 注册 @@ -18,20 +20,20 @@ public CustomerController(ICustomerAppService cusService) /// /// [HttpPost] - //[Permission("customerRegister")] + [AllowAnonymous] [ProducesResponseType(StatusCodes.Status201Created)] - public async Task> RegisterAsync([FromBody][NotNull] CustomerRegisterDto input) - => CreatedResult(await _cusService.RegisterAsync(input)); + public async Task> RegisterAsync([FromBody] CustomerRegisterDto input) => + CreatedResult(await _customerService.RegisterAsync(input)); /// - /// 充值 + /// 后台管理员给客户充值 /// /// [HttpPut("{id}/balance")] - //[Permission("customerRecharge")] + [AdncAuthorize(PermissionConsts.Customer.Recharge)] [ProducesResponseType(StatusCodes.Status200OK)] - public async Task>> RechargeAsync([FromRoute] long id, [FromBody] CustomerRechargeDto input) - => Result(await _cusService.RechargeAsync(id, input)); + public async Task>> RechargeAsync([FromRoute] long id, [FromBody] CustomerRechargeDto input) => + Result(await _customerService.RechargeAsync(id, input)); /// /// 客户分页列表 @@ -39,7 +41,8 @@ public async Task>> RechargeAsync([FromRoute] lon /// /// [HttpGet("page")] + [AdncAuthorize(PermissionConsts.Customer.GetList)] [ProducesResponseType(StatusCodes.Status200OK)] - public async Task>> GetPagedAsync([FromQuery] CustomerSearchPagedDto search) - => Result(await _cusService.GetPagedAsync(search)); + public async Task>> GetPagedAsync([FromQuery] CustomerSearchPagedDto search) => + Result(await _customerService.GetPagedAsync(search)); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/RestAndGrpcClientDemoController.cs b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/RestAndGrpcClientDemoController.cs index 2e0c4d68a..8084d8331 100644 --- a/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/RestAndGrpcClientDemoController.cs +++ b/src/ServerApi/Services/Adnc.Cus/Adnc.Cus.WebApi/Controllers/RestAndGrpcClientDemoController.cs @@ -12,28 +12,71 @@ namespace Adnc.Cus.WebApi.Controllers; [ApiController] public class RestAndGrpcClientDemoController : AdncControllerBase { + private readonly IAuthRestClient _authRestClient; private readonly IUsrRestClient _usrRestClient; private readonly IMaintRestClient _maintRestClient; private readonly IWhseRestClient _whseRestClient; + private readonly AuthGrpc.AuthGrpcClient _authGrpcClinet; private readonly UsrGrpc.UsrGrpcClient _usrGrpcClient; private readonly MaintGrpc.MaintGrpcClient _maintGrpcClient; private readonly WhseGrpc.WhseGrpcClient _whseGrpcClient; - public RestAndGrpcClientDemoController(IUsrRestClient usrRestClient - , IMaintRestClient maintRestClient - , IWhseRestClient whseRestClient - , UsrGrpc.UsrGrpcClient usrGrpcClient - , MaintGrpc.MaintGrpcClient maintGrpcClient - , WhseGrpc.WhseGrpcClient whseGrpcClient) + public RestAndGrpcClientDemoController( + IAuthRestClient authRestClient, + IUsrRestClient usrRestClient, + IMaintRestClient maintRestClient, + IWhseRestClient whseRestClient, + AuthGrpc.AuthGrpcClient authGrpcClinet, + UsrGrpc.UsrGrpcClient usrGrpcClient, + MaintGrpc.MaintGrpcClient maintGrpcClient, + WhseGrpc.WhseGrpcClient whseGrpcClient) { + _authRestClient = authRestClient; _usrRestClient = usrRestClient; _maintRestClient = maintRestClient; _whseRestClient = whseRestClient; + _authGrpcClinet = authGrpcClinet; _usrGrpcClient = usrGrpcClient; _maintGrpcClient = maintGrpcClient; _whseGrpcClient = whseGrpcClient; } + /// + /// 测试后台管理员登录-REST + /// + /// + /// + [AllowAnonymous] + [HttpPost("restsession")] + public async Task Login([FromBody] LoginInputRto input) + { + var result = await _authRestClient.LoginAsync(input); + + if (result.IsSuccessStatusCode) + return Ok(result.Content); + + return Problem(result.Error); + } + + /// + /// 测试后台管理员登录-GRPC + /// + /// + /// + [AllowAnonymous] + [HttpPost("grpcsession")] + public async Task LoginGrpcAsync([FromBody] LoginRequest input) + { + var result = await _authGrpcClinet.LoginAsync(input); + + if (result.IsSuccessStatusCode && result.Content.Is(LoginReply.Descriptor)) + { + var outputDto = result.Content.Unpack(); + return Ok(outputDto); + } + return BadRequest(result); + } + /// /// 测试Basic(Rest)认证,获取用户服务部门列表 /// diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/AutoMapper/MaintProfile.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/AutoMapper/MaintProfile.cs index 5e67cd987..55a2b50ae 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/AutoMapper/MaintProfile.cs +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/AutoMapper/MaintProfile.cs @@ -10,7 +10,7 @@ public MaintProfile() CreateMap(); CreateMap(); CreateMap(); - CreateMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap(); diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/GlobalUsings.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/GlobalUsings.cs index 446d38375..38ded61bc 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/GlobalUsings.cs +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/GlobalUsings.cs @@ -1,7 +1,5 @@ global using Adnc.Infra.Caching; global using Adnc.Infra.Caching.Configurations; -global using Adnc.Infra.Core.Configuration; -global using Adnc.Infra.Entities; global using Adnc.Infra.EventBus.RabbitMq; global using Adnc.Infra.IdGenerater.Yitter; global using Adnc.Infra.IRepositories; @@ -16,6 +14,7 @@ global using Adnc.Shared.Application.Services; global using Adnc.Shared.Consts.Caching.Maint; global using Adnc.Shared.Consts.Mq; +global using Adnc.Shared.Repository.MongoEntities; global using Adnc.Shared.Rpc; global using Adnc.Shared.Rpc.Rest.Services; global using AutoMapper; diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/Services/LogAppService.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/Services/LogAppService.cs index 3218d129b..d95cf9908 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/Services/LogAppService.cs +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Application/Services/LogAppService.cs @@ -3,12 +3,12 @@ public class LogAppService : AbstractAppService, ILogAppService { private readonly IMongoRepository _opsLogRepository; - private readonly IMongoRepository _nlogLogRepository; + private readonly IMongoRepository _nlogLogRepository; private readonly IMongoRepository _loginLogRepository; public LogAppService(IMongoRepository opsLogRepository , IMongoRepository loginLogRepository - , IMongoRepository nlogLogRepository) + , IMongoRepository nlogLogRepository) { _opsLogRepository = opsLogRepository; _loginLogRepository = loginLogRepository; @@ -49,8 +49,8 @@ public async Task> GetOpsLogsPagedAsync(LogSearchPagedDt public async Task> GetNlogLogsPagedAsync(LogSearchPagedDto searchDto) { - var builder = Builders.Filter; - var filterList = new List>(); + var builder = Builders.Filter; + var filterList = new List>(); filterList.AddIf(x => searchDto.BeginTime.HasValue, builder.Gte(l => l.Date, searchDto.BeginTime)); filterList.AddIf(x => searchDto.EndTime.HasValue, builder.Lte(l => l.Date, searchDto.EndTime)); filterList.AddIf(x => searchDto.Method.IsNotNullOrWhiteSpace(), builder.Eq(l => l.Properties.Method, searchDto.Method)); diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Adnc.Maint.Repository.csproj b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Adnc.Maint.Repository.csproj index be8fd4a23..ca0e65b9d 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Adnc.Maint.Repository.csproj +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Adnc.Maint.Repository.csproj @@ -5,6 +5,7 @@ + \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/CfgConfig.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/CfgConfig.cs index 141289104..2081d2df9 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/CfgConfig.cs +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/CfgConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Maint.Entities.Config; -public class CfgConfig : EntityTypeConfiguration +public class CfgConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/DictConfig.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/DictConfig.cs index 29b3e9944..5374facbf 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/DictConfig.cs +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/DictConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Maint.Entities.Config; -public class DictConfig : EntityTypeConfiguration +public class DictConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/NoticeConfig.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/NoticeConfig.cs index a4818d47c..ff29475b2 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/NoticeConfig.cs +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/Config/NoticeConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Maint.Entities.Config; -public class NoticeConfig : EntityTypeConfiguration +public class NoticeConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/EntityInfo.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/EntityInfo.cs index 684d9421d..b556e9d6f 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/EntityInfo.cs +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/Entities/EntityInfo.cs @@ -1,16 +1,13 @@ -using System.Reflection; +namespace Adnc.Maint.Entities; -namespace Adnc.Maint.Entities; - -public class EntityInfo : AbstractEntityInfo +public class EntityInfo : AbstracSharedEntityInfo { - public override IEnumerable GetEntitiesTypeInfo() - { - return GetEntityTypes(this.GetType().Assembly).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); - } + private readonly Assembly _assembly = typeof(EntityInfo).Assembly; + + public override IEnumerable GetEntitiesTypeInfo() => + GetEntityTypes(_assembly, false).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); + - public override IEnumerable GetConfigAssemblys() - { - return new List { this.GetType().Assembly }; - } + public override IEnumerable GetConfigAssemblys() => + GetConfigAssemblys(_assembly, false); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/GlobalUsings.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/GlobalUsings.cs index 3a539baf3..b08be0c5d 100644 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/GlobalUsings.cs +++ b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.Repository/GlobalUsings.cs @@ -1,5 +1,6 @@ global using Adnc.Infra.Entities; -global using Adnc.Infra.Entities.Config; global using Adnc.Shared.Consts.Entity.Maint; +global using Adnc.Shared.Repository.EfEntities; +global using Adnc.Shared.Repository.EfEntities.Config; global using Microsoft.EntityFrameworkCore.Metadata.Builders; - +global using System.Reflection; diff --git a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.WebApi/Controllers/AccountController.cs b/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.WebApi/Controllers/AccountController.cs deleted file mode 100644 index 8ccf714c2..000000000 --- a/src/ServerApi/Services/Adnc.Maint/Adnc.Maint.WebApi/Controllers/AccountController.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Adnc.Shared.Rpc.Rest.Rtos; -using Adnc.Shared.Rpc.Rest.Services; - -namespace Adnc.Maint.WebApi.Controllers; - -[Route("maint/session")] -[ApiController] -public class AccountController : AdncControllerBase -{ - private readonly IAuthRestClient _authRestClient; - - public AccountController(IAuthRestClient authRestClinet) => _authRestClient = authRestClinet; - - /// - /// for debugging purposes(rest) - /// - /// - /// - [AllowAnonymous] - [HttpPost()] - public async Task LoginRestAsync([FromBody] LoginInputRto input) - { - var result = await _authRestClient.LoginAsync(input); - - if (result.IsSuccessStatusCode) - return Ok(result.Content); - - return Problem(result.Error); - } -} \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/EntityInfo.cs b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/EntityInfo.cs index b9fb2f726..2ed1b9183 100644 --- a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/EntityInfo.cs +++ b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/EntityInfo.cs @@ -1,16 +1,12 @@ -using System.Reflection; - -namespace Adnc.Ord.Domain.EntityConfig; +namespace Adnc.Ord.Domain.EntityConfig; public class EntityInfo : AbstractDomainEntityInfo { - public override IEnumerable GetConfigAssemblys() - { - return GetConfigAssemblys(this.GetType().Assembly); - } + private readonly Assembly _assembly = typeof(EntityInfo).Assembly; + + public override IEnumerable GetConfigAssemblys() => + GetConfigAssemblys(_assembly); - public override IEnumerable GetEntitiesTypeInfo() - { - return GetEntityTypes(this.GetType().Assembly).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); - } + public override IEnumerable GetEntitiesTypeInfo() => + GetEntityTypes(_assembly).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/OrderConfig.cs b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/OrderConfig.cs index ef4b6def0..453664dd4 100644 --- a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/OrderConfig.cs +++ b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/OrderConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Ord.Domain.EntityConfig; -public class OrderConfig : EntityTypeConfiguration +public class OrderConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/OrderItemConfig.cs b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/OrderItemConfig.cs index 32f16f1cc..ef300a755 100644 --- a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/OrderItemConfig.cs +++ b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/EntityConfig/OrderItemConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Ord.Domain.EntityConfig; -public class OrderItemConfig : EntityTypeConfiguration +public class OrderItemConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/GlobalUsings.cs b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/GlobalUsings.cs index 60b514f37..d0e9867f6 100644 --- a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/GlobalUsings.cs +++ b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.Domain/GlobalUsings.cs @@ -1,6 +1,5 @@ global using Adnc.Infra.Core.Guard; global using Adnc.Infra.Entities; -global using Adnc.Infra.Entities.Config; global using Adnc.Infra.IdGenerater.Yitter; global using Adnc.Infra.IRepositories; global using Adnc.Ord.Domain.Aggregates.OrderAggregate; @@ -8,8 +7,9 @@ global using Adnc.Shared.Domain; global using Adnc.Shared.Domain.Entities; global using Adnc.Shared.Events; +global using Adnc.Shared.Repository.EfEntities.Config; global using Microsoft.EntityFrameworkCore; global using Microsoft.EntityFrameworkCore.Metadata.Builders; - +global using System.Reflection; diff --git a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.WebApi/Controllers/AccountController.cs b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.WebApi/Controllers/AccountController.cs deleted file mode 100644 index d38ecb816..000000000 --- a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.WebApi/Controllers/AccountController.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Adnc.Ord.WebApi.Controllers; - -[Route("ord/session")] -[ApiController] -public class AccountController : AdncControllerBase -{ - private readonly IAuthRestClient _authRestClient; - - public AccountController(IAuthRestClient authRestClient) => _authRestClient = authRestClient; - - /// - /// for debugging purposes - /// - /// - /// - [AllowAnonymous] - [HttpPost()] - public async Task Login([FromBody] LoginInputRto input) - { - var result = await _authRestClient.LoginAsync(input); - - if (result.IsSuccessStatusCode) - return Ok(result.Content); - - return Problem(result.Error); - } -} \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.WebApi/Controllers/OrderController.cs b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.WebApi/Controllers/OrderController.cs index a316d6b14..6ad9366e5 100644 --- a/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.WebApi/Controllers/OrderController.cs +++ b/src/ServerApi/Services/Adnc.Ord/Adnc.Ord.WebApi/Controllers/OrderController.cs @@ -24,7 +24,7 @@ public class OrderController : AdncControllerBase /// /// /// - [HttpPatch("{id}/payment")] + [HttpPut("{id}/payment")] public async Task PayAsync([FromRoute] long id) { await _orderSrv.PayAsync(id); @@ -36,7 +36,7 @@ public async Task PayAsync([FromRoute] long id) /// /// s /// - [HttpPatch("{id}/status/canceler")] + [HttpPut("{id}/status/canceler")] public async Task CancelAsync([FromRoute] long id) { await _orderSrv.CancelAsync(id); @@ -68,6 +68,6 @@ public async Task DeleteAsync([FromRoute] long id) /// /// /// - [HttpGet] + [HttpGet("page")] public async Task>> GetPagedAsync([FromQuery] OrderSearchPagedDto search) => await _orderSrv.GetPagedAsync(search); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Dtos/User/UserValidateDto.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Dtos/User/UserValidatedInfoDto.cs similarity index 100% rename from src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Dtos/User/UserValidateDto.cs rename to src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Dtos/User/UserValidatedInfoDto.cs diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Services/IAccountAppService.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Services/IAccountAppService.cs index be0316828..f5fff11c6 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Services/IAccountAppService.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Services/IAccountAppService.cs @@ -28,7 +28,7 @@ public interface IAccountAppService : IAppService /// /// /// - [OperateLog(LogName = "获取认证信息")] + //[OperateLog(LogName = "获取认证信息")] [CachingAble(CacheKeyPrefix = CachingConsts.UserValidatedInfoKeyPrefix)] Task GetUserValidatedInfoAsync([CachingParam] long id) => Task.FromResult(null); diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Services/IUserAppService.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Services/IUserAppService.cs index 23b351357..20da98f08 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Services/IUserAppService.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application.Contracts/Services/IUserAppService.cs @@ -70,7 +70,7 @@ public interface IUserAppService : IAppService /// /// /// - [OperateLog(LogName = "获取当前用户是否拥有指定权限")] + //[OperateLog(LogName = "获取当前用户是否拥有指定权限")] Task> GetPermissionsAsync(long userId, IEnumerable requestPermissions, string userBelongsRoleIds); /// diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application/Caching/CacheService.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application/Caching/CacheService.cs index 07703b281..7f085d176 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application/Caching/CacheService.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application/Caching/CacheService.cs @@ -4,9 +4,14 @@ public sealed class CacheService : AbstractCacheService, ICachePreheatable { private readonly Lazy> _jwtConfig; - public CacheService(Lazy cacheProvider, Lazy serviceProvider, Lazy> jwtConfig) + public CacheService( + Lazy cacheProvider, + Lazy serviceProvider, + Lazy> jwtConfig) : base(cacheProvider, serviceProvider) - => _jwtConfig = jwtConfig; + { + _jwtConfig = jwtConfig; + } public override async Task PreheatAsync() { diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application/GlobalUsings.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application/GlobalUsings.cs index d26730148..3b83f945a 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application/GlobalUsings.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Application/GlobalUsings.cs @@ -1,7 +1,6 @@ global using Adnc.Infra.Caching; global using Adnc.Infra.Caching.Configurations; global using Adnc.Infra.Core.Configuration; -global using Adnc.Infra.Entities; global using Adnc.Infra.Helper; global using Adnc.Infra.IdGenerater.Yitter; global using Adnc.Infra.IRepositories; @@ -12,6 +11,7 @@ global using Adnc.Shared.Application.Contracts.ResultModels; global using Adnc.Shared.Application.Services; global using Adnc.Shared.Consts.Caching.Usr; +global using Adnc.Shared.Repository.MongoEntities; global using Adnc.Usr.Application.Caching; global using Adnc.Usr.Application.Contracts.Dtos; global using Adnc.Usr.Application.Contracts.Services; @@ -24,4 +24,3 @@ global using System.Net; global using System.Reflection; - diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Adnc.Usr.Repository.csproj b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Adnc.Usr.Repository.csproj index 8449f91ee..ecc54fb0b 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Adnc.Usr.Repository.csproj +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Adnc.Usr.Repository.csproj @@ -5,6 +5,7 @@ + diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/DeptConfig.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/DeptConfig.cs index 76bb85e4b..bac1c1c71 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/DeptConfig.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/DeptConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Usr.Entities.Config; -public class DetpConfig : EntityTypeConfiguration +public class DetpConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/MenuConfig.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/MenuConfig.cs index 835c85953..ba4d24064 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/MenuConfig.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/MenuConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Usr.Repository.Entities.Config; -public class MenuConfig : EntityTypeConfiguration +public class MenuConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/RelationConfig.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/RelationConfig.cs index 8ce93eb93..26bca28ea 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/RelationConfig.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/RelationConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Usr.Repository.Entities.Config; -public class RelationConfig : EntityTypeConfiguration +public class RelationConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/RoleConfig.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/RoleConfig.cs index e42713f8a..0d3eeb03b 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/RoleConfig.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/RoleConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Usr.Repository.Entities.Config; -public class RoleConfig : EntityTypeConfiguration +public class RoleConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/UserConfig.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/UserConfig.cs index de0b75ee3..7abdbee20 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/UserConfig.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/Config/UserConfig.cs @@ -1,6 +1,6 @@ namespace Adnc.Usr.Repository.Entities.Config; -public class UserConfig : EntityTypeConfiguration +public class UserConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/EntityInfo.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/EntityInfo.cs index 9eda7147f..003bd8f7a 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/EntityInfo.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/Entities/EntityInfo.cs @@ -1,16 +1,13 @@ -using System.Reflection; +namespace Adnc.Usr.Entities; -namespace Adnc.Usr.Entities; - -public class EntityInfo : AbstractEntityInfo +public class EntityInfo : AbstracSharedEntityInfo { - public override IEnumerable GetEntitiesTypeInfo() - { - return GetEntityTypes(this.GetType().Assembly).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); - } + private readonly Assembly _assembly = typeof(EntityInfo).Assembly; + + public override IEnumerable GetEntitiesTypeInfo() => + GetEntityTypes(_assembly, false).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); + - public override IEnumerable GetConfigAssemblys() - { - return new List { this.GetType().Assembly }; - } + public override IEnumerable GetConfigAssemblys() => + GetConfigAssemblys(_assembly, false); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/GlobalUsings.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/GlobalUsings.cs index 98b206c22..caf7ca452 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/GlobalUsings.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.Repository/GlobalUsings.cs @@ -1,9 +1,10 @@ global using Adnc.Infra.Entities; -global using Adnc.Infra.Entities.Config; global using Adnc.Infra.IRepositories; global using Adnc.Shared.Consts.Entity.Usr; +global using Adnc.Shared.Repository.EfEntities; +global using Adnc.Shared.Repository.EfEntities.Config; global using Adnc.Usr.Entities; global using Microsoft.EntityFrameworkCore; global using Microsoft.EntityFrameworkCore.Metadata.Builders; global using System.Collections.ObjectModel; - +global using System.Reflection; diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.WebApi/Controllers/AccountController.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.WebApi/Controllers/AccountController.cs index c5528b49c..7dcf22c21 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.WebApi/Controllers/AccountController.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.WebApi/Controllers/AccountController.cs @@ -39,7 +39,7 @@ public async Task> LoginAsync([FromBody] UserLogi if (result.IsSuccess) { var validatedInfo = result.Content; - var accessToken = JwtTokenHelper.CreateAccessToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Account, validatedInfo.Id.ToString(), validatedInfo.Name, validatedInfo.RoleIds); + var accessToken = JwtTokenHelper.CreateAccessToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Account, validatedInfo.Id.ToString(), validatedInfo.Name, validatedInfo.RoleIds, JwtBearerDefaults.Manager); var refreshToken = JwtTokenHelper.CreateRefreshToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Id.ToString()); var tokenInfo = new UserTokenInfoDto(accessToken.Token, accessToken.Expire, refreshToken.Token, refreshToken.Expire); return Created($"/auth/session", tokenInfo); @@ -79,7 +79,7 @@ public async Task> RefreshAccessTokenAsync([FromB if (jti.Value != validatedInfo.ValidationVersion) return Forbid(); - var accessToken = JwtTokenHelper.CreateAccessToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Account, validatedInfo.Id.ToString(), validatedInfo.Name, validatedInfo.RoleIds); + var accessToken = JwtTokenHelper.CreateAccessToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Account, validatedInfo.Id.ToString(), validatedInfo.Name, validatedInfo.RoleIds, JwtBearerDefaults.Manager); var refreshToken = JwtTokenHelper.CreateRefreshToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Id.ToString()); await _accountService.ChangeUserValidateInfoExpiresDtAsync(id.Value); diff --git a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.WebApi/Grpc/AuthGrpcServer.cs b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.WebApi/Grpc/AuthGrpcServer.cs index 6bd9d1abc..5976ef561 100644 --- a/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.WebApi/Grpc/AuthGrpcServer.cs +++ b/src/ServerApi/Services/Adnc.Usr/Adnc.Usr.WebApi/Grpc/AuthGrpcServer.cs @@ -37,7 +37,7 @@ public override async Task Login(LoginRequest request, ServerCallC var validatedInfo = loginResult.Content; var loginReply = new LoginReply { - Token = JwtTokenHelper.CreateAccessToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Account, validatedInfo.Id.ToString(), validatedInfo.Name, validatedInfo.RoleIds).Token, + Token = JwtTokenHelper.CreateAccessToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Account, validatedInfo.Id.ToString(), validatedInfo.Name, validatedInfo.RoleIds, JwtBearerDefaults.Manager).Token, RefreshToken = JwtTokenHelper.CreateRefreshToken(_jwtOptions.Value, validatedInfo.ValidationVersion, validatedInfo.Id.ToString()).Token }; grpcResponse.Content = Any.Pack(loginReply); diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Application/Services/ProductAppService.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Application/Services/ProductAppService.cs index 4c7b87f18..c34883198 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Application/Services/ProductAppService.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Application/Services/ProductAppService.cs @@ -91,9 +91,9 @@ public async Task ChangePriceAsync(long id, ProducChangePriceDto inp public async Task PutOnSaleAsync(long id, ProductPutOnSaleDto input) { var product = await _productRepo.GetAsync(id); - var warehouseInfo = await _warehouseInfoRepo.Where(x => x.ProductId == id).FirstOrDefaultAsync(); + //var warehouseInfo = await _warehouseInfoRepo.Where(x => x.ProductId == id).FirstOrDefaultAsync(); - _productMgr.PutOnSale(product, warehouseInfo, input.Reason); + _productMgr.PutOnSale(product, input.Reason); await _productRepo.UpdateAsync(product); diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Application/Services/WarehouseAppService.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Application/Services/WarehouseAppService.cs index a641242b9..84c622aac 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Application/Services/WarehouseAppService.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Application/Services/WarehouseAppService.cs @@ -51,9 +51,8 @@ public async Task CreateAsync(WarehouseCreationDto input) public async Task AllocateShelfToProductAsync(long warehouseId, WarehouseAllocateToProductDto input) { var warehouse = await _warehouseRepo.GetAsync(warehouseId); - var product = await _productRepo.GetAsync(input.ProductId); - await _warehouseManager.AllocateShelfToProductAsync(warehouse, product); + await _warehouseManager.AllocateShelfToProductAsync(warehouse, input.ProductId); await _warehouseRepo.UpdateAsync(warehouse); @@ -106,9 +105,9 @@ public async Task BlockQtyAsync(OrderCreatedEvent eventDto, IMessageTracker trac { var blockQtyProductsInfo = eventDto.Data.Products.ToDictionary(x => x.ProductId, x => x.Qty); var warehouses = await _warehouseRepo.Where(x => blockQtyProductsInfo.Keys.Contains(x.ProductId.Value), noTracking: false).ToListAsync(); - var products = await _productRepo.Where(x => blockQtyProductsInfo.Keys.Contains(x.Id)).ToListAsync(); + // var products = await _productRepo.Where(x => blockQtyProductsInfo.Keys.Contains(x.Id)).ToListAsync(); - var result = await _warehouseManager.BlockQtyAsync(eventDto.Data.OrderId, blockQtyProductsInfo, warehouses, products); + var result = await _warehouseManager.BlockQtyAsync(eventDto.Data.OrderId, blockQtyProductsInfo, warehouses); //库存都符合锁定条件才能批量更新数据库 if (result) diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Aggregates/ProductAggregate/ProductStatusCodes.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Aggregates/ProductStatusCodes.cs similarity index 63% rename from src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Aggregates/ProductAggregate/ProductStatusCodes.cs rename to src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Aggregates/ProductStatusCodes.cs index bd27dd54e..298bf78b8 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Aggregates/ProductAggregate/ProductStatusCodes.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Aggregates/ProductStatusCodes.cs @@ -1,4 +1,4 @@ -namespace Adnc.Whse.Domain.Aggregates.ProductAggregate; +namespace Adnc.Whse.Domain.Aggregates; public enum ProductStatusCodes { diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/EntityInfo.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/EntityInfo.cs index c4f4af0c8..e4644d475 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/EntityInfo.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/EntityInfo.cs @@ -1,16 +1,12 @@ -using System.Reflection; - -namespace Adnc.Whse.Domain.EntityConfig; +namespace Adnc.Whse.Domain.EntityConfig; public class EntityInfo : AbstractDomainEntityInfo { - public override IEnumerable GetConfigAssemblys() - { - return GetConfigAssemblys(this.GetType().Assembly); - } + private readonly Assembly _assembly = typeof(EntityInfo).Assembly; + + public override IEnumerable GetConfigAssemblys() => + GetConfigAssemblys(_assembly); - public override IEnumerable GetEntitiesTypeInfo() - { - return GetEntityTypes(this.GetType().Assembly).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); - } + public override IEnumerable GetEntitiesTypeInfo() => + GetEntityTypes(_assembly).Select(x => new EntityTypeInfo() { Type = x, DataSeeding = default }); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/ProductConfig.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/ProductConfig.cs index 2f0bb503f..1eff6095e 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/ProductConfig.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/ProductConfig.cs @@ -1,6 +1,8 @@ -namespace Adnc.Whse.Domain.EntityConfig; +using Adnc.Whse.Domain.Aggregates.ProductAggregate; -public class ProductConfig : EntityTypeConfiguration +namespace Adnc.Whse.Domain.EntityConfig; + +public class ProductConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/WarehouseConfig.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/WarehouseConfig.cs index 730598104..9555136ba 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/WarehouseConfig.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/EntityConfig/WarehouseConfig.cs @@ -1,6 +1,8 @@ -namespace Adnc.Whse.Domain.EntityConfig; +using Adnc.Whse.Domain.Aggregates.WarehouseAggregate; -public class WarehouseConfig : EntityTypeConfiguration +namespace Adnc.Whse.Domain.EntityConfig; + +public class WarehouseConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/GlobalUsings.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/GlobalUsings.cs index 76ac8fb6d..2b06f8551 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/GlobalUsings.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/GlobalUsings.cs @@ -1,17 +1,14 @@ global using Adnc.Infra.Core.Exceptions; global using Adnc.Infra.Core.Guard; global using Adnc.Infra.Entities; -global using Adnc.Infra.Entities.Config; global using Adnc.Infra.IdGenerater.Yitter; global using Adnc.Infra.IRepositories; global using Adnc.Shared.Consts.Entity.Whse; global using Adnc.Shared.Domain; global using Adnc.Shared.Domain.Entities; global using Adnc.Shared.Events; -global using Adnc.Whse.Domain.Aggregates.ProductAggregate; -global using Adnc.Whse.Domain.Aggregates.WarehouseAggregate; +global using Adnc.Shared.Repository.EfEntities.Config; global using Microsoft.EntityFrameworkCore; global using Microsoft.EntityFrameworkCore.Metadata.Builders; - - +global using System.Reflection; diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Services/ProductManager.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Services/ProductManager.cs index 03fc7d610..38cf667e0 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Services/ProductManager.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Services/ProductManager.cs @@ -1,4 +1,7 @@ -namespace Adnc.Whse.Domain.Services; +using Adnc.Whse.Domain.Aggregates; +using Adnc.Whse.Domain.Aggregates.ProductAggregate; + +namespace Adnc.Whse.Domain.Services; public class ProductManager : IDomainService { @@ -79,17 +82,15 @@ public virtual async Task ChangeNameAsync(Product product, string newName) /// 上架商品 /// /// - /// /// /// - public virtual void PutOnSale(Product product, Warehouse warehouseInfo, string reason) + public virtual void PutOnSale(Product product, string reason) { Guard.Checker.NotNull(product, nameof(product)); - Guard.Checker.NotNull(warehouseInfo, nameof(warehouseInfo)); - - if (warehouseInfo.Qty > 0 && warehouseInfo.ProductId == product.Id) - product.SetStatus(new ProductStatus(ProductStatusCodes.SaleOn, reason)); - else - throw new BusinessException($"product exists{product.Id}"); + product.SetStatus(new ProductStatus(ProductStatusCodes.SaleOn, reason)); + //if (warehouseInfo.Qty > 0 && warehouseInfo.ProductId == product.Id) + // product.SetStatus(new ProductStatus(ProductStatusCodes.SaleOn, reason)); + //else + // throw new BusinessException($"product exists{product.Id}"); } } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Services/WarehouseManager.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Services/WarehouseManager.cs index 2a2a7a122..9a310a6a9 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Services/WarehouseManager.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.Domain/Services/WarehouseManager.cs @@ -1,4 +1,7 @@ -namespace Adnc.Whse.Domain.Services; +using Adnc.Whse.Domain.Aggregates; +using Adnc.Whse.Domain.Aggregates.WarehouseAggregate; + +namespace Adnc.Whse.Domain.Services; public class WarehouseManager : IDomainService { @@ -29,20 +32,19 @@ public async Task CreateAsync(string positionCode, string positionDes /// 分配货架给商品 /// /// - /// + /// /// - public async Task AllocateShelfToProductAsync(Warehouse warehouse, Product product) + public async Task AllocateShelfToProductAsync(Warehouse warehouse, long productId) { Guard.Checker.NotNull(warehouse, nameof(warehouse)); - Guard.Checker.NotNull(product, nameof(product)); - var existWarehouse = await _warehouseRepo.Where(x => x.ProductId == product.Id).SingleOrDefaultAsync(); + var existWarehouse = await _warehouseRepo.Where(x => x.ProductId == productId).SingleOrDefaultAsync(); //一个商品只能分配一个货架,但可以调整货架。 if (existWarehouse != null && existWarehouse.Id != warehouse.Id) - throw new BusinessException($"exist warehouse ({product.Id})"); + throw new BusinessException($"exist warehouse ({productId})"); - warehouse.SetProductId(product.Id); + warehouse.SetProductId(productId); } /// @@ -51,16 +53,14 @@ public async Task AllocateShelfToProductAsync(Warehouse warehouse, Product produ /// /// /// - /// /// - public async Task BlockQtyAsync(long orderId, Dictionary blockQtyProductsInfo, List warehouses, List products) + public async Task BlockQtyAsync(long orderId, Dictionary blockQtyProductsInfo, List warehouses) { bool isSuccess = false; string remark = string.Empty; Guard.Checker.NotNullOrAny(blockQtyProductsInfo, nameof(blockQtyProductsInfo)); Guard.Checker.NotNullOrAny(warehouses, nameof(warehouses)); - Guard.Checker.NotNullOrAny(products, nameof(products)); if (orderId <= 0) remark += $"{orderId}订单号错误"; @@ -68,8 +68,6 @@ public async Task BlockQtyAsync(long orderId, Dictionary blockQ remark += $"商品数量为空"; else if (warehouses.Count == 0) remark += $"仓储数量为空"; - else if (products.Count == 0) - remark += remark + $"产品数量为空"; else if (warehouses.Count != blockQtyProductsInfo.Count) remark += remark + $"商品数量与库存数量不一致"; else @@ -79,18 +77,9 @@ public async Task BlockQtyAsync(long orderId, Dictionary blockQ //这里需要捕获业务逻辑的异常 foreach (var productId in blockQtyProductsInfo.Keys) { - var product = products.FirstOrDefault(x => x.Id == productId); - - if (product == null) - remark += $"{productId}已经被删除;"; - else if (product.Status.Code != ProductStatusCodes.SaleOn) - remark += $"{productId}已经下架;"; - else - { - var needBlockQty = blockQtyProductsInfo[productId]; - var warehouse = warehouses.FirstOrDefault(x => x.ProductId == productId); - warehouse.BlockQty(needBlockQty); - } + var needBlockQty = blockQtyProductsInfo[productId]; + var warehouse = warehouses.FirstOrDefault(x => x.ProductId == productId); + warehouse.BlockQty(needBlockQty); } } catch (Exception ex) diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/AccountController.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/AccountController.cs deleted file mode 100644 index 21d955859..000000000 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/AccountController.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Adnc.Shared.Rpc.Rest.Rtos; -using Adnc.Shared.Rpc.Rest.Services; - -namespace Adnc.Whse.WebApi.Controllers; - -[Route("whse/session")] -[ApiController] -public class AccountController : AdncControllerBase -{ - private readonly IAuthRestClient _authRestClient; - - public AccountController(IAuthRestClient authRestClient) => _authRestClient = authRestClient; - - /// - /// for debugging purposes - /// - /// - /// - [AllowAnonymous] - [HttpPost()] - public async Task Login([FromBody] LoginInputRto input) - { - var result = await _authRestClient.LoginAsync(input); - - if (result.IsSuccessStatusCode) - return Ok(result.Content); - - return Problem(result.Error); - } -} \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/ProductController.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/ProductController.cs index e06b94349..50ff1f748 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/ProductController.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/ProductController.cs @@ -32,7 +32,7 @@ public class ProductController : AdncControllerBase /// /// /// - [HttpPatch("{id}/price")] + [HttpPut("{id}/price")] public async Task> ChangePriceAsync([FromRoute] long id, ProducChangePriceDto input) => await _productSrv.ChangePriceAsync(id, input); /// @@ -41,7 +41,7 @@ public class ProductController : AdncControllerBase /// /// /// - [HttpPatch("{id}/status/1001")] + [HttpPut("{id}/status/1001")] public async Task> PutOnSaleAsync([FromRoute] long id, ProductPutOnSaleDto input) => await _productSrv.PutOnSaleAsync(id, input); /// @@ -50,7 +50,7 @@ public class ProductController : AdncControllerBase /// /// /// - [HttpPatch("{id}/status/1002")] + [HttpPut("{id}/status/1002")] public async Task> PutOffSaleAsync([FromRoute] long id, ProductPutOffSaleDto input) => await _productSrv.PutOffSaleAsync(id, input); /// @@ -66,6 +66,6 @@ public class ProductController : AdncControllerBase /// /// /// - [HttpGet("paged")] + [HttpGet("page")] public async Task>> GetPagedAsync([FromQuery] ProductSearchPagedDto search) => await _productSrv.GetPagedAsync(search); } \ No newline at end of file diff --git a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/WarehouseController.cs b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/WarehouseController.cs index 1ac592fc4..96e690dd3 100644 --- a/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/WarehouseController.cs +++ b/src/ServerApi/Services/Adnc.Whse/Adnc.Whse.WebApi/Controllers/WarehouseController.cs @@ -23,7 +23,7 @@ public class WarehouseController : AdncControllerBase /// 分配货架给商品 /// /// - [HttpPatch("{id}/product")] + [HttpPut("{id}/product")] public async Task> AllocateShelfToProductAsync([FromRoute] long id, [FromBody] WarehouseAllocateToProductDto input) => await _warehouseSrv.AllocateShelfToProductAsync(id, input); /// diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Application/Extensions/ObjectMapperExtension.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Application/Extensions/ObjectMapperExtension.cs new file mode 100644 index 000000000..693db4e94 --- /dev/null +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Application/Extensions/ObjectMapperExtension.cs @@ -0,0 +1,15 @@ +namespace Adnc.Infra.Mapper; + +public static class ObjectMapperExtension +{ + public static TDestination Map(this IObjectMapper mapper, object source, long id) + where TDestination : Entity + { + var destination = mapper.Map(source); + if (destination is null) + return destination; + + destination.Id = id; + return destination; + } +} diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Application/GlobalUsings.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Application/GlobalUsings.cs index 74735f349..b7d83fd0d 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.Application/GlobalUsings.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Application/GlobalUsings.cs @@ -19,7 +19,8 @@ global using Adnc.Shared.Application.Contracts.ResultModels; global using Adnc.Shared.Application.Interceptors; global using Adnc.Shared.Consts.Caching.Common; -global using Adnc.Shared.Entities; +global using Adnc.Shared.Repository.EfEntities; +global using Adnc.Shared.Repository.MongoEntities; global using Castle.DynamicProxy; global using FluentValidation; global using Microsoft.Extensions.Configuration; @@ -39,4 +40,3 @@ global using System.Net; global using System.Reflection; global using System.Text.Json; -global using System.Threading; diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Domain/GlobalUsings.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Domain/GlobalUsings.cs index 1e648771f..f5a5a8175 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.Domain/GlobalUsings.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Domain/GlobalUsings.cs @@ -1,4 +1,4 @@ global using Adnc.Infra.Entities; global using Adnc.Infra.EventBus; -global using Adnc.Shared.Entities; +global using Adnc.Shared.Repository.EfEntities; global using System.Reflection; diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/Adnc.Shared.Repository.csproj b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/Adnc.Shared.Repository.csproj index b61bf3af1..8798f2995 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/Adnc.Shared.Repository.csproj +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/Adnc.Shared.Repository.csproj @@ -4,6 +4,10 @@ enable True + + + + diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/AbstracSharedEntityInfo.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/AbstracSharedEntityInfo.cs similarity index 64% rename from src/ServerApi/Services/Shared/Adnc.Shared.Repository/AbstracSharedEntityInfo.cs rename to src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/AbstracSharedEntityInfo.cs index 8e5b7fdb7..c5d107073 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/AbstracSharedEntityInfo.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/AbstracSharedEntityInfo.cs @@ -1,4 +1,4 @@ -namespace Adnc.Shared.Entities; +namespace Adnc.Shared.Repository.EfEntities; public abstract class AbstracSharedEntityInfo : IEntityInfo { @@ -6,7 +6,7 @@ public abstract class AbstracSharedEntityInfo : IEntityInfo public abstract IEnumerable GetConfigAssemblys(); - protected virtual IEnumerable GetEntityTypes(Assembly assembly) + protected virtual IEnumerable GetEntityTypes(Assembly assembly, bool containsSharedType = true) { var typeList = assembly.GetTypes().Where(m => m.FullName != null @@ -15,11 +15,12 @@ protected virtual IEnumerable GetEntityTypes(Assembly assembly) if (typeList is null) typeList = new List(); - return typeList.Append(typeof(EventTracker)); + return containsSharedType ? typeList.Append(typeof(EventTracker)) : typeList; } - protected virtual IEnumerable GetConfigAssemblys(Assembly assembly) + protected virtual IEnumerable GetConfigAssemblys(Assembly assembly, bool containsSharedAssembly = true) { - return new List { assembly, typeof(EventTracker).Assembly }; + var assemblies = new List { assembly }; + return containsSharedAssembly ? assemblies.Append(typeof(EventTracker).Assembly) : assemblies; } } \ No newline at end of file diff --git a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Config/EntityTypeConfiguration.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/Config/AbstractEntityTypeConfiguration.cs similarity index 88% rename from src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Config/EntityTypeConfiguration.cs rename to src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/Config/AbstractEntityTypeConfiguration.cs index ad93e0708..c00d35ff6 100644 --- a/src/ServerApi/Infrastructures/Adnc.Infra.Repository/Entities/EfEnities/Config/EntityTypeConfiguration.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/Config/AbstractEntityTypeConfiguration.cs @@ -1,6 +1,6 @@ -namespace Adnc.Infra.Entities.Config; +namespace Adnc.Shared.Repository.EfEntities.Config; -public abstract class EntityTypeConfiguration : IEntityTypeConfiguration +public abstract class AbstractEntityTypeConfiguration : IEntityTypeConfiguration where TEntity : Entity { public virtual void Configure(EntityTypeBuilder builder) diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/Entities/Config/EventTrackerConfig.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/Config/EventTrackerConfig.cs similarity index 65% rename from src/ServerApi/Services/Shared/Adnc.Shared.Repository/Entities/Config/EventTrackerConfig.cs rename to src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/Config/EventTrackerConfig.cs index 0fbd3ad19..b2114cfdf 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/Entities/Config/EventTrackerConfig.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/Config/EventTrackerConfig.cs @@ -1,8 +1,6 @@ -using Adnc.Shared.Entities; +namespace Adnc.Shared.Repository.EfEntities.Config; -namespace Adnc.Shared.Repository.Entities.Config; - -public class EventTrackerConfig : EntityTypeConfiguration +public class EventTrackerConfig : AbstractEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/Entities/EventTracker.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/EventTracker.cs similarity index 68% rename from src/ServerApi/Services/Shared/Adnc.Shared.Repository/Entities/EventTracker.cs rename to src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/EventTracker.cs index d8483464d..e19ace980 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/Entities/EventTracker.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/EfEntities/EventTracker.cs @@ -1,11 +1,11 @@ -namespace Adnc.Shared.Entities; +namespace Adnc.Shared.Repository.EfEntities; /// /// 事件跟踪/处理信息 /// /// /// EventId,TrackerName 需要建联合唯一索引 -/// CREATE UNIQUE NONCLUSTERED INDEX UK_EventId_TrackerNam ON EventTracker(EventId, TrackerName); +/// CREATE UNIQUE INDEX UK_EventId_TrackerNam ON EventTracker(EventId, TrackerName); /// public class EventTracker : EfBasicAuditEntity { diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/GlobalUsings.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/GlobalUsings.cs index d4916e3d3..31cf24dbf 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/GlobalUsings.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/GlobalUsings.cs @@ -1,5 +1,5 @@ global using Adnc.Infra.Entities; -global using Adnc.Infra.Entities.Config; global using Microsoft.EntityFrameworkCore; global using Microsoft.EntityFrameworkCore.Metadata.Builders; +global using MongoDB.Bson.Serialization.Attributes; global using System.Reflection; diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/LoggerLog.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/LoggerLog.cs new file mode 100644 index 000000000..25a528468 --- /dev/null +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/LoggerLog.cs @@ -0,0 +1,60 @@ +namespace Adnc.Shared.Repository.MongoEntities; + +/// +/// ILogger日志 +/// +//the driver would ignore any extra fields instead of throwing an exception +[BsonIgnoreExtraElements] +public class LoggerLog : MongoEntity +{ + [BsonDateTimeOptions(Kind = DateTimeKind.Local)] + public DateTime Date { get; set; } + + public string Level { get; set; } = default!; + + public string Message { get; set; } = default!; + + public string Logger { get; set; } = default!; + + public string Exception { get; set; } = default!; + + public int ThreadID { get; set; } = default!; + + public string ThreadName { get; set; } = default!; + + public int ProcessID { get; set; } = default!; + + public string ProcessName { get; set; } = default!; + + public SysNloglogProperty Properties { get; set; } = default!; +} + +[BsonIgnoreExtraElements] +public class SysNloglogProperty +{ + public string TraceIdentifier { get; set; } = default!; + + public string ConnectionId { get; set; } = default!; + + public string EventId_Id { get; set; } = default!; + + public string EventId_Name { get; set; } = default!; + + public string EventId { get; set; } = default!; + + public string RemoteIpAddress { get; set; } = default!; + + public string BaseDir { get; set; } = default!; + + public string QueryUrl { get; set; } = default!; + + public string RequestMethod { get; set; } = default!; + + public string Controller { get; set; } = default!; + + public string Method { get; set; } = default!; + + public string FormContent { get; set; } = default!; + + public string QueryContent { get; set; } = default!; +} \ No newline at end of file diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/LoginLog.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/LoginLog.cs new file mode 100644 index 000000000..907ef2d43 --- /dev/null +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/LoginLog.cs @@ -0,0 +1,26 @@ +namespace Adnc.Shared.Repository.MongoEntities; + +/// +/// 登录日志 +/// +public class LoginLog : MongoEntity +{ + public string Device { get; set; } = default!; + + public string Message { get; set; } = default!; + + public bool Succeed { get; set; } = default!; + + public int StatusCode { get; set; } = default!; + + public long? UserId { get; set; } = default!; + + public string Account { get; set; } = default!; + + public string UserName { get; set; } = default!; + + public string RemoteIpAddress { get; set; } = default!; + + [BsonDateTimeOptions(Kind = DateTimeKind.Local)] + public DateTime? CreateTime { get; set; } +} \ No newline at end of file diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/OperationLog.cs b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/OperationLog.cs new file mode 100644 index 000000000..a08667eca --- /dev/null +++ b/src/ServerApi/Services/Shared/Adnc.Shared.Repository/MongoEntities/OperationLog.cs @@ -0,0 +1,30 @@ +namespace Adnc.Shared.Repository.MongoEntities; + +/// +/// 操作日志 +/// +public class OperationLog : MongoEntity +{ + public string ClassName { get; set; } = default!; + + [BsonDateTimeOptions(Kind = DateTimeKind.Local)] + public DateTime? CreateTime { get; set; } + + public string LogName { get; set; } = default!; + + public string LogType { get; set; } = default!; + + public string Message { get; set; } = default!; + + public string Method { get; set; } = default!; + + public string Succeed { get; set; } = default!; + + public long? UserId { get; set; } = default!; + + public string Account { get; set; } = default!; + + public string UserName { get; set; } = default!; + + public string RemoteIpAddress { get; set; } = default!; +} \ No newline at end of file diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/Bearer/BearerAuthenticationHandler.cs b/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/Bearer/BearerAuthenticationHandler.cs index 018fa0741..a82bbf6b4 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/Bearer/BearerAuthenticationHandler.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/Bearer/BearerAuthenticationHandler.cs @@ -48,7 +48,7 @@ protected override async Task HandleAuthenticateAsync() return await Task.FromResult(authResult); } - Response.StatusCode = (int)HttpStatusCode.Forbidden; + Response.StatusCode = (int)HttpStatusCode.Unauthorized; authResult = AuthenticateResult.Fail("Invalid Authorization Token, claims is null"); return await Task.FromResult(authResult); } diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/JwtBearer/JwtBearerDefaults.cs b/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/JwtBearer/JwtBearerDefaults.cs new file mode 100644 index 000000000..589304365 --- /dev/null +++ b/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/JwtBearer/JwtBearerDefaults.cs @@ -0,0 +1,9 @@ +namespace Adnc.Shared.WebApi.Authentication.JwtBearer; + +public static class JwtBearerDefaults +{ + public const string RoleIds = "roleids"; + public const string LoginerType = "loginer"; + public const string Manager = "manager"; + public const string Customer = "customer"; +} diff --git a/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/JwtBearer/JwtTokenHelper.cs b/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/JwtBearer/JwtTokenHelper.cs index cab553c76..ab582172e 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/JwtBearer/JwtTokenHelper.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared.WebApi/Authentication/JwtBearer/JwtTokenHelper.cs @@ -72,7 +72,7 @@ JwtConfig jwtConfig , string nameId , string name ,string roleIds - ) + ,string loginerType) { if (jti.IsNullOrWhiteSpace()) throw new ArgumentNullException(nameof(jti)); @@ -83,7 +83,8 @@ JwtConfig jwtConfig new Claim(JwtRegisteredClaimNames.UniqueName, uniqueName), new Claim(JwtRegisteredClaimNames.NameId, nameId), new Claim(JwtRegisteredClaimNames.Name, name), - new Claim("roleids", roleIds) + new Claim(JwtBearerDefaults.RoleIds, roleIds), + new Claim(JwtBearerDefaults.LoginerType,loginerType) }; return WriteToken(jwtConfig, claims, Tokens.AccessToken); } diff --git a/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Caching/CachingConsts.Cust.cs b/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Caching/CachingConsts.Cust.cs new file mode 100644 index 000000000..8116063eb --- /dev/null +++ b/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Caching/CachingConsts.Cust.cs @@ -0,0 +1,7 @@ +namespace Adnc.Shared.Consts.Caching.Cust; + +public class CachingConsts : Common.CachingConsts +{ + //cache prefix + ///public const string CustomerValidatedInfoKeyPrefix = "adnc:cus:customer:validatedinfo"; +} \ No newline at end of file diff --git a/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Entity/EntityConsts.Cust.cs b/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Entity/EntityConsts.Cust.cs index ae07debfe..e2d60639d 100644 --- a/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Entity/EntityConsts.Cust.cs +++ b/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Entity/EntityConsts.Cust.cs @@ -3,9 +3,10 @@ /// /// 客户 /// -public static class CustConsts +public static class CustomerConsts { public const int Account_MaxLength = 16; + public const int Password_Maxlength = 32; public const int Nickname_MaxLength = 16; public const int Realname_Maxlength = 16; } diff --git a/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Permission/Permissions.Cust.cs b/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Permission/Permissions.Cust.cs new file mode 100644 index 000000000..13c7ce21b --- /dev/null +++ b/src/ServerApi/Services/Shared/Adnc.Shared/Consts/Permission/Permissions.Cust.cs @@ -0,0 +1,10 @@ +namespace Adnc.Shared.Consts.Permissions.Cust; + +public static class PermissionConsts +{ + public static class Customer + { + public const string GetList = "customerList"; + public const string Recharge = "customerRecharge"; + } +} \ No newline at end of file diff --git a/src/ServerApi/build/version.props b/src/ServerApi/build/version.props index 09e0f1c1a..76e32804f 100644 --- a/src/ServerApi/build/version.props +++ b/src/ServerApi/build/version.props @@ -2,8 +2,8 @@ 0 9 - 2 - 9 + 3 + 0 $(VersionMajor).$(VersionMinor).$(VersionPatch).$(VersionQuality) diff --git a/test/Adnc.UnitTest/EfCoreRepositoryTests.cs b/test/Adnc.UnitTest/EfCoreRepositoryTests.cs index 5a250a071..15fa45611 100644 --- a/test/Adnc.UnitTest/EfCoreRepositoryTests.cs +++ b/test/Adnc.UnitTest/EfCoreRepositoryTests.cs @@ -69,9 +69,9 @@ public async Task TestInsertRange() var id1 = IdGenerater.GetNextId(); var logs = new List { - new CustomerTransactionLog{ Id=id0,Account=customer.Account,ChangedAmount=0,Amount=0,ChangingAmount=0,CustomerId=customer.Id,ExchangeType=ExchangeTypeEnum.Recharge,ExchageStatus=ExchageStatusEnum.Finished,Remark="test"} + new CustomerTransactionLog{ Id=id0,Account=customer.Account,ChangedAmount=0,Amount=0,ChangingAmount=0,CustomerId=customer.Id,ExchangeType=ExchangeBehavior.Recharge,ExchageStatus=ExchageStatus.Finished,Remark="test"} , - new CustomerTransactionLog{ Id=id1,Account=customer.Account,ChangedAmount=0,Amount=0,ChangingAmount=0,CustomerId=customer.Id,ExchangeType=ExchangeTypeEnum.Recharge,ExchageStatus=ExchageStatusEnum.Finished,Remark="test"} + new CustomerTransactionLog{ Id=id1,Account=customer.Account,ChangedAmount=0,Amount=0,ChangingAmount=0,CustomerId=customer.Id,ExchangeType=ExchangeBehavior.Recharge,ExchageStatus=ExchageStatus.Finished,Remark="test"} }; await _custLogsRsp.InsertRangeAsync(logs);