diff --git a/README.md b/README.md
index 07dbeebf9..5a34add02 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+## 平台的简介
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
index e3c56ee54..19f8fc1e5 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
@@ -1,30 +1,55 @@
-package com.ruoyi;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-
-/**
- * 启动程序
- *
- * @author ruoyi
- */
-@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
-public class RuoYiApplication
-{
- public static void main(String[] args)
- {
- // System.setProperty("spring.devtools.restart.enabled", "false");
- SpringApplication.run(RuoYiApplication.class, args);
- System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
- " .-------. ____ __ \n" +
- " | _ _ \\ \\ \\ / / \n" +
- " | ( ' ) | \\ _. / ' \n" +
- " |(_ o _) / _( )_ .' \n" +
- " | (_,_).' __ ___(_ o _)' \n" +
- " | |\\ \\ | || |(_,_)' \n" +
- " | | \\ `' /| `-' / \n" +
- " | | \\ / \\ / \n" +
- " ''-' `'-' `-..-' ");
- }
-}
+package com.ruoyi;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.env.Environment;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * 启动程序
+ *
+ * @author ruoyi
+ */
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+public class RuoYiApplication
+{
+ //private static final Log logger = LogFactory.getLog(MethodHandles.lookup().lookupClass());
+ private static final Logger syslog = LoggerFactory.getLogger(RuoYiApplication.class);
+ public static void main(String[] args)
+ {
+ System.setProperty("spring.devtools.restart.enabled", "false");
+ ApplicationContext appc = SpringApplication.run(RuoYiApplication.class, args);
+ System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
+ " .-------. ____ __ \n" +
+ " | _ _ \\ \\ \\ / / \n" +
+ " | ( ' ) | \\ _. / ' \n" +
+ " |(_ o _) / _( )_ .' \n" +
+ " | (_,_).' __ ___(_ o _)' \n" +
+ " | |\\ \\ | || |(_,_)' \n" +
+ " | | \\ `' /| `-' / \n" +
+ " | | \\ / \\ / \n" +
+ " ''-' `'-' `-..-' ");
+
+ // 打印应用启动环境信息
+ Environment env = appc.getEnvironment();
+ String ip = "localhost";
+ try {
+ ip = InetAddress.getLocalHost().getHostAddress();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ syslog.info("\n----------------------------------------------------------\n\t" +
+ "Application '{}' is running! Access URLs:\n\t" +
+ "Local: \t\thttp://{}:{}\n\t" +
+ "----------------------------------------------------------",
+ env.getProperty("spring.profiles.active"),ip,
+ env.getProperty("server.port"));
+ syslog.info("程序启动完成!");
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/common/utils/ShopAuth.java b/ruoyi-admin/src/main/java/com/ruoyi/common/utils/ShopAuth.java
new file mode 100644
index 000000000..6a5c83f95
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/common/utils/ShopAuth.java
@@ -0,0 +1,133 @@
+package com.ruoyi.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.core.text.CharsetKit;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.math.BigInteger;
+
+/**
+ * @author libiao
+ * @version 1.0
+ * @Description: 虾皮2.0授权工具类
+ * @date 2021/10/24 21:12
+ **/
+public class ShopAuth {
+ public static final String AUTH_SIGN_METHOD = "HmacSHA256";
+
+ public static void main(String[] args) {
+ // 虾皮测试环境
+ String host = "https://partner.test-stable.shopeemobile.com";
+ String path = "/api/v2/shop/auth_partner";
+ //TODO 回跳到花生壳内网地址(转发到8080端口),需要补充URI
+ String redirect_url = "http://4v4c570155.zicp.vip:47393/swagger-ui/index.html";
+ // edterp 的 测试 Partner
+ long partner_id = 1002192L;
+ String partner_key = "8e8618dbb99923b4b298517d263b0b45df02a2ef8341d512539bdbacc76b0bb1";
+ String authUrl = calculateShopAuthUrl(host, path, redirect_url, partner_id, partner_key);
+ System.out.println(authUrl);
+
+ getTokenShopLevel("code123",partner_id,partner_key,"");
+ }
+
+ /**
+ * @Description: 虾皮店铺授权链接生成
+ * 1.拼接基础字符串,api path + partner_id + api path + timestamp
+ * 2.基于基础字符串计算签名
+ * @Author: libiao
+ * @Date: 2021/10/24 21:56
+ * @param host: 虾皮地址
+ * @param path: 虾皮授权接口路径(授权:"/api/v2/shop/auth_partner",取消授权:"/api/v2/shop/cancel_auth_partner")
+ * @param redirect_url: 授权成功后跳转地址,ERP的地址
+ * @param partner_id: 开发者账号id
+ * @param partner_key: 开发者账号key
+ * @return: java.lang.String 授权链接
+ **/
+ public static String calculateShopAuthUrl(String host, String path, String redirect_url, long partner_id, String partner_key) {
+ long timestamp = System.currentTimeMillis() / 1000L;
+ String tmp_base_string = String.format("%s%s%s", partner_id, path, timestamp);
+ byte[] partner_key_bytes;
+ byte[] base_string_bytes;
+ // 计算加密签名
+ BigInteger sign = null;
+ String sign_str = "";
+ try {
+ partner_key_bytes = partner_key.getBytes(CharsetKit.CHARSET_UTF_8);
+ base_string_bytes = tmp_base_string.getBytes(CharsetKit.CHARSET_UTF_8);
+ Mac mac = Mac.getInstance("HmacSHA256"); //"HmacSHA256"
+ SecretKeySpec secretKeySpec = new SecretKeySpec(partner_key_bytes, "HmacSHA256");
+ mac.init(secretKeySpec);
+ //sign = new BigInteger(mac.doFinal(base_string_bytes));
+ byte[] sign_bytes = mac.doFinal(base_string_bytes);
+ sign_str = byteArrayToHexString(sign_bytes);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ // 拼接授权url
+ //String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%032x&redirect=%s", partner_id, timestamp, sign, redirect_url);
+ String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%s&redirect=%s", partner_id, timestamp, sign_str, redirect_url);
+ return url;
+ }
+
+ /**
+ * @Description: 获取店铺级别接口鉴权access_token refresh_token
+ * @Author: libiao
+ * @Date: 2021/11/3 21:16
+ * @param code: 店铺授权成功后返回的
+ * @param partner_id: 开发者账号id
+ * @param partner_key: 开发者账号key
+ * @param shop_id: 店铺id(店铺授权成功后也会返回)
+ * @return: void
+ **/
+ public static void getTokenShopLevel(String code, long partner_id, String partner_key, String shop_id){
+ long timestamp = System.currentTimeMillis()/1000L;
+ JSONObject body = new JSONObject();
+ body.put("code",code);
+ body.put("shop_id",shop_id);
+ body.put("partner_id", partner_id);
+
+ //String host = "https://partner.shopeemobile.com/api/v2/auth/token/get";
+ String host = "https://partner.test-stable.shopeemobile.com";
+ String path = "/api/v2/auth/token/get";
+ String tmp_base_string = String.format("%s%s%s",partner_id,path,timestamp);
+
+ byte[] partner_key_bytes;
+ byte[] base_string_bytes;
+
+ String sign = null;
+ try {
+ partner_key_bytes = partner_key.getBytes("UTF-8");
+ base_string_bytes = tmp_base_string.getBytes("UTF-8");
+ Mac mac = Mac.getInstance(AUTH_SIGN_METHOD); //"HmacSHA256"
+ SecretKeySpec secretKeySpec = new SecretKeySpec(partner_key_bytes,AUTH_SIGN_METHOD);
+ mac.init(secretKeySpec);
+ byte[] sign_bytes = mac.doFinal(base_string_bytes);
+ sign = byteArrayToHexString(sign_bytes);
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ // 拼接授权url
+ String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%s",partner_id,timestamp,sign);
+ // TODO http请求获取access_token和refresh_token
+ System.out.println(url);
+ }
+
+ /**
+ * 将加密后的字节数组转换成字符串
+ *
+ * @param b 字节数组
+ * @return 字符串
+ */
+ public static String byteArrayToHexString(byte[] b) {
+ StringBuilder hs = new StringBuilder();
+ String stmp;
+ for (int n = 0; b!=null && n < b.length; n++) {
+ stmp = Integer.toHexString(b[n] & 0XFF);
+ if (stmp.length() == 1)
+ hs.append('0');
+ hs.append(stmp);
+ }
+ return hs.toString().toLowerCase();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/common/utils/Test.java b/ruoyi-admin/src/main/java/com/ruoyi/common/utils/Test.java
new file mode 100644
index 000000000..8c10caea4
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/common/utils/Test.java
@@ -0,0 +1,85 @@
+package com.ruoyi.common.utils;
+
+import com.ruoyi.common.core.text.CharsetKit;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.math.BigInteger;
+
+/**
+ * @author libiao
+ * @version 1.0
+ * @Description: TODO
+ * @date 2021/11/3 21:48
+ **/
+public class Test {
+ public static void main(String[] args) {
+ // 虾皮测试环境
+ String host = "https://partner.test-stable.shopeemobile.com";
+ String path = "/api/v2/shop/auth_partner";
+ //TODO 回跳到花生壳内网地址(转发到8080端口),需要补充URI
+ String redirect_url = "http://4v4c570155.zicp.vip:47393";
+ // edterp 的 测试 Partner
+ long partner_id = 1002192;
+ String partner_key = "8e8618dbb99923b4b298517d263b0b45df02a2ef8341d512539bdbacc76b0bb1";
+ String authUrl = calculateShopAuthUrl(host, path, redirect_url, partner_id, partner_key);
+ System.out.println(authUrl);
+ }
+
+ /**
+ * @Description: 虾皮店铺授权链接生成
+ * 1.拼接基础字符串,api path + partner_id + api path + timestamp
+ * 2.基于基础字符串计算签名
+ * @Author: libiao
+ * @Date: 2021/10/24 21:56
+ * @param host: 虾皮地址
+ * @param path: 虾皮授权接口路径(授权:"/api/v2/shop/auth_partner",取消授权:"/api/v2/shop/cancel_auth_partner")
+ * @param redirect_url: 授权成功后跳转地址
+ * @param partner_id: 开发者账号id
+ * @param partner_key: 开发者账号key
+ * @return: java.lang.String 授权链接
+ **/
+ public static String calculateShopAuthUrl(String host, String path, String redirect_url, long partner_id, String partner_key) {
+ long timestamp = System.currentTimeMillis() / 1000L;
+ String tmp_base_string = String.format("%s%s%s", partner_id, path, timestamp);
+ byte[] partner_key_bytes;
+ byte[] base_string_bytes;
+ // 计算加密签名
+ BigInteger sign = null;
+ String sign_str = "";
+ try {
+ partner_key_bytes = partner_key.getBytes(CharsetKit.CHARSET_UTF_8);
+ base_string_bytes = tmp_base_string.getBytes(CharsetKit.CHARSET_UTF_8);
+ Mac mac = Mac.getInstance("HmacSHA256"); //"HmacSHA256"
+ SecretKeySpec secretKeySpec = new SecretKeySpec(partner_key_bytes, "HmacSHA256");
+ mac.init(secretKeySpec);
+ //sign = new BigInteger(mac.doFinal(base_string_bytes));
+ byte[] sign_bytes = mac.doFinal(base_string_bytes);
+ sign_str = byteArrayToHexString(sign_bytes);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ // 拼接授权url
+ //String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%032x&redirect=%s", partner_id, timestamp, sign, redirect_url);
+ String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%s&redirect=%s", partner_id, timestamp, sign_str, redirect_url);
+ return url;
+ }
+
+ /**
+ * 将加密后的字节数组转换成字符串
+ *
+ * @param b 字节数组
+ * @return 字符串
+ */
+ public static String byteArrayToHexString(byte[] b) {
+ StringBuilder hs = new StringBuilder();
+ String stmp;
+ for (int n = 0; b!=null && n < b.length; n++) {
+ stmp = Integer.toHexString(b[n] & 0XFF);
+ if (stmp.length() == 1)
+ hs.append('0');
+ hs.append(stmp);
+ }
+ return hs.toString().toLowerCase();
+ }
+}
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index 1f098e407..1ee6e891d 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -1,57 +1,57 @@
-# 数据源配置
-spring:
- datasource:
- type: com.alibaba.druid.pool.DruidDataSource
- driverClassName: com.mysql.cj.jdbc.Driver
- druid:
- # 主库数据源
- master:
- url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
- username: root
- password: password
- # 从库数据源
- slave:
- # 从数据源开关/默认关闭
- enabled: false
- url:
- username:
- password:
- # 初始连接数
- initialSize: 5
- # 最小连接池数量
- minIdle: 10
- # 最大连接池数量
- maxActive: 20
- # 配置获取连接等待超时的时间
- maxWait: 60000
- # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
- timeBetweenEvictionRunsMillis: 60000
- # 配置一个连接在池中最小生存的时间,单位是毫秒
- minEvictableIdleTimeMillis: 300000
- # 配置一个连接在池中最大生存的时间,单位是毫秒
- maxEvictableIdleTimeMillis: 900000
- # 配置检测连接是否有效
- validationQuery: SELECT 1 FROM DUAL
- testWhileIdle: true
- testOnBorrow: false
- testOnReturn: false
- webStatFilter:
- enabled: true
- statViewServlet:
- enabled: true
- # 设置白名单,不填则允许所有访问
- allow:
- url-pattern: /druid/*
- # 控制台管理用户名和密码
- login-username: ruoyi
- login-password: 123456
- filter:
- stat:
- enabled: true
- # 慢SQL记录
- log-slow-sql: true
- slow-sql-millis: 1000
- merge-sql: true
- wall:
- config:
+# 数据源配置
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 主库数据源
+ master:
+ url: jdbc:mysql://localhost:3306/shopee_erp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: shopee_erp
+ password: shopee_erp123
+ # 从库数据源
+ slave:
+ # 从数据源开关/默认关闭
+ enabled: false
+ url:
+ username:
+ password:
+ # 初始连接数
+ initialSize: 5
+ # 最小连接池数量
+ minIdle: 10
+ # 最大连接池数量
+ maxActive: 20
+ # 配置获取连接等待超时的时间
+ maxWait: 60000
+ # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+ timeBetweenEvictionRunsMillis: 60000
+ # 配置一个连接在池中最小生存的时间,单位是毫秒
+ minEvictableIdleTimeMillis: 300000
+ # 配置一个连接在池中最大生存的时间,单位是毫秒
+ maxEvictableIdleTimeMillis: 900000
+ # 配置检测连接是否有效
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 设置白名单,不填则允许所有访问
+ allow:
+ url-pattern: /druid/*
+ # 控制台管理用户名和密码
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 慢SQL记录
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
multi-statement-allow: true
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/application-shopee.yml b/ruoyi-admin/src/main/resources/application-shopee.yml
new file mode 100644
index 000000000..2eea6252b
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/application-shopee.yml
@@ -0,0 +1,20 @@
+shopee:
+ partnerID: 845774
+ secrret: ea6e399abcBb69eacbeBfe38bc89a9ef35Za8Ze48a92535211c2Ъ92e18Ba52d
+ #回跳到系统
+ redirectURL: http://www.edterp.com/shop/shop
+ #shopee 认证
+ authpartner_url: https://partner.shopeemobile.com/api/v1/shop/auth partner
+ #
+ cancel_auth_partner_url: https://partner.shopeemobile.com/api/v1/shop/cancel_auth_partner
+ #shopee 消息推送到系统
+ msgPushUrl: http://www.edterp.com/dev-dpi/orders/shop/verfiyPushMsg
+ #shopee
+ shopInfoApiUrl: https://partner.shopeemobile.com/api/v1/shop/get
+ ordersApiUrl: https://partner.shopeemobile.com/api/v1/orders/basics
+ #
+ orderDetailApiUrl:https://partner.shopeemobile.com/api/v1/orders/detail
+ #
+ orderDetailUariationspiUrl1: https://partner.shopeemobile.com/api/v1/item/tier_var/get
+ socketHost: 172.19.92.42
+ socketPort: 10000
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml
index d69a57207..a8c526ec2 100644
--- a/ruoyi-admin/src/main/resources/logback.xml
+++ b/ruoyi-admin/src/main/resources/logback.xml
@@ -1,93 +1,93 @@
-
-
-
-
-
-
-
-
-
-
- ${log.pattern}
-
-
-
-
-
- ${log.path}/sys-info.log
-
-
-
- ${log.path}/sys-info.%d{yyyy-MM-dd}.log
-
- 60
-
-
- ${log.pattern}
-
-
-
- INFO
-
- ACCEPT
-
- DENY
-
-
-
-
- ${log.path}/sys-error.log
-
-
-
- ${log.path}/sys-error.%d{yyyy-MM-dd}.log
-
- 60
-
-
- ${log.pattern}
-
-
-
- ERROR
-
- ACCEPT
-
- DENY
-
-
-
-
-
- ${log.path}/sys-user.log
-
-
- ${log.path}/sys-user.%d{yyyy-MM-dd}.log
-
- 60
-
-
- ${log.pattern}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ ${log.pattern}
+
+
+
+
+
+ ${log.path}/sys-info.log
+
+
+
+ ${log.path}/sys-info.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+ ${log.pattern}
+
+
+
+ INFO
+
+ ACCEPT
+
+ DENY
+
+
+
+
+ ${log.path}/sys-error.log
+
+
+
+ ${log.path}/sys-error.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+ ${log.pattern}
+
+
+
+ ERROR
+
+ ACCEPT
+
+ DENY
+
+
+
+
+
+ ${log.path}/sys-user.log
+
+
+ ${log.path}/sys-user.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+ ${log.pattern}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file