admin
This commit is contained in:
commit
d3ce851dd9
|
@ -0,0 +1,26 @@
|
|||
*.jar
|
||||
*.war
|
||||
*.class
|
||||
*.lock
|
||||
*.DS_Store
|
||||
*.swp
|
||||
*.out
|
||||
target/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
*.bak
|
||||
.settings/
|
||||
.classpath
|
||||
.project
|
||||
.metadata/
|
||||
.idea/
|
||||
logs/
|
||||
log/
|
||||
*.log
|
||||
dependency-reduced-pom.xml
|
||||
.flattened-pom.xml
|
||||
**/bin/*
|
||||
/out/
|
||||
*.lck
|
||||
pom-xml-flattened
|
|
@ -0,0 +1 @@
|
|||
/target/
|
|
@ -0,0 +1,32 @@
|
|||
<?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 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.afe.g3fo</groupId>
|
||||
<artifactId>g3fo-admin</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>g3fo-admin-api</name>
|
||||
<artifactId>g3fo-admin-api</artifactId>
|
||||
<description>g3fo-admin-api</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.afe.g3fo</groupId>
|
||||
<artifactId>g3fo-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
package com.afe.g3fo.admin.exception;
|
||||
|
||||
import com.afe.g3fo.framework.exception.BizException;
|
||||
import com.afe.g3fo.framework.exception.IException;
|
||||
|
||||
public class AdminBizException extends BizException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
/target/
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
# 基础镜像
|
||||
FROM openjdk:17-alpine
|
||||
|
||||
## 设置时区为东八区(北京时间)
|
||||
#RUN apk add --no-cache tzdata \
|
||||
# && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
# && echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
# 复制打包后的 JAR 文件到容器中
|
||||
ENV HOSTNAME="g3fo-admin"
|
||||
COPY /target/g3fo-admin-service-1.0.0-SNAPSHOT.jar /app.jar
|
||||
ARG JAVA_OPTS="-XX:NewRatio=1 -XX:SurvivorRatio=1 -Xss1024k -Xmx512m -Xms512m -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:/data/logs/jvm/gc.log"
|
||||
ENV JAVA_OPTS=$JAVA_OPTS
|
||||
ENV RUN_ARGS="--spring.cloud.nacos.discovery.ip=$HOSTNAME --dubbo.provider.host=$HOSTNAME"
|
||||
# 容器启动时执行的命令
|
||||
|
||||
#ADD *.jar g3fo-demo-service-1.0.0-SNAPSHOT.jar
|
||||
|
||||
##指定配置文件,方便在容器中运行时挂载配置文件路径
|
||||
#ENTRYPOINT ["java", "-jar", "/app.jar", "$RUN_ARGS"]
|
||||
ENTRYPOINT java -jar /app.jar $RUN_ARGS
|
||||
|
||||
#ENTRYPOINT ["java", "-jar", "/app.jar"]
|
||||
|
||||
# 为容器设置端口映射(可选)
|
||||
EXPOSE 18002
|
|
@ -0,0 +1,74 @@
|
|||
<?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 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.afe.g3fo</groupId>
|
||||
<artifactId>g3fo-admin</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>g3fo-admin-service</name>
|
||||
<artifactId>g3fo-admin-service</artifactId>
|
||||
<description>g3fo-admin-service</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- g3fo-api -->
|
||||
<dependency>
|
||||
<groupId>com.afe.g3fo</groupId>
|
||||
<artifactId>g3fo-admin-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- framework -->
|
||||
<dependency>
|
||||
<groupId>com.afe.g3fo</groupId>
|
||||
<artifactId>g3fo-framework-service</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>p6spy</groupId>
|
||||
<artifactId>p6spy</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.afe.g3fo</groupId>
|
||||
<artifactId>g3fo-framework-service</artifactId>
|
||||
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>3.0.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,27 @@
|
|||
package com.afe.g3fo;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
/**
|
||||
* boot class
|
||||
*
|
||||
* @Author yangguangjing
|
||||
* @Date 2023年4月10日
|
||||
*/
|
||||
@EnableDubbo
|
||||
@MapperScan
|
||||
@DubboComponentScan
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.afe.g3fo.admin.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import io.swagger.v3.oas.annotations.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||
import io.swagger.v3.oas.annotations.info.Contact;
|
||||
import io.swagger.v3.oas.annotations.info.Info;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.servers.Server;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
@OpenAPIDefinition(
|
||||
tags = {
|
||||
@Tag(name = "用户管理", description = "用户管理")
|
||||
},
|
||||
info = @Info(
|
||||
title = "G3-admin-API",
|
||||
description = "用户模块接口文档",
|
||||
version = "1.0.0-SNAPSHOT",
|
||||
contact = @Contact(name = "g3support", email = "g3sfsupport@afe-solutions.com", url = "http://www.afe-solutions.com")
|
||||
),
|
||||
servers = {
|
||||
@Server(description = "开发环境", url = "http://127.0.0.1:8081/doc.html")
|
||||
},
|
||||
security = @SecurityRequirement(name = "Oauth2"),
|
||||
externalDocs = @ExternalDocumentation(
|
||||
description = "项目编译部署说明",
|
||||
url = "http://localhost/deploy/README.md"
|
||||
)
|
||||
)
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.afe.g3fo.admin.config;
|
||||
|
||||
import com.afe.g3fo.admin.exception.AdminBizException;
|
||||
import com.afe.g3fo.framework.common.Result;
|
||||
import com.afe.g3fo.framework.service.exception.GlobalExceptionHandler;
|
||||
import com.afe.g3fo.plugin.dubbo.exception.DubboException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* @Author:fengjianhuang
|
||||
* @Package:com.afe.g3fo.user.exception
|
||||
* @Project:g3fo-user
|
||||
* @name:UserGlobalExceptionHandler
|
||||
* @Date:2023/5/15 14:00
|
||||
* @Filename:UserGlobalExceptionHandler
|
||||
*/
|
||||
@ControllerAdvice
|
||||
@Slf4j
|
||||
public class UserGlobalExceptionHandler extends GlobalExceptionHandler {
|
||||
@ResponseBody
|
||||
@ExceptionHandler(DubboException.class)
|
||||
public Result<?> handleRpcException(DubboException e, HttpServletRequest request) {
|
||||
log.error(e.getMessage(), e);
|
||||
String code = String.valueOf(e.getCode());
|
||||
return StringUtils.isNotBlank(code) ? Result.error(code, e.getMessage()) : Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
@ResponseBody
|
||||
@ExceptionHandler(AdminBizException.class)
|
||||
public Result<?> handleServiceException(AdminBizException e, HttpServletRequest request) {
|
||||
log.error(e.getMessage(), e);
|
||||
String code = e.getCode();
|
||||
return StringUtils.isNotBlank(code) ? Result.error(code, e.getMessage()) : Result.error(e.getMessage());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
app:
|
||||
service-name: g3fo-admin
|
||||
env: dev
|
||||
spring:
|
||||
application:
|
||||
name: ${app.service-name}
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: nacos:8848 #nacos配置中心地址
|
||||
namespace: ${app.env} #配置中心的命名空间id
|
||||
group: DEFAULT_GROUP #配置分组,默认没有也可以
|
||||
file-extension: yml #配置文件后缀,用于拼接配置配置文件名称,目前只支持yml和properties
|
||||
refresh-enabled: true #配置自动刷新
|
||||
encode: UTF-8 # 配置编码
|
||||
extension-configs:
|
||||
- data-id: dubbo.yml
|
||||
refresh: false
|
||||
- data-id: redis.yml
|
||||
- data-id: mysql.yml
|
||||
- data-id: common.yml
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.afe.g3fo.user.mapper.UserInfoMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,166 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.afe.g3fo.user.mapper.UserLoginInfoMapper">
|
||||
|
||||
<!-- <resultMap type="com.afe.g3fo.user.entity.UserLoginInfo" id="UserLoginInfoMap">-->
|
||||
<!-- <result property="loginInfoId" column="login_info_id" jdbcType="INTEGER"/>-->
|
||||
<!-- <result property="userId" column="user_id" jdbcType="INTEGER"/>-->
|
||||
<!-- <result property="userName" column="user_name" jdbcType="VARCHAR"/>-->
|
||||
<!-- <result property="loginChannel" column="login_channel" jdbcType="VARCHAR"/>-->
|
||||
<!-- <result property="loginStatus" column="login_status" jdbcType="INTEGER"/>-->
|
||||
<!-- <result property="loginPassword" column="login_password" jdbcType="VARCHAR"/>-->
|
||||
<!-- <result property="retryCount" column="retry_count" jdbcType="INTEGER"/>-->
|
||||
<!-- <result property="pwdExpiryDate" column="pwd_expiry_date" jdbcType="TIMESTAMP"/>-->
|
||||
<!-- <result property="lastLoginDate" column="last_login_date" jdbcType="TIMESTAMP"/>-->
|
||||
<!-- </resultMap>-->
|
||||
|
||||
<!-- <!–查询单个–>-->
|
||||
<!-- <select id="queryById" resultMap="UserLoginInfoMap">-->
|
||||
<!-- select-->
|
||||
<!-- login_info_id, user_id, user_name, login_channel, login_status, login_password, retry_count, pwd_expiry_date, last_login_date-->
|
||||
<!-- from user_login_info-->
|
||||
<!-- where login_info_id = #{loginInfoId}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <!–查询指定行数据–>-->
|
||||
<!-- <select id="queryAllByLimit" resultMap="UserLoginInfoMap">-->
|
||||
<!-- select-->
|
||||
<!-- login_info_id, user_id, user_name, login_channel, login_status, login_password, retry_count, pwd_expiry_date, last_login_date-->
|
||||
<!-- from user_login_info-->
|
||||
<!-- <where>-->
|
||||
<!-- <if test="loginInfoId != null">-->
|
||||
<!-- and login_info_id = #{loginInfoId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="userId != null">-->
|
||||
<!-- and user_id = #{userId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="userName != null and userName != ''">-->
|
||||
<!-- and user_name = #{userName}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginChannel != null and loginChannel != ''">-->
|
||||
<!-- and login_channel = #{loginChannel}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginStatus != null">-->
|
||||
<!-- and login_status = #{loginStatus}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginPassword != null and loginPassword != ''">-->
|
||||
<!-- and login_password = #{loginPassword}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="retryCount != null">-->
|
||||
<!-- and retry_count = #{retryCount}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="pwdExpiryDate != null">-->
|
||||
<!-- and pwd_expiry_date = #{pwdExpiryDate}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="lastLoginDate != null">-->
|
||||
<!-- and last_login_date = #{lastLoginDate}-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- limit #{pageable.offset}, #{pageable.pageSize}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <!–统计总行数–>-->
|
||||
<!-- <select id="count" resultType="java.lang.Long">-->
|
||||
<!-- select count(1)-->
|
||||
<!-- from user_login_info-->
|
||||
<!-- <where>-->
|
||||
<!-- <if test="loginInfoId != null">-->
|
||||
<!-- and login_info_id = #{loginInfoId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="userId != null">-->
|
||||
<!-- and user_id = #{userId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="userName != null and userName != ''">-->
|
||||
<!-- and user_name = #{userName}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginChannel != null and loginChannel != ''">-->
|
||||
<!-- and login_channel = #{loginChannel}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginStatus != null">-->
|
||||
<!-- and login_status = #{loginStatus}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginPassword != null and loginPassword != ''">-->
|
||||
<!-- and login_password = #{loginPassword}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="retryCount != null">-->
|
||||
<!-- and retry_count = #{retryCount}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="pwdExpiryDate != null">-->
|
||||
<!-- and pwd_expiry_date = #{pwdExpiryDate}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="lastLoginDate != null">-->
|
||||
<!-- and last_login_date = #{lastLoginDate}-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <!–新增所有列–>-->
|
||||
<!-- <insert id="insert" keyProperty="loginInfoId" useGeneratedKeys="true">-->
|
||||
<!-- insert into user_login_info(user_id, user_name, login_channel, login_status, login_password, retry_count, pwd_expiry_date, last_login_date)-->
|
||||
<!-- values (#{userId}, #{userName}, #{loginChannel}, #{loginStatus}, #{loginPassword}, #{retryCount}, #{pwdExpiryDate}, #{lastLoginDate})-->
|
||||
<!-- </insert>-->
|
||||
|
||||
<!-- <insert id="insertBatch" keyProperty="loginInfoId" useGeneratedKeys="true">-->
|
||||
<!-- insert into user_login_info(user_id, user_name, login_channel, login_status, login_password, retry_count, pwd_expiry_date, last_login_date)-->
|
||||
<!-- values-->
|
||||
<!-- <foreach collection="entities" item="entity" separator=",">-->
|
||||
<!-- (#{entity.userId}, #{entity.userName}, #{entity.loginChannel}, #{entity.loginStatus}, #{entity.loginPassword}, #{entity.retryCount}, #{entity.pwdExpiryDate}, #{entity.lastLoginDate})-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </insert>-->
|
||||
|
||||
<!-- <insert id="insertOrUpdateBatch" keyProperty="loginInfoId" useGeneratedKeys="true">-->
|
||||
<!-- insert into user_login_info(user_id, user_name, login_channel, login_status, login_password, retry_count, pwd_expiry_date, last_login_date)-->
|
||||
<!-- values-->
|
||||
<!-- <foreach collection="entities" item="entity" separator=",">-->
|
||||
<!-- (#{entity.userId}, #{entity.userName}, #{entity.loginChannel}, #{entity.loginStatus}, #{entity.loginPassword}, #{entity.retryCount}, #{entity.pwdExpiryDate}, #{entity.lastLoginDate})-->
|
||||
<!-- </foreach>-->
|
||||
<!-- on duplicate key update-->
|
||||
<!-- user_id = values(user_id),-->
|
||||
<!-- user_name = values(user_name),-->
|
||||
<!-- login_channel = values(login_channel),-->
|
||||
<!-- login_status = values(login_status),-->
|
||||
<!-- login_password = values(login_password),-->
|
||||
<!-- retry_count = values(retry_count),-->
|
||||
<!-- pwd_expiry_date = values(pwd_expiry_date),-->
|
||||
<!-- last_login_date = values(last_login_date)-->
|
||||
<!-- </insert>-->
|
||||
|
||||
<!-- <!–通过主键修改数据–>-->
|
||||
<!-- <update id="update">-->
|
||||
<!-- update user_login_info-->
|
||||
<!-- <set>-->
|
||||
<!-- <if test="userId != null">-->
|
||||
<!-- user_id = #{userId},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="userName != null and userName != ''">-->
|
||||
<!-- user_name = #{userName},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginChannel != null and loginChannel != ''">-->
|
||||
<!-- login_channel = #{loginChannel},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginStatus != null">-->
|
||||
<!-- login_status = #{loginStatus},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="loginPassword != null and loginPassword != ''">-->
|
||||
<!-- login_password = #{loginPassword},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="retryCount != null">-->
|
||||
<!-- retry_count = #{retryCount},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="pwdExpiryDate != null">-->
|
||||
<!-- pwd_expiry_date = #{pwdExpiryDate},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="lastLoginDate != null">-->
|
||||
<!-- last_login_date = #{lastLoginDate},-->
|
||||
<!-- </if>-->
|
||||
<!-- </set>-->
|
||||
<!-- where login_info_id = #{loginInfoId}-->
|
||||
<!-- </update>-->
|
||||
|
||||
<!-- <!–通过主键删除–>-->
|
||||
<!-- <delete id="deleteById">-->
|
||||
<!-- delete from user_login_info where login_info_id = #{loginInfoId}-->
|
||||
<!-- </delete>-->
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
module.log=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
|
||||
# 自定义日志打印
|
||||
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
|
||||
#日志输出到控制台
|
||||
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
|
||||
# 使用日志系统记录 sql
|
||||
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
|
||||
# 设置 p6spy driver 代理
|
||||
deregisterdrivers=false
|
||||
# 取消JDBC URL前缀
|
||||
useprefix=true
|
||||
# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
|
||||
excludecategories=info,debug,result,batch,resultset
|
||||
# 日期格式
|
||||
dateformat=yyyy-MM-dd HH:mm:ss
|
||||
# 实际驱动可多个
|
||||
#driverlist=org.h2.Driver
|
||||
# 是否开启慢SQL记录
|
||||
outagedetection=true
|
||||
# 慢SQL记录标准 2 秒
|
||||
outagedetectioninterval=2
|
|
@ -0,0 +1,66 @@
|
|||
package com.afe.g3fo.user;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.afe.g3fo.framework.common.Result;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author:fengjianhuang
|
||||
* @Package:PACKAGE_NAME
|
||||
* @Project:g3fo-user
|
||||
* @name:LoginTest
|
||||
* @Date:2023/5/9 13:25
|
||||
* @Filename:LoginTest
|
||||
*/
|
||||
|
||||
@SpringBootTest
|
||||
public class LoginTest {
|
||||
@Resource
|
||||
UserLoginInfoService userLoginInfoService;
|
||||
@Resource
|
||||
UserInfoService userInfoService;
|
||||
@Resource
|
||||
UserLoginInfoMapper userLoginInfoMapper;
|
||||
@Resource
|
||||
UserLoginFacade userLoginFacade;
|
||||
@Test
|
||||
void insertData() throws Exception {
|
||||
UserLoginInfo userLoginInfo =new UserLoginInfo();
|
||||
userLoginInfo.setLoginChannel("PT");
|
||||
userLoginInfo.setUserName("jim");
|
||||
userLoginInfo.setLoginPassword(PasswordEncryptionUtils.encrypt("Afe12345"));
|
||||
userLoginInfo.setLoginStatus(1);
|
||||
userLoginInfo.setUserId(231313131133l);
|
||||
userLoginInfo.setLastLoginDate(LocalDateTime.now());
|
||||
userLoginInfo.setPwdExpiryDate(LocalDateTime.now());
|
||||
// int insert = userLoginInfoMapper.insert(userLoginInfo);
|
||||
userLoginInfoService.save(userLoginInfo);
|
||||
// List<UserInfoEntity> list = userInfoService.list();
|
||||
System.currentTimeMillis();
|
||||
}
|
||||
@Test
|
||||
void login(){
|
||||
UserLoginReq userLoginReq=new UserLoginReq();
|
||||
userLoginReq.setLoginPassword("Afe12345");
|
||||
userLoginReq.setUserName("jim");
|
||||
userLoginReq.setLoginChannel("PT");
|
||||
QueryWrapper<UserLoginInfo> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(UserLoginInfo::getUserName,userLoginReq.getUserName());
|
||||
queryWrapper.lambda().eq(UserLoginInfo::getLoginChannel,userLoginReq.getLoginChannel());
|
||||
UserLoginInfo userLoginInfo = userLoginInfoService.getOne(queryWrapper);
|
||||
try {
|
||||
if(PasswordEncryptionUtils.encrypt(userLoginReq.getLoginPassword()).equals(userLoginInfo.getLoginPassword())){
|
||||
UserLoginRsp userLoginRsp= BeanUtil.copyProperties(userLoginInfo,UserLoginRsp.class);
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.afe.g3fo.user;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author:fengjianhuang
|
||||
* @Package:com.afe.g3fo.user
|
||||
* @Project:g3fo-user
|
||||
* @name:UserTest
|
||||
* @Date:2023/5/9 16:32
|
||||
* @Filename:UserTest
|
||||
*/
|
||||
@SpringBootTest
|
||||
public class UserTest {
|
||||
@Resource
|
||||
UserInfoService userInfoService;
|
||||
|
||||
@Test
|
||||
void insertData() throws Exception {
|
||||
UserInfo userInfo =new UserInfo();
|
||||
userInfo.setCreateUser("sys");
|
||||
userInfo.setUserName("jim");
|
||||
userInfo.setLocalName("jim");
|
||||
userInfo.setEngName("jim");
|
||||
userInfo.setDepartment("");
|
||||
userInfo.setExpiryDate(LocalDateTime.now());
|
||||
userInfo.setCreatDate(LocalDateTime.now());
|
||||
userInfo.setUserStatus(1);
|
||||
userInfo.setUserType(1);
|
||||
userInfoService.save(userInfo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?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>
|
||||
|
||||
<!-- 基础信息 -->
|
||||
<parent>
|
||||
<groupId>com.afe.g3fo</groupId>
|
||||
<artifactId>g3fo-master</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>g3fo-admin</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>${revision}</version>
|
||||
|
||||
<!-- 项目介绍 -->
|
||||
<name>g3fo-user</name>
|
||||
<description>user service</description>
|
||||
|
||||
<!-- 所有模块 -->
|
||||
<modules>
|
||||
<module>g3fo-admin-api</module>
|
||||
<module>g3fo-admin-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<revision>1.0.0-SNAPSHOT</revision>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.afe.g3fo</groupId>
|
||||
<artifactId>g3fo-admin-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue