企业初始化
This commit is contained in:
@@ -57,5 +57,19 @@
|
|||||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -58,6 +58,18 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.coolstore</groupId>
|
||||||
|
<artifactId>coolstore-base</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -22,6 +22,13 @@ public class CommonConstants {
|
|||||||
|
|
||||||
public static final int REFRESH_TOKEN_EXPIRE = 60*60*24*30;
|
public static final int REFRESH_TOKEN_EXPIRE = 60*60*24*30;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统用户id
|
||||||
|
*/
|
||||||
|
public static final String SYSTEM_USER_ID = "system";
|
||||||
|
public static final String COMMA = ",";
|
||||||
|
|
||||||
|
|
||||||
public static final int ZERO = 0;
|
public static final int ZERO = 0;
|
||||||
public static final int ONE = 1;
|
public static final int ONE = 1;
|
||||||
public static final int TWO = 2;
|
public static final int TWO = 2;
|
||||||
|
|||||||
@@ -0,0 +1,422 @@
|
|||||||
|
package com.cool.store.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
|
import org.mybatis.spring.SqlSessionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.io.support.EncodedResource;
|
||||||
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
|
import org.springframework.jdbc.datasource.init.*;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.LineNumberReader;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: ScriptUtil
|
||||||
|
* @Description: 脚本工具
|
||||||
|
* @date 2022-01-21 16:48
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ScriptUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default statement separator within SQL scripts: {@code ";"}.
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_STATEMENT_SEPARATOR = ";";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fallback statement separator within SQL scripts: {@code "\n"}.
|
||||||
|
* <p>Used if neither a custom separator nor the
|
||||||
|
* {@link #DEFAULT_STATEMENT_SEPARATOR} is present in a given script.
|
||||||
|
*/
|
||||||
|
public static final String FALLBACK_STATEMENT_SEPARATOR = "\n";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String EOF_STATEMENT_SEPARATOR = "^^^ END OF SCRIPT ^^^";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default prefix for single-line comments within SQL scripts: {@code "--"}.
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_COMMENT_PREFIX = "--";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default start delimiter for block comments within SQL scripts: {@code "/*"}.
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_BLOCK_COMMENT_START_DELIMITER = "/*";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default end delimiter for block comments within SQL scripts: <code>"*/"</code>.
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_BLOCK_COMMENT_END_DELIMITER = "*/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变量开始字符$
|
||||||
|
*/
|
||||||
|
public static final String VARIABLE_START_DELIMITER = "\\$\\{";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变量开始字符#
|
||||||
|
*/
|
||||||
|
public static final String VARIABLE_START_DELIMITER2 = "\\#\\{";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变量结束字符
|
||||||
|
*/
|
||||||
|
public static final String VARIABLE_END_DELIMITER = "}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单引号
|
||||||
|
*/
|
||||||
|
public static final String SINGLE_QUOTE = "'";
|
||||||
|
|
||||||
|
|
||||||
|
private final SqlSessionTemplate sqlSessionTemplate;
|
||||||
|
private final DataSourceTransactionManager dataSourceTransactionManager;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ScriptUtil(SqlSessionTemplate sqlSessionTemplate, DataSourceTransactionManager dataSourceTransactionManager) {
|
||||||
|
this.sqlSessionTemplate = sqlSessionTemplate;
|
||||||
|
this.dataSourceTransactionManager = dataSourceTransactionManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(ScriptUtil.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Split an SQL script into separate statements delimited by the provided
|
||||||
|
* separator string. Each individual statement will be added to the provided
|
||||||
|
* {@code List}.
|
||||||
|
* <p>Within the script, the provided {@code commentPrefix} will be honored:
|
||||||
|
* any text beginning with the comment prefix and extending to the end of the
|
||||||
|
* line will be omitted from the output. Similarly, the provided
|
||||||
|
* {@code blockCommentStartDelimiter} and {@code blockCommentEndDelimiter}
|
||||||
|
* delimiters will be honored: any text enclosed in a block comment will be
|
||||||
|
* omitted from the output. In addition, multiple adjacent whitespace characters
|
||||||
|
* will be collapsed into a single space.
|
||||||
|
* @param resource the resource from which the script was read
|
||||||
|
* @param script the SQL script; never {@code null} or empty
|
||||||
|
* @param separator text separating each statement — typically a ';' or
|
||||||
|
* newline character; never {@code null}
|
||||||
|
* @param commentPrefix the prefix that identifies SQL line comments —
|
||||||
|
* typically "--"; never {@code null} or empty
|
||||||
|
* @param blockCommentStartDelimiter the <em>start</em> block comment delimiter;
|
||||||
|
* never {@code null} or empty
|
||||||
|
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter;
|
||||||
|
* never {@code null} or empty
|
||||||
|
* @param statements the list that will contain the individual statements
|
||||||
|
* @throws ScriptException if an error occurred while splitting the SQL script
|
||||||
|
*/
|
||||||
|
public static void splitSqlScript(@Nullable EncodedResource resource, String script,
|
||||||
|
String separator, String commentPrefix, String blockCommentStartDelimiter,
|
||||||
|
String blockCommentEndDelimiter, List<String> statements) throws ScriptException {
|
||||||
|
|
||||||
|
Assert.hasText(script, "'script' must not be null or empty");
|
||||||
|
Assert.notNull(separator, "'separator' must not be null");
|
||||||
|
Assert.hasText(commentPrefix, "'commentPrefix' must not be null or empty");
|
||||||
|
Assert.hasText(blockCommentStartDelimiter, "'blockCommentStartDelimiter' must not be null or empty");
|
||||||
|
Assert.hasText(blockCommentEndDelimiter, "'blockCommentEndDelimiter' must not be null or empty");
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
boolean inSingleQuote = false;
|
||||||
|
boolean inDoubleQuote = false;
|
||||||
|
boolean inEscape = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < script.length(); i++) {
|
||||||
|
char c = script.charAt(i);
|
||||||
|
if (inEscape) {
|
||||||
|
inEscape = false;
|
||||||
|
sb.append(c);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// MySQL style escapes
|
||||||
|
if (c == '\\') {
|
||||||
|
inEscape = true;
|
||||||
|
sb.append(c);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!inDoubleQuote && (c == '\'')) {
|
||||||
|
inSingleQuote = !inSingleQuote;
|
||||||
|
}
|
||||||
|
else if (!inSingleQuote && (c == '"')) {
|
||||||
|
inDoubleQuote = !inDoubleQuote;
|
||||||
|
}
|
||||||
|
if (!inSingleQuote && !inDoubleQuote) {
|
||||||
|
if (script.startsWith(separator, i)) {
|
||||||
|
// We've reached the end of the current statement
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
statements.add(sb.toString());
|
||||||
|
sb = new StringBuilder();
|
||||||
|
}
|
||||||
|
i += separator.length() - 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (script.startsWith(commentPrefix, i)) {
|
||||||
|
// Skip over any content from the start of the comment to the EOL
|
||||||
|
int indexOfNextNewline = script.indexOf('\n', i);
|
||||||
|
if (indexOfNextNewline > i) {
|
||||||
|
i = indexOfNextNewline;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If there's no EOL, we must be at the end of the script, so stop here.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (script.startsWith(blockCommentStartDelimiter, i)) {
|
||||||
|
// Skip over any block comments
|
||||||
|
int indexOfCommentEnd = script.indexOf(blockCommentEndDelimiter, i);
|
||||||
|
if (indexOfCommentEnd > i) {
|
||||||
|
i = indexOfCommentEnd + blockCommentEndDelimiter.length() - 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new ScriptParseException(
|
||||||
|
"Missing block comment end delimiter: " + blockCommentEndDelimiter, resource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c == ' ' || c == '\n' || c == '\t') {
|
||||||
|
// Avoid multiple adjacent whitespace characters
|
||||||
|
if (sb.length() > 0 && sb.charAt(sb.length() - 1) != ' ') {
|
||||||
|
c = ' ';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.hasText(sb)) {
|
||||||
|
statements.add(sb.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a script from the provided resource, using the supplied comment prefix
|
||||||
|
* and statement separator, and build a {@code String} containing the lines.
|
||||||
|
* <p>Lines <em>beginning</em> with the comment prefix are excluded from the
|
||||||
|
* results; however, line comments anywhere else — for example, within
|
||||||
|
* a statement — will be included in the results.
|
||||||
|
* @param resource the {@code EncodedResource} containing the script
|
||||||
|
* to be processed
|
||||||
|
* @param commentPrefix the prefix that identifies comments in the SQL script —
|
||||||
|
* typically "--"
|
||||||
|
* @param separator the statement separator in the SQL script — typically ";"
|
||||||
|
* @return a {@code String} containing the script lines
|
||||||
|
* @throws IOException in case of I/O errors
|
||||||
|
*/
|
||||||
|
private static String readScript(EncodedResource resource, @Nullable String commentPrefix,
|
||||||
|
@Nullable String separator) throws IOException {
|
||||||
|
|
||||||
|
LineNumberReader lnr = new LineNumberReader(resource.getReader());
|
||||||
|
try {
|
||||||
|
return readScript(lnr, commentPrefix, separator);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
lnr.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a script from the provided {@code LineNumberReader}, using the supplied
|
||||||
|
* comment prefix and statement separator, and build a {@code String} containing
|
||||||
|
* the lines.
|
||||||
|
* <p>Lines <em>beginning</em> with the comment prefix are excluded from the
|
||||||
|
* results; however, line comments anywhere else — for example, within
|
||||||
|
* a statement — will be included in the results.
|
||||||
|
* @param lineNumberReader the {@code LineNumberReader} containing the script
|
||||||
|
* to be processed
|
||||||
|
* @param commentPrefix the prefix that identifies comments in the SQL script —
|
||||||
|
* typically "--"
|
||||||
|
* @param separator the statement separator in the SQL script — typically ";"
|
||||||
|
* @return a {@code String} containing the script lines
|
||||||
|
* @throws IOException in case of I/O errors
|
||||||
|
*/
|
||||||
|
public static String readScript(LineNumberReader lineNumberReader, @Nullable String commentPrefix,
|
||||||
|
@Nullable String separator) throws IOException {
|
||||||
|
|
||||||
|
String currentStatement = lineNumberReader.readLine();
|
||||||
|
StringBuilder scriptBuilder = new StringBuilder();
|
||||||
|
while (currentStatement != null) {
|
||||||
|
if (commentPrefix != null && !currentStatement.startsWith(commentPrefix)) {
|
||||||
|
if (scriptBuilder.length() > 0) {
|
||||||
|
scriptBuilder.append('\n');
|
||||||
|
}
|
||||||
|
scriptBuilder.append(currentStatement);
|
||||||
|
}
|
||||||
|
currentStatement = lineNumberReader.readLine();
|
||||||
|
}
|
||||||
|
appendSeparatorToScriptIfNecessary(scriptBuilder, separator);
|
||||||
|
return scriptBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void appendSeparatorToScriptIfNecessary(StringBuilder scriptBuilder, @Nullable String separator) {
|
||||||
|
if (separator == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String trimmed = separator.trim();
|
||||||
|
if (trimmed.length() == separator.length()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// separator ends in whitespace, so we might want to see if the script is trying
|
||||||
|
// to end the same way
|
||||||
|
if (scriptBuilder.lastIndexOf(trimmed) == scriptBuilder.length() - trimmed.length()) {
|
||||||
|
scriptBuilder.append(separator.substring(trimmed.length()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the provided SQL script contain the specified delimiter?
|
||||||
|
* @param script the SQL script
|
||||||
|
* @param delim the string delimiting each statement - typically a ';' character
|
||||||
|
*/
|
||||||
|
public static boolean containsSqlScriptDelimiters(String script, String delim) {
|
||||||
|
boolean inLiteral = false;
|
||||||
|
boolean inEscape = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < script.length(); i++) {
|
||||||
|
char c = script.charAt(i);
|
||||||
|
if (inEscape) {
|
||||||
|
inEscape = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// MySQL style escapes
|
||||||
|
if (c == '\\') {
|
||||||
|
inEscape = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == '\'') {
|
||||||
|
inLiteral = !inLiteral;
|
||||||
|
}
|
||||||
|
if (!inLiteral && script.startsWith(delim, i)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void executeSqlScript(EncodedResource resource, Map<String, Object> params) throws ScriptException {
|
||||||
|
String commentPrefix = DEFAULT_COMMENT_PREFIX;
|
||||||
|
String separator = DEFAULT_STATEMENT_SEPARATOR;
|
||||||
|
try {
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("Executing SQL script from " + resource);
|
||||||
|
}
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
String script;
|
||||||
|
try {
|
||||||
|
script = readScript(resource, commentPrefix, separator);
|
||||||
|
}catch (IOException ex) {
|
||||||
|
throw new CannotReadScriptException(resource, ex);
|
||||||
|
}
|
||||||
|
if (!EOF_STATEMENT_SEPARATOR.equals(separator) && !containsSqlScriptDelimiters(script, separator)) {
|
||||||
|
separator = FALLBACK_STATEMENT_SEPARATOR;
|
||||||
|
}
|
||||||
|
List<String> statements = new ArrayList<>();
|
||||||
|
splitSqlScript(resource, script, separator, commentPrefix, DEFAULT_BLOCK_COMMENT_START_DELIMITER,
|
||||||
|
DEFAULT_BLOCK_COMMENT_END_DELIMITER, statements);
|
||||||
|
int stmtNumber = 0;
|
||||||
|
SqlSession sqlSession = SqlSessionUtils.getSqlSession(
|
||||||
|
sqlSessionTemplate.getSqlSessionFactory(), ExecutorType.BATCH,
|
||||||
|
sqlSessionTemplate.getPersistenceExceptionTranslator());
|
||||||
|
Connection connection = null;
|
||||||
|
Statement stmt = null;
|
||||||
|
try {
|
||||||
|
connection = sqlSession.getConnection();
|
||||||
|
stmt = connection.createStatement();
|
||||||
|
connection.setAutoCommit(false);
|
||||||
|
for (String statement : statements) {
|
||||||
|
stmtNumber++;
|
||||||
|
try {
|
||||||
|
statement = sqlVariableReplace(statement, params);
|
||||||
|
stmt.execute(statement);
|
||||||
|
int rowsAffected = stmt.getUpdateCount();
|
||||||
|
logger.info(rowsAffected + " returned as update count for SQL: " + statement);
|
||||||
|
}catch (SQLException ex) {
|
||||||
|
logger.error(ex);
|
||||||
|
ex.printStackTrace();
|
||||||
|
connection.rollback();
|
||||||
|
sqlSession.clearCache();
|
||||||
|
throw new ScriptStatementFailedException(statement, stmtNumber, resource, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connection.commit();
|
||||||
|
sqlSession.clearCache();
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
connection.rollback();
|
||||||
|
sqlSession.clearCache();
|
||||||
|
throw new Exception(e);
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
if(Objects.nonNull(stmt)){
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
}catch (Throwable ex) {
|
||||||
|
logger.trace("Could not close JDBC Statement", ex);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if(Objects.nonNull(connection)){
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
} catch (SQLException throwables) {
|
||||||
|
logger.trace("Could not close JDBC Statement", throwables);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("Executed SQL script from " + resource + " in " + elapsedTime + " ms.");
|
||||||
|
}
|
||||||
|
}catch (Exception ex) {
|
||||||
|
if (ex instanceof ScriptException) {
|
||||||
|
throw (ScriptException) ex;
|
||||||
|
}
|
||||||
|
throw new UncategorizedScriptException(
|
||||||
|
"Failed to execute database script from resource [" + resource + "]", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理sql变量
|
||||||
|
* @param statement
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String sqlVariableReplace(String statement, Map<String, Object> params){
|
||||||
|
if(MapUtils.isEmpty(params)){
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
if(!statement.contains(VARIABLE_START_DELIMITER) && !statement.contains(VARIABLE_END_DELIMITER)){
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
for (String key : params.keySet()) {
|
||||||
|
String realKey = VARIABLE_START_DELIMITER + key + VARIABLE_END_DELIMITER;
|
||||||
|
String realKey2 = VARIABLE_START_DELIMITER2 + key + VARIABLE_END_DELIMITER;
|
||||||
|
statement = statement.replaceAll(realKey, params.get(key).toString());
|
||||||
|
statement = statement.replaceAll(realKey2, SINGLE_QUOTE + params.get(key) + SINGLE_QUOTE);
|
||||||
|
|
||||||
|
}
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.cool.store.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一性ID工具类
|
||||||
|
*
|
||||||
|
* @author Aaron
|
||||||
|
* @ClassName UUIDUtils
|
||||||
|
* @Description 唯一性ID工具类
|
||||||
|
*/
|
||||||
|
public class UUIDUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID
|
||||||
|
*/
|
||||||
|
public static String get32UUID() {
|
||||||
|
return IdUtil.fastSimpleUUID();
|
||||||
|
}
|
||||||
|
public static String get8UUID() {
|
||||||
|
return StringUtils.substring(IdUtil.fastSimpleUUID(),1,9);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Long get8LongUuid() {
|
||||||
|
long uuid = (int) (Math.random() * 90000000 + 10000000);
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -84,12 +84,7 @@
|
|||||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.18" level="project" />
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.0.7" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.6.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: org.mybatis.generator:mybatis-generator-core:1.3.7" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
||||||
@@ -98,5 +93,12 @@
|
|||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mybatis.generator:mybatis-generator-core:1.3.7" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -50,10 +50,6 @@
|
|||||||
<version>1.3.7</version>
|
<version>1.3.7</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.pagehelper</groupId>
|
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -6,6 +6,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
@@ -25,4 +27,18 @@ public class EnterpriseUserDAO {
|
|||||||
return enterpriseUserMapper.getUserInfoById(enterpriseId, userId);
|
return enterpriseUserMapper.getUserInfoById(enterpriseId, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void batchInsertOrUpdate(String eid, List<EnterpriseUserDO> users) {
|
||||||
|
List<EnterpriseUserDO> result = new ArrayList<>();
|
||||||
|
users.forEach(user -> {
|
||||||
|
if (StringUtils.isBlank(user.getUnionid()) || StringUtils.isBlank(user.getUserId())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(user.getName())) {
|
||||||
|
user.setName(user.getUserId());
|
||||||
|
}
|
||||||
|
result.add(user);
|
||||||
|
});
|
||||||
|
enterpriseUserMapper.batchInsertOrUpdate(eid, result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserRole;
|
||||||
|
import com.cool.store.mapper.EnterpriseUserMapper;
|
||||||
|
import com.cool.store.mapper.EnterpriseUserRoleMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
* @date 2023-05-19 02:59
|
* @date 2023-05-19 02:59
|
||||||
@@ -9,4 +15,11 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class EnterpriseUserRoleDAO {
|
public class EnterpriseUserRoleDAO {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserRoleMapper enterpriseUserRoleMapper;
|
||||||
|
|
||||||
|
public Boolean insertBatchUserRole(String eid, List<EnterpriseUserRole> userRole) {
|
||||||
|
return enterpriseUserRoleMapper.insertBatchUserRole(eid, userRole);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
import com.cool.store.entity.SysRoleDO;
|
import com.cool.store.entity.SysRoleDO;
|
||||||
|
import com.cool.store.enums.RoleEnum;
|
||||||
import com.cool.store.mapper.SysRoleMapper;
|
import com.cool.store.mapper.SysRoleMapper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -30,4 +31,13 @@ public class SysRoleDAO {
|
|||||||
return sysRoleMapper.getHighestPrioritySysRoleDoByUserId(enterpriseId, userId);
|
return sysRoleMapper.getHighestPrioritySysRoleDoByUserId(enterpriseId, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getRoleIdByRoleEnum(String eid, String roleEnum) {
|
||||||
|
|
||||||
|
SysRoleDO roleByRoleEnum = sysRoleMapper.getRoleByRoleEnum(eid, roleEnum);
|
||||||
|
if(roleByRoleEnum==null){
|
||||||
|
return Long.valueOf(RoleEnum.getByCode(roleEnum).getId());
|
||||||
|
}
|
||||||
|
return roleByRoleEnum.getId();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.cool.store.mapper;
|
|||||||
import com.cool.store.entity.EnterpriseUserDO;
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
* @date 2023-05-19 02:58
|
* @date 2023-05-19 02:58
|
||||||
@@ -30,4 +32,12 @@ public interface EnterpriseUserMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
EnterpriseUserDO getUserInfoById(@Param("enterpriseId")String enterpriseId, @Param("userId")String userId);
|
EnterpriseUserDO getUserInfoById(@Param("enterpriseId")String enterpriseId, @Param("userId")String userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入或更新
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param users
|
||||||
|
*/
|
||||||
|
void batchInsertOrUpdate(@Param("enterpriseId") String enterpriseId, @Param("list") List<EnterpriseUserDO> users);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserRole;
|
||||||
import com.cool.store.entity.EnterpriseUserRoleDO;
|
import com.cool.store.entity.EnterpriseUserRoleDO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
* @date 2023-05-19 02:59
|
* @date 2023-05-19 02:59
|
||||||
@@ -22,4 +25,12 @@ public interface EnterpriseUserRoleMapper {
|
|||||||
* dateTime:2023-05-19 02:59
|
* dateTime:2023-05-19 02:59
|
||||||
*/
|
*/
|
||||||
int updateByPrimaryKeySelective(@Param("record") EnterpriseUserRoleDO record, @Param("enterpriseId") String enterpriseId);
|
int updateByPrimaryKeySelective(@Param("record") EnterpriseUserRoleDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入用户角色
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param userRoles
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean insertBatchUserRole(@Param("eid") String enterpriseId, @Param("userRoles") List<EnterpriseUserRole> userRoles);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserRole;
|
||||||
import com.cool.store.entity.SysRoleDO;
|
import com.cool.store.entity.SysRoleDO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
* @date 2023-05-19 03:00
|
* @date 2023-05-19 03:00
|
||||||
@@ -25,4 +28,6 @@ public interface SysRoleMapper {
|
|||||||
|
|
||||||
|
|
||||||
SysRoleDO getHighestPrioritySysRoleDoByUserId(@Param("enterpriseId") String enterpriseId, @Param("userId") String userId);
|
SysRoleDO getHighestPrioritySysRoleDoByUserId(@Param("enterpriseId") String enterpriseId, @Param("userId") String userId);
|
||||||
|
|
||||||
|
SysRoleDO getRoleByRoleEnum(@Param("eid") String enterpriseId, @Param("roleEnum") String roleEnum);
|
||||||
}
|
}
|
||||||
@@ -398,4 +398,73 @@
|
|||||||
where
|
where
|
||||||
user_id = #{userId}
|
user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="batchInsertOrUpdate" parameterType="java.util.List">
|
||||||
|
insert into enterprise_user_${eid} (
|
||||||
|
id,
|
||||||
|
user_id,
|
||||||
|
`name`,
|
||||||
|
mobile,
|
||||||
|
email,
|
||||||
|
active,
|
||||||
|
order_in_depts,
|
||||||
|
main_admin,
|
||||||
|
is_admin,
|
||||||
|
is_boss,
|
||||||
|
dingId,
|
||||||
|
unionid,
|
||||||
|
is_leader_in_depts,
|
||||||
|
is_hide,
|
||||||
|
departments,
|
||||||
|
`position`,
|
||||||
|
avatar,
|
||||||
|
jobnumber,
|
||||||
|
extattr,
|
||||||
|
roles,
|
||||||
|
is_leader,
|
||||||
|
create_time
|
||||||
|
) values
|
||||||
|
|
||||||
|
<foreach collection="list" item="it" separator=",">
|
||||||
|
|
||||||
|
(
|
||||||
|
#{it.id, jdbcType=VARCHAR},
|
||||||
|
#{it.userId, jdbcType=VARCHAR},
|
||||||
|
#{it.name, jdbcType=VARCHAR},
|
||||||
|
#{it.mobile, jdbcType=VARCHAR},
|
||||||
|
#{it.email, jdbcType=VARCHAR},
|
||||||
|
#{it.active, jdbcType=BOOLEAN},
|
||||||
|
#{it.orderInDepts, jdbcType=VARCHAR},
|
||||||
|
#{it.mainAdmin, jdbcType=BOOLEAN},
|
||||||
|
#{it.isAdmin, jdbcType=BOOLEAN},
|
||||||
|
#{it.isBoss, jdbcType=BOOLEAN},
|
||||||
|
#{it.dingid, jdbcType=VARCHAR},
|
||||||
|
#{it.unionid, jdbcType=VARCHAR},
|
||||||
|
#{it.isLeaderInDepts, jdbcType=VARCHAR},
|
||||||
|
#{it.isHide, jdbcType=BOOLEAN},
|
||||||
|
#{it.departments, jdbcType=VARCHAR},
|
||||||
|
#{it.position, jdbcType=VARCHAR},
|
||||||
|
#{it.avatar, jdbcType=VARCHAR},
|
||||||
|
#{it.jobnumber, jdbcType=VARCHAR},
|
||||||
|
#{it.extattr, jdbcType=VARCHAR},
|
||||||
|
#{it.roles, jdbcType=VARCHAR},
|
||||||
|
#{it.isLeader, jdbcType=BOOLEAN},
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
departments=values(departments),
|
||||||
|
`name`=values(name),
|
||||||
|
main_admin=values(main_admin),
|
||||||
|
is_admin=values(is_admin),
|
||||||
|
mobile = values(mobile),
|
||||||
|
order_in_depts=values(order_in_depts),
|
||||||
|
is_leader_in_depts=values(is_leader_in_depts),
|
||||||
|
avatar=values(avatar),
|
||||||
|
active=values(active),
|
||||||
|
`position`=values(position),
|
||||||
|
roles=values(roles),
|
||||||
|
jobnumber=values(jobnumber)
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -60,4 +60,13 @@
|
|||||||
</set>
|
</set>
|
||||||
where id = #{record.id}
|
where id = #{record.id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertBatchUserRole">
|
||||||
|
insert ignore into enterprise_user_role_${eid}
|
||||||
|
(role_id, user_id ,create_time)
|
||||||
|
values
|
||||||
|
<foreach collection="userRoles" item="userRole" separator=",">
|
||||||
|
(#{userRole.roleId}, #{userRole.userId} ,#{userRole.createTime})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -180,4 +180,21 @@
|
|||||||
c.priority is null, c.priority, position_type desc
|
c.priority is null, c.priority, position_type desc
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getRoleByRoleEnum" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
id as id,
|
||||||
|
role_name as roleName,
|
||||||
|
role_auth as roleAuth,
|
||||||
|
is_internal as isInternal,
|
||||||
|
`source` as source,
|
||||||
|
priority as priority,
|
||||||
|
app_menu as appMenu,
|
||||||
|
position_type as positionType,
|
||||||
|
role_enum as roleEnum
|
||||||
|
from
|
||||||
|
sys_role_${eid}
|
||||||
|
where
|
||||||
|
role_enum = #{roleEnum}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -58,6 +58,20 @@
|
|||||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring:2.0.4" level="project" />
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.cool.store.dto.enterprise;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author chenyupeng
|
||||||
|
* @since 2022/1/26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EnterpriseInitDTO {
|
||||||
|
|
||||||
|
private String appType;
|
||||||
|
|
||||||
|
private String corpId;
|
||||||
|
|
||||||
|
private String eid;
|
||||||
|
|
||||||
|
private String dbName;
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.cool.store.dto.enterprise;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业开通相关的参数
|
||||||
|
* @author :xugangkun
|
||||||
|
* @date :2022/2/11 14:14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnterpriseOpenMsg {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业id
|
||||||
|
*/
|
||||||
|
private String eid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* corpId
|
||||||
|
*/
|
||||||
|
private String corpId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开通类型
|
||||||
|
*/
|
||||||
|
private String appType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权用户id
|
||||||
|
*/
|
||||||
|
private String authUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库名
|
||||||
|
*/
|
||||||
|
private String dbName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
package com.cool.store.dto.enterprise;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
|
import com.cool.store.utils.UUIDUtils;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2022-01-18 04:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnterpriseUserDTO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("分机号")
|
||||||
|
private String tel;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String workPlace;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户主键id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("钉钉用户id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否已经激活, true表示已激活, false表示未激活")
|
||||||
|
private Boolean active;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否是主管理员,0:否,1:是")
|
||||||
|
private Byte mainAdmin;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否为企业的管理员, true表示是, false表示不是")
|
||||||
|
private Boolean isAdmin;
|
||||||
|
|
||||||
|
@ApiModelProperty("手机号码")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("员工的电子邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@ApiModelProperty("在当前isv全局范围内唯一标识一个用户的身份,用户无法修改")
|
||||||
|
private String unionid;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否号码隐藏, true表示隐藏, false表示不隐藏")
|
||||||
|
private Boolean isHide;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
@ApiModelProperty("员工的企业邮箱")
|
||||||
|
private String orgEmail;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否为企业的老板, true表示是, false表示不是")
|
||||||
|
private Boolean isBoss;
|
||||||
|
|
||||||
|
@ApiModelProperty("钉钉Id,在钉钉全局范围内标识用户的身份,但用户可以自行修改一次")
|
||||||
|
private String dingid;
|
||||||
|
|
||||||
|
@ApiModelProperty("头像url")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String roles;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否是部门的主管, true表示是, false表示不是")
|
||||||
|
private Boolean isLeader;
|
||||||
|
|
||||||
|
@ApiModelProperty("扩展属性,可以设置多种属性(但手机上最多只能显示10个扩展属性,具体显示哪些属性,请到OA管理后台->设置->通讯录信息设置和OA管理后台->设置->手机端显示信息设置)性")
|
||||||
|
private String extattr;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private Boolean isEnterprise;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("第三方OA系统唯一标识")
|
||||||
|
private String thirdOaUniqueFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String orderInDepts;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private List<String> isLeaderInDepts;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户语言环境:en_us/英语_美国,zh_cn/中文_简体,zh_hk/中文_繁体_HK")
|
||||||
|
private String language;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户来源:默认dingding钉钉,qw企业微信 mobile")
|
||||||
|
private String appType;
|
||||||
|
|
||||||
|
@ApiModelProperty("登录密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String monitoredDepartments;
|
||||||
|
|
||||||
|
@ApiModelProperty("工号")
|
||||||
|
private String jobnumber;
|
||||||
|
|
||||||
|
private String openUserid;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private List<String> departmentLists;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理范围
|
||||||
|
*/
|
||||||
|
private List<Long> scopeList;
|
||||||
|
|
||||||
|
private List<Long> storeList;
|
||||||
|
|
||||||
|
|
||||||
|
public static EnterpriseUserDO transUserDtoToDo(EnterpriseUserDTO enterpriseUserDTO) {
|
||||||
|
EnterpriseUserDO enterpriseUserDO = new EnterpriseUserDO();
|
||||||
|
enterpriseUserDO.setTel(enterpriseUserDTO.getTel());
|
||||||
|
enterpriseUserDO.setWorkPlace(enterpriseUserDTO.getWorkPlace());
|
||||||
|
enterpriseUserDO.setRemark(enterpriseUserDTO.getRemark());
|
||||||
|
enterpriseUserDO.setPosition(enterpriseUserDTO.getPosition());
|
||||||
|
enterpriseUserDO.setMobile(enterpriseUserDTO.getMobile());
|
||||||
|
enterpriseUserDO.setId(UUIDUtils.get32UUID());
|
||||||
|
enterpriseUserDO.setUserId(enterpriseUserDTO.getUserId());
|
||||||
|
enterpriseUserDO.setName(enterpriseUserDTO.getName());
|
||||||
|
enterpriseUserDO.setEmail(enterpriseUserDTO.getEmail());
|
||||||
|
enterpriseUserDO.setOrgEmail(enterpriseUserDTO.getOrgEmail());
|
||||||
|
enterpriseUserDO.setActive(Boolean.TRUE);
|
||||||
|
enterpriseUserDO.setIsBoss(enterpriseUserDTO.getIsBoss());
|
||||||
|
enterpriseUserDO.setUnionid(enterpriseUserDTO.getUnionid());
|
||||||
|
enterpriseUserDO.setAvatar(enterpriseUserDTO.getAvatar());
|
||||||
|
enterpriseUserDO.setIsLeaderInDepts(JSONObject.toJSONString(enterpriseUserDTO.getIsLeaderInDepts()));
|
||||||
|
enterpriseUserDO.setExtattr(enterpriseUserDTO.getExtattr());
|
||||||
|
enterpriseUserDO.setCreateTime(new Date());
|
||||||
|
enterpriseUserDO.setJobnumber(enterpriseUserDTO.getJobnumber());
|
||||||
|
return enterpriseUserDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.cool.store.dto.enterprise;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName EnterpriseUserRole
|
||||||
|
* @Description 用一句话描述什么
|
||||||
|
* @author 首亮
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnterpriseUserRole {
|
||||||
|
private Long id;
|
||||||
|
private String roleId;
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
//创建时间
|
||||||
|
private Date createTime;
|
||||||
|
//更新时间
|
||||||
|
public EnterpriseUserRole(String roleId, String userId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.userId = userId;
|
||||||
|
this.createTime = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.cool.store.dto.login;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: UserIdInfoDTO
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-29 10:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserIdInfoDTO {
|
||||||
|
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
private String unionId;
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
private String corpId;
|
||||||
|
|
||||||
|
public UserIdInfoDTO(String openId, String unionId, String userId, String corpId) {
|
||||||
|
this.openId = openId;
|
||||||
|
this.unionId = unionId;
|
||||||
|
this.userId = userId;
|
||||||
|
this.corpId = corpId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,7 +53,7 @@ public class EnterpriseUserDO implements Serializable {
|
|||||||
private String orderInDepts;
|
private String orderInDepts;
|
||||||
|
|
||||||
@ApiModelProperty("是否是主管理员,0:否,1:是")
|
@ApiModelProperty("是否是主管理员,0:否,1:是")
|
||||||
private Integer mainAdmin;
|
private Boolean mainAdmin;
|
||||||
|
|
||||||
@ApiModelProperty("是否为企业的管理员, true表示是, false表示不是")
|
@ApiModelProperty("是否为企业的管理员, true表示是, false表示不是")
|
||||||
private Boolean isAdmin;
|
private Boolean isAdmin;
|
||||||
|
|||||||
@@ -57,6 +57,16 @@
|
|||||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
||||||
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
|
||||||
@@ -67,14 +77,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
|
||||||
<orderEntry type="module" module-name="coolstore-partner-model" />
|
<orderEntry type="module" module-name="coolstore-partner-model" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
||||||
@@ -99,5 +101,24 @@
|
|||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
|
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun.openservices:ons-client:1.8.8.3.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea-openapi:0.0.19" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea-util:0.2.12" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:credentials-java:0.2.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.ini4j:ini4j:0.5.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.agent:runtime:0.8.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.65" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.65" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea:1.2.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.14.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -33,6 +33,18 @@
|
|||||||
<groupId>org.apache.shiro</groupId>
|
<groupId>org.apache.shiro</groupId>
|
||||||
<artifactId>shiro-core</artifactId>
|
<artifactId>shiro-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.openservices</groupId>
|
||||||
|
<artifactId>ons-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>tea-openapi</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>ons20190214</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.cool.store.http;
|
package com.cool.store.http;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
|
import com.cool.store.dto.login.UserIdInfoDTO;
|
||||||
import com.cool.store.utils.RestTemplateUtil;
|
import com.cool.store.utils.RestTemplateUtil;
|
||||||
|
import com.coolstore.base.dto.ResultDTO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -26,18 +29,33 @@ public class ISVHttpRequest {
|
|||||||
private String getUserIdByCode;
|
private String getUserIdByCode;
|
||||||
|
|
||||||
|
|
||||||
public JSONObject getUserIdByCode(String paramStr){
|
public UserIdInfoDTO getUserIdByCode(String paramStr){
|
||||||
String url = isvDomain + getUserIdByCode + paramStr;
|
String url = isvDomain + "/isv/user/getUserIdByCode" + paramStr;
|
||||||
ResponseEntity<JSONObject> responseEntity = null;
|
ResponseEntity<ResultDTO> responseEntity = null;
|
||||||
try {
|
try {
|
||||||
responseEntity = RestTemplateUtil.loadGet(url, JSONObject.class);
|
responseEntity = RestTemplateUtil.loadGet(url, ResultDTO.class);
|
||||||
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
|
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
|
||||||
|
if(Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()){
|
||||||
|
return JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getData()), UserIdInfoDTO.class);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("调用isv出错{}", e);
|
log.info("调用isv出错{}", e);
|
||||||
}
|
}
|
||||||
if(Objects.isNull(responseEntity)){
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return responseEntity.getBody();
|
|
||||||
|
public EnterpriseUserDTO getUserDetailByUserId(String corpId, String userId, String appType){
|
||||||
|
String url = isvDomain + "/isv/user/getUserDetail";
|
||||||
|
ResponseEntity<ResultDTO> responseEntity = null;
|
||||||
|
try {
|
||||||
|
responseEntity = RestTemplateUtil.loadGet(url, ResultDTO.class);
|
||||||
|
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
|
||||||
|
if(Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()){
|
||||||
|
return JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getData()), EnterpriseUserDTO.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("调用isv出错{}", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.cool.store.mq;
|
||||||
|
|
||||||
|
import com.aliyun.openservices.ons.api.SendResult;
|
||||||
|
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: OrderMessageService
|
||||||
|
* @Description: 顺序消息生产者
|
||||||
|
* @date 2021-12-22 17:37
|
||||||
|
*/
|
||||||
|
public interface OrderMessageService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送顺序消息
|
||||||
|
* @param message
|
||||||
|
* @param tag
|
||||||
|
* @param shardingKey
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SendResult send(String message, RocketMqTagEnum tag, final String shardingKey);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.cool.store.mq;
|
||||||
|
|
||||||
|
import com.aliyun.openservices.ons.api.bean.OrderProducerBean;
|
||||||
|
import com.aliyun.openservices.ons.api.bean.ProducerBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: ProducerClient
|
||||||
|
* @Description: 普通消息client
|
||||||
|
* @date 2021-12-21 11:33
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class ProducerClient {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RocketMqConfig rocketMqConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通消息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Primary
|
||||||
|
@Bean(initMethod = "start", destroyMethod = "shutdown")
|
||||||
|
public ProducerBean producerBean() {
|
||||||
|
ProducerBean producer = new ProducerBean();
|
||||||
|
producer.setProperties(rocketMqConfig.getMqProperties());
|
||||||
|
return producer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分区顺序消息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean(initMethod = "start", destroyMethod = "shutdown")
|
||||||
|
public OrderProducerBean orderProducerBean() {
|
||||||
|
OrderProducerBean producer = new OrderProducerBean();
|
||||||
|
producer.setProperties(rocketMqConfig.getMqProperties());
|
||||||
|
return producer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.cool.store.mq;
|
||||||
|
|
||||||
|
import com.aliyun.openservices.ons.api.PropertyKeyConst;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: RocketMqConfig
|
||||||
|
* @Description: 该服务的rocketmq的配置 以及生产者的topic
|
||||||
|
* @date 2021-12-21 11:33
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "rocketmq")
|
||||||
|
public class RocketMqConfig {
|
||||||
|
|
||||||
|
private String accessKey;
|
||||||
|
private String secretKey;
|
||||||
|
private String nameSrvAdder;
|
||||||
|
/**
|
||||||
|
* 普通消息的topic
|
||||||
|
*/
|
||||||
|
private String topic;
|
||||||
|
/**
|
||||||
|
* 分区顺序消息topic
|
||||||
|
*/
|
||||||
|
private String orderTopic;
|
||||||
|
|
||||||
|
public Properties getMqProperties() {
|
||||||
|
Properties properties = new Properties();
|
||||||
|
properties.setProperty(PropertyKeyConst.AccessKey, this.accessKey);
|
||||||
|
properties.setProperty(PropertyKeyConst.SecretKey, this.secretKey);
|
||||||
|
properties.setProperty(PropertyKeyConst.NAMESRV_ADDR, this.nameSrvAdder);
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessKey() {
|
||||||
|
return accessKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessKey(String accessKey) {
|
||||||
|
this.accessKey = accessKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSecretKey() {
|
||||||
|
return secretKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecretKey(String secretKey) {
|
||||||
|
this.secretKey = secretKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNameSrvAdder() {
|
||||||
|
return nameSrvAdder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameSrvAdder(String nameSrvAdder) {
|
||||||
|
this.nameSrvAdder = nameSrvAdder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTopic() {
|
||||||
|
return topic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTopic(String topic) {
|
||||||
|
this.topic = topic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderTopic() {
|
||||||
|
return orderTopic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderTopic(String orderTopic) {
|
||||||
|
this.orderTopic = orderTopic;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.cool.store.mq;
|
||||||
|
|
||||||
|
import com.aliyun.openservices.ons.api.SendCallback;
|
||||||
|
import com.aliyun.openservices.ons.api.SendResult;
|
||||||
|
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: MessageProducerService
|
||||||
|
* @Description: rocketmq 消息生产者
|
||||||
|
* @date 2021-12-22 16:12
|
||||||
|
*/
|
||||||
|
public interface SimpleMessageService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步发送
|
||||||
|
* @param message 消息
|
||||||
|
* @param tag tag
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SendResult send(String message, RocketMqTagEnum tag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单向发送
|
||||||
|
* @param message 消息
|
||||||
|
* @param tag tag
|
||||||
|
*/
|
||||||
|
void sendOneway(String message, RocketMqTagEnum tag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步发送
|
||||||
|
* @param message 消息
|
||||||
|
* @param tag tag
|
||||||
|
* @param sendCallback 回调
|
||||||
|
*/
|
||||||
|
void sendAsync(String message, RocketMqTagEnum tag, SendCallback sendCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步发送(延时)
|
||||||
|
* @param message
|
||||||
|
* @param tag
|
||||||
|
* @param startDeliverTime
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SendResult send(String message, RocketMqTagEnum tag, Long startDeliverTime);
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.cool.store.mq.impl;
|
||||||
|
|
||||||
|
import com.aliyun.openservices.ons.api.Message;
|
||||||
|
import com.aliyun.openservices.ons.api.SendResult;
|
||||||
|
import com.aliyun.openservices.ons.api.bean.OrderProducerBean;
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.mq.OrderMessageService;
|
||||||
|
import com.cool.store.mq.RocketMqConfig;
|
||||||
|
import com.cool.store.utils.UUIDUtils;
|
||||||
|
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: OrderMessageServiceImpl
|
||||||
|
* @Description: 顺序消息生产实现
|
||||||
|
* @date 2021-12-22 17:38
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class OrderMessageServiceImpl implements OrderMessageService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RocketMqConfig rocketMqConfig;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderProducerBean orderProducerBean;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SendResult send(String message, RocketMqTagEnum tag, String shardingKey) {
|
||||||
|
if(StringUtils.isAnyBlank(message, shardingKey) || Objects.isNull(tag)){
|
||||||
|
return new SendResult();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Message msg = new Message(rocketMqConfig.getOrderTopic(), tag.getTag(), message.getBytes("UTF-8"));
|
||||||
|
Properties properties = new Properties();
|
||||||
|
String requestId = MDC.get(CommonConstants.REQUEST_ID);
|
||||||
|
if(StringUtils.isBlank(requestId)){
|
||||||
|
requestId = UUIDUtils.get32UUID();
|
||||||
|
}
|
||||||
|
properties.setProperty(CommonConstants.REQUEST_ID, requestId);
|
||||||
|
msg.setUserProperties(properties);
|
||||||
|
SendResult send = orderProducerBean.send(msg, shardingKey);
|
||||||
|
return send;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("send@@@@@@@@@ddd", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package com.cool.store.mq.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyun.openservices.ons.api.Message;
|
||||||
|
import com.aliyun.openservices.ons.api.SendCallback;
|
||||||
|
import com.aliyun.openservices.ons.api.SendResult;
|
||||||
|
import com.aliyun.openservices.ons.api.bean.ProducerBean;
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.mq.RocketMqConfig;
|
||||||
|
import com.cool.store.mq.SimpleMessageService;
|
||||||
|
import com.cool.store.utils.UUIDUtils;
|
||||||
|
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: MessageProducerServiceImpl
|
||||||
|
* @Description: 消息生产者实现
|
||||||
|
* @date 2021-12-22 16:12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SimpleMessageServiceImpl implements SimpleMessageService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RocketMqConfig rocketMqConfig;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProducerBean producer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SendResult send(String message, RocketMqTagEnum tag) {
|
||||||
|
if(StringUtils.isBlank(message) || Objects.isNull(tag)){
|
||||||
|
return new SendResult();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Message msg = new Message(rocketMqConfig.getTopic(), tag.getTag(), message.getBytes("UTF-8"));
|
||||||
|
Properties properties = new Properties();
|
||||||
|
String requestId = MDC.get(CommonConstants.REQUEST_ID);
|
||||||
|
if(StringUtils.isBlank(requestId)){
|
||||||
|
requestId = UUIDUtils.get32UUID();
|
||||||
|
}
|
||||||
|
properties.setProperty(CommonConstants.REQUEST_ID, requestId);
|
||||||
|
msg.setUserProperties(properties);
|
||||||
|
SendResult send = producer.send(msg);
|
||||||
|
log.info("消息发送send response:{}", JSONObject.toJSONString(send));
|
||||||
|
return send;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("send#######", e);
|
||||||
|
}
|
||||||
|
return new SendResult();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendOneway(String message, RocketMqTagEnum tag) {
|
||||||
|
if(StringUtils.isBlank(message) || Objects.isNull(tag)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Message msg = new Message(rocketMqConfig.getTopic(), tag.getTag(), message.getBytes("UTF-8"));
|
||||||
|
Properties properties = new Properties();
|
||||||
|
String requestId = MDC.get(CommonConstants.REQUEST_ID);
|
||||||
|
if(StringUtils.isBlank(requestId)){
|
||||||
|
requestId = UUIDUtils.get32UUID();
|
||||||
|
}
|
||||||
|
properties.setProperty(CommonConstants.REQUEST_ID, requestId);
|
||||||
|
msg.setUserProperties(properties);
|
||||||
|
producer.sendOneway(msg);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("send@@@@@@", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendAsync(String message, RocketMqTagEnum tag, SendCallback sendCallback) {
|
||||||
|
if(StringUtils.isBlank(message) || Objects.isNull(tag)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Message msg = new Message(rocketMqConfig.getTopic(), tag.getTag(), message.getBytes("UTF-8"));
|
||||||
|
Properties properties = new Properties();
|
||||||
|
String requestId = MDC.get(CommonConstants.REQUEST_ID);
|
||||||
|
if(StringUtils.isBlank(requestId)){
|
||||||
|
requestId = UUIDUtils.get32UUID();
|
||||||
|
}
|
||||||
|
properties.setProperty(CommonConstants.REQUEST_ID, requestId);
|
||||||
|
msg.setUserProperties(properties);
|
||||||
|
producer.sendAsync(msg, sendCallback);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("sendAsync@@@@@@", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SendResult send(String message, RocketMqTagEnum tag, Long startDeliverTime) {
|
||||||
|
if(StringUtils.isBlank(message) || Objects.isNull(tag)){
|
||||||
|
return new SendResult();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Message msg = new Message(rocketMqConfig.getTopic(), tag.getTag(), message.getBytes("UTF-8"));
|
||||||
|
if(Objects.nonNull(startDeliverTime)) {
|
||||||
|
log.info("{} startDeliverTime:{}", tag.getTag(),new Date(startDeliverTime));
|
||||||
|
msg.setStartDeliverTime(startDeliverTime);
|
||||||
|
}
|
||||||
|
Properties properties = new Properties();
|
||||||
|
String requestId = MDC.get(CommonConstants.REQUEST_ID);
|
||||||
|
if(StringUtils.isBlank(requestId)){
|
||||||
|
requestId = UUIDUtils.get32UUID();
|
||||||
|
}
|
||||||
|
properties.setProperty(CommonConstants.REQUEST_ID, requestId);
|
||||||
|
msg.setUserProperties(properties);
|
||||||
|
SendResult send = producer.send(msg);
|
||||||
|
log.info("发送消息:data:{}", JSONObject.toJSONString(send));
|
||||||
|
return send;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("send@@@@@@@@@", e);
|
||||||
|
}
|
||||||
|
return new SendResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
package com.cool.store.mq.util;
|
||||||
|
|
||||||
|
import com.aliyun.ons20190214.*;
|
||||||
|
import com.aliyun.ons20190214.models.*;
|
||||||
|
import com.aliyun.teaopenapi.models.Config;
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.coolstore.base.enums.RocketMqGroupEnum;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author chenyupeng
|
||||||
|
* @since 2022/1/5
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class RocketMqUtil {
|
||||||
|
|
||||||
|
private static final String INSTANCE_ID = "MQ_INST_1947409023213164_BX3sLZnA";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地
|
||||||
|
*/
|
||||||
|
private static final String LOCAL_INSTANCE_ID = "MQ_INST_1255228665351616_BX3wfyPO";
|
||||||
|
|
||||||
|
private static final String INSTANCE_ID_ONLINE_HD_PRE = "MQ_INST_1947409023213164_BX5N7rwl";
|
||||||
|
private static final String ACCESS_KEY = "LTAI5t5ouXZuFgxJMbQea3b2";
|
||||||
|
private static final String ACCESS_SECRET = "yuomDstRjSdihtN5zo8viDbWu8Z0ig";
|
||||||
|
/**
|
||||||
|
* 使用AK&SK初始化账号Client
|
||||||
|
* @param accessKeyId
|
||||||
|
* @param accessKeySecret
|
||||||
|
* @return Client
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
|
||||||
|
Config config = new Config()
|
||||||
|
// 您的AccessKey ID
|
||||||
|
.setAccessKeyId(accessKeyId)
|
||||||
|
// 您的AccessKey Secret
|
||||||
|
.setAccessKeySecret(accessKeySecret);
|
||||||
|
// 访问的域名
|
||||||
|
config.endpoint = "ons.cn-hangzhou.aliyuncs.com";
|
||||||
|
return new Client(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Client createLocalClient(String accessKeyId, String accessKeySecret) throws Exception {
|
||||||
|
Config config = new Config()
|
||||||
|
// 您的AccessKey ID
|
||||||
|
.setAccessKeyId(accessKeyId)
|
||||||
|
// 您的AccessKey Secret
|
||||||
|
.setAccessKeySecret(accessKeySecret);
|
||||||
|
// 访问的域名
|
||||||
|
config.endpoint = "ons.mq-internet-access.aliyuncs.com";
|
||||||
|
return new Client(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增测试、开发环境的group
|
||||||
|
* @author chenyupeng
|
||||||
|
* @date 2022/1/13
|
||||||
|
* @param profiles 环境后缀,逗号分隔 例如: dev,dev2
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static void initGroup(String profiles) throws Exception {
|
||||||
|
Client client = RocketMqUtil.createClient(ACCESS_KEY, ACCESS_SECRET);
|
||||||
|
List<String> profileList = Arrays.asList(profiles.split(CommonConstants.COMMA));
|
||||||
|
if(CollectionUtils.isEmpty(profileList)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OnsGroupListRequest onsGroupListRequest = new OnsGroupListRequest();
|
||||||
|
onsGroupListRequest.setInstanceId(INSTANCE_ID);
|
||||||
|
OnsGroupListResponse onsGroupListResponse = client.onsGroupList(onsGroupListRequest);
|
||||||
|
List<OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo> subscribeInfoDo = onsGroupListResponse.getBody().getData().getSubscribeInfoDo();
|
||||||
|
Map<String, OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo> collect = ListUtils.emptyIfNull(subscribeInfoDo).stream().
|
||||||
|
collect(Collectors.toMap(OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo::getGroupId, data -> data, (a, b) -> a));
|
||||||
|
|
||||||
|
for (String profile : profileList) {
|
||||||
|
for (RocketMqGroupEnum groupEnum : RocketMqGroupEnum.values()) {
|
||||||
|
String groupId = groupEnum.getDefaultGroup() + "_" + profile;
|
||||||
|
//已经创建就继续
|
||||||
|
if(collect.get(groupId) != null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
OnsGroupCreateRequest onsGroupCreateRequest = new OnsGroupCreateRequest();
|
||||||
|
onsGroupCreateRequest.setGroupId(groupId);
|
||||||
|
onsGroupCreateRequest.setInstanceId(INSTANCE_ID);
|
||||||
|
// 复制代码运行请自行打印 API 的返回值
|
||||||
|
try {
|
||||||
|
client.onsGroupCreate(onsGroupCreateRequest);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("initGroupAndTag fail",e);
|
||||||
|
}
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initLocalGroup(String profiles) throws Exception {
|
||||||
|
Client client = RocketMqUtil.createLocalClient("LTAI5tPWCTeCyngfYLqoSGWk", "jkzIXlvNF17ne5TPPEFP1sQhcfg4Je");
|
||||||
|
List<String> profileList = Arrays.asList(profiles.split(CommonConstants.COMMA));
|
||||||
|
if(CollectionUtils.isEmpty(profileList)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OnsGroupListRequest onsGroupListRequest = new OnsGroupListRequest();
|
||||||
|
onsGroupListRequest.setInstanceId(LOCAL_INSTANCE_ID);
|
||||||
|
OnsGroupListResponse onsGroupListResponse = client.onsGroupList(onsGroupListRequest);
|
||||||
|
List<OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo> subscribeInfoDo = onsGroupListResponse.getBody().getData().getSubscribeInfoDo();
|
||||||
|
Map<String, OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo> collect = ListUtils.emptyIfNull(subscribeInfoDo).stream().
|
||||||
|
collect(Collectors.toMap(OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo::getGroupId, data -> data, (a, b) -> a));
|
||||||
|
|
||||||
|
for (String profile : profileList) {
|
||||||
|
for (RocketMqGroupEnum groupEnum : RocketMqGroupEnum.values()) {
|
||||||
|
String groupId = groupEnum.getDefaultGroup() + "_" + profile;
|
||||||
|
//已经创建就继续
|
||||||
|
if(collect.get(groupId) != null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
OnsGroupCreateRequest onsGroupCreateRequest = new OnsGroupCreateRequest();
|
||||||
|
onsGroupCreateRequest.setGroupId(groupId);
|
||||||
|
onsGroupCreateRequest.setInstanceId(LOCAL_INSTANCE_ID);
|
||||||
|
// 复制代码运行请自行打印 API 的返回值
|
||||||
|
try {
|
||||||
|
client.onsGroupCreate(onsGroupCreateRequest);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("initGroupAndTag fail",e);
|
||||||
|
}
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增线上、灰度、预发环境的group
|
||||||
|
* @author chenyupeng
|
||||||
|
* @date 2022/1/13
|
||||||
|
* @param profiles 环境后缀,逗号分隔 例如: online,hd,pre
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static void initOnlineAndHdAndPreGroup(String profiles) throws Exception {
|
||||||
|
Client client = RocketMqUtil.createClient(ACCESS_KEY, ACCESS_SECRET);
|
||||||
|
List<String> profileList = Arrays.asList(profiles.split(CommonConstants.COMMA));
|
||||||
|
if(CollectionUtils.isEmpty(profileList)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OnsGroupListRequest onsGroupListRequest = new OnsGroupListRequest();
|
||||||
|
onsGroupListRequest.setInstanceId(INSTANCE_ID_ONLINE_HD_PRE);
|
||||||
|
OnsGroupListResponse onsGroupListResponse = client.onsGroupList(onsGroupListRequest);
|
||||||
|
List<OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo> subscribeInfoDo = onsGroupListResponse.getBody().getData().getSubscribeInfoDo();
|
||||||
|
Map<String, OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo> collect = ListUtils.emptyIfNull(subscribeInfoDo).stream().
|
||||||
|
collect(Collectors.toMap(OnsGroupListResponseBody.OnsGroupListResponseBodyDataSubscribeInfoDo::getGroupId, data -> data, (a, b) -> a));
|
||||||
|
|
||||||
|
for (String profile : profileList) {
|
||||||
|
for (RocketMqGroupEnum groupEnum : RocketMqGroupEnum.values()) {
|
||||||
|
String groupId = groupEnum.getDefaultGroup() + "_" + profile;
|
||||||
|
//已经创建就继续
|
||||||
|
if(collect.get(groupId) != null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
OnsGroupCreateRequest onsGroupCreateRequest = new OnsGroupCreateRequest();
|
||||||
|
onsGroupCreateRequest.setGroupId(groupId);
|
||||||
|
onsGroupCreateRequest.setInstanceId(INSTANCE_ID_ONLINE_HD_PRE);
|
||||||
|
// 复制代码运行请自行打印 API 的返回值
|
||||||
|
try {
|
||||||
|
client.onsGroupCreate(onsGroupCreateRequest);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("initGroupAndTag fail",e);
|
||||||
|
}
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除测试、开发环境的group
|
||||||
|
* @author chenyupeng
|
||||||
|
* @date 2022/1/13
|
||||||
|
* @param groupId
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static void deleteGroupById(String groupId) throws Exception {
|
||||||
|
Client client = RocketMqUtil.createClient(ACCESS_KEY, ACCESS_SECRET);
|
||||||
|
OnsGroupDeleteRequest request = new OnsGroupDeleteRequest();
|
||||||
|
request.setGroupId(groupId);
|
||||||
|
request.setInstanceId(INSTANCE_ID);
|
||||||
|
client.onsGroupDelete(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dao.EnterpriseUserDAO;
|
||||||
|
import com.cool.store.dao.EnterpriseUserRoleDAO;
|
||||||
|
import com.cool.store.dao.SysRoleDAO;
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseInitDTO;
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseOpenMsg;
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserRole;
|
||||||
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
|
import com.cool.store.enums.RoleEnum;
|
||||||
|
import com.cool.store.http.ISVHttpRequest;
|
||||||
|
import com.cool.store.mq.SimpleMessageService;
|
||||||
|
import com.cool.store.utils.DataSourceHelper;
|
||||||
|
import com.cool.store.utils.ScriptUtil;
|
||||||
|
import com.cool.store.utils.UUIDUtils;
|
||||||
|
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.core.io.support.EncodedResource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: EnterpriseInitService
|
||||||
|
* @Description: 企业初始化
|
||||||
|
* @date 2023-05-26 16:28
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class EnterpriseInitServiceImpl {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
protected ScriptUtil scriptUtil;
|
||||||
|
@Resource
|
||||||
|
private SysRoleDAO sysRoleDAO;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserDAO enterpriseUserDAO;
|
||||||
|
@Resource
|
||||||
|
private SimpleMessageService simpleMessageService;
|
||||||
|
@Resource
|
||||||
|
private ISVHttpRequest isvHttpRequest;
|
||||||
|
|
||||||
|
public void runEnterpriseScript(EnterpriseOpenMsg msg) {
|
||||||
|
runEnterpriseScriptAndInitAuthUser(msg);
|
||||||
|
//抛出开始数据同步消息
|
||||||
|
EnterpriseInitDTO enterpriseInitDTO = new EnterpriseInitDTO();
|
||||||
|
enterpriseInitDTO.setEid(msg.getEid());
|
||||||
|
enterpriseInitDTO.setAppType(msg.getAppType());
|
||||||
|
enterpriseInitDTO.setCorpId(msg.getCorpId());
|
||||||
|
enterpriseInitDTO.setDbName(msg.getDbName());
|
||||||
|
enterpriseInitDTO.setUserId(msg.getAuthUserId());
|
||||||
|
log.info("send msg to enterprise_open_data_sync, eid:{}, appType:{}, corpId:{}, dbName:{}", msg.getEid(), msg.getAppType(), msg.getCorpId(), msg.getDbName(), msg.getAuthUserId());
|
||||||
|
simpleMessageService.send(JSONObject.toJSONString(enterpriseInitDTO), RocketMqTagEnum.ENTERPRISE_OPEN_DATA_SYNC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runEnterpriseScriptAndInitAuthUser(EnterpriseOpenMsg msg) {
|
||||||
|
DataSourceHelper.changeToSpecificDataSource(msg.getDbName());
|
||||||
|
//执行脚本代码
|
||||||
|
ClassPathResource rc = new ClassPathResource("script/enterpriseInit.sql");
|
||||||
|
EncodedResource er = new EncodedResource(rc, "utf-8");
|
||||||
|
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
||||||
|
objectObjectHashMap.put("enterpriseId", msg.getEid());
|
||||||
|
String userId = msg.getAuthUserId();
|
||||||
|
if(StringUtils.isBlank(userId)){
|
||||||
|
objectObjectHashMap.put("userId", CommonConstants.SYSTEM_USER_ID);
|
||||||
|
} else {
|
||||||
|
objectObjectHashMap.put("userId", userId);
|
||||||
|
}
|
||||||
|
String groupId = UUIDUtils.get32UUID();
|
||||||
|
objectObjectHashMap.put("groupId", groupId);
|
||||||
|
scriptUtil.executeSqlScript(er, objectObjectHashMap);
|
||||||
|
log.info("初始化开通用户");
|
||||||
|
if (StringUtils.isNotBlank(msg.getAuthUserId())) {
|
||||||
|
//初始化开通用户
|
||||||
|
initAuthUser(msg.getEid(), msg.getCorpId(), msg.getAppType(), msg.getAuthUserId(), userId, msg.getDbName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initAuthUser(String eid, String corpId, String appType, String authUserId, String userId, String dbName) {
|
||||||
|
List<EnterpriseUserRole> userRoles = new ArrayList<>();
|
||||||
|
Long roleIdByRoleEnum = sysRoleDAO.getRoleIdByRoleEnum(eid, RoleEnum.MASTER.getRoleEnum());
|
||||||
|
Long shopOwner = sysRoleDAO.getRoleIdByRoleEnum(eid, RoleEnum.SHOPOWNER.getRoleEnum());
|
||||||
|
Long subMaster = sysRoleDAO.getRoleIdByRoleEnum(eid, RoleEnum.SUB_MASTER.getRoleEnum());
|
||||||
|
//钉钉或者企业走用户,app开通不需要
|
||||||
|
EnterpriseUserDTO userDTO = null;
|
||||||
|
try {
|
||||||
|
userDTO = isvHttpRequest.getUserDetailByUserId(corpId, authUserId, appType);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("getUserDetailByUserId error", e);
|
||||||
|
}
|
||||||
|
EnterpriseUserDO userDO = EnterpriseUserDTO.transUserDtoToDo(userDTO);
|
||||||
|
userDO.setMainAdmin(true);
|
||||||
|
userDO.setIsAdmin(true);
|
||||||
|
enterpriseUserDAO.batchInsertOrUpdate(eid, Collections.singletonList(userDO));
|
||||||
|
userRoles.add(new EnterpriseUserRole(roleIdByRoleEnum.toString(), userId));
|
||||||
|
userRoles.add(new EnterpriseUserRole(shopOwner.toString(), userId));
|
||||||
|
userRoles.add(new EnterpriseUserRole(subMaster.toString(), userId));
|
||||||
|
enterpriseUserRoleDAO.insertBatchUserRole(eid, userRoles);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,6 +23,16 @@
|
|||||||
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
||||||
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
|
||||||
@@ -32,14 +42,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
|
||||||
<orderEntry type="module" module-name="coolstore-partner-model" />
|
<orderEntry type="module" module-name="coolstore-partner-model" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
||||||
@@ -64,6 +66,25 @@
|
|||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
|
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun.openservices:ons-client:1.8.8.3.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea-openapi:0.0.19" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea-util:0.2.12" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:credentials-java:0.2.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.ini4j:ini4j:0.5.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.agent:runtime:0.8.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.65" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.65" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea:1.2.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.14.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class TokenValidateFilter implements Filter {
|
|||||||
|
|
||||||
private static List<String> patternList =
|
private static List<String> patternList =
|
||||||
|
|
||||||
Lists.newArrayList("/web/check/ok","/check/ok", "/partner/doc.html",
|
Lists.newArrayList("/web/check/ok","/check/ok", "/partner/doc.html","/**/test/**",
|
||||||
"/**/swagger*/**",
|
"/**/swagger*/**",
|
||||||
"/**/webjars/**");
|
"/**/webjars/**");
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.cool.store.controller;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cool.store.dto.login.FeiShuLoginDTO;
|
import com.cool.store.dto.login.FeiShuLoginDTO;
|
||||||
|
import com.cool.store.dto.login.UserIdInfoDTO;
|
||||||
import com.cool.store.enums.AppTypeEnum;
|
import com.cool.store.enums.AppTypeEnum;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
@@ -42,17 +43,13 @@ public class LoginController {
|
|||||||
String userId = "", corpId = "", appType = AppTypeEnum.FEI_SHU.getValue();
|
String userId = "", corpId = "", appType = AppTypeEnum.FEI_SHU.getValue();
|
||||||
try {
|
try {
|
||||||
String value = "code=" + code + "&appType=" + appType + "&appId=" + appId;
|
String value = "code=" + code + "&appType=" + appType + "&appId=" + appId;
|
||||||
JSONObject userInfo = isvHttpRequest.getUserIdByCode(value);
|
UserIdInfoDTO userInfo = isvHttpRequest.getUserIdByCode(value);
|
||||||
if(Objects.isNull(userInfo)){
|
if(Objects.isNull(userInfo)){
|
||||||
throw new ServiceException(ErrorCodeEnum.LOGIN_ERROR);
|
throw new ServiceException(ErrorCodeEnum.LOGIN_ERROR);
|
||||||
}
|
}
|
||||||
log.info("userInfo:{}", JSONObject.toJSONString(userInfo));
|
log.info("userInfo:{}", JSONObject.toJSONString(userInfo));
|
||||||
userId = userInfo.getString("openId");
|
userId = userInfo.getOpenId();
|
||||||
corpId = userInfo.getString("corpId");
|
corpId = userInfo.getCorpId();
|
||||||
String errorCode = userInfo.getString("error_code");
|
|
||||||
if (StringUtils.isBlank(userId) && StringUtils.isNotBlank(errorCode)) {
|
|
||||||
throw new ServiceException(ErrorCodeEnum.LOGIN_ERROR);
|
|
||||||
}
|
|
||||||
return loginService.feiShuLogin(userId, corpId, Boolean.TRUE, appType, StringUtils.EMPTY);
|
return loginService.feiShuLogin(userId, corpId, Boolean.TRUE, appType, StringUtils.EMPTY);
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.cool.store.controller;
|
||||||
|
|
||||||
|
import com.cool.store.entity.EnterpriseConfigDO;
|
||||||
|
import com.cool.store.service.EnterpriseConfigService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: TestController
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-26 11:32
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("test/")
|
||||||
|
public class TestController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnterpriseConfigService enterpriseConfigService;
|
||||||
|
|
||||||
|
@GetMapping("/selectByEnterpriseId")
|
||||||
|
public EnterpriseConfigDO selectByEnterpriseId(@RequestParam("enterpriseId") String enterpriseId){
|
||||||
|
return enterpriseConfigService.selectByEnterpriseId(enterpriseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -34,4 +34,10 @@ mybatis.configuration.call-setters-on-nulls=true
|
|||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
isv.domain = https://tstore-isv.coolcollege.cn
|
isv.domain = https://tstore-isv.coolcollege.cn
|
||||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
|
|||||||
@@ -38,4 +38,10 @@ mybatis.configuration.call-setters-on-nulls=true
|
|||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
isv.domain = https://dstore-isv.coolcollege.cn
|
isv.domain = https://dstore-isv.coolcollege.cn
|
||||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -34,4 +34,10 @@ mybatis.configuration.call-setters-on-nulls=true
|
|||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
isv.domain = https://hdstore-isv.coolcollege.cn
|
isv.domain = https://hdstore-isv.coolcollege.cn
|
||||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -41,4 +41,10 @@ mybatis.configuration.call-setters-on-nulls=true
|
|||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
isv.domain = https://tstore-isv.coolcollege.cn
|
isv.domain = https://tstore-isv.coolcollege.cn
|
||||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -34,4 +34,10 @@ mybatis.configuration.call-setters-on-nulls=true
|
|||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
isv.domain = https://store-isv.coolcollege.cn
|
isv.domain = https://store-isv.coolcollege.cn
|
||||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -34,4 +34,10 @@ mybatis.configuration.call-setters-on-nulls=true
|
|||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
isv.domain = https://store-isv.coolcollege.cn
|
isv.domain = https://store-isv.coolcollege.cn
|
||||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -34,4 +34,10 @@ mybatis.configuration.call-setters-on-nulls=true
|
|||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
isv.domain = https://tstore-isv.coolcollege.cn
|
isv.domain = https://tstore-isv.coolcollege.cn
|
||||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -23,6 +23,16 @@
|
|||||||
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
||||||
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
|
||||||
@@ -32,14 +42,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
|
||||||
<orderEntry type="module" module-name="coolstore-partner-model" />
|
<orderEntry type="module" module-name="coolstore-partner-model" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
||||||
@@ -64,6 +66,25 @@
|
|||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
|
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun.openservices:ons-client:1.8.8.3.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea-openapi:0.0.19" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea-util:0.2.12" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:credentials-java:0.2.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.ini4j:ini4j:0.5.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.agent:runtime:0.8.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.65" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.65" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:tea:1.2.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.14.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
||||||
|
|||||||
@@ -32,3 +32,11 @@ mybatis.mapper-locations=classpath*:mapper/**/*Mapper.xml
|
|||||||
|
|
||||||
mybatis.configuration.call-setters-on-nulls=true
|
mybatis.configuration.call-setters-on-nulls=true
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -36,3 +36,10 @@ mybatis.mapper-locations=classpath*:mapper/**/*Mapper.xml
|
|||||||
|
|
||||||
mybatis.configuration.call-setters-on-nulls=true
|
mybatis.configuration.call-setters-on-nulls=true
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -32,3 +32,10 @@ mybatis.mapper-locations=classpath*:mapper/**/*Mapper.xml
|
|||||||
|
|
||||||
mybatis.configuration.call-setters-on-nulls=true
|
mybatis.configuration.call-setters-on-nulls=true
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -39,3 +39,10 @@ customize_sub_table_size=10
|
|||||||
|
|
||||||
mybatis.configuration.call-setters-on-nulls=true
|
mybatis.configuration.call-setters-on-nulls=true
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
|
|||||||
@@ -32,3 +32,10 @@ mybatis.mapper-locations=classpath*:mapper/**/*Mapper.xml
|
|||||||
|
|
||||||
mybatis.configuration.call-setters-on-nulls=true
|
mybatis.configuration.call-setters-on-nulls=true
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -32,3 +32,10 @@ mybatis.mapper-locations=classpath*:mapper/**/*Mapper.xml
|
|||||||
|
|
||||||
mybatis.configuration.call-setters-on-nulls=true
|
mybatis.configuration.call-setters-on-nulls=true
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
@@ -32,3 +32,10 @@ mybatis.mapper-locations=classpath*:mapper/**/*Mapper.xml
|
|||||||
|
|
||||||
mybatis.configuration.call-setters-on-nulls=true
|
mybatis.configuration.call-setters-on-nulls=true
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
|
||||||
|
#rocketmq \u914D\u7F6E
|
||||||
|
rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
|
||||||
|
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
|
||||||
|
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
|
||||||
|
rocketmq.topic=simple_message
|
||||||
|
rocketmq.orderTopic=order_message
|
||||||
20
pom.xml
20
pom.xml
@@ -131,6 +131,26 @@
|
|||||||
<artifactId>ons-client</artifactId>
|
<artifactId>ons-client</artifactId>
|
||||||
<version>1.8.8.3.Final</version>
|
<version>1.8.8.3.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.0.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.coolstore</groupId>
|
||||||
|
<artifactId>coolstore-base</artifactId>
|
||||||
|
<version>1.5.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>tea-openapi</artifactId>
|
||||||
|
<version>0.0.19</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>ons20190214</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user