Parcourir la source

Merge remote-tracking branch 'origin/master'

syh il y a 5 ans
Parent
commit
491326002d
15 fichiers modifiés avec 625 ajouts et 62 suppressions
  1. 170 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PropController.java
  2. 17 29
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/OperateDetailMapper.xml
  3. 2 1
      jeecg-boot-module-system/src/main/resources/quartz.properties
  4. 33 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/entity/Prop.java
  5. 26 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/entity/PropPhoto.java
  6. 7 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/mapper/PropMapper.java
  7. 7 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/mapper/PropPhotoMapper.java
  8. 7 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/service/IPropPhotoService.java
  9. 7 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/service/IPropService.java
  10. 11 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/service/impl/PropPhotoServiceImpl.java
  11. 11 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/service/impl/PropServiceImpl.java
  12. 25 21
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  13. 9 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IBatchService.java
  14. 290 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  15. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

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

@@ -0,0 +1,170 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.manage.modules.actor.entity.*;
+import cn.com.ctop.manage.modules.actor.service.*;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author jeecg-boot
+ */
+@RestController
+@Slf4j
+@RequestMapping("/ctop/prop")
+public class PropController {
+    @Autowired
+    private IPropService propService;
+    @Autowired
+    private IPropPhotoService propPhotoService;
+
+    @ResponseBody
+    @GetMapping("/detail")
+    public Result<Prop> getDetail(@RequestParam(name = "propId") Long propId) {
+        Result<Prop> result = new Result<>();
+        Prop prop = propService.getById(propId);
+        result.setResult(prop);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     * 分页列表查询
+     *
+     * @param prop
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @GetMapping(value = "/list")
+    public Result<IPage<Prop>> queryPageList(Prop prop,
+                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                              HttpServletRequest req) {
+        Result<IPage<Prop>> result = new Result<>();
+        QueryWrapper<Prop> queryWrapper = QueryGenerator.initQueryWrapper(prop, req.getParameterMap());
+        Page<Prop> page = new Page<>(pageNo, pageSize);
+        IPage<Prop> pageList = propService.page(page, queryWrapper);
+
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    @GetMapping(value = "/photo/list")
+    public Result<IPage<PropPhoto>> queryPhotoPageList(PropPhoto propPhoto,
+                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                        HttpServletRequest req) {
+        Result<IPage<PropPhoto>> result = new Result<>();
+
+        QueryWrapper<PropPhoto> queryWrapper = QueryGenerator.initQueryWrapper(propPhoto, req.getParameterMap());
+        Page<PropPhoto> page = new Page<>(pageNo, pageSize);
+        IPage<PropPhoto> pageList = propPhotoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    @DeleteMapping(value = "/photo/delete")
+    public Result<PropPhoto> deletePhoto(@RequestParam(name = "id", required = true) String id) {
+        Result<PropPhoto> result = new Result<>();
+        PropPhoto propPhoto = propPhotoService.getById(id);
+        if (propPhoto == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = propPhotoService.removeById(id);
+            if (ok) {
+                result.success("删除成功!");
+            }
+        }
+        return result;
+    }
+
+    @PostMapping(value = "/photo/add")
+    public Result<PropPhoto> addPhoto(PropPhoto propPhoto) {
+        Result<PropPhoto> result = new Result<>();
+        try {
+            String photoUrl = propPhoto.getPhotoUrl();
+            if (!Check.isNull(photoUrl) && !photoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                propPhoto.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + photoUrl);
+            }
+            propPhotoService.save(propPhoto);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param prop
+     * @return
+     */
+    @PostMapping(value = "/add")
+    public Result<Prop> add(@RequestBody Prop prop) {
+        Result<Prop> result = new Result<>();
+        try {
+            String coverUrl = prop.getCoverUrl();
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                prop.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
+            }
+            propService.save(prop);
+            if (null != prop.getImageList() && !prop.getImageList().isEmpty()) {
+                for (String url : prop.getImageList()) {
+                    PropPhoto photo = new PropPhoto();
+                    photo.setPropId(prop.getId());
+                    if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                        photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
+                    }
+                    propPhotoService.save(photo);
+                }
+            }
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param prop
+     * @return
+     */
+    @PutMapping(value = "/edit")
+    public Result<Prop> edit(@RequestBody Prop prop) {
+        Result<Prop> result = new Result<>();
+
+        Prop propEntity = propService.getById(prop.getId());
+        if (propEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            String coverUrl = prop.getCoverUrl();
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                prop.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
+            }
+
+            boolean ok = propService.updateById(prop);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+        return result;
+    }
+}

+ 17 - 29
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/OperateDetailMapper.xml

@@ -33,46 +33,34 @@
 
     <select id="ByteDanceOperateDetailGroupAccountByDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t2.project_name AS projectName,
-        t2.auth_name AS authName,
+        (SELECT project_name from ctop_user_allocation where account_id=t1.account_id ) AS projectName,
+        (SELECT auth_name from ctop_user_allocation where account_id=t1.account_id ) AS authName,
         ROUND(sum(t1.cost), 2) cost
         FROM
-        ctop_bytedance_report_advertiser_daily t1
-        LEFT JOIN ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
+        ctop_performance_operate_detail  t1
         WHERE
-        t1.stat_datetime &gt;= #{startDate} '00:00:00'
-        AND t1.stat_datetime &lt;= #{endDate}
-        AND t1.advertiser_id IN (
-        SELECT
-        account_id
-        FROM
-        ctop_user_allocation
-        WHERE
-        user_id = #{userId}
-        AND media_id = 1
-        ) GROUP BY t2.account_id
+        t1.stat_date &gt;=#{startDate}
+        AND t1.stat_date &lt;=#{endDate}
+        and t1.user_id=#{userId}
+        and t1.media_type=1
+        GROUP BY
+        t1.account_id
     </select>
 
     <select id="kuaiShouOperateDetailGroupAccountByDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t2.project_name AS projectName,
-        t2.auth_name AS authName,
-        ROUND(sum(t1.charge), 2) cost
+        (SELECT project_name from ctop_user_allocation where account_id=t1.account_id ) AS projectName,
+        (SELECT auth_name from ctop_user_allocation where account_id=t1.account_id ) AS authName,
+        ROUND(sum(t1.cost), 2) cost
         FROM
-        ctop_kuaishou_report_daily_account t1
-        LEFT JOIN ctop_user_allocation t2 on t1.account_id=t2.account_id
+        ctop_performance_operate_detail  t1
         WHERE
         t1.stat_date &gt;=#{startDate}
         AND t1.stat_date &lt;=#{endDate}
-        AND t1.account_id IN (
-        SELECT
-        account_id
-        FROM
-        ctop_user_allocation
-        WHERE
-        user_id = #{userId}
-        AND media_id = 2
-        ) GROUP BY t2.account_id
+        and t1.user_id=#{userId}
+        and t1.media_type=2
+        GROUP BY
+            t1.account_id
     </select>
 
 </mapper>

+ 2 - 1
jeecg-boot-module-system/src/main/resources/quartz.properties

@@ -3,5 +3,6 @@ org.quartz.threadPool.threadCount=50
 org.quartz.scheduler.batchTriggerAcquisitionMaxCount=50
 org.quartz.threadPool.threadPriority=5
 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
-org.quartz.jobStore.misfireThreshold=60000
+org.quartz.jobStore.misfireThreshold=600000
 org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
+

+ 33 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/entity/Prop.java

@@ -0,0 +1,33 @@
+package cn.com.ctop.manage.modules.actor.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+@TableName("ctop_prop")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class Prop {
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    private String name;
+    private String desc;
+    private String type;
+    private String coverUrl;
+    private Integer status;
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+    @TableField(exist = false)
+    private List<String> imageList;
+}

+ 26 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/entity/PropPhoto.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.manage.modules.actor.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 lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+@Data
+@TableName("ctop_prop_photo")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PropPhoto {
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    private Long propId;
+    private String photoUrl;
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+}

+ 7 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/mapper/PropMapper.java

@@ -0,0 +1,7 @@
+package cn.com.ctop.manage.modules.actor.mapper;
+
+import cn.com.ctop.manage.modules.actor.entity.Prop;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+public interface PropMapper extends BaseMapper<Prop> {
+}

+ 7 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/mapper/PropPhotoMapper.java

@@ -0,0 +1,7 @@
+package cn.com.ctop.manage.modules.actor.mapper;
+
+import cn.com.ctop.manage.modules.actor.entity.PropPhoto;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+public interface PropPhotoMapper extends BaseMapper<PropPhoto> {
+}

+ 7 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/service/IPropPhotoService.java

@@ -0,0 +1,7 @@
+package cn.com.ctop.manage.modules.actor.service;
+
+import cn.com.ctop.manage.modules.actor.entity.PropPhoto;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+public interface IPropPhotoService extends IService<PropPhoto> {
+}

+ 7 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/service/IPropService.java

@@ -0,0 +1,7 @@
+package cn.com.ctop.manage.modules.actor.service;
+
+import cn.com.ctop.manage.modules.actor.entity.Prop;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+public interface IPropService extends IService<Prop> {
+}

+ 11 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/service/impl/PropPhotoServiceImpl.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.manage.modules.actor.service.impl;
+
+import cn.com.ctop.manage.modules.actor.entity.PropPhoto;
+import cn.com.ctop.manage.modules.actor.mapper.PropPhotoMapper;
+import cn.com.ctop.manage.modules.actor.service.IPropPhotoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PropPhotoServiceImpl extends ServiceImpl<PropPhotoMapper, PropPhoto> implements IPropPhotoService {
+}

+ 11 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/service/impl/PropServiceImpl.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.manage.modules.actor.service.impl;
+
+import cn.com.ctop.manage.modules.actor.entity.Prop;
+import cn.com.ctop.manage.modules.actor.mapper.PropMapper;
+import cn.com.ctop.manage.modules.actor.service.IPropService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PropServiceImpl extends ServiceImpl<PropMapper, Prop> implements IPropService {
+}

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

@@ -1805,63 +1805,67 @@ public class BatchController {
      * @param requestJson
      * @return
      */
-/*    @PostMapping(value = "/copyUnitUpdate")
+    @PostMapping(value = "/copyUnitUpdate")
     public Result<JSONObject> copyUnitUpdate(@RequestBody JSONObject requestJson) {
         Result<JSONObject> result = new Result<>();
         try {
+            Integer totalCount = null;
             Long accountId = requestJson.getLong("accountId");
             CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
             if (Check.isNull(oauthToken)) {
                 throw new Exception("未获取到账户信息");
             }
             JSONObject returnJson = new JSONObject();
-
-            Long unitId = requestJson.getLong("unitId");
-            kuaiShouGroupService.getGroupByUnitId(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
-            Long copyToCampaignId = requestJson.getLong("copyToCampaignId");
+            JSONObject groupJson = requestJson.getJSONObject("groupArr");
+            requestJson.remove("groupArr");
+            requestJson.remove("groupArr");
             JSONArray failArr = new JSONArray();
-            //  Integer createCount = requestJson.getInteger("createCount");
-
-
             Integer createType = requestJson.getInteger("createType");
             if (createType == 1) { //系统生成
                 // 需要获取创建条数
+                String unitName = groupJson.getString("unitName");
                 Integer createCount = requestJson.getInteger("createCount");
-                String unitName = requestJson.getString("unitName");
+                totalCount = createCount;
                 if (unitName.contains("#")) {
                     int lastIndexOf = unitName.lastIndexOf("#");
                     unitName = unitName.substring(0, lastIndexOf);
                 }
-                requestJson.remove("unitName");
                 for (int i = 0; i < createCount; i++) {
-                    String randomName = unitName + RandomUtil.verifyCodeV2() + i;
-                    requestJson.put("unitName", randomName);
-                    JSONObject createJson = batchService.createUnit(requestJson, oauthToken);
+                    String randomName = unitName + RandomUtil.verifyCode() + "_" + i;
+                    groupJson.put("unitName", randomName);
+                    requestJson.put("groupArr", groupJson);
+                    JSONObject createJson = batchService.copyUpdateUnit(requestJson, oauthToken);
                     if (createJson.getInteger("code") != 0) {
                         JSONObject errJson = new JSONObject();
                         errJson.put("message", createJson.getString("message"));
-                        returnJson.put("unitName", randomName);
+                        errJson.put("unitName", randomName);
                         failArr.add(errJson);
                     }
                 }
 
             } else if (createType == 2) { // 自定义
-                JSONArray unitNames = requestJson.getJSONArray("unitNames");
+                JSONArray unitNames = groupJson.getJSONArray("unitName");
+                groupJson.remove("unitName");
+                totalCount = unitNames.size();
                 for (int i = 0; i < unitNames.size(); i++) {
-                    String unitName = unitNames.getString(i);
-                    requestJson.put("unitName", unitName);
-                    JSONObject createJson = batchService.createUnit(requestJson, oauthToken);
+                    JSONObject nameJson = unitNames.getJSONObject(i);
+                    if (Check.isNull(nameJson)) {
+                        continue;
+                    }
+                    groupJson.put("unitName", nameJson.getString("unitName"));
+                    requestJson.put("groupArr", groupJson);
+                    JSONObject createJson = batchService.copyUpdateUnit(requestJson, oauthToken);
                     if (createJson.getInteger("code") != 0) {
                         JSONObject errJson = new JSONObject();
                         errJson.put("message", createJson.getString("message"));
-                        returnJson.put("unitName", unitName);
+                        errJson.put("unitName", nameJson.getString("unitName"));
                         failArr.add(errJson);
                     }
 
                 }
             }
 
-
+            returnJson.put("totalCount", totalCount);
             returnJson.put("failCount", failArr.size());
             returnJson.put("failInfo", failArr);
             result.setResult(returnJson);
@@ -1873,7 +1877,7 @@ public class BatchController {
             result.setMessage(e.getMessage());
         }
         return result;
-    }*/
+    }
 
 
     /**

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

@@ -60,6 +60,15 @@ public interface IBatchService {
      */
     JSONObject createUnit(JSONObject requestJson,CtopOauthToken oauthToken) throws Exception;
 
+
+    /**
+     * 批量复制修改广告组
+     *
+     * @param requestJson
+     * @return
+     */
+    JSONObject copyUpdateUnit(JSONObject requestJson, CtopOauthToken oauthToken);
+
     /**
      * 批量复制广告组
      *

+ 290 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -170,16 +170,12 @@ public class BatchServiceImpl implements IBatchService {
      */
     @Override
     public JSONObject createUnit(JSONObject requestJson, CtopOauthToken oauthToken) throws Exception {
-
-
         JSONObject unitJson = new JSONObject();
-
         Long campaignId = requestJson.getLong("campaignId");
         if (Check.isNull(campaignId)) {
             throw new Exception("请选择广告计划");
         }
 
-
         String type = requestJson.getString("type");
         if ("copy".equals(type) && !Check.isNull(type)) {
             unitJson.put("campaign_id", requestJson.getLong("copyToCampaignId"));
@@ -404,7 +400,7 @@ public class BatchServiceImpl implements IBatchService {
                     unitJson.put("unit_name", unitName);
                 }
 
-                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson,1);
+                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson, 1);
                 if (!Check.isNullMap(returnUnitMap)) {
                     Integer code = (Integer) returnUnitMap.get("code");
                     if (code == 0) {
@@ -453,6 +449,292 @@ public class BatchServiceImpl implements IBatchService {
 
 
     /**
+     * 批量创建广告组
+     *
+     * @param requestJson
+     * @return
+     */
+    @Override
+    public JSONObject copyUpdateUnit(JSONObject requestJson, CtopOauthToken oauthToken) {
+
+        JSONObject returnJson = new JSONObject();
+
+        try {
+
+
+            JSONObject unitJson = new JSONObject();
+            Long campaignId = requestJson.getLong("campaignId");
+            if (Check.isNull(campaignId)) {
+                throw new Exception("请选择广告计划");
+            }
+
+            String type = requestJson.getString("type");
+            if ("copy".equals(type) && !Check.isNull(type)) {
+                unitJson.put("campaign_id", requestJson.getLong("copyToCampaignId"));
+            } else {
+                unitJson.put("campaign_id", campaignId);
+            }
+
+
+            // 资源位置
+            JSONArray scene_id = requestJson.getJSONArray("sceneId");
+            if (!Check.isNull(scene_id)) {
+                unitJson.put("scene_id", scene_id);
+            }
+
+            // 资源创作方式
+            if (!Check.isNull(requestJson.getInteger("unitType"))) {
+                unitJson.put("unit_type", requestJson.getInteger("unitType"));
+            }
+
+            // 转化目标id
+            if (!Check.isNull(requestJson.getInteger("convertId"))) {
+                unitJson.put("convert_id", requestJson.getInteger("convertId"));
+            }
+
+            // 优先从系统应用商店下载
+            if (!Check.isNull(requestJson.getInteger("useAppMarket"))) {
+                unitJson.put("use_app_market", requestJson.getInteger("useAppMarket"));
+            }
+
+            //投放开始时间
+            if (!Check.isNull(requestJson.getString("beginTime"))) {
+                String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                boolean beginTimeBoolean = DateUtils.compare(requestJson.getString("beginTime"), nowDate);
+                if (beginTimeBoolean) {
+                    unitJson.put("begin_time", nowDate);
+                } else {
+                    unitJson.put("begin_time", requestJson.getString("beginTime"));
+                }
+            }
+            // 投放结束时间
+            if (!Check.isNull(requestJson.getString("endTime"))) {
+                unitJson.put("end_time", requestJson.getString("endTime"));
+            }
+            // 投放时间段
+            if (!Check.isNull(requestJson.getString("scheduleTime"))) {
+                unitJson.put("schedule_time", requestJson.getString("scheduleTime"));
+            }
+            // 广告组单日预算
+            if (!Check.isNull(requestJson.getLong("dayBudget"))) {
+                unitJson.put("day_budget", requestJson.getLong("dayBudget"));
+            }
+            // url类型
+            if (!Check.isNull(requestJson.getInteger("urlType"))) {
+                unitJson.put("url_type", requestJson.getInteger("urlType"));
+            }
+            // url
+            if (!Check.isNull(requestJson.getString("url"))) {
+                unitJson.put("url", requestJson.getString("url"));
+            }
+            // appId
+            if (!Check.isNull(requestJson.getLong("appId"))) {
+                unitJson.put("app_id", requestJson.getLong("appId"));
+            }
+            // 创意展现方式
+            if (!Check.isNull(requestJson.getInteger("showMode"))) {
+                unitJson.put("show_mode", requestJson.getInteger("showMode"));
+            }
+            if (!Check.isNull(requestJson.getInteger("speed"))) {
+                unitJson.put("speed", requestJson.getInteger("speed"));
+            }
+
+
+            // -----------------用户定向-----------
+            JSONObject targetJson = new JSONObject();
+
+            // 地域
+            if (!Check.isNull(requestJson.getJSONArray("region"))) {
+                targetJson.put("region", requestJson.getJSONArray("region"));
+            }
+
+            // 自定义年龄段
+            JSONArray ageArr = requestJson.getJSONArray("age");
+            if (!Check.isNull(ageArr)) {
+                JSONObject ageJson = new JSONObject();
+                ageJson.put("min", ageArr.get(0));
+                ageJson.put("max", ageArr.get(1));
+                targetJson.put("age", ageJson);
+            }
+            // 固定年龄段
+            if (!Check.isNull(requestJson.getJSONArray("agesRange"))) {
+                targetJson.put("ages_range", requestJson.getJSONArray("agesRange"));
+            }
+            // 性别
+            if (!Check.isNull(requestJson.getInteger("gender"))) {
+                targetJson.put("gender", requestJson.getInteger("gender"));
+            }
+            //操作系统
+            if (!Check.isNull(requestJson.getInteger("platformOs"))) {
+                targetJson.put("platform_os", requestJson.getInteger("platformOs"));
+            }
+            //Android版本
+            if (!Check.isNull(requestJson.getInteger("androidOsv"))) {
+                targetJson.put("android_osv", requestJson.getInteger("androidOsv"));
+            }
+            // iOS版本
+            if (!Check.isNull(requestJson.getInteger("iosOsv"))) {
+                targetJson.put("ios_osv", requestJson.getInteger("iosOsv"));
+            }
+            //网络环境
+            if (!Check.isNull(requestJson.getInteger("network"))) {
+                targetJson.put("network", requestJson.getInteger("network"));
+            }
+            //设备品牌
+            if (!Check.isNull(requestJson.getJSONArray("deviceBrand"))) {
+                targetJson.put("device_brand", requestJson.getJSONArray("deviceBrand"));
+            }
+            //设备价格
+            if (!Check.isNull(requestJson.getJSONArray("devicePrice"))) {
+                targetJson.put("device_price", requestJson.getJSONArray("devicePrice"));
+            }
+            //商业兴趣类型
+            if (!Check.isNull(requestJson.getInteger("businessInterestType"))) {
+                targetJson.put("business_interest_type", requestJson.getInteger("businessInterestType"));
+            }
+            // 商业兴趣
+            if (!Check.isNull(requestJson.getJSONArray("businessInterest"))) {
+                targetJson.put("business_interest", requestJson.getJSONArray("businessInterest"));
+            }
+            //网红粉丝
+            if (!Check.isNull(requestJson.getJSONArray("fansStar"))) {
+                targetJson.put("fans_star", requestJson.getJSONArray("fansStar"));
+            }
+            //兴趣视频用户
+            if (!Check.isNull(requestJson.getJSONArray("interestVideo"))) {
+                targetJson.put("interest_video", requestJson.getJSONArray("interestVideo"));
+            }
+            // APP行为-按分类
+            if (!Check.isNull(requestJson.getJSONArray("appInterest"))) {
+                targetJson.put("app_interest", requestJson.getJSONArray("appInterest"));
+            }
+            // APP行为-按APP名称
+            if (!Check.isNull(requestJson.getJSONArray("appIds"))) {
+                targetJson.put("app_ids", requestJson.getJSONArray("appIds"));
+            }
+            // 人群包定向
+            if (!Check.isNull(requestJson.getJSONArray("population"))) {
+                targetJson.put("population", requestJson.getJSONArray("population"));
+            }
+            // 人群包排除
+            if (!Check.isNull(requestJson.getJSONArray("excludePopulation"))) {
+                targetJson.put("exclude_population", requestJson.getJSONArray("excludePopulation"));
+            }
+
+            JSONObject intelliExtendJson = new JSONObject();
+
+            // 开启智能扩量
+            if (!Check.isNull(requestJson.getInteger("isOpen"))) {
+                intelliExtendJson.put("is_open", requestJson.getInteger("isOpen"));
+            }
+            //不可突破年龄
+            if (!Check.isNull(requestJson.getInteger("noAgeBreak"))) {
+                intelliExtendJson.put("no_age_break", requestJson.getInteger("noAgeBreak"));
+            }
+            //不可突破性别
+            if (!Check.isNull(requestJson.getInteger("noGenderBreak"))) {
+                intelliExtendJson.put("no_gender_break", requestJson.getInteger("noGenderBreak"));
+            }
+            // 不可突破地域
+            if (!Check.isNull(requestJson.getInteger("noAreaBreak"))) {
+                intelliExtendJson.put("no_area_break", requestJson.getInteger("noAreaBreak"));
+            }
+            if (!Check.isNull(intelliExtendJson)) {
+                targetJson.put("intelli_extend", intelliExtendJson);
+            }
+
+            unitJson.put("target", targetJson);
+            JSONObject groupJson = requestJson.getJSONObject("groupArr");
+            if (Check.isNull(groupJson)) {
+                throw new Exception("请输入需要创建的广告组");
+            }
+
+
+            // 创建条数
+
+            JSONArray successArr = new JSONArray();
+            JSONArray failArr = new JSONArray();
+
+            if (!Check.isNull(groupJson)) {
+
+                // 出价
+                if (!Check.isNull(groupJson.getLong("bid"))) {
+                    unitJson.put("bid", groupJson.getLong("bid"));
+                }
+                // 出价类型
+                Integer bidType = groupJson.getInteger("bidType");
+                if (!Check.isNull(bidType)) {
+                    unitJson.put("bid_type", bidType);
+                }
+                // 深度转化出价
+                if (!Check.isNull(groupJson.getLong("cpaBid"))) {
+                    unitJson.put("cpa_bid", groupJson.getLong("cpaBid"));
+                }
+                // 深度转化目标出价
+                if (!Check.isNull(groupJson.getLong("deepConversionBid"))) {
+                    unitJson.put("deep_conversion_bid", groupJson.getLong("deepConversionBid"));
+                }
+                // 深度转化目标
+                if (!Check.isNull(groupJson.getInteger("deepConversionType"))) {
+                    unitJson.put("deep_conversion_type", groupJson.getInteger("deepConversionType"));
+                }
+                // 优化目标
+                Integer ocpx_action_type = groupJson.getInteger("ocpxActionType");
+                if (!Check.isNull(ocpx_action_type)) {
+                    unitJson.put("ocpx_action_type", ocpx_action_type);
+                }
+                String unitName = groupJson.getString("unitName");
+                if (!Check.isNull(unitName)) {
+                    unitJson.put("unit_name", unitName);
+                }
+
+                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson, 1);
+
+                if (!Check.isNullMap(returnUnitMap)) {
+                    Integer code = (Integer) returnUnitMap.get("code");
+                    if (code == 0) {
+
+                        Long unitId = (Long) returnUnitMap.get("unitId");
+                        returnJson.put("code", 0);
+                        returnJson.put("unitId", unitId);
+
+                        if (!Check.isNull(type) && "copy".equals(type)) {
+                            Long copyUnitId = requestJson.getLong("copyUnitId");
+                            if (!Check.isNull(unitId) && !Check.isNull(copyUnitId)) {
+                                Thread thread = new Thread() {
+                                    @Override
+                                    public void run() {
+                                        try {
+                                            copyCreative(oauthToken.getAccountId(), unitId, copyUnitId);
+                                        } catch (Exception e) {
+                                            e.printStackTrace();
+                                        }
+                                    }
+                                };
+                                thread.start();
+                            }
+                        }
+                    } else {
+                        returnJson.put("code", -1);
+                        returnJson.put("unitName", unitName);
+                        returnJson.put("message", returnUnitMap.get("message"));
+                    }
+
+                }
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", -1);
+            returnJson.put("message", "系统异常");
+        }
+
+
+        return returnJson;
+    }
+
+
+    /**
      * 复制组
      *
      * @param
@@ -683,7 +965,7 @@ public class BatchServiceImpl implements IBatchService {
                     unitJson.put("unit_name", unitName);
                 }
 
-                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), group.getAccountId(), unitJson,1);
+                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), group.getAccountId(), unitJson, 1);
                 if (!Check.isNullMap(returnUnitMap)) {
                     Integer code = (Integer) returnUnitMap.get("code");
                     if (code == 0) {
@@ -786,7 +1068,7 @@ public class BatchServiceImpl implements IBatchService {
                 }*/
 
 
-                Map<String, Object> returnCreativeMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson,1);
+                Map<String, Object> returnCreativeMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson, 1);
                 if (!Check.isNullMap(returnCreativeMap)) {
                     Integer code = (Integer) returnCreativeMap.get("code");
                     if (code == 0) {
@@ -908,7 +1190,7 @@ public class BatchServiceImpl implements IBatchService {
                                     }
                                 }
                                 creativeJson.put("image_token", imageToken);
-                                Map<String, Object> returnUnitMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson,1);
+                                Map<String, Object> returnUnitMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson, 1);
                                 if (!Check.isNullMap(returnUnitMap)) {
                                     Integer code = (Integer) returnUnitMap.get("code");
                                     if (code == 0) {

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

@@ -1041,7 +1041,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 } else {
 
                     if (code == 500000 && count <= 4) {
-
                         adUnitCreate(accessToken, advertiserId, requestJson, count + 1);
                     }
                     log.error("创建广告信息失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson);
@@ -2907,10 +2906,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     continue;
                 }
                 var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
-                Date videoTime = videoTimeService.getVideoTime(kuaiShouVideoGet.getPhotoId(), accountId);
+               /* Date videoTime = videoTimeService.getVideoTime(kuaiShouVideoGet.getPhotoId(), accountId);
                 if (!Check.isNull(videoTime)) {
                     kuaiShouVideoGet.setUploadDate(videoTime);
-                }
+                }*/
+                kuaiShouVideoGet.setStatDate(new Date());
                 kuaiShouVideoGet.setAccountId(accountId);
                 kuaiShouVideoGet.setId(accountId + kuaiShouVideoGet.getPhotoId());
                 kuaiShouVideoGet.setCreateTime(new Date());