diff --git a/ServiceSite/pom.xml b/ServiceSite/pom.xml index 1717a3302ef0292c320c56027e9cbe203468a502..dddff960dc86ec4d8c1b95666ac6d61efaece40e 100644 --- a/ServiceSite/pom.xml +++ b/ServiceSite/pom.xml @@ -153,6 +153,12 @@ <artifactId>mysql-connector-java</artifactId> <version>8.0.11</version> </dependency> + <!--鍩虹鏁版嵁 --> + <dependency> + <groupId>com.seasky</groupId> + <artifactId>base-data-api</artifactId> + <version>2.0.1-SNAPSHOT</version> + </dependency> <!-- 鏁版嵁搴� JDBC --> <!--seata--> <dependency> @@ -324,6 +330,11 @@ <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> + <resource> + <targetPath>/ROOT/src/main/resources/json/</targetPath> + <directory>src/main/resources/json/</directory> + <include>registerApplication.json</include> + </resource> </resources> </configuration> </plugin> diff --git a/ServiceSite/src/main/java/com/seasky/dddtemplate/domain/service/RegisterApplicationServiceImpl.java b/ServiceSite/src/main/java/com/seasky/dddtemplate/domain/service/RegisterApplicationServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..048c63b3df97ea78c64bec5d511f1c6e7719cd45 --- /dev/null +++ b/ServiceSite/src/main/java/com/seasky/dddtemplate/domain/service/RegisterApplicationServiceImpl.java @@ -0,0 +1,45 @@ +package com.seasky.dddtemplate.domain.service; + +import com.alibaba.fastjson.JSONArray; +import com.seasky.base.data.api.IApplicationController; +import com.seasky.base.data.dto.application.ApplicationCmd; +import com.seasky.core.common.Result; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.util.ResourceUtils; + +import java.io.*; + +/** + * @author xiaqihang + * @date 2021/12/15 10:35 + */ +@Slf4j +public class RegisterApplicationServiceImpl implements ApplicationRunner { + + @Autowired + IApplicationController iApplication; + + @Override + public void run(ApplicationArguments args) throws Exception { + log.info("----------寮€濮嬫敞鍐屽熀纭€鏁版嵁搴旂敤鍜岀浉鍏抽厤缃�----------"); + File jsonFile = ResourceUtils.getFile("src/main/resources/json/registerApplication.json"); + FileReader fileReader = new FileReader(jsonFile); + Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8"); + int ch; + StringBuffer sb = new StringBuffer(); + while ((ch = reader.read()) != -1) { + sb.append((char) ch); + } + fileReader.close(); + reader.close(); + String jsonStr = sb.toString(); + ApplicationCmd applicationCmd = JSONArray.parseObject(jsonStr, ApplicationCmd.class); +// applicationCmd.setVersion(serviceVersion); +// applicationCmd.setRecognizeId(applicationName); + Result<Integer> integerResult = iApplication.registerApplication(applicationCmd); + log.info("娉ㄥ唽缁撴灉锛�"+integerResult); + } +} diff --git a/ServiceSite/src/main/resources/json/registerApplication.json b/ServiceSite/src/main/resources/json/registerApplication.json new file mode 100644 index 0000000000000000000000000000000000000000..bd44267f4494853ffe1a62e8fa3cc0510ee7f303 --- /dev/null +++ b/ServiceSite/src/main/resources/json/registerApplication.json @@ -0,0 +1,169 @@ +{ + "applicationType": "INNER", + "enabled": "YES", + "id": 1423509196690710529, + "menuList": [ + { + "applicationId": 1423509196690710529, + "code": "000000", + "enabled": "YES", + "functionList": [ + { + "code": "000000", + "id": 1423509197328244731, + "menuId": 1423509197198221311, + "name": "娴忚", + "url": "" + } + ], + "id": 1423509197198221311, + "isNewWindow": "NO", + "name": "寰棬鎴�", + "parentId": 0, + "registerMenu": "YES", + "withUserId": "NO" + }, + { + "applicationId": 1423509196690710529, + "code": "SBD_000", + "enabled": "YES", + "functionList": [ + { + "code": "000000", + "id": 1426088154741366786, + "menuId": 1426088154577788929, + "name": "娴忚", + "url": "" + }, + { + "code": "000003", + "id": 1432154090418233345, + "menuId": 1426088154577788929, + "name": "鐧诲綍鏌ヨ", + "url": "**/loginCtrl/**" + }, + { + "code": "000004", + "id": 1432154219720237058, + "menuId": 1426088154577788929, + "name": "鑿滃崟绠$悊", + "url": "**/menuCtrl/**" + }, + { + "code": "000005", + "id": 1432154544812351489, + "menuId": 1426088154577788929, + "name": "娴佺▼绠$悊", + "url": "**/processCtrl/**" + }, + { + "code": "000006", + "id": 1432154727176495106, + "menuId": 1426088154577788929, + "name": "姹囨€绘煡璇�", + "url": "**/User/**" + } + ], + "id": 1426088154577788929, + "isNewWindow": "NO", + "name": "鏁欏璐㈠姟", + "parentId": 1423509197198221311, + "redirectUrl": "", + "registerMenu": "YES", + "routingUrl": "", + "urlParameter": "", + "withUserId": "NO" + }, + { + "applicationId": 1423509196690710529, + "code": "SBD_002", + "enabled": "YES", + "functionList": [ + { + "code": "000000", + "id": 1432151665447821314, + "menuId": 1432151665301020674, + "name": "娴忚", + "url": "" + }, + { + "code": "000002", + "id": 1432153711810994178, + "menuId": 1432151665301020674, + "name": "钖祫鏌ヨ", + "url": "*/Salary/**" + } + ], + "id": 1432151665301020674, + "isNewWindow": "NO", + "name": "钖祫鏌ヨ", + "parentId": 1426088154577788929, + "registerMenu": "YES", + "withUserId": "NO" + }, + { + "applicationId": 1423509196690710529, + "code": "SBD_001", + "enabled": "YES", + "functionList": [ + { + "code": "000000", + "id": 1432151974169567234, + "menuId": 1432151974005989378, + "name": "娴忚", + "url": "" + }, + { + "code": "000001", + "id": 1432152525926064129, + "menuId": 1432151974005989378, + "name": "椤圭洰绠$悊", + "url": "*/Project/**" + } + ], + "id": 1432151974005989378, + "isNewWindow": "NO", + "name": "椤圭洰鏌ヨ", + "parentId": 1426088154577788929, + "registerMenu": "YES", + "withUserId": "NO" + } + ], + "name": "寰棬鎴�", + "organizationList": [ + { + "applicationId": 1423509196690710529, + "code": "000000", + "enabled": "NO", + "id": 1438424540454612993, + "isDefault": "NO", + "name": "寰棬鎴�", + "parentId": 0, + "userIdList": [] + } + ], + "recognizeId": "micro-portal", + "roleList": [ + { + "applicationId": 1423509196690710529, + "enable": "YES", + "functionIds": [ + 1423509197328244731, + 1426088154741366786, + 1432154090418233345, + 1432154544812351489, + 1432154219720237058, + 1432154727176495106, + 1432151665447821314, + 1432153711810994178, + 1432151974169567234, + 1432152525926064129 + ], + "id": 1432180562247835650, + "isDefault": "NO", + "name": "榛樿" + } + ], + "useDefault": "YES", + "version": "0.0.9-SNAPSHOT" +} \ No newline at end of file