Przeglądaj źródła

Merge branch 'master' into video-dev

hcst_sunzhen 5 lat temu
rodzic
commit
aaf7ea93d2
100 zmienionych plików z 2271 dodań i 1121 usunięć
  1. 13 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/SystemDateConstant.java
  2. 21 6
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/LoginUser.java
  3. 56 31
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  4. 8 9
      jeecg-boot-module-system/pom.xml
  5. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  6. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/config/MybatisPlusConfig.java
  7. 0 67
      jeecg-boot-module-system/src/main/java/org/jeecg/config/RabbitConfig.java
  8. 112 118
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  9. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/config/WebMvcConfiguration.java
  10. 29 24
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  11. 6 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  12. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialCutFrameController.java
  13. 44 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  14. 50 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTopCtrl.java
  15. 61 16
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PangolinController.java
  16. 26 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  17. 3 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  18. 151 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  19. 14 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  20. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Advertiser.java
  21. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Project.java
  22. 59 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/CutFrameJob.java
  23. 27 30
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoDelete.java
  24. 47 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoLoginJob.java
  25. 2 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCrawlerJob.java
  26. 37 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/MaterialReportAccountUpdateJob.java
  27. 10 342
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/OceanengineJob.java
  28. 1 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/PangolinDataJob.java
  29. 2 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/PangolinLoginJob.java
  30. 20 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MaterialTopMapper.java
  31. 207 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialTopMapper.xml
  32. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICreateInternalService.java
  33. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IMaterialTopService.java
  34. 2 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CrawlerServiceImpl.java
  35. 26 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  36. 56 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialTopServiceImpl.java
  37. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  38. 24 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vo/MaterialTopVO.java
  39. 17 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouXxlEntity.java
  40. 0 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Receiver.java
  41. 0 27
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Sender.java
  42. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/CornerCheck.java
  43. 144 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/ExtractionVideoKeyFrames.java
  44. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/Perspective.java
  45. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictController.java
  46. 94 30
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  47. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java
  48. 28 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml
  49. 5 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysCategoryService.java
  50. 96 84
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
  51. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysCategoryServiceImpl.java
  52. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
  53. 1 6
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  54. 2 5
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  55. 19 19
      jeecg-boot-module-system/src/main/resources/application-test.yml
  56. 1 0
      jeecg-boot-module-system/src/main/resources/application.yml
  57. 0 1
      jeecg-boot-module-system/src/main/resources/static/demo1.html
  58. 128 44
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  59. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/constant/CtopRoleCodeConstant.java
  60. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/constant/OssConstant.java
  61. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java
  62. 3 3
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialCutFrame.java
  63. 63 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialCutFrameTask.java
  64. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  65. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/BindAccountLoginMapper.java
  66. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialCutFrameTaskMapper.java
  67. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  68. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SysRoleMapper.java
  69. 34 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/BindAccountLoginMapper.xml
  70. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialCutFrameTaskMapper.xml
  71. 8 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  72. 0 16
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysRoleMapper.xml
  73. 19 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IBindAccountLoginService.java
  74. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialCutFrameService.java
  75. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialCutFrameTaskService.java
  76. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  77. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  78. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java
  79. 114 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java
  80. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CorpWeixinServiceImpl.java
  81. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopCorpWexinUserServiceImpl.java
  82. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  83. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  84. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/IpPoolServiceImpl.java
  85. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MailLogServiceImpl.java
  86. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialAscriptionServiceImpl.java
  87. 119 61
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java
  88. 19 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameTaskServiceImpl.java
  89. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java
  90. 27 17
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  91. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialParameterServiceImpl.java
  92. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagServiceImpl.java
  93. 5 6
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/RefreshTokenServiceImpl.java
  94. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysRoleServiceImpl.java
  95. 41 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  96. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoMergeTaskServiceImpl.java
  97. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoPartServiceImpl.java
  98. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoWatermarkTaskServiceImpl.java
  99. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoWatermarkTemplateServiceImpl.java
  100. 0 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/CtopAdConstant.java

+ 13 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/SystemDateConstant.java

@@ -0,0 +1,13 @@
+package org.jeecg.common.constant;
+
+public class SystemDateConstant {
+
+    //系統年月日时间格式
+    public static String yyyy_MM_dd="yyyy-MM-dd";
+
+    public static String yyyy_MM="yyyy-MM";
+
+    //系统数据起始时间
+    public static String BEGIN_TIME="2019-09-01";
+
+}

+ 21 - 6
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/LoginUser.java

@@ -1,14 +1,12 @@
 package org.jeecg.common.system.vo;
 
-import java.util.Date;
-
-import org.springframework.format.annotation.DateTimeFormat;
-
 import com.fasterxml.jackson.annotation.JsonFormat;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  * <p>
@@ -73,11 +71,28 @@ public class LoginUser {
 	 * 状态(1:正常 2:冻结 )
 	 */
 	private Integer status;
-	
+
 	private String delFlag;
 	/**
      * 同步工作流引擎1同步0不同步
      */
     private String activitiSync;
 
+	@Override
+	public String toString() {
+		return "LoginUser{" +
+				"id='" + id + '\'' +
+				", username='" + username + '\'' +
+				", realname='" + realname + '\'' +
+				", orgCode='" + orgCode + '\'' +
+				", avatar='" + avatar + '\'' +
+				", birthday=" + birthday +
+				", sex=" + sex +
+				", email='" + email + '\'' +
+				", phone='" + phone + '\'' +
+				", status=" + status +
+				", delFlag='" + delFlag + '\'' +
+				", activitiSync='" + activitiSync + '\'' +
+				'}';
+	}
 }

+ 56 - 31
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1,5 +1,7 @@
 package org.jeecg.common.util;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.util.StringUtils;
 
 import java.beans.PropertyEditorSupport;
