Explorar el Código

Merge remote-tracking branch 'origin/master'

xuzuoyun hace 5 años
padre
commit
e45a1dc459
Se han modificado 31 ficheros con 993 adiciones y 795 borrados
  1. 11 12
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
  2. 2 31
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthController.java
  3. 28 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java
  4. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCampaign.java
  5. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceAdvertisePlanTemplate.java
  6. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/CTopOauthToken.java
  7. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAdvertiserCrawlerJob.java
  8. 23 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/RefreshTokenJob.java
  9. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CTopOauthTokenMapper.java
  10. 73 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CTopOauthTokenMapper.xml
  11. 8 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICTopOauthTokenService.java
  12. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IRefreshTokenService.java
  13. 1 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountServiceImpl.java
  14. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertisePlanServiceImpl.java
  15. 291 292
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  16. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceCreativeServiceImpl.java
  17. 28 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceAdvertisePlanTemplateServiceImpl.java
  18. 115 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CTopOauthTokenServiceImpl.java
  19. 46 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/RefreshTokenServiceImpl.java
  20. 264 276
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/test/controller/JeecgDemoController.java
  21. 14 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouController.java
  22. 0 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaishouInterfaceService.java
  23. 0 43
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaishouInterfaceServiceImpl.java
  24. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/handle/impl/SmsSendMsgHandle.java
  25. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/handle/impl/WxSendMsgHandle.java
  26. 3 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/job/SendMsgJob.java
  27. 3 3
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  28. 6 29
      module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils.java
  29. 0 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FateadmHttpUtil.java
  30. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java
  31. 55 55
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

+ 11 - 12
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java

