首次提交

master
luhaotian 2024-02-19 09:25:09 +08:00
commit 4c1cc07824
14 changed files with 697 additions and 0 deletions

200
pom.xml 100644
View File

@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.drht.jhqm.permissions01</groupId>
<artifactId>jhqm_permissions01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>jhqm_permissions01</name>
<description>jhqm_permissions01</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.6.13</spring-boot.version>
<failOnMissingWebXml>false</failOnMissingWebXml>
<swagger.version>3.0.0</swagger.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--数据库-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.22</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!--数据库-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1-jre</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.76</version>
</dependency>
<!--redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.9</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.example.drht.jhqm.permissions01.JhqmPermissions01Application</mainClass>
<skip>true</skip>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://nexus.derunht.cn/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<!-- 私服仓库配置:从私服下载-->
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus Plugin Repository</name>
<url>http://nexus.derunht.cn/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -0,0 +1,17 @@
package com.example.drht.jhqm.permissions01;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableAsync //支持异步须要开启的注解
@EnableScheduling //开启定时任务的注解
@SpringBootApplication
public class JhqmPermissions01Application {
public static void main(String[] args) {
SpringApplication.run(JhqmPermissions01Application.class, args);
}
}

View File

@ -0,0 +1,13 @@
package com.example.drht.jhqm.permissions01;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(JhqmPermissions01Application.class);
}
}

View File

@ -0,0 +1,32 @@
package com.example.drht.jhqm.permissions01.config;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
@Configuration
public class JacksonConf {
/**
* js
* */
/**
* JacksonlongStringjacksonlong
*
* @return Jackson2ObjectMapperBuilderCustomizer
*/
@Bean
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
Jackson2ObjectMapperBuilderCustomizer cunstomizer = new Jackson2ObjectMapperBuilderCustomizer() {
@Override
public void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder) {
jacksonObjectMapperBuilder.serializerByType(Long.class, ToStringSerializer.instance);
}
};
return cunstomizer;
}
}

View File

@ -0,0 +1,38 @@
package com.example.drht.jhqm.permissions01.config;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
//@EnableWebMvc
@Configuration //配置类
@EnableSwagger2// 开启Swagger2的自动配置
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.OAS_30)
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.apis(RequestHandlerSelectors.basePackage("com.example.drht.jhqm.permissions01.config"))
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("swagger 文档标题")
.description("swagger 文档描述")
.version("1.0 swagger 文档版本")
.build();
}
}

View File

@ -0,0 +1,30 @@
package com.example.drht.jhqm.permissions01.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
/**
*
* */
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("*")
.allowedHeaders("*");
}
/**
*
* */
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations("classpath:/static/");
}
}

View File