@@ -17,6 +19,9 @@ import java.util.*;
  * @Version 1.0
  */
 public class DateUtils extends PropertyEditorSupport {
+
+    private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
+
     /**
      * 以毫秒表示的时间
      */
@@ -236,7 +241,7 @@ public class DateUtils extends PropertyEditorSupport {
         Date dt = new Date();
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String nowTime = df.format(dt);
-        java.sql.Timestamp buydate = java.sql.Timestamp.valueOf(nowTime);
+        Timestamp buydate = Timestamp.valueOf(nowTime);
         return buydate;
     }
 
@@ -779,10 +784,6 @@ public class DateUtils extends PropertyEditorSupport {
         return sdf.format(calendar.getTime());
     }
 
-    //public static void main(String[] args) throws ParseException {
-    //    System.out.println(DateUtils.addDay( "2020-01-03",  7));
-    //}
-
     public static Date addDay(Date date, int day) {
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
@@ -880,10 +881,15 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
 
-    public static String getMonthBefore(String format, String nowTime, int amount) throws ParseException {
+    public static String getMonthBefore(String format, String nowTime, int amount) {
         // 获取当前时间
         SimpleDateFormat dateFormat = new SimpleDateFormat(format);
-        Date date = dateFormat.parse(nowTime);
+        Date date = null;
+        try {
+            date = dateFormat.parse(nowTime);
+        } catch (ParseException e) {
+            logger.error(e.getMessage(), e);
+        }
 
         //得到日历
         Calendar calendar = Calendar.getInstance();
@@ -1207,10 +1213,9 @@ public class DateUtils extends PropertyEditorSupport {
      * @param dateEnd
      * @return
      */
-    public static long getDiscrepantDays(String dateStart, String dateEnd){
+    public static long getDiscrepantDays(String dateStart, String dateEnd) {
         //设置转换的日期格式
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-
         //结束时间
         Date startDate = null;
         Date endDate = null;
@@ -1221,32 +1226,27 @@ public class DateUtils extends PropertyEditorSupport {
         } catch (ParseException e) {
             e.printStackTrace();
         }
-
         //得到相差的天数 betweenDate
-        long betweenDate = (endDate.getTime() - startDate.getTime())/(60*60*24*1000);
-
-        //打印控制台相差的天数
-        System.out.println(betweenDate);
-        return betweenDate;
+        return (endDate.getTime() - startDate.getTime()) / (60 * 60 * 24 * 1000);
     }
 
     /***
      * 两个日期之间间隔的月数(不考虑日期的情况)
      */
-    public static int calDiffMonth(Date start, Date end){
+    public static int calDiffMonth(Date start, Date end) {
         GregorianCalendar startCalendar = new GregorianCalendar();
         startCalendar.setTime(start);
         GregorianCalendar endCalendar = new GregorianCalendar();
         endCalendar.setTime(end);
 
-        int startYear=startCalendar.get(Calendar.YEAR);
-        int startMonth=startCalendar.get(Calendar.MONTH)+1;
-        int startDay=startCalendar.get(Calendar.DAY_OF_MONTH);
-        int endYear=endCalendar.get(Calendar.YEAR);
-        int endMonth=endCalendar.get(Calendar.MONTH)+1;
-        int endDay=endCalendar.get(Calendar.DAY_OF_MONTH);
+        int startYear = startCalendar.get(Calendar.YEAR);
+        int startMonth = startCalendar.get(Calendar.MONTH) + 1;
+        int startDay = startCalendar.get(Calendar.DAY_OF_MONTH);
+        int endYear = endCalendar.get(Calendar.YEAR);
+        int endMonth = endCalendar.get(Calendar.MONTH) + 1;
+        int endDay = endCalendar.get(Calendar.DAY_OF_MONTH);
 
-        return (endYear-startYear)*12 + (endMonth - startMonth);
+        return (endYear - startYear) * 12 + (endMonth - startMonth);
     }
 
     public static int getDaysOfMonth(int year, int month) {
@@ -1263,11 +1263,12 @@ public class DateUtils extends PropertyEditorSupport {
 
     /**
      * 获取指定日期下个月的第一天
+     *
      * @param dateStr
      * @param format
      * @return
      */
-    public static Map<String, String> getMaxMinDaysOfAddMonth(String dateStr,String format, int addMonth){
+    public static Map<String, String> getMaxMinDaysOfAddMonth(String dateStr, String format, int addMonth) {
         SimpleDateFormat sdf = new SimpleDateFormat(format);
         Map<String, String> dateMap = new HashMap<>();
         try {
@@ -1275,7 +1276,7 @@ public class DateUtils extends PropertyEditorSupport {
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(date);
             calendar.add(Calendar.MONTH, addMonth);
-            calendar.set(Calendar.DAY_OF_MONTH,1);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
             dateMap.put("startDate", sdf.format(calendar.getTime()));
 
             calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DATE));
@@ -1287,7 +1288,8 @@ public class DateUtils extends PropertyEditorSupport {
         return null;
     }
 
-    public static int dateDiff(String start, String end){
+
+    public static int dateDiff(String start, String end) {
         //设置转换的日期格式
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         //开始时间
@@ -1301,18 +1303,41 @@ public class DateUtils extends PropertyEditorSupport {
         }
 
         //得到相差的天数 betweenDate
-        long betweenDate = (endDate.getTime() - startDate.getTime())/(60*60*24*1000);
-        return (int)betweenDate;
+        long betweenDate = (endDate.getTime() - startDate.getTime()) / (60 * 60 * 24 * 1000);
+        return (int) betweenDate;
     }
 
-    public static Date addMonth(Date date){
+    public static Date addMonth(Date date) {
         Calendar calendar = Calendar.getInstance();//日历对象
         calendar.add(Calendar.MONTH, -1);//月份减一
         return calendar.getTime();
     }
 
-    public static void main(String[] args) {
-        System.out.println(dateDiff("2020-05-26","2020-05-27"));
+
+    public static List<Date> findDates(Date dBegin, Date dEnd) {
+        List<Date> lDate = new ArrayList<Date>();
+        lDate.add(dBegin);
+        Calendar calBegin = Calendar.getInstance();
+        // 使用给定的 Date 设置此 Calendar 的时间
+        calBegin.setTime(dBegin);
+        Calendar calEnd = Calendar.getInstance();
+        // 使用给定的 Date 设置此 Calendar 的时间
+        calEnd.setTime(dEnd);
+        // 测试此日期是否在指定日期之后
+        while (dEnd.after(calBegin.getTime())) {
+            // 根据日历的规则,为给定的日历字段添加或减去指定的时间量
+            calBegin.add(Calendar.DAY_OF_MONTH, 1);
+            lDate.add(calBegin.getTime());
+        }
+        return lDate;
+    }
+
+
+    public static void main(String[] args) throws ParseException {
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String s = DateUtils.addDay(nowDate, -180);
+        System.err.println(nowDate);
+        System.err.println(s);
     }
 
 }

+ 8 - 9
jeecg-boot-module-system/pom.xml

@@ -41,12 +41,6 @@
     </repositories>
 
     <dependencies>
-        <!-- rabbitmq 依赖jar包-->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-amqp</artifactId>
-            <version>1.5.2.RELEASE</version>
-        </dependency>
         <dependency>
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-boot-base-common</artifactId>
@@ -130,9 +124,9 @@
             <version>3.17</version>
         </dependency>
         <dependency>
-        <groupId>org.apache.poi</groupId>
-        <artifactId>poi-ooxml-schemas</artifactId>
-        <version>3.17</version>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml-schemas</artifactId>
+            <version>3.17</version>
         </dependency>
 
         <dependency>
@@ -151,6 +145,11 @@
             <artifactId>opencv</artifactId>
             <version>4.2.0</version>
         </dependency>
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper</artifactId>
+            <version>5.1.11</version>
+        </dependency>
     </dependencies>
 
     <dependencyManagement>

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java

@@ -1,6 +1,7 @@
 package org.jeecg;
 
 import cn.com.ctop.common.module.utils.SpringUtils;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -43,4 +44,10 @@ public class JeecgApplication {
         return new RestTemplate();
     }
 
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        return new PaginationInterceptor();
+    }
+
+
 }

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/config/MybatisPlusConfig.java

@@ -1,6 +1,7 @@
 package org.jeecg.config;
 
 import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -11,17 +12,17 @@ import org.springframework.context.annotation.Configuration;
  *
  */
 @Configuration
-@MapperScan(value = {"org.jeecg.modules.**.mapper*", "cn.com.ctop.**.mapper*", "cn.com.ctop.bytedance.mapper*"})
+@MapperScan(value = {"org.jeecg.modules.**.mapper*", "cn.com.ctop.**.mapper*"})
 
 public class MybatisPlusConfig {
 
     /**
          *  分页插件
      */
-    @Bean
+    /*@Bean
     public PaginationInterceptor paginationInterceptor() {
         return new PaginationInterceptor();
-    }
+    }*/
 
 //    /**
 //     * mybatis-plus SQL执行效率插件【生产环境可以关闭】
@@ -31,5 +32,4 @@ public class MybatisPlusConfig {
 //        return new PerformanceInterceptor();
 //    }
 
-
 }

+ 0 - 67
jeecg-boot-module-system/src/main/java/org/jeecg/config/RabbitConfig.java

@@ -1,67 +0,0 @@
-package org.jeecg.config;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.core.Queue;
-import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
-import org.springframework.amqp.rabbit.connection.ConnectionFactory;
-import org.springframework.amqp.rabbit.core.RabbitTemplate;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
-
-@Configuration
-@Slf4j
-public class RabbitConfig {
-    @Value("${spring.rabbitmq.host}")
-    private String host;
-
-    @Value("${spring.rabbitmq.port}")
-    private int port;
-
-    @Value("${spring.rabbitmq.username}")
-    private String username;
-
-    @Value("${spring.rabbitmq.password}")
-    private String password;
-
-
-    public static final String EXCHANGE_A = "my-mq-exchange_A";
-    public static final String EXCHANGE_B = "my-mq-exchange_B";
-    public static final String EXCHANGE_C = "my-mq-exchange_C";
-
-
-    public static final String QUEUE_A = "QUEUE_A";
-    public static final String QUEUE_B = "QUEUE_B";
-    public static final String QUEUE_C = "QUEUE_C";
-
-    public static final String ROUTINGKEY_A = "spring-boot-routingKey_A";
-    public static final String ROUTINGKEY_B = "spring-boot-routingKey_B";
-    public static final String ROUTINGKEY_C = "spring-boot-routingKey_C";
-
-    @Bean
-    public ConnectionFactory connectionFactory() {
-        CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host, port);
-        connectionFactory.setUsername(username);
-        connectionFactory.setPassword(password);
-        connectionFactory.setVirtualHost("/");
-        connectionFactory.setPublisherConfirms(true);
-        return connectionFactory;
-    }
-
-    /**
-     * 必须是prototype类型
-     */
-    @Bean
-    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-    public RabbitTemplate rabbitTemplate() {
-        RabbitTemplate template = new RabbitTemplate(connectionFactory());
-        return template;
-    }
-
-    @Bean
-    public Queue helloQueue() {
-        return new Queue("hello");
-    }
-}

+ 112 - 118
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -28,20 +28,20 @@ import java.util.Map;
 @Configuration
 public class ShiroConfig {
 
-	/**
-	 * Filter Chain定义说明
-	 *
-	 * 1、一个URL可以配置多个Filter,使用逗号分隔
-	 * 2、当设置多个过滤器时,全部验证通过,才视为通过
-	 * 3、部分过滤器可指定参数,如perms,roles
-	 */
-	@Bean("shiroFilter")
-	public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
-		ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
-		shiroFilterFactoryBean.setSecurityManager(securityManager);
-		// 拦截器
-		Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
-		// 配置不会被拦截的链接 顺序判断
+    /**
+     * Filter Chain定义说明
+     * <p>
+     * 1、一个URL可以配置多个Filter,使用逗号分隔
+     * 2、当设置多个过滤器时,全部验证通过,才视为通过
+     * 3、部分过滤器可指定参数,如perms,roles
+     */
+    @Bean("shiroFilter")
+    public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
+        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
+        shiroFilterFactoryBean.setSecurityManager(securityManager);
+        // 拦截器
+        Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
+        // 配置不会被拦截的链接 顺序判断
         //登录接口排除
         filterChainDefinitionMap.put("/sys/login", "anon");
         filterChainDefinitionMap.put("/sys/wxlogin", "anon");
@@ -70,67 +70,61 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/sys/common/download/**", "anon");
         //pdf预览
         filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");
-		filterChainDefinitionMap.put("/ctop/bytedanceAreaInfo/**", "anon");
-		filterChainDefinitionMap.put("/ctop/bytedanceInterestCategory/**", "anon");
-		filterChainDefinitionMap.put("/template/creative/words/get", "anon");
-		filterChainDefinitionMap.put("/appium/crawler/*", "anon");
+        filterChainDefinitionMap.put("/ctop/bytedanceAreaInfo/**", "anon");
+        filterChainDefinitionMap.put("/ctop/bytedanceInterestCategory/**", "anon");
+        filterChainDefinitionMap.put("/template/creative/words/get", "anon");
+        filterChainDefinitionMap.put("/appium/crawler/*", "anon");
 
         filterChainDefinitionMap.put("/ctop/kuaishouChannelRegInfo/*", "anon");
 
 
-		//优化师相关
-		//filterChainDefinitionMap.put("/ctop/performanceOptimizer/detail", "anon");
-		//filterChainDefinitionMap.put("/ctop/performanceOptimizer/ranking/list", "anon");
-		//filterChainDefinitionMap.put("/ctop/performance/project/list", "anon");
-		//filterChainDefinitionMap.put("/ctop/performance/account/list", "anon");
-		//filterChainDefinitionMap.put("/ctop/optimizerRoleInfo/manager/detail", "anon");
-
+        filterChainDefinitionMap.put("/ctop/byteDance/homePage/report/*", "anon");
+        filterChainDefinitionMap.put("/ctop/material/top/cost", "anon");
 
         filterChainDefinitionMap.put("/generic/**", "anon");
-		filterChainDefinitionMap.put("/", "anon");
-		filterChainDefinitionMap.put("/doc.html", "anon");
-		filterChainDefinitionMap.put("/**/*.js", "anon");
-		filterChainDefinitionMap.put("/**/*.css", "anon");
-		filterChainDefinitionMap.put("/**/*.html", "anon");
-		filterChainDefinitionMap.put("/**/*.svg", "anon");
-		filterChainDefinitionMap.put("/**/*.jpg", "anon");
-		filterChainDefinitionMap.put("/**/*.png", "anon");
-		filterChainDefinitionMap.put("/**/*.ico", "anon");
-		filterChainDefinitionMap.put("/druid/**", "anon");
-		filterChainDefinitionMap.put("/swagger-ui.html", "anon");
-		filterChainDefinitionMap.put("/swagger**/**", "anon");
-		filterChainDefinitionMap.put("/webjars/**", "anon");
-		filterChainDefinitionMap.put("/v2/**", "anon");
+        filterChainDefinitionMap.put("/", "anon");
+        filterChainDefinitionMap.put("/doc.html", "anon");
+        filterChainDefinitionMap.put("/**/*.js", "anon");
+        filterChainDefinitionMap.put("/**/*.css", "anon");
+        filterChainDefinitionMap.put("/**/*.html", "anon");
+        filterChainDefinitionMap.put("/**/*.svg", "anon");
+        filterChainDefinitionMap.put("/**/*.jpg", "anon");
+        filterChainDefinitionMap.put("/**/*.png", "anon");
+        filterChainDefinitionMap.put("/**/*.ico", "anon");
+        filterChainDefinitionMap.put("/druid/**", "anon");
+        filterChainDefinitionMap.put("/swagger-ui.html", "anon");
+        filterChainDefinitionMap.put("/swagger**/**", "anon");
+        filterChainDefinitionMap.put("/webjars/**", "anon");
+        filterChainDefinitionMap.put("/v2/**", "anon");
         filterChainDefinitionMap.put("/kuaishou", "anon");
         filterChainDefinitionMap.put("/kuaishou/report", "anon");
-		filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
-		filterChainDefinitionMap.put("/**/*.mp4", "anon");
-
+        filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
+        filterChainDefinitionMap.put("/**/*.mp4", "anon");
 
-		//性能监控
-		filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
-		filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
-		filterChainDefinitionMap.put("/actuator/redis/**", "anon");
+        //性能监控
+        filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
+        filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
+        filterChainDefinitionMap.put("/actuator/redis/**", "anon");
         //消息队列
         filterChainDefinitionMap.put("/mq/**", "anon");
         //模板测试
         filterChainDefinitionMap.put("/test/**", "anon");
-		//oauth接口
+        //oauth接口
         filterChainDefinitionMap.put("/auth/**", "anon");
-		filterChainDefinitionMap.put("/ctop/syncdata/**", "anon");
-		//头条接口
+        filterChainDefinitionMap.put("/ctop/syncdata/**", "anon");
+        //头条接口
         filterChainDefinitionMap.put("/bytedance", "anon");
-		filterChainDefinitionMap.put("/toutiao/dictitem/list", "anon");
+        filterChainDefinitionMap.put("/toutiao/dictitem/list", "anon");
         filterChainDefinitionMap.put("/toutiao/loadAllData", "anon");
         filterChainDefinitionMap.put("/toutiao/loadSingleData", "anon");
-		filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");
-		filterChainDefinitionMap.put("/toutiao/advertiser/**", "anon");
+        filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");
+        filterChainDefinitionMap.put("/toutiao/advertiser/**", "anon");
         filterChainDefinitionMap.put("/toutiao/industry/list", "anon");
         filterChainDefinitionMap.put("/template/bytedance/industry/list", "anon");
         filterChainDefinitionMap.put("/template/convert/list", "anon");
-		filterChainDefinitionMap.put("/template/convert/list/url", "anon");
+        filterChainDefinitionMap.put("/template/convert/list/url", "anon");
         //文件上传接口
-		filterChainDefinitionMap.put("/upload/**", "anon");
+        filterChainDefinitionMap.put("/upload/**", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
 
         filterChainDefinitionMap.put("/system/userCompany/**", "anon");
@@ -139,72 +133,72 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/test/getVideoAndImage/**", "anon");
         filterChainDefinitionMap.put("/test/gerCreative/**", "anon");
 
-		filterChainDefinitionMap.put("/report/kuaishouReportDailyAgent/get","anon");
+        filterChainDefinitionMap.put("/report/kuaishouReportDailyAgent/get", "anon");
 
-		filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
-		filterChainDefinitionMap.put("/zip/download", "anon");
-		//爬虫接口
-		filterChainDefinitionMap.put("/graphql/video", "anon");
-		filterChainDefinitionMap.put("/ks/web/test", "anon");
+        filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
+        filterChainDefinitionMap.put("/zip/download", "anon");
+        //爬虫接口
+        filterChainDefinitionMap.put("/graphql/video", "anon");
+        filterChainDefinitionMap.put("/ks/web/test", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
         filterChainDefinitionMap.put("/ctop/advertiser/**", "anon");
-		filterChainDefinitionMap.put("/pangolin/**", "anon");
-
-		// 添加自己的过滤器并且取名为jwt
-		Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
-		filterMap.put("jwt", new JwtFilter());
-		shiroFilterFactoryBean.setFilters(filterMap);
-		// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边
-		filterChainDefinitionMap.put("/**", "jwt");
-
-		// 未授权界面返回JSON
-		shiroFilterFactoryBean.setUnauthorizedUrl("/sys/common/403");
-		shiroFilterFactoryBean.setLoginUrl("/sys/common/403");
-		shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
-		return shiroFilterFactoryBean;
-	}
-
-	@Bean("securityManager")
-	public DefaultWebSecurityManager securityManager(ShiroRealm myRealm) {
-		DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
-		securityManager.setRealm(myRealm);
-
-		/*
-		 * 关闭shiro自带的session,详情见文档
-		 * http://shiro.apache.org/session-management.html#SessionManagement-
-		 * StatelessApplications%28Sessionless%29
-		 */
-		DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
-		DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
-		defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
-		subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
-		securityManager.setSubjectDAO(subjectDAO);
-
-		return securityManager;
-	}
-
-	/**
-	 * 下面的代码是添加注解支持
-	 * @return
-	 */
-	@Bean
-	@DependsOn("lifecycleBeanPostProcessor")
-	public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
-		DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
-		defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
-		return defaultAdvisorAutoProxyCreator;
-	}
-
-	@Bean
-	public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
-		return new LifecycleBeanPostProcessor();
-	}
-
-	@Bean
-	public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
-		AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
-		advisor.setSecurityManager(securityManager);
-		return advisor;
-	}
+
+        // 添加自己的过滤器并且取名为jwt
+        Map<String, Filter> filterMap = new HashMap<>(1);
+        filterMap.put("jwt", new JwtFilter());
+        shiroFilterFactoryBean.setFilters(filterMap);
+        // <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边
+        filterChainDefinitionMap.put("/**", "jwt");
+
+        // 未授权界面返回JSON
+        shiroFilterFactoryBean.setUnauthorizedUrl("/sys/common/403");
+        shiroFilterFactoryBean.setLoginUrl("/sys/common/403");
+        shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
+        return shiroFilterFactoryBean;
+    }
+
+    @Bean("securityManager")
+    public DefaultWebSecurityManager securityManager(ShiroRealm myRealm) {
+        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
+        securityManager.setRealm(myRealm);
+
+        /*
+         * 关闭shiro自带的session,详情见文档
+         * http://shiro.apache.org/session-management.html#SessionManagement-
+         * StatelessApplications%28Sessionless%29
+         */
+        DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
+        DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
+        defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
+        subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
+        securityManager.setSubjectDAO(subjectDAO);
+
+        return securityManager;
+    }
+
+    /**
+     * 下面的代码是添加注解支持
+     *
+     * @return
+     */
+    @Bean
+    @DependsOn("lifecycleBeanPostProcessor")
+    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
+        DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+        defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
+        return defaultAdvisorAutoProxyCreator;
+    }
+
+    @Bean
+    public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
+        return new LifecycleBeanPostProcessor();
+    }
+
+    @Bean
+    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
+        AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
+        advisor.setSecurityManager(securityManager);
+        return advisor;
+    }
 
 }

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/config/WebMvcConfiguration.java

@@ -33,10 +33,10 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
 	@Value("${spring.resource.static-locations}")
 	private String staticLocations;
 
-	@Override
-	public void addInterceptors(InterceptorRegistry registry) {
-		registry.addInterceptor(browseLogHandelInterceptor);
-	}
+//	@Override
+//	public void addInterceptors(InterceptorRegistry registry) {
+//		registry.addInterceptor(browseLogHandelInterceptor);
+//	}
 
 	@Bean
 	public CorsFilter corsFilter() {

+ 29 - 24
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
@@ -27,11 +28,9 @@ import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.vo.SheetInfoVo;
 import org.jeecg.modules.excelutil.entity.KuaishouXxlEntity;
 import org.jeecg.modules.system.entity.SysCategory;
-import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.entity.UserCompany;
 import org.jeecg.modules.system.mapper.UserCompanyMapper;
 import org.jeecg.modules.system.service.ISysCategoryService;
-import org.jeecg.modules.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -80,7 +79,7 @@ public class AdvertiserController {
         try {
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             QueryWrapper<Advertiser> queryWrapper = new QueryWrapper<>();
-            if (!"admin".equals(roleCode)) {
+            if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
                 QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
                 userCompanyQueryWrapper.eq("user_id", userId);
                 userCompanyQueryWrapper.orderByDesc("create_time");
@@ -114,13 +113,14 @@ public class AdvertiserController {
                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                    @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
                                                    HttpServletRequest req) {
-
         Result<IPage<Advertiser>> result = new Result<>();
         String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
         String userId = advertiser.getUserId();
-        if ("admin".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
             advertiser.setUserId(null);
         }
+        String industryId = advertiser.getIndustryId();
+        advertiser.setIndustryId(null);
         QueryWrapper<Advertiser> queryWrapper = QueryGenerator.initQueryWrapper(advertiser, req.getParameterMap());
         if ("kuaishouOperationManager".equals(roleCode)) {
             QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
@@ -132,32 +132,19 @@ public class AdvertiserController {
                 queryWrapper.eq("company_id", userCompany.getCompanyId());
             }
         }
-        Page<Advertiser> page = new Page<>(pageNo, pageSize);
-        IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
-        if (pageList != null && pageList.getRecords() != null && !pageList.getRecords().isEmpty()) {
-            List<Advertiser> list = new ArrayList<>();
-            for (int i = 0; i < pageList.getRecords().size(); i++) {
-                Advertiser advertiserRecord = pageList.getRecords().get(i);
-                SysCategory sysCategory = sysCategoryService.getById(advertiserRecord.getIndustryId());
-                if (sysCategory != null) {
-                    advertiserRecord.setIndustryId(sysCategory.getName());
-                }
-                SysUser user = sysUserService.getById(advertiserRecord.getSaleId());
-                if (null != user) {
-                    advertiserRecord.setSaleName(user.getRealname());
-                }
-                list.add(advertiserRecord);
+        if(null!=industryId&&!"".equals(industryId.trim())){
+            SysCategory category = sysCategoryService.getById(industryId);
+            if(null!=category){
+                queryWrapper.likeRight("industry_code",category.getCode());
             }
-            pageList.setRecords(list);
         }
+        Page<Advertiser> page = new Page<>(pageNo, pageSize);
+        IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
     }
 
-    @Autowired
-    private ISysUserService sysUserService;
-
     /**
      * 添加
      *
@@ -191,6 +178,14 @@ public class AdvertiserController {
             if (!Check.isNull(userCompany)) {
                 advertiser.setCompanyId(userCompany.getCompanyId());
             }
+            String industryId = advertiser.getIndustryId();
+            if(null!=industryId&&!"".equals(industryId.trim())){
+                SysCategory category = sysCategoryService.getById(industryId);
+                if(null!=category){
+                    advertiser.setIndustryId(category.getId());
+                    advertiser.setIndustryCode(category.getCode());
+                }
+            }
             advertiserService.save(advertiser);
             result.success("添加成功!");
         } catch (Exception e) {
@@ -218,6 +213,14 @@ public class AdvertiserController {
         if (advertiserEntity == null) {
             result.error500("未找到对应实体");
         } else {
+            String industryId = advertiser.getIndustryId();
+            if(null!=industryId&&!"".equals(industryId.trim())){
+                SysCategory category = sysCategoryService.getById(industryId);
+                if(null!=category){
+                    advertiser.setIndustryId(category.getId());
+                    advertiser.setIndustryCode(category.getCode());
+                }
+            }
             boolean ok = advertiserService.updateById(advertiser);
             QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>();
             projectQueryWrapper.eq("advertiser_id", advertiser.getId());
@@ -382,6 +385,7 @@ public class AdvertiserController {
                 }
             }
         }
+
         List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
         if (null != allocations && !allocations.isEmpty()) {
             for (UserAllocation allocation : allocations) {
@@ -417,6 +421,7 @@ public class AdvertiserController {
                 }
             }
         }
+
         List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
         if (null != allocations && !allocations.isEmpty()) {
             for (UserAllocation allocation : allocations) {

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

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.StringUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -64,22 +65,23 @@ public class BindAccountLoginController {
         String loginType = json.getString("loginType");
         // 广告主名称
         String advertiserName = json.getString("advertiser_name");
+        //项目id
+        Long projectId = json.getLong("projectId");
         //账号
         String accountName = json.getString("accountName");
         String password = json.getString("password");
-        Map<String, Object> stringObjectMap = createInternalService.bindLogin(advertiserId, accountName, password, loginType, userId, advertiserName);
+        Map<String, Object> stringObjectMap = createInternalService.bindLogin(projectId,advertiserId, accountName, password, loginType, userId, advertiserName);
         Boolean trueOrFalse = (Boolean) stringObjectMap.get("success");
-        if (Boolean.TRUE.equals(trueOrFalse)) {
+        if (Boolean.TRUE.equals(trueOrFalse)&&!loginType.equals(CtopAdConstant.PLATFORM_TYPE_PANGOLIN_PY)) {
             Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("account_name", accountName);
             deleteMap.put("user_id", userId);
             deleteMap.put("advertiser_id", advertiserId);
             userAllocationMapper.deleteByMap(deleteMap);
             Long accountId = (Long) stringObjectMap.get("accountId");
+            String mediaId = json.getString("mediaId");
             String userName = json.getString("userName");
             // 媒体类型: 1 头条 2 快手
-            String mediaId = json.getString("mediaId");
-            Long projectId = json.getLong("projectId");
             String projectName = json.getString("projectName");
             String systemType = json.getString("systemType");
             UserAllocation userAllocation = new UserAllocation();

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

@@ -51,6 +51,7 @@ public class MaterialCutFrameController {
                                                          HttpServletRequest req) {
         Result<IPage<MaterialCutFrame>> result = new Result<IPage<MaterialCutFrame>>();
         QueryWrapper<MaterialCutFrame> queryWrapper = QueryGenerator.initQueryWrapper(materialCutFrame, req.getParameterMap());
+        queryWrapper.orderByAsc("image_index");
         Page<MaterialCutFrame> page = new Page<MaterialCutFrame>(pageNo, pageSize);
         IPage<MaterialCutFrame> pageList = materialCutFrameService.page(page, queryWrapper);
         result.setSuccess(true);
@@ -58,6 +59,7 @@ public class MaterialCutFrameController {
         return result;
     }
 
+
     /**
      * 添加
      *

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

@@ -1,8 +1,8 @@
 package org.jeecg.modules.ctop.controller;
 
 
-import cn.com.ctop.common.module.entity.MaterialImageInfo;
-import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
+import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.JsonUtil;
@@ -25,6 +25,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 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.entity.Project;
 import org.jeecg.modules.ctop.service.IKuaiShouUploadService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
@@ -169,7 +170,7 @@ public class MaterialInfoController {
         materialInfo.setCreateTime(null);
         if (!Check.isNull(materialInfo.getUserId())) {
             String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
-            if ("admin".equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
+            if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
                 materialInfo.setUserId(null);
                 queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
             } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
@@ -233,12 +234,17 @@ public class MaterialInfoController {
                     material.setKuaiShou(JSONObject.parseObject(kuaiShouString));
                 }
 
+
+                Project project = projectService.getById(material.getProjectId());
+                if (!Check.isNull(project)) {
+                    material.setMediaId(project.getMediaId());
+                    material.setProjectName(project.getProjectName());
+                }
                 /*JSONObject generalizationJson = materialInfoService.getGeneralizationInfo(material.getCode());
                 if (!Check.isNull(generalizationJson)) {
-                    material.setGeneralization(generalizationJson);
+                    material.setGeneralization(generaliz  ationJson);
                 }*/
 
-
                 QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
                 imageInfoQueryWrapper.eq("video_id", material.getCode());
                 imageInfoQueryWrapper.eq("status", 0);
@@ -336,7 +342,29 @@ public class MaterialInfoController {
                 materialInfo.setUrl(url);
             }
 
+            //  修改素材库 相关联code
+            if (!Check.isNull(materialInfo.getCode())) {
+                String code = materialInfoEntity.getCode();
+                if (!Check.isNull(code)) {
+                    MaterialTag updateMaterialTag = new MaterialTag();
+                    updateMaterialTag.setMaterialId(materialInfo.getCode());
+                    QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
+                    tagQueryWrapper.eq("material_id", code);
+                    materialTagService.update(updateMaterialTag, tagQueryWrapper);
+                    MaterialParameter updateParameter = new MaterialParameter();
+                    updateParameter.setMaterialId(materialInfo.getCode());
+                    QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                    parameterQueryWrapper.eq("material_id", code);
+                    materialParameterService.update(updateParameter, parameterQueryWrapper);
+                    MaterialAscription updateMaterialAscription = new MaterialAscription();
+                    updateMaterialAscription.setMaterialId(materialInfo.getCode());
+                    QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
+                    ascriptionQueryWrapper.eq("material_id", code);
+                    materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
+                }
+            }
 
+            //  审核通过自动同步到到媒体后台
            /* Long projectId = materialInfoEntity.getProjectId();
             Project project = projectService.getById(projectId);
             if (!Check.isNull(projectId)) {
@@ -358,7 +386,6 @@ public class MaterialInfoController {
 
             }*/
 
-
             boolean ok = materialInfoService.updateById(materialInfo);
             if (ok) {
                 result.success("修改成功!");
@@ -381,16 +408,18 @@ public class MaterialInfoController {
     @DeleteMapping(value = "/delete")
     public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
+            MaterialInfo materialInfo = materialInfoService.getById(id);
+            if (!Check.isNull(materialInfo)) {
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("material_id", materialInfo.getCode());
+                materialAscriptionService.removeByMap(deleteMap);
+                materialParameterService.removeByMap(deleteMap);
+                materialTagService.removeByMap(deleteMap);
+                Map<String, Object> deleteWatermarkMap = new HashMap<>();
+                deleteWatermarkMap.put("video_id", id);
+                watermarkTaskService.removeByMap(deleteWatermarkMap);
+            }
             materialInfoService.removeById(id);
-            Map<String, Object> deleteMap = new HashMap<>();
-            deleteMap.put("material_id", id);
-            materialAscriptionService.removeByMap(deleteMap);
-            materialParameterService.removeByMap(deleteMap);
-            materialTagService.removeByMap(deleteMap);
-            Map<String, Object> deleteWatermarkMap = new HashMap<>();
-            deleteWatermarkMap.put("video_id", id);
-            watermarkTaskService.removeByMap(deleteWatermarkMap);
-
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");

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

@@ -0,0 +1,50 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.ctop.service.IMaterialTopService;
+import org.jeecg.modules.ctop.vo.MaterialTopVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *  Created by JQ.bi on 2020.5.21
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/material")
+public class MaterialTopCtrl {
+
+    @Autowired
+    IMaterialTopService materialTopService;
+
+    @PostMapping("/top/cost")
+    public Result<IPage<MaterialTopVO>> getCostTop(@RequestBody JSONObject requestBody,
+                                                   @RequestParam(defaultValue = "cost") String target,
+                                                   @RequestParam(defaultValue = "desc") String order,
+                                                   @RequestParam(defaultValue = "1") int pageNo,
+                                                   @RequestParam(defaultValue = "10") int pageSize) {
+        Result<IPage<MaterialTopVO>> result = new Result<>();
+        if(requestBody.isEmpty()){
+            log.error("request body is empty");
+            result.setSuccess(false);
+        }
+        try {
+            String startDate= requestBody.getString("startDate");
+            String endDate= requestBody.getString("endDate");
+            if(startDate.isEmpty()||endDate.isEmpty()){
+                log.error("startDate or endDate is empty");
+                result.setSuccess(false);
+            }
+            IPage<MaterialTopVO> voiPage = materialTopService.selectByPage(endDate, startDate, target, order, pageNo, pageSize);
+            result.setResult(voiPage);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+            result.setSuccess(false);
+        }
+        return result;
+    }
+}

+ 61 - 16
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PangolinController.java

@@ -1,14 +1,15 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinReportAppHourService;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinReportBillMonthService;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinReportChannelDailyService;
-import cn.com.ctop.crawler.modules.pangolin.vo.PangolinReportAppMonthVO;
+import cn.com.ctop.common.module.vo.PangolinReportAppMonthVO;
+import cn.com.ctop.crawler.modules.pangolin.service.*;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -28,17 +29,63 @@ public class PangolinController {
     @Autowired
     private PangolinReportBillMonthService pangolinReportBillMonthService;
     @Autowired
+    private PangolinAppService pangolinAppService;
+    @Autowired
+    private PangolinChannelService pangolinChannelService;
+    @Autowired
     private ISysRoleService sysRoleService;
+
+    @PostMapping("api/channel/list")
+    public Map<String, Object> channelList(@RequestBody JSONObject data) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
+            userId = null;
+        }
+        return pangolinChannelService.getListByUserId(userId);
+    }
+
+    @PostMapping("api/app/list")
+    public Map<String, Object> appList(@RequestBody JSONObject data) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
+            userId = null;
+        }
+        return pangolinAppService.getListByUserId(userId,data);
+    }
+
+
+    @PostMapping("api/memberList")
+    public Map<String,Object> memberList(){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            String userId = user.getId();
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            if (null!=roleCode&&CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
+                userId = null;
+            }
+            resultMap = pangolinAppService.getMemberList(userId);
+            return resultMap;
+        } catch (Exception e) {
+            ResultMapUtils.setResultMap(resultMap,StatusCode.COMMON_SERVER_ERROR);
+            return resultMap;
+        }
+    }
+
+
     /**
      * 实时数据
      */
     @PostMapping("api/realtime")
     public Map<String, Object> realTime(@RequestBody JSONObject data) {
-//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        String userId = user.getId();
-        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-        if(null!=roleCode&&(roleCode.equals("admin"))){
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
             userId = null;
         }
         return pangolinReportAppHourService.getRealTimeData(userId,data);
@@ -49,11 +96,10 @@ public class PangolinController {
      */
     @PostMapping("api/activation/list")
     public Map<String, Object> activationList(@RequestBody JSONObject data) {
-//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        String userId = user.getId();
-        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-        if(null!=roleCode&&(roleCode.equals("admin"))){
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
             userId = null;
         }
         return pangolinReportChannelDailyService.getActivationList(userId, data);
@@ -65,11 +111,10 @@ public class PangolinController {
     @PostMapping("/api/checkApps/list")
     public Map<String,Object> checkAppList(@RequestBody JSONObject data) {
         Map<String,Object> result = new HashMap<>();
-        //        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        String userId = user.getId();
-        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-        if(null!=roleCode&&(roleCode.equals("admin"))){
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
             userId = null;
         }
         PageInfo<PangolinReportAppMonthVO> pageInfo = pangolinReportBillMonthService.checkAppList(userId, data);

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
@@ -25,7 +26,9 @@ import org.jeecg.modules.ctop.service.IAdvertiserService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.service.ITransferAccountService;
+import org.jeecg.modules.system.entity.SysCategory;
 import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysCategoryService;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -61,7 +64,6 @@ public class ProjectController {
     private IUserAllocationService userAllocationService;
 
     /**
-     *
      * @param advertiserId
      * @param mediaId
      * @return
@@ -99,7 +101,7 @@ public class ProjectController {
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
         List<Project> projects = new ArrayList<>();
-        if (!"admin".equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
+        if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
             if ("designTeamLeader".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "planeLeader".equals(roleCode)) {
                 QueryWrapper<ProjectMember> memberQueryWrapper = new QueryWrapper<>();
                 memberQueryWrapper.eq("user_id", userId);
@@ -151,6 +153,8 @@ public class ProjectController {
         return map;
     }
 
+    @Autowired
+    private ISysCategoryService sysCategoryService;
 
     /**
      * 分页列表查询
@@ -169,14 +173,22 @@ public class ProjectController {
                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                 HttpServletRequest req) {
         Result<IPage<Project>> result = new Result<>();
+        String industryId = project.getIndustryId();
+        project.setIndustryId(null);
         QueryWrapper<Project> queryWrapper = QueryGenerator.initQueryWrapper(project, req.getParameterMap());
         Page<Project> page = new Page<>(pageNo, pageSize);
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
-        if (!("admin".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode))) {
+        if (!(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode))) {
             queryWrapper.eq("user_id", sysUser.getId());
             queryWrapper.orderByDesc("create_time");
         }
+        if(null!=industryId&&!"".equals(industryId.trim())){
+            SysCategory category = sysCategoryService.getById(industryId);
+            if(null!=category){
+                queryWrapper.likeRight("industry_code",category.getCode());
+            }
+        }
         IPage<Project> pageList = projectService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -203,7 +215,11 @@ public class ProjectController {
             Map<String, String> memberMap = new HashMap<>();
             if (!Check.isNull(advertiser)) {
                 project.setCompanyId(advertiser.getCompanyId());
-
+            }
+            SysCategory category = sysCategoryService.getById(project.getIndustryId());
+            if(null!=category){
+                project.setIndustryCode(category.getCode());
+                project.setIndustryId(category.getId());
             }
             SysUser sysUser = sysUserService.getById(project.getResponsibleId());
             if (!Check.isNull(sysUser)) {
@@ -266,6 +282,11 @@ public class ProjectController {
             projectMemberService.addMember(sysUser, project);
         }
 
+        SysCategory category = sysCategoryService.getById(project.getIndustryId());
+        if(null!=category){
+            project.setIndustryCode(category.getCode());
+            project.setIndustryId(category.getId());
+        }
         SysUser designSysUser = sysUserService.getById(project.getDesignResponsibleId());
         if (!Check.isNull(designSysUser)) {
             project.setDesignResponsibleName(designSysUser.getRealname());
@@ -287,6 +308,7 @@ public class ProjectController {
             userAllocationQueryWrapper.eq("project_id", project.getId());
             UserAllocation updateUserAllocation = new UserAllocation();
             updateUserAllocation.setProjectName(project.getProjectName());
+           // updateUserAllocation.setMediaId(project.getMediaId());
             userAllocationService.update(updateUserAllocation, userAllocationQueryWrapper);
 
             if (ok) {

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONArray;
@@ -10,11 +11,9 @@ 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.apache.shiro.SecurityUtils;
 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.system.vo.LoginUser;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
@@ -79,7 +78,6 @@ public class ProjectMemberController {
         return map;
     }
 
-
     /**
      * 我参与项目
      *
@@ -94,7 +92,7 @@ public class ProjectMemberController {
         try {
             QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
+            if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
             queryWrapper.groupBy("project_id");
@@ -187,7 +185,7 @@ public class ProjectMemberController {
                     QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("user_id", userId);
                     queryWrapper.eq("project_id", projectId);
-                    ProjectMember selectMember = (ProjectMember) projectMemberService.getObj(queryWrapper);
+                    ProjectMember selectMember = (ProjectMember) projectMemberService.getOne(queryWrapper);
                     if (!Check.isNull(selectMember)) {
                         continue;
                     }

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

@@ -20,11 +20,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
+import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.io.IOException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -87,6 +89,115 @@ public class TestController {
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
 
+    @Autowired
+    private IMaterialCutFrameService cutFrameService;
+
+
+    @GetMapping(value = "/getAccountList")
+    public void getAccountList(String startDate, String endDate) throws JobExecutionException {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+                try {
+                    Date start = sim.parse(startDate);
+                    Date end = sim.parse(endDate);
+                    //1:查询当日数据
+                    List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+                    if (null == tokens || tokens.size() <= 0) {
+                        log.info("定时获取快手数据异常:未获取到可用的token");
+                        return;
+                    }
+
+                    executorService = Executors.newFixedThreadPool(3);
+                    tokens.forEach(token -> {
+                        executorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                //1: 获取广告主信息数据
+                                kuaishouInterfaceService.getAdvertiserReportDaily(token, start, end);
+                            }
+                        });
+                    });
+                } catch (ParseException e) {
+                    e.printStackTrace();
+                }
+
+
+            }
+        };
+        thread.start();
+
+    }
+
+
+    @GetMapping(value = "/getVideo")
+    public String getVideo(String startDate, String endDate) throws IOException {
+
+        try {
+
+
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+
+
+                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+                    tokenQueryWrapper.eq("media_id", 2);
+                    List<CtopOauthToken> list = tokenService.list(tokenQueryWrapper);
+
+                    executorService = Executors.newFixedThreadPool(8);
+                    list.forEach(token -> {
+                        executorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                try {
+                                    //获取全量视频素材数据
+                                    kuaishouInterfaceService.getVideoList(token, null, null);
+                                    // 获取图片信息数据
+                                    //   kuaishouInterfaceService.getImageList(token, startDate, endDate);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                } finally {
+                                }
+                            }
+                        });
+                    });
+                    log.info("快手物料数据同步完成");
+                }
+            };
+            thread.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "Success";
+    }
+
+    @GetMapping(value = "/createCutTask")
+    public String createCutTask(String startDate, String endDate) throws IOException {
+
+        List<MaterialInfo> materialInfos = materialInfoService.getListByDate(startDate, endDate);
+        if (!Check.isNull(materialInfos)) {
+            for (MaterialInfo materialInfo : materialInfos) {
+                if (!Check.isNull(materialInfo)) {
+                    String code = materialInfo.getCode();
+                    QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                    parameterQueryWrapper.eq("material_id", code);
+                    parameterQueryWrapper.last("limit 1");
+                    MaterialParameter materialParameter = parameterService.getOne(parameterQueryWrapper);
+                    if (!Check.isNull(materialParameter)) {
+                        cutFrameService.getCutFrame(materialInfo.getUrl(), code, materialParameter.getSecond(), materialParameter.getHeight(), materialParameter.getWidth());
+
+                    }
+
+                }
+
+            }
+
+        }
+        return "Success";
+    }
+
 
     @GetMapping(value = "/getToken")
     public String getToken(Long accountId, String refreshToken, Integer agentType) {
@@ -95,6 +206,46 @@ public class TestController {
     }
 
 
+    @GetMapping(value = "/getAccountReport")
+    public String getAccountReport(Long accountId, String startDate, String endDate) throws ParseException {
+        QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
+        oauthTokenQueryWrapper.eq("media_id", 2);
+        oauthTokenQueryWrapper.eq("account_id", accountId);
+        oauthTokenQueryWrapper.last("limit 1");
+        CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+        Date date1 = sim.parse(startDate);
+        Date date2 = sim.parse(endDate);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
+        return "Success";
+    }
+
+
+    @GetMapping(value = "/getAccountReportList")
+    public String getAccountReportList(String startDate, String endDate) {
+        Result<String> result = new Result<>();
+        try {
+            SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+            Date date1 = sim.parse(startDate);
+            Date date2 = sim.parse(endDate);
+
+            QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+            tokenQueryWrapper.eq("media_id", 2);
+            List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
+            if (!Check.isNull(ctopOauthTokens)) {
+                for (CtopOauthToken token : ctopOauthTokens) {
+                    kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
+                }
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return "success";
+    }
+
+
     @GetMapping(value = "/updateCode")
     public String updateCode() {
         List<MaterialInfo> list = materialInfoService.list();
@@ -386,9 +537,6 @@ public class TestController {
     private IReportService reportService;
 
 
-
-
-
     @Autowired
     private IBytedancePlanHourlyReportService planHourlyReportService;
 

+ 14 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ISysRoleService;
@@ -123,10 +124,10 @@ public class UserAllocationController {
             QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("user_id", userId);
             queryWrapper.eq("project_id", projectId);
-            Project project = projectService.getById(projectId);
-            if (!Check.isNull(project)) {
+           /*  Project project = projectService.getById(projectId);
+                if (!Check.isNull(project)) {
                 queryWrapper.eq("media_id", project.getMediaId());
-            }
+            }*/
 
             List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
             result.setSuccess(true);
@@ -147,13 +148,14 @@ public class UserAllocationController {
         try {
             QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("project_id", projectId);
+
+           /* if (!Check.isNull(project)) {
             Project project = projectService.getById(projectId);
-            if (!Check.isNull(project)) {
                 queryWrapper.eq("media_id", project.getMediaId());
-            }
+            }*/
 
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
+            if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
             queryWrapper.orderByDesc("create_time");
@@ -183,10 +185,11 @@ public class UserAllocationController {
 
             QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("project_id", projectId);
-            Project project = projectService.getById(projectId);
-            if (!Check.isNull(project)) {
-                queryWrapper.eq("media_id", project.getMediaId());
-            }
+
+           /* if (!Check.isNull(project)) {
+                 Project project = projectService.getById(projectId);
+                 queryWrapper.eq("media_id", project.getMediaId());
+            }*/
             queryWrapper.isNotNull("account_id");
             List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
             result.setSuccess(true);
@@ -221,7 +224,7 @@ public class UserAllocationController {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
         String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
-        if (!"admin".equals(roleCode)) {
+        if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
             queryWrapper.eq("user_id", user.getId());
             queryWrapper.orderByDesc("id");
         }

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

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -46,12 +47,15 @@ public class Advertiser {
      */
     @Excel(name = "行业ID", width = 15)
     @ApiModelProperty(value = "行业ID")
+    @Dict(dicCode = "id",dictTable="sys_category",dicText="name")
     private String industryId;
+    private String industryCode;
     /**
      * 销售ID
      */
     @Excel(name = "销售ID", width = 15)
     @ApiModelProperty(value = "销售ID")
+    @Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
     private String saleId;
     /**
      * 销售ID

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

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -52,6 +53,10 @@ public class Project {
     @Excel(name = "广告主名称", width = 15)
     @ApiModelProperty(value = "广告主名称")
     private String advertiserName;
+
+    @Dict(dicCode = "id",dictTable="sys_category",dicText="name")
+    private String industryId;
+    private String industryCode;
     /**
      * 创建人
      */

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

@@ -0,0 +1,59 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.MaterialCutFrameTask;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialCutFrameTaskService;
+import cn.com.ctop.common.module.utils.Check;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.Executors;
+
+import static org.jeecg.modules.ctop.job.KuaishouDailyGroupReportLoadJob.executorService;
+
+/**
+ * 获取抽帧视频
+ */
+@Slf4j
+public class CutFrameJob implements Job {
+    @Autowired
+    private IMaterialCutFrameService materialCutFrameService;
+    @Autowired
+    private IMaterialCutFrameTaskService taskService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+
+                log.info("开始抽帧定时任务");
+                QueryWrapper<MaterialCutFrameTask> taskQueryWrapper = new QueryWrapper<>();
+                taskQueryWrapper.eq("job_status", 0);
+                List<MaterialCutFrameTask> list = taskService.list(taskQueryWrapper);
+
+                if (Check.isNull(list)) {
+                    return;
+                }
+                executorService = Executors.newFixedThreadPool(5);
+                list.forEach(cutFrameTask -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            //获取广告计划信息数据
+                            materialCutFrameService.loadCutFrame(cutFrameTask.getJobId(), cutFrameTask.getVideoSignature());
+                        }
+                    });
+                });
+            }
+        };
+        thread.start();
+
+
+    }
+}

+ 27 - 30
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoDelete.java

@@ -2,8 +2,8 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
@@ -13,6 +13,9 @@ import org.springframework.beans.factory.annotation.Value;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 @Slf4j
 public class KuaishouCommentAutoDelete implements Job {
@@ -22,39 +25,33 @@ public class KuaishouCommentAutoDelete implements Job {
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
+    static ExecutorService executorService = null;
+    //线程计数器
+    static CountDownLatch countDownLatch = null;
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("login_type", "kuaishou");
-                queryWrapper.eq("status", 1);
-                List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
-                if (list != null && list.size() > 0) {
-                    for (BindAccountLogin account : list) {
-                        try {
-                            log.info("正在删除评论:{}", account.getAccountName());
-                            kuaishouWebInterfaceService.adkuaishouWebLogin(account.getAccountName(), account.getPassword());
-                            kuaishouWebInterfaceService.deleteAllComment(new HashMap<>());
-                            Runtime runtime = Runtime.getRuntime();
-                            Process pro = runtime.exec(cleanUrl);
-                            int status = pro.waitFor();
-                            if (status == 0) {
-                                log.info("success,删除评论调用shell脚本执行成功");
-                            } else {
-                                log.info("error,删除评论调用shell脚本执行失败");
-                            }
-                            Thread.sleep(5 * 1000L);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                    }
+        Long start = System.currentTimeMillis();
+        List<BindAccountLogin>loginList = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY,1);
+        if (loginList != null && !loginList.isEmpty()) {
+            executorService = Executors.newFixedThreadPool(5);
+            countDownLatch = new CountDownLatch(loginList.size());
+            loginList.forEach(login -> executorService.submit(()->{
+                try {
+                    kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(),login);
+                }catch (Exception e){
+                    log.error(e.getMessage(),e);
+                }finally {
+                    countDownLatch.countDown();
                 }
+            }));
+            try {
+                countDownLatch.await();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
             }
-        };
-        thread.start();
-
+            Long end = System.currentTimeMillis();
+            log.info("快手删评论所用时长:{}毫秒",end-start);
+        }
     }
 }

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

@@ -0,0 +1,47 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.BindAccountLogin;
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+
+import java.util.List;
+
+@Slf4j
+public class KuaishouCommentAutoLoginJob implements Job {
+    @Value("${chrome.script.clean}")
+    private String cleanUrl;
+    @Autowired
+    private IBindAccountLoginService bindAccountLoginService;
+    @Autowired
+    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY,1);
+        if(list!=null&&!list.isEmpty()){
+            for (BindAccountLogin login:list) {
+                if(null==login.getCookie()||"".equals(login.getCookie().trim())){
+                    kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
+                    Runtime runtime = Runtime.getRuntime();
+                    try {
+                        Process pro = runtime.exec(cleanUrl);
+                        int status = pro.waitFor();
+                        if (status == 0) {
+                            log.info("success,删除评论调用shell脚本执行成功");
+                        } else {
+                            log.info("error,删除评论调用shell脚本执行失败");
+                        }
+                    } catch (Exception e) {
+                        log.error(e.getMessage(),e);
+                    }
+                }
+            }
+        }
+    }
+}

+ 2 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCrawlerJob.java

@@ -24,7 +24,7 @@ public class KuaishouCrawlerJob implements Job {
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         try {
             Integer page = 1;
-            QueryWrapper<KuaishouAppAccount> queryWrapper = new QueryWrapper<KuaishouAppAccount>();
+            QueryWrapper<KuaishouAppAccount> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("path","/rest/n/feed/hot");
             List<KuaishouAppAccount> list = kuaishouAppAccountService.list(queryWrapper);
             if (list != null) {
@@ -37,7 +37,7 @@ public class KuaishouCrawlerJob implements Job {
                 }
             }
 
-            QueryWrapper<KuaishouIosAccount> queryWrapper2 = new QueryWrapper<KuaishouIosAccount>();
+            QueryWrapper<KuaishouIosAccount> queryWrapper2 = new QueryWrapper<>();
             queryWrapper2.eq("path","/rest/n/feed/hot");
             List<KuaishouIosAccount> list2 = kuaishouIosAccountService.list(queryWrapper2);
             if (list2 != null) {
@@ -53,15 +53,4 @@ public class KuaishouCrawlerJob implements Job {
             e.printStackTrace();
         }
     }
-
-    public static void main(String[] args) {
-        for (int i = 0; i < 100; i++) {
-            System.out.println(i);
-            try {
-                System.out.println(1 / 0);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-    }
 }

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

@@ -0,0 +1,37 @@
+package org.jeecg.modules.ctop.job;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.constant.SystemDateConstant;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.ctop.service.IMaterialTopService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ *  Created by JQ.bi on 2020.5.25
+ *  定时更新素材报表的 快手头条整合数据
+ */
+@Slf4j
+public class MaterialReportAccountUpdateJob implements Job {
+
+    @Autowired
+    IMaterialTopService materialTopService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+        log.info("MaterialReportAccountUpdateJob is start");
+
+        boolean result=materialTopService.insertMaterialReportAccount(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd,
+                DateUtils.getNowDate(SystemDateConstant.yyyy_MM_dd), -1));
+
+        if(!result){
+            log.error("MaterialReportAccountUpdateJob is error");
+        } else {
+            log.info("MaterialReportAccountUpdateJob is done");
+        }
+    }
+
+}

+ 10 - 342
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/OceanengineJob.java

@@ -1,361 +1,29 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.common.module.utils.Base64Utils;
-import cn.com.ctop.common.module.utils.HttpUtils2;
-import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
-import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
-import cn.com.ctop.crawler.modules.oceanengine.entity.DouyinHot;
-import cn.com.ctop.crawler.modules.oceanengine.entity.EffectCase;
-import cn.com.ctop.crawler.modules.oceanengine.entity.HotMaterial;
-import cn.com.ctop.crawler.modules.oceanengine.service.IDouyinHotService;
-import cn.com.ctop.crawler.modules.oceanengine.service.IEffectCaseService;
-import cn.com.ctop.crawler.modules.oceanengine.service.IHotMaterialService;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import cn.com.ctop.crawler.modules.oceanengine.service.IOceanEngineService;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.http.impl.cookie.BasicClientCookie;
-import org.bytedeco.javacv.FFmpegFrameGrabber;
-import org.bytedeco.javacv.Frame;
-import org.bytedeco.javacv.Java2DFrameConverter;
-import org.openqa.selenium.Cookie;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.chrome.ChromeOptions;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-
-import javax.imageio.ImageIO;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayOutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.List;
-import java.util.*;
 
 @Slf4j
 public class OceanengineJob implements Job {
-    @Value("${jeecg.path.chrome-driver}")
-    private String chromeDriver;
-    @Autowired
-    private IDouyinHotService douyinHotService;
-    @Autowired
-    private IEffectCaseService effectCaseService;
     @Autowired
-    private IHotMaterialService hotMaterialService;
-
-    public static String getVideoUrlByVid(String vid) {
-        String url = "https://aweme.snssdk.com/aweme/v1/playwm/?video_id=" + vid + "&line=0";
-        return getRealVideoUrl(url);
-    }
+    private IOceanEngineService oceanEngineService;
 
-    public static String getRealVideoUrl(String url) {
-        try {
-            URL serverUrl = new URL(url);
-            HttpURLConnection conn = (HttpURLConnection) serverUrl
-                    .openConnection();
-            conn.setRequestMethod("GET");
-            // 必须设置false,否则会自动redirect到Location的地址
-            conn.setInstanceFollowRedirects(false);
-            conn.addRequestProperty("User-Agent",
-                    "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Firefox/3.6.8");
-            conn.connect();
-            String location = conn.getHeaderField("Location");
-            return location;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-    private void hotMaterialHandler(int page,int appCode,String appName){
-        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_material/list?material_type=3&order_by=convert_show_rate&period_type=3&aggr_app_code="+appCode+"&page="+page+"&limit=20");
-        ObjectMapper mapper = new ObjectMapper();
-        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-        try {
-            JsonNode node = mapper.readTree(result);
-            int code = node.get("code").asInt();
-            if (code == 0) {
-                if (node.get("data") != null&&node.get("data").get("materials")!=null) {
-                    String dataJson = node.get("data").get("materials").toString();
-                    List<HotMaterial> list = mapper.readValue(dataJson,new TypeReference<List<HotMaterial>>() {});
-                    if(list != null && list.size() > 0){
-                        for (HotMaterial material : list){
-                            material.setAppCode(appCode);
-                            material.setAppName(appName);
-                            material.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+material.getVid()+"&line=0"));
-                            if(material.getVideoUrl() == null){
-                                material.setVideoUrl(getVideoUrl(material.getVid()));
-                            }
-//                            material.setVideoUrl(getVideoUrl(material.getVid()));
-                            material.setCoverImage(getVideoFirstImage(material.getVideoUrl()));
-                            if(material.getCoverImage() == null){
-                                Thread.sleep(1000);
-                                material.setCoverImage(getVideoFirstImage(material.getVideoUrl()));
-                            }
-                            hotMaterialService.saveOrUpdate(material);
-                        }
-                        hotMaterialHandler(page+1,appCode,appName);
-                    }
-                }
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-        }
-    }
-
-    public static String getVideoUrl(String vid) throws Exception {
-        String url = "http://i.snssdk.com/video/urls/1/toutiao/mp4/"+vid;
-        String result = HttpUtils2.httpGetRequest(url);
-        ObjectMapper mapper = new ObjectMapper();
-        if(result != null){
-            JsonNode node = mapper.readTree(result);
-            String mainUrl = node.get("data").get("video_list").get("video_1").get("main_url").asText();
-            return Base64Utils.decode(mainUrl);
-        }
-        return null;
-    }
-    private void effectCaseHandler(int page){
-        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case_list?industry=0&style=0&mode=0&page="+page+"&limit=20");
-        ObjectMapper mapper = new ObjectMapper();
-        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-        try {
-            JsonNode node = mapper.readTree(result);
-            int code = node.get("code").asInt();
-            if(code == 0) {
-                if (node.get("data") != null) {
-                    String dataJson = node.get("data").get("effect_cases").toString();
-                    List<EffectCase> list = mapper.readValue(dataJson,new TypeReference<List<EffectCase>>() {});
-                    if (list != null && list.size() > 0) {
-                        for (EffectCase effectCase:list){
-                            String resultDetail = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case/"+effectCase.getId());
-                            JsonNode detailNode = mapper.readTree(resultDetail);
-                            int detailCode = detailNode.get("code").asInt();
-                            if(detailCode == 0){
-                                if(detailNode.get("data") != null){
-//                                    String detailJson = node.get("data").get("effect_cases").toString();
-//                                    EffectCase effectCase1 = mapper.readValue(detailJson,EffectCase.class);
-                                    effectCase.setAuthor(detailNode.get("data").get("effect_case").get("author").asText());
-                                    effectCase.setCreateDate(detailNode.get("data").get("effect_case").get("create_date").asText());
-                                    effectCase.setCreativeId(detailNode.get("data").get("effect_case").get("creative_id").asLong());
-                                    effectCase.setCreativeScore(detailNode.get("data").get("effect_case").get("creative_score").asText());
-                                    effectCase.setEffect(detailNode.get("data").get("effect_case").get("effect").toString());
-                                    effectCase.setMethods(detailNode.get("data").get("effect_case").get("methods").toString());
-                                    effectCase.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+effectCase.getVid()+"&line=0"));
-                                    if (effectCase.getVideoUrl() == null){
-                                        effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
-                                    }
-//                                    effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
-                                    effectCase.setCoverImage(getVideoFirstImage(effectCase.getVideoUrl()));
-                                    if (effectCase.getCoverImage() == null){
-                                        Thread.sleep(1000);
-                                        effectCase.setCoverImage(getVideoFirstImage(effectCase.getVideoUrl()));
-                                    }
-                                    effectCase.setCreativeLabel(detailNode.get("data").get("effect_case").get("creative_label").toString());
-                                }
-                            }
-                            effectCaseService.saveOrUpdate(effectCase);
-                        }
-                        effectCaseHandler(page+1);
-                    }
-                }
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-        }
-    }
-
-    private String getVideoFirstImage(String url){
-        try {
-            FFmpegFrameGrabber ff = new FFmpegFrameGrabber(url);
-            ff.start();
-            int lenght = ff.getLengthInFrames();
-            int i = 0;
-            Frame f = null;
-            while (i < lenght) {
-// 过滤前5帧,避免出现全黑的图片,依自己情况而定
-                f = ff.grabFrame();
-                if ((i > 5) && (f.image != null)) {
-                    break;
-                }
-                i++;
-            }
-//            opencv_core.IplImage img = f.image;
-            int owidth = f.imageWidth;
-            int oheight = f.imageHeight;
-            Java2DFrameConverter converter =new Java2DFrameConverter();
-            BufferedImage fecthedImage =converter.getBufferedImage(f);
-// 对截取的帧进行等比例缩放
-            int width = 800;
-            int height = (int) (((double) width / owidth) * oheight);
-            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
-            bi.getGraphics().drawImage(fecthedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH),
-                    0, 0, null);
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();//io流
-            ImageIO.write(bi, "jpg", baos);
-            byte[] bytes = baos.toByteArray();//转换成字节
-            String png_base64 = Base64.getEncoder().encodeToString(bytes).trim();//转换成base64串
-            png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//删除 \r\n
-            //        ImageIO.write(bufferedImage, "png", new File("D:/qrcode1.png"));
-            baos.close();
-            ff.close();
-            return "data:image/jpg;base64,"+png_base64;
-        }catch (Exception e){
-            e.printStackTrace();
-            return null;
-        }
-
-    }
-    private void douyinHotHandler(int page,int listType){
-        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_video/user_side/list?page="+page+"&limit=20&list_type="+listType+"&aggr_duration_type=-1");
-        ObjectMapper mapper = new ObjectMapper();
-        try {
-            JsonNode node = mapper.readTree(result);
-            int code = node.get("code").asInt();
-            if(code == 0){
-                if(node.get("data")!= null){
-                    String dataJson = node.get("data").get("items").toString();
-                    List<DouyinHot> list = mapper.readValue(dataJson,new TypeReference<List<DouyinHot>>() {});
-                    if (list != null && list.size() > 0){
-                        for (DouyinHot douyinHot : list){
-                            douyinHot.setUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+douyinHot.getVideoId()+"&line=0"));
-                            if(douyinHot.getUrl() == null){
-                                douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
-                            }
-//                            douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
-                            douyinHot.setCoverImage(getVideoFirstImage(douyinHot.getUrl()));
-                            if(douyinHot.getCoverImage() == null){
-                                Thread.sleep(1000);
-                                douyinHot.setCoverImage(getVideoFirstImage(douyinHot.getUrl()));
-                            }
-                            douyinHotService.saveOrUpdate(douyinHot);
-                        }
-                        douyinHotHandler(page+1,listType);
-                    }else {
-                        if(listType < 4){
-                            douyinHotHandler(1,listType+1);
-                        }
-                    }
-                }
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-        }
-
-    }
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         String account="3248395570@qq.com";
         String password = "Ydxq-704127411";
-        login(account,password);
-        douyinHotHandler(1,1);
-        effectCaseHandler(1);
-        hotMaterialHandler(1,1,"西瓜");
-        hotMaterialHandler(1,3,"火山");
-        hotMaterialHandler(1,4,"抖音");
-        hotMaterialHandler(1,8,"头条");
-        hotMaterialHandler(1,9,"穿山甲");
+        oceanEngineService.login(account,password);
+        oceanEngineService.douyinHotHandler(1,1);
+        oceanEngineService.effectCaseHandler(1);
+        oceanEngineService.hotMaterialHandler(1,1,"西瓜");
+        oceanEngineService.hotMaterialHandler(1,3,"火山");
+        oceanEngineService.hotMaterialHandler(1,4,"抖音");
+        oceanEngineService.hotMaterialHandler(1,8,"头条");
+        oceanEngineService.hotMaterialHandler(1,9,"穿山甲");
         log.info("巨量创意抓取完成");
     }
-
-    private void login(String account,String password){
-        String url = "https://cc.oceanengine.com/login";
-        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
-        ChromeOptions chromeOptions = new ChromeOptions();
-        chromeOptions.addArguments("--headless");
-        chromeOptions.addArguments("--no-sandbox");
-        chromeOptions.addArguments("--window-size=1920,1080");
-        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
-        chromeOptions.setAcceptInsecureCerts(true);
-        WebDriver webDriver = new ChromeDriver(chromeOptions);
-        //清除所有的缓存
-        webDriver.manage().deleteAllCookies();
-        try {
-            //获取登录页面
-            webDriver.get(url);
-            for (Cookie cookie : webDriver.manage().getCookies()) {
-                BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
-                ck.setDomain("oceanengine.com");
-                ck.setExpiryDate(cookie.getExpiry());
-                ck.setPath(cookie.getPath());
-                HttpUtils2.cookieStore.addCookie(ck);
-            }
-            Map<String, String> header = new HashMap<>();
-            header.put("Accept", "*/*");
-            header.put("Connection", "keep-alive");
-            header.put("Host", "sso.toutiao.com");
-            header.put("Content-Type", "application/x-www-form-urlencoded");
-            header.put("Origin", "https://cc.oceanengine.com");
-            header.put("Referer", "https://cc.oceanengine.com/login");
-            Map<String, Object> param = new HashMap<>();
-            param.put("mobile", "");
-            param.put("code", "");
-            param.put("account", account);
-            param.put("password", password);
-            param.put("captcha", "hqde");
-            param.put("is_30_days_no_login", "true");
-            param.put("service", "https://cc.oceanengine.com");
-            String res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-            ObjectMapper mapper = new ObjectMapper();
-            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-            JsonNode jsonNode = mapper.readTree(res);
-            //errorcode == 1102 验证码错误,请重新输入验证码
-            //errorcode == 1101 验证码为空
-
-            Integer errorCode = jsonNode.get("error_code").asInt();
-            String orderId = null;
-            while (errorCode != 0) {
-                //用户名或者密码错误
-                if (null != errorCode && errorCode == 1009) {
-                    return;
-                }
-                FateadmUtil fateadmUtil = new FateadmUtil();
-                fateadmUtil.init();
-                if (orderId != null) {
-                    fateadmUtil.justice(orderId);
-                }
-                String captcha = jsonNode.get("captcha").asText();
-                Base64.Decoder decoder = Base64.getDecoder();
-                FateadmHttpUtil.HttpResp resp = fateadmUtil.Predict("30400", decoder.decode(captcha));
-                param.put("captcha", resp.predResl);
-                orderId = resp.reqId;
-                res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-                jsonNode = mapper.readTree(res);
-                errorCode = jsonNode.get("error_code").asInt();
-            }
-            if (errorCode == 0) {
-                //表示登录成功
-                List<org.apache.http.cookie.Cookie> cookies = HttpUtils2.cookieStore.getCookies();
-                for (org.apache.http.cookie.Cookie ck : cookies) {
-                    Cookie cookie = new Cookie(ck.getName(), ck.getValue(), "." + ck.getDomain(), ck.getPath(), ck.getExpiryDate());
-                    webDriver.manage().addCookie(cookie);
-                }
-                String redirectUrl = jsonNode.get("redirect_url").asText();
-                webDriver.get(redirectUrl);
-                //登录成功 进入推广页面
-                webDriver.get("https://cc.oceanengine.com/inspiration/douyin-rank-list");
-                Thread.sleep(3000);
-                for (Cookie cookie : webDriver.manage().getCookies()) {
-                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
-                    ck.setDomain("cc.oceanengine.com");
-                    ck.setExpiryDate(cookie.getExpiry());
-                    ck.setPath(cookie.getPath());
-                    HttpUtils2.cookieStore.addCookie(ck);
-                }
-
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            //获得cookie
-            Set<Cookie> coo = webDriver.manage().getCookies();
-            //清除所有的缓存
-            webDriver.manage().deleteAllCookies();
-            webDriver.quit();
-        }
-    }
 }

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

@@ -2,11 +2,8 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
-import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -18,8 +15,6 @@ public class PangolinDataJob implements Job {
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
-    private PangolinAppService pangolinAppService;
-    @Autowired
     private PangolinCrawlerService pangolinCrawlerService;
 
     @Override
@@ -31,15 +26,7 @@ public class PangolinDataJob implements Job {
         List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
         if (list != null && !list.isEmpty()) {
             for (BindAccountLogin bindAccountLogin : list) {
-                pangolinCrawlerService.getChannelList(bindAccountLogin);
-                pangolinCrawlerService.getActivationList(bindAccountLogin, DateUtils.getNowDate("yyyy-MM-dd"), 1);
-                pangolinCrawlerService.getCheckList(bindAccountLogin);
-                QueryWrapper<PangolinApp> queryWrapper1 = new QueryWrapper<>();
-                queryWrapper1.eq("account_name", bindAccountLogin.getAccountName());
-                List<PangolinApp> appList = pangolinAppService.list(queryWrapper1);
-                if (appList != null && !appList.isEmpty()) {
-                    appList.forEach(pangolinApp -> pangolinCrawlerService.getRealTimeList(bindAccountLogin, pangolinApp.getId()));
-                }
+                pangolinCrawlerService.getNowData(bindAccountLogin);
             }
         }
     }

+ 2 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/PangolinLoginJob.java

@@ -2,8 +2,8 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -18,10 +18,7 @@ public class PangolinLoginJob implements Job {
     private PangolinLoginService pangolinLoginService;
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("login_type","pangolin");
-        queryWrapper.eq("status",1);
-        List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
+        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_PANGOLIN_PY,1);
         if(list!=null&&!list.isEmpty()){
             for (BindAccountLogin login:list) {
                 if(null==login.getCookie()||"".equals(login.getCookie().trim())){

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

@@ -0,0 +1,20 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.ctop.vo.MaterialTopVO;
+
+public interface MaterialTopMapper {
+
+    IPage<MaterialTopVO> selectMapsPage(Page<MaterialTopVO> page, @Param(Constants.WRAPPER)QueryWrapper<MaterialTopVO> wrapper);
+
+    int insertByteDanceMaterialReportAccountByDate(@Param("statDate") String statDate);
+
+    int insertKuaiShouMaterialReportAccountByDate(@Param("statDate") String statDate);
+
+    int deletedMaterialReportAccountByDate(@Param("statDate") String statDate);
+
+}

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

@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.ctop.mapper.MaterialTopMapper">
+    <select id="selectMapsPage" resultType="org.jeecg.modules.ctop.vo.MaterialTopVO">
+       SELECT
+          url,
+          name,
+          stat_date ,
+          sum(cost) as cost,
+          sum(click) as click,
+          sum(show_num) as show_num,
+          sum(active) as active,
+          sum(register) as register,
+          sum(pay) as pay,
+          sum(phone_convert) as phone_convert,
+          sum(form_convert) as form_convert,
+          convert_rate,
+          sum(residue) as residue,
+          sum(play3s) as play3s,
+          sum(play10s) as play10s
+       FROM
+          ctop_material_report_total_result
+       where
+        ${ew.sqlSegment}
+    </select>
+
+    <insert id="insertByteDanceMaterialReportAccountByDate">
+        INSERT INTO ctop_material_report_total_result (
+            CODE,
+            url,
+            NAME,
+            stat_date,
+            cost,
+            click,
+            show_num,
+            active,
+            register,
+            pay,
+            phone_convert,
+            form_convert,
+            residue,
+            play3s,
+            play10s,
+            media_type
+        ) SELECT
+              t2.signature,
+              CASE
+                  WHEN (
+                      SELECT
+                          info.url
+                      FROM
+                          ctop_material_info info
+                      WHERE
+                          info. CODE = t2.signature
+                      ORDER BY
+                          create_time DESC
+                      LIMIT 1
+                  ) IS NULL THEN
+                      ""
+                  ELSE
+                      (
+                          SELECT
+                              info.url
+                          FROM
+                              ctop_material_info info
+                          WHERE
+                              info. CODE = t2.signature
+                          ORDER BY
+                              create_time DESC
+                          LIMIT 1
+                      )
+                  END AS url,
+              CASE
+                  WHEN (
+                      SELECT
+                          info.material_name
+                      FROM
+                          ctop_material_info info
+                      WHERE
+                          info. CODE = t2.signature
+                      ORDER BY
+                          create_time DESC
+                      LIMIT 1
+                  ) IS NULL THEN
+                      ""
+                  ELSE
+                      (
+                          SELECT
+                              info.material_name
+                          FROM
+                              ctop_material_info info
+                          WHERE
+                              info. CODE = t2.signature
+                          ORDER BY
+                              create_time DESC
+                          LIMIT 1
+                      )
+                  END AS NAME,
+              t1.stat_datetime AS statDate,
+              sum(t1.cost) AS cost,
+              sum(t1.click) click,
+              0 AS showNum,
+              sum(t1.active) AS active,
+              sum(t1.register) AS register,
+              sum(t1.pay_count) AS pay,
+              sum(t1.phone_confirm) AS phoneConvert,
+              sum(t1.form) AS formConvert,
+              sum(t1.next_day_open) AS residue,
+              sum(t1.play_duration_3s) AS play3s,
+              sum(t1.play_duration_10s) AS play3s,
+              0 AS mediaType
+        FROM
+            ctop_bytedance_report_material_daily t1
+                LEFT JOIN ctop_bytedance_video_info t2 ON t1.material_id = t2.material_id
+        WHERE
+            1 = 1
+          AND t1.stat_datetime = #{statDate}
+          AND t1.image_mode != 'MATERIAL_IMAGE_MODE_TITLE'
+          AND t2.signature IS NOT NULL
+          AND t2.signature != ""
+        GROUP BY
+            t2.signature,
+            t1.stat_datetime;
+    </insert>
+
+    <insert id ="insertKuaiShouMaterialReportAccountByDate">
+        INSERT INTO ctop_material_report_total_result (
+            CODE,
+            url,
+            NAME,
+            stat_date,
+            cost,
+            click,
+            show_num,
+            active,
+            register,
+            form_convert,
+            media_type
+        ) SELECT
+              t1.signature AS 'code',
+              CASE
+                  WHEN (
+                      SELECT
+                          url
+                      FROM
+                          ctop_material_info
+                      WHERE
+                          `code` = t1.signature
+                      LIMIT 1
+                  ) IS NULL THEN
+                      ""
+                  ELSE
+                      (
+                          SELECT
+                              url
+                          FROM
+                              ctop_material_info
+                          WHERE
+                              `code` = t1.signature
+                          LIMIT 1
+                      )
+                  END AS 'url',
+              CASE
+                  WHEN (
+                      SELECT
+                          material_name
+                      FROM
+                          ctop_material_info
+                      WHERE
+                          `code` = t1.signature
+                      LIMIT 1
+                  ) IS NULL THEN
+                      ""
+                  ELSE
+                      (
+                          SELECT
+                              material_name
+                          FROM
+                              ctop_material_info
+                          WHERE
+                              `code` = t1.signature
+                          LIMIT 1
+                      )
+                  END AS 'name',
+              t1.stat_date AS 'stat_date',
+              sum(t1.charge) AS 'cost',
+              sum(t1.photo_click) AS 'click',
+              sum(t1.photo_show) AS 'show_num',
+              sum(t1.activation) AS 'active',
+              sum(t1.event_register) AS 'register',
+              sum(t1.form_count) AS 'form_convert',
+              '2' AS 'media_type'
+        FROM
+            ctop_kuaishou_report_daily_creative t1
+        WHERE
+            t1.signature IS NOT NULL
+          AND t1.stat_date = #{statDate}
+        GROUP BY
+            t1.stat_date,
+            t1.signature;
+    </insert>
+
+    <delete id="deletedMaterialReportAccountByDate">
+        DELETE FROM ctop_material_report_total_result where stat_date= #{statDate}
+    </delete>
+
+</mapper>

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

@@ -6,5 +6,5 @@ public interface ICreateInternalService {
 
     Map<String, Object> checkAccountPassword(String account, String password);
 
-    Map<String, Object> bindLogin(String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName);
+    Map<String, Object> bindLogin(Long projectId,String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName);
 }

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

@@ -0,0 +1,9 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.jeecg.modules.ctop.vo.MaterialTopVO;
+
+public interface IMaterialTopService {
+    IPage<MaterialTopVO> selectByPage(String endDate, String startDate, String target, String order, int pageNo, int pageSize);
+    boolean insertMaterialReportAccount(String statDate);
+}

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

@@ -32,13 +32,10 @@ public class CrawlerServiceImpl implements ICrawlerService {
     public Map<String, Object> loadInspiration() {
         //(1):效果广告解析
         loadeffectAdByPage(100, 1);
-
         //(2):广告创意视频
         loadInspiredAdByPage(100, 1);
-
         //(3):快手热门作品
         loadHotPhotoByPage(100, 1);
-
         return null;
     }
 
@@ -55,7 +52,7 @@ public class CrawlerServiceImpl implements ICrawlerService {
             return;
         }
         JSONArray hotPhotoInfos = resultObject.getJSONObject("data").getJSONArray("hotPhotoInfos");
-        if (null == hotPhotoInfos || hotPhotoInfos.size() <= 0) {
+        if (null == hotPhotoInfos || hotPhotoInfos.isEmpty()) {
             log.info("热门作品数据获取完成");
             return;
         }
@@ -120,11 +117,10 @@ public class CrawlerServiceImpl implements ICrawlerService {
             return;
         }
         JSONArray effectAds = resultObject.getJSONObject("data").getJSONArray("effectAds");
-        if (null == effectAds || effectAds.size() <= 0) {
+        if (null == effectAds || effectAds.isEmpty()) {
             log.info("效果广告数据获取完成");
             return;
         }
-//        List<KuaishouEffectAdInfo> adInfos = new ArrayList<>();
         for (int i = 0; i < effectAds.size(); i++) {
             JSONObject ad = effectAds.getJSONObject(i);
             Long contentId = ad.getLong("contentId");
@@ -132,12 +128,8 @@ public class CrawlerServiceImpl implements ICrawlerService {
                 JSONObject content = getEffectAdDetail(contentId).getJSONObject("data").getJSONObject("effectAdDetail");
                 KuaishouEffectAdInfo adInfo = new KuaishouEffectAdInfo(content);
                 effectAdInfoService.saveOrUpdate(adInfo);
-                //                adInfos.add(adInfo);
             }
         }
-        /*if (adInfos.size() > 0) {
-            effectAdInfoService.replaceBatch(adInfos);
-        }*/
         loadeffectAdByPage(pageSize, pageNum + 1);
     }
 

+ 26 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java

@@ -5,6 +5,8 @@ import cn.com.ctop.common.module.mapper.BindAccountLoginMapper;
 import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
 import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
+import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
+import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -33,34 +35,27 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
     private String chromeDriver;
     @Autowired
     private BindAccountLoginMapper bindAccountLoginMapper;
+    @Autowired
+    private PangolinLoginService pangolinLoginService;
+    @Autowired
+    private PangolinCrawlerService pangolinCrawlerService;
 
     @Override
-    public Map<String, Object> bindLogin(String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName) {
-
+    public Map<String, Object> bindLogin(Long projectId,String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName) {
         Map<String, Object> returnMap = new HashMap<>();
         Map<String, Object> requestMap = new HashMap<>();
         requestMap.put("advertiser_id", advertiserId);
         requestMap.put("account_name", accountName);
         requestMap.put("login_type", loginType);
         requestMap.put("user_id", userId);
-        Map<String, Object> deleteMap = new HashMap<>();
-        deleteMap.put("advertiser_id", advertiserId);
-        deleteMap.put("account_name", accountName);
-        deleteMap.put("login_type", loginType);
-        deleteMap.put("user_id", userId);
-        bindAccountLoginMapper.deleteByMap(deleteMap);
-        List<BindAccountLogin> bindAccounts = bindAccountLoginMapper.selectByMap(requestMap);
-        if (!Check.isNull(bindAccounts)) {
-            returnMap.put("success", false);
-            returnMap.put("message", "账号已存在");
-            return returnMap;
-        }
+        requestMap.put("project_id", projectId);
+        bindAccountLoginMapper.deleteByMap(requestMap);
         String accountId = "";
         //头条登录
         if (null != loginType && loginType.equals(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_PY)) {
             Map<String, Object> result = this.checkAccountPassword(accountName, password);
             Boolean checkSuccess = (Boolean) result.get("success");
-            if (!checkSuccess) {
+            if (Boolean.FALSE.equals(checkSuccess)) {
                 returnMap.put("success", false);
                 returnMap.put("message", "账号验证失败");
                 return returnMap;
@@ -73,13 +68,27 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         bindAccountLogin.setPassword(password);
         bindAccountLogin.setAccountId(accountId);
         bindAccountLogin.setLoginType(loginType);
+        bindAccountLogin.setProjectId(projectId);
         bindAccountLogin.setUserId(userId);
         int i = bindAccountLoginMapper.insert(bindAccountLogin);
         if (i > 0) {
             log.info("登录账号绑定成功,广告主id:{}", bindAccountLogin.getAdvertiserId());
+            if(null!=loginType&&loginType.equals(CtopAdConstant.PLATFORM_TYPE_PANGOLIN_PY)){
+                //穿山甲账户绑定
+                Thread thread = new Thread(){
+                    @Override
+                    public void run() {
+                        //1:登录
+                        pangolinLoginService.pangolinLogin(bindAccountLogin.getAccountName(), bindAccountLogin.getPassword());
+                        //2:拉取数据
+                        pangolinCrawlerService.getNowData(bindAccountLogin);
+                    }
+                };
+                thread.start();
+            }
+
             returnMap.put("success", true);
             returnMap.put("accountUd", password);
-            return returnMap;
         }
         return returnMap;
     }
@@ -175,7 +184,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 }
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(),e);
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SERVER_ERROR.getCode());
         } finally {
             //清除所有的缓存

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

@@ -0,0 +1,56 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.StringUtils;
+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.modules.ctop.mapper.MaterialTopMapper;
+import org.jeecg.modules.ctop.service.IMaterialTopService;
+import org.jeecg.modules.ctop.vo.MaterialTopVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ *  Created by JQ.bi on 2020.05.22
+ */
+@Slf4j
+@Service
+public class MaterialTopServiceImpl  implements IMaterialTopService {
+
+    @Autowired
+    private MaterialTopMapper materialTopMapper;
+
+    @Override
+    public IPage<MaterialTopVO> selectByPage(String endDate, String startDate, String target, String order, int pageNo, int pageSize) {
+        QueryWrapper<MaterialTopVO> wrapper = new QueryWrapper<>();
+        wrapper.ge("stat_date", startDate).le("stat_date", endDate).ne("url","").isNotNull("url");
+        target = StringUtils.humpToLine2(target);
+        if(order.equals(CtopAdConstant.COMMON_ORDER_TYPE_ASC)){
+            wrapper.orderByAsc(target);
+        }else{
+            wrapper.orderByDesc(target);
+        }
+        wrapper.groupBy("code");
+        Page<MaterialTopVO> page = new Page<>((pageNo-1)*pageSize,pageSize);
+        return materialTopMapper.selectMapsPage(page, wrapper);
+    }
+
+    @Override
+    public boolean insertMaterialReportAccount(String statDate) {
+
+        int resultByteDance=materialTopMapper.insertByteDanceMaterialReportAccountByDate(statDate);
+        int resultKuaishou=materialTopMapper.insertKuaiShouMaterialReportAccountByDate(statDate);
+
+        if(resultByteDance == 0 || resultKuaishou == 0){
+            log.error("整合素材报表信息失败");
+            log.info("delete dirty data is start");
+            materialTopMapper.deletedMaterialReportAccountByDate(statDate);
+            log.info("delete dirty data is success");
+        }
+
+        return resultByteDance != 0 && resultKuaishou != 0;
+    }
+
+}

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -13,7 +14,6 @@ import org.jeecg.modules.system.entity.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -78,7 +78,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
             projectMemberList = memberMapper.designProjects(userId, mediaIds);
         }else if( roleCode.equals("designTeamLeader")){
             projectMemberList = memberMapper.designLeaderProjects(companyId, mediaIds);
-        }else if(roleCode.equals("admin")){
+        }else if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
             projectMemberList = memberMapper.adminProjects(mediaIds);
         }else if(roleCode.equals("operator") || roleCode.equals("operationAssistant") || roleCode.equals("touTiaoOperationManager")){
             projectMemberList = memberMapper.operationProjects(userId, mediaIds);

+ 24 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vo/MaterialTopVO.java

@@ -0,0 +1,24 @@
+package org.jeecg.modules.ctop.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class MaterialTopVO {
+    private String url;
+    private String name ;
+    private String statDate;
+    private BigDecimal cost;
+    private Long click;
+    private Long showNum;
+    private Long active;
+    private Long register;
+    private BigDecimal pay;
+    private Long phoneConvert;
+    private Long formConvert;
+    private BigDecimal convertRate;
+    private Long residue;
+    private Long play3s;
+    private Long play10s;
+}

+ 17 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouXxlEntity.java

@@ -30,18 +30,23 @@ public class KuaishouXxlEntity extends BaseRowModel {
     @ExcelProperty(index = 4, value = "非双出价(元)")
     private BigDecimal singleBid;
     /**
+     * 非双出价
+     */
+    @ExcelProperty(index = 5, value = "详情页消耗(元)")
+    private BigDecimal detailCost;
+    /**
      * 激活数
      */
-    @ExcelProperty(index = 5, value = "激活数")
+    @ExcelProperty(index = 6, value = "激活数")
     private int active;
     /**
      * 激活成本
      */
-    @ExcelProperty(index = 6, value = "激活成本")
+    @ExcelProperty(index = 7, value = "激活成本")
     private BigDecimal activeCost;
-    @ExcelProperty(index = 7, value = "每日计划(组)")
+    @ExcelProperty(index = 8, value = "每日计划(组)")
     private int planNum;
-    @ExcelProperty(index = 8, value = "每日素材安排")
+    @ExcelProperty(index = 9, value = "每日素材安排")
     private String mat;
 
     public String getDate() {
@@ -107,4 +112,12 @@ public class KuaishouXxlEntity extends BaseRowModel {
     public void setMat(String mat) {
         this.mat = mat;
     }
+
+    public BigDecimal getDetailCost() {
+        return detailCost;
+    }
+
+    public void setDetailCost(BigDecimal detailCost) {
+        this.detailCost = detailCost;
+    }
 }

+ 0 - 20
jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Receiver.java

@@ -1,20 +0,0 @@
-package org.jeecg.modules.mq;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.rabbit.annotation.Queue;
-import org.springframework.amqp.rabbit.annotation.RabbitHandler;
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.stereotype.Component;
-
-@Slf4j
-@Component
-@RabbitListener(queuesToDeclare = @Queue("hello"))
-public class Receiver {
-    /**
-     * 通过@RabbitHandler声明的方法,对hello队列中的消息进行处理
-     */
-    @RabbitHandler
-    public void receiver(String str) {
-        log.info("Receiver says:[" + str + "]");
-    }
-}

+ 0 - 27
jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Sender.java

@@ -1,27 +0,0 @@
-package org.jeecg.modules.mq;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.core.AmqpTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-/**
- * @author jeecg-boot
- * 2019年12月5日19:57:58
- */
-@Component
-@Slf4j
-public class Sender {
-
-    @Autowired
-    AmqpTemplate rabbitmqTemplate;
-
-    /**
-     * 发送消息
-     */
-    public void send() {
-        String content = "Sender says:" + "'hello, I'm sender'";
-        log.info(content);
-        rabbitmqTemplate.convertAndSend("hello", content);
-    }
-}

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/CornerCheck.java

@@ -224,7 +224,6 @@ public class CornerCheck {
                 System.out.println(imageGR.get((int) point.y, (int) point.x)[1]);
                 if (imageGR.get((int) point.y, (int) point.x)[1] >= 120) {
                     if (point.x <= rightDown.x) {
-                        System.out.println("greenPoint:" + point.toString());
                         checkPoints.add(point);
                     }
                 }

+ 144 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/ExtractionVideoKeyFrames.java

@@ -0,0 +1,144 @@
+package org.jeecg.modules.opencv.utils;
+
+import org.opencv.core.*;
+import org.opencv.imgcodecs.Imgcodecs;
+import org.opencv.imgproc.Imgproc;
+import org.opencv.videoio.VideoCapture;
+import org.opencv.videoio.Videoio;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExtractionVideoKeyFrames {
+    Mat computeColorHist3D(Mat im, Size size)
+    {
+        Mat dst = new Mat(), hist = new Mat();
+        Imgproc.resize(im, dst, size, 0, 0, Imgproc.INTER_NEAREST);
+        Mat hsv_src = new Mat();
+        Imgproc.cvtColor(im, hsv_src, Imgproc.COLOR_BGR2HSV);
+        List<Mat> images=new ArrayList<Mat>(3);
+        images.add(hsv_src);
+
+        MatOfInt channels= new MatOfInt(0);
+        MatOfInt hSize = new MatOfInt(256);
+        MatOfFloat ranges= new MatOfFloat(0,255);
+        //获取图像直方图
+        Imgproc.calcHist(images, channels, new Mat(), hist, hSize, ranges);
+        return hist;
+    }
+
+    Mat computeColorHist(Mat im, Size size)
+    {
+        Mat dst = new Mat(), hist = new Mat();
+        Imgproc.resize(im, dst, size, 0, 0, Imgproc.INTER_NEAREST);
+        Mat gray = new Mat(im.size(),CvType.CV_8UC1);
+        Imgproc.cvtColor(im,gray,Imgproc.COLOR_RGB2GRAY);
+
+        List<Mat> images = new ArrayList<Mat>();
+        images.add(gray);
+
+        MatOfInt channels= new MatOfInt(0);
+        MatOfInt hSize = new MatOfInt(128);
+        MatOfFloat ranges= new MatOfFloat(0,128);
+        Imgproc.calcHist(images, channels, new Mat(), hist, hSize, ranges);
+        return hist;
+    }
+
+    double computeASE(Mat a, Mat b) {
+        return  1 - Imgproc.compareHist(a, b, 0);
+    }
+
+    int ExtractKeyframes(String videoPath, double rate, String outImgPath){
+        VideoCapture cap = new VideoCapture();
+        System.out.println(cap.isOpened());
+        if (!cap.open(videoPath)) {
+            System.out.println("Open video file error!");
+            return -1;
+        }
+
+        File file = new File(outImgPath);
+        if(!file.exists()){
+            file.mkdirs();
+        }
+        //  Videoio.CAP_PROP_FRAME_COUNT
+        int width = (int)cap.get(Videoio.CAP_PROP_FRAME_WIDTH);
+        int height = (int)cap.get(Videoio.CAP_PROP_FRAME_HEIGHT);
+        float fps = (float)cap.get(Videoio.CAP_PROP_FPS);
+        int nframes = (int)cap.get(Videoio.CAP_PROP_FRAME_COUNT);
+        System.out.println("W:"+width+";H:"+height+";FPS:"+fps+";N:"+nframes);
+
+        int nscale = 1;
+        if (width%4==0 && height%4==0){
+            nscale = 4;
+        }else if (width%2==0 && height%2==0){
+            nscale = 2;
+        }
+        Size size = new Size(width/nscale, height/nscale);
+
+        Mat frame = new Mat();
+        Mat lastFrame = new Mat();
+        Mat histA = new Mat();
+        Mat histB = new Mat();
+        long nCount = 0;
+        int frameID = 1;
+        int lastFrameID = 1;
+        double tic = (double)Core.getTickCount();
+        while (cap.read(frame)) {
+            if (frame.empty()){
+                break;
+            }
+
+            if (lastFrameID==1) {
+                frameID = (int)cap.get(Videoio.CAP_PROP_POS_FRAMES);
+                lastFrameID = frameID;
+                frame.copyTo(lastFrame);
+                continue;
+            }
+            if (++nCount % 15 != 0){
+                continue;	// Processing one frame in each second
+            }
+
+            frameID = (int)cap.get(Videoio.CAP_PROP_POS_FRAMES);
+            histA = computeColorHist3D(frame, size);
+
+            double aseV = rate;
+            if (histB.empty()){
+                System.out.println(aseV);
+            }
+            else{
+                aseV = computeASE(histA, histB);
+                System.out.println(aseV);
+            }
+
+            if (aseV >= rate) {
+                String imagePath = outImgPath+"/"+lastFrameID+".jpg";
+                if (!Imgcodecs.imwrite(imagePath, lastFrame)){
+                    return -2;
+                }
+                lastFrameID = frameID;
+                frame.copyTo(lastFrame);
+            }
+
+            histA.copyTo(histB);
+        }
+
+        if (!lastFrame.empty()) {
+            String imagePath=outImgPath+"/"+ lastFrameID+".jpg";
+            if (!Imgcodecs.imwrite(imagePath, lastFrame)){
+                return -2;
+            }
+        }
+        System.out.println("NFRAMES(in reality)="+nCount);
+
+        double toc = (double)Core.getTickCount();
+        System.out.println("ELAPSED TIME="+(toc-tic)/Core.getTickFrequency());
+        return 0;
+    }
+
+    public static void main(String[] args) {
+        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
+        ExtractionVideoKeyFrames evf = new ExtractionVideoKeyFrames();
+        evf.ExtractKeyframes("D:\\data\\fill.mp4",0.5,"D:\\data\\");
+    }
+}

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/Perspective.java

@@ -48,7 +48,6 @@ public class Perspective {
             Imgcodecs.imwrite(targetFileName, dst);
         } catch (Exception e) {
             e.printStackTrace();
-            System.out.println("例外:" + e);
         }
     }
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictController.java

@@ -405,7 +405,7 @@ public class SysDictController {
 			@RequestParam(name="text") String text,
 			@RequestParam(name="code") String code,
 			@RequestParam(name="hasChildField") String hasChildField) {
-		Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>();
+		Result<List<TreeSelectModel>> result = new Result<>();
 		List<TreeSelectModel> ls = sysDictService.queryTreeList(tbname, text, code, pidField, pid,hasChildField);
 		result.setSuccess(true);
 		result.setResult(ls);

+ 94 - 30
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -1,5 +1,8 @@
 package org.jeecg.modules.system.controller;
 
+import cn.com.ctop.common.module.entity.SysRole;
+import cn.com.ctop.common.module.service.ISysRoleService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.vo.SysDepartUsersVO;
 import cn.com.ctop.common.module.vo.SysUserRoleVO;
 import cn.com.ctop.common.module.vo.SysUserVo;
@@ -20,10 +23,10 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.PasswordUtil;
 import org.jeecg.common.util.RedisUtil;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.system.entity.SysDepart;
-import org.jeecg.modules.system.entity.SysUser;
-import org.jeecg.modules.system.entity.SysUserDepart;
-import org.jeecg.modules.system.entity.SysUserRole;
+import org.jeecg.modules.ctop.entity.ProjectMember;
+import org.jeecg.modules.ctop.service.IProjectMemberService;
+import org.jeecg.modules.system.entity.*;
+import org.jeecg.modules.system.mapper.UserCompanyMapper;
 import org.jeecg.modules.system.model.DepartIdModel;
 import org.jeecg.modules.system.model.SysUserDepartsVO;
 import org.jeecg.modules.system.service.*;
@@ -58,24 +61,24 @@ public class SysUserController {
 
     @Autowired
     private ISysUserService sysUserService;
-
     @Autowired
     private ISysDepartService sysDepartService;
-
     @Autowired
     private ISysUserRoleService sysUserRoleService;
-
     @Autowired
     private ISysUserDepartService sysUserDepartService;
-
     @Autowired
     private ISysUserRoleService userRoleService;
-
     @Autowired
     private RedisUtil redisUtil;
-
     @Autowired
     private IUserCompanyService userCompanyService;
+    @Autowired
+    private ISysRoleService roleService;
+    @Autowired
+    private IProjectMemberService memberService;
+    @Autowired
+    private ISysDepartService departService;
 
 
     @RequestMapping(value = "/getRoleInfo", method = RequestMethod.GET)
@@ -91,34 +94,41 @@ public class SysUserController {
     @RequestMapping(value = "/list", method = RequestMethod.GET)
     public Result<IPage<SysUser>> queryPageList(SysUser user, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
-        Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
+        Result<IPage<SysUser>> result = new Result<>();
+        String realName = user.getRealname();
         QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
-        Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
+        if(null!=realName&&!"".equals(realName)){
+            queryWrapper.like("realname",realName);
+        }
+        Page<SysUser> page = new Page<>(pageNo, pageSize);
         IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
     }
 
+    @Autowired
+    private UserCompanyMapper userCompanyMapper;
 
     @RequestMapping(value = "/getAllUserListByCompany", method = RequestMethod.GET)
-    public Result<List<SysUserVo>> getAllUserListByCompany(String userId) {
+    public Result<List<SysUserVo>> getAllUserListByCompany() {
         Result<List<SysUserVo>> result = new Result<>();
         try {
-            /*List<SysUserVo> userList = new ArrayList<>();
-            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode)) {
-                QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
-                userCompanyQueryWrapper.eq("user_id", userId);
-                userCompanyQueryWrapper.orderByDesc("create_time");
-                userCompanyQueryWrapper.last("limit 1");
-                UserCompany userCompany = userCompanyMapper.selectOne(userCompanyQueryWrapper);
-                userList = sysUserService.getUserListByCompany(userCompany.getCompanyId());
-            } else {
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
+            userCompanyQueryWrapper.eq("user_id", user.getId());
+            userCompanyQueryWrapper.orderByDesc("create_time");
+            userCompanyQueryWrapper.last("limit 1");
+            UserCompany userCompany = userCompanyMapper.selectOne(userCompanyQueryWrapper);
+            String companyId = userCompany.getCompanyId();
+            List<SysUserVo> userList;
+            if ("4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
                 userList = sysUserService.getAllUser();
+            } else {
+                userList = sysUserService.getUserListByCompany(companyId);
             }
-*/
-            List<SysUserVo> userList = sysUserService.getAllUser();
+
+
             result.setSuccess(true);
             result.setResult(userList);
         } catch (Exception e) {
@@ -135,7 +145,19 @@ public class SysUserController {
     public Result<List<SysUserVo>> getAllList() {
         Result<List<SysUserVo>> result = new Result<>();
         try {
-            List<SysUserVo> userList = sysUserService.getAllUser();
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
+            userCompanyQueryWrapper.eq("user_id", user.getId());
+            userCompanyQueryWrapper.orderByDesc("create_time");
+            userCompanyQueryWrapper.last("limit 1");
+            UserCompany userCompany = userCompanyMapper.selectOne(userCompanyQueryWrapper);
+            String companyId = userCompany.getCompanyId();
+            List<SysUserVo> userList;
+            if ("4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
+                userList = sysUserService.getAllUser();
+            } else {
+                userList = sysUserService.getUserListByCompany(companyId);
+            }
             result.setSuccess(true);
             result.setResult(userList);
         } catch (Exception e) {
@@ -150,7 +172,21 @@ public class SysUserController {
     public Result<List<SysUserVo>> getSaleList() {
         Result<List<SysUserVo>> result = new Result<>();
         try {
-            List<SysUserVo> userList = sysUserService.getAllSales();
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            List<SysUserVo> userList;
+            QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
+            userCompanyQueryWrapper.eq("user_id", user.getId());
+            userCompanyQueryWrapper.orderByDesc("create_time");
+            userCompanyQueryWrapper.last("limit 1");
+            UserCompany userCompany = userCompanyMapper.selectOne(userCompanyQueryWrapper);
+            String companyId = userCompany.getCompanyId();
+            if ("4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
+                userList = sysUserService.getAllSales();
+            } else {
+                userList = sysUserService.getAllSalesByCompanyId(companyId);
+            }
+
+
             result.setSuccess(true);
             result.setResult(userList);
         } catch (Exception e) {
@@ -169,7 +205,14 @@ public class SysUserController {
         String selectedRoles = jsonObject.getString("selectedroles");
         String selectedDeparts = jsonObject.getString("selecteddeparts");
         try {
+
             SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
+            if (!Check.isNull(selectedDeparts)) {
+                SysDepart depart = departService.getById(selectedDeparts);
+                if (!Check.isNull(depart)) {
+                    user.setOrgCode(depart.getOrgCode());
+                }
+            }
             //设置创建时间
             user.setCreateTime(new Date());
             String salt = oConvertUtils.randomGen(8);
@@ -191,9 +234,8 @@ public class SysUserController {
         return result;
     }
 
-    @RequestMapping(value = "/edit", method = RequestMethod.PUT)
-    //	@RequiresPermissions("user:edit")
 
+    @RequestMapping(value = "/edit", method = RequestMethod.PUT)
     public Result<SysUser> edit(@RequestBody JSONObject jsonObject) {
         Result<SysUser> result = new Result<SysUser>();
         try {
@@ -206,11 +248,33 @@ public class SysUserController {
                 //String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
                 user.setPassword(sysUser.getPassword());
                 String roles = jsonObject.getString("selectedroles");
-
                 String departs = jsonObject.getString("selecteddeparts");
+                if (!Check.isNull(departs)) {
+                    SysDepart depart = departService.getById(departs);
+                    if (!Check.isNull(depart)) {
+                        user.setOrgCode(depart.getOrgCode());
+                    }
+                }
                 sysUserService.editUserWithRole(user, roles);
                 sysUserService.editUserWithDepart(user, departs);
                 userCompanyService.addOrUpdateUserWithCompany(user);
+                if (!Check.isNull(roles)) {
+                    Thread thread = new Thread() {
+                        @Override
+                        public void run() {
+                            SysRole sysRole = roleService.getById(roles);
+                            if (!Check.isNull(sysRole)) {
+                                QueryWrapper<ProjectMember> memberQueryWrapper = new QueryWrapper<>();
+                                memberQueryWrapper.eq("user_id", user.getId());
+                                ProjectMember updateMember = new ProjectMember();
+                                updateMember.setRoleCode(sysRole.getRoleCode());
+                                memberService.update(updateMember, memberQueryWrapper);
+                            }
+                        }
+                    };
+                    thread.start();
+                }
+
                 result.success("修改成功!");
             }
         } catch (Exception e) {

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java

@@ -80,4 +80,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
     List<SysUserVo> getUserListByCompany(@Param("companyId") String companyId);
 
     List<SysUserVo> getAllSale();
+
+    List<SysUserVo> getAllSalesByCompanyId(@Param("companyId") String companyId);
 }

+ 28 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml

@@ -94,15 +94,34 @@ SELECT
     WHERE t1.company_id = #{companyId}
     </select>
     <select id="getAllSale" resultType="cn.com.ctop.common.module.vo.SysUserVo">
-        SELECT
-            t1.id userId,
-            t1.username userName,
-            t1.realname realName,
-            t3.role_name as  roleName
-        FROM sys_user t1
-        LEFT JOIN sys_user_role t2 on t1.id = t2.user_id
-        left join sys_role t3 on t3.id = t2.role_id
-        where t3.role_name like '销售%';
+       SELECT
+	t2.id userId,
+	t2.username userName,
+	t2.realname realName,
+   t4.role_name AS roleName
+    FROM
+	user_company t1
+    LEFT JOIN sys_user t2 ON t1.user_id = t2.id
+    LEFT JOIN sys_user_role t3 ON t2.id = t3.user_id
+    LEFT JOIN sys_role t4 ON t3.role_id = t4.id
+    WHERE
+	t4.role_name LIKE '%销售%';
+    </select>
+
+
+    <select id="getAllSalesByCompanyId" resultType="cn.com.ctop.common.module.vo.SysUserVo">
+       SELECT
+	t2.id userId,
+	t2.username userName,
+	t2.realname realName,
+    t4.role_name AS roleName
+  FROM
+	user_company t1
+    LEFT JOIN sys_user t2 ON t1.user_id = t2.id
+    LEFT JOIN sys_user_role t3 ON t2.id = t3.user_id
+    LEFT JOIN sys_role t4 ON t3.role_id = t4.id
+    WHERE t1.company_id = #{companyId}
+	and t4.role_name LIKE '%销售%';
     </select>
 
 

+ 5 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysCategoryService.java

@@ -1,13 +1,12 @@
 package org.jeecg.modules.system.service;
 
-import java.util.List;
-
 import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.system.entity.SysCategory;
 import org.jeecg.modules.system.model.TreeSelectModel;
 
-import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
 
 /**
  * @Description: 分类字典
@@ -33,13 +32,14 @@ public interface ISysCategoryService extends IService<SysCategory> {
 	 * @param pcode
 	 * @return
 	 */
-	public List<TreeSelectModel> queryListByCode(String pcode) throws JeecgBootException;
+    List<TreeSelectModel> queryListByCode(String pcode) throws JeecgBootException;
 
     /**
 	  * 根据pid查询子节点集合
 	 * @param pid
 	 * @return
 	 */
-	public List<TreeSelectModel> queryListByPid(String pid);
+    List<TreeSelectModel> queryListByPid(String pid);
 
+    SysCategory getByCode(String getCode);
 }

+ 96 - 84
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java

@@ -22,115 +22,127 @@ import java.util.Set;
  */
 public interface ISysUserService extends IService<SysUser> {
 
-	public SysUser getUserByName(String username);
+    public SysUser getUserByName(String username);
+
+    /**
+     * 添加用户和用户角色关系
+     *
+     * @param user
+     * @param roles
+     */
+    public void addUserWithRole(SysUser user, String roles);
 
-	/**
-	 * 添加用户和用户角色关系
-	 * @param user
-	 * @param roles
-	 */
-	public void addUserWithRole(SysUser user,String roles);
 
+    /**
+     * 修改用户和用户角色关系
+     *
+     * @param user
+     * @param roles
+     */
+    public void editUserWithRole(SysUser user, String roles);
 
     /**
-	 * 修改用户和用户角色关系
-	 * @param user
-	 * @param roles
-	 */
-	public void editUserWithRole(SysUser user,String roles);
-
-	/**
-	 * 获取用户的授权角色
-	 * @param username
-	 * @return
-	 */
-	public List<String> getRole(String username);
+     * 获取用户的授权角色
+     *
+     * @param username
+     * @return
+     */
+    public List<String> getRole(String username);
 
     /**
-	  * 查询用户信息包括 部门信息
-	 * @param username
-	 * @return
-	 */
-	public SysUserCacheInfo getCacheUser(String username);
-
-	/**
-	 * 根据部门Id查询
-	 * @param
-	 * @return
-	 */
-	public IPage<SysUser> getUserByDepId(Page<SysUser> page, String departId, String username);
-
-	/**
-	 * 根据角色Id查询
-	 * @param
-	 * @return
-	 */
-	public IPage<SysUser> getUserByRoleId(Page<SysUser> page,String roleId, String username);
-
-	/**
-	 * 通过用户名获取用户角色集合
-	 *
-	 * @param username 用户名
-	 * @return 角色集合
-	 */
-	Set<String> getUserRolesSet(String username);
-
-	/**
-	 * 通过用户名获取用户权限集合
-	 *
-	 * @param username 用户名
-	 * @return 权限集合
-	 */
-	Set<String> getUserPermissionsSet(String username);
+     * 查询用户信息包括 部门信息
+     *
+     * @param username
+     * @return
+     */
+    public SysUserCacheInfo getCacheUser(String username);
 
     /**
-	 * 根据用户名设置部门ID
-	 * @param username
-	 * @param orgCode
-	 */
-	void updateUserDepart(String username,String orgCode);
+     * 根据部门Id查询
+     *
+     * @param
+     * @return
+     */
+    public IPage<SysUser> getUserByDepId(Page<SysUser> page, String departId, String username);
 
     /**
-	 * 根据手机号获取用户名和密码
-	 */
-	public SysUser getUserByPhone(String phone);
+     * 根据角色Id查询
+     *
+     * @param
+     * @return
+     */
+    public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username);
 
+    /**
+     * 通过用户名获取用户角色集合
+     *
+     * @param username 用户名
+     * @return 角色集合
+     */
+    Set<String> getUserRolesSet(String username);
 
-	/**
-	 * 根据邮箱获取用户
-	 */
-	public SysUser getUserByEmail(String email);
+    /**
+     * 通过用户名获取用户权限集合
+     *
+     * @param username 用户名
+     * @return 权限集合
+     */
+    Set<String> getUserPermissionsSet(String username);
 
+    /**
+     * 根据用户名设置部门ID
+     *
+     * @param username
+     * @param orgCode
+     */
+    void updateUserDepart(String username, String orgCode);
 
-	/**
-	 * 添加用户和用户部门关系
-	 * @param user
-	 * @param selectedParts
-	 */
-	void addUserWithDepart(SysUser user, String selectedParts);
+    /**
+     * 根据手机号获取用户名和密码
+     */
+    public SysUser getUserByPhone(String phone);
 
-	/**
-	 * 编辑用户和用户部门关系
-	 * @param user
-	 * @param departs
-	 */
-	void editUserWithDepart(SysUser user, String departs);
 
     /**
-	   * 校验用户是否有效
-	 * @param sysUser
-	 * @return
-	 */
-	Result checkUserIsEffective(SysUser sysUser);
+     * 根据邮箱获取用户
+     */
+    public SysUser getUserByEmail(String email);
+
+
+    /**
+     * 添加用户和用户部门关系
+     *
+     * @param user
+     * @param selectedParts
+     */
+    void addUserWithDepart(SysUser user, String selectedParts);
+
+    /**
+     * 编辑用户和用户部门关系
+     *
+     * @param user
+     * @param departs
+     */
+    void editUserWithDepart(SysUser user, String departs);
+
+    /**
+     * 校验用户是否有效
+     *
+     * @param sysUser
+     * @return
+     */
+    Result checkUserIsEffective(SysUser sysUser);
 
     Map<String, Object> queryRoleCode(String userId);
 
     List<SysUserVo> getAllUser();
 
 
-	List<SysUserVo> getUserListByCompany(String companyId);
+    List<SysUserVo> getUserListByCompany(String companyId);
 
     List<SysUser> getUserListByRoleId(String roleId);
 
     List<SysUserVo> getAllSales();
+
+    List<SysUserVo> getAllSalesByCompanyId(String companyId);
 }

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysCategoryServiceImpl.java

@@ -121,4 +121,11 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
 		return baseMapper.queryListByPid(pid);
 	}
 
+	@Override
+	public SysCategory getByCode(String getCode) {
+		QueryWrapper<SysCategory>queryWrapper = new QueryWrapper<>();
+		queryWrapper.eq("code",getCode).orderByDesc("create_time").last("limit 1");
+		return this.getOne(queryWrapper);
+	}
+
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java

@@ -289,5 +289,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return userMapper.getAllSale();
     }
 
+    @Override
+    public List<SysUserVo> getAllSalesByCompanyId(String companyId) {
+        return userMapper.getAllSalesByCompanyId(companyId);
+
+    }
+
 
 }

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

@@ -14,11 +14,6 @@ management:
         include: metrics,httptrace
 
 spring:
-  rabbitmq:
-    host: 39.106.184.70
-    port: 5672
-    username: guest
-    password: guest
   servlet:
     multipart:
       max-file-size: -1
@@ -135,7 +130,7 @@ mybatis-plus:
       table-underline: true
     configuration:
       # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
-      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+      #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
   ffmpeg:

+ 2 - 5
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -12,11 +12,6 @@ management:
       exposure:
         include: metrics,httptrace
 spring:
-  rabbitmq:
-    host: 39.106.184.70
-    port: 5672
-    username: guest
-    password: guest
   servlet:
     multipart:
       max-file-size: -1
@@ -136,6 +131,8 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
   ffmpeg:

+ 19 - 19
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8080
+  port: 8088
   ip: 39.106.184.70
   servlet:
     context-path: /jeecg-boot
@@ -14,11 +14,6 @@ management:
         include: metrics,httptrace
 
 spring:
-  rabbitmq:
-    host: 39.106.184.70
-    port: 5672
-    username: guest
-    password: guest
   servlet:
     multipart:
       max-file-size: -1
@@ -34,6 +29,9 @@ spring:
           starttls:
             enable: true
             required: true
+  ## quartz定时任务,采用数据库方式
+  quartz:
+    job-store-type: jdbc
   #json 时间戳统一转换
   jackson:
     date-format:   yyyy-MM-dd HH:mm:ss
@@ -41,6 +39,7 @@ spring:
   aop:
     proxy-target-class: true
   #配置freemarker
+  #配置freemarker
   freemarker:
     # 设置模板后缀名
     suffix: .ftl
@@ -95,18 +94,17 @@ spring:
         filters: stat,slf4j
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      #      datasource:
+      #        master:
+      #          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+      #          username: hcst
+      #          password: test@20190531
       datasource:
         master:
           url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
           password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
-          # 多数据源配置
-          #multi-datasource1:
-          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
-          #username: root
-          #password: root
-          #driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0
@@ -131,9 +129,13 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-    configuration:
-      # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
-      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  # configuration:
+  #  map-underscore-to-camel-case: false
+  #分页pageHelper
+pagehelper:
+  helper-dialect: mysql
+  reasonable: true
+  support-methods-arguments: true
 #jeecg专用配置
 jeecg:
   ffmpeg:
@@ -146,7 +148,7 @@ jeecg:
     webapp: /data/webapp
     video-upload: /data/upload/video/
     image-upload: /data/upload/image/
-    chrome-driver: /usr/bin/chromedriver
+    chrome-driver: D://chromedriver.exe
     csv-upload: /data/upload/csv/
     report-history: /data/report/history/
     report-daily: /data/report/daily/
@@ -161,10 +163,8 @@ logging:
 chrome:
   script:
     clean: sh /mnt/webapp/cleanProcess.sh
-
-
 oss:
   replace:
-    replace-value: oss-cn-beijing-internal
+    replace-value: oss-cn-beijing
     replace-old-value: oss-cn-beijing
     download: /mnt/file/video/

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

@@ -14,3 +14,4 @@ swagger:
     enable: true
     username: jeecg
     password: jeecg1314
+

+ 0 - 1
jeecg-boot-module-system/src/main/resources/static/demo1.html

@@ -1 +0,0 @@
-demo1

+ 128 - 44
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,15 +1,20 @@
 package org.jeecg;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
-import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
+import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+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 lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -19,7 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 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.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -29,22 +36,133 @@ import java.util.concurrent.Executors;
 @Slf4j
 public class SampleTest {
     @Autowired
+    private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IReportService reportService;
+
+    @Test
+    public void testOceanEngineJob() {
+        try {
+            String url = "https://ad.e.kuaishou.com/rest/openapi/v1/tool/key_frame";
+            JSONArray ptotoArr = new JSONArray();
+            ptotoArr.add("5188991225263567823");
+
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", "e251db4aa139eb36623818581003bcec");
+            headers.put("Content-Type", "application/json");
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("advertiser_id", 161468);
+            requestJson.put("photo_ids", ptotoArr);
+            //  requestJson.put("type", type);
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
+            System.err.println(result);
+            //     CtopOauthToken byId = oauthTokenService.getById(1654059015242756L);
+
+          /*  SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date start = simpleDateFormat.parse("2020-01-01");
+            Date end = simpleDateFormat.parse("2020-06-03");*/
+
+
+            /*String nowDate = "2020-06-03";
+            String endDate = "2020-01-01";
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date start = simpleDateFormat.parse(nowDate);
+            Date end = simpleDateFormat.parse(endDate);
+            List<Date> dates = DateUtils.findDates(end, start);
+            for (int i = 0; i < dates.size(); i++) {
+                String formatDate = simpleDateFormat.format(dates.get(i));
+                Date parse = simpleDateFormat.parse(formatDate);
+                reportService.getAdvertiserReport(byId, parse, parse, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            }*/
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        String account = "3248395570@qq.com";
+       /* String password = "Ydxq-704127411";
+        oceanEngineService.login(account,password);
+        oceanEngineService.douyinHotHandler(1,1);
+        oceanEngineService.effectCaseHandler(1);
+        oceanEngineService.hotMaterialHandler(1,4,"抖音");
+        oceanEngineService.hotMaterialHandler(1,8,"头条");
+        oceanEngineService.hotMaterialHandler(1,1,"西瓜");
+        oceanEngineService.hotMaterialHandler(1,3,"火山");
+        oceanEngineService.hotMaterialHandler(1,9,"穿山甲");
+        log.info("巨量创意抓取完成");*/
+    }
+
+    @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
+    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
+
+    @Test
+    public void kuaishouLogin() {
+        Long start = System.currentTimeMillis();
+        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
+        if (list != null && !list.isEmpty()) {
+            for (BindAccountLogin login : list) {
+                if (null == login.getCookie() || "".equals(login.getCookie().trim())) {
+                    kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
+                }
+            }
+        }
+        Long end = System.currentTimeMillis();
+        log.info("总用时:{}毫秒", end - start);
+    }
+
+    static ExecutorService executorService = null;
+    static CountDownLatch countDownLatch = null;
+
+    @Test
+    public void kuaishouCommentDelete() {
+        Long start = System.currentTimeMillis();
+        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
+        if (list != null && !list.isEmpty()) {
+            executorService = Executors.newFixedThreadPool(10);
+            countDownLatch = new CountDownLatch(list.size());
+            list.forEach(login -> {
+                executorService.submit(() -> {
+                    try {
+                        if (null != login.getCookie() && !"".equals(login.getCookie().trim())) {
+                            kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(), login);
+                        }
+                    } catch (Exception e) {
+
+                    } finally {
+                        countDownLatch.countDown();
+                    }
+                });
+            });
+        }
+        try {
+            countDownLatch.await();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        Long end = System.currentTimeMillis();
+        log.info("总用时:{}毫秒", end - start);
+    }
+
+    @Autowired
     private PangolinLoginService pangolinLoginService;
     @Autowired
     private PangolinCrawlerService pangolinCrawlerService;
     @Autowired
     private PangolinAppService pangolinAppService;
+
     @Test
-    public void testPangolinLogin(){
+    public void testPangolinLogin() {
         QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("login_type","pangolin");
-        queryWrapper.eq("status",1);
+        queryWrapper.eq("login_type", "pangolin");
+        queryWrapper.eq("status", 1);
         List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
-        if(list!=null&&!list.isEmpty()){
-            for (BindAccountLogin login:list) {
-                if(null==login.getCookie()||"".equals(login.getCookie().trim())){
+        if (list != null && !list.isEmpty()) {
+            for (BindAccountLogin login : list) {
+                if (null == login.getCookie() || "".equals(login.getCookie().trim())) {
                     pangolinLoginService.pangolinLogin(login.getAccountName(), login.getPassword());
                 }
             }
@@ -52,7 +170,7 @@ public class SampleTest {
     }
 
     @Test
-    public void testPangolinData(){
+    public void testPangolinData() {
         QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("login_type", "pangolin");
         queryWrapper.eq("status", 1);
@@ -72,43 +190,9 @@ public class SampleTest {
             }
         }
     }
-
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IBytedanceFundDailyService bytedanceFundDailyService;
-    static ExecutorService executorService = null;
+}
 
 
-    @Test
-    public void testflowFund(){
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.error("头条账户流水数据异常:未获取到可用的token");
-            return ;
-        }
-        CountDownLatch countDownLatch   = new CountDownLatch(tokens.size());
-        executorService = Executors.newFixedThreadPool(5);
-        tokens.forEach(token -> {
-            executorService.submit(() -> {
-                try {
-                    for(int i=0;i<60;i++){
-                        String findDate = DateUtils.addDay(DateUtils.formatDate(),-i);
-                        bytedanceFundDailyService.loadFundDataByPage(token, findDate, findDate,1);
-                    }
-                }catch (Exception e){
-                }finally {
-                    countDownLatch.countDown();
-                }
-            });
-        });
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-}
 
 
 

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/constant/CtopRoleCodeConstant.java

@@ -0,0 +1,5 @@
+package cn.com.ctop.common.module.constant;
+
+public class CtopRoleCodeConstant {
+    public static final String COMMON_ROLE_CODE_ADMIN = "admin";
+}

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/constant/OssConstant.java

@@ -0,0 +1,5 @@
+package cn.com.ctop.common.module.constant;
+
+public class OssConstant {
+    public static final String formatUrl = "https://%s.%s.aliyuncs.com/";
+}

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java

@@ -101,4 +101,14 @@ public class BindAccountLogin {
     private Date updateTime;
 
     private String cookie;
+
+    public BindAccountLogin(Long id,String accountName) {
+        this.id = id;
+        this.accountName = accountName;
+    }
+
+    public BindAccountLogin() {
+    }
+
+    private Long projectId;
 }

+ 3 - 3
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialCutFrame.java

@@ -38,7 +38,7 @@ public class MaterialCutFrame {
      */
     @Excel(name = "素材库id", width = 15)
     @ApiModelProperty(value = "素材库id")
-    private String materialMd5;
+    private String videoSignature;
     /**
      * url
      */
@@ -50,13 +50,13 @@ public class MaterialCutFrame {
      */
     @Excel(name = "md5", width = 15)
     @ApiModelProperty(value = "md5")
-    private String code;
+    private String signature;
     /**
      * 素材标
      */
     @Excel(name = "素材标", width = 15)
     @ApiModelProperty(value = "素材标")
-    private Integer cutFrameIndex;
+    private Integer imageIndex;
 
     /**
      * createTime

+ 63 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialCutFrameTask.java

@@ -0,0 +1,63 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+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 java.util.Date;
+
+/**
+ * 截帧 任务表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-06-01
+ */
+@Data
+@TableName("ctop_material_cut_frame_task")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_material_cut_frame_task对象", description = "截帧 任务表")
+public class MaterialCutFrameTask {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 视频md5
+     */
+    @Excel(name = "视频md5", width = 15)
+    @ApiModelProperty(value = "视频md5")
+    private String videoSignature;
+    /**
+     * jobId
+     */
+    @Excel(name = "jobId", width = 15)
+    @ApiModelProperty(value = "jobId")
+    private String jobId;
+    /**
+     * 任务状态 0 未执行 1 已完成
+     */
+    @Excel(name = "任务状态 0 未执行 1 已完成", width = 15)
+    @ApiModelProperty(value = "任务状态 0 未执行 1 已完成")
+    private Integer jobStatus;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -153,4 +153,11 @@ public class MaterialInfo {
     private Boolean whetherUnaudited;  // 是否有未审核封面
 
 
+    @TableField(exist = false)
+    private String mediaId;  // 是否有未审核封面
+
+    @TableField(exist = false)
+    private String projectName;  // 是否有未审核封面
+
+
 }

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/BindAccountLoginMapper.java

@@ -1,7 +1,12 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
+import cn.com.ctop.common.module.vo.PangolinAccountVO;
+import cn.com.ctop.common.module.vo.PangolinProjectVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @Description: 账号绑定-登陆
@@ -11,4 +16,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface BindAccountLoginMapper extends BaseMapper<BindAccountLogin> {
 
+    List<PangolinProjectVO> getProjectByParams(@Param(value = "userId") String userId,
+                                               @Param(value = "loginType") String loginType,
+                                               @Param(value = "projectId") Long projectId);
+    List<PangolinAccountVO> getAccountByParams(@Param(value = "userId") String userId,
+                                              @Param(value = "loginType") String loginType,
+                                              @Param(value = "projectId") Long projectId);
 }

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialCutFrameTaskMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.MaterialCutFrameTask;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 截帧 任务表
+ *
+ * @author: jeecg-boot
+ * @date: 2020-06-01
+ * @cersion: V1.0
+ */
+public interface MaterialCutFrameTaskMapper extends BaseMapper<MaterialCutFrameTask> {
+
+}

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

@@ -34,4 +34,6 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
     MaterialInfo getMaterialInfoByCode(@Param("code") String code);
 
     Long getProjectIdByAccountId(@Param("accountId") Long accountId);
+
+    List<MaterialInfo> getListByDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/SysRoleMapper.java

@@ -20,7 +20,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
     /**
      * 根据roleCode获取相对应的用户信息
      */
-    List<UserDto> getUserByRoleCode(@Param("roleCode") String roleCode);
+
 
     String getRoleIdByRoleCode(@Param("roleCode") String roleCode);
 

+ 34 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/BindAccountLoginMapper.xml

@@ -2,4 +2,38 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.BindAccountLoginMapper">
 
+    <select id="getProjectByParams" resultType="cn.com.ctop.common.module.vo.PangolinProjectVO">
+        select
+            project.project_name,
+            project.id as 'project_id'
+        from
+            ctop_bind_account_login login
+            left join ctop_project project on login.project_id = project.id
+        where 1=1
+        <if test="userId!=null">
+            and user_id = #{userId}
+        </if>
+        <if test="loginType!=null">
+            and login_type = #{loginType}
+        </if>
+        group by project_id
+    </select>
+    <select id="getAccountByParams" resultType="cn.com.ctop.common.module.vo.PangolinAccountVO">
+        select
+        login.account_id,
+        login.account_name
+        from
+        ctop_bind_account_login login
+        left join ctop_project project on login.project_id = project.id
+        where 1=1
+        <if test="userId!=null">
+            and login.user_id = #{userId}
+        </if>
+        <if test="loginType!=null">
+            and login.login_type = #{loginType}
+        </if>
+        <if test="projectId!=null">
+            and project.id = #{projectId}
+        </if>
+    </select>
 </mapper>

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialCutFrameTaskMapper.xml

@@ -0,0 +1,5 @@
+<?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.common.module.mapper.MaterialCutFrameTaskMapper">
+
+</mapper>

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

@@ -130,5 +130,13 @@
         limit 1
     </select>
 
+    <select id="getListByDate" resultType="cn.com.ctop.common.module.entity.MaterialInfo">
+        select  *  from
+        ctop_material_info
+        where  1 = 1
+        and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= #{endDate}
+    </select>
+
 
 </mapper>

+ 0 - 16
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysRoleMapper.xml

@@ -2,22 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.SysRoleMapper">
 
-	<!-- 根据rolecode获取相对应角色所有的人 -->
-    <select id="getUserByRoleCode" resultType="cn.com.ctop.common.module.vo.UserDto">
-			select
-			a.id as userId,
-			a.realname,
-			c.id as roleId,
-			c.role_name as roleName
-		from
-		sys_user a
-		left join sys_user_role b on a.id = b.user_id
-		left join sys_role c on b.role_id = c.id
-		left join sys_
-        where
-        c.role_code = #{roleCode}
-	</select>
-
 	<!-- 根据roleCode获取roleId -->
 	<select id="getRoleIdByRoleCode" resultType="java.lang.String">
 		select

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IBindAccountLoginService.java

@@ -1,7 +1,13 @@
 package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
+import cn.com.ctop.common.module.vo.PangolinProjectVO;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.http.client.CookieStore;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 账号绑定-登陆
@@ -10,6 +16,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface IBindAccountLoginService extends IService<BindAccountLogin> {
+    boolean checkLogin(BindAccountLogin bindAccountLogin, String response);
+
     /**
      * 查询
      *
@@ -17,4 +25,15 @@ public interface IBindAccountLoginService extends IService<BindAccountLogin> {
      * @return
      */
     BindAccountLogin selectByAccountId(String accountId);
+
+    Map<String, Object> getListByUserId(String userId);
+
+    List<BindAccountLogin> getListByParams(String loginType,Integer status);
+
+    CookieStore setCookie(BindAccountLogin bindAccountLogin,String domain) throws JsonProcessingException;
+
+    BindAccountLogin getByParams(String accountName, String password, String advertiserId);
+
+    List<PangolinProjectVO> getProjectByParams(String userId, String loginType);
+
 }

+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialCutFrameService.java

@@ -14,6 +14,8 @@ import java.io.IOException;
  * @date 2019-12-25
  */
 public interface IMaterialCutFrameService extends IService<MaterialCutFrame> {
-    void getCutFrame(String url, String materialId, String height, String width) throws IOException;
+    void getCutFrame(String url, String materialId, Long secondDuration, String height, String width) throws IOException;
+
+    void loadCutFrame(String jobId, String videoSignature);
 
 }

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialCutFrameTaskService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.MaterialCutFrameTask;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 截帧 任务表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-06-01
+ */
+public interface IMaterialCutFrameTaskService extends IService<MaterialCutFrameTask> {
+
+}

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

@@ -64,4 +64,5 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     List<String> getEffiCode();
 
+    List<MaterialInfo> getListByDate(String startDate, String endDate);
 }

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -1,9 +1,11 @@
 package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 用户分配
@@ -17,5 +19,9 @@ public interface IUserAllocationService extends IService<UserAllocation> {
 
     List<UserAllocation> getByProjectId(Long projectId, String systemType);
 
+    Map<String, Object> getPangolinAccountListByParams(String userId, JSONObject data);
+
+    Map<String, Object> getPangolinProjectListByParams(String userId);
+
     List<UserAllocation> selectAccountListByProjectId(Long projectId);
 }

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

@@ -9,6 +9,7 @@ import cn.com.ctop.common.module.utils.PropertiesUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import java.io.UnsupportedEncodingException;
@@ -25,6 +26,7 @@ import java.util.Map;
  */
 @Slf4j
 @Service
+@Primary
 public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMapper, BindAccountAuth> implements IBindAccountAuthService {
 
     @Autowired

+ 114 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java

@@ -3,11 +3,28 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.mapper.BindAccountLoginMapper;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.common.module.vo.PangolinAccountVO;
+import cn.com.ctop.common.module.vo.PangolinProjectVO;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.http.client.CookieStore;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.cookie.BasicClientCookie;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @Description: 账号绑定-登陆
  * @Author: jeecg-boot
@@ -18,9 +35,106 @@ import org.springframework.stereotype.Service;
 @Service
 public class BindAccountLoginServiceImpl extends ServiceImpl<BindAccountLoginMapper, BindAccountLogin> implements IBindAccountLoginService {
     @Override
+    public boolean checkLogin(BindAccountLogin bindAccountLogin, String response) {
+        if (response.contains("<html>")) {
+            bindAccountLogin.setCookie("");
+            this.updateById(bindAccountLogin);
+            return false;
+        }
+        return true;
+    }
+    @Override
     public BindAccountLogin selectByAccountId(String accountId) {
         QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("account_id", accountId).orderByDesc("id").last("limit 1");
         return this.getOne(queryWrapper);
     }
+
+    @Override
+    public BindAccountLogin getByParams(String accountName, String password, String advertiserId) {
+        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
+        if(null!=accountName&&!"".equals(accountName)){
+            queryWrapper.eq("account_name",accountName);
+        }
+        if(null!=password&&!"".equals(password)){
+            queryWrapper.eq("password",password);
+        }
+        if(null!=advertiserId&&!"".equals(advertiserId)){
+            queryWrapper.eq("advertiser_id",advertiserId);
+        }
+        queryWrapper.orderByDesc("create_time").last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+
+    @Override
+    public List<PangolinProjectVO> getProjectByParams(String userId, String loginType) {
+        List<PangolinProjectVO> projectVOS =  bindAccountLoginMapper.getProjectByParams(userId,loginType,null);
+        List<PangolinProjectVO> setProjectVOS = new ArrayList<>();
+        if(null!=projectVOS&&!projectVOS.isEmpty()){
+            projectVOS.forEach(pangolinProjectVO -> {
+                List<PangolinAccountVO>accountVOS = bindAccountLoginMapper.getAccountByParams(userId,loginType,pangolinProjectVO.getProjectId());
+                pangolinProjectVO.setAccountVOList(accountVOS);
+                setProjectVOS.add(pangolinProjectVO);
+            });
+        }
+        return setProjectVOS;
+    }
+
+    @Autowired
+    private BindAccountLoginMapper bindAccountLoginMapper;
+
+    @Override
+    public Map<String, Object> getListByUserId(String userId) {
+        Map<String,Object>result = new HashMap<>();
+        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("login_type", CtopAdConstant.PLATFORM_TYPE_PANGOLIN_PY);
+        List<BindAccountLogin> loginList = new ArrayList<>();
+        if(userId == null||"".equals(userId.trim())){
+            loginList.add(new BindAccountLogin(0L,"全部"));
+        }else{
+            queryWrapper.eq("user_id",userId);
+        }
+        loginList.addAll(this.list(queryWrapper));
+        result.put("data",loginList);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Override
+    public List<BindAccountLogin> getListByParams(String loginType, Integer status) {
+        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
+        if(null!=loginType&&!loginType.equals("")){
+            queryWrapper.eq("login_type",loginType);
+        }
+        if(status!=null){
+            queryWrapper.eq("status",status);
+        }
+        return this.list(queryWrapper);
+    }
+
+    @Override
+    public CookieStore setCookie(BindAccountLogin bindAccountLogin,String domain) throws JsonProcessingException {
+        ObjectMapper mapper = new ObjectMapper();
+        List<String> cookieList = mapper.readValue(bindAccountLogin.getCookie(), new TypeReference<List<String>>() {});
+        if(cookieList == null||cookieList.isEmpty()){
+            return null;
+        }
+        CookieStore cookieStore = new BasicCookieStore();
+        for (String cookieStr : cookieList) {
+            String[] cookieArray = cookieStr.split(";");
+            Map<String, String> cookieMap = new HashMap<>();
+            for (String cookie : cookieArray) {
+                String[] kv = cookie.split("=");
+                if (kv.length > 1) {
+                    cookieMap.put(kv[0].trim(), kv[1].trim());
+                }
+            }
+            BasicClientCookie clientCookie = new BasicClientCookie(cookieArray[0].split("=")[0],
+                    cookieArray[0].split("=")[1]);
+            clientCookie.setDomain(domain);
+            clientCookie.setPath(cookieMap.get("path"));
+            cookieStore.addCookie(clientCookie);
+        }
+        return cookieStore;
+    }
 }

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

@@ -8,10 +8,12 @@ import me.chanjar.weixin.cp.api.impl.WxCpOAuth2ServiceImpl;
 import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
 import me.chanjar.weixin.cp.bean.WxCpMessage;
 import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 @Slf4j
 @Service
+@Primary
 public class CorpWeixinServiceImpl implements ICorpWeixinService {
     public static void main(String[] args) {
         val configStorage = new WxCpDefaultConfigImpl();

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

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.CtopCorpWexinUser;
 import cn.com.ctop.common.module.mapper.CtopCorpWexinUserMapper;
 import cn.com.ctop.common.module.service.ICtopCorpWexinUserService;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -15,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  * @date 2019-12-08
  */
 @Service
+@Primary
 public class CtopCorpWexinUserServiceImpl extends ServiceImpl<CtopCorpWexinUserMapper, CtopCorpWexinUser> implements ICtopCorpWexinUserService {
 
 }

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

@@ -25,7 +25,7 @@ import java.util.Map;
  * @Version: V1.0
  */
 @Slf4j
-@Service("ctopOauthTokenService")
+@Service
 public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper, CtopOauthToken> implements ICtopOauthTokenService {
     @Autowired
     private CtopOauthTokenMapper cTopOauthTokenMapper;

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

@@ -23,6 +23,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -42,6 +43,7 @@ import java.util.Map;
  */
 @Slf4j
 @Service
+@Primary
 public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> implements IFileInfoService {
     @Value("${jeecg.path.image-upload}")
     private String imageUploadPath;

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

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
@@ -22,6 +23,7 @@ import java.util.List;
  */
 @Slf4j
 @Service
+@Primary
 public class IpPoolServiceImpl extends ServiceImpl<IpPoolMapper, IpPool> implements IIpPoolService {
 
     @Override

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

@@ -7,6 +7,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 /**
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
  * @date 2019-12-08
  */
 @Service
+@Primary
 public class MailLogServiceImpl extends ServiceImpl<MailLogMapper, MailLog> implements IMailLogService {
     @Autowired
     private MailLogMapper mailLogMapper;

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

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.MaterialAscription;
 import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 /**
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
  * @date 2019-11-23
  */
 @Service
+@Primary
 public class MaterialAscriptionServiceImpl extends ServiceImpl<MaterialAscriptionMapper, MaterialAscription> implements IMaterialAscriptionService {
 
 }

+ 119 - 61
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java

@@ -1,8 +1,12 @@
 package cn.com.ctop.common.module.service.impl;
 
+import cn.com.ctop.common.module.constant.OssConstant;
 import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import cn.com.ctop.common.module.entity.MaterialCutFrameTask;
 import cn.com.ctop.common.module.mapper.MaterialCutFrameMapper;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialCutFrameTaskService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.MpsUtils;
 import com.alibaba.fastjson.JSON;
@@ -14,7 +18,11 @@ import com.aliyuncs.mts.model.v20140618.QuerySnapshotJobListResponse;
 import com.aliyuncs.mts.model.v20140618.SubmitSnapshotJobRequest;
 import com.aliyuncs.mts.model.v20140618.SubmitSnapshotJobResponse;
 import com.aliyuncs.profile.DefaultProfile;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
@@ -28,33 +36,50 @@ import java.net.URLEncoder;
  * @version V1.0
  * @date 2019-12-25
  */
-@Service("materialCutFrameService")
+@Slf4j
+@Service
 public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMapper, MaterialCutFrame> implements IMaterialCutFrameService {
 
     private static String ossLocation = "oss-cn-beijing";
     private static String ossBucket = "ctop-media";
     private static String ossOutputObject = "output_{Count}.jpg";
 
+    @Value("${jeecg.path.image-upload}")
+    private String imageUpLoadPath;
+
+
+    @Autowired
+    private IMaterialCutFrameTaskService cutFrameTaskService;
+
     /**
      * 获取素材关键帧
      *
      * @param url
      */
     @Override
-    public void getCutFrame(String url, String materialId, String height, String width) throws IOException {
+    public void getCutFrame(String url, String materialId, Long secondDuration, String height, String width) throws IOException {
         try {
-            String zeroFrameUrl = url + "?x-oss-process=video/snapshot,t_00000,m_fast";
 
-            // String localPath = LoadFileUtil.downLoadFromUrl(zeroFrameUrl, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-            String localPath = LoadFileUtil.downLoadFromUrl(zeroFrameUrl, "D:\\tets1");
+            QueryWrapper<MaterialCutFrameTask> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("video_signature", materialId);
+            queryWrapper.last("limit 1");
+            MaterialCutFrameTask checkCutFrame = cutFrameTaskService.getOne(queryWrapper);
+            if (!Check.isNull(checkCutFrame)) {
+                log.info("已存推荐封面");
+                return;
+
+            }
+
+            String zeroFrameUrl = url + "?x-oss-process=video/snapshot,t_00000,m_fast";
+            String localPath = LoadFileUtil.downLoadFromUrl(zeroFrameUrl, imageUpLoadPath);
             String md5 = LoadFileUtil.getMD5(localPath);
             LoadFileUtil.delFile(localPath);
 
             MaterialCutFrame cutFrame = new MaterialCutFrame();
-            cutFrame.setCode(md5);
+            cutFrame.setSignature(md5);
             cutFrame.setUrl(zeroFrameUrl);
-            cutFrame.setMaterialMd5(materialId);
-            cutFrame.setCutFrameIndex(0);
+            cutFrame.setVideoSignature(materialId);
+            cutFrame.setImageIndex(0);
             this.save(cutFrame);
 
 
@@ -72,11 +97,13 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
             JSONObject input = new JSONObject();
             input.put("Location", ossLocation);
             input.put("Bucket", ossBucket);
-
+         //   https://ctop-media.oss-cn-beijing.aliyuncs.com/video/2020-06-03/bp%E8%95%89%E4%B8%8B%E7%9B%B4%E6%92%AD2-1591188835505.mp4
             String replaceUrl = url.replace("https://ctop-media.oss-cn-beijing.aliyuncs.com/", "");
             input.put("Object", replaceUrl);
 
             request.setInput(input.toJSONString());
+
+
             // SnapshotConfig
             JSONObject snapshotConfig = new JSONObject();
             // SnapshotConfig->OutputFile
@@ -89,10 +116,15 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
 
             snapshotConfig.put("OutputFile", output.toJSONString());
             // SnapshotConfig->Time
-            snapshotConfig.put("Time", "3");
+            //   Integer time = ((secondDuration.intValue() - 2) / 14) + 1; // 时长 / 14 == 间隔时间
+
+            double num = (double) (secondDuration - 2) / 15;
+            long rint = Math.round(num);
+            log.info("相隔时间数:{}", rint);
+            snapshotConfig.put("Time", 2000);
             // SnapshotConfig->Interval/Num
-            snapshotConfig.put("Interval", "2");
-            snapshotConfig.put("Num", "9");
+            snapshotConfig.put("Interval", rint);
+            snapshotConfig.put("Num", "14");
             // SnapshotConfig->Width/Height
             snapshotConfig.put("Height", height);
             snapshotConfig.put("Width", width);
@@ -101,60 +133,86 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
             // PipelineId
             String pipelineId = MpsUtils.getPipelineId(client);
             request.setPipelineId(pipelineId);
-            // call api
-            SubmitSnapshotJobResponse response;
-            response = client.getAcsResponse(request);
-            for (int i = 0; i < 100; i++) {
-                Thread.sleep(5 * 1000L);
-                QuerySnapshotJobListRequest request1 = new QuerySnapshotJobListRequest();
-                request1.setSnapshotJobIds(response.getSnapshotJob().getId());
-                QuerySnapshotJobListResponse response1 = client.getAcsResponse(request1);
-                String s = JSON.toJSONString(response1);
-                JSONObject jsonObject = JSONObject.parseObject(s);
-                if (jsonObject == null) {
-                    continue;
-                }
-                JSONObject json = (JSONObject) jsonObject.getJSONArray("snapshotJobList").get(0);
-                String state = json.getString("state");
-                if (null == state || !"Success".equals(state)) {
-                    continue;
-                }
-                Integer count = json.getInteger("count");
-                for (int j = 1; j <= count; j++) {
-                    String urlStr = "";
-                    if (j < 10) {
-                        urlStr = String.format(
-                                "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_0000" + j + ".jpg",
-                                ossBucket,
-                                ossLocation);
-                    } else if (j < 100) {
-                        urlStr = String.format(
-                                "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_000" + j + ".jpg",
-                                ossBucket,
-                                ossLocation);
-                    } else if (j > 100) {
-                        urlStr = String.format(
-                                "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_00" + j + ".jpg",
-                                ossBucket,
-                                ossLocation);
-                    }
-                    String cutFramePath = LoadFileUtil.downLoadFromUrl(urlStr, "D:\\tets1");
-                    String cutFrameMd5 = LoadFileUtil.getMD5(cutFramePath);
-                    LoadFileUtil.delFile(cutFramePath);
-                    cutFrame = new MaterialCutFrame();
-                    cutFrame.setCode(cutFrameMd5);
-                    cutFrame.setUrl(urlStr);
-                    cutFrame.setMaterialMd5(materialId);
-                    cutFrame.setCutFrameIndex(j);
-                    this.save(cutFrame);
+            SubmitSnapshotJobResponse response = client.getAcsResponse(request);
+            String jobId = response.getSnapshotJob().getId();
+            MaterialCutFrameTask cutFrameTask = new MaterialCutFrameTask();
+            cutFrameTask.setJobStatus(0);
+            cutFrameTask.setJobId(jobId);
+            cutFrameTask.setVideoSignature(materialId);
+            cutFrameTaskService.save(cutFrameTask);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+
+
+    }
+
+
+    @Override
+    public void loadCutFrame(String jobId, String videoSignature) {
+        try {
+            DefaultProfile profile = DefaultProfile.getProfile(
+                    "cn-beijing",
+                    "LTAIbNbqWzSOklQV",
+                    "1rkPz7JNoXk8sJevPaeYHWqfkQXBGh");
+            IAcsClient client = new DefaultAcsClient(profile);
+
+            QuerySnapshotJobListRequest request = new QuerySnapshotJobListRequest();
+            request.setSnapshotJobIds(jobId);
+            QuerySnapshotJobListResponse response = client.getAcsResponse(request);
+            JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(response));
+            if (jsonObject == null) {
+                return;
+            }
+            JSONObject json = (JSONObject) jsonObject.getJSONArray("snapshotJobList").get(0);
+            String state = json.getString("state");
+            if (null == state || !"Success".equals(state)) {
+                return;
+            }
+            String loadImage = "cutFrame/" + videoSignature + "/";
+
+            Integer count = json.getInteger("count");
+            for (int j = 1; j <= count; j++) {
+                String urlStr = null;
+                if (j < 10) {
+                    urlStr = String.format(
+                            OssConstant.formatUrl + loadImage + "output_0000" + j + ".jpg",
+                            ossBucket,
+                            ossLocation);
+                } else if (j < 100) {
+                    urlStr = String.format(
+                            OssConstant.formatUrl + loadImage + "output_000" + j + ".jpg",
+                            ossBucket,
+                            ossLocation);
+                } else if (j > 100) {
+                    urlStr = String.format(
+                            OssConstant.formatUrl + loadImage + "output_00" + j + ".jpg",
+                            ossBucket,
+                            ossLocation);
                 }
-                break;
+                String cutFramePath = LoadFileUtil.downLoadFromUrl(urlStr, imageUpLoadPath);
+                String cutFrameMd5 = LoadFileUtil.getMD5(cutFramePath);
+
+                MaterialCutFrame cutFrame = new MaterialCutFrame();
+                cutFrame.setSignature(cutFrameMd5);
+                cutFrame.setUrl(urlStr);
+                cutFrame.setVideoSignature(videoSignature);
+                cutFrame.setImageIndex(j);
+                this.save(cutFrame);
+                LoadFileUtil.delFile(cutFramePath);
+
             }
+
+            QueryWrapper<MaterialCutFrameTask> updateQueryWrapper = new QueryWrapper<>();
+            updateQueryWrapper.eq("job_id", jobId);
+            updateQueryWrapper.eq("video_signature", videoSignature);
+            MaterialCutFrameTask updateTask = new MaterialCutFrameTask();
+            updateTask.setJobStatus(1);
+            cutFrameTaskService.update(updateTask, updateQueryWrapper);
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage());
         }
 
-
     }
 
 

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameTaskServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialCutFrameTask;
+import cn.com.ctop.common.module.mapper.MaterialCutFrameTaskMapper;
+import cn.com.ctop.common.module.service.IMaterialCutFrameTaskService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 截帧 任务表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-06-01
+ */
+@Service
+public class MaterialCutFrameTaskServiceImpl extends ServiceImpl<MaterialCutFrameTaskMapper, MaterialCutFrameTask> implements IMaterialCutFrameTaskService {
+
+}

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

@@ -33,7 +33,7 @@ import java.util.Map;
  * @date 2020-03-16
  */
 @Slf4j
-@Service("materialImageInfoService")
+@Service
 public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoMapper, MaterialImageInfo> implements IMaterialImageInfoService {
 
     @Value("${oss.replace.download}")

+ 27 - 17
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -17,6 +17,7 @@ import it.sauronsoftware.jave.EncoderException;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -41,6 +42,7 @@ import java.util.regex.Pattern;
  */
 @Slf4j
 @Service
+@Primary
 public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, MaterialInfo> implements IMaterialInfoService {
     private static ExecutorService uploadExecutorService = Executors.newFixedThreadPool(5);
     @Resource
@@ -49,6 +51,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private IVideoWatermarkTaskService videoWatermarkTaskService;
     @Autowired
     private MaterialInfoMapper materialInfoMapper;
+    @Autowired
+    private MaterialParameterMapper materialParameterMapper;
+
     @Value("${oss.replace.replace-value}")
     private String replaceValue;
     @Value("${oss.replace.replace-old-value}")
@@ -322,9 +327,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
 
-    @Autowired
-    private MaterialParameterMapper materialParameterMapper;
-
     @Override
     public void getFile(MaterialInfo materialInfo) {
         uploadExecutorService.submit(new Runnable() {
@@ -334,7 +336,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 log.info("获取素材基本信息,code:{}", materialInfo.getCode());
                 if (!Check.isNull(materialInfo)) {
                     long l = System.currentTimeMillis();
-                    String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
+                    String videoUrl = materialInfo.getUrl();
+                    String url = videoUrl.replace(replaceOldValue, replaceValue);
                     log.info("replaceUrl:{}", url);
                     String localUrl = null;
                     it.sauronsoftware.jave.MultimediaInfo m = null;
@@ -360,6 +363,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                         // 视频高
                         String height = String.valueOf(m.getVideo().getSize().getHeight());
                         materialParameter.setHeight(height);
+
+
                         fis = new FileInputStream(file);
                         FileChannel fc = fis.getChannel();
                         BigDecimal fileSize = new BigDecimal(fc.size());
@@ -373,8 +378,19 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                         int insert = materialParameterMapper.insert(materialParameter);
                         if (insert > 0) {
                             log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
-
                         }
+                        Thread thread = new Thread() {
+                            @Override
+                            public void run() {
+                                try {
+                                    log.info("开始抽帧");
+                                    materialCutFrameService.getCutFrame(videoUrl, materialInfo.getCode(), secondDuration, height, width);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        };
+                        thread.start();
                     } catch (FileNotFoundException e) {
                         e.printStackTrace();
                     } catch (IOException e) {
@@ -392,18 +408,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                         }
                     }
 
-                            /*Thread thread = new Thread() {
-                                @Override
-                                public void run() {
-                                    try {
-                                        Thread.sleep(5 * 1000);
-                                        materialCutFrameService.getCutFrame(url, materialInfo.getCode(), height, width);
-                                    } catch (Exception e) {
-                                        e.printStackTrace();
-                                    }
-                                }
-                            };
-                            thread.start();*/
+                    /* */
 
                        /* } catch (Exception e) {
                             e.printStackTrace();
@@ -599,6 +604,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
         return materialInfoList;
     }
+
+    @Override
+    public List<MaterialInfo> getListByDate(String startDate, String endDate) {
+        return materialInfoMapper.getListByDate(startDate, endDate);
+    }
 }
 
 

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

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.service.IMaterialParameterService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 /**
@@ -15,6 +16,7 @@ import org.springframework.stereotype.Service;
  * @date 2019-11-23
  */
 @Service
+@Primary
 public class MaterialParameterServiceImpl extends ServiceImpl<MaterialParameterMapper, MaterialParameter> implements IMaterialParameterService {
 
     @Override

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

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.MaterialTag;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
 import cn.com.ctop.common.module.service.IMaterialTagService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 /**
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
  * @date 2019-11-23
  */
 @Service
+@Primary
 public class MaterialTagServiceImpl extends ServiceImpl<MaterialTagMapper, MaterialTag> implements IMaterialTagService {
 
 }

+ 5 - 6
module-common/src/main/java/cn/com/ctop/common/module/service/impl/RefreshTokenServiceImpl.java

@@ -10,16 +10,15 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import java.util.List;
 
 @Slf4j
-@Service("refreshTokenService")
+@Service
 public class RefreshTokenServiceImpl implements IRefreshTokenService {
     @Autowired
     private CtopOauthTokenMapper oauthTokenMapper;
-    @Resource
-    private ICtopOauthTokenService ctopOauthTokenService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
 
     /**
      * 获取所有token
@@ -35,11 +34,11 @@ public class RefreshTokenServiceImpl implements IRefreshTokenService {
                 log.info("刷新token,accountId:{}", oauthToken.getAccountId());
                 //头条
                 if (CtopAdConstant.PLATFORM_TYPE_BYTEDANCE.equals(oauthToken.getMediaId().trim())) {
-                    ctopOauthTokenService.getByteDanceAccessToken(String.valueOf(oauthToken.getAccountId()));
+                    oauthTokenService.getByteDanceAccessToken(String.valueOf(oauthToken.getAccountId()));
                 }
                 //快手
                 if (CtopAdConstant.PLATFORM_TYPE_KUAISHOU.equals(oauthToken.getMediaId().trim())) {
-                    ctopOauthTokenService.getKuaiShouRefreshToken(oauthToken.getAccountId(), oauthToken.getRefreshToken(), oauthToken.getAgentType());
+                    oauthTokenService.getKuaiShouRefreshToken(oauthToken.getAccountId(), oauthToken.getRefreshToken(), oauthToken.getAgentType());
                 }
             }
         } else {

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

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.mapper.SysRoleMapper;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 /**
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Service;
  * @since 2018-12-19
  */
 @Service
+@Primary
 public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
     @Autowired
     private SysRoleMapper sysRoleMapper;

+ 41 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -3,12 +3,19 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.context.annotation.Primary;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 用户分配
@@ -17,6 +24,7 @@ import java.util.List;
  * @Version: V1.0
  */
 @Service
+@Primary
 public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper, UserAllocation> implements IUserAllocationService {
     @Autowired
     private UserAllocationMapper userAllocationMapper;
@@ -42,6 +50,39 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
+    public Map<String, Object> getPangolinAccountListByParams(String userId, JSONObject data) {
+        Map<String,Object>result = new HashMap<>();
+        Long projectId = data.getLong("project_id");
+        QueryWrapper<UserAllocation>queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("media_id", CtopAdConstant.PLATFORM_TYPE_PANGOLIN);
+        if(null != userId&&!"".equals(userId.trim())){
+            queryWrapper.eq("user_id",userId);
+        }
+        if(null != projectId&&projectId != 0){
+            queryWrapper.eq("project_id",projectId);
+        }
+        List<UserAllocation> allocations = this.list(queryWrapper);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        result.put("data",allocations);
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> getPangolinProjectListByParams(String userId) {
+        Map<String,Object>result = new HashMap<>();
+        QueryWrapper<UserAllocation>queryWrapper = new QueryWrapper<>();
+        queryWrapper.select("distinct project_id,project_name");
+        queryWrapper.eq("media_id",CtopAdConstant.PLATFORM_TYPE_PANGOLIN);
+        if(null != userId&&!"".equals(userId.trim())){
+            queryWrapper.eq("user_id",userId);
+        }
+        List<UserAllocation> allocations = this.list(queryWrapper);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        result.put("data",allocations);
+        return result;
+    }
+
+    @Override
     public List<UserAllocation> selectAccountListByProjectId(Long projectId) {
         List<UserAllocation> list = userAllocationMapper.selectAccountListByProjectId(projectId);
         return list;

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

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.VideoMergeTask;
 import cn.com.ctop.common.module.mapper.VideoMergeTaskMapper;
 import cn.com.ctop.common.module.service.IVideoMergeTaskService;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  * @version V1.0
  */
 @Service
+@Primary
 public class VideoMergeTaskServiceImpl extends ServiceImpl<VideoMergeTaskMapper, VideoMergeTask> implements IVideoMergeTaskService {
 
 }

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

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.VideoPart;
 import cn.com.ctop.common.module.mapper.VideoPartMapper;
 import cn.com.ctop.common.module.service.IVideoPartService;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  * @version V1.0
  */
 @Service
+@Primary
 public class VideoPartServiceImpl extends ServiceImpl<VideoPartMapper, VideoPart> implements IVideoPartService {
 
 }

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

@@ -13,7 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  * @date   2019-12-20
  * @version V1.0
  */
-@Service("videoWatermarkTaskService")
+@Service
 public class VideoWatermarkTaskServiceImpl extends ServiceImpl<VideoWatermarkTaskMapper, VideoWatermarkTask> implements IVideoWatermarkTaskService {
 
 }

+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoWatermarkTemplateServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.VideoWatermarkTemplate;
 import cn.com.ctop.common.module.mapper.VideoWatermarkTemplateMapper;
 import cn.com.ctop.common.module.service.IVideoWatermarkTemplateService;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -13,7 +14,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  * @date   2019-12-20
  * @version V1.0
  */
-@Service("videoWatermarkTemplateService")
+@Service
+@Primary
 public class VideoWatermarkTemplateServiceImpl extends ServiceImpl<VideoWatermarkTemplateMapper, VideoWatermarkTemplate> implements IVideoWatermarkTemplateService {
 
 }

+ 0 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/CtopAdConstant.java


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików