Bläddra i källkod

修改素材库图片上传逻辑

syh 4 år sedan
förälder
incheckning
6b49d7841c
19 ändrade filer med 133 tillägg och 216 borttagningar
  1. 8 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java
  2. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java
  3. 5 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  4. 43 18
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TagInfoController.java
  5. 1 1
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  6. 13 119
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  7. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialImageInfo.java
  8. 7 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/TagInfo.java
  9. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  10. 0 17
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  11. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageInfoService.java
  12. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  13. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ITagInfoService.java
  14. 18 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java
  15. 0 5
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  16. 9 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/TagInfoServiceImpl.java
  17. 1 7
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceTodayPlaneLoadJob.java
  18. 8 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoDailyReportLoadJob.java
  19. 12 27
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 8 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java


+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java

@@ -22,7 +22,7 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.ctop.service.IProjectMemberService;
+import org.jeecg.modules.system.service.ISysRoleService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -64,7 +64,7 @@ public class MaterialImageInfoController {
     @Autowired
     private MaterialInfoMapper materialInfoMapper;
     @Autowired
-    private IProjectMemberService memberService;
+    private ISysRoleService sysRoleService;
 
 
     @ApiOperation(value = "截屏-分页列表查询", notes = "截屏-分页列表查询")
@@ -78,7 +78,7 @@ public class MaterialImageInfoController {
         Object createTime = materialImageInfo.getCreateTime();
         materialImageInfo.setCreateTime(null);
         if (!Check.isNull(materialImageInfo.getUserId())) {
-            String roleCode = materialInfoService.getRoleCodeByUserId(materialImageInfo.getUserId());
+            String roleCode = sysRoleService.getRoleCodeByUserId(materialImageInfo.getUserId());
             if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "admin".equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
                 materialImageInfo.setUserId(null);
                 queryWrapper = QueryGenerator.initQueryWrapper(materialImageInfo, req.getParameterMap());

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

@@ -27,6 +27,7 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
+import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -196,9 +197,9 @@ public class MaterialInfoController {
         result.setResult(pageList);
         return result;
     }
+    @Autowired
+    private ISysRoleService roleService;
 
-    @AutoLog(value = "素材信息-分页列表查询")
-    @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/list")
     public Result<IPage<MaterialInfo>> queryPageList(MaterialInfo materialInfo,
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@@ -218,7 +219,7 @@ public class MaterialInfoController {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         materialInfo.setCreateTime(null);
         if (!Check.isNull(materialInfo.getUserId())) {
-            String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
+            String roleCode = roleService.getRoleCodeByUserId(materialInfo.getUserId());
             if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {
                 materialInfo.setUserId(null);
                 queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
@@ -292,10 +293,6 @@ public class MaterialInfoController {
                     material.setMediaId(project.getMediaId());
                     material.setProjectName(project.getProjectName());
                 }
-                /*JSONObject generalizationJson = materialInfoService.getGeneralizationInfo(material.getCode());
-                if (!Check.isNull(generalizationJson)) {
-                    material.setGeneralization(generaliz  ationJson);
-                }*/
 
                 QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
                 imageInfoQueryWrapper.eq("video_id", material.getCode());
@@ -338,7 +335,7 @@ public class MaterialInfoController {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
 
         if (!Check.isNull(materialInfo.getUserId())) {
-            String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
+            String roleCode = roleService.getRoleCodeByUserId(materialInfo.getUserId());
             if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
                 materialInfo.setUserId(null);
             } else {

+ 43 - 18
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TagInfoController.java

@@ -1,9 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.entity.TagCategoryInfo;
 import cn.com.ctop.common.module.entity.TagInfo;
 import cn.com.ctop.common.module.model.TagInfoTreeModel;
+import cn.com.ctop.common.module.service.ITagCategoryInfoService;
 import cn.com.ctop.common.module.service.ITagInfoService;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -43,19 +44,41 @@ public class TagInfoController {
 	  * @return
 	  */
 	 @RequestMapping(value = "/treeList", method = RequestMethod.GET)
-	 public Result<List<TagInfoTree>> list() {
-		 long start = System.currentTimeMillis();
-		 Result<List<TagInfoTree>> result = new Result<>();
+	 public Result<IPage<TagInfo>> list(@RequestParam(defaultValue = "10")Integer pageSize,@RequestParam(defaultValue = "1")Integer pageNo) {
+		 Result<IPage<TagInfo>> result = new Result<>();
 		 try {
-			 LambdaQueryWrapper<TagInfo> query = new LambdaQueryWrapper<>();
-			 query.eq(TagInfo::getDelFlag, CommonConstant.DEL_FLAG_0);
-			 query.orderByAsc(TagInfo::getTagOrder);
-			 List<TagInfo> list = tagInfoService.list(query);
-			 List<TagInfoTree> treeList = new ArrayList<>();
-			 getTreeList(treeList, list, null);
-			 result.setResult(treeList);
-			 result.setSuccess(true);
-			 log.info("======获取全部菜单数据=====耗时:" + (System.currentTimeMillis() - start) + "毫秒");
+			QueryWrapper<TagInfo> query = new QueryWrapper<>();
+		 	query.eq("del_flag", CommonConstant.DEL_FLAG_0);
+		 	query.eq("level",1);
+		 	query.orderByAsc("tag_order");
+		 	Page<TagInfo> page = new Page<>(pageNo, pageSize);
+		 	IPage<TagInfo> pageList = tagInfoService.page(page,query);
+		 	List<TagInfo>recordsLevel1 = pageList.getRecords();
+
+			 List<TagInfo>setRecordsLevel1 = new ArrayList<>();
+			 if(null!=recordsLevel1&&!recordsLevel1.isEmpty()){
+		 		for (TagInfo level1tag:recordsLevel1) {
+					if(!level1tag.isLeaf()){
+						//非叶子节点
+						List<TagInfo>recordsLevel2 = tagInfoService.getByParentId(level1tag.getId());
+						List<TagInfo>setRecordsLevel2 = new ArrayList<>();
+						if(null!=recordsLevel2&&!recordsLevel2.isEmpty()){
+							for(TagInfo level2Tag:recordsLevel2){
+								if(!level2Tag.isLeaf()){
+									List<TagInfo>recordsLevel3 = tagInfoService.getByParentId(level2Tag.getId());
+									level2Tag.setChildren(recordsLevel3);
+								}
+								setRecordsLevel2.add(level2Tag);
+							}
+						}
+						level1tag.setChildren(setRecordsLevel2);
+					}
+					setRecordsLevel1.add(level1tag);
+				}
+			}
+			pageList.setRecords(setRecordsLevel1);
+		 	result.setSuccess(true);
+		 	result.setResult(pageList);
 		 } catch (Exception e) {
 			 log.error(e.getMessage(), e);
 		 }
@@ -103,15 +126,16 @@ public class TagInfoController {
 		return result;
 	}
 
-	/**
-	  *   添加
-	 * @param tagInfo
-	 * @return
-	 */
+	@Autowired
+	private ITagCategoryInfoService tagCategoryInfoService;
 	@PostMapping(value = "/add")
 	public Result<TagInfo> add(@RequestBody TagInfo tagInfo) {
 		Result<TagInfo> result = new Result<>();
 		try {
+			TagCategoryInfo categoryInfo = tagCategoryInfoService.getById(tagInfo.getTagCategoryId());
+			if(null!=categoryInfo){
+				tagInfo.setTagCategoryName(categoryInfo.getName());
+			}
 			TagInfo getTag = tagInfoService.getByTagCode(tagInfo.getTagCode());
 			if(null!=getTag){
 				result.error500("标签编码已存在");
@@ -123,6 +147,7 @@ public class TagInfoController {
 				tagInfo.setStatus(1);
 			}
 			tagInfo.setUserId(user.getId());
+
 			int level = 1;
 			Long parentId = tagInfo.getParentId();
 			if(null!=parentId){

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

@@ -181,4 +181,4 @@ oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: /mnt/file/video/
+    download: D://mnt//image//

+ 13 - 119
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -5,28 +5,17 @@ import cn.com.ctop.check.entity.CtopCheckTaskList;
 import cn.com.ctop.check.service.ICtopCheckTaskListService;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UReportSubscriber;
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
 import cn.com.ctop.common.module.entity.UserAllocation;
-import cn.com.ctop.common.module.message.handle.impl.EmailSendMsgHandle;
-import cn.com.ctop.common.module.service.*;
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
-import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
-import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
-import cn.com.ctop.oa.modules.service.IWechatDepartmentService;
-import cn.com.ctop.oa.modules.service.IWechatUserListService;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -37,9 +26,6 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import java.io.File;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -59,86 +45,26 @@ public class SampleTest {
     @Autowired
     private IReportService reportService;
     @Autowired
-    private IUserAllocationService userAllocationService;
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
     @Autowired
-    private IKuaiShouDailyReportTaskService dailyReportTaskService;
-    private IBytedanceReportService bytedanceReportService;
+    private IMaterialImageInfoService imageInfoService;
     @Test
     public void loadBytedanceMatData(){
         executorService = Executors.newFixedThreadPool(5);
         List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
-//        for(int i=14;i<45;i++){
-//            Date getDate2 = DateUtils.addDay(new Date(), -i);
-            String date2 = DateUtils.formatDate(new Date());
-            for (CtopOauthToken token:tokens) {
-                //获取头条素材报表两天前的数据
-//                XxlJobLogger.log("账户"+token.getAccountId() + "素材报表数据任务开始,任务时间:" + date2 + "~" + date2);
-                reportService.getAdvertiserPlanReport(token,new Date(),new Date(),CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-//                XxlJobLogger.log("账户"+token.getAccountId() + "素材报表数据任务完成,任务时间:" + date2 + "~" + date2);
-//            }
+        for (CtopOauthToken token:tokens) {
+            reportService.getAdvertiserPlanReport(token,new Date(),new Date(),CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
         }
     }
 
     @Test
-    public void loadBytedanceCreativeData() {
-        UserAllocation allocation = userAllocationService.getByAccountId(1648083559613447L);
-        CtopOauthToken token = oauthTokenService.getTokenByAccountId(1648083559613447L);
-//        advertiserDataService.getAdvertiserPlan(token, "", null, null);
-        List<ByteDanceAdvertisePlan> plans = advertisePlanService.getAllPlans(token.getAccountId(),DateUtils.formatDate(new Date()));
-        if(null!=plans&&!plans.isEmpty()){
-            for (ByteDanceAdvertisePlan plan:plans) {
-                Map<String, Object> creativeDetail = creativeService.getCreativeDetail(token.getAccountId(), plan.getId());
-                if(null!=creativeDetail.get("data")){
-                    JSONObject data = (JSONObject) creativeDetail.get("data");
-                    checkMonitorLink(data,plan,allocation);
-                }
-            }
+    public void initImageCode(){
+        List<MaterialImageInfo> imageInfos = imageInfoService.list();
+        for (MaterialImageInfo image:imageInfos) {
+            imageInfoService.initImageCode(image);
         }
     }
 
-    private void checkMonitorLink(JSONObject data, ByteDanceAdvertisePlan plan, UserAllocation allocation) {
-        String downloadUrl = plan.getDownloadUrl();
-        boolean errorflag = false;
-        String errorMsg = "";
-        String token = plan.getName().split("-")[0];
-        String tokenInfo = "surl_token="+token;
-        String appType = plan.getAppType();
-
-    @Autowired
-    private IWechatDepartmentService wechatDepartment;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-    @Autowired
-    private IWechatUserListService wechatUserInfoService;
-    @Autowired
-    private IWechatCheckinDataService wechatCheckinDataService;
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-
-
-    @Test
-    public void getDepartment() throws ParseException {
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse1 = simpleDateFormat.parse("2020-09-12");
-        Date parse2 = simpleDateFormat.parse("2020-09-17");
-        for (CtopOauthToken token : tokens) {
-
-            kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse1, parse2);
-
-        }
-
-    //    wechatCheckinDataService.getCheckinData();
-        //  wechatUserInfoService.getUserList();
-        // wechatDepartment.getDepartment();
-        // kuaishouInterfaceService.getSuZaoList("a34853c230e1b949eddbe569023dbc40", 7022550L, 1, "2020-09-15", "2020-09-16");
-
-    }
-
 
     @Test
     public void loadBytedanceCreativeData() {
@@ -181,7 +107,6 @@ public class SampleTest {
     }
 
     static ExecutorService executorService = null;
-    //线程计数器/bytedance/bytedanceMaterialReport
     static CountDownLatch countDownLatch = null;
 
     @Test
@@ -269,40 +194,9 @@ public class SampleTest {
         for(int i=2;i<100;i++){
             String date = DateUtils.formatDate(DateUtils.addDay(new Date(),-i));
             for (CtopOauthToken token:tokens) {
-                bytedanceReportService.bytedanceVideoMaterialReport(token, date, date);
+//                bytedanceReportService.bytedanceVideoMaterialReport(token, date, date);
             }
         }
     }
 
-    @Autowired
-    IUReportExportService uReportExportService;
-    @Autowired
-    EmailSendMsgHandle emailSendMsgHandle;
-    @Autowired
-    IUReportService uReportService;
-
-    @Test
-    public void sendUReport() {
-        uReportService.uReportList().forEach(uReport -> {
-            List<UReportSubscriber> uReportSubscriber = uReportService.getUReportSubscriberByFileId(uReport.getString("id"));
-            if (!uReportSubscriber.isEmpty()) {
-                String title = uReport.getString("name").replace(".ureport.xml", "");
-                String content = "您订阅的日报在附件中请注意查收》》》";
-                //下载文件到本地
-                uReportExportService.exportExcel(uReport.getString("name"));
-                uReportSubscriber.forEach(sender -> {
-                    emailSendMsgHandle.SendAttachment("bijiequan@c-top.com.cn", title, content,
-                            new File(System.getProperty("user.dir") + File.separator + "uReport" + File.separator + uReport.getString("name").replace("ureport.xml", "") + "xlsx"));
-                });
-            }
-        });
-        //发完全部订阅,删除文件
-        File file = new File(System.getProperty("user.dir") + File.separator + "uReport");
-        File[] files = file.listFiles();
-        if (files != null && files.length > 0) {
-            for (File f : files) {
-                f.delete();
-            }
-        }
-    }
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialImageInfo.java

@@ -44,7 +44,7 @@ public class MaterialImageInfo {
      */
     @Excel(name = "url", width = 15)
     @ApiModelProperty(value = "url")
-    private Object url;
+    private String url;
     /**
      * 素材名称
      */

+ 7 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/TagInfo.java

@@ -11,6 +11,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 标签信息
@@ -28,8 +29,8 @@ public class TagInfo {
 	private Long id;
 	@Dict(dicCode = "id",dictTable="ctop_tag_info",dicText="tag_name")
 	private Long parentId;
-	@Dict(dicCode = "id",dictTable="ctop_tag_category",dicText="name")
 	private Long tagCategoryId;
+	private String tagCategoryName;
 	@Dict(dicCode = "id",dictTable="ctop_tag_info",dicText="tag_name")
 	private Long firstTagId;
 	@Dict(dicCode = "id",dictTable="ctop_tag_info",dicText="tag_name")
@@ -48,4 +49,9 @@ public class TagInfo {
 	private boolean leaf;
 	private Date createTime;
 	private Date updateTime;
+
+	@TableField(exist = false)
+	List<TagInfo> children;
+
+
 }

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

@@ -21,8 +21,6 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
 
     Integer selectCountByMap(Map<String, Object> requestMap);
 
-    String getRoleCodeByUserId(@Param("userId") String userId);
-
     Integer getKuaishouUpVideoCount(@Param("code") String code);
 
     Integer getToutiaoUpVideoCount(@Param("code") String code);

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

@@ -33,23 +33,6 @@
 
     </select>
 
-    <select id="getRoleCodeByUserId" resultType="java.lang.String">
-   SELECT
-    role_code
-    FROM
-    sys_role
-    WHERE
-    id = (
-    SELECT
-    t2.role_id
-    FROM
-    sys_user t1
-    LEFT JOIN sys_user_role t2 ON t1.id = t2.user_id
-    WHERE
-    t1.id = #{userId,jdbcType=VARCHAR}
-    )
-    </select>
-
     <select id="getKuaishouUpVideoCount" resultType="java.lang.Integer">
         select
         count(1)

+ 2 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageInfoService.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.MaterialImageInfo;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -28,4 +27,6 @@ public interface IMaterialImageInfoService extends IService<MaterialImageInfo> {
     List<String> getCodeList();
 
     List<JSONObject> getUrlList(String videoId);
+
+    void initImageCode(MaterialImageInfo image);
 }

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

@@ -38,8 +38,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     JSONObject report(String userId);
 
-    String getRoleCodeByUserId(String userId);
-
     void watermarkVideo(String materialId, Long videoWatermarkTemplateId, String userId);
 
     void getFile(MaterialInfo materialInfo, String mediaId);

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/ITagInfoService.java

@@ -17,4 +17,6 @@ public interface ITagInfoService extends IService<TagInfo> {
     List<TagInfoTreeModel> queryTreeList(String userId,Long CategoryId);
 
     TagInfo getByTagCode(String tagCode);
+
+    List<TagInfo> getByParentId(Long id);
 }

+ 18 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java

@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.MD5Util;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -21,6 +22,7 @@ import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -59,7 +61,6 @@ public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoM
                 if (!Check.isNull(json)) {
                     MaterialImageInfo materialImageInfo = new MaterialImageInfo();
                     materialImageInfo.setVideoId(videoId);
-                    materialImageInfo.setCode(json.getString("code"));
                     materialImageInfo.setMaterialDescribe(json.getString("materialDescribe"));
                     materialImageInfo.setType("IMAGE");
                     String url = "https:" + json.getString("url");
@@ -68,6 +69,8 @@ public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoM
                     materialImageInfo.setStatus(0);
                     materialImageInfo.setUserId(userId);
                     String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
+                    String md5Code = MD5Util.getFileMd5(localUrl);
+                    materialImageInfo.setCode(md5Code);
                     File picture = new File(localUrl);
                     BufferedImage sourceImg = null;
                     try {
@@ -126,4 +129,18 @@ public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoM
         return materialImageInfoMapper.getUrlList(videoId);
     }
 
+    @Override
+    public void initImageCode(MaterialImageInfo image) {
+        String localUrl = LoadFileUtil.downLoadFromUrl(image.getUrl(), downloadUrl);
+        String md5Code = null;
+        try {
+            md5Code = MD5Util.getFileMd5(localUrl);
+            image.setCode(md5Code);
+            image.setUpdateTime(new Date());
+            this.saveOrUpdate(image);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
 }

+ 0 - 5
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -376,11 +376,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public String getRoleCodeByUserId(String userId) {
-        return materialInfoMapper.getRoleCodeByUserId(userId);
-    }
-
-    @Override
     public void getFile(MaterialInfo materialInfo, String mediaId) {
         uploadExecutorService.submit(new Runnable() {
             @Override

+ 9 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/TagInfoServiceImpl.java

@@ -45,4 +45,13 @@ public class TagInfoServiceImpl extends ServiceImpl<TagInfoMapper, TagInfo> impl
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
     }
+
+    @Override
+    public List<TagInfo> getByParentId(Long parentId) {
+        QueryWrapper<TagInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("parent_id",parentId);
+        queryWrapper.eq("del_flag",0);
+        queryWrapper.orderByAsc("tag_order");
+        return this.list(queryWrapper);
+    }
 }

+ 1 - 7
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceTodayPlaneLoadJob.java

@@ -3,8 +3,6 @@ package cn.com.ctop.job.bytedance.handler;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;
@@ -26,13 +24,9 @@ import java.util.concurrent.Executors;
 public class BytedanceTodayPlaneLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(15);
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
-    private IByteDanceCampaignService campaignService;
-    @Autowired
-    private IByteDanceCreativeService creativeService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(15);
 
     @XxlJob("bytedanceTodayPlaneLoadJob")
     public ReturnT<String> execute(String params) throws Exception {

+ 8 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoDailyReportLoadJob.java

@@ -0,0 +1,8 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class BytedanceVideoDailyReportLoadJob {
+
+}

+ 12 - 27
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -239,26 +239,17 @@
         where status = 0
     </select>
     <select id="bytedanceImageCost" resultType="cn.com.ctop.toutiao.modules.report.DTO.ImageCostVO">
-        select
-            a.statDate,
-            a.signature,
-            group_concat(distinct a.projectName) as 'projectName',
-            a.imageUrl as 'imageUrl',
-            round(sum(a.cost), 2)       as 'cost',
-            sum(a.click)                as 'click',
-            sum(a.showNum)              as 'showNum',
-            sum(a.convert)            as 'convert'
-        from (select
-                report.cost as 'cost',
-                report.click as 'click',
-                report.show_material as 'showNum',
-                report.convert_material as 'convert',
-                (select image_url from ctop_bytedance_image_info where material_id = report.material_id limit 1)       as 'imageUrl',
-                (select signature from ctop_bytedance_image_info where material_id = report.material_id)               as 'signature',
-                allocation.project_name as 'projectName',
-                report.stat_datetime as 'statDate'
+        select round(sum(report.cost),2)                              as 'cost',
+        sum(report.click)                                             as 'click',
+        sum(report.show_material)                                     as 'showNum',
+        sum(report.convert_material)                                  as 'convert',
+        imageInfo.image_url                                           as 'imageUrl',
+        imageInfo.signature                                           as 'signature',
+        group_concat(distinct allocation.project_name)                as 'projectName',
+        report.stat_datetime                                          as 'statDate'
             from ctop_bytedance_report_material_daily report
             left join ctop_user_allocation allocation on allocation.account_id = report.account_id
+            left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
         where
         1=1
         <if test="startDate!=null">
@@ -273,17 +264,11 @@
                 #{accountId}
             </foreach>
         </if>
-        and image_mode not in (
-        'CREATIVE_IMAGE_MODE_VIDEO',
-        'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL',
-        'MATERIAL_IMAGE_MODE_TITLE')
-        ) a
-        where 1=1
         <if test="code!=null">
-            and a.signature = #{code}
+            and imageInfo.signature = #{code}
         </if>
-        group by a.signature
-        order by sum(a.cost) desc
+        group by imageInfo.signature
+        order by sum(report.cost) desc
     </select>
     <select id="getVideoVoByDate" resultType="cn.com.ctop.toutiao.modules.material.vo.BytedanceVideoVo">
         select