diff --git a/app/src/main/resources/sql/mysql/init_data_for_test.sql b/app/src/main/resources/sql/mysql/init_data_for_test.sql index 9f82cce7..919d6dd6 100644 --- a/app/src/main/resources/sql/mysql/init_data_for_test.sql +++ b/app/src/main/resources/sql/mysql/init_data_for_test.sql @@ -104,7 +104,7 @@ INSERT INTO `t_block` (`id`, `label`, `name`, `framework`, `content`, `assets`, INSERT INTO `t_material` (`id`, `name`, `npm_name`, `framework`, `assets_url`, `image_url`, `published`, `latest_version`, `latest_history_id`, `public`, `last_build_info`, `description`, `is_official`, `is_default`, `tiny_reserved`, `component_library_id`, `material_category_id`, `material_size`, `tgz_url`, `unzip_tgz_root_path_url`, `unzip_tgz_files`, `created_by`, `last_updated_by`, `created_time`, `last_updated_time`, `tenant_id`, `site_id`) VALUES (1, 'materialstwo', '@opentiny/lowcode-alpha-material-materialstwo-1505', 'Vue', NULL, NULL, NULL, '1.0.8', 1, 1, '{\"version\": \"1.0.8\"}', '物料包', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', '1', '2024-10-16 23:37:14', '2024-10-16 23:37:14', '1', '1'); -INSERT INTO `t_page` (`id`, `name`, `app_id`, `route`, `page_content`, `is_body`, `parent_id`, `group`, `depth`, `is_page`, `occupier_by`, `is_default`, `content_blocks`, `latest_version`, `latest_history_id`, `created_by`, `last_updated_by`, `created_time`, `last_updated_time`, `tenant_id`, `site_id`) VALUES (1, 'createVm', 1, 'createVm', '{\"state\":{\"dataDisk\":[1,2,3]},\"methods\":{},\"componentName\":\"Page\",\"css\":\"body {\\r\\n background-color:#eef0f5 ;\\r\\n margin-bottom: 80px;\\r\\n}\",\"props\":{},\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"padding-bottom: 10px; padding-top: 10px;\"},\"id\":\"2b2cabf0\",\"children\":[{\"componentName\":\"TinyTimeLine\",\"props\":{\"active\":\"2\",\"data\":[{\"name\":\"基础配置\"},{\"name\":\"网络配置\"},{\"name\":\"高级配置\"},{\"name\":\"确认配置\"}],\"horizontal\":true,\"style\":\"border-radius: 0px;\"},\"id\":\"dd764b17\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;\"},\"id\":\"30c94cc8\",\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"计费模式\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"包年/包月\",\"value\":\"1\"},{\"text\":\"按需计费\",\"value\":\"2\"}],\"modelValue\":\"1\"},\"id\":\"a8d84361\"}],\"id\":\"9f39f3e7\"},{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"区域\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"乌兰察布二零一\",\"value\":\"1\"}],\"modelValue\":\"1\",\"style\":\"border-radius: 0px; margin-right: 10px;\"},\"id\":\"c97ccd99\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"温馨提示:页面左上角切换区域\",\"style\":\"background-color: [object Event]; color: #8a8e99; font-size: 12px;\"},\"id\":\"20923497\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"不同区域的云服务产品之间内网互不相通;请就近选择靠近您业务的区域,可减少网络时延,提高访问速度\",\"style\":\"display: block; color: #8a8e99; border-radius: 0px; font-size: 12px;\"},\"id\":\"54780a26\"}],\"id\":\"4966384d\"},{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"可用区\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"可用区1\",\"value\":\"1\"},{\"text\":\"可用区2\",\"value\":\"2\"},{\"text\":\"可用区3\",\"value\":\"3\"}],\"modelValue\":\"1\"},\"id\":\"6184481b\"}],\"id\":\"690837bf\"}],\"id\":\"b6a425d4\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;\"},\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"CPU架构\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"x86计算\",\"value\":\"1\"},{\"text\":\"鲲鹏计算\",\"value\":\"2\"}],\"modelValue\":\"1\"},\"id\":\"7d33ced7\"}],\"id\":\"05ed5a79\"},{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"区域\"},\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; justify-content: flex-start; align-items: center;\"},\"id\":\"606edf78\",\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; align-items: center; margin-right: 10px;\"},\"id\":\"f3f98246\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"vCPUs\",\"style\":\"width: 80px;\"},\"id\":\"c287437e\"},{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}]},\"id\":\"4c43286b\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; align-items: center; margin-right: 10px;\"},\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"内存\",\"style\":\"width: 80px; border-radius: 0px;\"},\"id\":\"38b8fa1f\"},{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}]},\"id\":\"cd33328e\"}],\"id\":\"2b2c678f\"},{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; align-items: center;\"},\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"规格名称\",\"style\":\"width: 80px;\"},\"id\":\"d3eb6352\"},{\"componentName\":\"TinySearch\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"输入关键词\"},\"id\":\"21cb9282\"}],\"id\":\"b8e0f35c\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"border-radius: 0px;\"},\"id\":\"5000c83e\",\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"通用计算型\",\"value\":\"1\"},{\"text\":\"通用计算增强型\",\"value\":\"2\"},{\"text\":\"内存优化型\",\"value\":\"3\"},{\"text\":\"内存优化型\",\"value\":\"4\"},{\"text\":\"磁盘增强型\",\"value\":\"5\"},{\"text\":\"超高I/O型\",\"value\":\"6\"},{\"text\":\"GPU加速型\",\"value\":\"7\"}],\"modelValue\":\"1\",\"style\":\"border-radius: 0px; margin-top: 12px;\"},\"id\":\"b8724703\"},{\"componentName\":\"TinyGrid\",\"props\":{\"editConfig\":{\"trigger\":\"click\",\"mode\":\"cell\",\"showStatus\":true},\"columns\":[{\"type\":\"radio\",\"width\":60},{\"field\":\"employees\",\"title\":\"规格名称\"},{\"field\":\"created_date\",\"title\":\"vCPUs | 内存(GiB)\",\"sortable\":true},{\"field\":\"city\",\"title\":\"CPU\",\"sortable\":true},{\"title\":\"基准 / 最大带宽\\t\",\"sortable\":true},{\"title\":\"内网收发包\",\"sortable\":true}],\"data\":[{\"id\":\"1\",\"name\":\"GFD科技有限公司\",\"city\":\"福州\",\"employees\":800,\"created_date\":\"2014-04-30 00:56:00\",\"boole\":false},{\"id\":\"2\",\"name\":\"WWW科技有限公司\",\"city\":\"深圳\",\"employees\":300,\"created_date\":\"2016-07-08 12:36:22\",\"boole\":true}],\"style\":\"margin-top: 12px; border-radius: 0px;\",\"auto-resize\":true},\"id\":\"77701c25\"},{\"componentName\":\"div\",\"props\":{\"style\":\"margin-top: 12px; border-radius: 0px;\"},\"id\":\"3339838b\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"当前规格\",\"style\":\"width: 150px; display: inline-block;\"},\"id\":\"203b012b\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"通用计算型 | Si2.large.2 | 2vCPUs | 4 GiB\",\"style\":\"font-weight: 700;\"},\"id\":\"87723f52\"}]}]}],\"id\":\"657fb2fc\"}],\"id\":\"d19b15cf\"}],\"id\":\"9991228b\"},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;\"},\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"镜像\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"公共镜像\",\"value\":\"1\"},{\"text\":\"私有镜像\",\"value\":\"2\"},{\"text\":\"共享镜像\",\"value\":\"3\"}],\"modelValue\":\"1\"},\"id\":\"922b14cb\"},{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; margin-top: 12px; border-radius: 0px;\"},\"id\":\"6b679524\",\"children\":[{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}],\"style\":\"width: 170px; margin-right: 10px;\"},\"id\":\"4851fff7\"},{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}],\"style\":\"width: 340px;\"},\"id\":\"a7183eb7\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"margin-top: 12px;\"},\"id\":\"57aee314\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"请注意操作系统的语言类型。\",\"style\":\"color: #e37d29;\"},\"id\":\"56d36c27\"}]}],\"id\":\"e3b02436\"}],\"id\":\"59aebf2b\"}],\"id\":\"87ff7b99\"},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;\"},\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"系统盘\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex;\"},\"id\":\"cddba5b8\",\"children\":[{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}],\"style\":\"width: 200px; margin-right: 10px;\"},\"id\":\"a97fbe15\"},{\"componentName\":\"TinyInput\",\"props\":{\"placeholder\":\"请输入\",\"modelValue\":\"\",\"style\":\"width: 120px; margin-right: 10px;\"},\"id\":\"1cde4c0f\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"GiB \\nIOPS上限240,IOPS突发上限5,000\",\"style\":\"color: #575d6c; font-size: 12px;\"},\"id\":\"2815d82d\"}]}],\"id\":\"50239a3a\"}],\"id\":\"e8582986\"},{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"数据盘\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"margin-top: 12px; display: flex;\"},\"id\":\"728c9825\",\"children\":[{\"componentName\":\"Icon\",\"props\":{\"style\":\"margin-right: 10px; width: 16px; height: 16px;\",\"name\":\"IconPanelMini\"},\"id\":\"fded6930\"},{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}],\"style\":\"width: 200px; margin-right: 10px;\"},\"id\":\"62734e3f\"},{\"componentName\":\"TinyInput\",\"props\":{\"placeholder\":\"请输入\",\"modelValue\":\"\",\"style\":\"width: 120px; margin-right: 10px;\"},\"id\":\"667c7926\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"GiB \\nIOPS上限600,IOPS突发上限5,000\",\"style\":\"color: #575d6c; font-size: 12px; margin-right: 10px;\"},\"id\":\"e7bc36d6\"},{\"componentName\":\"TinyInput\",\"props\":{\"placeholder\":\"请输入\",\"modelValue\":\"\",\"style\":\"width: 120px;\"},\"id\":\"1bd56dc0\"}],\"loop\":{\"type\":\"JSExpression\",\"value\":\"this.state.dataDisk\"}},{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; margin-top: 12px; border-radius: 0px;\"},\"children\":[{\"componentName\":\"Icon\",\"props\":{\"name\":\"IconPlus\",\"style\":\"width: 16px; height: 16px; margin-right: 10px;\"},\"id\":\"65c89f2b\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"增加一块数据盘\",\"style\":\"font-size: 12px; border-radius: 0px; margin-right: 10px;\"},\"id\":\"cb344071\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"您还可以挂载 21 块磁盘(云硬盘)\",\"style\":\"color: #8a8e99; font-size: 12px;\"},\"id\":\"80eea996\"}],\"id\":\"e9e530ab\"}],\"id\":\"078e03ef\"}],\"id\":\"ccef886e\"}],\"id\":\"0fb7bd74\"},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-color: #ffffff; padding-top: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; position: fixed; inset: auto 0% 0% 0%; height: 80px; line-height: 80px; border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[],\"id\":\"21ed4475\"},{\"componentName\":\"TinyRow\",\"props\":{\"style\":\"border-radius: 0px; height: 100%;\"},\"children\":[{\"componentName\":\"TinyCol\",\"props\":{\"span\":\"8\"},\"id\":\"b9d051a5\",\"children\":[{\"componentName\":\"TinyRow\",\"props\":{\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyCol\",\"props\":{\"span\":\"5\",\"style\":\"display: flex;\"},\"id\":\"02352776\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"购买量\",\"style\":\"margin-right: 10px;\"},\"id\":\"0cd9ed5c\"},{\"componentName\":\"TinyInput\",\"props\":{\"placeholder\":\"请输入\",\"modelValue\":\"\",\"style\":\"width: 120px; margin-right: 10px;\"},\"id\":\"2f9cf442\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"台\"},\"id\":\"facd4481\"}]},{\"componentName\":\"TinyCol\",\"props\":{\"span\":\"7\"},\"id\":\"82b6c659\",\"children\":[{\"componentName\":\"div\",\"props\":{},\"id\":\"9cd65874\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"配置费用\",\"style\":\"font-size: 12px;\"},\"id\":\"b5a0a0da\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"¥1.5776\",\"style\":\"padding-left: 10px; padding-right: 10px; color: #de504e;\"},\"id\":\"d9464214\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"/小时\",\"style\":\"font-size: 12px;\"},\"id\":\"af7cc5e6\"}]},{\"componentName\":\"div\",\"props\":{},\"id\":\"89063830\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"参考价格,具体扣费请以账单为准。\",\"style\":\"font-size: 12px; border-radius: 0px;\"},\"id\":\"d8995fbc\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"了解计费详情\",\"style\":\"font-size: 12px; color: #344899;\"},\"id\":\"b383c3e2\"}]}]}],\"id\":\"94fc0e43\"}]},{\"componentName\":\"TinyCol\",\"props\":{\"span\":\"4\",\"style\":\"display: flex; flex-direction: row-reverse; border-radius: 0px; height: 100%; justify-content: flex-start; align-items: center;\"},\"id\":\"10b73009\",\"children\":[{\"componentName\":\"TinyButton\",\"props\":{\"text\":\"下一步: 网络配置\",\"type\":\"danger\",\"style\":\"max-width: unset;\"},\"id\":\"0b584011\"}]}],\"id\":\"d414a473\"}],\"id\":\"e8ec029b\"}],\"fileName\":\"createVM\"}', 0, 0, 'staticPages', 0, 1, '1', 0, NULL, NULL, NULL, '1', '1', '1', '2024-10-16 23:31:48', '1', '2024-10-16 23:31:48'); +INSERT INTO `t_page` (`id`, `name`, `app_id`, `route`, `page_content`, `is_body`, `parent_id`, `group`, `depth`, `is_page`, `occupier_by`, `is_default`, `content_blocks`, `latest_version`, `latest_history_id`, `created_by`, `last_updated_by`, `created_time`, `last_updated_time`, `tenant_id`, `site_id`) VALUES (1, 'createVm', 1, 'createVm', '{\"state\":{\"dataDisk\":[1,2,3]},\"methods\":{},\"componentName\":\"Page\",\"css\":\"body {\\r\\n background-color:#eef0f5 ;\\r\\n margin-bottom: 80px;\\r\\n}\",\"props\":{},\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"padding-bottom: 10px; padding-top: 10px;\"},\"id\":\"2b2cabf0\",\"children\":[{\"componentName\":\"TinyTimeLine\",\"props\":{\"active\":\"2\",\"data\":[{\"name\":\"基础配置\"},{\"name\":\"网络配置\"},{\"name\":\"高级配置\"},{\"name\":\"确认配置\"}],\"horizontal\":true,\"style\":\"border-radius: 0px;\"},\"id\":\"dd764b17\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;\"},\"id\":\"30c94cc8\",\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"计费模式\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"包年/包月\",\"value\":\"1\"},{\"text\":\"按需计费\",\"value\":\"2\"}],\"modelValue\":\"1\"},\"id\":\"a8d84361\"}],\"id\":\"9f39f3e7\"},{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"区域\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"乌兰察布二零一\",\"value\":\"1\"}],\"modelValue\":\"1\",\"style\":\"border-radius: 0px; margin-right: 10px;\"},\"id\":\"c97ccd99\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"温馨提示:页面左上角切换区域\",\"style\":\"background-color: [object Event]; color: #8a8e99; font-size: 12px;\"},\"id\":\"20923497\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"不同区域的云服务产品之间内网互不相通;请就近选择靠近您业务的区域,可减少网络时延,提高访问速度\",\"style\":\"display: block; color: #8a8e99; border-radius: 0px; font-size: 12px;\"},\"id\":\"54780a26\"}],\"id\":\"4966384d\"},{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"可用区\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"可用区1\",\"value\":\"1\"},{\"text\":\"可用区2\",\"value\":\"2\"},{\"text\":\"可用区3\",\"value\":\"3\"}],\"modelValue\":\"1\"},\"id\":\"6184481b\"}],\"id\":\"690837bf\"}],\"id\":\"b6a425d4\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;\"},\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"CPU架构\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"x86计算\",\"value\":\"1\"},{\"text\":\"鲲鹏计算\",\"value\":\"2\"}],\"modelValue\":\"1\"},\"id\":\"7d33ced7\"}],\"id\":\"05ed5a79\"},{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"区域\"},\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; justify-content: flex-start; align-items: center;\"},\"id\":\"606edf78\",\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; align-items: center; margin-right: 10px;\"},\"id\":\"f3f98246\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"vCPUs\",\"style\":\"width: 80px;\"},\"id\":\"c287437e\"},{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}]},\"id\":\"4c43286b\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; align-items: center; margin-right: 10px;\"},\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"内存\",\"style\":\"width: 80px; border-radius: 0px;\"},\"id\":\"38b8fa1f\"},{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}]},\"id\":\"cd33328e\"}],\"id\":\"2b2c678f\"},{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; align-items: center;\"},\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"规格名称\",\"style\":\"width: 80px;\"},\"id\":\"d3eb6352\"},{\"componentName\":\"TinySearch\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"输入关键词\"},\"id\":\"21cb9282\"}],\"id\":\"b8e0f35c\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"border-radius: 0px;\"},\"id\":\"5000c83e\",\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"通用计算型\",\"value\":\"1\"},{\"text\":\"通用计算增强型\",\"value\":\"2\"},{\"text\":\"内存优化型\",\"value\":\"3\"},{\"text\":\"内存优化型\",\"value\":\"4\"},{\"text\":\"磁盘增强型\",\"value\":\"5\"},{\"text\":\"超高I/O型\",\"value\":\"6\"},{\"text\":\"GPU加速型\",\"value\":\"7\"}],\"modelValue\":\"1\",\"style\":\"border-radius: 0px; margin-top: 12px;\"},\"id\":\"b8724703\"},{\"componentName\":\"TinyGrid\",\"props\":{\"editConfig\":{\"trigger\":\"click\",\"mode\":\"cell\",\"showStatus\":true},\"columns\":[{\"type\":\"radio\",\"width\":60},{\"field\":\"employees\",\"title\":\"规格名称\"},{\"field\":\"created_date\",\"title\":\"vCPUs | 内存(GiB)\",\"sortable\":true},{\"field\":\"city\",\"title\":\"CPU\",\"sortable\":true},{\"title\":\"基准 / 最大带宽\\t\",\"sortable\":true},{\"title\":\"内网收发包\",\"sortable\":true}],\"data\":[{\"id\":\"1\",\"name\":\"GFD科技有限公司\",\"city\":\"福州\",\"employees\":800,\"created_date\":\"2014-04-30 00:56:00\",\"boole\":false},{\"id\":\"2\",\"name\":\"WWW科技有限公司\",\"city\":\"深圳\",\"employees\":300,\"created_date\":\"2016-07-08 12:36:22\",\"boole\":true}],\"style\":\"margin-top: 12px; border-radius: 0px;\",\"auto-resize\":true},\"id\":\"77701c25\"},{\"componentName\":\"div\",\"props\":{\"style\":\"margin-top: 12px; border-radius: 0px;\"},\"id\":\"3339838b\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"当前规格\",\"style\":\"width: 150px; display: inline-block;\"},\"id\":\"203b012b\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"通用计算型 | Si2.large.2 | 2vCPUs | 4 GiB\",\"style\":\"font-weight: 700;\"},\"id\":\"87723f52\"}]}]}],\"id\":\"657fb2fc\"}],\"id\":\"d19b15cf\"}],\"id\":\"9991228b\"},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;\"},\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"镜像\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyButtonGroup\",\"props\":{\"data\":[{\"text\":\"公共镜像\",\"value\":\"1\"},{\"text\":\"私有镜像\",\"value\":\"2\"},{\"text\":\"共享镜像\",\"value\":\"3\"}],\"modelValue\":\"1\"},\"id\":\"922b14cb\"},{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; margin-top: 12px; border-radius: 0px;\"},\"id\":\"6b679524\",\"children\":[{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}],\"style\":\"width: 170px; margin-right: 10px;\"},\"id\":\"4851fff7\"},{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}],\"style\":\"width: 340px;\"},\"id\":\"a7183eb7\"}]},{\"componentName\":\"div\",\"props\":{\"style\":\"margin-top: 12px;\"},\"id\":\"57aee314\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"请注意操作系统的语言类型。\",\"style\":\"color: #e37d29;\"},\"id\":\"56d36c27\"}]}],\"id\":\"e3b02436\"}],\"id\":\"59aebf2b\"}],\"id\":\"87ff7b99\"},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;\"},\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"系统盘\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex;\"},\"id\":\"cddba5b8\",\"children\":[{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}],\"style\":\"width: 200px; margin-right: 10px;\"},\"id\":\"a97fbe15\"},{\"componentName\":\"TinyInput\",\"props\":{\"placeholder\":\"请输入\",\"modelValue\":\"\",\"style\":\"width: 120px; margin-right: 10px;\"},\"id\":\"1cde4c0f\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"GiB \\nIOPS上限240,IOPS突发上限5,000\",\"style\":\"color: #575d6c; font-size: 12px;\"},\"id\":\"2815d82d\"}]}],\"id\":\"50239a3a\"}],\"id\":\"e8582986\"},{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyFormItem\",\"props\":{\"label\":\"数据盘\",\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"div\",\"props\":{\"style\":\"margin-top: 12px; display: flex;\"},\"id\":\"728c9825\",\"children\":[{\"componentName\":\"Icon\",\"props\":{\"style\":\"margin-right: 10px; width: 16px; height: 16px;\",\"name\":\"IconPanelMini\"},\"id\":\"fded6930\"},{\"componentName\":\"TinySelect\",\"props\":{\"modelValue\":\"\",\"placeholder\":\"请选择\",\"options\":[{\"value\":\"1\",\"label\":\"黄金糕\"},{\"value\":\"2\",\"label\":\"双皮奶\"}],\"style\":\"width: 200px; margin-right: 10px;\"},\"id\":\"62734e3f\"},{\"componentName\":\"TinyInput\",\"props\":{\"placeholder\":\"请输入\",\"modelValue\":\"\",\"style\":\"width: 120px; margin-right: 10px;\"},\"id\":\"667c7926\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"GiB \\nIOPS上限600,IOPS突发上限5,000\",\"style\":\"color: #575d6c; font-size: 12px; margin-right: 10px;\"},\"id\":\"e7bc36d6\"},{\"componentName\":\"TinyInput\",\"props\":{\"placeholder\":\"请输入\",\"modelValue\":\"\",\"style\":\"width: 120px;\"},\"id\":\"1bd56dc0\"}],\"loop\":{\"type\":\"JSExpression\",\"value\":\"this.state.dataDisk\"}},{\"componentName\":\"div\",\"props\":{\"style\":\"display: flex; margin-top: 12px; border-radius: 0px;\"},\"children\":[{\"componentName\":\"Icon\",\"props\":{\"name\":\"IconPlus\",\"style\":\"width: 16px; height: 16px; margin-right: 10px;\"},\"id\":\"65c89f2b\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"增加一块数据盘\",\"style\":\"font-size: 12px; border-radius: 0px; margin-right: 10px;\"},\"id\":\"cb344071\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"您还可以挂载 21 块磁盘(云硬盘)\",\"style\":\"color: #8a8e99; font-size: 12px;\"},\"id\":\"80eea996\"}],\"id\":\"e9e530ab\"}],\"id\":\"078e03ef\"}],\"id\":\"ccef886e\"}],\"id\":\"0fb7bd74\"},{\"componentName\":\"div\",\"props\":{\"style\":\"border-width: 1px; border-style: solid; border-color: #ffffff; padding-top: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; position: fixed; inset: auto 0% 0% 0%; height: 80px; line-height: 80px; border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyForm\",\"props\":{\"labelWidth\":\"80px\",\"labelPosition\":\"top\",\"inline\":false,\"label-position\":\"left \",\"label-width\":\"150px\",\"style\":\"border-radius: 0px;\"},\"children\":[],\"id\":\"21ed4475\"},{\"componentName\":\"TinyRow\",\"props\":{\"style\":\"border-radius: 0px; height: 100%;\"},\"children\":[{\"componentName\":\"TinyCol\",\"props\":{\"span\":\"8\"},\"id\":\"b9d051a5\",\"children\":[{\"componentName\":\"TinyRow\",\"props\":{\"style\":\"border-radius: 0px;\"},\"children\":[{\"componentName\":\"TinyCol\",\"props\":{\"span\":\"5\",\"style\":\"display: flex;\"},\"id\":\"02352776\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"购买量\",\"style\":\"margin-right: 10px;\"},\"id\":\"0cd9ed5c\"},{\"componentName\":\"TinyInput\",\"props\":{\"placeholder\":\"请输入\",\"modelValue\":\"\",\"style\":\"width: 120px; margin-right: 10px;\"},\"id\":\"2f9cf442\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"台\"},\"id\":\"facd4481\"}]},{\"componentName\":\"TinyCol\",\"props\":{\"span\":\"7\"},\"id\":\"82b6c659\",\"children\":[{\"componentName\":\"div\",\"props\":{},\"id\":\"9cd65874\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"配置费用\",\"style\":\"font-size: 12px;\"},\"id\":\"b5a0a0da\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"¥1.5776\",\"style\":\"padding-left: 10px; padding-right: 10px; color: #de504e;\"},\"id\":\"d9464214\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"/小时\",\"style\":\"font-size: 12px;\"},\"id\":\"af7cc5e6\"}]},{\"componentName\":\"div\",\"props\":{},\"id\":\"89063830\",\"children\":[{\"componentName\":\"Text\",\"props\":{\"text\":\"参考价格,具体扣费请以账单为准。\",\"style\":\"font-size: 12px; border-radius: 0px;\"},\"id\":\"d8995fbc\"},{\"componentName\":\"Text\",\"props\":{\"text\":\"了解计费详情\",\"style\":\"font-size: 12px; color: #344899;\"},\"id\":\"b383c3e2\"}]}]}],\"id\":\"94fc0e43\"}]},{\"componentName\":\"TinyCol\",\"props\":{\"span\":\"4\",\"style\":\"display: flex; flex-direction: row-reverse; border-radius: 0px; height: 100%; justify-content: flex-start; align-items: center;\"},\"id\":\"10b73009\",\"children\":[{\"componentName\":\"TinyButton\",\"props\":{\"text\":\"下一步: 网络配置\",\"type\":\"danger\",\"style\":\"max-width: unset;\"},\"id\":\"0b584011\"}]}],\"id\":\"d414a473\"}],\"id\":\"e8ec029b\"}],\"fileName\":\"createVM\"}', 0, 0, 'staticPages', 0, 1, '1', 0, NULL, NULL, NULL, '1', '1', '2024-10-16 23:31:48', '1', '2024-10-16 23:31:48','1','1'); INSERT INTO `t_user` (`id`, `username`, `email`, `enable`, `created_by`, `last_updated_by`, `created_time`, `last_updated_time`, `tenant_id`, `site_id`, `is_admin`, `is_public`) VALUES (1, '开发者', 'developer@lowcode.com', NULL, '1', '1', '2024-10-16 23:28:41', '2024-10-16 23:28:41', '1', '1', 1, NULL); INSERT INTO `t_i18n_lang` (`id`, `lang`, `label`, `created_by`, `last_updated_by`, `created_time`, `last_updated_time`) VALUES (1, 'zh_CN', '简体中文', '1', '1', '2024-10-17 00:01:36', '2024-10-17 00:01:36'); diff --git a/base/src/main/java/com/tinyengine/it/common/log/SystemLogAspect.java b/base/src/main/java/com/tinyengine/it/common/log/SystemLogAspect.java index 37aa1913..b55d464d 100644 --- a/base/src/main/java/com/tinyengine/it/common/log/SystemLogAspect.java +++ b/base/src/main/java/com/tinyengine/it/common/log/SystemLogAspect.java @@ -102,8 +102,7 @@ public void controllerAspect() { */ @Before("controllerAspect()") public void doBefore(JoinPoint joinPoint) { - logger.debug("Method: {}", - (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName())); + logger.debug("Method: {}", joinPoint.getSignature().getName()); } /** @@ -114,13 +113,7 @@ public void doBefore(JoinPoint joinPoint) { */ @AfterThrowing(pointcut = "serviceAspect()", throwing = "e") public void doAfterThrowing(JoinPoint joinPoint, Throwable e) { - logger.error("Method:" - + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()")); - logger.error("Exception ClassName:" + e.getClass().getName()); + logger.error("Method: {}", joinPoint.getSignature().getName()); logger.error("Exception Message:" + e.getMessage()); - logger.error("Exception Stack:"); - for (StackTraceElement element : e.getStackTrace()) { - logger.error("\t" + element.toString()); - } } } diff --git a/base/src/main/java/com/tinyengine/it/common/utils/Utils.java b/base/src/main/java/com/tinyengine/it/common/utils/Utils.java index 416f8fc5..763b7af2 100644 --- a/base/src/main/java/com/tinyengine/it/common/utils/Utils.java +++ b/base/src/main/java/com/tinyengine/it/common/utils/Utils.java @@ -5,18 +5,18 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.tinyengine.it.model.dto.FileInfo; +import cn.hutool.core.io.FileUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.web.multipart.MultipartFile; import java.io.BufferedOutputStream; -import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; -import java.io.FileReader; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -71,14 +71,7 @@ public static List removeDuplicates(List list) { */ // 查找最大版本 public static String findMaxVersion(List versions) { - return versions.stream() - .max(Comparator.comparing( - version -> Arrays.stream(version.split("\\.")) - .mapToInt(Integer::parseInt).toArray(), - Comparator.comparingInt((int[] arr) -> arr[0]) - .thenComparingInt(arr -> arr[1]) - .thenComparingInt(arr -> arr[2]))) - .orElse(null); + return versions.stream().max(Comparator.comparing(version -> Arrays.stream(version.split("\\.")).mapToInt(Integer::parseInt).toArray(), Comparator.comparingInt((int[] arr) -> arr[0]).thenComparingInt(arr -> arr[1]).thenComparingInt(arr -> arr[2]))).orElse(null); } /** @@ -261,15 +254,13 @@ private static void extractFile(ZipInputStream zis, File newFile) throws IOExcep * * @param file the file * @return String the String - * @throws IOException IOException */ - private static String readFileContent(File file) throws IOException { + public static String readFileContent(File file) { + List lines = FileUtil.readLines(file, Charset.defaultCharset()); + StringBuilder contentBuilder = new StringBuilder(); - try (BufferedReader br = new BufferedReader(new FileReader(file))) { - String line; - while ((line = br.readLine()) != null) { - contentBuilder.append(line).append(System.lineSeparator()); - } + for (String line : lines) { + contentBuilder.append(line).append(System.lineSeparator()); } return contentBuilder.toString(); } diff --git a/base/src/main/java/com/tinyengine/it/gateway/ai/AiChatClient.java b/base/src/main/java/com/tinyengine/it/gateway/ai/AiChatClient.java index e227775a..745dcec4 100644 --- a/base/src/main/java/com/tinyengine/it/gateway/ai/AiChatClient.java +++ b/base/src/main/java/com/tinyengine/it/gateway/ai/AiChatClient.java @@ -10,6 +10,7 @@ import com.tinyengine.it.model.dto.OpenAiBodyDto; import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Mono; import org.springframework.http.HttpMethod; import org.springframework.web.reactive.function.client.WebClient; @@ -25,7 +26,7 @@ @Slf4j public class AiChatClient { private final Map config; - private final WebClient webClient; + private WebClient webClient; /** * Instantiates a new Ai chat client. @@ -70,12 +71,14 @@ public Map executeChatRequest(OpenAiBodyDto openAiBodyDto) { } } - return requestSpec.retrieve().bodyToMono(String.class).map(response -> { + Mono stringMono = requestSpec.retrieve().bodyToMono(String.class); + return stringMono.map(response -> + { try { return new ObjectMapper().readValue(response, new TypeReference>() {}); } catch (JsonProcessingException e) { throw new ServiceException(CM322.getResultCode(), e.getMessage()); } - }).block(); // 等待结果 + }).block(); // 等待结果 } } diff --git a/base/src/main/java/com/tinyengine/it/service/app/impl/I18nEntryServiceImpl.java b/base/src/main/java/com/tinyengine/it/service/app/impl/I18nEntryServiceImpl.java index 9a70bd0c..ce934442 100644 --- a/base/src/main/java/com/tinyengine/it/service/app/impl/I18nEntryServiceImpl.java +++ b/base/src/main/java/com/tinyengine/it/service/app/impl/I18nEntryServiceImpl.java @@ -346,14 +346,6 @@ public Result readSingleFileAndBulkCreate(MultipartFile file, in @SystemServiceLog(description = "readFilesAndbulkCreate 批量上传词条数据") @Override public Result readFilesAndbulkCreate(String lang, MultipartFile file, int host) throws Exception { - try (InputStream inputStream = file.getInputStream()) { - BufferedReader reader = new BufferedReader(new InputStreamReader((inputStream), StandardCharsets.UTF_8)); - StringBuilder sb = new StringBuilder(); - String line; - while ((line = reader.readLine()) != null) { - sb.append(line); - } - } Result parseJsonFileStreamResult = parseJsonFileStream(file); // 解析 JSON 数据 if (!parseJsonFileStreamResult.isSuccess()) { diff --git a/base/src/main/java/com/tinyengine/it/service/app/impl/v1/AppV1ServiceImpl.java b/base/src/main/java/com/tinyengine/it/service/app/impl/v1/AppV1ServiceImpl.java index 7b909444..20d24643 100644 --- a/base/src/main/java/com/tinyengine/it/service/app/impl/v1/AppV1ServiceImpl.java +++ b/base/src/main/java/com/tinyengine/it/service/app/impl/v1/AppV1ServiceImpl.java @@ -359,8 +359,7 @@ public List getBlockHistoryIdBySemver(List blocksVersi // 遍历区块历史记录 综合信息映射关系 Set keySet = blocksVersionMap.keySet(); for (Iterator it = keySet.iterator(); it.hasNext(); ) { - String key = it.next(); - Map keyMap = blocksVersionMap.get(key); + Map keyMap = blocksVersionMap.get(it.next()); // 获取 "versions" 字段并确保它是 List 类型 List versions = null; diff --git a/base/src/test/java/com/tinyengine/it/common/log/SystemLogAspectTest.java b/base/src/test/java/com/tinyengine/it/common/log/SystemLogAspectTest.java index 70c2ae7a..9353a6ae 100644 --- a/base/src/test/java/com/tinyengine/it/common/log/SystemLogAspectTest.java +++ b/base/src/test/java/com/tinyengine/it/common/log/SystemLogAspectTest.java @@ -61,5 +61,31 @@ public String controllerLog() { return "ControllerLog"; } } + + @Test + void testServiceAspect() { + systemLogAspect.serviceAspect(); + } + + @Test + void testControllerAspect() { + systemLogAspect.controllerAspect(); + } + + @Test + void testDoBefore() { + JoinPoint joinPoint = Mockito.mock(JoinPoint.class); + MethodSignature signature = Mockito.mock(MethodSignature.class); + when(joinPoint.getSignature()).thenReturn(signature); + systemLogAspect.doBefore(joinPoint); + } + + @Test + void testDoAfterThrowing() { + JoinPoint joinPoint = Mockito.mock(JoinPoint.class); + MethodSignature signature = Mockito.mock(MethodSignature.class); + when(joinPoint.getSignature()).thenReturn(signature); + systemLogAspect.doAfterThrowing(joinPoint, new Throwable("message")); + } } diff --git a/base/src/test/java/com/tinyengine/it/common/utils/UtilsTest.java b/base/src/test/java/com/tinyengine/it/common/utils/UtilsTest.java index 6f665a0a..712768a8 100644 --- a/base/src/test/java/com/tinyengine/it/common/utils/UtilsTest.java +++ b/base/src/test/java/com/tinyengine/it/common/utils/UtilsTest.java @@ -1,10 +1,13 @@ package com.tinyengine.it.common.utils; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import java.io.File; +import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -32,19 +35,19 @@ void removeDuplicates() { @Test void testFindMaxVersion() { String result = Utils.findMaxVersion(Arrays.asList("versions")); - Assertions.assertEquals("versions", result); + assertEquals("versions", result); } @Test void testToHump() { String result = Utils.toHump("name"); - Assertions.assertEquals("name", result); + assertEquals("name", result); } @Test void testToLine() { String result = Utils.toLine("name"); - Assertions.assertEquals("name", result); + assertEquals("name", result); } @Test @@ -52,7 +55,25 @@ void testConvert() { Map mapData = new HashMap(); mapData.put("key", "value"); Map result = Utils.convert(mapData); - Assertions.assertEquals("value", result.get("key")); + assertEquals("value", result.get("key")); + } + + @Test + void testFlat() { + Map mapData = new HashMap(); + mapData.put("key", "value"); + Map flat = Utils.flat(mapData); + assertTrue(flat.keySet().contains("key")); + } + + @Test + void testReadFileContent() { + URL resource = UtilsTest.class.getClassLoader().getResource("testFile.txt"); + if (resource != null) { + File file = new File(resource.getFile()); + String fileContent = Utils.readFileContent(file); + assertEquals("abc" + System.lineSeparator(), fileContent); + } } } diff --git a/base/src/test/java/com/tinyengine/it/gateway/ai/AiChatClientTest.java b/base/src/test/java/com/tinyengine/it/gateway/ai/AiChatClientTest.java index 934137d4..547c1fec 100644 --- a/base/src/test/java/com/tinyengine/it/gateway/ai/AiChatClientTest.java +++ b/base/src/test/java/com/tinyengine/it/gateway/ai/AiChatClientTest.java @@ -9,6 +9,8 @@ import com.tinyengine.it.model.dto.AiMessages; import com.tinyengine.it.model.dto.OpenAiBodyDto; +import reactor.core.publisher.Mono; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -51,16 +53,20 @@ void testExecuteChatRequest() { put("headers", "headers"); } }; + String modelName = "gpt-3.5-turbo"; AiChatConfig.HttpRequestOption option = new AiChatConfig.HttpRequestOption("POST", "json", "json", 100); AiChatConfig.AiChatConfigData configData = new AiChatConfig.AiChatConfigData("httpRequestUrl", option, headers, null); - String modelName = "model"; when(config.get(modelName)).thenReturn(configData); WebClient.RequestBodyUriSpec bodyUriSpec = Mockito.mock(WebClient.RequestBodyUriSpec.class, RETURNS_DEEP_STUBS); + Mono mono = Mockito.mock(Mono.class, RETURNS_DEEP_STUBS); + Map result = new HashMap<>(); + when(mono.map(any()).block()).thenReturn(result); + when(bodyUriSpec.retrieve().bodyToMono(String.class)).thenReturn(mono); when(webClient.method(any(HttpMethod.class))).thenReturn(bodyUriSpec); WebClient.RequestHeadersSpec requestSpec = Mockito.mock(WebClient.RequestHeadersSpec.class, RETURNS_DEEP_STUBS); @@ -69,8 +75,8 @@ void testExecuteChatRequest() { AiMessages aiMessages = new AiMessages(); OpenAiBodyDto param = new OpenAiBodyDto(modelName, Arrays.asList(aiMessages)); - Map result = aiChatClient.executeChatRequest(param); - Assertions.assertTrue(result.isEmpty()); + Map returnData = aiChatClient.executeChatRequest(param); + Assertions.assertNull(returnData); } } diff --git a/base/src/test/resources/testFile.txt b/base/src/test/resources/testFile.txt new file mode 100644 index 00000000..f2ba8f84 --- /dev/null +++ b/base/src/test/resources/testFile.txt @@ -0,0 +1 @@ +abc \ No newline at end of file