瀏覽代碼

Merge remote-tracking branch 'origin/master'

xuzuoyun 5 年之前
父節點
當前提交
c142e7ea56

+ 26 - 16
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouController.java

@@ -1,8 +1,5 @@
 package org.jeecg.modules.kuaishou.controller;
 
-import cn.com.ctop.common.utils.FileEntity;
-import cn.com.ctop.common.utils.FileUploadTool;
-import cn.com.ctop.common.utils.TransfMediaTool;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
@@ -13,7 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
-import java.io.File;
 import java.io.IOException;
 import java.util.Map;
 
@@ -120,7 +116,7 @@ public class KuaiShouController {
 
     @RequestMapping("/getToken")
     public void getToken() {
-        String accessToken = "b565fa0dc618ec8fa08e1b32d66f3f17";
+        String accessToken = "092955a5f1768f8dfdc19fd821ccfd9e";
         kuaishouInterfaceService.getRefreshToken(accessToken);
 
 
@@ -130,7 +126,7 @@ public class KuaiShouController {
     @RequestMapping(value = "/video/upload", consumes = "multipart/form-data;charset=utf-8")
     public void upload(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
 
-        String accessToken = "8903c5a4ddbec0c236eb536b8bec58db";
+        String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
 
         kuaishouInterfaceService.videoUpload(advertiserId, accessToken, multipartFile, request);
@@ -141,7 +137,7 @@ public class KuaiShouController {
     @RequestMapping("/video/get")
     public void videoGet() {
 
-        String accessToken = "8903c5a4ddbec0c236eb536b8bec58db";
+        String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
         String photoId = "5249789805735604135";
         /*FileUploadTool fileUploadTool = new FileUploadTool();
@@ -159,7 +155,7 @@ public class KuaiShouController {
     @RequestMapping("/image/get")
     public void imageGet() {
 
-        String accessToken = "8903c5a4ddbec0c236eb536b8bec58db";
+        String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
         String image_token = "market825e095b83eb4456a31ce95704d03238.jpg";
         /*FileUploadTool fileUploadTool = new FileUploadTool();
@@ -178,7 +174,7 @@ public class KuaiShouController {
     @RequestMapping("/area/list")
     public void areaList() {
 
-        String accessToken = "8903c5a4ddbec0c236eb536b8bec58db";
+        String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
         String image_token = "market825e095b83eb4456a31ce95704d03238.jpg";
         /*FileUploadTool fileUploadTool = new FileUploadTool();
@@ -197,7 +193,7 @@ public class KuaiShouController {
     @RequestMapping(value = "/image/upload", consumes = "multipart/form-data;charset=utf-8")
     public void imgUpload(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
 
-        String accessToken = "8903c5a4ddbec0c236eb536b8bec58db";
+        String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
 
         kuaishouInterfaceService.imageUpload(advertiserId, accessToken, multipartFile, request);
@@ -208,20 +204,34 @@ public class KuaiShouController {
     @RequestMapping(value = "/app/create", consumes = "multipart/form-data;charset=utf-8")
     public void appCreate(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
 
-        String accessToken = "8903c5a4ddbec0c236eb536b8bec58db";
+        String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
 
-        kuaishouInterfaceService.appCreate(advertiserId, accessToken, multipartFile, request);
+        JSONObject requestJson = new JSONObject();
+        requestJson.put("app_version", "2.3.6");
+        requestJson.put("app_name", "微信开发1");
+        requestJson.put("image_token", "market81dd2187353e4cb19918b61276797ce5.jpg");
+        requestJson.put("advertiser_id", advertiserId);
+        requestJson.put("package_name", "2");
+        requestJson.put("platform", 1);
+        kuaishouInterfaceService.appCreate(advertiserId, accessToken, multipartFile, request, requestJson);
 
     }
 
-    @RequestMapping(value = "/getAppList", consumes = "multipart/form-data;charset=utf-8")
+    @RequestMapping("/getAppList")
     public void getAppList() throws IOException {
-
-        String accessToken = "8903c5a4ddbec0c236eb536b8bec58db";
+        String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
-
         kuaishouInterfaceService.getAppList(advertiserId, accessToken);
 
     }
+
+    @RequestMapping(value = "/app/update", consumes = "multipart/form-data;charset=utf-8")
+    public void appUpdate(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
+        String accessToken = "360d43b49553684a011d6607322582b1";
+        Long advertiserId = 23212L;
+        JSONObject requestJson = new JSONObject();
+        kuaishouInterfaceService.appUpdate(advertiserId, accessToken, requestJson, multipartFile, request);
+
+    }
 }

+ 11 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaishouInterfaceService.java

@@ -164,7 +164,7 @@ public interface IKuaishouInterfaceService {
      * @param multipartFile
      * @param request
      */
-    void appCreate(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request);
+    void appCreate(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request, JSONObject requestJson);
 
 
     /**
@@ -186,4 +186,14 @@ public interface IKuaishouInterfaceService {
     String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap, String filePath);
 
 
+    /**
+     * 修改应用
+     *
+     * @param advertiserId
+     * @param accessToken
+     * @param requestJson
+     * @param multipartFile
+     * @param request
+     */
+    void appUpdate(Long advertiserId, String accessToken, JSONObject requestJson, MultipartFile multipartFile, HttpServletRequest request);
 }

+ 24 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaishouInterfaceServiceImpl.java

@@ -22,20 +22,24 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.FileSystemResource;
-import org.springframework.http.*;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
 
 @Service
 public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
@@ -1218,7 +1222,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private KuaiShouAppCreateMapper appCreateMapper;
 
     @Override
-    public void appCreate(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request) {
+    public void appCreate(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request, JSONObject requestJson) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
             String savaPath = "D:\\tets1\\app";
@@ -1227,13 +1231,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             entity = fileUploadTool.createFile(multipartFile, request, savaPath);
             if (!Check.isNull(entity)) {
                 String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_CREATE;
-                JSONObject requestJson = new JSONObject();
-                requestJson.put("app_version", "2.3.6");
-                requestJson.put("app_name", "微信开发1");
-                requestJson.put("image_token", "market81dd2187353e4cb19918b61276797ce5.jpg");
-                requestJson.put("advertiser_id", advertiserId);
-                requestJson.put("package_name", "2");
-                requestJson.put("platform", 1);
                 Map<String, String> header = new HashMap<String, String>();
                 header.put("Content-Type", "multipart/form-data");
                 header.put("Access-Token", accessToken);
@@ -1340,6 +1337,21 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
+    /**
+     * 修改应用
+     *
+     * @param advertiserId
+     * @param accessToken
+     * @param requestJson
+     * @param multipartFile
+     * @param request
+     */
+    @Override
+    public void appUpdate(Long advertiserId, String accessToken, JSONObject requestJson, MultipartFile multipartFile, HttpServletRequest request) {
+        //TODO
+    }
+
+
     public Object jsonToObj(Object t, String jsonStr) throws
             JsonParseException, JsonMappingException, IOException {
         ObjectMapper mapper = new ObjectMapper();
@@ -1378,21 +1390,16 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             FileSystemResource resource = new FileSystemResource(new File(filePath));
             MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
             param.add("file", resource);
-
-
             if (!Check.isNullMap(paramMap)) {
                 for (String key : paramMap.keySet()) {
                     param.add(key, paramMap.get(key));
                 }
-
-
                 HttpHeaders headers = new HttpHeaders();
                 if (!Check.isNullMap(headerMap)) {
                     for (String key : headerMap.keySet()) {
-                        headers.add(key, (String) headerMap.get(key));
+                        headers.add(key, headerMap.get(key));
                     }
                 }
-
                 HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<MultiValueMap<String, Object>>(param, headers);
                 ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
                 System.err.println(responseEntity.getBody());

+ 3 - 3
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -90,9 +90,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: root
-          password:
+          url: jdbc:mysql://192.168.0.23:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: 123456
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:

+ 3 - 3
jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties

@@ -1,8 +1,8 @@
 #mysql 
 diver_name=com.mysql.jdbc.Driver
-url=jdbc:mysql://localhost:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8
-username=root
-password=root
+url=jdbc:mysql://192.168.0.23:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8
+username=hcst
+password=123456
 database_name=jeecg-boot
 #oracle
 #diver_name=oracle.jdbc.driver.OracleDriver

+ 0 - 26
module-common/src/main/java/cn/com/ctop/common/utils/FileUploadTool.java

@@ -228,32 +228,6 @@ public class FileUploadTool {
         }
         return size;
     }
-
-
-/*
-    public static void exceptInfoForRestTemplate() throws ParseException {
-
-        String url = "https://ad.e.kuaishou.com/rest/openapi/v1/file/ad/video/upload";
-        String filePath = "D:\\tets1\\123412.mp4";
-
-        RestTemplate rest = new RestTemplate();
-        FileSystemResource resource = new FileSystemResource(new File(filePath));
-        MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
-        param.add("file", resource);
-        param.add("advertiser_id", 23212L);
-        org.springframework.http.HttpHeaders headers = new org.springframework.http.HttpHeaders();
-        headers.set("Access-Token", "b0c6767b052fc1d882ba62753e8b93d2");
-        headers.set("Content-Type", "multipart/form-data");
-
-
-
-
-
-
-        String string = rest.postForObject(url, new HttpEntity<String>(headers) ,param, String.class);
-        System.out.println(string);
-    }*/
-
 }