Browse Source

Merge remote-tracking branch 'origin/master'

xuzuoyun 5 years ago
parent
commit
dba9c4010f

+ 1 - 1
.gitignore

@@ -32,4 +32,4 @@ gen
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 hs_err_pid*
 **/target/
-application.yml
+#application.yml

+ 36 - 1
jeecg-boot-module-system/pom.xml

@@ -78,6 +78,14 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <configuration>
+                    <delimiters>@</delimiters>
+                    <useDefaultDelimiters>false</useDefaultDelimiters>
+                </configuration>
+            </plugin>
         </plugins>
         <resources>
             <!-- 解决MyBatis配置文件引入问题 -->
@@ -88,11 +96,38 @@
                     <include>**/*.xml</include>
                 </includes>
                 <!-- 是否替换资源中的属性-->
-                <filtering>false</filtering>
+                <filtering>true</filtering>
             </resource>
             <resource>
                 <directory>src/main/resources</directory>
+                <filtering>true</filtering>
             </resource>
         </resources>
     </build>
+
+    <profiles>
+        <profile>
+            <id>dev</id>
+            <properties>
+                <!-- 环境标识,需要与配置文件的名称相对应 -->
+                <activatedProperties>dev</activatedProperties>
+            </properties>
+            <activation>
+                <!-- 默认环境 -->
+                <activeByDefault>true</activeByDefault>
+            </activation>
+        </profile>
+        <profile>
+            <id>test</id>
+            <properties>
+                <activatedProperties>test</activatedProperties>
+            </properties>
+        </profile>
+        <profile>
+            <id>prod</id>
+            <properties>
+                <activatedProperties>prod</activatedProperties>
+            </properties>
+        </profile>
+    </profiles>
 </project>

+ 0 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -1,23 +1,12 @@
 package org.jeecg.modules.ctop.controller;
 
 import com.alibaba.fastjson.JSONObject;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.xssf.usermodel.XSSFCell;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-
 @RestController
 @RequestMapping("/test")
 public class TestController {

+ 5 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java

@@ -27,6 +27,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
 
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
+
     @Override
     public Map<String, Object> createInternal(JSONObject requestJson) {
         String url = "https://ad.oceanengine.com/pages/login/index.html";
@@ -58,7 +59,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
             header.put("Content-Type", "application/x-www-form-urlencoded");
             header.put("Origin", "https://ad.oceanengine.com");
             header.put("Referer", "https://ad.oceanengine.com/pages/login/index.html");
-            Map<String, Object> param = new HashMap<String, Object>();
+            Map<String, Object> param = new HashMap<>();
             param.put("mobile", "");
             param.put("code", "");
             param.put("account", "dcd_ad@bytedance.com");
@@ -67,6 +68,8 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
             param.put("is_30_days_no_login", "true");
             param.put("service", "https://ad.oceanengine.com");
             String res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
+            System.out.println("res:" + new String(res.getBytes("GBK"), "UTF8"));
+
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             JsonNode jsonNode = mapper.readTree(res);
@@ -88,7 +91,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 param.put("captcha", resp.pred_resl);
                 orderId = resp.req_id;
                 res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-                System.out.println(res);
+                System.out.println("res:" + res);
                 jsonNode = mapper.readTree(res);
                 errorCode = jsonNode.get("error_code").asInt();
             }

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

@@ -141,3 +141,4 @@ jeecg:
     video-upload: D://upFiles//video//
     image-upload: D://upFiles//image//
     chrome-driver: D://chromedriver.exe
+    csv-upload: D://upFiles//csv//

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

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: dev
+    active: @activatedProperties@
 swagger:
   production: false
   basic:

+ 11 - 0
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -8,6 +8,7 @@ import java.util.Map;
 import javax.annotation.Resource;
 
 import cn.com.ctop.common.utils.OSSUtils;
+import com.alibaba.fastjson.JSONObject;
 import org.apache.ibatis.annotations.Param;
 import org.apache.poi.hssf.usermodel.HSSFDataFormat;
 import org.apache.poi.ss.usermodel.Cell;
@@ -20,6 +21,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.util.ResultMapUtils;
 import org.jeecg.common.util.StatusCode;
 import org.jeecg.modules.ctop.mapper.PlatformCampaignStatisticInfoMapper;
+import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.jeecg.modules.ctop.service.IReportService;
 import org.jeecg.modules.ctop.vo.StatisticCampaignVo;
 import org.jeecg.modules.demo.mock.MockController;
@@ -391,5 +393,14 @@ public class SampleTest {
 
     @Autowired
     private PlatformCampaignStatisticInfoMapper statisticInfoMapper;
+    @Autowired
+    private ICreateInternalService createInternalService;
+
+    @Test
+    public void testNg() {
+        JSONObject json = new JSONObject();
+        System.err.println(json);
+        createInternalService.createInternal(json);
+    }
 
 }

+ 2 - 2
module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils.java

@@ -149,8 +149,8 @@ public class HttpUtils {
             // 第一步:通过setEntity 将我们的entity对象传递过去
             httppost.setEntity(formEntity);
 
-            //httppost.setHeader("Content-Type", "application/json");
-//            httppost.setEntity(new StringEntity(new Gson().toJson(param), Charset.forName("UTF-8")));
+//            httppost.setHeader("Content-Type", "application/json");
+            httppost.setEntity(new StringEntity(new Gson().toJson(param), Charset.forName("UTF-8")));
             HttpEntity respentity;
 
             HttpResponse response = httpClient.execute(httppost);

+ 8 - 0
pom.xml

@@ -397,6 +397,14 @@
                     <skipTests>true</skipTests>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <configuration>
+                    <delimiters>@</delimiters>
+                    <useDefaultDelimiters>false</useDefaultDelimiters>
+                </configuration>
+            </plugin>
             <!-- 避免font文件的二进制文件格式压缩破坏 -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>