diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 4449f92..0000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -### IDEA ### -*.iml -*/target/* -*/*.iml -/.gradle/ -*.pid -logs -/.idea/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2e60591 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +FROM irsfactoryrepository.zj.gov.cn/base/base_image:1.0 \ No newline at end of file diff --git a/README.md b/README.md index d5c89df..2066320 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ +# README 柯桥增值式服务 \ No newline at end of file diff --git a/build-spec.config b/build-spec.config new file mode 100644 index 0000000..036957f --- /dev/null +++ b/build-spec.config @@ -0,0 +1,2 @@ +artifactType=1 +artifactFile=kqapi/target/kqapi.jar \ No newline at end of file diff --git a/kqapi/logs/error.log b/kqapi/logs/error.log new file mode 100644 index 0000000..86053b2 --- /dev/null +++ b/kqapi/logs/error.log @@ -0,0 +1,446 @@ +2023-10-27 11:11:07.300 [main] ERROR o.s.boot.SpringApplication -Application run failed +org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqController' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\controller\DscSxAdsShareItemQltQlsxCommonIDVKqController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'matterManage' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\manage\MatterManage.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) + at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:420) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) + at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:144) + at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) + at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) + at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124) + at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) + at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) + at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43) + at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) + at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) + at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) + at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) + at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) + at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) + at org.junit.runners.ParentRunner.run(ParentRunner.java:413) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) + at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) + at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) + at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) + at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) + at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'matterManage' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\manage\MatterManage.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 47 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) + at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 61 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1534) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1417) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) + ... 76 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1519) + ... 87 common frames omitted +Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 100 common frames omitted +Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) + ... 114 common frames omitted +Caused by: java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.util.Assert.state(Assert.java:97) + at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:241) + at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:193) + at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:48) + at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:90) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) + ... 115 common frames omitted +2023-10-27 11:11:08.114 [main] ERROR o.s.boot.SpringApplication -Application run failed +org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqController' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\controller\DscSxAdsShareItemQltQlsxCommonIDVKqController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'matterManage' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\manage\MatterManage.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) + at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:420) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) + at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:144) + at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) + at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) + at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124) + at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.outputConditionEvaluationReport(SpringBootDependencyInjectionTestExecutionListener.java:53) + at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:46) + at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) + at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) + at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) + at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) + at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) + at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) + at org.junit.runners.ParentRunner.run(ParentRunner.java:413) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) + at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) + at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) + at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) + at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) + at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'matterManage' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\manage\MatterManage.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 46 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) + at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 60 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1534) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1417) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) + ... 75 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1519) + ... 86 common frames omitted +Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 99 common frames omitted +Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) + ... 113 common frames omitted +Caused by: java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.util.Assert.state(Assert.java:97) + at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:241) + at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:193) + at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:48) + at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:90) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) + ... 114 common frames omitted +2023-10-27 11:11:08.118 [main] ERROR o.s.test.context.TestContextManager -Caught exception while allowing TestExecutionListener [org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@54504ecd] to prepare test instance [com.ningdatech.kqapi.menu.MenuTest@2ef14fe] +java.lang.IllegalStateException: Failed to load ApplicationContext + at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132) + at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124) + at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) + at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) + at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43) + at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) + at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) + at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) + at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) + at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) + at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) + at org.junit.runners.ParentRunner.run(ParentRunner.java:413) + at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) + at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) + at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) + at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) + at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) + at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqController' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\controller\DscSxAdsShareItemQltQlsxCommonIDVKqController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'matterManage' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\manage\MatterManage.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) + at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:420) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) + at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:144) + at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) + at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) + ... 28 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'matterManage' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\manage\MatterManage.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 47 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) + at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 61 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dscSxAdsShareItemQltQlsxCommonIDVKqMapper' defined in file [D:\ningda\kq-value-added-project\kqapi\target\classes\com\ningdatech\kqapi\zzsfw\mapper\DscSxAdsShareItemQltQlsxCommonIDVKqMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1534) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1417) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) + ... 76 common frames omitted +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1519) + ... 87 common frames omitted +Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) + at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) + at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) + ... 100 common frames omitted +Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) + ... 114 common frames omitted +Caused by: java.lang.IllegalStateException: Cannot load driver class: com.kingbase8.Driver + at org.springframework.util.Assert.state(Assert.java:97) + at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:241) + at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:193) + at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:48) + at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:90) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) + ... 115 common frames omitted diff --git a/kqapi/logs/info-20231117-0.log b/kqapi/logs/info-20231117-0.log new file mode 100644 index 0000000..d9ed742 --- /dev/null +++ b/kqapi/logs/info-20231117-0.log @@ -0,0 +1,92 @@ +2023-11-17 10:49:40.856 [background-preinit] INFO o.h.validator.internal.util.Version -HV000001: Hibernate Validator 6.2.4.Final +2023-11-17 10:49:40.871 [main] INFO c.n.kqapi.menu.DuplicationTest -Starting DuplicationTest using Java 1.8.0_131 on LAPTOP-NQGEQP03 with PID 1660 (started by PoffyZhang in D:\ningda\kq-value-added-project\kqapi) +2023-11-17 10:49:40.872 [main] INFO c.n.kqapi.menu.DuplicationTest -The following 1 profile is active: "dev" +2023-11-17 10:49:43.409 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat initialized with port(s): 0 (http) +2023-11-17 10:49:43.422 [main] INFO o.a.coyote.http11.Http11NioProtocol -Initializing ProtocolHandler ["http-nio-auto-1"] +2023-11-17 10:49:43.422 [main] INFO o.a.catalina.core.StandardService -Starting service [Tomcat] +2023-11-17 10:49:43.423 [main] INFO o.a.catalina.core.StandardEngine -Starting Servlet engine: [Apache Tomcat/9.0.65] +2023-11-17 10:49:43.548 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/kq] -Initializing Spring embedded WebApplicationContext +2023-11-17 10:49:43.548 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext -Root WebApplicationContext: initialization completed in 2619 ms +2023-11-17 10:49:45.799 [main] INFO com.ningdatech.swagger.SwaggerConfig -swagger文档加载…… +2023-11-17 10:49:46.978 [main] INFO c.n.kqapi.common.config.BeanConfig ------restTemplate-----初始化完成 +2023-11-17 10:49:47.437 [main] INFO s.d.s.w.WebMvcPropertySourcedRequestMappingHandlerMapping -Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2ControllerWebMvc#getDocumentation(String, HttpServletRequest)] +2023-11-17 10:49:47.819 [main] WARN o.s.b.a.f.FreeMarkerAutoConfiguration -Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false) +2023-11-17 10:49:48.370 [main] INFO o.a.coyote.http11.Http11NioProtocol -Starting ProtocolHandler ["http-nio-auto-1"] +2023-11-17 10:49:48.405 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat started on port(s): 8882 (http) with context path '/kq' +2023-11-17 10:49:48.406 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Documentation plugins bootstrapped +2023-11-17 10:49:48.412 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Found 1 custom documentation plugin(s) +2023-11-17 10:49:48.459 [main] INFO s.d.s.w.s.ApiListingReferenceScanner -Scanning for api listing references +2023-11-17 10:49:48.662 [main] INFO c.n.kqapi.menu.DuplicationTest -Started DuplicationTest in 8.343 seconds (JVM running for 9.853) +2023-11-17 10:49:50.027 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Starting... +2023-11-17 10:49:50.550 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Start completed. +2023-11-17 10:50:09.079 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown initiated... +2023-11-17 10:50:09.088 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown completed. +2023-11-17 10:53:13.468 [background-preinit] INFO o.h.validator.internal.util.Version -HV000001: Hibernate Validator 6.2.4.Final +2023-11-17 10:53:13.482 [main] INFO c.n.kqapi.menu.DuplicationTest -Starting DuplicationTest using Java 1.8.0_131 on LAPTOP-NQGEQP03 with PID 25504 (started by PoffyZhang in D:\ningda\kq-value-added-project\kqapi) +2023-11-17 10:53:13.483 [main] INFO c.n.kqapi.menu.DuplicationTest -The following 1 profile is active: "dev" +2023-11-17 10:53:15.962 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat initialized with port(s): 0 (http) +2023-11-17 10:53:15.973 [main] INFO o.a.coyote.http11.Http11NioProtocol -Initializing ProtocolHandler ["http-nio-auto-1"] +2023-11-17 10:53:15.973 [main] INFO o.a.catalina.core.StandardService -Starting service [Tomcat] +2023-11-17 10:53:15.973 [main] INFO o.a.catalina.core.StandardEngine -Starting Servlet engine: [Apache Tomcat/9.0.65] +2023-11-17 10:53:16.096 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/kq] -Initializing Spring embedded WebApplicationContext +2023-11-17 10:53:16.097 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext -Root WebApplicationContext: initialization completed in 2552 ms +2023-11-17 10:53:18.302 [main] INFO com.ningdatech.swagger.SwaggerConfig -swagger文档加载…… +2023-11-17 10:53:19.393 [main] INFO c.n.kqapi.common.config.BeanConfig ------restTemplate-----初始化完成 +2023-11-17 10:53:19.765 [main] INFO s.d.s.w.WebMvcPropertySourcedRequestMappingHandlerMapping -Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2ControllerWebMvc#getDocumentation(String, HttpServletRequest)] +2023-11-17 10:53:19.992 [main] WARN o.s.b.a.f.FreeMarkerAutoConfiguration -Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false) +2023-11-17 10:53:20.272 [main] INFO o.a.coyote.http11.Http11NioProtocol -Starting ProtocolHandler ["http-nio-auto-1"] +2023-11-17 10:53:20.303 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat started on port(s): 9130 (http) with context path '/kq' +2023-11-17 10:53:20.304 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Documentation plugins bootstrapped +2023-11-17 10:53:20.309 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Found 1 custom documentation plugin(s) +2023-11-17 10:53:20.357 [main] INFO s.d.s.w.s.ApiListingReferenceScanner -Scanning for api listing references +2023-11-17 10:53:20.526 [main] INFO c.n.kqapi.menu.DuplicationTest -Started DuplicationTest in 7.616 seconds (JVM running for 8.671) +2023-11-17 10:53:21.705 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Starting... +2023-11-17 10:53:22.183 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Start completed. +2023-11-17 10:58:52.050 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown initiated... +2023-11-17 10:58:52.057 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown completed. +2023-11-17 11:21:22.316 [background-preinit] INFO o.h.validator.internal.util.Version -HV000001: Hibernate Validator 6.2.4.Final +2023-11-17 11:21:22.329 [main] INFO c.n.kqapi.menu.DuplicationTest -Starting DuplicationTest using Java 1.8.0_131 on LAPTOP-NQGEQP03 with PID 31264 (started by PoffyZhang in D:\ningda\kq-value-added-project\kqapi) +2023-11-17 11:21:22.329 [main] INFO c.n.kqapi.menu.DuplicationTest -The following 1 profile is active: "dev" +2023-11-17 11:21:24.781 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat initialized with port(s): 0 (http) +2023-11-17 11:21:24.801 [main] INFO o.a.coyote.http11.Http11NioProtocol -Initializing ProtocolHandler ["http-nio-auto-1"] +2023-11-17 11:21:24.802 [main] INFO o.a.catalina.core.StandardService -Starting service [Tomcat] +2023-11-17 11:21:24.802 [main] INFO o.a.catalina.core.StandardEngine -Starting Servlet engine: [Apache Tomcat/9.0.65] +2023-11-17 11:21:24.953 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/kq] -Initializing Spring embedded WebApplicationContext +2023-11-17 11:21:24.954 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext -Root WebApplicationContext: initialization completed in 2564 ms +2023-11-17 11:21:27.791 [main] INFO com.ningdatech.swagger.SwaggerConfig -swagger文档加载…… +2023-11-17 11:21:28.932 [main] INFO c.n.kqapi.common.config.BeanConfig ------restTemplate-----初始化完成 +2023-11-17 11:21:29.324 [main] INFO s.d.s.w.WebMvcPropertySourcedRequestMappingHandlerMapping -Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2ControllerWebMvc#getDocumentation(String, HttpServletRequest)] +2023-11-17 11:21:29.572 [main] WARN o.s.b.a.f.FreeMarkerAutoConfiguration -Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false) +2023-11-17 11:21:29.847 [main] INFO o.a.coyote.http11.Http11NioProtocol -Starting ProtocolHandler ["http-nio-auto-1"] +2023-11-17 11:21:29.873 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat started on port(s): 1891 (http) with context path '/kq' +2023-11-17 11:21:29.875 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Documentation plugins bootstrapped +2023-11-17 11:21:29.879 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Found 1 custom documentation plugin(s) +2023-11-17 11:21:29.915 [main] INFO s.d.s.w.s.ApiListingReferenceScanner -Scanning for api listing references +2023-11-17 11:21:30.057 [main] INFO c.n.kqapi.menu.DuplicationTest -Started DuplicationTest in 8.307 seconds (JVM running for 9.268) +2023-11-17 11:21:30.482 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Starting... +2023-11-17 11:21:30.894 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Start completed. +2023-11-17 11:21:34.814 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown initiated... +2023-11-17 11:21:34.821 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown completed. +2023-11-17 11:22:30.687 [background-preinit] INFO o.h.validator.internal.util.Version -HV000001: Hibernate Validator 6.2.4.Final +2023-11-17 11:22:30.699 [main] INFO c.n.kqapi.menu.DuplicationTest -Starting DuplicationTest using Java 1.8.0_131 on LAPTOP-NQGEQP03 with PID 33544 (started by PoffyZhang in D:\ningda\kq-value-added-project\kqapi) +2023-11-17 11:22:30.700 [main] INFO c.n.kqapi.menu.DuplicationTest -The following 1 profile is active: "dev" +2023-11-17 11:22:33.079 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat initialized with port(s): 0 (http) +2023-11-17 11:22:33.094 [main] INFO o.a.coyote.http11.Http11NioProtocol -Initializing ProtocolHandler ["http-nio-auto-1"] +2023-11-17 11:22:33.095 [main] INFO o.a.catalina.core.StandardService -Starting service [Tomcat] +2023-11-17 11:22:33.096 [main] INFO o.a.catalina.core.StandardEngine -Starting Servlet engine: [Apache Tomcat/9.0.65] +2023-11-17 11:22:33.228 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/kq] -Initializing Spring embedded WebApplicationContext +2023-11-17 11:22:33.228 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext -Root WebApplicationContext: initialization completed in 2476 ms +2023-11-17 11:22:35.478 [main] INFO com.ningdatech.swagger.SwaggerConfig -swagger文档加载…… +2023-11-17 11:22:36.643 [main] INFO c.n.kqapi.common.config.BeanConfig ------restTemplate-----初始化完成 +2023-11-17 11:22:37.045 [main] INFO s.d.s.w.WebMvcPropertySourcedRequestMappingHandlerMapping -Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2ControllerWebMvc#getDocumentation(String, HttpServletRequest)] +2023-11-17 11:22:37.263 [main] WARN o.s.b.a.f.FreeMarkerAutoConfiguration -Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false) +2023-11-17 11:22:37.506 [main] INFO o.a.coyote.http11.Http11NioProtocol -Starting ProtocolHandler ["http-nio-auto-1"] +2023-11-17 11:22:37.532 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat started on port(s): 1929 (http) with context path '/kq' +2023-11-17 11:22:37.533 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Documentation plugins bootstrapped +2023-11-17 11:22:37.536 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Found 1 custom documentation plugin(s) +2023-11-17 11:22:37.572 [main] INFO s.d.s.w.s.ApiListingReferenceScanner -Scanning for api listing references +2023-11-17 11:22:37.707 [main] INFO c.n.kqapi.menu.DuplicationTest -Started DuplicationTest in 7.587 seconds (JVM running for 8.526) +2023-11-17 11:22:38.105 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Starting... +2023-11-17 11:22:38.584 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Start completed. +2023-11-17 11:23:16.073 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown initiated... +2023-11-17 11:23:16.081 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown completed. diff --git a/kqapi/logs/info.log b/kqapi/logs/info.log new file mode 100644 index 0000000..09bb614 --- /dev/null +++ b/kqapi/logs/info.log @@ -0,0 +1,23 @@ +2023-11-22 16:34:54.722 [background-preinit] INFO o.h.validator.internal.util.Version -HV000001: Hibernate Validator 6.2.4.Final +2023-11-22 16:34:54.736 [main] INFO c.n.kqapi.menu.DuplicationTest -Starting DuplicationTest using Java 1.8.0_131 on LAPTOP-NQGEQP03 with PID 7560 (started by PoffyZhang in D:\ningda\kq-value-added-project\kqapi) +2023-11-22 16:34:54.736 [main] INFO c.n.kqapi.menu.DuplicationTest -The following 1 profile is active: "dev" +2023-11-22 16:34:57.112 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat initialized with port(s): 0 (http) +2023-11-22 16:34:57.123 [main] INFO o.a.coyote.http11.Http11NioProtocol -Initializing ProtocolHandler ["http-nio-auto-1"] +2023-11-22 16:34:57.124 [main] INFO o.a.catalina.core.StandardService -Starting service [Tomcat] +2023-11-22 16:34:57.124 [main] INFO o.a.catalina.core.StandardEngine -Starting Servlet engine: [Apache Tomcat/9.0.65] +2023-11-22 16:34:57.241 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/kq] -Initializing Spring embedded WebApplicationContext +2023-11-22 16:34:57.241 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext -Root WebApplicationContext: initialization completed in 2454 ms +2023-11-22 16:34:59.543 [main] INFO com.ningdatech.swagger.SwaggerConfig -swagger文档加载…… +2023-11-22 16:35:00.675 [main] INFO c.n.kqapi.common.config.BeanConfig ------restTemplate-----初始化完成 +2023-11-22 16:35:01.087 [main] INFO s.d.s.w.WebMvcPropertySourcedRequestMappingHandlerMapping -Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2ControllerWebMvc#getDocumentation(String, HttpServletRequest)] +2023-11-22 16:35:01.309 [main] WARN o.s.b.a.f.FreeMarkerAutoConfiguration -Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false) +2023-11-22 16:35:01.562 [main] INFO o.a.coyote.http11.Http11NioProtocol -Starting ProtocolHandler ["http-nio-auto-1"] +2023-11-22 16:35:01.588 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer -Tomcat started on port(s): 32509 (http) with context path '/kq' +2023-11-22 16:35:01.589 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Documentation plugins bootstrapped +2023-11-22 16:35:01.592 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper -Found 1 custom documentation plugin(s) +2023-11-22 16:35:01.629 [main] INFO s.d.s.w.s.ApiListingReferenceScanner -Scanning for api listing references +2023-11-22 16:35:01.772 [main] INFO c.n.kqapi.menu.DuplicationTest -Started DuplicationTest in 7.554 seconds (JVM running for 8.94) +2023-11-22 16:35:02.189 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Starting... +2023-11-22 16:35:02.677 [main] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Start completed. +2023-11-22 16:35:46.625 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown initiated... +2023-11-22 16:35:46.634 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource -HikariPool-1 - Shutdown completed. diff --git a/kqapi/pom.xml b/kqapi/pom.xml index 828bdf0..10ddf10 100644 --- a/kqapi/pom.xml +++ b/kqapi/pom.xml @@ -122,36 +122,24 @@ org.springframework.boot spring-boot-configuration-processor - - com.ningdatech - nd-basic - - - org.slf4j - slf4j-log4j12 - - - spring-boot-starter-security - org.springframework.boot - - - - - com.ningdatech - nd-swagger2-starter - - - org.slf4j - slf4j-log4j12 - - - mysql mysql-connector-java + + io.swagger + swagger-models + 1.6.5 + + + + + com.github.ulisesbocchio + jasypt-spring-boot-starter + 3.0.4 + diff --git a/kqapi/src/lib/kingbase8-8.2.0.jar b/kqapi/src/lib/kingbase8-8.2.0.jar deleted file mode 100644 index 390ae26..0000000 Binary files a/kqapi/src/lib/kingbase8-8.2.0.jar and /dev/null differ diff --git a/kqapi/src/lib/kingbase8-8.6.0.jar b/kqapi/src/lib/kingbase8-8.6.0.jar deleted file mode 100644 index 965ca8f..0000000 Binary files a/kqapi/src/lib/kingbase8-8.6.0.jar and /dev/null differ diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/App.java b/kqapi/src/main/java/com/ningdatech/kqapi/App.java index 85ee652..0daeacc 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/App.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/App.java @@ -1,7 +1,7 @@ package com.ningdatech.kqapi; -import com.ningdatech.basic.util.SpringUtils; import com.ningdatech.kqapi.common.util.SpringContextHolder; +import com.ningdatech.kqapi.common.util.SpringUtils; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/config/BeanConfig.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/config/BeanConfig.java index 0bf84b1..cc05b5a 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/config/BeanConfig.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/config/BeanConfig.java @@ -1,5 +1,13 @@ package com.ningdatech.kqapi.common.config; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.json.JsonReadFeature; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.ningdatech.kqapi.common.util.NdDateUtils; +import com.ningdatech.kqapi.common.util.NdJacksonModule; +import com.ningdatech.kqapi.common.util.SpringUtils; import lombok.extern.slf4j.Slf4j; import org.apache.http.Header; import org.apache.http.client.HttpClient; @@ -9,20 +17,34 @@ import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicHeader; +import org.springframework.boot.autoconfigure.AutoConfigureBefore; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; +import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.core.convert.converter.Converter; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.lang.NonNull; import org.springframework.web.client.RestTemplate; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneId; +import java.util.*; import java.util.concurrent.TimeUnit; /** @@ -31,9 +53,10 @@ import java.util.concurrent.TimeUnit; * @Date 2023/3/2 9:42 * @Created by PoffyZhang */ +@AutoConfigureBefore(JacksonAutoConfiguration.class) @Configuration @Slf4j -public class BeanConfig { +public class BeanConfig implements WebMvcConfigurer { @Bean @@ -106,4 +129,67 @@ public class BeanConfig { .setRetryHandler(new DefaultHttpRequestRetryHandler(2, true)) .build(); } + + /** + * 全局配置 序列化和反序列化规则 + * addSerializer:序列化 (Controller 返回 给前端的json) + * 1. Long -> string + * 2. BigInteger -> string + * 3. BigDecimal -> string + * 4. date -> string + * 5. LocalDateTime -> "yyyy-MM-dd HH:mm:ss" + * 6. LocalDate -> "yyyy-MM-dd" + * 7. LocalTime -> "HH:mm:ss" + * 8. BaseEnum -> {"code": "xxx", "desc": "xxx"} + * + *