@ -0,0 +1,67 @@
/*
* Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.drht.jhqm.permissions01.demos.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
@Controller
public class BasicController {
// http://127.0.0.1:8080/hello?name=lisi
@RequestMapping("/hello")
@ResponseBody
public String hello(@RequestParam(name = "name", defaultValue = "unknown user") String name) {
return "Hello " + name;
}
// http://127.0.0.1:8080/user
@RequestMapping("/user")
@ResponseBody
public User user() {
User user = new User();
user.setName("theonefx");
user.setAge(666);
return user;
}
// http://127.0.0.1:8080/save_user?name=newName&age=11
@RequestMapping("/save_user")
@ResponseBody
public String saveUser(User u) {
return "user will save: name=" + u.getName() + ", age=" + u.getAge();
}
// http://127.0.0.1:8080/html
@RequestMapping("/html")
public String html() {
return "index.html";
}
@ModelAttribute
public void parseUser(@RequestParam(name = "name", defaultValue = "unknown user") String name
, @RequestParam(name = "age", defaultValue = "12") Integer age, User user) {
user.setName("zhangsan");
user.setAge(18);
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.drht.jhqm.permissions01.demos.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
@Controller
public class PathVariableController {
// http://127.0.0.1:8080/user/123/roles/222
@RequestMapping(value = "/user/{userId}/roles/{roleId}", method = RequestMethod.GET)
@ResponseBody
public String getLogin(@PathVariable("userId") String userId, @PathVariable("roleId") String roleId) {
return "User Id : " + userId + " Role Id : " + roleId;
}
// http://127.0.0.1:8080/javabeat/somewords
@RequestMapping(value = "/javabeat/{regexp1:[a-z-]+}", method = RequestMethod.GET)
@ResponseBody
public String getRegExp(@PathVariable("regexp1") String regexp1) {
return "URI Part : " + regexp1;
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.drht.jhqm.permissions01.demos.web;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
public class User {
private String name;
private Integer age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
}

View File

@ -0,0 +1,37 @@
package com.example.drht.jhqm.permissions01.model;
import lombok.Data;
import javax.persistence.*;
import java.util.Objects;
@Data
@Entity
@Table(name = "t_user_microservice_aw_user", schema = "jinhaiqimengdb", catalog = "")
public class TUserMicroserviceAwUser {
@Id
@Column(name = "id")
private Long id;
@Basic
@Column(name = "user_name")
private String userName;
@Basic
@Column(name = "user_sex")
private String userSex;
@Basic
@Column(name = "user_phone")
private String userPhone;
@Basic
@Column(name = "new_time")
private Long newTime;
@Basic
@Column(name = "updata_time")
private Long updataTime;
@Basic
@Column(name = "user_pw")
private String userPw;
@Basic
@Column(name = "user_img")
private String userImg;
}

View File

@ -0,0 +1,112 @@
package com.example.drht.jhqm.permissions01.model;
import lombok.Data;
import javax.persistence.*;
import java.util.Objects;
@Data
@Entity
@Table(name = "t_user_microservice_qm_list", schema = "jinhaiqimengdb", catalog = "")
public class TUserMicroserviceQmList {
@Id
@Column(name = "id")
private Long id;
@Basic
@Column(name = "user_id")
private Long userId;
@Basic
@Column(name = "us_study")
private String usStudy;
@Basic
@Column(name = "us_study_id")
private Long usStudyId;
@Basic
@Column(name = "us_adds")
private String usAdds;
@Basic
@Column(name = "us_linkman")
private String usLinkman;
@Basic
@Column(name = "us_linkman_code")
private String usLinkmanCode;
@Basic
@Column(name = "us_state")
private String usState;
@Basic
@Column(name = "firm_code")
private String firmCode;
@Basic
@Column(name = "firm_log")
private String firmLog;
@Basic
@Column(name = "firm_img")
private String firmImg;
@Basic
@Column(name = "firm_name")
private String firmName;
@Basic
@Column(name = "firm_referral")
private String firmReferral;
@Basic
@Column(name = "us_type")
private String usType;
@Basic
@Column(name = "new_time")
private Long newTime;
@Basic
@Column(name = "updata_time")
private Long updataTime;
@Basic
@Column(name = "role_id")
private Long roleId;
@Basic
@Column(name = "role_name")
private String roleName;
@Basic
@Column(name = "user_token")
private String userToken;
@Basic
@Column(name = "qm_scale_type")
private String qmScaleType;
@Basic
@Column(name = "qm_city")
private String qmCity;
@Basic
@Column(name = "qm_industry")
private String qmIndustry;
@Basic
@Column(name = "qm_province")
private String qmProvince;
@Basic
@Column(name = "qm_topic")
private String qmTopic;
@Basic
@Column(name = "qm_institution")
private Long qmInstitution;
@Basic
@Column(name = "current_id")
private Long currentId;
@Basic
@Column(name = "current_name")
private String currentName;
@Basic
@Column(name = "current_type")
private String currentType;
@Basic
@Column(name = "join_role")
private String joinRole;
@Basic
@Column(name = "join_id")
private Long joinId;
@Basic
@Column(name = "is_sham")
private String isSham;
@Basic
@Column(name = "sham_code")
private String shamCode;
@Basic
@Column(name = "sham_name")
private String shamName;
}

View File

@ -0,0 +1,45 @@
# 应用服务 WEB 访问端口
server.port=8080
spring.mvc.async.request-timeout=100000
logging.file.path=/logs
logging.file.name=tools.log
# 这里的 com.example.logt 是我的测试项目的包名
# 这里是指的单个日志文件最大大小 默认为10MB
logging.file.max-size=20MB
# 这里是日志文件最长保存天数 不配置的话为无限制 永远存储 单位为天
logging.file.max-history=15
spring.servlet.multipart.max-file-size=50MB
spring.servlet.multipart.max-request-size=50MB
spring.datasource.druid.db-type=com.alibaba.druid.pool.DruidDataSource
#spring.datasource.druid.url=jdbc:mysql://localhost:3306/bgl_test2?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=false
spring.datasource.druid.url=jdbc:mysql://120.46.194.248:13306/jinhaiqimengdb?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2b8&useSSL=false
#spring.datasource.druid.url=jdbc:mysql://localhost:3306/bgl_test?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%8&useSSL=false
spring.datasource.druid.username=userMicroservice_user
spring.datasource.druid.password=Zf4mm=K5N33&ju2$
spring.datasource.druid.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.database=mysql
spring.jpa.show-sql=false
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
#spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.database-platform=org.hibernate.dialect.MySQL57InnoDBDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
spring.redis.database=5
#spring.redis.host=39.100.237.119
spring.redis.host=120.46.171.171
spring.redis.port=6379
spring.redis.password=bcd4@g2wp*PZv#&U
spring.redis.timeout=40000ms
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8

View File

@ -0,0 +1,6 @@
<html>
<body>
<h1>hello word!!!</h1>
<p>this is a html page</p>
</body>
</html>

View File

@ -0,0 +1,13 @@
package com.example.drht.jhqm.permissions01;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class JhqmPermissions01ApplicationTests {
@Test
void contextLoads() {
}
}