@@ -18,9 +18,10 @@ public class AesEncryptUtil {
 
     /**
      * 加密方法
-     * @param data  要加密的数据
-     * @param key 加密key
-     * @param iv 加密iv
+     *
+     * @param data 要加密的数据
+     * @param key  加密key
+     * @param iv   加密iv
      * @return 加密的结果
      * @throws Exception
      */
@@ -55,9 +56,10 @@ public class AesEncryptUtil {
 
     /**
      * 解密方法
+     *
      * @param data 要解密的数据
      * @param key  解密key
-     * @param iv 解密iv
+     * @param iv   解密iv
      * @return 解密的结果
      * @throws Exception
      */
@@ -82,6 +84,7 @@ public class AesEncryptUtil {
 
     /**
      * 使用默认的key和iv加密
+     *
      * @param data
      * @return
      * @throws Exception
@@ -92,6 +95,7 @@ public class AesEncryptUtil {
 
     /**
      * 使用默认的key和iv解密
+     *
      * @param data
      * @return
      * @throws Exception
@@ -101,24 +105,19 @@ public class AesEncryptUtil {
     }
 
 
-
     /**
      * 测试
      */
     public static void main(String args[]) throws Exception {
 
         String test1 = "sa";
-        String test =new String(test1.getBytes(),"UTF-8");
+        String test = new String(test1.getBytes(), "UTF-8");
         String data = null;
-        String key =  KEY;
+        String key = KEY;
         String iv = IV;
         // /g2wzfqvMOeazgtsUVbq1kmJawROa6mcRAzwG1/GeJ4=
         data = encrypt(test, key, iv);
-        System.out.println("数据:"+test);
-        System.out.println("加密:"+data);
-        String jiemi =desEncrypt(data, key, iv).trim();
-        System.out.println("解密:"+jiemi);
-
+        String jiemi = desEncrypt(data, key, iv).trim();
 
     }
 }

+ 2 - 31
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthController.java

@@ -83,36 +83,7 @@ public class AuthController {
     @GetMapping("bytedance/refreshtoken")
     @ResponseBody
     public Map<String, Object> refreshToken(String accountId) {
-        Map<String, Object> resultMap = new HashMap<>();
-        CTopOauthToken token = tokenService.getOAuthTokenByAccountId(accountId);
-        if (null == token) {
-            resultMap.put("message", "token信息不存在");
-            resultMap.put("code", -1);
-            return resultMap;
-        }
-        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.REFRESH_TOKEN;
-        Map<String, Object> param = new HashMap<String, Object>();
-        param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
-        param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
-        param.put("grant_type", "refresh_token");
-        param.put("refresh_token", token.getRefreshToken());
-
-        String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
-        JSONObject resultObject = JSONObject.parseObject(result);
-        Integer code = resultObject.getInteger("status");
-        if (null == code || code != 0) {
-            logger.info("刷新token异常;accountId:{}", accountId);
-            resultMap.put("message", "刷新token异常");
-            resultMap.put("code", -1);
-            return resultMap;
-        }
-        JSONObject data = resultObject.getJSONObject("data");
-        CTopOauthToken refreshToken = new CTopOauthToken(token, data);
-        cTopOauthTokenMapper.deleteById(token.getId());
-        cTopOauthTokenMapper.insert(refreshToken);
-        resultMap.put("message", "token刷新成功");
-        resultMap.put("code", 0);
-        return resultMap;
+        return null;
     }
 
     @Autowired
@@ -145,7 +116,7 @@ public class AuthController {
                 cTopOauthTokenMapper.insert(token);
                 bindAccountService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.TYPE_AUTHORIZATION, state, KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE); //账号绑定
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return result;

+ 28 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java

@@ -9,7 +9,6 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.ctop.entity.*;
 import org.jeecg.modules.ctop.service.*;
-import org.jeecg.modules.system.entity.SysDictItem;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -33,7 +32,7 @@ public class ByteDanceTemplateController {
 
     /**
      * 广告组模板
-     *
+     * 完成
      * @param template
      * @param req
      * @return
@@ -68,7 +67,7 @@ public class ByteDanceTemplateController {
     }
 
     /**
-     * 用户定向
+     * 广告计划模板
      *
      * @param template
      * @param req
@@ -80,7 +79,7 @@ public class ByteDanceTemplateController {
     }
 
     /**
-     * 预算与出价模板
+     * 用户定向模板列表
      *
      * @param template
      * @param req
@@ -114,6 +113,31 @@ public class ByteDanceTemplateController {
     }
 
     /**
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     * @功能:获取广告组列表信息
+     */
+    @PostMapping(value = "campaign/data/list")
+    public Result<IPage<ByteDanceCampaign>> audiencePageList(ByteDanceCampaign campaign, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                             @RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest req) {
+        Result<IPage<ByteDanceCampaign>> result = new Result<>();
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        campaign.setAdvertiserId(user.getId());
+        QueryWrapper<ByteDanceCampaign> queryWrapper = QueryGenerator.initQueryWrapper(campaign, req.getParameterMap());
+        queryWrapper.eq("advertiser_id", campaign.getAdvertiserId()).orderByAsc("id");
+        Page<ByteDanceCampaign> page = new Page<>(pageNo, pageSize);
+        IPage<ByteDanceCampaign> pageList = campaignService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    @Autowired
+    private IByteDanceCampaignService campaignService;
+
+    /**
      * 投放目标
      *
      * @param template

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCampaign.java

@@ -177,5 +177,6 @@ public class ByteDanceCampaign {
 		this.budget = new BigDecimal(template.getBudgetDaily());
 		this.landingType = template.getPromotionPurpuse();
 		this.toutiaoId = token.getAccountId();
+		this.templateId = template.getId();
 	}
 }

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceAdvertisePlanTemplate.java

@@ -86,6 +86,13 @@ public class BytedanceAdvertisePlanTemplate {
     private Integer status;
 
     /**
+     * 模板名称
+     */
+    @Excel(name = "模板名称", width = 15)
+    @ApiModelProperty(value = "模板名称")
+    private String name;
+
+    /**
      * createTime
      */
     @ApiModelProperty(value = "createTime")

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/CTopOauthToken.java

@@ -119,7 +119,7 @@ public class CTopOauthToken {
 
     public CTopOauthToken(CTopOauthToken token, JSONObject data) {
         this.advertiserId = token.getAdvertiserId();
-        this.mediaId = "toutiao";
+        this.mediaId = "1";
         this.accountId = token.getAccountId();
         String accessToken = data.getString("access_token");
         Integer refreshTokenExpiresIn = data.getInteger("refresh_token_expires_in");

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAdvertiserCrawlerJob.java

@@ -22,7 +22,6 @@ public class KuaishouAdvertiserCrawlerJob implements Job {
             List<KuaishouAdAccount> list = KuaishouAdAccountService.querySyncAccount();
             if (list != null){
                 for(KuaishouAdAccount account : list){
-                    System.out.println("正在获取video信息:"+account.getName());
                     kuaishouAppService.adAccountFetch(account,"");
                 }
             }

+ 23 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/RefreshTokenJob.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.ctop.job;
+
+import org.jeecg.modules.ctop.service.IRefreshTokenService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class RefreshTokenJob implements Job {
+    @Autowired
+    private IRefreshTokenService refreshTokenService;
+
+    /**
+     * 刷新token
+     *
+     * @param jobExecutionContext
+     * @throws JobExecutionException
+     */
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) {
+        refreshTokenService.getRefresh();
+    }
+}

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CTopOauthTokenMapper.java

@@ -3,6 +3,8 @@ package org.jeecg.modules.ctop.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
 
+import java.util.List;
+
 /**
  * @Description: oauth授权码
  * @Author: jeecg-boot
@@ -10,4 +12,9 @@ import org.jeecg.modules.ctop.entity.CTopOauthToken;
  * @Version: V1.0
  */
 public interface CTopOauthTokenMapper extends BaseMapper<CTopOauthToken> {
+    List<CTopOauthToken> selectAll();
+
+    int updateByPrimaryKeySelective(CTopOauthToken oauthToken);
+
+    CTopOauthToken selectByAccountId(Long accountId);
 }

+ 73 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CTopOauthTokenMapper.xml

@@ -1,4 +1,77 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper">
+
+    <resultMap id="BaseResultMap" type="org.jeecg.modules.ctop.entity.CTopOauthToken">
+        <result column="id" property="id" jdbcType="BIGINT"/>
+        <result column="media_id" property="mediaId" jdbcType="VARCHAR"/>
+        <result column="advertiser_id" property="advertiserId" jdbcType="VARCHAR"/>
+        <result column="account_id" property="accountId" jdbcType="BIGINT"/>
+        <result column="access_token" property="accessToken" jdbcType="VARCHAR"/>
+        <result column="refresh_token" property="refreshToken" jdbcType="VARCHAR"/>
+        <result column="access_token_expires_in" property="accessTokenExpiresIn" jdbcType="TIMESTAMP"/>
+        <result column="refresh_token_expires_in" property="refreshTokenExpiresIn" jdbcType="TIMESTAMP"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,media_id,advertiser_id,account_id,access_token,refresh_token,access_token_expires_in,refresh_token_expires_in,create_time,update_time
+   </sql>
+
+    <select id="selectAll" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from ctop_oauth_token
+    </select>
+
+
+    <update id="updateByPrimaryKeySelective" parameterType="org.jeecg.modules.ctop.entity.CTopOauthToken">
+        update ctop_oauth_token
+        <set>
+
+            <if test="mediaId != null">
+                media_id = #{mediaId},
+            </if>
+
+            <if test="advertiserId != null">
+                advertiser_id = #{advertiserId},
+            </if>
+
+            <if test="accessToken != null">
+                access_token = #{accessToken},
+            </if>
+
+            <if test="accessTokenExpiresIn != null">
+                access_token_expires_in = #{accessTokenExpiresIn},
+            </if>
+
+            <if test="refreshToken != null">
+                refresh_token = #{refreshToken,jdbcType=VARCHAR},
+            </if>
+
+            <if test="refreshTokenExpiresIn != null">
+                refresh_token_expires_in = #{refreshTokenExpiresIn},
+            </if>
+
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+
+            <if test="updateTime != null">
+                update_time = #{updateTime},
+            </if>
+        </set>
+        where account_id = #{accountId}
+    </update>
+
+    <select id="selectByAccountId" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from ctop_oauth_token
+        where account_id = #{accountId}
+        order by create_time desc
+        limit 1
+    </select>
+
 </mapper>

+ 8 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICTopOauthTokenService.java

@@ -1,15 +1,21 @@
 package org.jeecg.modules.ctop.service;
 
-import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.CTopOauthToken;
+
+import java.util.Map;
 
 /**
  * @Description: oauth授权码
  * @Author: jeecg-boot
- * @Date:   2019-07-09
+ * @Date: 2019-07-09
  * @Version: V1.0
  */
 public interface ICTopOauthTokenService extends IService<CTopOauthToken> {
 
     CTopOauthToken getOAuthTokenByAccountId(String accountId);
+
+    Map<String, Object> getByteDanceAccessToken(String accountId);
+
+    Map<String, Object> getKuaiShouRefreshToken(Long accountId, String refreshToken);
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IRefreshTokenService.java

@@ -0,0 +1,5 @@
+package org.jeecg.modules.ctop.service;
+
+public interface IRefreshTokenService {
+    void getRefresh();
+}

+ 1 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountServiceImpl.java

@@ -29,7 +29,6 @@ import java.util.Map;
 public class BindAccountServiceImpl extends ServiceImpl<BindAccountMapper, BindAccount> implements IBindAccountService {
     private static final Logger logger = LoggerFactory.getLogger(BindAccountServiceImpl.class);
 
-
     @Autowired
     BindAccountMapper bindAccountMapper;
 
@@ -67,13 +66,6 @@ public class BindAccountServiceImpl extends ServiceImpl<BindAccountMapper, BindA
      */
     @Override
     public String bindAuthorization(String advertiserId, String authorizationType) throws UnsupportedEncodingException {
-        BindAccount bindAccount = new BindAccount();
-        bindAccount.setAdvertiserId(advertiserId);
-
-        bindAccount.setType("login");
-        bindAccount.setType("authorization");
-        bindAccount.setLoginType(authorizationType);
-
         String codeUrl = "";
         if ("kuaishou".equals(authorizationType)) {
             codeUrl = getKuaishouCodeUrl(advertiserId);
@@ -81,7 +73,7 @@ public class BindAccountServiceImpl extends ServiceImpl<BindAccountMapper, BindA
         if ("toutiao".equals(authorizationType)) {
             codeUrl = getByteDanceCodeUrl(advertiserId);
         }
-        bindAccountMapper.insert(bindAccount);
+
         return codeUrl;
     }
 

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

@@ -57,8 +57,6 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         }
         JSONObject dataObject = result.getJSONObject("data");
         Long adId = dataObject.getLong("ad_id");
-        System.out.println(adId);
-        System.out.println(dataObject.toJSONString());
         ByteDanceAdvertisePlan plan = new ByteDanceAdvertisePlan(dataObject, accountId, adId, data);
         planMapper.insert(plan);
         resultMap.put("code", 0);

+ 291 - 292
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -38,7 +38,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     @Autowired
     private CTopOauthTokenMapper cTopOauthTokenMapper;
 
-    private CTopOauthToken getOAuthTokenByAccountId(String accountId){
+    private CTopOauthToken getOAuthTokenByAccountId(String accountId) {
         QueryWrapper<CTopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("advertiser_id", accountId).orderByDesc("create_time");
         CTopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
@@ -47,29 +47,29 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
 
     @Override
     public Map<String, Object> getAdvertiserInfo(String accountId) {
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_advertiser_info");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
-        TreeMap<String,Object>params = new TreeMap<>();
-        params.put("advertiser_ids","["+cTopOauthToken.getAccountId()+"]");
-        String result = HttpUtils.httpGetRequest(url,headers,params);
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_advertiser_info");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
+        TreeMap<String, Object> params = new TreeMap<>();
+        params.put("advertiser_ids", "[" + cTopOauthToken.getAccountId() + "]");
+        String result = HttpUtils.httpGetRequest(url, headers, params);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("获取广告主信息接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","获取广告主信息接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("获取广告主信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "获取广告主信息接口异常");
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONArray("data");
-        if(null==data||data.size()<=0){
-            resultMap.put("code",0);
-            resultMap.put("message","广告主信息不存在");
+        if (null == data || data.size() <= 0) {
+            resultMap.put("code", 0);
+            resultMap.put("message", "广告主信息不存在");
             return resultMap;
         }
         for (int i = 0; i < data.size(); i++) {
@@ -79,46 +79,46 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             advertiserMapper.deleteById(advertiser.getId());
             advertiserMapper.insert(advertiser);
         }
-        resultMap.put("code",0);
-        resultMap.put("message","获取广告主信息成功");
+        resultMap.put("code", 0);
+        resultMap.put("message", "获取广告主信息成功");
         return resultMap;
     }
 
     private void getAdvertiserPlanByPageNumber(String accountId, Integer pageNumber, String ids) {
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_ad_get");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
-
-        TreeMap<String,Object>params = new TreeMap<>();
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("page",pageNumber+"");
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_get");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
+
+        TreeMap<String, Object> params = new TreeMap<>();
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("page", pageNumber + "");
         JSONObject filtering = new JSONObject();
-        if(null!=ids&&!"".equals(ids.trim())){
+        if (null != ids && !"".equals(ids.trim())) {
             String[] idsArray = ids.split(",");
             JSONArray filterIdsArray = new JSONArray();
             for (int i = 0; i < idsArray.length; i++) {
                 Long id = Long.parseLong(idsArray[i]);
                 filterIdsArray.add(id);
             }
-            filtering.put("ids",filterIdsArray);
+            filtering.put("ids", filterIdsArray);
         }
-        params.put("filtering",filtering.toJSONString());
+        params.put("filtering", filtering.toJSONString());
 
-        String result = HttpUtils.httpGetRequest(url,headers,params);
+        String result = HttpUtils.httpGetRequest(url, headers, params);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("获取广告主广告计划信息接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            return ;
+        if (null == code || !code.equals(0)) {
+            logger.info("获取广告主广告计划信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            return;
         }
         JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
-        if(null==data||data.size()<=0){
-            logger.info("获取广告主广告计划信息不存在==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            return ;
+        if (null == data || data.size() <= 0) {
+            logger.info("获取广告主广告计划信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            return;
         }
         for (int i = 0; i < data.size(); i++) {
             JSONObject dataObject = data.getJSONObject(i);
@@ -127,7 +127,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             advertisePlanMapper.deleteById(advertisePlan.getId());
             advertisePlanMapper.insert(advertisePlan);
         }
-        getAdvertiserPlanByPageNumber(accountId,pageNumber+1,ids);
+        getAdvertiserPlanByPageNumber(accountId, pageNumber + 1, ids);
     }
 
     @Autowired
@@ -135,49 +135,49 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
 
     @Override
     public Map<String, Object> getAdvertiserPlan(String accountId, String ids) {
-        getAdvertiserPlanByPageNumber(accountId,1,ids);
-        Map<String,Object>resultMap = new HashMap<>();
-        resultMap.put("code",0);
-        resultMap.put("message","获取广告计划信息成功");
+        getAdvertiserPlanByPageNumber(accountId, 1, ids);
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("code", 0);
+        resultMap.put("message", "获取广告计划信息成功");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> getAdvertiserCampaign(String accountId, String ids) {
-        getAdvertiserCampaignByPageNumber(accountId,1,ids);
-        Map<String,Object>resultMap = new HashMap<>();
-        resultMap.put("code",0);
-        resultMap.put("message","获取广告組信息成功");
+        getAdvertiserCampaignByPageNumber(accountId, 1, ids);
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("code", 0);
+        resultMap.put("message", "获取广告組信息成功");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> getAdvertiserBudget(String accountId) {
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_campaign_get");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
-
-        TreeMap<String,Object>params = new TreeMap<>();
-        params.put("advertiser_ids","["+cTopOauthToken.getAccountId()+"]");
-        String result = HttpUtils.httpGetRequest(url,headers,params);
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
+
+        TreeMap<String, Object> params = new TreeMap<>();
+        params.put("advertiser_ids", "[" + cTopOauthToken.getAccountId() + "]");
+        String result = HttpUtils.httpGetRequest(url, headers, params);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("获取广告预算信息接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","获取广告预算信息接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("获取广告预算信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "获取广告预算信息接口异常");
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONArray("data");
-        if(null==data||data.size()<=0){
-            logger.info("广告主预算信息不存在==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",0);
-            resultMap.put("message","获取广告主预算信息完成");
+        if (null == data || data.size() <= 0) {
+            logger.info("广告主预算信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", 0);
+            resultMap.put("message", "获取广告主预算信息完成");
             return resultMap;
         }
         for (int i = 0; i < data.size(); i++) {
@@ -187,48 +187,48 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             advertiserBudgetMapper.deleteById(advertiserBudget.getId());
             advertiserBudgetMapper.insert(advertiserBudget);
         }
-        resultMap.put("code",0);
-        resultMap.put("message","获取广告预算信息完成");
+        resultMap.put("code", 0);
+        resultMap.put("message", "获取广告预算信息完成");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> getAdvertiserCreative(String accountId, String ids) {
-        Map<String,Object>resultMap = new HashMap<>();
-        getAdvertiserCreativeByPageNumber(accountId,1,ids);
-        resultMap.put("code",0);
-        resultMap.put("message","获取广告主广告创意信息完成");
+        Map<String, Object> resultMap = new HashMap<>();
+        getAdvertiserCreativeByPageNumber(accountId, 1, ids);
+        resultMap.put("code", 0);
+        resultMap.put("message", "获取广告主广告创意信息完成");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> getAdvertiserCreativeMaterial(String accountId, String creativeIds) {
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_creative_material_get");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
-
-        TreeMap<String,Object>params = new TreeMap<>();
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("creative_ids","["+creativeIds+"]");
-        String result = HttpUtils.httpGetRequest(url,headers,params);
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_material_get");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
+
+        TreeMap<String, Object> params = new TreeMap<>();
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("creative_ids", "[" + creativeIds + "]");
+        String result = HttpUtils.httpGetRequest(url, headers, params);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("获取广告主创意素材信息接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","获取广告主创意素材信息接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("获取广告主创意素材信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "获取广告主创意素材信息接口异常");
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONArray("data");
-        if(null==data||data.size()<=0){
-            logger.info("广告主创意素材信息不存在==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",0);
-            resultMap.put("message","获取广告主预算信息完成");
+        if (null == data || data.size() <= 0) {
+            logger.info("广告主创意素材信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", 0);
+            resultMap.put("message", "获取广告主预算信息完成");
             return resultMap;
         }
         for (int i = 0; i < data.size(); i++) {
@@ -238,44 +238,44 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             creativeMaterialMapper.deleteById(material.getId());
             creativeMaterialMapper.insert(material);
         }
-        resultMap.put("code",0);
-        resultMap.put("message","获取广告主预算信息完成");
+        resultMap.put("code", 0);
+        resultMap.put("message", "获取广告主预算信息完成");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> advertiserCampaignCreate(String accountId, String campaignName, String budgetMode, Integer budget, String landingType) {
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         CTopOauthToken token = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         JSONObject params = new JSONObject();
         params.put("advertiser_id", token.getAccountId());
-        params.put("campaign_name",campaignName);
-        params.put("budget_mode",budgetMode);
-        params.put("budget",budget);
-        params.put("landing_type",landingType);
+        params.put("campaign_name", campaignName);
+        params.put("budget_mode", budgetMode);
+        params.put("budget", budget);
+        params.put("landing_type", landingType);
         JSONObject result = createCampaign(params, token.getAccessToken());
         Integer code = result.getInteger("code");
 
-        if(null==code||!code.equals(0)){
+        if (null == code || !code.equals(0)) {
             logger.info("创建广告组接口异常==》accountId:{},message:{}", accountId, result.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","创建广告组接口异常");
+            resultMap.put("code", -1);
+            resultMap.put("message", "创建广告组接口异常");
             return resultMap;
         }
         JSONObject data = result.getJSONObject("data");
-        if(null==data){
+        if (null == data) {
             logger.info("广告组创建异常==》accountId:{},message:{}", accountId, result.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","广告组创建异常");
+            resultMap.put("code", -1);
+            resultMap.put("message", "广告组创建异常");
             return resultMap;
         }
-        Long id =  data.getLong("campaign_id");
+        Long id = data.getLong("campaign_id");
         ByteDanceCampaign campaign = new ByteDanceCampaign(id, token, campaignName, budgetMode, budget, landingType);
         //清除清数据,插入新数据
         campaignMapper.insert(campaign);
-        resultMap.put("code",0);
-        resultMap.put("message","广告组创建成功");
+        resultMap.put("code", 0);
+        resultMap.put("message", "广告组创建成功");
         return resultMap;
     }
 
@@ -326,317 +326,317 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
 
     @Override
     public Map<String, Object> advertiserCampaignUpdateStatus(String accountId, String campaignIds, String optStatus) {
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         JSONArray ids = new JSONArray();
-        String [] getIds = campaignIds.split(",");
-        if(null!=getIds&&getIds.length>0){
+        String[] getIds = campaignIds.split(",");
+        if (null != getIds && getIds.length > 0) {
             for (int i = 0; i < getIds.length; i++) {
                 ids.add(Long.parseLong(getIds[i]));
             }
         }
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_campaign_update_status");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update_status");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
         JSONObject params = new JSONObject();
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("campaign_ids",ids);
-        params.put("opt_status",optStatus);
-        String result = HttpUtils.httpPostRequest(url,params,headers);
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("campaign_ids", ids);
+        params.put("opt_status", optStatus);
+        String result = HttpUtils.httpPostRequest(url, params, headers);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("广告组更新状态接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","广告组更新状态接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("广告组更新状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "广告组更新状态接口异常");
             return resultMap;
         }
         JSONObject data = jsonObject.getJSONObject("data");
-        if(null==data){
-            logger.info("广告组更新状态异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","广告组更新状态异常");
+        if (null == data) {
+            logger.info("广告组更新状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "广告组更新状态异常");
             return resultMap;
         }
-        JSONArray getCampaignIds =  data.getJSONArray("campaign_ids");
-        if(null!=getCampaignIds&&getCampaignIds.size()>0){
+        JSONArray getCampaignIds = data.getJSONArray("campaign_ids");
+        if (null != getCampaignIds && getCampaignIds.size() > 0) {
             for (int i = 0; i < getCampaignIds.size(); i++) {
                 Long id = getCampaignIds.getLong(i);
                 ByteDanceCampaign campaign = campaignMapper.selectById(id);
-                if(null!=campaign){
+                if (null != campaign) {
                     campaign.setOptStatus(optStatus);
                 }
                 campaignMapper.updateById(campaign);
             }
         }
-        resultMap.put("code",0);
-        resultMap.put("message","广告组状态修改成功");
+        resultMap.put("code", 0);
+        resultMap.put("message", "广告组状态修改成功");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> advertiserCampaignUpdate(String accountId, Long campaignId, String budgetMode, Integer budget, String campaignName) {
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         ByteDanceCampaign campaign = campaignMapper.selectById(campaignId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_campaign_update");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
         JSONObject params = new JSONObject();
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("campaign_id",campaignId);
-        params.put("modify_time",campaign.getModifyTime());
-        params.put("campaign_id",campaignId);
-        if(null!=campaignName&&!"".equals(campaignName.trim())){
-            params.put("campaign_name",campaignName);
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("campaign_id", campaignId);
+        params.put("modify_time", campaign.getModifyTime());
+        params.put("campaign_id", campaignId);
+        if (null != campaignName && !"".equals(campaignName.trim())) {
+            params.put("campaign_name", campaignName);
         }
-        if(null!=budgetMode&&!"".equals(budgetMode.trim())){
-            params.put("budget_mode",budgetMode);
+        if (null != budgetMode && !"".equals(budgetMode.trim())) {
+            params.put("budget_mode", budgetMode);
         }
-        if(null!=budget){
-            params.put("budget",budget);
+        if (null != budget) {
+            params.put("budget", budget);
         }
-        String result = HttpUtils.httpPostRequest(url,params,headers);
+        String result = HttpUtils.httpPostRequest(url, params, headers);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("广告组更新接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","广告组更新接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("广告组更新接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "广告组更新接口异常");
             return resultMap;
         }
         JSONObject data = jsonObject.getJSONObject("data");
-        if(null==data){
-            logger.info("广告组更新异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","广告组更新异常");
+        if (null == data) {
+            logger.info("广告组更新异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "广告组更新异常");
             return resultMap;
         }
-        if(null!=campaignName&&!"".equals(campaignName.trim())){
+        if (null != campaignName && !"".equals(campaignName.trim())) {
             campaign.setName(campaignName);
         }
-        if(null!=budgetMode&&!"".equals(budgetMode.trim())){
-            params.put("budget_mode",budgetMode);
+        if (null != budgetMode && !"".equals(budgetMode.trim())) {
+            params.put("budget_mode", budgetMode);
             campaign.setBudgetMode(budgetMode);
         }
-        if(null!=budget){
+        if (null != budget) {
             campaign.setBudget(new BigDecimal(budget));
         }
         campaignMapper.updateById(campaign);
 
-        resultMap.put("code",0);
-        resultMap.put("message","广告组信息修改成功");
+        resultMap.put("code", 0);
+        resultMap.put("message", "广告组信息修改成功");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> advertiserPlanUpdateStatus(String accountId, String adIds, String optStatus) {
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         JSONArray ids = new JSONArray();
-        String [] getIds = adIds.split(",");
-        if(null!=getIds&&getIds.length>0){
+        String[] getIds = adIds.split(",");
+        if (null != getIds && getIds.length > 0) {
             for (int i = 0; i < getIds.length; i++) {
                 ids.add(Long.parseLong(getIds[i]));
             }
         }
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_ad_update_status");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_status");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
         JSONObject params = new JSONObject();
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("ad_ids",ids.toJSONString());
-        params.put("opt_status",optStatus);
-        String result = HttpUtils.httpPostRequest(url,params,headers);
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("ad_ids", ids.toJSONString());
+        params.put("opt_status", optStatus);
+        String result = HttpUtils.httpPostRequest(url, params, headers);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("广告计划更新状态接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","广告计划更新状态接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("广告计划更新状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "广告计划更新状态接口异常");
             return resultMap;
         }
         JSONObject data = jsonObject.getJSONObject("data");
-        if(null==data){
-            logger.info("广告计划更新状态异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","广告计划更新状态异常");
+        if (null == data) {
+            logger.info("广告计划更新状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "广告计划更新状态异常");
             return resultMap;
         }
-        JSONArray getAdIds =  data.getJSONArray("ad_ids");
-        if(null!=getAdIds&&getAdIds.size()>0){
+        JSONArray getAdIds = data.getJSONArray("ad_ids");
+        if (null != getAdIds && getAdIds.size() > 0) {
             //获取广告计划信息
-            getAdvertiserPlan(accountId,adIds);
+            getAdvertiserPlan(accountId, adIds);
         }
-        resultMap.put("code",0);
-        resultMap.put("message","广告组状态修改成功");
+        resultMap.put("code", 0);
+        resultMap.put("message", "广告组状态修改成功");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> advertiserPlanUpdateBid(String accountId, String adIds, String bids) {
         //TODO 校验数据是否完整
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         JSONArray data = new JSONArray();
-        String [] getadIds = adIds.split(",");
-        String [] getBids = bids.split(",");
-        if(null!=getadIds&&getadIds.length>0){
+        String[] getadIds = adIds.split(",");
+        String[] getBids = bids.split(",");
+        if (null != getadIds && getadIds.length > 0) {
             for (int i = 0; i < getadIds.length; i++) {
                 JSONObject object = new JSONObject();
                 Long ad_id = Long.parseLong(getadIds[i]);
                 Long bid = Long.parseLong(getBids[i]);
-                object.put("ad_id",ad_id);
-                object.put("bid",bid);
+                object.put("ad_id", ad_id);
+                object.put("bid", bid);
                 data.add(object);
             }
         }
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_ad_update_bid");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_bid");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
         JSONObject params = new JSONObject();
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("data",data.toJSONString());
-        String result = HttpUtils.httpPostRequest(url,params,headers);
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("data", data.toJSONString());
+        String result = HttpUtils.httpPostRequest(url, params, headers);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("修改计划出价接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","修改计划出价接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("修改计划出价接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "修改计划出价接口异常");
             return resultMap;
         }
         JSONObject getData = jsonObject.getJSONObject("data");
-        if(null==getData){
-            logger.info("修改计划出价异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","修改计划出价异常");
+        if (null == getData) {
+            logger.info("修改计划出价异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "修改计划出价异常");
             return resultMap;
         }
         JSONArray getAdIds = getData.getJSONArray("ad_ids");
-        if(null!=getAdIds&&getAdIds.size()>0){
+        if (null != getAdIds && getAdIds.size() > 0) {
             //获取广告计划信息
-            getAdvertiserPlan(accountId,adIds);
+            getAdvertiserPlan(accountId, adIds);
         }
-        resultMap.put("code",0);
-        resultMap.put("message","修改计划出价成功");
+        resultMap.put("code", 0);
+        resultMap.put("message", "修改计划出价成功");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> advertiserPlanUpdateBudget(String accountId, String adIds, String budgets) {
         //TODO 校验数据是否完整
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         JSONArray data = new JSONArray();
-        String [] getadIds = adIds.split(",");
-        String [] getBudgets = budgets.split(",");
-        if(null!=getadIds&&getadIds.length>0){
+        String[] getadIds = adIds.split(",");
+        String[] getBudgets = budgets.split(",");
+        if (null != getadIds && getadIds.length > 0) {
             for (int i = 0; i < getadIds.length; i++) {
                 JSONObject object = new JSONObject();
                 Long ad_id = Long.parseLong(getadIds[i]);
                 Long budget = Long.parseLong(getBudgets[i]);
-                object.put("ad_id",ad_id);
-                object.put("budget",budget);
+                object.put("ad_id", ad_id);
+                object.put("budget", budget);
                 data.add(object);
             }
         }
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_ad_update_budget");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_budget");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
         JSONObject params = new JSONObject();
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("data",data.toJSONString());
-        String result = HttpUtils.httpPostRequest(url,params,headers);
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("data", data.toJSONString());
+        String result = HttpUtils.httpPostRequest(url, params, headers);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
-        if(null==code||!code.equals(0)){
-            logger.info("修改计划预算接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","修改计划预算接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("修改计划预算接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "修改计划预算接口异常");
             return resultMap;
         }
         JSONObject getData = jsonObject.getJSONObject("data");
-        if(null==getData){
-            logger.info("修改计划预算异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","修改计划预算异常");
+        if (null == getData) {
+            logger.info("修改计划预算异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "修改计划预算异常");
             return resultMap;
         }
         JSONArray getAdIds = getData.getJSONArray("ad_ids");
-        if(null!=getAdIds&&getAdIds.size()>0){
+        if (null != getAdIds && getAdIds.size() > 0) {
             //获取广告计划信息
-            getAdvertiserPlan(accountId,adIds);
+            getAdvertiserPlan(accountId, adIds);
         }
-        resultMap.put("code",0);
-        resultMap.put("message","修改计划预算成功");
+        resultMap.put("code", 0);
+        resultMap.put("message", "修改计划预算成功");
         return resultMap;
     }
 
     @Override
     public Map<String, Object> advertiserCreativeUpdateStatus(String accountId, String creativeIds, String optStatus) {
-        Map<String,Object>resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         JSONArray ids = new JSONArray();
-        String [] getCreativeIds = creativeIds.split(",");
-        if(null!=getCreativeIds&&getCreativeIds.length>0){
+        String[] getCreativeIds = creativeIds.split(",");
+        if (null != getCreativeIds && getCreativeIds.length > 0) {
             for (int i = 0; i < getCreativeIds.length; i++) {
                 ids.add(Long.parseLong(getCreativeIds[i]));
             }
         }
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_creative_update_status");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_update_status");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
         JSONObject params = new JSONObject();
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("creative_ids",ids.toJSONString());
-        params.put("opt_status",optStatus);
-        String result = HttpUtils.httpPostRequest(url,params,headers);
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("creative_ids", ids.toJSONString());
+        params.put("opt_status", optStatus);
+        String result = HttpUtils.httpPostRequest(url, params, headers);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("修改创意状态接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","修改创意状态接口异常");
+        if (null == code || !code.equals(0)) {
+            logger.info("修改创意状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "修改创意状态接口异常");
             return resultMap;
         }
         JSONObject data = jsonObject.getJSONObject("data");
-        if(null==data){
-            logger.info("修改创意状态异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            resultMap.put("code",-1);
-            resultMap.put("message","修改创意状态异常");
+        if (null == data) {
+            logger.info("修改创意状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("code", -1);
+            resultMap.put("message", "修改创意状态异常");
             return resultMap;
         }
-        JSONArray returnCreativeIds =  data.getJSONArray("creative_ids");
-        if(null!=returnCreativeIds&&returnCreativeIds.size()>0){
+        JSONArray returnCreativeIds = data.getJSONArray("creative_ids");
+        if (null != returnCreativeIds && returnCreativeIds.size() > 0) {
             //TODO 获取广告计划信息 需要注意这里的逻辑 有漏洞,后期修改
-            getAdvertiserCreative(accountId,creativeIds);
+            getAdvertiserCreative(accountId, creativeIds);
         }
-        resultMap.put("code",0);
-        resultMap.put("message","广告创意状态修改成功");
+        resultMap.put("code", 0);
+        resultMap.put("message", "广告创意状态修改成功");
         return resultMap;
     }
 
@@ -679,7 +679,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             resultMap.put("code", -1);
             return resultMap;
         }
-        System.out.println(data.toJSONString());
         for (int i = 0; i < data.size(); i++) {
             JSONObject dataObject = data.getJSONObject(i);
             ByteDanceCustomAudience audience = new ByteDanceCustomAudience(token, dataObject);
@@ -709,7 +708,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         if (null == code || !code.equals(0)) {
             logger.info("创建广告组接口异常==》accountId:{},message:{}", token.getAccountId(), result.getString("message"));
             resultMap.put("code", -1);
-            resultMap.put("message", "创建广告组接口异常");
+            resultMap.put("message", result.getString("message"));
             return resultMap;
         }
         JSONObject data = result.getJSONObject("data");
@@ -740,37 +739,37 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     private void getAdvertiserCreativeByPageNumber(String accountId, Integer pageNumber, String ids) {
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_creative_get");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_get");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
-        TreeMap<String,Object>params = new TreeMap<>();
+        TreeMap<String, Object> params = new TreeMap<>();
         JSONObject filtering = new JSONObject();
-        if(null!=ids&&!"".equals(ids.trim())){
+        if (null != ids && !"".equals(ids.trim())) {
             String[] idsArray = ids.split(",");
             JSONArray filterIdsArray = new JSONArray();
             for (int i = 0; i < idsArray.length; i++) {
                 Long id = Long.parseLong(idsArray[i]);
                 filterIdsArray.add(id);
             }
-            filtering.put("ids",filterIdsArray);
+            filtering.put("ids", filterIdsArray);
         }
-        params.put("filtering",filtering.toJSONString());
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("page",pageNumber+"");
-        String result = HttpUtils.httpGetRequest(url,headers,params);
+        params.put("filtering", filtering.toJSONString());
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("page", pageNumber + "");
+        String result = HttpUtils.httpGetRequest(url, headers, params);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("获取广告主广告创意信息接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            return ;
+        if (null == code || !code.equals(0)) {
+            logger.info("获取广告主广告创意信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            return;
         }
         JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
-        if(null==data||data.size()<=0){
-            logger.info("广告主广告创意信息不存在==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            return ;
+        if (null == data || data.size() <= 0) {
+            logger.info("广告主广告创意信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            return;
         }
         for (int i = 0; i < data.size(); i++) {
             JSONObject dataObject = data.getJSONObject(i);
@@ -779,7 +778,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             creativeMapper.deleteById(creative.getId());
             creativeMapper.insert(creative);
         }
-        getAdvertiserCreativeByPageNumber(accountId,pageNumber+1,ids);
+        getAdvertiserCreativeByPageNumber(accountId, pageNumber + 1, ids);
     }
 
     @Autowired
@@ -790,37 +789,37 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     private void getAdvertiserCampaignByPageNumber(String accountId, Integer pageNumber, String ids) {
         CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+PropertiesUtils.getValue("bytedance_config","bytedance_v2_campaign_get");
-        Map<String,String> headers = new HashMap<>();
-        headers.put("Content-Type","application/json");
-        headers.put("Access-Token",cTopOauthToken.getAccessToken());
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get");
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
-        TreeMap<String,Object> params = new TreeMap<>();
+        TreeMap<String, Object> params = new TreeMap<>();
         JSONObject filtering = new JSONObject();
-        if(null!=ids&&!"".equals(ids.trim())){
+        if (null != ids && !"".equals(ids.trim())) {
             String[] idsArray = ids.split(",");
             JSONArray filterIdsArray = new JSONArray();
             for (int i = 0; i < idsArray.length; i++) {
                 Long id = Long.parseLong(idsArray[i]);
                 filterIdsArray.add(id);
             }
-            filtering.put("ids",filterIdsArray);
+            filtering.put("ids", filterIdsArray);
         }
-        params.put("filtering",filtering.toJSONString());
-        params.put("advertiser_id",cTopOauthToken.getAccountId());
-        params.put("page",pageNumber+"");
-        String result = HttpUtils.httpGetRequest(url,headers,params);
+        params.put("filtering", filtering.toJSONString());
+        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("page", pageNumber + "");
+        String result = HttpUtils.httpGetRequest(url, headers, params);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
-        if(null==code||!code.equals(0)){
-            logger.info("获取广告主广告组信息接口异常==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            return ;
+        if (null == code || !code.equals(0)) {
+            logger.info("获取广告主广告组信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            return;
         }
         JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
-        if(null==data||data.size()<=0){
-            logger.info("获取广告主广告组信息不存在==》accountId:{},message:{}",accountId,jsonObject.getString("message"));
-            return ;
+        if (null == data || data.size() <= 0) {
+            logger.info("获取广告主广告组信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            return;
         }
         for (int i = 0; i < data.size(); i++) {
             JSONObject dataObject = data.getJSONObject(i);
@@ -829,7 +828,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             campaignMapper.deleteById(campaign.getId());
             campaignMapper.insert(campaign);
         }
-        getAdvertiserCampaignByPageNumber(accountId,pageNumber+1,ids);
+        getAdvertiserCampaignByPageNumber(accountId, pageNumber + 1, ids);
     }
 
     @Autowired

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceCreativeServiceImpl.java

@@ -56,7 +56,6 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
         }
         JSONObject dataObject = result.getJSONObject("data");
 //        Long adId = dataObject.getLong("ad_id");
-        System.out.println(dataObject.toJSONString());
         resultMap.put("code", 0);
         resultMap.put("message", "广告创意创建成功");
         return resultMap;

+ 28 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceAdvertisePlanTemplateServiceImpl.java

@@ -1,10 +1,13 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.ctop.entity.ByteDanceBudgetTemplate;
 import org.jeecg.modules.ctop.entity.BytedanceAdvertisePlanTemplate;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import org.jeecg.modules.ctop.mapper.BytedanceAdvertisePlanTemplateMapper;
+import org.jeecg.modules.ctop.service.IByteDanceAdvertisePlanService;
 import org.jeecg.modules.ctop.service.IBytedanceAdvertisePlanTemplateService;
 import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,14 +34,35 @@ public class BytedanceAdvertisePlanTemplateServiceImpl extends ServiceImpl<Byted
         CTopOauthToken token = tokenService.getOAuthTokenByAccountId(user.getId());
         template.setAccountId(token.getAccountId());
         template.setAdvertiserId(token.getAdvertiserId());
-//        template.setStatus(1);
+        template.setStatus(1);
         templateMapper.insert(template);
-        resultMap.put("success", true);
-        resultMap.put("message", "投放目标模板保存成功");
-        return resultMap;
+        //同步线上广告计划信息
+        String accountId = "e9ca23d68d884d4ebb19d07889727dae";
+        Long campaignId = template.getCampaignTemplateId();
+//        ByteDanceBudgetTemplate budgetTemplate = bu
+        JSONObject data = new JSONObject();
+        data.put("campaign_id", campaignId);
+        data.put("delivery_range", "DEFAULT");
+        data.put("budget_mode", "BUDGET_MODE_DAY");
+        data.put("budget", 2000);//需要大于bid
+        data.put("bid", 100);
+        data.put("start_time", "2019-07-30 01:00");
+        data.put("end_time", "2019-07-31 01:00");
+        data.put("pricing", "PRICING_CPM");
+        data.put("schedule_type", "SCHEDULE_FROM_NOW");
+        data.put("flow_control_mode", "FLOW_CONTROL_MODE_FAST");
+        data.put("name", "测试计划名称");
+        data.put("external_url", "https://lordsmobile.176.com/download.php");
+        data.put("download_url", "https://lordsmobile.176.com/download.php");
+        data.put("download_type", "DOWNLOAD_URL");//坑
+        data.put("package", "com.igg.android.lordsmobile_cn");//坑
+        data.put("app_type", "APP_ANDROID");//坑
+        return advertisePlanService.advertiserPlanCreate(accountId, campaignId, data.toJSONString());
     }
 
     @Autowired
+    private IByteDanceAdvertisePlanService advertisePlanService;
+    @Autowired
     private BytedanceAdvertisePlanTemplateMapper templateMapper;
     @Autowired
     private ICTopOauthTokenService tokenService;

+ 115 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CTopOauthTokenServiceImpl.java

@@ -1,22 +1,35 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import cn.com.ctop.common.utils.Check;
+import cn.com.ctop.common.utils.HttpUtils;
+import cn.com.ctop.common.utils.PropertiesUtils;
+import cn.com.ctop.toutiao.common.BytedanceInterfaceConstant;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import constant.KuaishouInterfaceConstant;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
 import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @Description: oauth授权码
  * @Author: jeecg-boot
- * @Date:   2019-07-09
+ * @Date: 2019-07-09
  * @Version: V1.0
  */
 @Service
 public class CTopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper, CTopOauthToken> implements ICTopOauthTokenService {
+    private static final Logger logger = LoggerFactory.getLogger(CTopOauthTokenServiceImpl.class);
+
 
     @Autowired
     private CTopOauthTokenMapper cTopOauthTokenMapper;
@@ -24,8 +37,107 @@ public class CTopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper,
     @Override
     public CTopOauthToken getOAuthTokenByAccountId(String accountId) {
         QueryWrapper<CTopOauthToken> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("advertiser_id", accountId).orderByDesc("create_time");
+        queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
         CTopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
         return cTopOauthToken;
     }
+
+    /**
+     * 刷新token
+     *
+     * @param accountId
+     * @return
+     */
+    @Override
+    public Map<String, Object> getByteDanceAccessToken(String accountId) {
+        Map<String, Object> resultMap = new HashMap<>();
+        CTopOauthToken token = this.getOAuthTokenByAccountId(accountId);
+        if (null == token) {
+            resultMap.put("message", "token信息不存在");
+            resultMap.put("code", -1);
+            return resultMap;
+        }
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.REFRESH_TOKEN;
+        Map<String, Object> param = new HashMap<String, Object>();
+        param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
+        param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
+        param.put("grant_type", "refresh_token");
+        param.put("refresh_token", token.getRefreshToken());
+        String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
+        JSONObject resultObject = JSONObject.parseObject(result);
+        Integer code = resultObject.getInteger("code");
+        if (null == code || code != 0) {
+            logger.info("刷新token异常;accountId:{}", accountId);
+            resultMap.put("message", "刷新token异常");
+            resultMap.put("code", -1);
+            return resultMap;
+        }
+        JSONObject data = resultObject.getJSONObject("data");
+        CTopOauthToken refreshToken = new CTopOauthToken(token, data);
+        cTopOauthTokenMapper.deleteById(token.getId());
+        cTopOauthTokenMapper.insert(refreshToken);
+        logger.info("头条刷新token成功:accountId:{}", accountId);
+        resultMap.put("message", "token刷新成功");
+        resultMap.put("code", 0);
+        return resultMap;
+    }
+
+    /**
+     * 快手 刷新token
+     *
+     * @param accountId
+     * @param refreshToken
+     * @return
+     */
+    @Override
+    public Map<String, Object> getKuaiShouRefreshToken(Long accountId, String refreshToken) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.REFRESH_TOKEN;
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", " application/json");
+        Map<String, Object> param = new HashMap<String, Object>();
+        param.put("app_id", PropertiesUtils.getConfig("kuaishou_appid"));
+        param.put("secret", PropertiesUtils.getConfig("kuaishou_secret"));
+        param.put("refresh_token", refreshToken);
+        try {
+            String result = HttpUtils.httpPostRequest(url, param, headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    CTopOauthToken oauthToken = cTopOauthTokenMapper.selectByAccountId(accountId);
+                    if (!Check.isNull(oauthToken)) {
+                        JSONObject dataJson = resultJson.getJSONObject("data");
+                        if (!Check.isNull(dataJson)) {
+                            oauthToken.setAccountId(accountId);
+                            oauthToken.setAccessToken(dataJson.getString("access_token"));
+                            long accessTokenExpireIn = dataJson.getLong("access_token_expires_in") * 1000L;
+                            long now = System.currentTimeMillis();
+                            Date accessTokenExpireInDate = new Date(now + accessTokenExpireIn);
+                            oauthToken.setAccessTokenExpiresIn(accessTokenExpireInDate);
+                            oauthToken.setRefreshToken(dataJson.getString("refresh_token"));
+                            long refreshTokenExpireIn = dataJson.getLong("refresh_token_expires_in") * 1000L;
+                            Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
+                            oauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
+                            oauthToken.setUpdateTime(new Date());
+                            int i = cTopOauthTokenMapper.updateByPrimaryKeySelective(oauthToken);
+                            if (i > 0) {
+                                logger.info("快手刷新token成功,accountId:{}", accountId);
+
+                            }
+                        }
+                    }
+                } else {
+                    logger.error("快手刷新token失败,accountId:{},result:{}", accountId, resultJson);
+
+                }
+            } else {
+                logger.error("快手刷新token返回结果为空,accountId:{}", accountId);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+
+        return null;
+    }
 }

+ 46 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/RefreshTokenServiceImpl.java

@@ -0,0 +1,46 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.utils.Check;
+import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
+import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
+import org.jeecg.modules.ctop.service.IRefreshTokenService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class RefreshTokenServiceImpl implements IRefreshTokenService {
+    private static final Logger logger = LoggerFactory.getLogger(RefreshTokenServiceImpl.class);
+    @Autowired
+    private CTopOauthTokenMapper oauthTokenMapper;
+    @Autowired
+    private ICTopOauthTokenService oauthTokenService;
+
+    /**
+     * 获取所有token
+     *
+     * @return
+     */
+    @Override
+    public void getRefresh() {
+        List<CTopOauthToken> oauthTokens = oauthTokenMapper.selectAll();
+        logger.info("需要刷新token列表长度:{}", oauthTokens.size());
+        if (!Check.isNull(oauthTokens)) {
+            for (CTopOauthToken oauthToken : oauthTokens) {
+                if ("1".equals(oauthToken.getMediaId().trim())) { //头条
+                    oauthTokenService.getByteDanceAccessToken(String.valueOf(oauthToken.getAccountId()));
+                }
+                if ("2".equals(oauthToken.getMediaId().trim())) { //快手
+                    oauthTokenService.getKuaiShouRefreshToken(oauthToken.getAccountId(), oauthToken.getRefreshToken());
+                }
+
+            }
+        } else {
+            logger.error("----------------------刷新token获取数据返回结果为空----------------------------------");
+        }
+    }
+}

+ 264 - 276
jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/test/controller/JeecgDemoController.java

@@ -1,13 +1,13 @@
 package org.jeecg.modules.demo.test.controller;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.aspect.annotation.PermissionData;
@@ -18,306 +18,294 @@ import org.jeecg.common.util.RedisUtil;
 import org.jeecg.modules.demo.test.entity.JeecgDemo;
 import org.jeecg.modules.demo.test.service.IJeecgDemoService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.extern.slf4j.Slf4j;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
 
 /**
- * @Description: 测试demo 
- * @Author: jeecg-boot 
- * @Date:2018-12-29 
+ * @Description: 测试demo
+ * @Author: jeecg-boot
+ * @Date:2018-12-29
  * @Version:V1.0
  */
 @Slf4j
-@Api(tags="单表DEMO")
+@Api(tags = "单表DEMO")
 @RestController
 @RequestMapping("/test/jeecgDemo")
-public class JeecgDemoController extends JeecgController<JeecgDemo,IJeecgDemoService> {
-	@Autowired
-	private IJeecgDemoService jeecgDemoService;
+public class JeecgDemoController extends JeecgController<JeecgDemo, IJeecgDemoService> {
+    @Autowired
+    private IJeecgDemoService jeecgDemoService;
 
-	@Autowired
-	private RedisUtil redisUtil;
+    @Autowired
+    private RedisUtil redisUtil;
 
-	/**
-	 * 分页列表查询
-	 * 
-	 * @param jeecgDemo
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
-	@GetMapping(value = "/list")
-	@PermissionData(pageComponent="jeecg/JeecgDemoList")
-	public Result<IPage<JeecgDemo>> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-			HttpServletRequest req) {
-		Result<IPage<JeecgDemo>> result = new Result<IPage<JeecgDemo>>();
-		/*
-		 * QueryWrapper<JeecgDemo> queryWrapper = null;
-		 * //===========================================================================
-		 * ===== //高级组合查询 try { String superQueryParams =
-		 * req.getParameter("superQueryParams");
-		 * if(oConvertUtils.isNotEmpty(superQueryParams)) { // 解码 superQueryParams =
-		 * URLDecoder.decode(superQueryParams, "UTF-8"); List<QueryRuleVo> userList =
-		 * JSON.parseArray(superQueryParams, QueryRuleVo.class);
-		 * log.info(superQueryParams); queryWrapper = new QueryWrapper<JeecgDemo>(); for
-		 * (QueryRuleVo rule : userList) { if(oConvertUtils.isNotEmpty(rule.getField())
-		 * && oConvertUtils.isNotEmpty(rule.getRule()) &&
-		 * oConvertUtils.isNotEmpty(rule.getVal())){
-		 * ObjectParseUtil.addCriteria(queryWrapper, rule.getField(),
-		 * QueryRuleEnum.getByValue(rule.getRule()), rule.getVal()); } } } } catch
-		 * (UnsupportedEncodingException e) { e.printStackTrace(); }
-		 * //===========================================================================
-		 * =====
-		 * 
-		 * // 手工转换实体驼峰字段为下划线分隔表字段 queryWrapper = queryWrapper==null?new
-		 * QueryWrapper<JeecgDemo>(jeecgDemo):queryWrapper; Page<JeecgDemo> page = new
-		 * Page<JeecgDemo>(pageNo, pageSize);
-		 * 
-		 * // 排序逻辑 处理 String column = req.getParameter("column"); String order =
-		 * req.getParameter("order"); if (oConvertUtils.isNotEmpty(column) &&
-		 * oConvertUtils.isNotEmpty(order)) { if ("asc".equals(order)) {
-		 * queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column)); } else {
-		 * queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column)); } }
-		 */
+    /**
+     * 分页列表查询
+     *
+     * @param jeecgDemo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
+    @GetMapping(value = "/list")
+    @PermissionData(pageComponent = "jeecg/JeecgDemoList")
+    public Result<IPage<JeecgDemo>> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                         HttpServletRequest req) {
+        Result<IPage<JeecgDemo>> result = new Result<IPage<JeecgDemo>>();
+        /*
+         * QueryWrapper<JeecgDemo> queryWrapper = null;
+         * //===========================================================================
+         * ===== //高级组合查询 try { String superQueryParams =
+         * req.getParameter("superQueryParams");
+         * if(oConvertUtils.isNotEmpty(superQueryParams)) { // 解码 superQueryParams =
+         * URLDecoder.decode(superQueryParams, "UTF-8"); List<QueryRuleVo> userList =
+         * JSON.parseArray(superQueryParams, QueryRuleVo.class);
+         * log.info(superQueryParams); queryWrapper = new QueryWrapper<JeecgDemo>(); for
+         * (QueryRuleVo rule : userList) { if(oConvertUtils.isNotEmpty(rule.getField())
+         * && oConvertUtils.isNotEmpty(rule.getRule()) &&
+         * oConvertUtils.isNotEmpty(rule.getVal())){
+         * ObjectParseUtil.addCriteria(queryWrapper, rule.getField(),
+         * QueryRuleEnum.getByValue(rule.getRule()), rule.getVal()); } } } } catch
+         * (UnsupportedEncodingException e) { e.printStackTrace(); }
+         * //===========================================================================
+         * =====
+         *
+         * // 手工转换实体驼峰字段为下划线分隔表字段 queryWrapper = queryWrapper==null?new
+         * QueryWrapper<JeecgDemo>(jeecgDemo):queryWrapper; Page<JeecgDemo> page = new
+         * Page<JeecgDemo>(pageNo, pageSize);
+         *
+         * // 排序逻辑 处理 String column = req.getParameter("column"); String order =
+         * req.getParameter("order"); if (oConvertUtils.isNotEmpty(column) &&
+         * oConvertUtils.isNotEmpty(order)) { if ("asc".equals(order)) {
+         * queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column)); } else {
+         * queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column)); } }
+         */
 
-		QueryWrapper<JeecgDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeecgDemo, req.getParameterMap());
-		Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);
+        QueryWrapper<JeecgDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeecgDemo, req.getParameterMap());
+        Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);
 
-		IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
+        IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
 //		log.info("查询当前页:" + pageList.getCurrent());
 //		log.info("查询当前页数量:" + pageList.getSize());
 //		log.info("查询结果数量:" + pageList.getRecords().size());
 //		log.info("数据总数:" + pageList.getTotal());
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param jeecgDemo
+     * @return
+     */
+    @PostMapping(value = "/add")
+    @AutoLog(value = "添加测试DEMO")
+    @ApiOperation(value = "添加DEMO", notes = "添加DEMO")
+    public Result<JeecgDemo> add(@RequestBody JeecgDemo jeecgDemo) {
+        Result<JeecgDemo> result = new Result<JeecgDemo>();
+        try {
+            jeecgDemoService.save(jeecgDemo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
 
-	/**
-	 * 添加
-	 * 
-	 * @param jeecgDemo
-	 * @return
-	 */
-	@PostMapping(value = "/add")
-	@AutoLog(value = "添加测试DEMO")
-	@ApiOperation(value = "添加DEMO", notes = "添加DEMO")
-	public Result<JeecgDemo> add(@RequestBody JeecgDemo jeecgDemo) {
-		Result<JeecgDemo> result = new Result<JeecgDemo>();
-		try {
-			jeecgDemoService.save(jeecgDemo);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(), e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
+    /**
+     * 编辑
+     *
+     * @param jeecgDemo
+     * @return
+     */
+    @PutMapping(value = "/edit")
+    @ApiOperation(value = "编辑DEMO", notes = "编辑DEMO")
+    public Result<JeecgDemo> eidt(@RequestBody JeecgDemo jeecgDemo) {
+        Result<JeecgDemo> result = new Result<JeecgDemo>();
+        JeecgDemo jeecgDemoEntity = jeecgDemoService.getById(jeecgDemo.getId());
+        if (jeecgDemoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = jeecgDemoService.updateById(jeecgDemo);
+            // TODO 返回false说明什么?
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
 
-	/**
-	 * 编辑
-	 * 
-	 * @param jeecgDemo
-	 * @return
-	 */
-	@PutMapping(value = "/edit")
-	@ApiOperation(value = "编辑DEMO", notes = "编辑DEMO")
-	public Result<JeecgDemo> eidt(@RequestBody JeecgDemo jeecgDemo) {
-		Result<JeecgDemo> result = new Result<JeecgDemo>();
-		JeecgDemo jeecgDemoEntity = jeecgDemoService.getById(jeecgDemo.getId());
-		if (jeecgDemoEntity == null) {
-			result.error500("未找到对应实体");
-		} else {
-			boolean ok = jeecgDemoService.updateById(jeecgDemo);
-			// TODO 返回false说明什么?
-			if (ok) {
-				result.success("修改成功!");
-			}
-		}
+        return result;
+    }
 
-		return result;
-	}
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "删除测试DEMO")
+    @DeleteMapping(value = "/delete")
+    @ApiOperation(value = "通过ID删除DEMO", notes = "通过ID删除DEMO")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            jeecgDemoService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
 
-	/**
-	 * 通过id删除
-	 * 
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "删除测试DEMO")
-	@DeleteMapping(value = "/delete")
-	@ApiOperation(value = "通过ID删除DEMO", notes = "通过ID删除DEMO")
-	public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
-		try {
-			jeecgDemoService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @DeleteMapping(value = "/deleteBatch")
+    @ApiOperation(value = "批量删除DEMO", notes = "批量删除DEMO")
+    public Result<JeecgDemo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<JeecgDemo> result = new Result<JeecgDemo>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.jeecgDemoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
 
-	/**
-	 * 批量删除
-	 * 
-	 * @param ids
-	 * @return
-	 */
-	@DeleteMapping(value = "/deleteBatch")
-	@ApiOperation(value = "批量删除DEMO", notes = "批量删除DEMO")
-	public Result<JeecgDemo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-		Result<JeecgDemo> result = new Result<JeecgDemo>();
-		if (ids == null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		} else {
-			this.jeecgDemoService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/queryById")
+    @ApiOperation(value = "通过ID查询DEMO", notes = "通过ID查询DEMO")
+    public Result<JeecgDemo> queryById(@ApiParam(name = "id", value = "示例id", required = true) @RequestParam(name = "id", required = true) String id) {
+        Result<JeecgDemo> result = new Result<JeecgDemo>();
+        JeecgDemo jeecgDemo = jeecgDemoService.getById(id);
+        if (jeecgDemo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(jeecgDemo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
 
-	/**
-	 * 通过id查询
-	 * 
-	 * @param id
-	 * @return
-	 */
-	@GetMapping(value = "/queryById")
-	@ApiOperation(value = "通过ID查询DEMO", notes = "通过ID查询DEMO")
-	public Result<JeecgDemo> queryById(@ApiParam(name = "id", value = "示例id", required = true) @RequestParam(name = "id", required = true) String id) {
-		Result<JeecgDemo> result = new Result<JeecgDemo>();
-		JeecgDemo jeecgDemo = jeecgDemoService.getById(id);
-		if (jeecgDemo == null) {
-			result.error500("未找到对应实体");
-		} else {
-			result.setResult(jeecgDemo);
-			result.setSuccess(true);
-		}
-		return result;
-	}
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param jeecgDemo
+     */
+    @RequestMapping(value = "/exportXls")
+    @PermissionData(pageComponent = "jeecg/JeecgDemoList")
+    public ModelAndView exportXls(HttpServletRequest request, JeecgDemo jeecgDemo) {
+        return super.exportXls(request, jeecgDemo, JeecgDemo.class, "单表模型");
+    }
 
-	/**
-	 * 导出excel
-	 * 
-	 * @param request
-	 * @param jeecgDemo
-	 */
-	@RequestMapping(value = "/exportXls")
-	@PermissionData(pageComponent="jeecg/JeecgDemoList")
-	public ModelAndView exportXls(HttpServletRequest request, JeecgDemo jeecgDemo) {
-		return super.exportXls(request, jeecgDemo, JeecgDemo.class, "单表模型");
-	}
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, JeecgDemo.class);
+    }
 
-	/**
-	 * 通过excel导入数据
-	 * 
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-	public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-		return super.importExcel(request, response, JeecgDemo.class);
-	}
+    // ================================================================================================================
 
-	// ================================================================================================================
-	/**
-	 * redis操作 -- set
-	 */
-	@GetMapping(value = "/redisSet")
-	public void redisSet() {
-		redisUtil.set("name", "张三" + DateUtils.now());
-	}
+    /**
+     * redis操作 -- set
+     */
+    @GetMapping(value = "/redisSet")
+    public void redisSet() {
+        redisUtil.set("name", "张三" + DateUtils.now());
+    }
 
-	/**
-	 * redis操作 -- get
-	 */
-	@GetMapping(value = "/redisGet")
-	public String redisGet() {
-		return (String) redisUtil.get("name");
-	}
+    /**
+     * redis操作 -- get
+     */
+    @GetMapping(value = "/redisGet")
+    public String redisGet() {
+        return (String) redisUtil.get("name");
+    }
 
-	/**
-	 * redis操作 -- setObj
-	 */
-	@GetMapping(value = "/redisSetObj")
-	public void redisSetObj() {
-		JeecgDemo p = new JeecgDemo();
-		p.setAge(10);
-		p.setBirthday(new Date());
-		p.setContent("hello");
-		p.setName("张三");
-		p.setSex("男");
-		redisUtil.set("user-zdh", p);
-	}
+    /**
+     * redis操作 -- setObj
+     */
+    @GetMapping(value = "/redisSetObj")
+    public void redisSetObj() {
+        JeecgDemo p = new JeecgDemo();
+        p.setAge(10);
+        p.setBirthday(new Date());
+        p.setContent("hello");
+        p.setName("张三");
+        p.setSex("男");
+        redisUtil.set("user-zdh", p);
+    }
 
-	/**
-	 * redis操作 -- setObj
-	 */
-	@GetMapping(value = "/redisGetObj")
-	public Object redisGetObj() {
-		return redisUtil.get("user-zdh");
-	}
+    /**
+     * redis操作 -- setObj
+     */
+    @GetMapping(value = "/redisGetObj")
+    public Object redisGetObj() {
+        return redisUtil.get("user-zdh");
+    }
 
-	/**
-	 * redis操作 -- get
-	 */
-	@GetMapping(value = "/redisDemo/{id}")
-	public JeecgDemo redisGetJeecgDemo(@PathVariable("id") String id) {
-		JeecgDemo t = jeecgDemoService.getByIdCacheable(id);
-		System.out.println(t);
-		return t;
-	}
+    /**
+     * redis操作 -- get
+     */
+    @GetMapping(value = "/redisDemo/{id}")
+    public JeecgDemo redisGetJeecgDemo(@PathVariable("id") String id) {
+        JeecgDemo t = jeecgDemoService.getByIdCacheable(id);
+        return t;
+    }
 
-	/**
-	 * freemaker方式 【页面路径: src/main/resources/templates】
-	 * 
-	 * @param modelAndView
-	 * @return
-	 */
-	@RequestMapping("/demo3")
-	public ModelAndView demo3(ModelAndView modelAndView) {
-		modelAndView.setViewName("demo3");
-		List<String> userList = new ArrayList<String>();
-		userList.add("admin");
-		userList.add("user1");
-		userList.add("user2");
-		log.info("--------------test--------------");
-		modelAndView.addObject("userList", userList);
-		return modelAndView;
-	}
+    /**
+     * freemaker方式 【页面路径: src/main/resources/templates】
+     *
+     * @param modelAndView
+     * @return
+     */
+    @RequestMapping("/demo3")
+    public ModelAndView demo3(ModelAndView modelAndView) {
+        modelAndView.setViewName("demo3");
+        List<String> userList = new ArrayList<String>();
+        userList.add("admin");
+        userList.add("user1");
+        userList.add("user2");
+        log.info("--------------test--------------");
+        modelAndView.addObject("userList", userList);
+        return modelAndView;
+    }
 
-	// ================================================================================================================
+    // ================================================================================================================
 
-	// ==========================================动态表单
-	// JSON接收测试===========================================//
-	@PostMapping(value = "/testOnlineAdd")
-	public Result<JeecgDemo> testOnlineAdd(@RequestBody JSONObject json) {
-		Result<JeecgDemo> result = new Result<JeecgDemo>();
-		log.info(json.toJSONString());
-		result.success("添加成功!");
-		return result;
-	}
+    // ==========================================动态表单
+    // JSON接收测试===========================================//
+    @PostMapping(value = "/testOnlineAdd")
+    public Result<JeecgDemo> testOnlineAdd(@RequestBody JSONObject json) {
+        Result<JeecgDemo> result = new Result<JeecgDemo>();
+        log.info(json.toJSONString());
+        result.success("添加成功!");
+        return result;
+    }
 
 }

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

@@ -2,6 +2,8 @@ package org.jeecg.modules.kuaishou.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
+import org.jeecg.modules.ctop.service.IRefreshTokenService;
 import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -114,15 +116,6 @@ public class KuaiShouController {
     }
 
 
-    @RequestMapping("/getToken")
-    public void getToken() {
-        String accessToken = "092955a5f1768f8dfdc19fd821ccfd9e";
-        kuaishouInterfaceService.getRefreshToken(accessToken);
-
-
-    }
-
-
     @RequestMapping(value = "/video/upload", consumes = "multipart/form-data;charset=utf-8")
     public void upload(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
 
@@ -234,4 +227,16 @@ public class KuaiShouController {
         kuaishouInterfaceService.appUpdate(advertiserId, accessToken, requestJson, multipartFile, request);
 
     }
+
+    @Autowired
+    private IRefreshTokenService refreshTokenService;
+    @Autowired
+    private ICTopOauthTokenService oauthTokenService;
+
+    @RequestMapping("/test")
+    public void test() throws IOException {
+        oauthTokenService.getKuaiShouRefreshToken(23212L, "b51ce96a098299b04fa6cb70617e653d");
+
+    }
+
 }

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

@@ -84,14 +84,6 @@ public interface IKuaishouInterfaceService {
      */
     KuaishouResultToken getAccessToken(String authCode);
 
-    /**
-     * 刷新token
-     *
-     * @param refreshToken
-     * @return
-     */
-    KuaishouResultToken getRefreshToken(String refreshToken);
-
 
     /**
      * 获取可选的深度转化类型

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

@@ -64,7 +64,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             if (!Check.isNull(resultJson)) {
 
             }
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportHourlyAccount>>() {
@@ -91,7 +90,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         KuaishouResult<KuaishouReportDailyAccount> kuaishouResult = null;
         try {
             String result = HttpUtils.httpPostRequest(url, param, headers);
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportDailyAccount>>() {
@@ -118,7 +116,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         KuaishouResult<KuaishouReportDailyCampaign> kuaishouResult = null;
         try {
             String result = HttpUtils.httpPostRequest(url, param, headers);
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportDailyCampaign>>() {
@@ -145,7 +142,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         KuaishouResult<KuaishouReportHourlyCampaign> kuaishouResult = null;
         try {
             String result = HttpUtils.httpPostRequest(url, param, headers);
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportHourlyCampaign>>() {
@@ -172,7 +168,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         KuaishouResult<KuaishouReportDailyGroup> kuaishouResult = null;
         try {
             String result = HttpUtils.httpPostRequest(url, param, headers);
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportDailyGroup>>() {
@@ -199,7 +194,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         KuaishouResult<KuaishouReportHourlyGroup> kuaishouResult = null;
         try {
             String result = HttpUtils.httpPostRequest(url, param, headers);
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportHourlyGroup>>() {
@@ -226,7 +220,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         KuaishouResult<KuaishouReportDailyCreative> kuaishouResult = null;
         try {
             String result = HttpUtils.httpPostRequest(url, param, headers);
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportDailyCreative>>() {
@@ -253,7 +246,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         KuaishouResult<KuaishouReportHourlyCreative> kuaishouResult = null;
         try {
             String result = HttpUtils.httpPostRequest(url, param, headers);
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportHourlyCreative>>() {
@@ -733,41 +725,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
     /**
-     * 刷新token
-     *
-     * @param refreshToken
-     * @return
-     */
-    @Override
-    public KuaishouResultToken getRefreshToken(String refreshToken) {
-        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.REFRESH_TOKEN;
-        Map<String, String> headers = new HashMap<String, String>();
-        headers.put("Content-Type", " application/json");
-        Map<String, Object> param = new HashMap<String, Object>();
-        param.put("app_id", PropertiesUtils.getConfig("kuaishou_appid"));
-        param.put("secret", PropertiesUtils.getConfig("kuaishou_secret"));
-        param.put("refresh_token", refreshToken);
-        KuaishouResultToken kuaishouResult = null;
-        try {
-            String result = HttpUtils.httpPostRequest(url, param, headers);
-            System.err.println(result);
-            JSONObject tokenJson = new JSONObject();
-            if (!Check.isNullMap(tokenJson)) {
-
-
-            } else {
-                logger.error("重新获取token返回结果为空");
-            }
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return kuaishouResult;
-    }
-
-
-    /**
      * 获取可选的深度转化类型
      *
      * @param advertiserId

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/handle/impl/SmsSendMsgHandle.java

@@ -7,7 +7,6 @@ public class SmsSendMsgHandle implements ISendMsgHandle {
 	@Override
 	public void SendMsg(String es_receiver, String es_title, String es_content) {
 		// TODO Auto-generated method stub
-		System.out.println("发短信");
 	}
 
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/handle/impl/WxSendMsgHandle.java

@@ -7,7 +7,7 @@ public class WxSendMsgHandle implements ISendMsgHandle {
 	@Override
 	public void SendMsg(String es_receiver, String es_title, String es_content) {
 		// TODO Auto-generated method stub
-		System.out.println("发微信消息模板");
+
 	}
 
 }

+ 3 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/job/SendMsgJob.java

@@ -1,7 +1,7 @@
 package org.jeecg.modules.message.job;
 
-import java.util.List;
-
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.message.entity.SysMessage;
 import org.jeecg.modules.message.handle.ISendMsgHandle;
@@ -13,9 +13,7 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-
-import lombok.extern.slf4j.Slf4j;
+import java.util.List;
 
 /**
  * 发送消息任务
@@ -37,7 +35,6 @@ public class SendMsgJob implements Job {
 		queryWrapper.eq("es_send_status", SendMsgStatusEnum.WAIT.getCode())
 				.or(i -> i.eq("es_send_status", SendMsgStatusEnum.FAIL.getCode()).lt("es_send_num", 6));
 		List<SysMessage> sysMessages = sysMessageService.list(queryWrapper);
-		System.out.println(sysMessages);
 		// 2.根据不同的类型走不通的发送实现类
 		for (SysMessage sysMessage : sysMessages) {
 			ISendMsgHandle sendMsgHandle = null;

+ 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://192.168.0.23:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: hcst
-          password: 123456
+          url: jdbc:mysql://localhost:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: root
+          password: root
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:

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

@@ -6,7 +6,10 @@ import org.apache.fontbox.ttf.CmapSubtable;
 import org.apache.fontbox.ttf.GlyphData;
 import org.apache.fontbox.ttf.TTFParser;
 import org.apache.fontbox.ttf.TrueTypeFont;
-import org.apache.http.*;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.config.CookieSpecs;
@@ -17,29 +20,20 @@ import org.apache.http.client.methods.HttpPost;
 import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.conn.ssl.TrustStrategy;
 import org.apache.http.cookie.Cookie;
-import org.apache.http.entity.ContentType;
-
 import org.apache.http.entity.StringEntity;
-import org.apache.http.entity.mime.HttpMultipartMode;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.ssl.SSLContextBuilder;
 import org.apache.http.util.EntityUtils;
 import org.eclipse.jetty.util.UrlEncoded;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.net.ssl.SSLContext;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLEncoder;
@@ -80,14 +74,12 @@ public class HttpUtils {
             httppost.setHeader("User-Agent", USER_AGENT);
 
             List<Cookie> list = cookieStore.getCookies();
-            System.out.println("httpPostRequest");
             for (Cookie ck : list) {
                 System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
             }
             System.out.println("-------------------------------------");
             for (String key : headers.keySet()) {
                 httppost.setHeader(key, headers.get(key));
-                System.out.println(key + "=" + headers.get(key));
             }
             List<NameValuePair> paramList = new ArrayList<NameValuePair>();
             for (String key : param.keySet()) {
@@ -106,7 +98,6 @@ public class HttpUtils {
 
             HttpResponse response = httpClient.execute(httppost);
             int statusCode = response.getStatusLine().getStatusCode();
-            System.out.println(statusCode);
             if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
                 String newUrl = response.getFirstHeader("Location").getValue();
                 return httpPostParamRequest(newUrl, param, headers);
@@ -131,13 +122,11 @@ public class HttpUtils {
             httppost.setHeader("User-Agent", USER_AGENT);
             httppost.addHeader("Content-Type", "application/json");
             List<Cookie> list = cookieStore.getCookies();
-            System.out.println("httpPostRequest");
             for (Cookie ck : list) {
                 System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
             }
             for (String key : headers.keySet()) {
                 httppost.setHeader(key, headers.get(key));
-                System.out.println(key + "=" + headers.get(key));
             }
             //httppost.setHeader("Content-Type", "application/json");
             httppost.setEntity(new StringEntity(new Gson().toJson(param), Charset.forName("UTF-8")));
@@ -201,13 +190,11 @@ public class HttpUtils {
             httppost.setHeader("User-Agent", USER_AGENT);
             httppost.addHeader("Content-Type", "application/json");
             List<Cookie> list = cookieStore.getCookies();
-            System.out.println("httpPostRequest");
             for (Cookie ck : list) {
                 System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
             }
             for (String key : headers.keySet()) {
                 httppost.setHeader(key, headers.get(key));
-                System.out.println(key + "=" + headers.get(key));
             }
             //httppost.setHeader("Content-Type", "application/json");
             httppost.setEntity(new StringEntity(params.toJSONString(), Charset.forName("UTF-8")));
@@ -239,18 +226,14 @@ public class HttpUtils {
         try {
             httpGet.setHeader("User-Agent", USER_AGENT);
             List<Cookie> list2 = cookieStore.getCookies();
-            System.out.println("httpGetRequest");
             for (Cookie ck : list2) {
                 System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
             }
             response = httpClient.execute(httpGet);
             List<Cookie> list = cookieStore.getCookies();
-            System.out.println("httpGetRequest");
             for (Cookie ck : list) {
                 System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
             }
-            System.out.println("-------------------------------------");
-            System.out.println(response.getStatusLine().getStatusCode());
             int statusCode = response.getStatusLine().getStatusCode();
             if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
                 String newUrl = response.getFirstHeader("Location").getValue();
@@ -283,7 +266,6 @@ public class HttpUtils {
             HttpEntity respentity;
             HttpResponse response = httpClient.execute(httppost);
             int code = response.getStatusLine().getStatusCode();
-            System.out.println(code);
 
             respentity = response.getEntity();
             strReturn = EntityUtils.toString(respentity);
@@ -339,7 +321,6 @@ public class HttpUtils {
         HttpPost httpPost = new HttpPost(url);
         List<Cookie> list = cookieStore.getCookies();
 //        cookieStore.clear();
-        System.out.println("callingGraph");
         for (Cookie ck : list) {
 
             System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
@@ -353,14 +334,12 @@ public class HttpUtils {
             httpPost.setHeader("User-Agent", USER_AGENT);
             httpPost.setEntity(entity);
             response = httpClient.execute(httpPost);
-            System.out.println(response.getStatusLine().getStatusCode());
             BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
             String line = null;
             StringBuilder builder = new StringBuilder();
             while ((line = reader.readLine()) != null) {
                 builder.append(line);
             }
-            System.out.println("callingGraph");
             for (Cookie ck : list) {
 
                 System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
@@ -416,7 +395,6 @@ public class HttpUtils {
             System.out.println(gson.toJson(tables));
             CmapSubtable table = tables[0];
             Map<String, Integer> numberMap = new HashMap<String, Integer>();
-            System.out.println("datas=" + datas.length);
             Map<String, String> fontMap = new HashMap<String, String>();
             for (int i = 0; i <= 13; i++) {
                 GlyphData data = datas[i];
@@ -569,5 +547,4 @@ public class HttpUtils {
     }
 
 
-
 }

+ 0 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FateadmHttpUtil.java

@@ -328,7 +328,6 @@ public class FateadmHttpUtil {
                 result += line;
             }
         } catch (Exception e) {
-            System.out.println("发送 POST 请求出现异常!"+e);
             e.printStackTrace();
         }
         //使用finally块来关闭输出流、输入流

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java

@@ -102,7 +102,6 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
         try {
             JsonNode userProfileNode = mapper.readTree(userProfileStr);
-            System.out.println(userProfileStr);
             int photoCount = userProfileNode.get("userProfile").get("ownerCount").get("photo").asInt();
             QueryWrapper<AppVideo> queryWrapper = new QueryWrapper<AppVideo>();
             queryWrapper.eq("user_id", kuaishouAdAccount.getKsid());

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 55 - 55
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java