+ * addDeserializer: 反序列化 (前端调用接口时,传递到后台的json) + * 1. {"code": "xxx"} -> BaseEnum + * 2. "yyyy-MM-dd HH:mm:ss" -> LocalDateTime + * 3. "yyyy-MM-dd" -> LocalDate + * 4. "HH:mm:ss" -> LocalTime + * + * @param builder 构造器 + * @return 全局 ObjectMapper + */ + @Bean + @Primary + @ConditionalOnClass(ObjectMapper.class) + @ConditionalOnMissingBean + public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) { + ObjectMapper objectMapper = builder.createXmlMapper(false).build(); + objectMapper.setLocale(Locale.CHINA) + //去掉默认的时间戳格式 + .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) + // 时区 + .setTimeZone(TimeZone.getTimeZone(ZoneId.systemDefault())) + //Date参数日期格式 + .setDateFormat(new SimpleDateFormat(NdDateUtils.DEFAULT_DATE_TIME_FORMAT, Locale.CHINA)) + + //该特性决定parser是否允许JSON字符串包含非引号控制字符(值小于32的ASCII字符,包含制表符和换行符)。 如果该属性关闭,则如果遇到这些字符,则会抛出异常。JSON标准说明书要求所有控制符必须使用引号,因此这是一个非标准的特性 + .configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true) + // 忽略不能转义的字符 + .configure(JsonReadFeature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER.mappedFeature(), true) + //在使用spring boot + jpa/hibernate,如果实体字段上加有FetchType.LAZY,并使用jackson序列化为json串时,会遇到SerializationFeature.FAIL_ON_EMPTY_BEANS异常 + .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) + //忽略未知字段 + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + //单引号处理 + .configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + // 注册自定义模块 + objectMapper.registerModule(new NdJacksonModule()).findAndRegisterModules(); + return objectMapper; + } + + //解决跨域方式二 + static final String ORIGINS[] = new String[]{"GET", "POST", "PUT", "DELETE","OPTIONS"}; + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") // 所有的当前站点的请求地址,都支持跨域访问。 + .allowedOriginPatterns("*") // 所有的外部域都可跨域访问。 如果是localhost则很难配置,因为在跨域请求的时候,外部域的解析可能是localhost、127.0.0.1、主机名 + .allowCredentials(true) // 是否支持跨域用户凭证 + .allowedMethods(ORIGINS) // 当前站点支持的跨域请求类型是什么 + .maxAge(3600); // 超时时长设置为1小时。 时间单位是秒。 + } } diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/BizConst.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/BizConst.java index 0784b6f..ad8fb48 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/BizConst.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/BizConst.java @@ -1,6 +1,6 @@ package com.ningdatech.kqapi.common.constant; -import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.kqapi.common.model.ApiResponse; import java.math.BigDecimal; diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/DefValConst.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/DefValConst.java index 98cecd5..69385ee 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/DefValConst.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/DefValConst.java @@ -1,7 +1,7 @@ package com.ningdatech.kqapi.common.constant; -import com.ningdatech.basic.util.StrPool; +import cn.hutool.core.text.StrPool; /** * 默认值 diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/BaseDateConverter.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/BaseDateConverter.java new file mode 100644 index 0000000..1b843ff --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/BaseDateConverter.java @@ -0,0 +1,42 @@ +package com.ningdatech.kqapi.common.converter; + +import java.util.Map; +import java.util.Set; +import java.util.function.Function; + +/** + * 解决入参为 Date类型 + * + * @author WendyYang + * @date 2019-04-30 + */ +public abstract class BaseDateConverter { + + /** + * 值转换 + * + * @param source 源数据 + * @param function 回调 + * @return 转换后的数据 + */ + public T convert(String source, Function function) { + if (source == null || source.isEmpty()) { + return null; + } + String sourceTrim = source.trim(); + Set> entries = getFormat().entrySet(); + for (Map.Entry entry : entries) { + if (sourceTrim.matches(entry.getValue())) { + return function.apply(entry.getKey()); + } + } + throw new IllegalArgumentException("无效的日期参数格式:'" + sourceTrim + "'"); + } + + /** + * 获取子类 具体的格式化表达式 + * + * @return 格式化 + */ + protected abstract Map getFormat(); +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/NdLocalDateTimeDeserializer.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/NdLocalDateTimeDeserializer.java new file mode 100644 index 0000000..fec700e --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/NdLocalDateTimeDeserializer.java @@ -0,0 +1,185 @@ +package com.ningdatech.kqapi.common.converter; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.JSR310DateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; + +import java.io.IOException; +import java.time.*; +import java.time.format.DateTimeFormatter; + +import static com.ningdatech.kqapi.common.util.NdDateUtils.*; + + +/** + * 字段类型是LocalDateTime时,可以按照以下6种格式反序列化: + * 1. yyyy-MM-dd + * 2. yyyy年MM月dd日 + * 3. yyyy/MM/dd + * 4. yyyy-MM-dd HH:mm:ss + * 5. yyyy年MM月dd日HH时mm分ss秒 + * 6. yyyy/MM/dd HH:mm:ss + * + * @author WendyYang + * @date 2020/6/18 上午10:50 + */ +@SuppressWarnings("ALL") +public class NdLocalDateTimeDeserializer extends JSR310DateTimeDeserializerBase { + public static final NdLocalDateTimeDeserializer INSTANCE = new NdLocalDateTimeDeserializer(); + private static final long serialVersionUID = 1L; + private static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE_TIME; + /** + * 以下是支持的6种参数格式 + */ + private static final DateTimeFormatter DEFAULT_DATE_FORMAT_DTF = DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT); + private static final DateTimeFormatter DEFAULT_DATE_FORMAT_EN_DTF = DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT_EN); + private static final DateTimeFormatter SLASH_DATE_FORMAT_DTF = DateTimeFormatter.ofPattern(SLASH_DATE_FORMAT); + private static final DateTimeFormatter DEFAULT_DATE_TIME_FORMAT_DTF = DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT); + private static final DateTimeFormatter DEFAULT_DATE_TIME_FORMAT_EN_DTF = DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT_EN); + private static final DateTimeFormatter SLASH_DATE_TIME_FORMAT_DTF = DateTimeFormatter.ofPattern(SLASH_DATE_TIME_FORMAT); + + @Override + protected JSR310DateTimeDeserializerBase withShape(JsonFormat.Shape shape) { + return this; + } + + private NdLocalDateTimeDeserializer() { + this(DEFAULT_FORMATTER); + } + + public NdLocalDateTimeDeserializer(DateTimeFormatter formatter) { + super(LocalDateTime.class, formatter); + } + + protected NdLocalDateTimeDeserializer(NdLocalDateTimeDeserializer base, Boolean leniency) { + super(base, leniency); + } + + @Override + protected NdLocalDateTimeDeserializer withLeniency(Boolean leniency) { + return new NdLocalDateTimeDeserializer(this, leniency); + } + + @Override + protected JSR310DateTimeDeserializerBase withDateFormat(DateTimeFormatter formatter) { + return new LocalDateTimeDeserializer(formatter); + } + + private LocalDateTime convert(String source) { + if (source.matches(DEFAULT_DATE_FORMAT_MATCHES)) { + return LocalDateTime.of(LocalDate.parse(source, DEFAULT_DATE_FORMAT_DTF), LocalTime.MIN); + } + if (source.matches(DEFAULT_DATE_FORMAT_EN_MATCHES)) { + return LocalDateTime.of(LocalDate.parse(source, DEFAULT_DATE_FORMAT_EN_DTF), LocalTime.MIN); + } + if (source.matches(SLASH_DATE_FORMAT_MATCHES)) { + return LocalDateTime.of(LocalDate.parse(source, SLASH_DATE_FORMAT_DTF), LocalTime.MIN); + } + if (source.matches(DEFAULT_DATE_TIME_FORMAT_MATCHES)) { + return LocalDateTime.parse(source, DEFAULT_DATE_TIME_FORMAT_DTF); + } + if (source.matches(DEFAULT_DATE_TIME_FORMAT_EN_MATCHES)) { + return LocalDateTime.parse(source, DEFAULT_DATE_TIME_FORMAT_EN_DTF); + } + if (source.matches(SLASH_DATE_TIME_FORMAT_MATCHES)) { + return LocalDateTime.parse(source, SLASH_DATE_TIME_FORMAT_DTF); + } + return null; + } + + @Override + public LocalDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + // 字符串 + if (parser.hasTokenId(JsonTokenId.ID_STRING)) { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + + try { + if (_formatter == null) { + return convert(string); + } + if (_formatter == DEFAULT_FORMATTER) { + // JavaScript by default includes time and zone in JSON serialized Dates (UTC/ISO instant format). + if (string.length() > 10 && string.charAt(10) == 'T') { + if (string.endsWith("Z")) { + return LocalDateTime.ofInstant(Instant.parse(string), ZoneOffset.UTC); + } else { + return LocalDateTime.parse(string, DEFAULT_FORMATTER); + } + } + return convert(string); + } + + return LocalDateTime.parse(string, this._formatter); + } catch (DateTimeException e) { + return _handleDateTimeException(context, e, string); + } + } + // 数组 + if (parser.isExpectedStartArrayToken()) { + JsonToken t = parser.nextToken(); + if (t == JsonToken.END_ARRAY) { + return null; + } + if ((t == JsonToken.VALUE_STRING || t == JsonToken.VALUE_EMBEDDED_OBJECT) + && context.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { + final LocalDateTime parsed = deserialize(parser, context); + if (parser.nextToken() != JsonToken.END_ARRAY) { + handleMissingEndArrayForSingle(parser, context); + } + return parsed; + } + if (t == JsonToken.VALUE_NUMBER_INT) { + LocalDateTime result; + + int year = parser.getIntValue(); + int month = parser.nextIntValue(-1); + int day = parser.nextIntValue(-1); + int hour = parser.nextIntValue(-1); + int minute = parser.nextIntValue(-1); + + t = parser.nextToken(); + if (t == JsonToken.END_ARRAY) { + result = LocalDateTime.of(year, month, day, hour, minute); + } else { + int second = parser.getIntValue(); + t = parser.nextToken(); + if (t == JsonToken.END_ARRAY) { + result = LocalDateTime.of(year, month, day, hour, minute, second); + } else { + int partialSecond = parser.getIntValue(); + if (partialSecond < 1_000 && + !context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + // value is milliseconds, convert it to nanoseconds + partialSecond *= 1_000_000; + } + if (parser.nextToken() != JsonToken.END_ARRAY) { + throw context.wrongTokenException(parser, handledType(), JsonToken.END_ARRAY, "Expected array to end"); + } + result = LocalDateTime.of(year, month, day, hour, minute, second, partialSecond); + } + } + return result; + } + context.reportInputMismatch(handledType(), "Unexpected token (%s) within Array, expected VALUE_NUMBER_INT", t); + } + // 数字 + if (parser.hasToken(JsonToken.VALUE_NUMBER_INT)) { + return Instant.ofEpochMilli(parser.getLongValue()).atZone(ZoneOffset.ofHours(8)).toLocalDateTime(); + } + // 没看懂这个是啥 + if (parser.hasToken(JsonToken.VALUE_EMBEDDED_OBJECT)) { + return (LocalDateTime) parser.getEmbeddedObject(); + } + + return _handleUnexpectedToken(context, parser, "当前参数需要数组、字符串、时间戳。"); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2DateConverter.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2DateConverter.java new file mode 100644 index 0000000..dd3e772 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2DateConverter.java @@ -0,0 +1,77 @@ +package com.ningdatech.kqapi.common.converter; + +import com.ningdatech.kqapi.common.exception.BizException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.convert.converter.Converter; +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; + +import static com.ningdatech.kqapi.common.exception.BaseException.BASE_VALID_PARAM; +import static com.ningdatech.kqapi.common.util.NdDateUtils.*; + + +/** + * 解决入参为 Date类型 + * + * @author WendyYang + * @date 2019-04-30 + */ +@Slf4j +public class String2DateConverter extends BaseDateConverter implements Converter { + + protected static final Map FORMAT = new LinkedHashMap<>(15); + + static { + FORMAT.put(DEFAULT_YEAR_FORMAT, "^\\d{4}"); + FORMAT.put(DEFAULT_MONTH_FORMAT, "^\\d{4}-\\d{1,2}$"); + FORMAT.put(DEFAULT_DATE_FORMAT, DEFAULT_DATE_FORMAT_MATCHES); + FORMAT.put("yyyy-MM-dd HH", "^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}"); + FORMAT.put("yyyy-MM-dd HH:mm", "^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$"); + FORMAT.put(DEFAULT_DATE_TIME_FORMAT, DEFAULT_DATE_TIME_FORMAT_MATCHES); + FORMAT.put(DEFAULT_MONTH_FORMAT_SLASH, "^\\d{4}/\\d{1,2}$"); + FORMAT.put(SLASH_DATE_FORMAT, SLASH_DATE_FORMAT_MATCHES); + FORMAT.put("yyyy/MM/dd HH", "^\\d{4}/\\d{1,2}/\\d{1,2} {1}\\d{1,2}"); + FORMAT.put("yyyy/MM/dd HH:mm", "^\\d{4}/\\d{1,2}/\\d{1,2} {1}\\d{1,2}:\\d{1,2}$"); + FORMAT.put(SLASH_DATE_TIME_FORMAT, SLASH_DATE_TIME_FORMAT_MATCHES); + FORMAT.put(DEFAULT_DATE_FORMAT_EN, DEFAULT_DATE_FORMAT_EN_MATCHES); + FORMAT.put(DEFAULT_DATE_TIME_FORMAT_EN, DEFAULT_DATE_TIME_FORMAT_EN_MATCHES); + } + + /** + * 格式化日期 + * + * @param dateStr String 字符型日期 + * @param format String 格式 + * @return Date 日期 + */ + protected static Date parseDate(String dateStr, String format) { + try { + DateFormat dateFormat = new SimpleDateFormat(format); + //严格模式 + dateFormat.setLenient(false); + return dateFormat.parse(dateStr); + } catch (ParseException e) { + log.info("转换日期失败, date={}, format={}", dateStr, format, e); + throw new BizException(BASE_VALID_PARAM, e.getMessage(), e); + } + } + + @Override + protected Map getFormat() { + return FORMAT; + } + + @Override + @Nullable + public Date convert(@NonNull String source) { + return super.convert(source, key -> parseDate(source, key)); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalDateConverter.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalDateConverter.java new file mode 100644 index 0000000..55ebb74 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalDateConverter.java @@ -0,0 +1,40 @@ +package com.ningdatech.kqapi.common.converter; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.lang.NonNull; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.LinkedHashMap; +import java.util.Map; + +import static com.ningdatech.kqapi.common.util.NdDateUtils.*; + +/** + * 解决入参为 Date类型 + * + * @author WendyYang + * @date 2019-04-30 + */ +public class String2LocalDateConverter extends BaseDateConverter implements Converter { + + protected static final Map FORMAT = new LinkedHashMap<>(5); + + static { + FORMAT.put(DEFAULT_DATE_FORMAT, DEFAULT_DATE_FORMAT_MATCHES); + FORMAT.put(SLASH_DATE_FORMAT, SLASH_DATE_FORMAT_MATCHES); + FORMAT.put(DEFAULT_DATE_FORMAT_EN, DEFAULT_DATE_FORMAT_EN_MATCHES); + } + + @Override + protected Map getFormat() { + return FORMAT; + } + + @Override + public LocalDate convert(@NonNull String source) { + return super.convert(source, (key) -> LocalDate.parse(source, DateTimeFormatter.ofPattern(key))); + } + +} + diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalDateTimeConverter.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalDateTimeConverter.java new file mode 100644 index 0000000..3cbe5e7 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalDateTimeConverter.java @@ -0,0 +1,38 @@ +package com.ningdatech.kqapi.common.converter; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.lang.NonNull; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.LinkedHashMap; +import java.util.Map; + +import static com.ningdatech.kqapi.common.util.NdDateUtils.*; + +/** + * 解决入参为 Date类型 + * + * @author WendyYang + * @date 2019-04-30 + */ +public class String2LocalDateTimeConverter extends BaseDateConverter implements Converter { + + protected static final Map FORMAT = new LinkedHashMap<>(5); + + static { + FORMAT.put(DEFAULT_DATE_TIME_FORMAT, DEFAULT_DATE_TIME_FORMAT_MATCHES); + FORMAT.put(SLASH_DATE_TIME_FORMAT, SLASH_DATE_TIME_FORMAT_MATCHES); + FORMAT.put(DEFAULT_DATE_TIME_FORMAT_EN, DEFAULT_DATE_TIME_FORMAT_EN_MATCHES); + } + + @Override + protected Map getFormat() { + return FORMAT; + } + + @Override + public LocalDateTime convert(@NonNull String source) { + return super.convert(source, (key) -> LocalDateTime.parse(source, DateTimeFormatter.ofPattern(key))); + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalTimeConverter.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalTimeConverter.java new file mode 100644 index 0000000..c372d21 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/converter/String2LocalTimeConverter.java @@ -0,0 +1,36 @@ +package com.ningdatech.kqapi.common.converter; + +import org.springframework.core.convert.converter.Converter; + +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.LinkedHashMap; +import java.util.Map; + +import static com.ningdatech.kqapi.common.util.NdDateUtils.DEFAULT_TIME_FORMAT; + +/** + * 解决入参为 Date类型 + * + * @author WendyYang + * @date 2019-04-30 + */ +@SuppressWarnings("all") +public class String2LocalTimeConverter extends BaseDateConverter implements Converter { + + protected static final Map FORMAT = new LinkedHashMap<>(5); + + static { + FORMAT.put(DEFAULT_TIME_FORMAT, "^\\d{1,2}:\\d{1,2}:\\d{1,2}$"); + } + + @Override + protected Map getFormat() { + return FORMAT; + } + + @Override + public LocalTime convert(String source) { + return super.convert(source, (key) -> LocalTime.parse(source, DateTimeFormatter.ofPattern(key))); + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ArgumentException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ArgumentException.java new file mode 100644 index 0000000..16a9ab5 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ArgumentException.java @@ -0,0 +1,38 @@ +package com.ningdatech.kqapi.common.exception; + + +import com.ningdatech.kqapi.common.exception.code.ExceptionCode; + +/** + * 业务参数异常 + * 用于在业务中,检测到非法参数时,进行抛出的异常。 + * + * @author WendyYang + * @version 3.5.0 + */ +public class ArgumentException extends BaseUncheckedException { + + private static final long serialVersionUID = -3843907364558373817L; + + public ArgumentException(Throwable cause) { + super(cause); + } + + public ArgumentException(String message) { + super(ExceptionCode.BASE_VALID_PARAM.getCode(), message); + } + + public ArgumentException(String message, Throwable cause) { + super(ExceptionCode.BASE_VALID_PARAM.getCode(), message, cause); + } + + public ArgumentException(final String format, Object... args) { + super(ExceptionCode.BASE_VALID_PARAM.getCode(), format, args); + } + + @Override + public String toString() { + return "ArgumentException [message=" + getMessage() + ", code=" + getCode() + "]"; + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseCheckedException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseCheckedException.java new file mode 100644 index 0000000..2a80406 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseCheckedException.java @@ -0,0 +1,57 @@ +package com.ningdatech.kqapi.common.exception; + +/** + * 运行期异常基类 + * + * @author WendyYang + * @version 1.0 + */ +public abstract class BaseCheckedException extends Exception implements BaseException { + + private static final long serialVersionUID = 2706069899924648586L; + + /** + * 异常信息 + */ + private String message; + + /** + * 具体异常码 + */ + private int code; + + public BaseCheckedException(final int code, final String message) { + super(message); + this.code = code; + this.message = message; + } + + public BaseCheckedException(final int code, final String format, Object... args) { + super(String.format(format, args)); + this.code = code; + this.message = String.format(format, args); + } + + /** + * 获取 异常消息 + * + * @return 异常消息 + */ + @Override + public String getMessage() { + return message; + } + + + /** + * 获取 错误码 + * + * @return 错误码 + */ + @Override + public int getCode() { + return code; + } + + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseException.java new file mode 100644 index 0000000..1984e77 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseException.java @@ -0,0 +1,30 @@ +package com.ningdatech.kqapi.common.exception; + +/** + * 异常接口类 + * + * @author WendyYang + * @version 1.0 + */ +public interface BaseException { + + /** + * 统一参数验证异常码 + */ + int BASE_VALID_PARAM = -9; + + /** + * 返回异常信息 + * + * @return 异常信息 + */ + String getMessage(); + + /** + * 返回异常编码 + * + * @return 异常编码 + */ + int getCode(); + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseUncheckedException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseUncheckedException.java new file mode 100644 index 0000000..7a848dc --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BaseUncheckedException.java @@ -0,0 +1,65 @@ +package com.ningdatech.kqapi.common.exception; + +import cn.hutool.core.util.StrUtil; +import com.ningdatech.kqapi.common.util.StrPool; + +/** + * 非运行期异常基类,所有自定义非运行时异常继承该类 + * + * @author WendyYang + * @version 1.0 + * @see RuntimeException + */ +public class BaseUncheckedException extends RuntimeException implements BaseException { + + private static final long serialVersionUID = -778887391066124051L; + + /** + * 异常信息 + */ + private String message; + + /** + * 具体异常码 + */ + private int code; + + public BaseUncheckedException(Throwable cause) { + super(cause); + } + + public BaseUncheckedException(final int code, Throwable cause) { + super(cause); + this.code = code; + } + + + public BaseUncheckedException(final int code, final String message) { + super(message); + this.code = code; + this.message = message; + } + + public BaseUncheckedException(final int code, final String message, Throwable cause) { + super(cause); + this.code = code; + this.message = message; + } + + public BaseUncheckedException(final int code, final String format, Object... args) { + super(StrUtil.contains(format, StrPool.BRACE) ? StrUtil.format(format, args) : String.format(format, args)); + this.code = code; + this.message = StrUtil.contains(format, StrPool.BRACE) ? StrUtil.format(format, args) : String.format(format, args); + } + + + @Override + public String getMessage() { + return message; + } + + @Override + public int getCode() { + return code; + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BizException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BizException.java new file mode 100644 index 0000000..1225466 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/BizException.java @@ -0,0 +1,78 @@ +package com.ningdatech.kqapi.common.exception; + + +import com.ningdatech.kqapi.common.exception.code.BaseExceptionCode; + +/** + * 业务异常 + * 用于在处理业务逻辑时,进行抛出的异常。 + * + * @author WendyYang + * @version 1.0 + */ +public class BizException extends BaseUncheckedException { + + private static final long serialVersionUID = -3843907364558373817L; + + public BizException(Throwable cause) { + super(cause); + } + + public BizException(int code, Throwable cause) { + super(code, cause); + } + + public BizException(String message) { + super(-1, message); + } + + public BizException(String message, Throwable cause) { + super(-1, message, cause); + } + + public BizException(int code, String message) { + super(code, message); + } + + public BizException(int code, String message, Throwable cause) { + super(code, message, cause); + } + + public BizException(int code, String message, Object... args) { + super(code, message, args); + } + + /** + * 实例化异常 + * + * @param code 自定义异常编码 + * @param message 自定义异常消息 + * @param args 已定义异常参数 + * @return 异常实例 + */ + public static BizException wrap(int code, String message, Object... args) { + return new BizException(code, message, args); + } + + public static BizException wrap(String message, Object... args) { + return new BizException(-1, message, args); + } + + public static BizException validFail(String message, Object... args) { + return new BizException(-9, message, args); + } + + public static BizException wrap(BaseExceptionCode ex) { + return new BizException(ex.getCode(), ex.getMsg()); + } + + public static BizException wrap(BaseExceptionCode ex, Throwable cause) { + return new BizException(ex.getCode(), ex.getMsg(), cause); + } + + @Override + public String toString() { + return "BizException [message=" + getMessage() + ", code=" + getCode() + "]"; + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/CommonException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/CommonException.java new file mode 100644 index 0000000..e14a447 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/CommonException.java @@ -0,0 +1,30 @@ +package com.ningdatech.kqapi.common.exception; + +/** + * 非业务异常 + * 用于在处理非业务逻辑时,进行抛出的异常。 + * + * @author WendyYang + * @version 1.0 + * @see Exception + */ +public class CommonException extends BaseCheckedException { + + + public CommonException(int code, String message) { + super(code, message); + } + + public CommonException(int code, String format, Object... args) { + super(code, format, args); + } + + public CommonException wrap(int code, String format, Object... args) { + return new CommonException(code, format, args); + } + + @Override + public String toString() { + return "BizException [message=" + getMessage() + ", code=" + getCode() + "]"; + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/DownloadException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/DownloadException.java new file mode 100644 index 0000000..0397cff --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/DownloadException.java @@ -0,0 +1,27 @@ +package com.ningdatech.kqapi.common.exception; + +import com.ningdatech.kqapi.common.exception.code.ExceptionCode; + +/** + *

+ * DownloadException + *

+ * + * @author WendyYang + * @since 16:02 2024/1/8 + */ +public class DownloadException extends BaseUncheckedException { + + public DownloadException(Throwable cause) { + super(cause); + } + + public DownloadException(String message, Object... args) { + super(ExceptionCode.BAD_REQUEST.getCode(), message, args); + } + + public static DownloadException wrap(String message, Object... args) { + return new DownloadException(message, args); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ExportException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ExportException.java new file mode 100644 index 0000000..16b76bc --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ExportException.java @@ -0,0 +1,28 @@ +package com.ningdatech.kqapi.common.exception; + + +import com.ningdatech.kqapi.common.exception.code.ExceptionCode; + +/** + *

+ * ExportException + *

+ * + * @author WendyYang + * @since 16:02 2024/1/8 + */ +public class ExportException extends BaseUncheckedException { + + public ExportException(Throwable cause) { + super(cause); + } + + public ExportException(String message, Object... args) { + super(ExceptionCode.BAD_REQUEST.getCode(), message, args); + } + + public static ExportException wrap(String message, Object... args) { + return new ExportException(message, args); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ForbiddenException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ForbiddenException.java new file mode 100644 index 0000000..f744ca1 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/ForbiddenException.java @@ -0,0 +1,33 @@ +package com.ningdatech.kqapi.common.exception; + +import com.ningdatech.kqapi.common.exception.code.BaseExceptionCode; +import com.ningdatech.kqapi.common.exception.code.ExceptionCode; + +/** + * 403 禁止访问 + * + * @author WendyYang + * @version 1.0 + */ +public class ForbiddenException extends BaseUncheckedException { + + private static final long serialVersionUID = 1L; + + public ForbiddenException(int code, String message) { + super(code, message); + } + + public static ForbiddenException wrap(BaseExceptionCode ex) { + return new ForbiddenException(ex.getCode(), ex.getMsg()); + } + + public static ForbiddenException wrap(String msg) { + return new ForbiddenException(ExceptionCode.FORBIDDEN.getCode(), msg); + } + + @Override + public String toString() { + return "ForbiddenException [message=" + getMessage() + ", code=" + getCode() + "]"; + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/UnauthorizedException.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/UnauthorizedException.java new file mode 100644 index 0000000..3637283 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/UnauthorizedException.java @@ -0,0 +1,33 @@ +package com.ningdatech.kqapi.common.exception; + + +import com.ningdatech.kqapi.common.exception.code.ExceptionCode; + +/** + * 401 未认证 未登录 + * + * @author WendyYang + * @version 1.0 + */ +public class UnauthorizedException extends BaseUncheckedException { + + private static final long serialVersionUID = 1L; + + public UnauthorizedException(int code, String message) { + super(code, message); + } + + public UnauthorizedException(int code, String message, Throwable cause) { + super(code, message, cause); + } + + public static UnauthorizedException wrap(String msg) { + return new UnauthorizedException(ExceptionCode.UNAUTHORIZED.getCode(), msg); + } + + @Override + public String toString() { + return "UnauthorizedException [message=" + getMessage() + ", code=" + getCode() + "]"; + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/code/BaseExceptionCode.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/code/BaseExceptionCode.java new file mode 100644 index 0000000..eca67d6 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/code/BaseExceptionCode.java @@ -0,0 +1,23 @@ +package com.ningdatech.kqapi.common.exception.code; + +/** + * 异常编码 + * + * @author WendyYang + * @date 2017-12-25 13:46 + */ +public interface BaseExceptionCode { + /** + * 异常编码 + * + * @return 异常编码 + */ + int getCode(); + + /** + * 异常消息 + * + * @return 异常消息 + */ + String getMsg(); +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/code/ExceptionCode.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/code/ExceptionCode.java new file mode 100644 index 0000000..6a3ce13 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/exception/code/ExceptionCode.java @@ -0,0 +1,103 @@ +package com.ningdatech.kqapi.common.exception.code; + + +/** + * 异常编码 + * + * @author WendyYang + * @date 2017-12-13 16:22 + */ +public enum ExceptionCode implements BaseExceptionCode { + + //系统相关 start + SUCCESS(0, "成功"), + SYSTEM_BUSY(-1, "系统繁忙~请稍后再试~"), + SYSTEM_TIMEOUT(-2, "系统维护中~请稍后再试~"), + PARAM_EX(-3, "参数类型解析异常"), + SQL_EX(-4, "运行SQL出现异常"), + NULL_POINT_EX(-5, "空指针异常"), + ILLEGAL_ARGUMENT_EX(-6, "无效参数异常"), + MEDIA_TYPE_EX(-7, "请求类型异常"), + LOAD_RESOURCES_ERROR(-8, "加载资源出错"), + BASE_VALID_PARAM(-9, "统一验证参数异常"), + OPERATION_EX(-10, "操作异常"), + SERVICE_MAPPER_ERROR(-11, "Mapper类转换异常"), + CAPTCHA_ERROR(-12, "验证码校验失败"), + JSON_PARSE_ERROR(-13, "JSON解析异常"), + + + OK(200, "OK"), + BAD_REQUEST(400, "错误的请求"), + /** + * {@code 401 Unauthorized}. 需要重新登录。 + * 该HTTP状态码表示认证错误,它是为了认证设计的,而不是为了授权设计的。收到401响应,表示请求没有被认证—压根没有认证或者认证不正确—但是请重新认证和重试。(一般在响应头部包含一个WWW-Authenticate来描述如何认证)。通常由web服务器返回,而不是web应用。从性质上来说是临时的东西。(服务器要求客户端重试) + * + * @see HTTP/1.1: Authentication, section 3.1 + */ + UNAUTHORIZED(401, "未认证"), + /** 该HTTP状态码是关于授权方面的。从性质上来说是永久的东西,和应用的业务逻辑相关联。它比401更具体,更实际。收到403响应表示服务器完成认证过程,但是客户端请求没有权限去访问要求的资源。 */ + FORBIDDEN(403, "禁止访问"), + /** + * {@code 404 Not Found}. + * + * @see HTTP/1.1: Semantics and Content, section 6.5.4 + */ + NOT_FOUND(404, "没有找到资源"), + METHOD_NOT_ALLOWED(405, "不支持当前请求类型"), + + TOO_MANY_REQUESTS(429, "请求超过次数限制"), + INTERNAL_SERVER_ERROR(500, "内部服务错误"), + BAD_GATEWAY(502, "网关错误"), + GATEWAY_TIMEOUT(504, "网关超时"), + //系统相关 end + + REQUIRED_FILE_PARAM_EX(1001, "请求中必须至少包含一个有效文件"), + + DATA_SAVE_ERROR(2000, "新增数据失败"), + DATA_UPDATE_ERROR(2001, "修改数据失败"), + TOO_MUCH_DATA_ERROR(2002, "批量新增数据过多"), + //jwt token 相关 start + + JWT_BASIC_INVALID(40000, "无效的基本身份验证令牌"), + JWT_TOKEN_EXPIRED(40001, "会话超时,请重新登录"), + JWT_SIGNATURE(40002, "不合法的token,请认真比对 token 的签名"), + JWT_ILLEGAL_ARGUMENT(40003, "缺少token参数"), + JWT_GEN_TOKEN_FAIL(40004, "生成token失败"), + JWT_PARSER_TOKEN_FAIL(40005, "解析用户身份错误,请重新登录!"), + JWT_USER_INVALID(40006, "用户名或密码错误"), + JWT_USER_ENABLED(40007, "用户已经被禁用!"), + JWT_OFFLINE(40008, "您已在另一个设备登录!"), + JWT_NOT_LOGIN(40009, "登录超时,请重新登录!"), + //jwt token 相关 end + + ; + + private final int code; + private String msg; + + ExceptionCode(int code, String msg) { + this.code = code; + this.msg = msg; + } + + @Override + public int getCode() { + return code; + } + + @Override + public String getMsg() { + return msg; + } + + + public ExceptionCode build(String msg, Object... param) { + this.msg = String.format(msg, param); + return this; + } + + public ExceptionCode param(Object... param) { + msg = String.format(msg, param); + return this; + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalExceptionHandler.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalExceptionHandler.java index 82a981e..f5b6ae9 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalExceptionHandler.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalExceptionHandler.java @@ -1,7 +1,7 @@ package com.ningdatech.kqapi.common.handler; -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.kqapi.common.model.ApiResponse; +import com.ningdatech.kqapi.common.model.Status; import lombok.extern.slf4j.Slf4j; import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.http.HttpStatus; diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalResponseHandler.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalResponseHandler.java index b7048b7..fbb2695 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalResponseHandler.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalResponseHandler.java @@ -1,6 +1,6 @@ package com.ningdatech.kqapi.common.handler; -import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.kqapi.common.model.ApiResponse; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/model/ApiResponse.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/ApiResponse.java new file mode 100644 index 0000000..e5968e4 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/ApiResponse.java @@ -0,0 +1,123 @@ +package com.ningdatech.kqapi.common.model; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + *

+ * ApiResponse - 统一的接口返回值封装 + *

+ * + * @author WendyYang + * @since 14:29 2022/9/29 + */ +@Data +@NoArgsConstructor +public class ApiResponse implements Serializable { + private static final long serialVersionUID = 532384723325394156L; + + public static final int SUCCESS_CODE = 200; + + public static final String SUCCESS_MSG = "success"; + + public static final int ERROR_CODE = 500; + + public static final String ERROR_MSG = "Internal server error"; + + /** + * 状态码 + */ + private Integer code; + + /** + * 返回内容 + */ + private String message; + + /** + * 返回数据 + */ + private T data; + + /** + * 全参构造函数 + * + * @param code 状态码 + * @param message 返回内容 + * @param data 返回数据 + */ + private ApiResponse(Integer code, String message, T data) { + this.code = code; + this.message = message; + this.data = data; + } + + /** + * 构造一个自定义的API返回 + * + * @param code 状态码 + * @param message 返回内容 + * @param data 返回数据 + * @return ApiResponse + */ + public static ApiResponse of(Integer code, String message, T data) { + return new ApiResponse(code, message, data); + } + + public static ApiResponse of(Integer code, String message) { + return of(code, message, null); + } + + /** + * 构造一个成功且不带数据的API返回 + * + * @return ApiResponse + */ + public static ApiResponse ofSuccess() { + return ofSuccess(null); + } + + /** + * 构造一个成功且带数据的API返回 + * + * @param data 返回数据 + * @return ApiResponse + */ + public static ApiResponse ofSuccess(T data) { + return ofStatus(Status.OK, data); + } + + /** + * 构造一个成功且自定义消息的API返回 + * + * @param message 返回内容 + * @return ApiResponse + */ + public static ApiResponse ofMessage(String message) { + return of(Status.OK.getCode(), message, null); + } + + /** + * 构造一个有状态的API返回 + * + * @param status 状态 {@link Status} + * @return ApiResponse + */ + public static ApiResponse ofStatus(ApiStatus status) { + return ofStatus(status, null); + } + + /** + * 构造一个有状态且带数据的API返回 + * + * @param status 状态 {@link Status} + * @param data 返回数据 + * @return ApiResponse + */ + public static ApiResponse ofStatus(ApiStatus status, T data) { + return of(status.getCode(), status.getReasonPhrase(), data); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/model/ApiStatus.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/ApiStatus.java new file mode 100644 index 0000000..d628085 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/ApiStatus.java @@ -0,0 +1,26 @@ +package com.ningdatech.kqapi.common.model; + +/** + *

+ * ApiStatus - 通用api状态 + *

+ * + * @author WendyYang + * @since 14:44 2022/9/29 + */ +public interface ApiStatus { + /** + * 获取code + * + * @return code + */ + Integer getCode(); + + /** + * 获取短语 + * + * @return 短语 + */ + String getReasonPhrase(); + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/model/PagePo.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/PagePo.java new file mode 100644 index 0000000..7670a75 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/PagePo.java @@ -0,0 +1,30 @@ +package com.ningdatech.kqapi.common.model; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.Data; + +/** + *

+ * PagePo - 分页请求参数类 + *

+ * + * @author WendyYang + * @since 16:29 2022/9/14 + */ +@Data +public class PagePo { + + private Integer pageNumber = 1; + + private Integer pageSize = 10; + + public void page(Integer pageNumber, Integer pageSize) { + this.pageNumber = pageNumber; + this.pageSize = pageSize; + } + + public Page page() { + return Page.of(pageNumber, pageSize); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/model/PageVo.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/PageVo.java new file mode 100644 index 0000000..42825e3 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/PageVo.java @@ -0,0 +1,63 @@ +package com.ningdatech.kqapi.common.model; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.Collections; + +/** + *

+ * PageVo - 分页返回的包装对象 + *

+ * + * @author WendyYang + * @since 14:43 2022/9/29 + */ +@Data +@NoArgsConstructor +public class PageVo { + + private Collection records; + private Long total; + + private Boolean hasNextPage; + + public PageVo(Collection records, Boolean hasNextPage) { + this.records = records; + this.hasNextPage = hasNextPage; + } + + public PageVo(Collection records, Long total) { + this.records = records; + this.total = total; + } + + public void setTotal(Long total) { + this.total = total; + } + + public static PageVo of(Collection data, Long total) { + return new PageVo<>(data, total); + } + + public static PageVo of(Collection data, Integer total) { + return new PageVo<>(data, (long) total); + } + + /** + * 移动端无需展示总页码使用 + * + * @param data 分页数据 + * @param hasNextPage 是否有下一页 + * @author WendyYang + **/ + public static PageVo of(Collection data, Boolean hasNextPage) { + return new PageVo<>(data, hasNextPage); + } + + public static PageVo empty() { + return new PageVo<>(Collections.emptyList(), 0L); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/model/Status.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/Status.java new file mode 100644 index 0000000..192f7d8 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/model/Status.java @@ -0,0 +1,123 @@ +package com.ningdatech.kqapi.common.model; + +import lombok.Getter; + +/** + * @description: + * @author: liushuai + * @date: 2022/3/25 11:31 + */ +@Getter +public enum Status implements ApiStatus { + /** + * 正常 + */ + OK(200, "正常"), + /** + * 请求错误 + */ + BAD_REQUEST(400, "请求错误"), + /** + * Unauthorized + */ + NO_AUTHORIZATION(401, "未经授权的"), + /** + * 服务器解析不到用户请求的服务名称 + */ + REQUEST_NOT_FOUND(404, "服务不存在"), + /** + * 未知异常 + */ + UNKNOWN_ERROR(500, "服务器内部错误"), + /** + * 未定义异常 + */ + UNDEFINED(501, "未定义"), + /** + * 未定义异常 + */ + ERROR_PARAM(502, "您输入的参数有非法字符,请输入正确的参数"), + /** + * 该服务已下线 + */ + SERVICES_DISABLED(1, "服务未启用"), + /** + * 请求参数不能为空 + */ + PARAM_NOT_NULL(101, "请求参数不能为空"), + /** + * 字段名重复 + */ + COLUMN_REPEAT(112, "字段名重复,请重新填写"), + /** + * 参数不匹配 + */ + PARAM_NOT_MATCH(102, "参数不匹配"), + /** + * 权限认证参数 + */ + NO_AUT_PARAM(103, "权限参数不存在"), + /** + * 日期格式错误 + */ + DATE_FORMAT_EXCEPTION(104, "日期格式错误"), + /** + * 网络连接异常 + */ + CONNECTION_REFUSED(105, "连接拒绝"), + /** + * 登录失败 + */ + LOGIN_BAD(107, "用户登录失败,请确认用户信息"), + /** + * 流程删除失败 + */ + BAD_DELETE_PROCESS(106,"文件已进入流转流程,删除失败"), + /** + * 无可用端口 + */ + NO_PORT_AVAILABLE(111, "无可用端口"), + /** + * 文件下载异常 + */ + FILE_DOWNLOAD_EXCEPTION(607, "文件下载异常"), + /** + * 文件传输异常 + */ + FILE_TRANS_EXCEPTION(608, "文件传输异常"), + /** + * 文件名不存在 + */ + FILE_NAME_EXCEPTION(609, "文件名不存在"), + /** + * 文件名不存在 + */ + FILE_NAME_REPEAT(610, "文件名重复,请重新上传"), + /** + * 文件名不存在 + */ + FILE_DELETE_FAIL(611, "文件删除异常"), + /** + * 文件名不存在 + */ + FILE_NOT_SUPPORT(612, "不支持的文件类型,请重新上传"), + /** + * 文件名不存在 + */ + FILE_NOT_EXIT(613, "业务文件未上传,请上传业务文件"); + + /** + * 状态码 + */ + private final Integer code; + + /** + * 内容 + */ + private final String reasonPhrase; + + Status(Integer code, String reasonPhrase) { + this.code = code; + this.reasonPhrase = reasonPhrase; + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/BizUtils.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/BizUtils.java index 80b6442..fc6e3f0 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/BizUtils.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/BizUtils.java @@ -1,7 +1,7 @@ package com.ningdatech.kqapi.common.util; +import cn.hutool.core.text.StrPool; import cn.hutool.core.util.StrUtil; -import com.ningdatech.basic.util.StrPool; import org.apache.commons.lang3.StringUtils; import org.springframework.util.NumberUtils; @@ -109,10 +109,6 @@ public class BizUtils { }))); } - public static String inSqlJoin(List strings) { - return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET)); - } - public static LocalDateTime convertDate(Date date) { if (Objects.nonNull(date)) { return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/CodeUtil.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/CodeUtil.java index 03faee7..2373055 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/CodeUtil.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/CodeUtil.java @@ -1,6 +1,6 @@ package com.ningdatech.kqapi.common.util; -import com.ningdatech.basic.util.StrPool; +import cn.hutool.core.text.StrPool; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/FreemarkerWordUtil.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/FreemarkerWordUtil.java deleted file mode 100644 index 02b69d6..0000000 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/FreemarkerWordUtil.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.ningdatech.kqapi.common.util; - -import cn.hutool.core.io.IoUtil; -import com.ningdatech.basic.exception.BizException; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import lombok.extern.slf4j.Slf4j; -import org.apache.http.entity.ContentType; -import org.springframework.core.io.ByteArrayResource; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; -import java.io.*; -import java.math.BigDecimal; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - *

- * FreemarkerWordUtil - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Slf4j -public class FreemarkerWordUtil { - - private static void setDownFileName(HttpServletResponse response, String fileName) { - String fileNameEncoded; - try { - fileNameEncoded = URLEncoder.encode(fileName, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException("文件名编码异常"); - } - response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileNameEncoded); - } - - private static final Configuration CONFIGURATION = new Configuration(Configuration.VERSION_2_3_31); - - static { - CONFIGURATION.setDefaultEncoding("UTF-8"); - CONFIGURATION.setClassForTemplateLoading(FreemarkerWordUtil.class, "/template"); - } - - /** - * 生成word文件 - * - * @param dataMap word中需要展示的动态数据,用map集合来保存 - * @param templateName word模板名称,例如:test.ftl - * @param filePath 文件生成的目标路径,例如:D:/wordFile/ - * @param fileName 生成的文件名称,例如:test.doc - */ - public static void create(Object dataMap, String templateName, String filePath, String fileName) { - try { - Template template = CONFIGURATION.getTemplate(templateName); - //输出文件 - File outFile = new File(filePath + File.separator + fileName); - //如果输出目标文件夹不存在,则创建 - if (!outFile.getParentFile().exists()) { - boolean ignore = outFile.getParentFile().mkdirs(); - } - //将模板和数据模型合并生成文件 - Writer out = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(outFile.toPath()), StandardCharsets.UTF_8)); - //生成文件 - template.process(dataMap, out); - IoUtil.flush(out); - IoUtil.close(out); - } catch (Exception e) { - log.error("根据模版生成Word文件失败:", e); - throw BizException.wrap("根据模版生成Word文件失败"); - } - } - - public static void export(String fileName, Object data, HttpServletResponse response, String templateName) throws TemplateException, IOException { - Template template = CONFIGURATION.getTemplate(templateName); - response.setCharacterEncoding(StandardCharsets.UTF_8.displayName()); - response.setContentType(ContentType.APPLICATION_JSON.getMimeType()); - setDownFileName(response, fileName); - try (StringWriter out = new StringWriter(); - Writer writer = new BufferedWriter(out, 4096)) { - template.process(data, writer); - try (InputStream is = new ByteArrayResource(out.toString().getBytes(StandardCharsets.UTF_8)).getInputStream(); - ServletOutputStream outputStream = response.getOutputStream()) { - // 缓冲区 - byte[] buffer = new byte[1024]; - int bytesToRead; - // 通过循环将读入的Word文件的内容输出到浏览器中 - while ((bytesToRead = is.read(buffer)) != -1) { - outputStream.write(buffer, 0, bytesToRead); - } - } - } - - - } - -} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/GzipUtils.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/GzipUtils.java deleted file mode 100644 index 46d393f..0000000 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/GzipUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ningdatech.kqapi.common.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -/** - *

- * 压缩为Gzip - *

- * - * @author WendyYang - */ -public class GzipUtils { - /** - * 使用gzip进行压缩 - */ - public static String compress(String primStr) { - if (primStr == null || primStr.length() == 0) { - return primStr; - } - ByteArrayOutputStream out = new ByteArrayOutputStream(); - GZIPOutputStream gzip = null; - try { - gzip = new GZIPOutputStream(out); - gzip.write(primStr.getBytes()); - } catch (IOException e) { - throw new RuntimeException(e); - } finally { - if (gzip != null) { - try { - gzip.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } - return new sun.misc.BASE64Encoder().encode(out.toByteArray()); - } - - /** - * 使用gzip进行解压缩 - */ - public static String uncompress(String compressedStr) { - if (compressedStr == null) { - return null; - } - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ByteArrayInputStream in = null; - GZIPInputStream ginzip = null; - byte[] compressed = null; - String decompressed = null; - try { - compressed = new sun.misc.BASE64Decoder().decodeBuffer(compressedStr); - in = new ByteArrayInputStream(compressed); - ginzip = new GZIPInputStream(in); - - byte[] buffer = new byte[1024]; - int offset = -1; - while ((offset = ginzip.read(buffer)) != -1) { - out.write(buffer, 0, offset); - } - decompressed = out.toString(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - if (ginzip != null) { - try { - ginzip.close(); - } catch (IOException e) { - } - } - if (in != null) { - try { - in.close(); - } catch (IOException e) { - } - } - try { - out.close(); - } catch (IOException e) { - } - } - return decompressed; - } - -} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/HttpUtil.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/HttpUtil.java index 17f355f..e15b995 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/HttpUtil.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/HttpUtil.java @@ -8,23 +8,15 @@ import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.DefaultHostnameVerifier; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.TrustStrategy; import org.apache.http.conn.util.PublicSuffixMatcher; import org.apache.http.conn.util.PublicSuffixMatcherLoader; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; -import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; - -import javax.net.ssl.SSLContext; import java.io.IOException; import java.net.URL; import java.util.ArrayList; @@ -51,7 +43,7 @@ public class HttpUtil { * 发送 post 请求 * @param httpUrl 地址 */ - public String sendHttpPost(String httpUrl) { + public String sendHttpPost(String httpUrl) throws IOException { HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost return sendHttpPost(httpPost); } @@ -61,7 +53,7 @@ public class HttpUtil { * @param httpUrl 地址 * @param params 参数(格式:key1=value1&key2=value2) */ - public String sendHttpPost(String httpUrl, String params) { + public String sendHttpPost(String httpUrl, String params) throws IOException { HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost try { //设置参数 @@ -69,7 +61,7 @@ public class HttpUtil { stringEntity.setContentType("application/x-www-form-urlencoded"); httpPost.setEntity(stringEntity); } catch (Exception e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage()); } return sendHttpPost(httpPost); } @@ -79,7 +71,7 @@ public class HttpUtil { * @param httpUrl 地址 * @param maps 参数 */ - public String sendHttpPost(String httpUrl, Map maps) { + public String sendHttpPost(String httpUrl, Map maps) throws IOException { HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost // 创建参数队列 List nameValuePairs = new ArrayList(); @@ -89,7 +81,7 @@ public class HttpUtil { try { httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); } catch (Exception e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage()); } return sendHttpPost(httpPost); } @@ -99,7 +91,7 @@ public class HttpUtil { * @param httpPost *@return */ - private String sendHttpPost(HttpPost httpPost) { + private String sendHttpPost(HttpPost httpPost) throws IOException { CloseableHttpClient httpClient = null; CloseableHttpResponse response = null; HttpEntity entity = null; @@ -113,18 +105,19 @@ public class HttpUtil { entity = response.getEntity(); responseContent = EntityUtils.toString(entity, "UTF-8"); } catch (Exception e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage()); } finally { + httpClient.close(); try { // 关闭连接,释放资源 if (response != null) { - response.close(); + response.close(); } if (httpClient != null) { - httpClient.close(); + httpClient.close(); } } catch (IOException e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage()); } } return responseContent; @@ -134,7 +127,7 @@ public class HttpUtil { * 发送 get 请求 * @param httpUrl */ - public String sendHttpGet(String httpUrl) { + public String sendHttpGet(String httpUrl) throws IOException { HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求 return sendHttpGet(httpGet); } @@ -153,7 +146,7 @@ public class HttpUtil { * @param httpGet *@return */ - private String sendHttpGet(HttpGet httpGet) { + private String sendHttpGet(HttpGet httpGet) throws IOException { CloseableHttpClient httpClient = null; CloseableHttpResponse response = null; HttpEntity entity = null; @@ -167,8 +160,9 @@ public class HttpUtil { entity = response.getEntity(); responseContent = EntityUtils.toString(entity, "UTF-8"); } catch (Exception e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage()); } finally { + httpClient.close(); try { // 关闭连接,释放资源 if (response != null) { @@ -178,7 +172,7 @@ public class HttpUtil { httpClient.close(); } } catch (IOException e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage()); } } return responseContent; @@ -205,7 +199,7 @@ public class HttpUtil { entity = response.getEntity(); responseContent = EntityUtils.toString(entity, "UTF-8"); } catch (Exception e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage()); } finally { try { // 关闭连接,释放资源 @@ -216,31 +210,9 @@ public class HttpUtil { httpClient.close(); } } catch (IOException e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage()); } } return responseContent; } - - /** - * 通过该工厂类创建的RestTemplate发送请求时,可忽略https证书认证 - * @return 工厂 - */ - public static HttpComponentsClientHttpRequestFactory generateHttpRequestFactory(){ - try{ - TrustStrategy acceptingTrustStrategy = ((x509Certificates, authType) -> true); - SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); - SSLConnectionSocketFactory connectionSocketFactory = new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier()); - - HttpClientBuilder httpClientBuilder = HttpClients.custom(); - httpClientBuilder.setSSLSocketFactory(connectionSocketFactory); - CloseableHttpClient httpClient = httpClientBuilder.build(); - HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); - factory.setHttpClient(httpClient); - return factory; - }catch (Exception e){ - e.printStackTrace(); - } - return null; - } } \ No newline at end of file diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/Md5Utils.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/Md5Utils.java index 80f083a..a91580b 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/Md5Utils.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/Md5Utils.java @@ -17,7 +17,7 @@ public class Md5Utils { algorithm.update(s.getBytes(StandardCharsets.UTF_8)); return algorithm.digest(); } catch (Exception e) { - LOGGER.error("MD5 Error...", e); + LOGGER.error("MD5 Error...",e.getMessage()); } return null; } @@ -45,7 +45,7 @@ public class Md5Utils { } return new String(hex.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); } catch (Exception e) { - LOGGER.error("not supported charset:", e); + LOGGER.error("not supported charset:", e.getMessage()); return s; } } diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/NdDateUtils.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/NdDateUtils.java new file mode 100644 index 0000000..793983a --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/NdDateUtils.java @@ -0,0 +1,898 @@ +package com.ningdatech.kqapi.common.util; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.StrUtil; +import com.ningdatech.kqapi.common.exception.BizException; +import lombok.extern.slf4j.Slf4j; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.*; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.stream.Stream; + +import static cn.hutool.core.date.DatePattern.*; + +/** + * 描述:日期工具类 + * + * @author WendyYang + * 修改时间:2018/4/24 + */ +@Slf4j +public final class NdDateUtils { + public static final String DEFAULT_YEAR_FORMAT = "yyyy"; + public static final String DEFAULT_MONTH_FORMAT = "yyyy-MM"; + public static final String DEFAULT_MONTH_FORMAT_SLASH = "yyyy/MM"; + public static final String DEFAULT_MONTH_FORMAT_EN = "yyyy年MM月"; + public static final String DEFAULT_WEEK_FORMAT = "yyyy-ww"; + public static final String DEFAULT_WEEK_FORMAT_EN = "yyyy年ww周"; + public static final String DEFAULT_DATE_FORMAT = NORM_DATE_PATTERN; + public static final String DEFAULT_DATE_FORMAT_EN = CHINESE_DATE_PATTERN; + public static final String DEFAULT_DATE_TIME_FORMAT = NORM_DATETIME_PATTERN; + public static final String DEFAULT_DATE_TIME_START_FORMAT = "yyyy-MM-dd 00:00:00"; + public static final String DEFAULT_DATE_TIME_END_FORMAT = "yyyy-MM-dd 23:59:59"; + public static final String DEFAULT_DATE_TIME_FORMAT_EN = CHINESE_DATE_TIME_PATTERN; + public static final String DEFAULT_TIME_FORMAT = NORM_TIME_PATTERN; + public static final String DAY = "DAY"; + public static final String MONTH = "MONTH"; + public static final String WEEK = "WEEK"; + + public static final String DEFAULT_DATE_FORMAT_MATCHES = "^\\d{4}-\\d{1,2}-\\d{1,2}$"; + public static final String DEFAULT_DATE_TIME_FORMAT_MATCHES = "^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$"; + public static final String DEFAULT_DATE_FORMAT_EN_MATCHES = "^\\d{4}年\\d{1,2}月\\d{1,2}日$"; + public static final String DEFAULT_DATE_TIME_FORMAT_EN_MATCHES = "^\\d{4}年\\d{1,2}月\\d{1,2}日\\d{1,2}时\\d{1,2}分\\d{1,2}秒$"; + public static final String SLASH_DATE_FORMAT_MATCHES = "^\\d{4}/\\d{1,2}/\\d{1,2}$"; + public static final String SLASH_DATE_TIME_FORMAT_MATCHES = "^\\d{4}/\\d{1,2}/\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$"; + public static final String SLASH_DATE_FORMAT = "yyyy/MM/dd"; + public static final String SLASH_DATE_TIME_FORMAT = "yyyy/MM/dd HH:mm:ss"; + public static final String CRON_FORMAT = "ss mm HH dd MM ? yyyy"; + + /** + * 一个月平均天数 + */ + public static final long MAX_MONTH_DAY = 30; + /** + * 3个月平均天数 + */ + public static final long MAX_3_MONTH_DAY = 90; + /** + * 一年平均天数 + */ + public static final long MAX_YEAR_DAY = 365; + private static final Map DATE_FORMAT = new LinkedHashMap<>(5); + + //---------------------------------------------------格式化日期start------------------------------------------------- + + static { + DATE_FORMAT.put(DEFAULT_DATE_FORMAT, DEFAULT_DATE_FORMAT_MATCHES); + DATE_FORMAT.put(SLASH_DATE_FORMAT, SLASH_DATE_FORMAT_MATCHES); + DATE_FORMAT.put(DEFAULT_DATE_FORMAT_EN, DEFAULT_DATE_FORMAT_EN_MATCHES); + } + + private NdDateUtils() { + } + + /** + * 将字符串解析LocalDate + * + * @param source 源参数 + * 支持以下格式: + * yyyy-MM-dd + * yyyy/MM/dd + * yyyy年MM月dd日 + * @return 日期 + */ + public static LocalDate parse(String source) { + String sourceTrim = source.trim(); + Set> entries = DATE_FORMAT.entrySet(); + for (Map.Entry entry : entries) { + if (sourceTrim.matches(entry.getValue())) { + return LocalDate.parse(source, DateTimeFormatter.ofPattern(entry.getKey())); + } + } + throw BizException.wrap("解析日期失败, 请传递正确的日期格式"); + } + + + /** + * 转换 Date 为 cron , eg: "0 07 10 15 1 ? 2016" + * + * @param date 时间点 + * @return cron 表达式 + */ + public static String getCron(Date date) { + return format(date, CRON_FORMAT); + } + + /** + * 转换 LocalDateTime 为 cron , eg. "0 07 10 15 1 ? 2016" + * + * @param date 时间点 + * @return cron 表达式 + */ + public static String getCron(LocalDateTime date) { + return format(date, CRON_FORMAT); + } + + /** + * 格式化日期,返回格式为 yyyy-MM + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String format(LocalDateTime date, String pattern) { + if (date == null) { + date = LocalDateTime.now(); + } + if (pattern == null) { + pattern = DEFAULT_MONTH_FORMAT; + } + return date.format(DateTimeFormatter.ofPattern(pattern)); + } + + public static String format(LocalDate date, String pattern) { + if (date == null) { + date = LocalDate.now(); + } + if (pattern == null) { + pattern = DEFAULT_MONTH_FORMAT; + } + return date.format(DateTimeFormatter.ofPattern(pattern)); + } + + /** + * 根据传入的格式格式化日期.默认格式为MM月dd日 + * + * @param d 日期 + * @param f 格式 + * @return 格式化后的字符串 + */ + public static String format(Date d, String f) { + Date date = d; + String format = f; + if (date == null) { + date = new Date(); + } + if (format == null) { + format = DEFAULT_DATE_TIME_FORMAT; + } + SimpleDateFormat df = new SimpleDateFormat(format); + return df.format(date); + } + + /** + * 格式化日期,返回格式为 yyyy-MM-dd + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String formatAsDate(LocalDateTime date) { + return format(date, DEFAULT_DATE_FORMAT); + } + + public static String formatAsDate(LocalDate date) { + return format(date, DEFAULT_DATE_FORMAT); + } + + public static String formatAsDateEn(LocalDateTime date) { + return format(date, DEFAULT_DATE_FORMAT_EN); + } + + + public static String formatAsYearMonth(LocalDateTime date) { + return format(date, DEFAULT_MONTH_FORMAT); + } + + public static String formatAsYearMonthEn(LocalDateTime date) { + return format(date, DEFAULT_MONTH_FORMAT_EN); + } + + /** + * 格式化日期,返回格式为 yyyy-ww + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String formatAsYearWeek(LocalDateTime date) { + return format(date, DEFAULT_WEEK_FORMAT); + } + + public static String formatAsYearWeekEn(LocalDateTime date) { + return format(date, DEFAULT_WEEK_FORMAT_EN); + } + + /** + * 格式化日期,返回格式为 yyyy-MM + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String formatAsYearMonth(Date date) { + SimpleDateFormat df = new SimpleDateFormat(DEFAULT_MONTH_FORMAT); + return df.format(date); + } + + /** + * 格式化日期,返回格式为 yyyy-ww + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String formatAsYearWeek(Date date) { + SimpleDateFormat df = new SimpleDateFormat(DEFAULT_WEEK_FORMAT); + return df.format(date); + } + + /** + * 格式化日期,返回格式为 HH:mm:ss 例:12:24:24 + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String formatAsTime(Date date) { + SimpleDateFormat df = new SimpleDateFormat(DEFAULT_TIME_FORMAT); + return df.format(date); + } + + /** + * 格式化日期,返回格式为 yyyy-MM-dd + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String formatAsDate(Date date) { + SimpleDateFormat df = new SimpleDateFormat(DEFAULT_DATE_FORMAT); + return df.format(date); + } + + /** + * 格式化日期,返回格式为 yyyy-MM-dd HH:mm:ss + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String formatAsDateTime(Date date) { + SimpleDateFormat df = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT); + return df.format(date); + } + + /** + * 格式化日期,返回格式为 dd ,即对应的天数. + * + * @param date 日期 + * @return 格式化后的字符串 + */ + public static String formatAsDay(Date date) { + SimpleDateFormat df = new SimpleDateFormat("dd"); + return df.format(date); + } + + //--格式化日期end----------------------------------------- + + //--解析日期start----------------------------------------- + + /** + * 将字符转换成日期 + * + * @param dateStr 日期字符串 + * @param format 解析格式 + * @return 解析后的日期 + */ + public static Date parse(String dateStr, String format) { + Date date = null; + SimpleDateFormat dateFormat = new SimpleDateFormat(format); + dateFormat.setLenient(false); + try { + date = dateFormat.parse(dateStr); + + } catch (Exception e) { + log.info("DateUtils error", e); + } + return date; + } + + /** + * 获取当月最后一天 + * + * @param date 日期 + * @return 当月最后一天 + */ + public static Date getLastDateOfMonth(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, 1); + calendar.set(Calendar.DAY_OF_MONTH, 0); + return calendar.getTime(); + } + + /** + * 根据传入的String返回对应的date + * + * @param source 日期字符串 + * @return 日期 + */ + public static Date parseAsDate(String source) { + String sourceTrim = source.trim(); + Set> entries = DATE_FORMAT.entrySet(); + try { + for (Map.Entry entry : entries) { + if (sourceTrim.matches(entry.getValue())) { + return new SimpleDateFormat(entry.getKey()).parse(source); + } + } + } catch (ParseException e) { + throw BizException.wrap("解析日期失败, 请传递正确的日期格式"); + } + throw BizException.wrap("解析日期失败, 请传递正确的日期格式"); + } + + /** + * 按给定参数返回Date对象 + * + * @param dateTime 时间对象格式为("yyyy-MM-dd HH:mm:ss"); + * @return 解析后的日期 + */ + public static Date parseAsDateTime(String dateTime) { + SimpleDateFormat simpledateformat = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT); + try { + return simpledateformat.parse(dateTime); + } catch (ParseException e) { + return null; + } + } + + /** + * 获取指定日期的开始时间 + * 如:00:00:00 + * + * @param value 日期 + * @return 解析后的日期 + */ + public static Date getDate0000(LocalDateTime value) { + return getDate0000(value.toLocalDate()); + } + + /** + * 获取指定日期的开始时间 + * 如:00:00:00 + * + * @param value 日期 + * @return 解析后的日期 + */ + public static Date getDate0000(Date value) { + return getDate0000(NdDateUtils.date2LocalDate(value)); + } + + /** + * 获取指定日期的开始时间 + * 如:00:00:00 + * + * @param value 日期 + * @return 解析后的日期 + */ + public static Date getDate0000(LocalDate value) { + LocalDateTime todayStart = LocalDateTime.of(value, LocalTime.MIN); + return NdDateUtils.localDateTime2Date(todayStart); + } + + /** + * 获取指定日期的结束时间 + * 如:23:59:59 + * + * @param value 日期 + * @return 解析后的日期 + */ + public static Date getDate2359(LocalDateTime value) { + return getDate2359(value.toLocalDate()); + + } + + /** + * 获取指定日期的结束时间 + * 如:23:59:59 + * + * @param value 日期 + * @return 解析后的日期 + */ + public static Date getDate2359(Date value) { + return getDate2359(NdDateUtils.date2LocalDate(value)); + } + + /** + * 获取指定日期的结束时间 + * 如:23:59:59 + * + * @param value 日期 + * @return 解析后的日期 + */ + public static Date getDate2359(LocalDate value) { + LocalDateTime dateEnd = LocalDateTime.of(value, LocalTime.MAX); + return NdDateUtils.localDateTime2Date(dateEnd); + } + + /** + * LocalDateTime转换为Date + * + * @param localDateTime 日期 + * @return 解析后的日期 + */ + public static Date localDateTime2Date(LocalDateTime localDateTime) { + ZoneId zoneId = ZoneId.systemDefault(); + ZonedDateTime zdt = localDateTime.atZone(zoneId); + return Date.from(zdt.toInstant()); + } + + //--解析日期 end----------------------------------------- + + + /** + * Date转换为LocalDateTime + * + * @param date 日期 + */ + public static LocalDateTime date2LocalDateTime(Date date) { + if (date == null) { + return LocalDateTime.now(); + } + Instant instant = date.toInstant(); + ZoneId zoneId = ZoneId.systemDefault(); + return instant.atZone(zoneId).toLocalDateTime(); + } + + /** + * 日期转 LocalDate + * + * @param date 日期 + * @return 解析后的日期 + */ + public static LocalDate date2LocalDate(Date date) { + if (date == null) { + return LocalDate.now(); + } + Instant instant = date.toInstant(); + ZoneId zoneId = ZoneId.systemDefault(); + return instant.atZone(zoneId).toLocalDate(); + } + + /** + * 日期转 LocalTime + * + * @param date 日期 + * @return 解析后的日期 + */ + public static LocalTime date2LocalTime(Date date) { + if (date == null) { + return LocalTime.now(); + } + Instant instant = date.toInstant(); + ZoneId zoneId = ZoneId.systemDefault(); + return instant.atZone(zoneId).toLocalTime(); + } + + + /** + * 毫秒转日期 + * + * @param epochMilli 毫秒 + * @return 解析后的日期 + */ + public static LocalDateTime getDateTimeOfTimestamp(long epochMilli) { + Instant instant = Instant.ofEpochMilli(epochMilli); + return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + } + + /** + * 秒转日期 + * + * @param epochSecond 秒 + * @return 解析后的日期 + */ + public static LocalDateTime getDateTimeOfSecond(long epochSecond) { + Instant instant = Instant.ofEpochSecond(epochSecond); + return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + } + + //-计算日期 start------------------------------------------ + + + /** + * 计算结束时间与当前时间间隔的天数 + * + * @param endDate 结束日期 + * @return 计算结束时间与当前时间间隔的天数 + */ + public static long until(Date endDate) { + return LocalDateTime.now().until(date2LocalDateTime(endDate), ChronoUnit.DAYS); + } + + /** + * 计算结束时间与开始时间间隔的天数 + * + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return 计算结束时间与开始时间间隔的天数 + */ + public static long until(Date startDate, Date endDate) { + return date2LocalDateTime(startDate).until(date2LocalDateTime(endDate), ChronoUnit.DAYS); + } + + + /** + * 计算结束时间与开始时间间隔的天数 + * + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return 计算结束时间与开始时间间隔的天数 + */ + public static long until(LocalDateTime startDate, LocalDateTime endDate) { + return startDate.until(endDate, ChronoUnit.DAYS); + } + + public static long until(LocalDate startDate, LocalDate endDate) { + return startDate.until(endDate, ChronoUnit.DAYS); + } + + /** + * 计算2个日期之间的所有的日期 yyyy-MM-dd + * 含头含尾 + * + * @param start yyyy-MM-dd + * @param end yyyy-MM-dd + * @return 日期区间的所有日期 + */ + public static List getBetweenDay(Date start, Date end) { + return getBetweenDay(date2LocalDate(start), date2LocalDate(end)); + } + + /** + * 计算2个日期之间的所有的日期 yyyy-MM-dd + * 含头含尾 + * + * @param start yyyy-MM-dd + * @param end yyyy-MM-dd + */ + public static List getBetweenDay(String start, String end) { + return getBetweenDay(LocalDate.parse(start), LocalDate.parse(end)); + } + + /** + * 计算2个日期之间的所有的日期 yyyy-MM-dd + * 含头含尾 + * + * @param startDate yyyy-MM-dd + * @param endDate yyyy-MM-dd + */ + public static List getBetweenDay(LocalDate startDate, LocalDate endDate) { + return getBetweenDay(startDate, endDate, DEFAULT_DATE_FORMAT); + } + + public static List getBetweenDayEn(LocalDate startDate, LocalDate endDate) { + return getBetweenDay(startDate, endDate, DEFAULT_DATE_FORMAT_EN); + } + + public static List getBetweenDay(LocalDate startDate, LocalDate endDate, String pattern) { + if (pattern == null) { + pattern = DEFAULT_DATE_FORMAT; + } + List list = new ArrayList<>(); + long distance = ChronoUnit.DAYS.between(startDate, endDate); + if (distance < 1) { + return list; + } + String finalPattern = pattern; + Stream.iterate(startDate, d -> d.plusDays(1)). + limit(distance + 1) + .forEach(f -> list.add(f.format(DateTimeFormatter.ofPattern(finalPattern)))); + return list; + } + + + /** + * 计算2个日期之间的所有的周 yyyy-ww + * 含头含尾 + * + * @param start yyyy-MM-dd + * @param end yyyy-MM-dd + */ + public static List getBetweenWeek(Date start, Date end) { + return getBetweenWeek(date2LocalDate(start), date2LocalDate(end)); + } + + /** + * 计算2个日期之间的所有的周 yyyy-ww + * 含头含尾 + * + * @param start yyyy-MM-dd + * @param end yyyy-MM-dd + * @return 2个日期之间的所有的周 + */ + public static List getBetweenWeek(String start, String end) { + return getBetweenWeek(LocalDate.parse(start), LocalDate.parse(end)); + } + + /** + * 计算2个日期之间的所有的周 yyyy-ww + * 含头含尾 + * + * @param startDate yyyy-MM-dd + * @param endDate yyyy-MM-dd + * @return 2个日期之间的所有的周 + */ + public static List getBetweenWeek(LocalDate startDate, LocalDate endDate) { + return getBetweenWeek(startDate, endDate, DEFAULT_WEEK_FORMAT); + } + + public static List getBetweenWeek(LocalDate startDate, LocalDate endDate, String pattern) { + List list = new ArrayList<>(); + + long distance = ChronoUnit.WEEKS.between(startDate, endDate); + if (distance < 1) { + return list; + } + Stream.iterate(startDate, d -> d.plusWeeks(1)). + limit(distance + 1).forEach(f -> list.add(f.format(DateTimeFormatter.ofPattern(pattern)))); + return list; + } + + /** + * 计算2个日期之间的所有的月 yyyy-MM + * + * @param start yyyy-MM-dd + * @param end yyyy-MM-dd + * @return 2个日期之间的所有的月 + */ + public static List getBetweenMonth(Date start, Date end) { + return getBetweenMonth(date2LocalDate(start), date2LocalDate(end)); + } + + /** + * 计算2个日期之间的所有的月 yyyy-MM + * + * @param start yyyy-MM-dd + * @param end yyyy-MM-dd + * @return 2个日期之间的所有的月 + */ + public static List getBetweenMonth(String start, String end) { + return getBetweenMonth(LocalDate.parse(start), LocalDate.parse(end)); + } + + /** + * 计算2个日期之间的所有的月 yyyy-MM + * + * @param startDate yyyy-MM-dd + * @param endDate yyyy-MM-dd + * @return 2个日期之间的所有的月 + */ + public static List getBetweenMonth(LocalDate startDate, LocalDate endDate) { + return getBetweenMonth(startDate, endDate, DEFAULT_MONTH_FORMAT); + } + + public static List getBetweenMonth(LocalDate startDate, LocalDate endDate, String pattern) { + List list = new ArrayList<>(); + long distance = ChronoUnit.MONTHS.between(startDate, endDate); + if (distance < 1) { + return list; + } + + Stream.iterate(startDate, d -> d.plusMonths(1)) + .limit(distance + 1) + .forEach(f -> list.add(f.format(DateTimeFormatter.ofPattern(pattern)))); + return list; + } + + /** + * 计算时间区间内的日期列表,并返回 + * + * @param startTime 开始 + * @param endTime 结束 + * @param dateList 日期 + * @return 计算时间区间内的日期列表 + */ + public static String calculationEn(LocalDateTime startTime, LocalDateTime endTime, List dateList) { + if (startTime == null) { + startTime = LocalDateTime.now(); + } + if (endTime == null) { + endTime = LocalDateTime.now().plusDays(30); + } + return calculationEn(startTime.toLocalDate(), endTime.toLocalDate(), dateList); + } + + public static String calculation(LocalDate startDate, LocalDate endDate, List dateList) { + if (startDate == null) { + startDate = LocalDate.now(); + } + if (endDate == null) { + endDate = LocalDate.now().plusDays(30); + } + if (dateList == null) { + dateList = new ArrayList<>(); + } + long day = until(startDate, endDate); + + String dateType; + if (day >= 0 && day <= MAX_MONTH_DAY) { + dateType = DAY; + dateList.addAll(NdDateUtils.getBetweenDay(startDate, endDate, DEFAULT_DATE_FORMAT)); + } else if (day > MAX_MONTH_DAY && day <= MAX_3_MONTH_DAY) { + dateType = WEEK; + dateList.addAll(NdDateUtils.getBetweenWeek(startDate, endDate, DEFAULT_WEEK_FORMAT)); + } else if (day > MAX_3_MONTH_DAY && day <= MAX_YEAR_DAY) { + dateType = MONTH; + dateList.addAll(NdDateUtils.getBetweenMonth(startDate, endDate, DEFAULT_MONTH_FORMAT)); + } else { + throw new BizException("日期参数只能介于0-365天之间"); + } + return dateType; + } + + public static String calculationEn(LocalDate startDate, LocalDate endDate, List dateList) { + if (startDate == null) { + startDate = LocalDate.now(); + } + if (endDate == null) { + endDate = LocalDate.now().plusDays(30); + } + if (dateList == null) { + dateList = new ArrayList<>(); + } + long day = until(startDate, endDate); + + String dateType; + if (day >= 0 && day <= MAX_MONTH_DAY) { + dateType = DAY; + dateList.addAll(NdDateUtils.getBetweenDay(startDate, endDate, DEFAULT_DATE_FORMAT_EN)); + } else if (day > MAX_MONTH_DAY && day <= MAX_3_MONTH_DAY) { + dateType = WEEK; + dateList.addAll(NdDateUtils.getBetweenWeek(startDate, endDate, DEFAULT_WEEK_FORMAT_EN)); + } else if (day > MAX_3_MONTH_DAY && day <= MAX_YEAR_DAY) { + dateType = MONTH; + dateList.addAll(NdDateUtils.getBetweenMonth(startDate, endDate, DEFAULT_MONTH_FORMAT_EN)); + } else { + throw new BizException("日期参数只能介于0-365天之间"); + } + return dateType; + } + +//----------//----------//----------//----------//----------//----------//----------//----------//----------//----------//---------- + + /** + * 计算开始时间 + * + * @param time 日期 + * @return 计算开始时间 + */ + public static LocalDateTime getStartTime(String time) { + String startTime = time; + if (time.matches("^\\d{4}-\\d{1,2}$")) { + startTime = time + "-01 00:00:00"; + } else if (time.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")) { + startTime = time + " 00:00:00"; + } else if (time.matches("^\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}$")) { + startTime = time + ":00"; + } else if (time.matches("^\\d{4}-\\d{1,2}-\\d{1,2}T\\d{1,2}:\\d{1,2}:\\d{1,2}.\\d{3}Z$")) { + startTime = time.replace("T", " ").substring(0, time.indexOf('.')); + } + return LocalDateTimeUtil.beginOfDay(LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT))); + } + + /** + * 计算结束时间 + * + * @param time 日期 + * @return 结束时间 精确到毫秒 + */ + public static LocalDateTime getEndTime(String time) { + String startTime = time; + if (time.matches("^\\d{4}-\\d{1,2}$")) { + Date date = NdDateUtils.parse(time, "yyyy-MM"); + date = NdDateUtils.getLastDateOfMonth(date); + startTime = NdDateUtils.formatAsDate(date) + " 23:59:59"; + } else if (time.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")) { + startTime = time + " 23:59:59"; + } else if (time.matches("^\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}$")) { + startTime = time + ":59"; + } else if (time.matches("^\\d{4}-\\d{1,2}-\\d{1,2}T\\d{1,2}:\\d{1,2}:\\d{1,2}.\\d{3}Z$")) { + time = time.replace("T", " ").substring(0, time.indexOf('.')); + startTime = time; + } + + return endOfDay(LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT))); + } + + public static LocalDateTime endOfDay(LocalDateTime time) { + return time.with(LocalTime.of(23, 59, 59, 999_999_000)); + } + + /** + * 判断当前时间是否在指定时间范围 + * + * @param from 开始时间 + * @param to 结束时间 + * @return 结果 + */ + public static boolean between(LocalTime from, LocalTime to) { + if (from == null) { + throw new IllegalArgumentException("开始时间不能为空"); + } + if (to == null) { + throw new IllegalArgumentException("结束时间不能为空"); + } + LocalTime now = LocalTime.now(); + return now.isAfter(from) && now.isBefore(to); + } + + /** + * 转换日期 + *

+ * 0: 今天结束的日期 + * 1m: 1分钟后的日期 + * 1h: 1小时后的日期 + * 4d: 4天后的日期 + * 2w: 2周后的日期 + * 3M: 3个月后的日期 + * 5y: 5年后的日期 + * + * @param dateTime 待转换日期 + * @param time 转换格式 如: + * 0 当天23:59:59 + * 1s 1秒后 + * 3m 3分钟后 + * 2w 2周后 + * 1h 1小时后 + * 2H 2小时后 + * 4d 4天后 + * 5M 5月后 + * 6y 6年后 + * @return 日期 + */ + public static LocalDateTime conversionDateTime(LocalDateTime dateTime, String time) { + if (StrUtil.isEmpty(time)) { + return LocalDateTime.MAX; + } + + if (dateTime == null) { + return endOfDay(LocalDateTime.now()); + } + + // 今天的23:59:59 + if (StrPool.ZERO.equals(time)) { + return endOfDay(dateTime); + } + + char unit = Character.toLowerCase(time.charAt(time.length() - 1)); + if (time.length() == 1) { + unit = 'd'; + } + Long lastTime = Convert.toLong(time.substring(0, time.length() - 1)); + + switch (unit) { + //秒 + case 's': + return dateTime.plusSeconds(lastTime); + //分 + case 'm': + return dateTime.plusMinutes(lastTime); + //时 + case 'h' | 'H': + return dateTime.plusHours(lastTime); + //周 + case 'w': + return dateTime.plusWeeks(lastTime); + //月 + case 'M': + return dateTime.plusMonths(lastTime); + //年 + case 'y': + return dateTime.plusYears(lastTime); + //天 + case 'd': + default: + return dateTime.plusDays(lastTime); + } + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/NdJacksonModule.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/NdJacksonModule.java new file mode 100644 index 0000000..5a93bd4 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/NdJacksonModule.java @@ -0,0 +1,35 @@ +package com.ningdatech.kqapi.common.util; + +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; +import com.ningdatech.kqapi.common.converter.NdLocalDateTimeDeserializer; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; + +import static com.ningdatech.kqapi.common.util.NdDateUtils.*; + +/** + * jackson 自定义序列化 & 反序列化 规则 + * + * @author WendyYang + */ +public class NdJacksonModule extends SimpleModule { + + public NdJacksonModule() { + super(); + this.addDeserializer(LocalDateTime.class, NdLocalDateTimeDeserializer.INSTANCE); + this.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT))); + this.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT))); + this.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT))); + this.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT))); + this.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT))); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/RefreshKeyUtil.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/RefreshKeyUtil.java index 28ffb67..68b33d6 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/RefreshKeyUtil.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/RefreshKeyUtil.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; +import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -16,7 +17,7 @@ import java.util.Objects; */ @Slf4j public class RefreshKeyUtil { - public static String getRequestSecret(String appKey, String appSecret,Long requestTime) { + public static String getRequestSecret(String appKey, String appSecret,Long requestTime) throws IOException { // 刷新秘钥 HttpUtil httpUtil = HttpUtil.getInstance(); log.info("请求密钥" + appSecret); @@ -36,7 +37,7 @@ public class RefreshKeyUtil { return result; } - public static String refreshSecret(String appKey, String refreshSecret,Long requestTime) { + public static String refreshSecret(String appKey, String refreshSecret,Long requestTime) throws IOException { // 刷新秘钥 HttpUtil httpUtil = HttpUtil.getInstance(); log.info("刷新密钥" + refreshSecret); diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/SpringUtils.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/SpringUtils.java new file mode 100644 index 0000000..540560c --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/SpringUtils.java @@ -0,0 +1,95 @@ +package com.ningdatech.kqapi.common.util; + +import org.springframework.context.ApplicationContext; +import org.springframework.util.Assert; + +import java.util.Map; + +/** + * Spring工具类 + * + * @author WendyYang + * @date 2017-12-25 16:27 + */ +public final class SpringUtils { + private SpringUtils() { + } + + /** + * 单例Holder模式: 优点:将懒加载和线程安全完美结合的一种方式(无锁)。(推荐) + * + * @return 实实例 + */ + public static SpringUtils getInstance() { + return SpringUtilsHolder.INSTANCE; + } + + private static ApplicationContext applicationContext; + private static ApplicationContext parentApplicationContext; + + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + public static void setApplicationContext(ApplicationContext ctx) { + Assert.notNull(ctx, "SpringUtil injection ApplicationContext is null"); + applicationContext = ctx; + parentApplicationContext = ctx.getParent(); + } + + public static Object getBean(String name) { + Assert.hasText(name, "SpringUtil name is null or empty"); + try { + return applicationContext.getBean(name); + } catch (Exception e) { + return parentApplicationContext.getBean(name); + } + } + + public static T getBean(String name, Class type) { + Assert.hasText(name, "SpringUtil name is null or empty"); + Assert.notNull(type, "SpringUtil type is null"); + try { + return applicationContext.getBean(name, type); + } catch (Exception e) { + return parentApplicationContext.getBean(name, type); + } + } + + public static T getBean(Class type) { + Assert.notNull(type, "SpringUtil type is null"); + try { + return applicationContext.getBean(type); + } catch (Exception e) { + return parentApplicationContext.getBean(type); + } + } + + public static Map getBeansOfType(Class type) { + Assert.notNull(type, "SpringUtil type is null"); + try { + return applicationContext.getBeansOfType(type); + } catch (Exception e) { + return parentApplicationContext.getBeansOfType(type); + } + } + + public static ApplicationContext publishEvent(Object event) { + applicationContext.publishEvent(event); + return applicationContext; + } + + + /** + *

+ * 类级的内部类,也就是静态的成员式内部类,该内部类的实例与外部类的实例 + * 没有绑定关系,而且只有被调用到才会装载,从而实现了延迟加载 + */ + private static class SpringUtilsHolder { + /** + * 静态初始化器,由JVM来保证线程安全 + */ + private static final SpringUtils INSTANCE = new SpringUtils(); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/util/StrPool.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/StrPool.java new file mode 100644 index 0000000..adff4f1 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/util/StrPool.java @@ -0,0 +1,148 @@ +package com.ningdatech.kqapi.common.util; + + +/** + *

+ * 常用字符串 + *

+ * + * @author WendyYang + * @date 2019/07/25 + */ +public interface StrPool { + + String AMPERSAND = "&"; + String AND = "and"; + String AT = "@"; + String ASTERISK = "*"; + String STAR = "*"; + String BACK_SLASH = "\\"; + String COLON = ":"; + String COMMA = ","; + String DASH = "-"; + String DOLLAR = "$"; + String DOT = "."; + String DOTDOT = ".."; + String DOT_CLASS = ".class"; + String DOT_JAVA = ".java"; + String DOT_XML = ".xml"; + String EMPTY = ""; + String EQUALS = "="; + String FALSE = "false"; + String SLASH = "/"; + String HASH = "#"; + String HAT = "^"; + String LEFT_BRACE = "{"; + String BRACE = "{}"; + String LEFT_BRACKET = "("; + char LEFT_BRACKET_CHAR = '('; + String LEFT_CHEV = "<"; + String NEWLINE = "\n"; + String N = "n"; + String NO = "no"; + String NULL = "null"; + String OFF = "off"; + String ON = "on"; + String PERCENT = "%"; + String PIPE = "|"; + String PLUS = "+"; + String QUESTION_MARK = "?"; + String EXCLAMATION_MARK = "!"; + String QUOTE = "\""; + String RETURN = "\r"; + String TAB = "\t"; + String RIGHT_BRACE = "}"; + String RIGHT_BRACKET = ")"; + String RIGHT_CHEV = ">"; + String SEMICOLON = ";"; + String SEMICOLON_CHINA = ";"; + String SINGLE_QUOTE = "'"; + String BACKTICK = "`"; + String SPACE = " "; + String TILDA = "~"; + String LEFT_SQ_BRACKET = "["; + String RIGHT_SQ_BRACKET = "]"; + String TRUE = "true"; + String UNDERSCORE = "_"; + String UTF_8 = "UTF-8"; + String GBK = "GBK"; + String US_ASCII = "US-ASCII"; + String ISO_8859_1 = "ISO-8859-1"; + String Y = "y"; + String YES = "yes"; + String ONE = "1"; + String ZERO = "0"; + String DOLLAR_LEFT_BRACE = "${"; + String HASH_LEFT_BRACE = "#{"; + String CRLF = "\r\n"; + String HTML_NBSP = " "; + String HTML_AMP = "&"; + String HTML_QUOTE = """; + String HTML_LT = "<"; + String HTML_GT = ">"; + String STRING_TYPE_NAME = "java.lang.String"; + String LONG_TYPE_NAME = "java.lang.Long"; + String BYTE_TYPE_NAME = "java.lang.Byte"; + String CHARACTER_TYPE_NAME = "java.lang.Character"; + String INTEGER_TYPE_NAME = "java.lang.Integer"; + String SHORT_TYPE_NAME = "java.lang.Short"; + String DOUBLE_TYPE_NAME = "java.lang.Double"; + String FLOAT_TYPE_NAME = "java.lang.Float"; + String BOOLEAN_TYPE_NAME = "java.lang.Boolean"; + String SET_TYPE_NAME = "java.util.Set"; + String LIST_TYPE_NAME = "java.util.List"; + String COLLECTION_TYPE_NAME = "java.util.Collection"; + String DATE_TYPE_NAME = "java.util.Date"; + String LOCAL_DATE_TIME_TYPE_NAME = "java.time.LocalDateTime"; + String LOCAL_DATE_TYPE_NAME = "java.time.LocalDate"; + String LOCAL_TIME_TYPE_NAME = "java.time.LocalTime"; + String JAVA_TEMP_DIR = "java.io.tmpdir"; + + String ARRAY = "Array"; + String INTEGER = "Integer"; + String FLOAT = "Float"; + String DATETIME = "DateTime"; + String DATE = "Date"; + String TIME = "Time"; + String BOOLEAN = "Boolean"; + + + String HTTPS_PREFIX = "https://"; + String HTTP_PREFIX = "http://"; + String HTTPS = "https"; + String HTTP = "http"; + /** + * 编码 + */ + String UTF8 = "UTF-8"; + /** + * JSON 资源 + */ + String CONTENT_TYPE = "application/json; charset=utf-8"; + + /** + * 用于随机选的字符 + */ + String BASE_UPPER_CHAR = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + String TEST_TOKEN = "Bearer test"; + String TEST = "test"; + String PROD = "prod"; + String DEV = "dev"; + + /** + * 默认的父id + */ + Long DEF_PARENT_ID = 0L; + + String UNKNOWN = "unknown"; + + /** + * 日期 个位数前面补0 + */ + String FORMAT_DATE_SINGLE_DIGITS = "%02d"; + /** + * 不足三位的数字前面补0 + */ + String FORMAT_NUMBER_THREE = "%03d"; +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/open/controller/HealthController.java b/kqapi/src/main/java/com/ningdatech/kqapi/open/controller/HealthController.java new file mode 100644 index 0000000..d3f8fb5 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/open/controller/HealthController.java @@ -0,0 +1,40 @@ +package com.ningdatech.kqapi.open.controller; + +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.jasypt.util.text.BasicTextEncryptor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/** + *

+ * 前端控制器 + *

+ * + * @author ZPF + * @since 2023-10-27 + */ +@Slf4j +@Validated +@RestController +@RequestMapping +@RequiredArgsConstructor +public class HealthController { + + @GetMapping("/health") + public JSONObject health() { + JSONObject json = new JSONObject(); + json.put("code","200"); + json.put("area","柯桥区"); + json.put("chargePerson","李*"); + json.put("appName","企业线上平台"); + json.put("mobile","156*****306"); + json.put("time",LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + json.put("dept","产业发展科"); + return json; + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/controller/TaskController.java b/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/controller/TaskController.java index 7b6b5c0..1473d1a 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/controller/TaskController.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/controller/TaskController.java @@ -5,23 +5,17 @@ import com.ningdatech.kqapi.scheduler.manage.SynManage; import com.ningdatech.kqapi.scheduler.task.CheckMattersUrlTask; import com.ningdatech.kqapi.scheduler.task.RemoveMattersTask; import com.ningdatech.kqapi.scheduler.task.SynTask; -import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO; -import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; -import com.ningdatech.kqapi.zzsfw.manage.MatterManage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - import java.net.MalformedURLException; import java.net.UnknownHostException; import java.util.Arrays; -import java.util.List; /** *

diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/task/CheckMattersUrlTask.java b/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/task/CheckMattersUrlTask.java index 1bdbb1b..676e8cb 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/task/CheckMattersUrlTask.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/task/CheckMattersUrlTask.java @@ -1,29 +1,35 @@ package com.ningdatech.kqapi.scheduler.task; import cn.hutool.core.date.StopWatch; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; -import com.ningdatech.basic.model.ApiResponse; import com.ningdatech.kqapi.common.model.entity.Item; import com.ningdatech.kqapi.common.util.HttpUtil; import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu; import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMenuService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.TrustStrategy; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContexts; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; +import javax.net.ssl.SSLContext; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -77,7 +83,7 @@ public class CheckMattersUrlTask { List errUrls = Lists.newArrayList(); for (NdKqZzsfwMenu menu : menus) { - RestTemplate restTemplate = new RestTemplate(HttpUtil.generateHttpRequestFactory()); + RestTemplate restTemplate = new RestTemplate(generateHttpRequestFactory()); String url = "https://www.zjzwfw.gov.cn/jpaas-zjservice-server/open-api/item/getItemDetail"; MultiValueMap map = new LinkedMultiValueMap<>(); @@ -93,6 +99,7 @@ public class CheckMattersUrlTask { ResponseEntity response = restTemplate.postForEntity(url, formEntity, Item.class); System.out.println(response.getBody()); Item body = response.getBody(); + assert body != null; Item.ItemData itemData = body.getData(); //如果是空的 if(Objects.isNull(itemData.getItem())){ @@ -137,4 +144,26 @@ public class CheckMattersUrlTask { } return queryPairs; } + + /** + * 通过该工厂类创建的RestTemplate发送请求时,可忽略https证书认证 + * @return 工厂 + */ + public static HttpComponentsClientHttpRequestFactory generateHttpRequestFactory(){ + try{ + TrustStrategy acceptingTrustStrategy = ((x509Certificates, authType) -> true); + SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); + SSLConnectionSocketFactory connectionSocketFactory = new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier()); + + HttpClientBuilder httpClientBuilder = HttpClients.custom(); + httpClientBuilder.setSSLSocketFactory(connectionSocketFactory); + CloseableHttpClient httpClient = httpClientBuilder.build(); + HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); + factory.setHttpClient(httpClient); + return factory; + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } } diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/DscSxAdsShareItemQltQlsxCommonIDVKqController.java b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/DscSxAdsShareItemQltQlsxCommonIDVKqController.java index b78bf39..d3d13aa 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/DscSxAdsShareItemQltQlsxCommonIDVKqController.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/DscSxAdsShareItemQltQlsxCommonIDVKqController.java @@ -2,10 +2,7 @@ package com.ningdatech.kqapi.zzsfw.controller; import com.ningdatech.kqapi.zzsfw.entity.dto.DscSxAdsShareItemQltQlsxCommonIDVKqDTO; import com.ningdatech.kqapi.zzsfw.entity.entity.DscSxAdsShareItemQltQlsxCommonIDVKq; -import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; import com.ningdatech.kqapi.zzsfw.manage.QlManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; @@ -28,13 +25,11 @@ import java.util.List; @Validated @RestController @RequestMapping("/api/v1/zzsfw/") -@Api(value = "DscSxAdsShareItemQltQlsxCommonIDVKqController", tags = "柯桥-政务数据") @RequiredArgsConstructor public class DscSxAdsShareItemQltQlsxCommonIDVKqController { private final QlManage qlManage; - @ApiOperation(value = "获取政务事项数据列表", notes = "获取政务事项数据列表") @GetMapping("/search") public List search(@ModelAttribute DscSxAdsShareItemQltQlsxCommonIDVKqDTO dto) { return qlManage.search(dto); diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/HealthController.java b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/HealthController.java deleted file mode 100644 index a24be8b..0000000 --- a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/HealthController.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.kqapi.zzsfw.controller; - - -import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMattersDeduplicateDTO; -import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMenuDTO; -import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO; -import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; -import com.ningdatech.kqapi.zzsfw.manage.MatterManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author ZPF - * @since 2023-10-27 - */ -@Slf4j -@Validated -@RestController -@RequestMapping -@Api(value = "NdKqZzsfwMenuController", tags = "柯桥-政务数据") -@RequiredArgsConstructor -public class HealthController { - private final MatterManage matterManage; - - @ApiOperation(value = "健康检测", notes = "健康检测") - @GetMapping("/health") - public String health() { - return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); - } -} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java index 27b7058..32752ca 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java @@ -1,15 +1,10 @@ package com.ningdatech.kqapi.zzsfw.controller; - -import com.ningdatech.basic.model.ApiResponse; import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMattersDeduplicateDTO; import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMenuDTO; import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO; -import com.ningdatech.kqapi.zzsfw.entity.vo.MattersVO; import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; import com.ningdatech.kqapi.zzsfw.manage.MatterManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; @@ -29,42 +24,35 @@ import java.util.List; @Validated @RestController @RequestMapping("/api/v1/zzsfw/") -@Api(value = "NdKqZzsfwMenuController", tags = "柯桥-政务数据") @RequiredArgsConstructor public class NdKqZzsfwMenuController { private final MatterManage matterManage; - @ApiOperation(value = "获取政务事项数据列表", notes = "获取政务事项数据列表") @GetMapping("/matters") public List getMatters() { return matterManage.getMatters(); } - @ApiOperation(value = "top10事项", notes = "top10事项") @GetMapping("/top10") public List topTen() { return matterManage.topTen(); } - @ApiOperation(value = "政务事项数据保存", notes = "政务事项数据保存") @PostMapping("/save") public String save(@RequestBody NdKqZzsfwMenuDTO dto) { return matterManage.save(dto); } - @ApiOperation(value = "政务事项数据清空", notes = "政务事项数据清空") @GetMapping("/remove-all") public String removeAll() { return matterManage.removeAll(); } - @ApiOperation(value = "政务事项去重保存", notes = "政务事项去重保存") @PostMapping("/save-dup") public String saveDup(@RequestBody NdKqZzsfwMattersDeduplicateDTO dto) { return matterManage.saveDup(dto); } - @ApiOperation(value = "政务事项数据清空", notes = "政务事项数据清空") @GetMapping("/remove-all-dup") public String removeAllDup() { return matterManage.removeAllDup(); diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/PolicyRegulationsController.java b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/PolicyRegulationsController.java index ae9fae6..1bbc6cd 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/PolicyRegulationsController.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/PolicyRegulationsController.java @@ -1,11 +1,9 @@ package com.ningdatech.kqapi.zzsfw.controller; -import com.ningdatech.basic.model.PageVo; +import com.ningdatech.kqapi.common.model.PageVo; import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwPolicyDTO; import com.ningdatech.kqapi.zzsfw.entity.vo.NdKqZzsfwPolicyVO; import com.ningdatech.kqapi.zzsfw.manage.PolicyManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; @@ -23,24 +21,20 @@ import java.util.List; @Validated @RestController @RequestMapping("/api/v1/poclicy/") -@Api(value = "PolicyRegulationsController", tags = "柯桥-政策条例") @RequiredArgsConstructor public class PolicyRegulationsController { private final PolicyManage policyManage; - @ApiOperation(value = "政策条例分页列表", notes = "政策条例分页列表") @GetMapping("/list") public PageVo list(@RequestParam(defaultValue = "1") long pageNumber, @RequestParam(defaultValue = "10") long pageSize) { return policyManage.list(pageNumber,pageSize); } - @ApiOperation(value = "政策条例保存", notes = "政策条例保存") @PostMapping("/save") public String save(@RequestBody NdKqZzsfwPolicyDTO dto) { return policyManage.save(dto); } - @ApiOperation(value = "政策条例保存", notes = "政策条例保存") @PostMapping("/save-batch") public String saveBatch(@RequestBody List dtos) { @@ -48,7 +42,6 @@ public class PolicyRegulationsController { } - @ApiOperation(value = "政务事项数据清空", notes = "政务事项数据清空") @GetMapping("/remove-all") public String removeAll() { return policyManage.removeAll(); diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/entity/dto/DscSxAdsShareItemQltQlsxCommonIDVKqDTO.java b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/entity/dto/DscSxAdsShareItemQltQlsxCommonIDVKqDTO.java index 2c41eab..301e34a 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/entity/dto/DscSxAdsShareItemQltQlsxCommonIDVKqDTO.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/entity/dto/DscSxAdsShareItemQltQlsxCommonIDVKqDTO.java @@ -1,6 +1,5 @@ package com.ningdatech.kqapi.zzsfw.entity.dto; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -16,7 +15,6 @@ import java.time.LocalDateTime; * @since 2023-10-25 */ @Data -@ApiModel(value = "DscSxAdsShareItemQltQlsxCommonIDVKqDTO", description = "省回流_政务服务_数据共享_事项基本信息表") public class DscSxAdsShareItemQltQlsxCommonIDVKqDTO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/PolicyManage.java b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/PolicyManage.java index fc90fe5..4c23e8f 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/PolicyManage.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/PolicyManage.java @@ -4,9 +4,8 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.basic.model.PageVo; +import com.ningdatech.kqapi.common.model.PageVo; import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwPolicyDTO; -import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu; import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwPolicy; import com.ningdatech.kqapi.zzsfw.entity.vo.NdKqZzsfwPolicyVO; import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwPolicyService; diff --git a/kqapi/src/main/resources/application-dev.yml b/kqapi/src/main/resources/application-dev.yml index 959525d..df8b2fd 100644 --- a/kqapi/src/main/resources/application-dev.yml +++ b/kqapi/src/main/resources/application-dev.yml @@ -43,9 +43,9 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://47.98.125.47:3306/kqzzsfw?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false + url: ENC(aMGW3+FFqxyutRz9liYjAg+A72b6IQ7/ygtxO0DmQJ/LLFZkx8r4MhN8quv9L62nQ4sH55qFg+LnQoor/t8IqBACrbfNg462YNKnRyMsBmdHHxJm7i57flIQfePLDW93Omz4LZ2PbRZTvPcLLYtnQyxXSDPwDnjexHNVXTdxwuTJPBqthsVpvyA2mnn5Szef) username: root - password: NingdaKeji123! + password: ENC(NHFdgnNk7opRJpNnZOJs51OTXb72zU//) # 数据源 hikari: # 是客户端等待连接池连接的最大毫秒数 @@ -120,4 +120,12 @@ swagger: hostname: iZbp13nwyvib53j4j1p2xoZ +jasypt: + encryptor: + password: CodeSheep + # 指定解密算法,需要和加密时使用的算法一致 + algorithm: PBEWithMD5AndDES + # 指定initialization vector类型 + iv-generator-classname: org.jasypt.iv.NoIvGenerator + diff --git a/kqapi/src/main/resources/application-pre.yml b/kqapi/src/main/resources/application-pre.yml index 9b9a163..3278fde 100644 --- a/kqapi/src/main/resources/application-pre.yml +++ b/kqapi/src/main/resources/application-pre.yml @@ -43,7 +43,7 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://47.98.125.47:3306/kqzzsfw?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false + url: ENC(aMGW3+FFqxyutRz9liYjAg+A72b6IQ7/ygtxO0DmQJ/LLFZkx8r4MhN8quv9L62nQ4sH55qFg+LnQoor/t8IqBACrbfNg462YNKnRyMsBmdHHxJm7i57flIQfePLDW93Omz4LZ2PbRZTvPcLLYtnQyxXSDPwDnjexHNVXTdxwuTJPBqthsVpvyA2mnn5Szef) username: root password: NingdaKeji123! # 数据源 @@ -118,4 +118,11 @@ log: swagger: enabled: true -hostname: iZbp13nwyvib53j4j1p2xoZ \ No newline at end of file +hostname: iZbp13nwyvib53j4j1p2xoZ + +jasypt: + encryptor: + password: CodeSheep + algorithm: PBEWithMD5AndDES + # 指定initialization vector类型 + iv-generator-classname: org.jasypt.iv.NoIvGenerator \ No newline at end of file diff --git a/kqapi/src/main/resources/application-prod.yml b/kqapi/src/main/resources/application-prod.yml index 07a43c9..5911b2d 100644 --- a/kqapi/src/main/resources/application-prod.yml +++ b/kqapi/src/main/resources/application-prod.yml @@ -43,9 +43,10 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://10.42.248.27:3306/kqzzsfw?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false + url: ENC(gtE4OUrpgtFsh6B3aLiSp2sVSX1BYDET9Uii/wRP2RboRK0NDaYu1S7Vx30cHXFE7vecQzY1UbrSFW/BaWJvQ3XJxfDiaUxdrIDND5e+DMTjx1pUkfS8/RbXHQDE+QoOVZV1UKEtdq+khr32tlQXqkTnzmZGuZjctVmjdQxUnmI2YNpoeNlIAkDXiaCvcVYc) username: root password: Nd@20231116 + # 数据源 hikari: # 是客户端等待连接池连接的最大毫秒数 @@ -120,4 +121,11 @@ swagger: hostname: iZut201mqskxt0mwme4tjfZ +jasypt: + encryptor: + password: CodeSheep + algorithm: PBEWithMD5AndDES + # 指定initialization vector类型 + iv-generator-classname: org.jasypt.iv.NoIvGenerator + diff --git a/kqapi/src/main/resources/template/meeting/专家抽取表.ftl b/kqapi/src/main/resources/template/meeting/专家抽取表.ftl deleted file mode 100644 index c8c4974..0000000 --- a/kqapi/src/main/resources/template/meeting/专家抽取表.ftl +++ /dev/null @@ -1,1348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 信息化项目专家抽取表 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 项目编码 - - - - - - - - - - - - - - - - - - - - - - - - - - ${projectCode} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 项目名称 - - - - - - - - - - - - - - - - - - - - - - - - - ${projectName} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 建设单位 - - - - - - - - - - - - - - - - - - - - - - - - ${buildOrg} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 评审地点 - - - - - - - - - - - - - - - - - - - - - - - - ${meetingAddress} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 评审时间 - - - - - - - - - - - - - - - - - - - - - - - - ${meetingTime} - - - - - - - - - - - - - - - - - - - - 评审耗时 - - - - - - - - - - - - - - - - - - - - - - - ${meetingUsageTime} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 抽取人 - - - - - - - - - - - - - - - - - - - - - - ${meetingCreateBy} - - - - - - - - - - - - - - - - - - - - 监督人 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 序号 - - - - - - - - - - - - - - - - - - - - - 姓名 - - - - - - - - - - - - - - - - - - - - - 电话 - - - - - - - - - - - - - - - - - - - - 工作单位 - - - - - - - - - - - - - - - - - - - - - 签名 - - - - - <#list experts as expert> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${expert.no} - - - - - - - - - - - - - - - - - - - - - - - ${expert.name} - - - - - - - - - - - - - - - - - - - - - - - ${expert.mobile} - - - - - - - - - - - - - - - - - - - - - - - ${expert.company} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/kqapi/src/main/resources/template/meeting/专家评审单.ftl b/kqapi/src/main/resources/template/meeting/专家评审单.ftl deleted file mode 100644 index 2cf2ed1..0000000 --- a/kqapi/src/main/resources/template/meeting/专家评审单.ftl +++ /dev/null @@ -1,741 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${projectName} - - - - - - - - - - 专家评审意见 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${meetingTime},${holdOrg}组织专家在${meetingAddress}对${projectName} - 进行评审。专家组认真听取了项目业主方、建设方的情况汇报,审阅了项目材料,实地查看了设备及平台演示,专家组织质询、讨论后提出以下意见: - - - - - - - - - - - - - - - - - - - - - - - - - ${(reviewResult)!} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 专家组 - - - - - - - - - - - - - - - - - - (签名 - - - - - - - - - ): - - - - - - - - - \ No newline at end of file diff --git a/kqapi/src/main/resources/template/meeting/专家费.ftl b/kqapi/src/main/resources/template/meeting/专家费.ftl deleted file mode 100644 index 3c01ae5..0000000 --- a/kqapi/src/main/resources/template/meeting/专家费.ftl +++ /dev/null @@ -1,1230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 丽水市大数据局信息化项目专家费 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 项目名称: - - - - - - - - ${projectName} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 验收地点: - - - - - - - - ${meetingAddress} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 日 期: - - - - - - - - ${meetingTime} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 姓名 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 身份证号 - - - - - - - - - - - - - - - - - - - - 单位 - - - - - - - - - - - - - - - - - - - - 联系电话 - - - - - - - - - - - - - - - - - - - - 评审费 - - - - - - - - - - - - - - - - - - - - 开户行 - - - - - - - - - - - - - - - - - - - - - 账号 - - - - - - - - - - - - - - - - - - - - - 签名 - - - - - <#list experts as rowData> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${rowData.no} - - - - - - - - - - - - - - - - - - - - - - - - - ${rowData.name} - - - - - - - - - - - - - - - - - - - - - - - - ${rowData.sex} - - - - - - - - - - - - - - - - - - - - - - - - ${rowData.idcard} - - - - - - - - - - - - - - - - - - - - - - - - ${rowData.company} - - - - - - - - - - - - - - - - - - - - - - - - ${rowData.mobile} - - - - - - - - - - - - - - - - - - - - - - - - ${rowData.fee} - - - - - - - - - - - - - - - - - - - - - - - - - ${(rowData.bank)!} - - - - - - - - - - - - - - - - - - - - - - - ${rowData.bankNo} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 经办人 - - - - - - - - - - - - (签字 - - - - - - ): - - - - - - - - - \ No newline at end of file diff --git a/kqapi/src/main/resources/template/meeting/劳务费发放.ftl b/kqapi/src/main/resources/template/meeting/劳务费发放.ftl deleted file mode 100644 index 9195664..0000000 --- a/kqapi/src/main/resources/template/meeting/劳务费发放.ftl +++ /dev/null @@ -1,2657 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 劳务费发放审批单 - - - - - - - - - - - - - - - - - - - - - - 制表单位(盖章): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 劳务活动项目 - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${projectName} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 活动时间 - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${meetingTime} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 劳务费类别 - - - - - - - - - - - - - - - - - - - - - - - - - - - - □讲课费□稿费□考务(监考费) - - - - - - - - - - - - - - - - - - □评审费□其他项目 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 发放标准 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 500元/人 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 有关情况说明 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 通过市信息化专家库系统抽取 - - - - - - - - - ${expertCount} - - - - - - - - - 名专家。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 发放清单 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 姓名 - - - - - - - - - - - - - - - - - - - - - - - - - - - 工作单位 - - - - - - - - - - - - - - - - - - - - - - - - - - - 职务(职称) - - - - - - - - - - - - - - - - - - - - - - - - - - - 标准 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 发放金额 - - - - - - - - - - - - - - - - - - - - (元) - - - - - - - - - - - - - - - - - - - - - - - - - - - 签字 - - - - - <#list experts as expert> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${expert.name} - - - - - - - - - - - - - - - - - - - - - - - - - - - ${expert.company} - - - - - - - - - - - - - - - - - - - - - - - - - - - ${(expert.job)!} - - - - - - - - - - - - - - - - - - - - - - - - - - - ${meetingUsageTime} - - - - - - - - - - - - - - - - - - - - - - - - - - - 500 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 发放单位审批意见 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 业务部门意见 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 分管领导意见 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 单位负责人 - - - - - - - - - - - - - - - - - - - - (财务审批人)意见 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 经办人意见 - - - - - - - - - - - - - - - - - - - - - - - - - - - 部门负责人意见 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (签字) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (签字): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 分管领导(签字): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 负责人(财务审批人) - - - - - - - - - - - - - - - - - - - - (签字): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/kqapi/src/main/resources/template/simsun.ttc b/kqapi/src/main/resources/template/simsun.ttc deleted file mode 100644 index 40e9693..0000000 Binary files a/kqapi/src/main/resources/template/simsun.ttc and /dev/null differ diff --git a/kqapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表(空).xls b/kqapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表(空).xls deleted file mode 100644 index c43cd89..0000000 Binary files a/kqapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表(空).xls and /dev/null differ diff --git a/kqapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表.xls b/kqapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表.xls deleted file mode 100644 index d06cdad..0000000 Binary files a/kqapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表.xls and /dev/null differ diff --git a/kqapi/src/main/resources/template/区县-预审申请单.html b/kqapi/src/main/resources/template/区县-预审申请单.html deleted file mode 100644 index c5242c9..0000000 --- a/kqapi/src/main/resources/template/区县-预审申请单.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - Document - - - -
-

- #title# -

-
-

- - 项目编号: - #projectCode# - - #time# -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
项目基本信息
项目名称#projectName#
是否临时增补#isTemporaryAugment#是否一地创新全省共享项目#isInnovateWholeProvinceShare#
项目负责人#responsibleMan#负责人手机号#responsibleManMobile#
项目联系人#contactName#项目联系人手机号#contactPhone#
建设单位#buildOrgName#建设单位统一社会信用代码#orgCreditCode#
项目类型#projectType#是否首次新建#isFirst#
预算年度#projectYear#建设起止时间#beginAndEndTime#
四大体系#fourSystems#
是否数字化改革项目#isDigitalReform#综合业务领域#bizDomain#
立项依据#buildBasisList#
是否上云#isCloud#云类型#cloudType#
项目简介 -

#projectIntroduction#

-
资金申报情况
申报金额#declareAmount#
自有资金#declareHaveAmount#政府投资-本级财政资金#declareGovOwnFinanceAmount#
政府投资-上级补助资金#declareGovSuperiorFinanceAmount#银行贷款#declareBankLendingAmount#
其他资金#declareOtherAmount#
本年计划投资(万元)#yearPlanInvest#
资金分配情况
软件开发#softwareDevelopmentAmount#云资源、硬件购置#cloudHardwarePurchaseAmount#
第三方服务#thirdPartyAmount#
年度支付计划
年度支付金额#annualPlanAmount#
自有资金#annualPlanHaveAmount#政府投资-本级财政资金#annualPlanGovOwnFinanceAmount#
政府投资-上级补助资金#annualPlanGovSuperiorFinanceAmount#银行贷款#annualPlanBankLendingAmount#
其他资金#annualPlanOtherAmount#
备注
备注

#projectRemarks#

单位意见
本级主管单位意见(盖章) -
-
- #superOrgOpinion# -
-
- #superOrgAuditDate# -
-
-
上级主管单位意见(盖章) -
-
- #higherOrgOpinion# -
-
- #higherOrgAuditDate# -
-
-
-
-
- - diff --git a/kqapi/src/main/resources/template/市级-预审申请单.html b/kqapi/src/main/resources/template/市级-预审申请单.html deleted file mode 100644 index e6ffff5..0000000 --- a/kqapi/src/main/resources/template/市级-预审申请单.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - Document - - - -
-

- #title# -

-
-

- - 项目编号: - #projectCode# - - #time# -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
项目基本信息
项目名称#projectName#
是否临时增补#isTemporaryAugment#是否一地创新全省共享项目#isInnovateWholeProvinceShare#
项目负责人#responsibleMan#负责人手机号#responsibleManMobile#
项目联系人#contactName#项目联系人手机号#contactPhone#
建设单位#buildOrgName#建设单位统一社会信用代码#orgCreditCode#
项目类型#projectType#是否首次新建#isFirst#
预算年度#projectYear#建设起止时间#beginAndEndTime#
四大体系#fourSystems#
是否数字化改革项目#isDigitalReform#综合业务领域#bizDomain#
立项依据#buildBasisList#
是否上云#isCloud#云类型#cloudType#
项目简介 -

#projectIntroduction#

-
资金申报情况
申报金额#declareAmount#
自有资金#declareHaveAmount#政府投资-本级财政资金#declareGovOwnFinanceAmount#
政府投资-上级补助资金#declareGovSuperiorFinanceAmount#银行贷款#declareBankLendingAmount#
其他资金#declareOtherAmount#
本年计划投资(万元)#yearPlanInvest#
资金分配情况
软件开发#softwareDevelopmentAmount#云资源、硬件购置#cloudHardwarePurchaseAmount#
第三方服务#thirdPartyAmount#
年度支付计划
年度支付金额#annualPlanAmount#
自有资金#annualPlanHaveAmount#政府投资-本级财政资金#annualPlanGovOwnFinanceAmount#
政府投资-上级补助资金#annualPlanGovSuperiorFinanceAmount#银行贷款#annualPlanBankLendingAmount#
其他资金#annualPlanOtherAmount#
备注
备注

#projectRemarks#

单位意见
本级主管单位意见(盖章) -
-
- #superOrgOpinion# -
-
- #superOrgAuditDate# -
-
-
-
-
- - diff --git a/kqapi/src/main/resources/template/建设方案申请单.html b/kqapi/src/main/resources/template/建设方案申请单.html deleted file mode 100644 index c548ce8..0000000 --- a/kqapi/src/main/resources/template/建设方案申请单.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - Document - - - -
-

- #title# -

-
-

- - 项目编号: - #projectCode# - - #time# -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
项目基本信息
项目名称#projectName#
是否临时增补#isTemporaryAugment#是否一地创新全省共享项目#isInnovateWholeProvinceShare#
项目负责人#responsibleMan#负责人手机号#responsibleManMobile#
项目联系人#contactName#项目联系人手机号#contactPhone#
建设单位#buildOrgName#建设单位统一社会信用代码#orgCreditCode#
项目类型#projectType#是否首次新建#isFirst#
预算年度#projectYear#建设起止时间#beginAndEndTime#
四大体系#fourSystems#
是否数字化改革项目#isDigitalReform#综合业务领域#bizDomain#
立项依据#buildBasisList#
是否上云#isCloud#云类型#cloudType#
项目简介 -

#projectIntroduction#

-
资金申报情况
申报金额#declareAmount#
自有资金#declareHaveAmount#政府投资-本级财政资金#declareGovOwnFinanceAmount#
政府投资-上级补助资金#declareGovSuperiorFinanceAmount#银行贷款#declareBankLendingAmount#
其他资金#declareOtherAmount#
本年计划投资(万元)#yearPlanInvest#
资金分配情况
软件开发#softwareDevelopmentAmount#云资源、硬件购置#cloudHardwarePurchaseAmount#
第三方服务#thirdPartyAmount#
年度支付计划
年度支付金额#annualPlanAmount#
自有资金#annualPlanHaveAmount#政府投资-本级财政资金#annualPlanGovOwnFinanceAmount#
政府投资-上级补助资金#annualPlanGovSuperiorFinanceAmount#银行贷款#annualPlanBankLendingAmount#
其他资金#annualPlanOtherAmount#
备注
备注

#projectRemarks#

单位意见
大数据局主管单位意见(盖章) -
-
- #bigDataBureauOpinion# -
-
- #bigDataBureauAuditDate# -
-
-
-
-
- - diff --git a/kqapi/src/test/resources/template/simsun.ttc b/kqapi/src/test/resources/template/simsun.ttc deleted file mode 100644 index 40e9693..0000000 Binary files a/kqapi/src/test/resources/template/simsun.ttc and /dev/null differ diff --git a/kqapi/src/test/resources/template/预审申请单.html b/kqapi/src/test/resources/template/预审申请单.html deleted file mode 100644 index 2641489..0000000 --- a/kqapi/src/test/resources/template/预审申请单.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - Document - - - -
-

- #title# -

-
-

- - 项目编号: - #projectNo# - - #time# -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
项目基本信息
项目名称#projectName#
是否临时增补#isTemporaryAugment#是否一地创新全省共享项目#isInnovateWholeProvinceShare#
项目负责人#responsibleMan#负责人手机号#responsibleManMobile#
项目联系人#contactName#项目联系人手机号#contactPhone#
建设单位#buildOrgName#建设单位统一社会信用代码#orgCreditCode#
项目类型#projectType#是否首次新建#isFirst#
预算年度#projectYear#建设起止时间#beginAndEndTime#
四大体系#fourSystems#
是否数字化改革项目#isDigitalReform#综合业务领域#bizDomain#
立项依据#buildBasisList#
是否上云#isCloud#云类型#cloudType#
项目简介#projectIntroduction#
资金申报情况
申报金额#declareAmount#
自有资金#declareHaveAmount#政府投资-本级财政资金#declareGovOwnFinanceAmount#
政府投资-上级补助资金#declareGovSuperiorFinanceAmount#银行贷款#declareBankLendingAmount#
其他资金#declareOtherAmount#
本年计划投资(万元)#yearPlanInvest#
资金分配情况
软件开发#softwareDevelopmentAmount#云资源、硬件购置#cloudHardwarePurchaseAmount#
第三方服务#thirdPartyAmount#
年度支付计划
年度支付金额#annualPlanAmount#
自有资金#annualPlanHaveAmount#政府投资-本级财政资金#annualPlanGovOwnFinanceAmount#
政府投资-上级补助资金#annualPlanGovSuperiorFinanceAmount#银行贷款#annualPlanBankLendingAmount#
其他资金#annualPlanOtherAmount#
备注
备注#projectRemarks#
单位意见
本级主管单位意见(盖章) -
-

- #superOrgOpinion# -

-

- #superOrgAuditDate# -

-
-
上级主管单位意见(盖章) -
-

- #higherOrgOpinion# -

-

- #higherOrgAuditDate# -

-
-
- #bigDataBureauName# - 意见(盖章) - -
-

- #bigDataBureauOpinion# -

-

- #bigDataBureauAuditDate# -

-
-
-
-
- -