Explorar el Código

增加添加站点对外接口

Jack hace 11 meses
padre
commit
25e74c479a

+ 32 - 8
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/api/okki/site/controller/OkkiSiteController.java

@@ -180,19 +180,14 @@ public class OkkiSiteController extends JeecgController<OkkiSite, IOkkiSiteServi
 	 * @return
 	 */
 	@PostMapping(value = "status")
-	public Result<String> changeStatus(@RequestBody OkkiSite okkiSite) {
+	public Result<String> changeStatus(@RequestBody OkkiSite okkiSite) throws Exception{
 		// TODO:: 请求okki平台接口
-		return Result.OK();
-	}
-
-
-	public static void main(String[] args) throws Exception {
 		String url = "https://cms.dev.xiaoman.cn/shop-api/External/site";
 		String clientSecret = "rAqZAp9oo0crNariGVVpt5AvPeVhCKXJ";
 		Map<String, String> query = new TreeMap<>();
 		query.put("sign_method", "hmac-md5");
 		query.put("timestamp", String.valueOf(System.currentTimeMillis()));
-		query.put("site_id", "1000002");
+		query.put("site_id", String.valueOf(okkiSite.getSiteId()));
 		query.put("method", "update_site_status");
 
 		Map<String, Object> postData = new HashMap<>();
@@ -205,9 +200,38 @@ public class OkkiSiteController extends JeecgController<OkkiSite, IOkkiSiteServi
 
 		String okkiUrl = url + "?" + buildQueryString(query);
 		String res = doPost(okkiUrl, body);
-		System.out.println(res);
+		if (!res.isEmpty()) {
+			okkiSite.setStatus(3);
+			okkiSiteService.updateById(okkiSite);
+			return Result.OK("操作成功");
+		}else {
+			return Result.error("操作失败");
+		}
 	}
 
+
+//	public static void main(String[] args) throws Exception {
+//		String url = "https://cms.dev.xiaoman.cn/shop-api/External/site";
+//		String clientSecret = "rAqZAp9oo0crNariGVVpt5AvPeVhCKXJ";
+//		Map<String, String> query = new TreeMap<>();
+//		query.put("sign_method", "hmac-md5");
+//		query.put("timestamp", String.valueOf(System.currentTimeMillis()));
+//		query.put("site_id", "1000002");
+//		query.put("method", "update_site_status");
+//
+//		Map<String, Object> postData = new HashMap<>();
+//		postData.put("status", 3);
+//
+//		String queryStr = buildQueryString(query);
+//		String body = toJsonString(postData);
+//		String signStr = queryStr + body;
+//		query.put("signature", generateHmacMD5(signStr, clientSecret));
+//
+//		String okkiUrl = url + "?" + buildQueryString(query);
+//		String res = doPost(okkiUrl, body);
+//		System.out.println(res);
+//	}
+
 	private static String buildQueryString(Map<String, String> params) {
 		StringBuilder query = new StringBuilder();
 		for (Map.Entry<String, String> entry : params.entrySet()) {

+ 21 - 3
jeecg-boot/start.sh

@@ -1,6 +1,24 @@
 
 #!/bin/bash
+ 
+# 项目路径
+PROJECT_PATH=/home/centos/okki-oms/jeecg-boot
+ 
+# 进入项目目录
+cd $PROJECT_PATH
+ 
+# 清理Maven项目
+mvn clean
+ 
+# 打包Maven项目
+mvn package -Dmaven.test.skip=true
+ 
+# 检查包是否生成成功
+if [ -f "$PROJECT_PATH/jeecg-boot-module-system/jeecg-system-start/target/jeecg-system-start-3.6.3.jar" ]; then
+    echo "微服务包生成成功"
+else
+    echo "微服务包生成失败"
+    exit 1
+fi
 
-
-cd /home/centos/okki-oms/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg
-mvn spring-boot:run
+java -jar "$PROJECT_PATH/jeecg-boot-module-system/jeecg-system-start/target/jeecg-system-start-3.6.3.jar" >logs/out.log