yumeng преди 5 години
родител
ревизия
6981f7df9d
променени са 13 файла, в които са добавени 761 реда и са изтрити 29 реда
  1. 23 2
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  2. 40 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  3. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupTargetController.java
  4. 10 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java
  5. 203 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTarget.java
  6. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTargetMapper.java
  7. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouAppInfoMapper.xml
  8. 16 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  9. 67 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTargetMapper.xml
  10. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouRegionListChildrenMapper.xml
  11. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupTargetService.java
  12. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTargetServiceImpl.java
  13. 99 13
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

+ 23 - 2
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,8 +1,12 @@
 package org.jeecg;
 
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.HttpUtils2;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.jeecg.modules.ctop.service.IBidWarningService;
@@ -21,7 +25,10 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
@@ -133,9 +140,13 @@ public class SampleTest {
 
     }
 
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+
     @Test
     public void testMail() throws Exception {
-
+        // String accessToken, Long advertiserId, Date startDate, Date endDate, Integer page
+        kuaishouInterfaceService.getGroupList("adf659b9b43e8952f9a3f0c5269505ca", 35675L, null, null, 1);
     }
 
 
@@ -144,7 +155,17 @@ public class SampleTest {
 
     @Test
     public void testMa() throws Exception {
-        bidWarningService.BidWarning();
+        //String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_advertiser_info");
+        String url = "https://ad.oceanengine.com/open_api/2/advertiser/public_info/";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", "7827db33fe53348e935706250a991461e7cffda2");
+        TreeMap<String, Object> params = new TreeMap<>();
+        //TODO jsonArray
+        params.put("advertiser_ids", "[" + 111463131228L+ "]");
+        String result = HttpUtils.httpGetRequest(url, headers, params);
+        JSONObject jsonObject = JSONObject.parseObject(result);
+        System.err.println(jsonObject);
     }
 
 

+ 40 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -6,7 +6,9 @@ import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListParentMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -22,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
+import java.util.List;
 
 @Slf4j
 @Api(tags = "快手-批量工具")
@@ -43,6 +46,8 @@ public class BatchController {
 
     @Autowired
     private IKuaiShouGroupService kuaiShouGroupService;
+    @Autowired
+    private KuaiShouRegionListParentMapper regionListParentMapper;
 
 
     /**
@@ -148,7 +153,16 @@ public class BatchController {
     }
 
 
-    @PostMapping(value = "/getUnitList")
+    /**
+     * 查询广告组列表
+     *
+     * @param kuaiShouGroup
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @GetMapping(value = "/getUnitList")
     public Result<IPage<KuaiShouGroup>> getUnitList(KuaiShouGroup kuaiShouGroup,
                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@@ -162,4 +176,29 @@ public class BatchController {
         return result;
     }
 
+
+    /**
+     * 获取区域列表
+     *
+     * @param kuaiShouRegionListParent
+     * @return
+     */
+    @GetMapping(value = "/getRegion")
+    public Result<List<KuaiShouRegionListParent>> getRegion(KuaiShouRegionListParent kuaiShouRegionListParent, HttpServletRequest req) {
+        Result<List<KuaiShouRegionListParent>> result = new Result<>();
+
+        try {
+            QueryWrapper<KuaiShouRegionListParent> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouRegionListParent, req.getParameterMap());
+
+            List<KuaiShouRegionListParent> regionListParents = regionListParentMapper.selectList(queryWrapper);
+            result.setSuccess(true);
+            result.setResult(regionListParents);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+
+        }
+        return result;
+    }
+
 }

+ 248 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupTargetController.java

