diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 00c72ccf..bdca58df 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -12,13 +12,15 @@ - - + + + + diff --git a/dq-financial-guarantee/pom.xml b/dq-financial-guarantee/pom.xml deleted file mode 100644 index 8d030265..00000000 --- a/dq-financial-guarantee/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.1.8.RELEASE - - - com.daqing.financial - dq-financial-guarantee - 0.0.1-SNAPSHOT - dq-financial-guarantee - 大庆智慧金融平台-担保业务服务 - - - 1.8 - Greenwich.SR3 - - - - - - com.daqing.framework - dq-framework-model - 1.0-SNAPSHOT - - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplication.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplication.java deleted file mode 100644 index 85b79c03..00000000 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.daqing.financial.guarantee; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class DqFinancialGuaranteeApplication { - - public static void main(String[] args) { - SpringApplication.run(DqFinancialGuaranteeApplication.class, args); - } - -} diff --git a/dq-financial-guarantee/src/main/resources/application.properties b/dq-financial-guarantee/src/main/resources/application.properties deleted file mode 100644 index 8b137891..00000000 --- a/dq-financial-guarantee/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/dq-financial-guarantee/src/main/resources/logback-spring.xml b/dq-financial-guarantee/src/main/resources/logback-spring.xml deleted file mode 100644 index a7d9bdd4..00000000 --- a/dq-financial-guarantee/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - utf8 - - - - - - - - ${LOG_HOME}/guarantee.%d{yyyy-MM-dd}.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - 0 - - 512 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dq-financial-guarantee/src/test/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplicationTests.java b/dq-financial-guarantee/src/test/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplicationTests.java deleted file mode 100644 index fa202884..00000000 --- a/dq-financial-guarantee/src/test/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.daqing.financial.guarantee; - -import org.junit.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class DqFinancialGuaranteeApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/dq-financial-hrms-auth/pom.xml b/dq-financial-hrms-auth/pom.xml index 9b389a3f..e9b706df 100644 --- a/dq-financial-hrms-auth/pom.xml +++ b/dq-financial-hrms-auth/pom.xml @@ -30,16 +30,27 @@ dq-framework-model 1.0-SNAPSHOT + org.springframework.boot - spring-boot-starter-web + spring-boot-starter-data-redis + + + org.springframework.cloud spring-cloud-starter-openfeign - + - + - + - - com.daqing.financial - dq-financial-workflow - 0.0.1-SNAPSHOT - dq-financial-workflow - 大庆智慧金融平台-工作流服务 - - - 1.8 - Greenwich.SR3 - - - - - com.daqing.framework - dq-framework-common - 1.0-SNAPSHOT - - - com.daqing.framework - dq-framework-model - 1.0-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/dq-financial-workflow/src/main/java/com/daqing/financial/workflow/DqFinancialWorkflowApplication.java b/dq-financial-workflow/src/main/java/com/daqing/financial/workflow/DqFinancialWorkflowApplication.java deleted file mode 100644 index cd7c9823..00000000 --- a/dq-financial-workflow/src/main/java/com/daqing/financial/workflow/DqFinancialWorkflowApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.daqing.financial.workflow; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class DqFinancialWorkflowApplication { - - public static void main(String[] args) { - SpringApplication.run(DqFinancialWorkflowApplication.class, args); - } - -} diff --git a/dq-financial-workflow/src/main/resources/application.properties b/dq-financial-workflow/src/main/resources/application.properties deleted file mode 100644 index 8b137891..00000000 --- a/dq-financial-workflow/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/dq-financial-workflow/src/main/resources/logback-spring.xml b/dq-financial-workflow/src/main/resources/logback-spring.xml deleted file mode 100644 index 067d56bd..00000000 --- a/dq-financial-workflow/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - utf8 - - - - - - - - ${LOG_HOME}/workflow.%d{yyyy-MM-dd}.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - 0 - - 512 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dq-financial-workflow/src/test/java/com/daqing/financial/workflow/DqFinancialWorkflowApplicationTests.java b/dq-financial-workflow/src/test/java/com/daqing/financial/workflow/DqFinancialWorkflowApplicationTests.java deleted file mode 100644 index df9bd3ac..00000000 --- a/dq-financial-workflow/src/test/java/com/daqing/financial/workflow/DqFinancialWorkflowApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.daqing.financial.workflow; - -import org.junit.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class DqFinancialWorkflowApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/dq-framework-common/pom.xml b/dq-framework-common/pom.xml index 4dd9b22a..51d36fa3 100644 --- a/dq-framework-common/pom.xml +++ b/dq-framework-common/pom.xml @@ -102,6 +102,24 @@ com.alibaba.cloud spring-cloud-starter-alibaba-nacos-config + + + com.auth0 + java-jwt + 3.3.0 + + + + com.alibaba + fastjson + 1.2.70 + + + + org.springframework.boot + spring-boot-starter-data-redis + 2.1.8.RELEASE + diff --git a/dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java b/dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java index 259467a7..24a89f0f 100644 --- a/dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java +++ b/dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java @@ -19,6 +19,8 @@ public enum CommonCode implements ResultCode { UNAUTHENTICATED(false, 10001, "此操作需要登陆系统!"), UNAUTHORISE(false, 10002, "权限不足,无权操作!"), INVALID_PARAM(false, 10003, "非法参数!"), + USER_IS_NOT_EXIST(false, 10004, "用户不存在或用户已禁用!"), + PASSWORD_IS_ERROR(false, 10005, "密码错误!"), SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); /** diff --git a/dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java b/dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java index c897e97e..607c6a1d 100644 --- a/dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java +++ b/dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java @@ -52,7 +52,7 @@ public class ResponseResult { return new ResponseResult(CommonCode.SUCCESS); } - public ResponseResult SUCCESS(T t) { + public static ResponseResult SUCCESS(Object t) { return new ResponseResult<>(true, 10000, t, "操作成功!"); } @@ -60,4 +60,8 @@ public class ResponseResult { return new ResponseResult(CommonCode.FAIL); } + public static ResponseResult FAIL(int code, String message) { + return new ResponseResult<>(false, code, null, message); + } + } diff --git a/dq-framework-common/src/main/java/com/daqing/framework/util/Md5Util.java b/dq-framework-common/src/main/java/com/daqing/framework/util/Md5Util.java new file mode 100644 index 00000000..ec639040 --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/util/Md5Util.java @@ -0,0 +1,24 @@ + +package com.daqing.framework.util; + +import org.springframework.util.DigestUtils; + +/** + * @author zcw + * @version 1.0 + * @date 2020/1/6 17:03 + * @description md5工具类 + */ +public class Md5Util { + + public static String md5(String str) { + if (str == null) { + return null; + } + return DigestUtils.md5DigestAsHex(str.getBytes()); + } + + public static void main(String[] args) { + System.out.printf(md5("1234561")); + } +} diff --git a/dq-framework-common/target/classes/com/daqing/framework/model/response/CommonCode.class b/dq-framework-common/target/classes/com/daqing/framework/model/response/CommonCode.class index 2f3adc83..e7fabb96 100644 Binary files a/dq-framework-common/target/classes/com/daqing/framework/model/response/CommonCode.class and b/dq-framework-common/target/classes/com/daqing/framework/model/response/CommonCode.class differ diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/LoginRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/LoginRequest.java new file mode 100644 index 00000000..af330c96 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/LoginRequest.java @@ -0,0 +1,25 @@ +package com.daqing.framework.domain.hrms.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class LoginRequest { + + private int id; + + @ApiModelProperty(value = "手机号码") + private String phone; + + @ApiModelProperty(value = "登录类型(1:手机号 2:微信登录)") + private int type; + + @ApiModelProperty(value = "微信唯一编号") + private String wechatId; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "登录十天有效 1:有效 2:不处理") + private int tenDayEffective; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java index 651f8fcd..bb485b32 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java @@ -2,6 +2,7 @@ package com.daqing.framework.domain.hrms.request; import lombok.Data; +import javax.validation.constraints.Pattern; import java.io.Serializable; /** @@ -21,6 +22,7 @@ public class UserLoginRequest implements Serializable { /**A * 密码 */ + @Pattern(regexp = "^[a-zA-Z0-9]{8,20}$") private String password; /** diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/LoginResponse.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/LoginResponse.java new file mode 100644 index 00000000..9be2a5a1 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/LoginResponse.java @@ -0,0 +1,12 @@ +package com.daqing.framework.domain.hrms.response; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class LoginResponse { + @ApiModelProperty(value = "用户名") + private String account; + @ApiModelProperty("token令牌") + private String token; +} diff --git a/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/exception/DqException.java b/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/exception/DqException.java deleted file mode 100644 index 81a9cb24..00000000 --- a/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/exception/DqException.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.daqing.financial.gateway.exception; - -import com.daqing.financial.gateway.util.ResultCodeEnum; -import lombok.Data; - -@Data -public class DqException extends RuntimeException { - - private int code; - - private ResultCodeEnum resultCodeEnum; - - public DqException(ResultCodeEnum codeEnum) { - super(codeEnum.getRemark()); - code = codeEnum.getCode(); - } - - public int getCode() { - return code; - } - - public ResultCodeEnum getResultCodeEnum() { - return resultCodeEnum; - } -} \ No newline at end of file diff --git a/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/util/JwtUtil.java b/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/util/JwtUtil.java index 46547e6f..af0d0001 100644 --- a/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/util/JwtUtil.java +++ b/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/util/JwtUtil.java @@ -1,10 +1,9 @@ package com.daqing.financial.gateway.util; + import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; - import com.daqing.financial.gateway.SpringContextHolder; -import com.daqing.financial.gateway.exception.DqException; import java.util.Date; import java.util.Set; @@ -19,7 +18,7 @@ public class JwtUtil { private final static Algorithm algorithm = SpringContextHolder.getBean("algorithm", Algorithm.class); - private final static OdcProperties properties = SpringContextHolder.getBean("odcProperties", OdcProperties.class); + //private final static OdcProperties properties = SpringContextHolder.getBean("odcProperties", OdcProperties.class); /** * 创建token @@ -49,17 +48,18 @@ public class JwtUtil { return userId; } } catch (Exception e) { - throw new DqException(ResultCodeEnum.UN_AUTHORIZATION); + e.printStackTrace(); + return null; } - throw new DqException(ResultCodeEnum.UN_AUTHORIZATION); + return null; } public static String getRedisKey(Long userId, String token) { - return String.format(properties.getConfig().getTokenRedisKeyFormat(), userId, token); + return String.format("dq:token:%d:%s", userId, token); } - public static void putTokenToRedis(Long userId, String token) { - RedisUtil.setEx(getRedisKey(userId, token), "nothing", properties.getConfig().getTokenExpireSeconds()); + public static void putTokenToRedis(Long userId, String token, long times) { + RedisUtil.setEx(getRedisKey(userId, token), "nothing", times); } public static void removeTokenByUserId(Long userId) { diff --git a/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/util/ResultCodeEnum.java b/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/util/ResultCodeEnum.java deleted file mode 100644 index 62846ece..00000000 --- a/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/util/ResultCodeEnum.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.daqing.financial.gateway.util; - -public enum ResultCodeEnum { - - SUCCESS(0, "请求成功"), - BAD_REQUEST(400, "错误请求"), - UN_AUTHORIZATION(401, "未授权"), - SERVER_EXCEPTION(500, "服务器异常"), - - ACCOUNT_NOT_EXIST(10000, "账号不存在"), - ACCOUNT_NOT_BIND(10001, "账号未绑定钱包"), - ACCOUNT_NOT_ACTIVE(10002, "账号未激活"), - ACCOUNT_EXIST(10003, "账号已存在,请登录"), - COIN_ADDRESS_IS_NOT_EXIST(10004, "该币种地址不存在"), - COIN_NAME_IS_NOT_EXIST(10005, "该币种不存在"), - - WALLET_BAD_PARAM(10100, "非法参数,禁止访问他人账号"), - WALLET_NOT_ENOUGH(10101, "可用余额不足"), - SUB_ACCOUNT_NOT_ALLOW_WITHDRAW(10102, "子账号不允许提币"), - USER_NAME_ALREADY_EXISTS(10103,"用户名已存在"), - USER_EMAIL_ALREADY_EXISTS(10104,"邮箱已存在"), - INVITATION_CODE_NOT_EXIST(10105,"邀请码不存在"), - DEVICE_EXIST(10106,"设备号相同"), - LOGINPASSWORD_ERROR(10107,"登录密码错误"), - ACCOUNT_DISABLED(10108,"账号已禁用"), - USER_NAME_IS_ENABLE(10109,"用户名不存在"), - USER_IS_ACTIVE(10111,"该用户已激活"), - PAY_PASSWORD_IS_ERROR(10112,"支付密码错误"), - USER_IS_ACTIVE_MAX(10113,"您的激活次数已上线"), - WITHDRAW_IS_ENABLE(10114,"该币种已关闭提币通道"), - WITHDRAW_IS_NOT_BEGIN_TIME(10115,"未到提币时间"), - WITHDRAW_IS_SUPER_END_TIME(10116,"提币时间已过"), - WITHDRAW_MIN_ERROR(10117,"不能小于最小提币金额"), - WITHDRAW_MAX_ERROR(10118,"不能大于最大提币金额"), - WITHDRAW_MAX_TODAY(10120,"当日提币金额已上限"), - TRANSFER_IS_ENABLE(10121,"该币种已关闭转账通道"), - TRANSFER_MIN_ERROR(10122,"不能小于最小转账金额"), - TRANSFER_MAX_ERROR(10123,"不能大于最大转账金额"), - TRANSFER_MAX_TODAY(10124,"当日转账金额已上限"), - USERNAME_AND_EMAIL_ERROR(10125,"用户名和邮箱不匹配"), - EMAIL_CODE_IS_ERROR(10126,"验证码错误"), - PAY_PASSWORD_IS_NULL(10127,"请先设置支付密码"), - CHAIN_IS_ERROR(10128,"链上异常请联系管理员"); - - - - private final int code; - private final String remark; - - ResultCodeEnum(int code, String remark) { - this.code = code; - this.remark = remark; - } - - public int getCode() { - return code; - } - - public String getRemark() { - return remark; - } -} diff --git a/dq-govern-gateway/src/main/resources/jwt.properties b/dq-govern-gateway/src/main/resources/jwt.properties index a37d3cc8..f1383c49 100644 --- a/dq-govern-gateway/src/main/resources/jwt.properties +++ b/dq-govern-gateway/src/main/resources/jwt.properties @@ -1 +1,2 @@ +jwt.ignoreUrlList=/api/hrms/employee/list,/apiHrmsAuth/hrms/auth/userlogin/login jwt.ignoreUrlList=/apiHrmsAuth/getBackPwd, \ No newline at end of file diff --git a/pom.xml b/pom.xml index ecd9c34b..3802a3da 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ dq-financial-hrms-auth dq-financial-crms dq-financial-crms-auth - dq-financial-workflow - dq-financial-guarantee +