From de8473b6986109ea53011456ed03cc64fa9d516f Mon Sep 17 00:00:00 2001 From: gk Date: Sat, 19 Feb 2022 21:30:44 +0800 Subject: [PATCH] 1.01 --- modules/kdayun-app/.classpath | 7 +- modules/kdayun-app/pom.xml | 5 + modules/kdayun-demo/.classpath | 27 ++++ modules/kdayun-demo/.gitignore | 1 + modules/kdayun-demo/.project | 45 +++++++ modules/kdayun-demo/build.bat | 8 ++ modules/kdayun-demo/jar-source.bat | 5 + modules/kdayun-demo/jar.bat | 3 + modules/kdayun-demo/mavendeploy.bat | 6 + modules/kdayun-demo/maveninstall.bat | 1 + modules/kdayun-demo/pom.xml | 122 ++++++++++++++++++ .../src/main/java/META-INF/MANIFEST.MF | 3 + .../demo/controller/DemoController.java | 39 ++++++ .../com/kdayun/demo/service/DemoService.java | 14 ++ .../demo/service/impl/DemoServiceImpl.java | 29 +++++ .../main/java/com/kdayun/demo/util/Utils.java | 21 +++ .../test/java/com/kdayun/report/AppTest.java | 24 ++++ pom.xml | 109 ++++++++-------- 18 files changed, 408 insertions(+), 61 deletions(-) create mode 100644 modules/kdayun-demo/.classpath create mode 100644 modules/kdayun-demo/.gitignore create mode 100644 modules/kdayun-demo/.project create mode 100644 modules/kdayun-demo/build.bat create mode 100644 modules/kdayun-demo/jar-source.bat create mode 100644 modules/kdayun-demo/jar.bat create mode 100644 modules/kdayun-demo/mavendeploy.bat create mode 100644 modules/kdayun-demo/maveninstall.bat create mode 100644 modules/kdayun-demo/pom.xml create mode 100644 modules/kdayun-demo/src/main/java/META-INF/MANIFEST.MF create mode 100644 modules/kdayun-demo/src/main/java/com/kdayun/demo/controller/DemoController.java create mode 100644 modules/kdayun-demo/src/main/java/com/kdayun/demo/service/DemoService.java create mode 100644 modules/kdayun-demo/src/main/java/com/kdayun/demo/service/impl/DemoServiceImpl.java create mode 100644 modules/kdayun-demo/src/main/java/com/kdayun/demo/util/Utils.java create mode 100644 modules/kdayun-demo/src/test/java/com/kdayun/report/AppTest.java diff --git a/modules/kdayun-app/.classpath b/modules/kdayun-app/.classpath index cfc54e4..aca5799 100644 --- a/modules/kdayun-app/.classpath +++ b/modules/kdayun-app/.classpath @@ -18,19 +18,16 @@ + + - - - - - diff --git a/modules/kdayun-app/pom.xml b/modules/kdayun-app/pom.xml index 70cac0c..cb987da 100644 --- a/modules/kdayun-app/pom.xml +++ b/modules/kdayun-app/pom.xml @@ -54,6 +54,11 @@ kdayun-baidu 1.0.1 + + com.kdayun + kdayun-demo + 1.0.1 + com.github.bingoohuang patchca diff --git a/modules/kdayun-demo/.classpath b/modules/kdayun-demo/.classpath new file mode 100644 index 0000000..5e8a55f --- /dev/null +++ b/modules/kdayun-demo/.classpath @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/kdayun-demo/.gitignore b/modules/kdayun-demo/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/modules/kdayun-demo/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/modules/kdayun-demo/.project b/modules/kdayun-demo/.project new file mode 100644 index 0000000..78332ab --- /dev/null +++ b/modules/kdayun-demo/.project @@ -0,0 +1,45 @@ + + + kdayun-demo + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.genuitec.eclipse.springframework.springbuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/modules/kdayun-demo/build.bat b/modules/kdayun-demo/build.bat new file mode 100644 index 0000000..e78da30 --- /dev/null +++ b/modules/kdayun-demo/build.bat @@ -0,0 +1,8 @@ +cd /d %~dp0 +set JAVA_HOME="D:\BS\Server\tomcat8\jdk" +set mavenpath=H:\M\BS\maven\apache-maven-3.2.5\bin\mvn +call jar.bat +call jar-source.bat +call maveninstall.bat + + diff --git a/modules/kdayun-demo/jar-source.bat b/modules/kdayun-demo/jar-source.bat new file mode 100644 index 0000000..7892c81 --- /dev/null +++ b/modules/kdayun-demo/jar-source.bat @@ -0,0 +1,5 @@ +cd /d %~dp0 + +mvn source:jar -Dmaven.test.skip=true + + diff --git a/modules/kdayun-demo/jar.bat b/modules/kdayun-demo/jar.bat new file mode 100644 index 0000000..b621aff --- /dev/null +++ b/modules/kdayun-demo/jar.bat @@ -0,0 +1,3 @@ +cd /d %~dp0 + +mvn clean package -Dmaven.test.skip=true \ No newline at end of file diff --git a/modules/kdayun-demo/mavendeploy.bat b/modules/kdayun-demo/mavendeploy.bat new file mode 100644 index 0000000..e5baf51 --- /dev/null +++ b/modules/kdayun-demo/mavendeploy.bat @@ -0,0 +1,6 @@ +cd /d %~dp0 +set JAVA_HOME="D:\BS\Server\tomcat8\jdk" +set mavenpath=H:\M\BS\maven\apache-maven-3.2.5\bin\mvn +mvn deploy -Dmaven.test.skip=true + +pause \ No newline at end of file diff --git a/modules/kdayun-demo/maveninstall.bat b/modules/kdayun-demo/maveninstall.bat new file mode 100644 index 0000000..54831e6 --- /dev/null +++ b/modules/kdayun-demo/maveninstall.bat @@ -0,0 +1 @@ +%mavenpath% install -Dmaven.test.skip=true diff --git a/modules/kdayun-demo/pom.xml b/modules/kdayun-demo/pom.xml new file mode 100644 index 0000000..30cd112 --- /dev/null +++ b/modules/kdayun-demo/pom.xml @@ -0,0 +1,122 @@ + + + + 4.0.0 + + kdayun-root + com.kdayun + 5.0.0 + ../.. + + 1.0.1 + kdayun-demo + kdayun-demo + + http://www.kdayun.com + 快搭科技(上海)有限公司-企业微信库 + + + com.kdayun + kdayun-core + ${base.version} + + + + UTF-8 + + + + kdayun-releases + http://develop.kdayun.com:8081/repository/maven-local/ + + + kdayun-snapshots + http://develop.kdayun.com:8081/repository/maven-snapshots/ + + + + + + maven-compiler-plugin + + ${jdk.version} + ${jdk.version} + UTF-8 + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + lib/ + + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + true + + + + maven-resources-plugin + + + copy-xmls + process-sources + + copy-resources + + + ${basedir}/target/classes + + + ${basedir}/src/main/java + + **/*.xml + + + + + + + + + + + + jdk-${jdk.version} + + + true + ${jdk.version} + + + ${jdk.version} + ${jdk.version} + ${jdk.version} + + + + + diff --git a/modules/kdayun-demo/src/main/java/META-INF/MANIFEST.MF b/modules/kdayun-demo/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/modules/kdayun-demo/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/modules/kdayun-demo/src/main/java/com/kdayun/demo/controller/DemoController.java b/modules/kdayun-demo/src/main/java/com/kdayun/demo/controller/DemoController.java new file mode 100644 index 0000000..2a17db2 --- /dev/null +++ b/modules/kdayun-demo/src/main/java/com/kdayun/demo/controller/DemoController.java @@ -0,0 +1,39 @@ +package com.kdayun.demo.controller; + +import java.util.Date; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.kdayun.demo.service.DemoService; +import com.kdayun.z1.core.base.BaseController; +import com.kdayun.z1.core.base.RetVo; +import com.kdayun.z1.core.base.RetVo.retstate; + +/** + * 企业微信 + * + * @author gk + * + */ +@Controller +@RequestMapping("demo") +public class DemoController extends BaseController { + + @Autowired + DemoService demoService; + + /** + * 上传资源文件 返回文件资源的路径 一般用于识别的文件图片识别 + */ + @RequestMapping(value = "hello", method = RequestMethod.GET) + public RetVo upload(HttpServletRequest request, HttpServletResponse response) throws Exception { + return RetVo.getNewInstance(retstate.OK, "hello", null); + } +} diff --git a/modules/kdayun-demo/src/main/java/com/kdayun/demo/service/DemoService.java b/modules/kdayun-demo/src/main/java/com/kdayun/demo/service/DemoService.java new file mode 100644 index 0000000..8e14de5 --- /dev/null +++ b/modules/kdayun-demo/src/main/java/com/kdayun/demo/service/DemoService.java @@ -0,0 +1,14 @@ +package com.kdayun.demo.service; + +public interface DemoService { + + /** + * 获取百度云的访问AccessToken + */ + String getAccessToken(); + + /** + * 刷新百度云的访问AccessToken 失效时候使用 + */ + String refreshAccessToken(); +} diff --git a/modules/kdayun-demo/src/main/java/com/kdayun/demo/service/impl/DemoServiceImpl.java b/modules/kdayun-demo/src/main/java/com/kdayun/demo/service/impl/DemoServiceImpl.java new file mode 100644 index 0000000..ae1580a --- /dev/null +++ b/modules/kdayun-demo/src/main/java/com/kdayun/demo/service/impl/DemoServiceImpl.java @@ -0,0 +1,29 @@ +package com.kdayun.demo.service.impl; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import com.kdayun.demo.service.DemoService; +import com.kdayun.demo.util.Utils; + +@Service +public class DemoServiceImpl implements DemoService { + public static String baiduAccessToken = ""; + + @Override + public String getAccessToken() { + if (StringUtils.isNotBlank(baiduAccessToken)) { + return baiduAccessToken; + } else { + baiduAccessToken = Utils.getAccessToken(); + } + return baiduAccessToken; + } + + @Override + public String refreshAccessToken() { + baiduAccessToken = Utils.getAccessToken(); + return baiduAccessToken; + } + +} diff --git a/modules/kdayun-demo/src/main/java/com/kdayun/demo/util/Utils.java b/modules/kdayun-demo/src/main/java/com/kdayun/demo/util/Utils.java new file mode 100644 index 0000000..b621c48 --- /dev/null +++ b/modules/kdayun-demo/src/main/java/com/kdayun/demo/util/Utils.java @@ -0,0 +1,21 @@ +package com.kdayun.demo.util; + +import org.springframework.beans.factory.annotation.Value; + +public class Utils { + + @Value("${demo.appid}") + private String appid; + @Value("${demo.appkey}") + private String appkey; + @Value("${demo.secretkey}") + private String secretkey; + + /** + * 请求获取微信的授权Accesstoken + */ + public static String getAccessToken() { + return ""; + } + +} diff --git a/modules/kdayun-demo/src/test/java/com/kdayun/report/AppTest.java b/modules/kdayun-demo/src/test/java/com/kdayun/report/AppTest.java new file mode 100644 index 0000000..8c0736e --- /dev/null +++ b/modules/kdayun-demo/src/test/java/com/kdayun/report/AppTest.java @@ -0,0 +1,24 @@ +package com.kdayun.report; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * + * @package com.kdayun.demo + * @author qjb + * @email qjb@kdayun.com.cn + * @date 2019年3月26日下午5:05:43 + * @company 快搭科技(上海)有限公司 + * @desc + */ +public class AppTest { + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() { + assertTrue(true); + } +} diff --git a/pom.xml b/pom.xml index 7a80b94..ed64f23 100644 --- a/pom.xml +++ b/pom.xml @@ -13,10 +13,7 @@ modules/kdayun-app - modules/kdayun-manager - modules/kdayun-core - modules/kdayun-admin - modules/kdayun-report + modules/kdayun-demo - - org.apache.logging.log4j - log4j-api - ${log4j.version} - - - org.apache.logging.log4j - log4j-core - ${log4j.version} - - - - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j.version} - compile - + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j.version} + compile + @@ -444,9 +441,9 @@ ${workflow.version} - org.codehaus.groovy - groovy-all - + org.codehaus.groovy + groovy-all + @@ -468,10 +465,10 @@ ${workflow.version} - org.codehaus.groovy - groovy-all - - + org.codehaus.groovy + groovy-all + + @@ -480,10 +477,10 @@ ${workflow.version} - org.codehaus.groovy - groovy-all - - + org.codehaus.groovy + groovy-all + + @@ -492,10 +489,10 @@ ${workflow.version} - org.codehaus.groovy - groovy-all - - + org.codehaus.groovy + groovy-all + + @@ -544,10 +541,10 @@ ${workflow.version} - org.codehaus.groovy - groovy-all - - + org.codehaus.groovy + groovy-all + + @@ -556,10 +553,10 @@ ${workflow.version} - org.codehaus.groovy - groovy-all - - + org.codehaus.groovy + groovy-all + + @@ -568,10 +565,10 @@ ${workflow.version} - org.codehaus.groovy - groovy-all - - + org.codehaus.groovy + groovy-all + + @@ -580,9 +577,9 @@ ${workflow.version} - org.codehaus.groovy - groovy-all - + org.codehaus.groovy + groovy-all + @@ -880,8 +877,8 @@ - org.springframework.boot - spring-boot-starter-cache + org.springframework.boot + spring-boot-starter-cache org.springframework.data @@ -986,8 +983,8 @@ http://develop.kdayun.com:8081/repository/maven-local/ - kdayun-snapshots - http://develop.kdayun.com:8081/repository/maven-snapshots/ - + kdayun-snapshots + http://develop.kdayun.com:8081/repository/maven-snapshots/ + \ No newline at end of file