@@ -0,0 +1,248 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
+import com.alibaba.fastjson.JSON;
+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 lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+@Slf4j
+@Api(tags = "快手-定向信息")
+@RestController
+@RequestMapping("/ctop/kuaiShouGroupTarget")
+public class KuaiShouGroupTargetController {
+    @Autowired
+    private IKuaiShouGroupTargetService kuaiShouGroupTargetService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouGroupTarget
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-分页列表查询")
+    @ApiOperation(value = "快手-定向信息-分页列表查询", notes = "快手-定向信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouGroupTarget>> queryPageList(KuaiShouGroupTarget kuaiShouGroupTarget,
+                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                            HttpServletRequest req) {
+        Result<IPage<KuaiShouGroupTarget>> result = new Result<IPage<KuaiShouGroupTarget>>();
+        QueryWrapper<KuaiShouGroupTarget> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupTarget, req.getParameterMap());
+        Page<KuaiShouGroupTarget> page = new Page<KuaiShouGroupTarget>(pageNo, pageSize);
+        IPage<KuaiShouGroupTarget> pageList = kuaiShouGroupTargetService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouGroupTarget
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-添加")
+    @ApiOperation(value = "快手-定向信息-添加", notes = "快手-定向信息-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouGroupTarget> add(@RequestBody KuaiShouGroupTarget kuaiShouGroupTarget) {
+        Result<KuaiShouGroupTarget> result = new Result<KuaiShouGroupTarget>();
+        try {
+            kuaiShouGroupTargetService.save(kuaiShouGroupTarget);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouGroupTarget
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-编辑")
+    @ApiOperation(value = "快手-定向信息-编辑", notes = "快手-定向信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouGroupTarget> edit(@RequestBody KuaiShouGroupTarget kuaiShouGroupTarget) {
+        Result<KuaiShouGroupTarget> result = new Result<KuaiShouGroupTarget>();
+        KuaiShouGroupTarget kuaiShouGroupTargetEntity = kuaiShouGroupTargetService.getById(kuaiShouGroupTarget.getId());
+        if (kuaiShouGroupTargetEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouGroupTargetService.updateById(kuaiShouGroupTarget);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-通过id删除")
+    @ApiOperation(value = "快手-定向信息-通过id删除", notes = "快手-定向信息-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaiShouGroupTargetService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-批量删除")
+    @ApiOperation(value = "快手-定向信息-批量删除", notes = "快手-定向信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaiShouGroupTarget> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouGroupTarget> result = new Result<KuaiShouGroupTarget>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouGroupTargetService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-通过id查询")
+    @ApiOperation(value = "快手-定向信息-通过id查询", notes = "快手-定向信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouGroupTarget> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouGroupTarget> result = new Result<KuaiShouGroupTarget>();
+        KuaiShouGroupTarget kuaiShouGroupTarget = kuaiShouGroupTargetService.getById(id);
+        if (kuaiShouGroupTarget == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouGroupTarget);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouGroupTarget> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouGroupTarget kuaiShouGroupTarget = JSON.parseObject(deString, KuaiShouGroupTarget.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupTarget, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouGroupTarget> pageList = kuaiShouGroupTargetService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-定向信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouGroupTarget.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手-定向信息列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<KuaiShouGroupTarget> listKuaiShouGroupTargets = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouGroupTarget.class, params);
+                kuaiShouGroupTargetService.saveBatch(listKuaiShouGroupTargets);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouGroupTargets.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 10 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java

@@ -62,6 +62,8 @@ public class KuaiShouGroup {
     @Excel(name = "广告组状态", width = 15)
     @ApiModelProperty(value = "广告组状态")
     private Integer status;
+    private Integer putStatus;
+    private Integer createChannel;
     /**
      * 审核拒绝理由
      */
@@ -86,6 +88,10 @@ public class KuaiShouGroup {
     @Excel(name = "OCPC出价", width = 15)
     @ApiModelProperty(value = "OCPC出价")
     private Long cpaBid;
+
+    private Integer deepConversionType;
+    private Long deepConversionBid;
+
     /**
      * OCPX行为类型   1: CPM, 2: CPC,
      */
@@ -116,18 +122,16 @@ public class KuaiShouGroup {
     @Excel(name = "投放结束时间", width = 15)
     @ApiModelProperty(value = "投放结束时间")
     private String endTime;
-    /**
-     * 投放时段
-     */
-    @Excel(name = "投放时段", width = 15)
-    @ApiModelProperty(value = "投放时段")
-    private String schedule;
+    private String scheduleTime;
+    private String sceneId;
+
     /**
      * 创意展现方式  0:未知, 1:轮播,
      */
     @Excel(name = "创意展现方式  0:未知, 1:轮播,", width = 15)
     @ApiModelProperty(value = "创意展现方式  0:未知, 1:轮播,")
     private Integer showModel;
+    private Integer unitType;
     /**
      * url类型
      */

+ 203 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTarget.java

@@ -0,0 +1,203 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+@Data
+@TableName("ctop_kuaishou_group_target")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_group_target对象", description = "快手-定向信息")
+public class KuaiShouGroupTarget {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 广告组ID
+     */
+    @Excel(name = "广告组ID", width = 15)
+    @ApiModelProperty(value = "广告组ID")
+    private Long unitId;
+    /**
+     * 地域
+     */
+    @Excel(name = "地域", width = 15)
+    @ApiModelProperty(value = "地域")
+    private String region;
+    /**
+     * 年龄最小限制
+     */
+    @Excel(name = "年龄最小限制", width = 15)
+    @ApiModelProperty(value = "年龄最小限制")
+    private Integer ageMin;
+    /**
+     * 年龄最大限制
+     */
+    @Excel(name = "年龄最大限制", width = 15)
+    @ApiModelProperty(value = "年龄最大限制")
+    private Integer ageMax;
+    /**
+     * 固定年龄段 【0:表示0-11岁】【12:表示12-17岁】【18:表示18-23岁】【24:表示24-30岁】【31:表示31-40岁】【41:表示41-49岁】【50:表示50-100岁】
+     */
+    @Excel(name = "固定年龄段 【0:表示0-11岁】【12:表示12-17岁】【18:表示18-23岁】【24:表示24-30岁】【31:表示31-40岁】【41:表示41-49岁】【50:表示50-100岁】", width = 15)
+    @ApiModelProperty(value = "固定年龄段 【0:表示0-11岁】【12:表示12-17岁】【18:表示18-23岁】【24:表示24-30岁】【31:表示31-40岁】【41:表示41-49岁】【50:表示50-100岁】")
+    private String agesRange;
+    /**
+     * 性别 1:女性, 2:男性, 0:不限
+     */
+    @Excel(name = "性别 1:女性, 2:男性, 0:不限", width = 15)
+    @ApiModelProperty(value = "性别 1:女性, 2:男性, 0:不限")
+    private Integer gender;
+    /**
+     * 操作系统 1: Android, 2: iOS, 0:不限
+     */
+    @Excel(name = "操作系统 1: Android, 2: iOS, 0:不限", width = 15)
+    @ApiModelProperty(value = "操作系统 1: Android, 2: iOS, 0:不限")
+    private Integer platformOs;
+    /**
+     * 安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;
+     */
+    @Excel(name = "安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;", width = 15)
+    @ApiModelProperty(value = "安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;")
+    private Integer androidOsv;
+    /**
+     * ios版本  6:不限, 7: 7.x+, 8: 8.x+,9: 9.x+, 10: 10.x+
+     */
+    @Excel(name = "ios版本  6:不限, 7: 7.x+, 8: 8.x+,9: 9.x+, 10: 10.x+", width = 15)
+    @ApiModelProperty(value = "ios版本  6:不限, 7: 7.x+, 8: 8.x+,9: 9.x+, 10: 10.x+")
+    private Integer iosOsv;
+    /**
+     * 网络环境 1: Wi-Fi, 2:移动网络,0:表示不限
+     */
+    @Excel(name = "网络环境 1: Wi-Fi, 2:移动网络,0:表示不限", width = 15)
+    @ApiModelProperty(value = "网络环境 1: Wi-Fi, 2:移动网络,0:表示不限")
+    private Integer network;
+    /**
+     * 设备品牌 1: OPPO, 2: VIVO,3:华为, 4:小米,5:荣耀, 6:三星,7:金立, 8:魅族,9:乐视, 10:其他,11 : 苹 果
+     */
+    @Excel(name = "设备品牌 1: OPPO, 2: VIVO,3:华为, 4:小米,5:荣耀, 6:三星,7:金立, 8:魅族,9:乐视, 10:其他,11 : 苹 果", width = 15)
+    @ApiModelProperty(value = "设备品牌 1: OPPO, 2: VIVO,3:华为, 4:小米,5:荣耀, 6:三星,7:金立, 8:魅族,9:乐视, 10:其他,11 : 苹 果")
+    private String deviceBrand;
+    /**
+     * 设备价格 1: 1500 元以下,2: 1501~2000,3: 2001~2500,4: 2501~3000,5: 3001~3500,6: 3501~4000,7: 4001~4500,8: 4501~5000,9: 5001~5500,10: 5500 元以上
+     */
+    @Excel(name = "设备价格 1: 1500 元以下,2: 1501~2000,3: 2001~2500,4: 2501~3000,5: 3001~3500,6: 3501~4000,7: 4001~4500,8: 4501~5000,9: 5001~5500,10: 5500 元以上", width = 15)
+    @ApiModelProperty(value = "设备价格 1: 1500 元以下,2: 1501~2000,3: 2001~2500,4: 2501~3000,5: 3001~3500,6: 3501~4000,7: 4001~4500,8: 4501~5000,9: 5001~5500,10: 5500 元以上")
+    private String devicePrice;
+    /**
+     * 商业兴趣类型 0:不限,2:按照兴趣标签
+     */
+    @Excel(name = "商业兴趣类型 0:不限,2:按照兴趣标签", width = 15)
+    @ApiModelProperty(value = "商业兴趣类型 0:不限,2:按照兴趣标签")
+    private Integer businessInterestType;
+    /**
+     * 商业兴趣
+     */
+    @Excel(name = "商业兴趣", width = 15)
+    @ApiModelProperty(value = "商业兴趣")
+    private String businessInterest;
+    /**
+     * 网红粉丝
+     */
+    @Excel(name = "网红粉丝", width = 15)
+    @ApiModelProperty(value = "网红粉丝")
+    private String fansStar;
+    /**
+     * 兴趣视频用户
+     */
+    @Excel(name = "兴趣视频用户", width = 15)
+    @ApiModelProperty(value = "兴趣视频用户")
+    private String interestVideo;
+    /**
+     * APP行为-按分类
+     */
+    @Excel(name = "APP行为-按分类", width = 15)
+    @ApiModelProperty(value = "APP行为-按分类")
+    private String appInterest;
+    /**
+     * APP行为-按APP名称
+     */
+    @Excel(name = "APP行为-按APP名称", width = 15)
+    @ApiModelProperty(value = "APP行为-按APP名称")
+    private String appIds;
+    /**
+     * 人群包定向
+     */
+    @Excel(name = "人群包定向", width = 15)
+    @ApiModelProperty(value = "人群包定向")
+    private String population;
+    /**
+     * 人群包排除
+     */
+    @Excel(name = "人群包排除", width = 15)
+    @ApiModelProperty(value = "人群包排除")
+    private String excludePopulation;
+    /**
+     * 0:关闭智能扩量,1:打开智能扩量
+     */
+    @Excel(name = "0:关闭智能扩量,1:打开智能扩量", width = 15)
+    @ApiModelProperty(value = "0:关闭智能扩量,1:打开智能扩量")
+    private Integer isOpen;
+    /**
+     * 不可突破年龄 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "不可突破年龄 0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "不可突破年龄 0:可突破/无需控制,1:不可突破")
+    private Integer noAgeBreak;
+    /**
+     * 不可突破性别 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "不可突破性别 0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "不可突破性别 0:可突破/无需控制,1:不可突破")
+    private Integer noGenderBreak;
+    /**
+     * 不可突破地域 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "不可突破地域 0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "不可突破地域 0:可突破/无需控制,1:不可突破")
+    private Integer noAreaBreak;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

+ 19 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTargetMapper.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手-定向信息
+ *
+ * @author: jeecg-boot
+ * @date: 2019-12-17
+ * @cersion: V1.0
+ */
+public interface KuaiShouGroupTargetMapper extends BaseMapper<KuaiShouGroupTarget> {
+
+    void replaceBatch(@Param("targets") List<KuaiShouGroupTarget> targets);
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouAppInfoMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppInfoMapper">
     <insert id="replaceBatch">
         replace into ctop_kuaishou_app_info(
-        account_id ,
+        account_id,
         unit_id,
         app_package_name,
         app_name,

+ 16 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml

@@ -9,17 +9,23 @@
         unit_id,
         unit_name,
         status,
+        put_status,
+        create_channel,
         review_detail,
         bid_type,
         bid,
         cpa_bid,
         ocpx_action_type,
+        deep_conversion_type,
+        deep_conversion_bid,
         day_budget,
         speed,
         begin_time,
         end_time,
-        schedule,
+        schedule_time,
+        scene_id,
         show_model,
+        unit_type,
         url_type,
         url,
         app_id,
@@ -28,23 +34,30 @@
         update_time)
         values
         <foreach collection="groups" item="getGroup" separator=",">
-            (#{getGroup.id},
+            (
+            #{getGroup.id},
             #{getGroup.accountId},
             #{getGroup.campaignId},
             #{getGroup.unitId},
             #{getGroup.unitName},
             #{getGroup.status},
+            #{getGroup.putStatus},
+            #{getGroup.createChannel},
             #{getGroup.reviewDetail},
             #{getGroup.bidType},
             #{getGroup.bid},
             #{getGroup.cpaBid},
             #{getGroup.ocpxActionType},
+            #{getGroup.deepConversionType},
+            #{getGroup.deepConversionBid},
             #{getGroup.dayBudget},
             #{getGroup.speed},
             #{getGroup.beginTime},
             #{getGroup.endTime},
-            #{getGroup.schedule},
+            #{getGroup.scheduleTime},
+            #{getGroup.sceneId},
             #{getGroup.showModel},
+            #{getGroup.unitType},
             #{getGroup.urlType},
             #{getGroup.url},
             #{getGroup.appId},
@@ -56,8 +69,6 @@
 
 
     <select id="selectWarningGroup" resultType="java.lang.String">
-
-
    SELECT
    unit_name
    FROM ctop_kuaishou_group

+ 67 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTargetMapper.xml

@@ -0,0 +1,67 @@
+<?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="cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper">
+
+
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_group_target(
+        account_id ,
+        unit_id,
+        region,
+        age_min,
+        age_max,
+        ages_range,
+        gender,
+        platform_os,
+        android_osv,
+        ios_osv,
+        network,
+        device_brand,
+        device_price,
+        business_interest_type,
+        business_interest,
+        fans_star,
+        interest_video,
+        app_interest,
+        app_ids,
+        population,
+        exclude_population,
+        is_open,
+        no_age_break,
+        no_gender_break,
+        no_area_break
+        )
+        values
+        <foreach collection="targets" item="targets" separator=",">
+            (
+
+            #{targets.accountId},
+            #{targets.unitId},
+            #{targets.region},
+            #{targets.ageMin},
+            #{targets.ageMax},
+            #{targets.agesRange},
+            #{targets.gender},
+            #{targets.platformOs},
+            #{targets.androidOsv},
+            #{targets.iosOsv},
+            #{targets.network},
+            #{targets.deviceBrand},
+            #{targets.devicePrice},
+            #{targets.businessInterestType},
+            #{targets.businessInterest},
+            #{targets.fansStar},
+            #{targets.interestVideo},
+            #{targets.appInterest},
+            #{targets.appIds},
+            #{targets.population},
+            #{targets.excludePopulation},
+            #{targets.isOpen},
+            #{targets.noAgeBreak},
+            #{targets.noGenderBreak},
+            #{targets.noAreaBreak}
+            )
+        </foreach>
+    </insert>
+
+</mapper>

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouRegionListChildrenMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListChildrenMapper">
     <delete id="deleteAll">
-        delete from ctop_kuaishou_region_list_children;
+        delete from ctop_kuaishou_region_list_parent;
     </delete>
 
 </mapper>

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupTargetService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+public interface IKuaiShouGroupTargetService extends IService<KuaiShouGroupTarget> {
+
+}

+ 19 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTargetServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+@Service
+public class KuaiShouGroupTargetServiceImpl extends ServiceImpl<KuaiShouGroupTargetMapper, KuaiShouGroupTarget> implements IKuaiShouGroupTargetService {
+
+}

+ 99 - 13
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -1443,41 +1443,52 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
+    @Autowired
+    private KuaiShouGroupTargetMapper groupTargetMapper;
+
     private void addGroup(Long advertiserId, JSONArray details) {
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();
             List<KuaiShouAppInfo> appInfos = new ArrayList<>();
-            List<KuaiShouSchedule> shouSchedules = new ArrayList<>();
+            List<KuaiShouSchedule> schedules = new ArrayList<>();
+            List<KuaiShouGroupTarget> targets = new ArrayList<>();
             for (int i = 0; i < details.size(); i++) {
                 JSONObject detail = JSONObject.parseObject(details.get(i).toString());
                 if (!Check.isNull(detail)) {
                     KuaiShouGroup group = new KuaiShouGroup();
+                    Long unitId = detail.getLong("unit_id");
+                    group.setId("" + advertiserId + unitId);
                     group.setAccountId(advertiserId);
-                    group.setStatus(detail.getInteger("status"));
-                    group.setBid(detail.getLong("bid"));
-                    group.setSpeed(detail.getInteger("speed"));
-                    group.setSchedule(detail.getString("schedule"));
-                    group.setUrl(detail.getString("url"));
                     group.setCampaignId(detail.getLong("campaign_id"));
-                    Long unitId = detail.getLong("unit_id");
                     group.setUnitId(unitId);
-                    group.setId("" + advertiserId + unitId);
                     group.setUnitName(detail.getString("unit_name"));
-                    group.setBidType(detail.getInteger("bid_type"));
+                    group.setStatus(detail.getInteger("status"));
+                    group.setPutStatus(detail.getInteger("put_status"));
+                    group.setCreateChannel(detail.getInteger("create_channel"));
                     group.setReviewDetail(detail.getString("review_detail"));
+                    group.setBidType(detail.getInteger("bid_type"));
+                    group.setBid(detail.getLong("bid"));
                     group.setCpaBid(detail.getLong("cpa_bid"));
                     group.setOcpxActionType(detail.getInteger("ocpx_action_type"));
+                    group.setDeepConversionType(detail.getInteger("deep_conversion_type"));
+                    group.setDeepConversionBid(detail.getLong("deep_conversion_bid"));
                     group.setDayBudget(detail.getLong("day_budget"));
+                    group.setSpeed(detail.getInteger("speed"));
                     group.setBeginTime(detail.getString("begin_time"));
                     group.setEndTime(detail.getString("end_time"));
+                    group.setScheduleTime(detail.getString("schedule_time"));
+                    group.setSceneId(detail.getJSONArray("scene_id") + "");
                     group.setShowModel(detail.getInteger("show_mode"));
+                    group.setUnitType(detail.getInteger("unit_type"));
                     group.setUrlType(detail.getInteger("url_type"));
+                    group.setUrl(detail.getString("url"));
                     group.setAppId(detail.getLong("app_id"));
                     group.setAppIconUrl(detail.getString("app_icon_url"));
                     group.setCreateTime(new Date());
                     group.setUpdateTime(new Date());
                     groups.add(group);
                     // 添加应用信息
+
                     JSONObject diverseJson = detail.getJSONObject("diverse_data");
                     if (!Check.isNull(diverseJson)) {
                         KuaiShouAppInfo appInfo = new KuaiShouAppInfo();
@@ -1505,19 +1516,94 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         schedule.setSun(scheduleJson.getJSONArray("sun").toJSONString());
                         schedule.setCreateTime(new Date());
                         schedule.setUpdateTime(new Date());
-                        shouSchedules.add(schedule);
+                        schedules.add(schedule);
+                    }
+
+                    JSONObject targetJson = detail.getJSONObject("target");
+                    if (!Check.isNull(targetJson)) {
+                        KuaiShouGroupTarget groupTarget = new KuaiShouGroupTarget();
+                        groupTarget.setAccountId(advertiserId);
+                        groupTarget.setUnitId(unitId);
+
+                        if (!Check.isNull(targetJson.getJSONArray("region"))) {
+                            groupTarget.setRegion(targetJson.getJSONArray("region").toJSONString());
+                        }
+
+                        JSONObject age = targetJson.getJSONObject("age");
+                        if (!Check.isNull(age)) {
+                            groupTarget.setAgeMin(age.getInteger("min"));
+                            groupTarget.setAgeMax(age.getInteger("max"));
+                        }
+                        if (!Check.isNull(targetJson.getJSONArray("ages_range"))) {
+                            groupTarget.setAgesRange(targetJson.getJSONArray("ages_range").toJSONString());
+                        }
+
+                        groupTarget.setGender(targetJson.getInteger("gender"));
+                        groupTarget.setPlatformOs(targetJson.getInteger("platform_os"));
+                        groupTarget.setAndroidOsv(targetJson.getInteger("android_osv"));
+                        groupTarget.setIosOsv(targetJson.getInteger("ios_osv"));
+                        groupTarget.setNetwork(targetJson.getInteger("network"));
+                        if (!Check.isNull(targetJson.getJSONArray("device_brand"))) {
+                            groupTarget.setDeviceBrand(targetJson.getJSONArray("device_brand").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("device_price"))) {
+                            groupTarget.setDevicePrice(targetJson.getJSONArray("device_price").toJSONString());
+                        }
+
+                        groupTarget.setBusinessInterestType(targetJson.getInteger("business_interest_type"));
+                        if (!Check.isNull(targetJson.getJSONArray("business_interest"))) {
+                            groupTarget.setBusinessInterest(targetJson.getJSONArray("business_interest").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("fans_star"))) {
+                            groupTarget.setFansStar(targetJson.getJSONArray("fans_star").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("interest_video"))) {
+                            groupTarget.setInterestVideo(targetJson.getJSONArray("interest_video").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("app_interest"))) {
+                            groupTarget.setAppInterest(targetJson.getJSONArray("app_interest").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("app_ids"))) {
+                            groupTarget.setAppIds(targetJson.getJSONArray("app_ids").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("population"))) {
+                            groupTarget.setPopulation(targetJson.getJSONArray("population").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("exclude_population"))) {
+                            groupTarget.setExcludePopulation(targetJson.getJSONArray("exclude_population").toJSONString());
+                        }
+
+                        JSONObject intelliExtend = targetJson.getJSONObject("intelli_extend");
+                        if (!Check.isNull(intelliExtend)) {
+                            groupTarget.setIsOpen(intelliExtend.getInteger("is_open"));
+                            groupTarget.setNoAgeBreak(intelliExtend.getInteger("no_age_break"));
+                            groupTarget.setNoGenderBreak(intelliExtend.getInteger("no_gender_break"));
+                            groupTarget.setNoAreaBreak(intelliExtend.getInteger("no_area_break"));
+
+                        }
+                        targets.add(groupTarget);
                     }
                 }
             }
             if (!Check.isNull(groups)) {
                 groupMapper.replaceBatch(groups);
             }
-            if (!Check.isNull(shouSchedules)) {
-                shouScheduleMapper.replaceBatch(shouSchedules);
+            if (!Check.isNull(schedules)) {
+                shouScheduleMapper.replaceBatch(schedules);
             }
             if (!Check.isNull(appInfos)) {
                 appInfoMapper.replaceBatch(appInfos);
             }
+            if (!Check.isNull(targets)) {
+                groupTargetMapper.replaceBatch(targets);
+            }
         }
     }
 
@@ -2041,7 +2127,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                             }
                         }
                     }
-                    log.info("获取视频信息完成,advertiserId:{},返回信息:{}", advertiserId,resultJson);
+                    log.info("获取视频信息完成,advertiserId:{},返回信息:{}", advertiserId, resultJson);
                 } else {
                     log.error("获取广告视频失败,advertiser_id:{},返回信息:{}", advertiserId, resultJson);
                 }