Browse Source

V1.1.3 自动投放 批量同步素材

yumeng 4 years ago
parent
commit
81fefbde32

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

@@ -15,6 +15,7 @@ import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
+import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
@@ -36,8 +37,6 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.InputStream;
 import java.math.BigDecimal;
@@ -119,9 +118,23 @@ public class TestController {
     private IBindAccountAuthService bindAccountAuthService;
     @Autowired
     private UserAllocationMapper allocationMapper;
+    @Autowired
+    private IMaterialUploadService materialUploadService;
+
+    @GetMapping("/uploadVideo")
+    public String uploadVideo(Long projectId) {
+        //  832
+        JSONArray idList = materialInfoService.getIdListByProject(projectId);
+        JSONArray accountArray = new JSONArray();
+        accountArray.add(9864909L);
+
+        materialUploadService.uploadAccount("2", idList, accountArray, "2e3b982046a44b5faadaa77a7c0da114");
+        return "success";
+    }
+
 
     @GetMapping("/testKuaishou")
-    public String kuaishouCallback( @RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
+    public String kuaishouCallback(@RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
         try {
             JSONObject json = JSONObject.parseObject(state);
             if (Check.isNull(json)) {
@@ -231,8 +244,8 @@ public class TestController {
 
 
     @GetMapping("/getBytedanceMatReport")
-    public Map<String,Object>getData(){
-        List<BytedanceAccountReportTaskRecord>  records = reportTaskRecordService.listByParams(100,"ACCOUNT_DAILY");
+    public Map<String, Object> getData() {
+        List<BytedanceAccountReportTaskRecord> records = reportTaskRecordService.listByParams(100, "ACCOUNT_DAILY");
         executorService = Executors.newFixedThreadPool(1);
         CountDownLatch countDownLatch = new CountDownLatch(records.size());
         records.forEach(record -> executorService.submit(() -> {
@@ -240,7 +253,7 @@ public class TestController {
 //                reportService.getAdvertiserReport(record, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
 //                log.info("账户数据获取完成:account:{},时间:{}-{}",record.getAccountId(),record.getStartDate(),record.getEndDate());
                 bytedanceReportService.bytedanceMaterialReportV2(record);
-                log.info("素材数据获取完成:account:{},时间:{}-{}",record.getAccountId(),record.getStartDate(),record.getEndDate());
+                log.info("素材数据获取完成:account:{},时间:{}-{}", record.getAccountId(), record.getStartDate(), record.getEndDate());
             } catch (Exception e) {
 
             } finally {
@@ -258,8 +271,8 @@ public class TestController {
         bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
         bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
         bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
-        Map<String,Object> result =  new HashMap<>();
-        ResultMapUtils.setResultMap(new HashMap<>(),StatusCode.COMMON_SUCCESS);
+        Map<String, Object> result = new HashMap<>();
+        ResultMapUtils.setResultMap(new HashMap<>(), StatusCode.COMMON_SUCCESS);
         return result;
     }
 

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -36,4 +37,6 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
     List<MaterialInfo> getListByDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
 
     List<MaterialInfo> getListByParams(@Param("tagCode")String tagCode,@Param("type")String type, @Param("status")Integer status, @Param("projectIds")List<Long> projectIds, @Param("materialName")String materialName, @Param("code")String code, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("userId")String userId);
+
+    JSONArray getIdListByProject(Long projectId);
 }

+ 6 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -52,7 +52,6 @@
     </select>
 
 
-
     <select id="getEffiSignature" resultType="string">
         select
         efficient_video_signature
@@ -135,5 +134,11 @@
         and DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= #{endDate}
     </select>
 
+    <select id="getIdListByProject" resultType="java.lang.String">
+        select id  from  ctop_material_info
+        where project_id = #{projectId}
+        and status != 2
+
+    </select>
 
 </mapper>

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.apache.ibatis.annotations.Param;
@@ -78,4 +79,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     List<MaterialInfo> getListByDate(String startDate, String endDate);
 
     Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize);
+
+    JSONArray getIdListByProject(Long projectId);
 }

+ 7 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -52,6 +52,8 @@ import static cn.com.ctop.common.module.utils.CloudVideoProcessUtil.videoWaterma
 @Service
 public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, MaterialInfo> implements IMaterialInfoService {
 
+    @Autowired
+    private MaterialInfoMapper materialInfoMapper;
     private static ExecutorService uploadExecutorService = Executors.newFixedThreadPool(5);
 
     @Resource
@@ -59,8 +61,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     @Resource
     private IVideoWatermarkTaskService videoWatermarkTaskService;
     @Autowired
-    private MaterialInfoMapper materialInfoMapper;
-    @Autowired
     private MaterialParameterMapper materialParameterMapper;
     @Autowired
     private MaterialAscriptionMapper materialAscriptionMapper;
@@ -828,6 +828,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
+
+    @Override
+    public JSONArray getIdListByProject(Long projectId) {
+        return materialInfoMapper.getIdListByProject(projectId);
+    }
 }