Преглед изворни кода

Merge branch 'test' of http://git.tjyourong.com.cn/ctop/adsp-boot into test

xuzuoyun пре 5 година
родитељ
комит
dc9319525f
100 измењених фајлова са 2661 додато и 5301 уклоњено
  1. 47 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java
  2. 13 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/SystemDateConstant.java
  3. 21 6
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/LoginUser.java
  4. 103 44
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  5. 101 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/JsonResourceUtil.java
  6. 14 14
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java
  7. 13 48
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java
  8. 15 31
      jeecg-boot-module-system/pom.xml
  9. 13 1
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  10. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/config/MybatisPlusConfig.java
  11. 0 67
      jeecg-boot-module-system/src/main/java/org/jeecg/config/RabbitConfig.java
  12. 115 117
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  13. 10 12
      jeecg-boot-module-system/src/main/java/org/jeecg/config/Swagger2Config.java
  14. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/WebMvcConfiguration.java
  15. 97 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/interceptors/BrowseLogHandelInterceptor.java
  16. 31 47
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActorController.java
  17. 19 21
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdCoverController.java
  18. 49 69
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  19. 9 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AgentInfoController.java
  20. 12 96
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountAuthController.java
  21. 12 97
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  22. 0 294
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceAdvertiserPostController.java
  23. 0 248
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceCleanMaterialReportController.java
  24. 3 191
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java
  25. 0 164
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceFundDailyController.java
  26. 92 95
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  27. 0 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CreativeTitleController.java
  28. 7 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CtopOauthTokenController.java
  29. 8 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaInfoController.java
  30. 7 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java
  31. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaRoleInfoController.java
  32. 26 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/EduLessonController.java
  33. 0 250
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/EduLessonNewController.java
  34. 10 50
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/FileInfoController.java
  35. 7 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/GraphqlController.java
  36. 4 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/HotInformationCtroller.java
  37. 10 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageDownloadController.java
  38. 0 248
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouCleanMaterialReportController.java
  39. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouDefectMaterialController.java
  40. 14 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAdvertiserController.java
  41. 8 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAppAccountController.java
  42. 35 37
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAppProductController.java
  43. 7 94
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouChannelRegInfoController.java
  44. 8 92
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialAscriptionController.java
  45. 8 86
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialCutFrameController.java
  46. 11 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java
  47. 96 108
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  48. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialParameterController.java
  49. 6 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialPartController.java
  50. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTagController.java
  51. 50 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTopCtrl.java
  52. 5 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialUploadController.java
  53. 126 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PangolinController.java
  54. 40 112
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  55. 48 84
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  56. 157 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ReleaseRecordController.java
  57. 171 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ReleaseViewRecordController.java
  58. 9 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SalePerformanceDetailController.java
  59. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ScriptTagInfoController.java
  60. 0 249
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SourceFileController.java
  61. 214 386
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  62. 0 32
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestMqController.java
  63. 13 95
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TransferAccountController.java
  64. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileBindUserController.java
  65. 8 90
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileController.java
  66. 38 106
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  67. 29 116
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoMergeTaskController.java
  68. 26 110
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoPartController.java
  69. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTaskController.java
  70. 29 115
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTemplateController.java
  71. 16 76
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/YardController.java
  72. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Advertiser.java
  73. 0 107
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCleanMaterialReport.java
  74. 0 135
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceFundDaily.java
  75. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaInfo.java
  76. 0 100
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/EduLessonNew.java
  77. 0 93
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/KuaiShouCleanMaterialReport.java
  78. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Project.java
  79. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java
  80. 46 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ReleaseRecord.java
  81. 46 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ReleaseViewRecord.java
  82. 1 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountBidJob.java
  83. 0 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java
  84. 4 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceCleanMaterialJob.java
  85. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceHourlyAccountWarningLoadJob.java
  86. 30 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceRefreshTokenJob.java
  87. 3 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDailyReportLoadJob.java
  88. 10 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDataLoadJob.java
  89. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserHourlyReportLoadJob.java
  90. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceCreativeDailyReportLoadJob.java
  91. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceCreativeHourlyReportLoadJob.java
  92. 45 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyAccountReportAsyncJob.java
  93. 51 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyAsyncJob.java
  94. 45 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyCampaignReportAsyncJob.java
  95. 46 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyCreativeReportAsyncJob.java
  96. 64 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyMaterialReportJob.java
  97. 75 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyMaterialReportRetryJob.java
  98. 46 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyPlanReportAsyncJob.java
  99. 33 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyReportAsyncTaskGetJob.java
  100. 0 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyVideoMaterialReportAddJob.java

+ 47 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -0,0 +1,47 @@
+package org.jeecg.common.constant;
+
+import org.jeecg.common.util.JsonResourceUtil;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *  Created by JQ.bi on 2020.5.30
+ */
+public class AccountReportConstants {
+
+    /**
+     * 私有构造器
+     */
+    private AccountReportConstants(){
+
+    }
+
+    /** 单体实例 */
+    private static AccountReportConstants instance;
+
+
+    /**
+     * @return 返回 instance
+     */
+    public static AccountReportConstants getInstance() {
+        if (instance == null) {
+            instance = new AccountReportConstants();
+        }
+        return instance;
+    }
+
+    /** 字典数据 */
+    public static Map<String, Map<String,Object>> dicMap = new HashMap<>();
+
+    /**
+     * 初始化字典
+     */
+    public void init(){
+        //加载json文件
+        Object json=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
+        //json 转为map存为静态常量
+        dicMap=JsonResourceUtil.jsonToMap(json);
+    }
+
+}

+ 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 + '\'' +
+				'}';
+	}
 }

+ 103 - 44
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1,5 +1,8 @@
 package org.jeecg.common.util;
 
+import org.jeecg.common.constant.SystemDateConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.util.StringUtils;
 
 import java.beans.PropertyEditorSupport;
@@ -17,13 +20,16 @@ import java.util.*;
  * @Version 1.0
  */
 public class DateUtils extends PropertyEditorSupport {
+
+    private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
+
     /**
      * 以毫秒表示的时间
      */
-    private static final long DAY_IN_MILLIS = 24 * 3600 * 1000;
-    private static final long HOUR_IN_MILLIS = 3600 * 1000;
-    private static final long MINUTE_IN_MILLIS = 60 * 1000;
-    private static final long SECOND_IN_MILLIS = 1000;
+    private static final long DAY_IN_MILLIS = 24 * 3600 * 1000L;
+    private static final long HOUR_IN_MILLIS = 3600 * 1000L;
+    private static final long MINUTE_IN_MILLIS = 60 * 1000L;
+    private static final long SECOND_IN_MILLIS = 1000L;
 
 
     public static boolean compare(String beginDate, String nowDate) throws ParseException {
@@ -140,11 +146,7 @@ public class DateUtils extends PropertyEditorSupport {
      */
     public static String date2Str() {
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-        Date date = getDate();
-        if (null == date) {
-            return null;
-        }
-        return format.format(date);
+        return format.format(new Date());
     }
 
     /**
@@ -173,9 +175,6 @@ public class DateUtils extends PropertyEditorSupport {
      */
     public static String getDate(String format) {
         Date date = new Date();
-        if (null == date) {
-            return null;
-        }
         SimpleDateFormat sdf = new SimpleDateFormat(format);
         return sdf.format(date);
     }
@@ -243,7 +242,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;
     }
 
@@ -493,9 +492,13 @@ public class DateUtils extends PropertyEditorSupport {
      * @throws ParseException
      * @throws
      */
-    public static Date parseDate(String src, String pattern) throws ParseException {
-        return getDateFormat(pattern).parse(src);
-
+    public static Date parseDate(String src, String pattern) {
+        try {
+            return getDateFormat(pattern).parse(src);
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return null;
+        }
     }
 
     /**
@@ -768,19 +771,20 @@ public class DateUtils extends PropertyEditorSupport {
         return sdf.format(calendar.getTime());
     }
 
-    public static String addDay(String dateString, int day) throws ParseException {
+    public static String addDay(String dateString, int day) {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-        Date date = sdf.parse(dateString);
+        Date date = null;
+        try {
+            date = sdf.parse(dateString);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         calendar.add(Calendar.DAY_OF_YEAR, day);
         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);
@@ -878,10 +882,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();
@@ -1205,10 +1214,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;
@@ -1219,32 +1227,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) {
@@ -1261,11 +1264,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 {
@@ -1273,7 +1277,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));
@@ -1285,8 +1289,63 @@ public class DateUtils extends PropertyEditorSupport {
         return null;
     }
 
-    public static void main(String[] args) throws ParseException {
-        System.out.println(calDiffMonth(DateUtils.parseDate("2019-04-01","yyyy-MM-dd"),new Date()));
+
+    public static int dateDiff(String start, String end) {
+        //设置转换的日期格式
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        //开始时间
+        Date startDate = null;
+        Date endDate = null;
+        try {
+            startDate = sdf.parse(start);
+            endDate = sdf.parse(end);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        //得到相差的天数 betweenDate
+        long betweenDate = (endDate.getTime() - startDate.getTime()) / (60 * 60 * 24 * 1000);
+        return (int) betweenDate;
+    }
+
+    public static Date addMonth(Date date) {
+        Calendar calendar = Calendar.getInstance();//日历对象
+        calendar.add(Calendar.MONTH, -1);//月份减一
+        return calendar.getTime();
+    }
+
+    /**
+     * 判断两个日期间隔是否大于半年
+     *
+     * @return
+     */
+    public static boolean isMoreSixMonth(String startDate, String endDate) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(Objects.requireNonNull(parseDate(startDate, SystemDateConstant.yyyy_MM_dd)));
+        long time1 = c.getTimeInMillis();
+        c.setTime(Objects.requireNonNull(parseDate(endDate, SystemDateConstant.yyyy_MM_dd)));
+        long time2 = c.getTimeInMillis();
+        long between_days = (time2 - time1) / (1000 * 3600 * 24);
+        int day = Integer.parseInt(String.valueOf(between_days));
+        return day > 180;
+    }
+
+    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;
     }
 
 }

+ 101 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/JsonResourceUtil.java

@@ -0,0 +1,101 @@
+package org.jeecg.common.util;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
+
+import java.io.File;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+
+/**
+ * Created by JQ.bi on 2020.06.03
+ */
+public class JsonResourceUtil {
+
+    private static Logger logger = LoggerFactory.getLogger(JsonResourceUtil.class);
+
+    private JsonResourceUtil() {
+
+    }
+
+    //filename 为文件名字 如 “/json/app_version_info.json”
+    public static JSONObject getJsonObjFromResource(String filename) {
+        JSONObject json = null;
+        if (!filename.contains(".json")) {
+            filename += ".json";
+        }
+        try {
+            ClassPathResource classPathResource = new ClassPathResource(filename);
+            if (classPathResource.exists()) {
+                InputStream inputStream = classPathResource.getInputStream();
+                String content = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+                json = JSON.parseObject(content);
+            } else {
+                logger.info("file not exist!");
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.info("readFileToString" + e.getMessage());
+        }
+        return json;
+    }
+
+    public static Map<String, Map<String, Object>> jsonToMap(Object jsonObj) {
+        JSONObject jsonObject = JSONObject.parseObject(jsonObj.toString());
+        Map<String, Map<String, Object>> mapMap = new HashMap<>();
+        jsonObject.forEach((key, value) -> {
+            mapMap.put(key, JSONObject.parseObject(value.toString()));
+        });
+        return mapMap;
+    }
+
+    /**
+     * 拼接字段
+     */
+    public static String joinFiled(JSONArray array) {
+        StringBuilder sb = new StringBuilder();
+        array.forEach(it -> {
+            if (AccountReportConstants.dicMap.get(it.toString()).isEmpty()) {
+                sb.append(it).append(",");
+            } else {
+                sb.append(AccountReportConstants.dicMap.get(it.toString()).get("filed")).append(",");
+            }
+        });
+        return sb.deleteCharAt(sb.length() - 1).toString();
+    }
+
+    /**
+     * 拼接title
+     */
+    public static List<String> joinTitle(JSONArray array) {
+        List<String> titles = new ArrayList<>(20);
+        array.forEach(it -> {
+            if (AccountReportConstants.dicMap.get(it.toString()).isEmpty()) {
+                titles.add(it.toString());
+            } else {
+                titles.add(AccountReportConstants.dicMap.get(it.toString()).get("comment").toString());
+            }
+        });
+        return titles;
+    }
+
+    /**
+     * 拼接字段
+     */
+    public static String joinAllFiled() {
+        StringBuilder sb = new StringBuilder();
+        AccountReportConstants.dicMap.forEach((k, v) -> {
+            sb.append(v.get("filed")).append(",");
+        });
+        return sb.deleteCharAt(sb.length() - 1).toString();
+    }
+}

+ 14 - 14
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java

@@ -1,15 +1,13 @@
 package org.jeecg.common.util.jsonschema;
 
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+
 import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-import lombok.extern.slf4j.Slf4j;
-
 @Slf4j
 public class JsonschemaUtil {
 
@@ -74,26 +72,28 @@ public class JsonschemaUtil {
      * @param fileName
      * @return
      */
-    public static String readJsonFile(String fileName) {
+	public static String readJsonFile(String fileName) throws IOException {
         String jsonStr = "";
-        try {
+		FileReader fileReader = null;
+		Reader reader = null;
+		try {
             File jsonFile = new File(fileName);
-            FileReader fileReader = new FileReader(jsonFile);
-
-            Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
+			fileReader = new FileReader(jsonFile);
+			reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
             int ch = 0;
             StringBuffer sb = new StringBuffer();
             while ((ch = reader.read()) != -1) {
                 sb.append((char) ch);
             }
-            fileReader.close();
-            reader.close();
             jsonStr = sb.toString();
             return jsonStr;
-        } catch (IOException e) {
+		} catch (Exception e) {
             e.printStackTrace();
             return null;
-        }
+		} finally {
+			fileReader.close();
+			reader.close();
+		}
     }
 
 }

+ 13 - 48
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java

@@ -3,7 +3,6 @@ package org.jeecg.common.util;
 import org.apache.commons.lang.StringEscapeUtils;
 
 import javax.servlet.http.HttpServletRequest;
-import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -47,23 +46,11 @@ public class oConvertUtils {
 		return temp;
 	}
 
-    public static String strToUtf(String strIn, String sourceCode, String targetCode) {
-		strIn = "";
-		try {
-			strIn = new String(strIn.getBytes("ISO-8859-1"), "GBK");
-		} catch (UnsupportedEncodingException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		return strIn;
-
-	}
-
 	private static String code2code(String strIn, String sourceCode, String targetCode) {
-		String strOut = null;
         if (strIn == null || "".equals(strIn.trim())) {
 			return strIn;
 		}
+		String strOut = null;
 		try {
 			byte[] b = strIn.getBytes(sourceCode);
 			strOut = new String(b, targetCode);
@@ -75,7 +62,7 @@ public class oConvertUtils {
 	}
 
 	public static int getInt(String s, int defval) {
-		if (s == null || s == "") {
+		if (s == null || s.trim().equals("")) {
 			return (defval);
 		}
 		try {
@@ -86,7 +73,7 @@ public class oConvertUtils {
 	}
 
 	public static int getInt(String s) {
-		if (s == null || s == "") {
+		if (s == null || s.trim().equals("")) {
 			return 0;
 		}
 		try {
@@ -97,7 +84,7 @@ public class oConvertUtils {
 	}
 
 	public static int getInt(String s, Integer df) {
-		if (s == null || s == "") {
+		if (s == null || s.trim().equals("")) {
 			return df;
 		}
 		try {
@@ -108,10 +95,10 @@ public class oConvertUtils {
 	}
 
 	public static Integer[] getInts(String[] s) {
-		Integer[] integer = new Integer[s.length];
 		if (s == null) {
 			return null;
 		}
+		Integer[] integer = new Integer[s.length];
 		for (int i = 0; i < s.length; i++) {
 			integer[i] = Integer.parseInt(s[i]);
 		}
@@ -120,7 +107,7 @@ public class oConvertUtils {
 	}
 
 	public static double getDouble(String s, double defval) {
-		if (s == null || s == "") {
+		if (s == null || s.trim().equals("")) {
 			return (defval);
 		}
 		try {
@@ -137,14 +124,6 @@ public class oConvertUtils {
 		return s;
 	}
 
-	/*public static Short getShort(String s) {
-		if (StringUtil.isNotEmpty(s)) {
-			return (Short.parseShort(s));
-		} else {
-			return null;
-		}
-	}*/
-
 	public static int getInt(Object object, int defval) {
 		if (isEmpty(object)) {
 			return (defval);
@@ -174,7 +153,7 @@ public class oConvertUtils {
 		return s.intValue();
 	}
 
-	public static Integer[] getIntegerArry(String[] object) {
+	public static Integer[] getIntegerArray(String[] object) {
 		int len = object.length;
 		Integer[] result = new Integer[len];
 		try {
@@ -230,12 +209,7 @@ public class oConvertUtils {
 	}
 
 	public static long stringToLong(String str) {
-        Long test = 0L;
-		try {
-			test = Long.valueOf(str);
-		} catch (Exception e) {
-		}
-		return test.longValue();
+		return Long.valueOf(str);
 	}
 
 	/**
@@ -260,7 +234,7 @@ public class oConvertUtils {
 	 *            要判断的类。
 	 * @return true 表示为基本数据类型。
 	 */
-	private static boolean isBaseDataType(Class clazz) throws Exception {
+	private static boolean isBaseDataType(Class clazz) {
 		return (clazz.equals(String.class) || clazz.equals(Integer.class) || clazz.equals(Byte.class) || clazz.equals(Long.class) || clazz.equals(Double.class) || clazz.equals(Float.class) || clazz.equals(Character.class) || clazz.equals(Short.class) || clazz.equals(BigDecimal.class) || clazz.equals(BigInteger.class) || clazz.equals(Boolean.class) || clazz.equals(Date.class) || clazz.isPrimitive());
 	}
 
@@ -302,11 +276,11 @@ public class oConvertUtils {
 			Enumeration<InetAddress> address = ni.getInetAddresses();
 			while (address.hasMoreElements()) {
 				ip = address.nextElement();
-                if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {
+				if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(':') == -1) {
 					netip = ip.getHostAddress();
 					finded = true;
 					break;
-                } else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {
+				} else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(':') == -1) {
 					localip = ip.getHostAddress();
 				}
 			}
@@ -357,20 +331,13 @@ public class oConvertUtils {
 	}
 
 	/**
-	 * 获取Map对象
-	 */
-	public static Map<Object, Object> getHashMap() {
-		return new HashMap<Object, Object>();
-	}
-
-	/**
 	 * SET转换MAP
      *
 	 * @param setobj
 	 * @return
 	 */
     public static Map<Object, Object> setToMap(Set<Object> setobj) {
-		Map<Object, Object> map = getHashMap();
+		Map<Object, Object> map = new HashMap<>();
 		for (Iterator iterator = setobj.iterator(); iterator.hasNext();) {
 			Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) iterator.next();
 			map.put(entry.getKey().toString(), entry.getValue() == null ? "" : entry.getValue().toString().trim());
@@ -401,9 +368,7 @@ public class oConvertUtils {
 		long b = Integer.parseInt(ip[1]);
 		long c = Integer.parseInt(ip[2]);
 		long d = Integer.parseInt(ip[3]);
-
-		long ipNum = a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
-		return ipNum;
+		return a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
 	}
 
 	private static boolean isInner(long userIp, long begin, long end) {

+ 15 - 31
jeecg-boot-module-system/pom.xml

@@ -41,22 +41,6 @@
     </repositories>
 
     <dependencies>
-        <!--<dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-openfeign</artifactId>
-        </dependency>-->
-
-        <!-- 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>
@@ -122,18 +106,7 @@
             <version>2.0.2</version>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>org.jeecgframework.boot</groupId>
-            <artifactId>module-ctop</artifactId>
-            <version>2.0.2</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>cn.com.ctop</groupId>
-            <artifactId>module-report</artifactId>
-            <version>2.0.2</version>
-            <scope>compile</scope>
-        </dependency>
+
         <dependency>
             <groupId>com.bstek.ureport</groupId>
             <artifactId>ureport2-console</artifactId>
@@ -152,9 +125,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>
@@ -173,6 +146,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>
@@ -253,5 +231,11 @@
                 <activatedProperties>prod</activatedProperties>
             </properties>
         </profile>
+        <profile>
+            <id>wps</id>
+            <properties>
+                <activatedProperties>wps</activatedProperties>
+            </properties>
+        </profile>
     </profiles>
 </project>

+ 13 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java

@@ -1,7 +1,9 @@
 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.jeecg.modules.excelutil.SpringUtils;
+import org.jeecg.common.constant.AccountReportConstants;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.ConfigurableApplicationContext;
@@ -43,4 +45,14 @@ public class JeecgApplication {
         return new RestTemplate();
     }
 
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        return new PaginationInterceptor();
+    }
+    //加载数据字典
+    @Bean
+    public void instanceFiledDic(){
+        AccountReportConstants.getInstance().init();
+    }
+
 }

+ 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");
-    }
-}

+ 115 - 117
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,63 @@ 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("/v1/**", "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,71 +135,73 @@ 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");
-
-		// 添加自己的过滤器并且取名为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;
-	}
+        //filterChainDefinitionMap.put("/ctop/performance/show/**", "anon");
+        filterChainDefinitionMap.put("/job/test/*", "anon");
+
+        // 添加自己的过滤器并且取名为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;
+    }
 
 }

+ 10 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/config/Swagger2Config.java

@@ -1,29 +1,27 @@
 package org.jeecg.config;
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.modules.shiro.vo.DefContants;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
-
-import io.swagger.annotations.ApiOperation;
-import springfox.documentation.service.Parameter;
-import lombok.extern.slf4j.Slf4j;
 import springfox.documentation.builders.ApiInfoBuilder;
 import springfox.documentation.builders.ParameterBuilder;
 import springfox.documentation.builders.PathSelectors;
 import springfox.documentation.builders.RequestHandlerSelectors;
 import springfox.documentation.schema.ModelRef;
 import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Parameter;
 import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spring.web.plugins.Docket;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @Author scott
  */
@@ -36,7 +34,7 @@ public class Swagger2Config implements WebMvcConfigurer {
 	/**
 	 *
 	 * 显示swagger-ui.html文档展示页,还必须注入swagger资源:
-	 * 
+	 *
 	 * @param registry
 	 */
 	@Override
@@ -85,9 +83,9 @@ public class Swagger2Config implements WebMvcConfigurer {
 	private ApiInfo apiInfo() {
 		return new ApiInfoBuilder()
 				// //大标题
-				.title("Jeecg-Boot 后台服务API接口文档")
+				.title("汇创助手后台服务API接口文档")
 				// 版本号
-				.version("1.0")
+				.version("2.0.2")
 //				.termsOfServiceUrl("NO terms of service")
 				// 描述
 				.description("restful 风格接口")

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

@@ -1,12 +1,15 @@
 package org.jeecg.config;
 
 import cn.com.ctop.common.module.utils.StringUtils;
+import org.jeecg.config.interceptors.BrowseLogHandelInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.cors.CorsConfiguration;
 import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
 import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
 import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -20,6 +23,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 @Configuration
 public class WebMvcConfiguration implements WebMvcConfigurer {
 
+	@Autowired
+	BrowseLogHandelInterceptor browseLogHandelInterceptor;
+
 	@Value("${jeecg.path.upload}")
 	private String upLoadPath;
 	@Value("${jeecg.path.webapp}")
@@ -27,6 +33,11 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
 	@Value("${spring.resource.static-locations}")
 	private String staticLocations;
 
+//	@Override
+//	public void addInterceptors(InterceptorRegistry registry) {
+//		registry.addInterceptor(browseLogHandelInterceptor);
+//	}
+
 	@Bean
 	public CorsFilter corsFilter() {
 		final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();

+ 97 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/interceptors/BrowseLogHandelInterceptor.java

@@ -0,0 +1,97 @@
+package org.jeecg.config.interceptors;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.common.system.util.JwtUtil;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Created by JQ.bi on 2020.5.8
+ */
+@Component
+@Slf4j
+public class BrowseLogHandelInterceptor extends HandlerInterceptorAdapter {
+
+    private static final String REQUEST_METHOD = "GET_POST_PUT_DELETE_OPTIONS";
+
+    private final static ExecutorService executorServicePool;
+
+    //加载一次
+    static {
+        int threadCount = Runtime.getRuntime().availableProcessors();
+        ThreadFactoryBuilder builder = new ThreadFactoryBuilder();
+        builder.setNameFormat("BrowseLogHandlerFactory");
+        builder.setDaemon(true);
+        builder.setUncaughtExceptionHandler((t, e) -> {
+        });//忽略异常
+        builder.setPriority(Thread.MIN_PRIORITY);
+        executorServicePool = new ThreadPoolExecutor(threadCount, threadCount,
+                0L, TimeUnit.MILLISECONDS,
+                new LinkedBlockingQueue<Runnable>(100000), builder.build(), new ThreadPoolExecutor.DiscardPolicy());
+    }
+
+
+    @Override
+    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
+        if (REQUEST_METHOD.contains(request.getMethod())) {
+            if (request.getRequestURI().endsWith("/sys/permission/getUserPermissionByToken")||request.getRequestURI().endsWith("/getEncryptedString")||request.getRequestURI().endsWith("/login")||request.getRequestURI().endsWith("/sys/annountCement/listByUser")) {
+                return;
+            }
+            boolean isSuccess = true;
+            if (response.getStatus() != 200) {
+                isSuccess = false;
+            }
+            String userName = JwtUtil.getUserNameByToken(request);
+            if (StringUtils.isEmpty(userName)) {
+                log.warn("登陆账号用户名为空");
+            }
+            String token = request.getHeader("X-Access-Token");
+            String uri = request.getRequestURI();
+            String currentDate = DateUtils.now();
+            BrowseLogRunnable runnable = new BrowseLogRunnable(userName, isSuccess,token, uri, currentDate);
+            executorServicePool.submit(runnable);
+        }
+    }
+
+
+    private static class BrowseLogRunnable implements Runnable {
+        String userName;
+        Boolean isSuccess;
+        String token;
+        String uri;
+        String currentDate;
+        BrowseLogRunnable(String userName, boolean isSuccess, String token, String uri, String currentDate) {
+            this.userName = userName;
+            this.isSuccess = isSuccess;
+            this.token = token;
+            this.uri = uri;
+            this.currentDate = currentDate;
+        }
+
+        @Override
+        public void run() {
+            try {
+                if (!StringUtils.isEmpty(token)) {
+                    if(isSuccess){
+                        log.info("-SUCCESS " + currentDate + " 用户:" + userName + " 访问了[" + uri + "]?token=\"" + token + "\"");
+                    }else {
+                        log.info("-FALSE " + currentDate + " 用户:" + userName + "” 访问了[" + uri + "]?token=\"" + token + "\"");
+                    }
+                }
+            } catch (Exception e) {
+                log.error(e.toString());
+            }
+        }
+    }
+}
+

+ 31 - 47
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActorController.java

@@ -38,7 +38,7 @@ public class ActorController {
     private IActorVideoService actorVideoService;
 
     @ResponseBody
-    @RequestMapping(value = "/detail", method = RequestMethod.GET)
+    @GetMapping("/detail")
     public Result<Actor> getDetail(@RequestParam(name = "actorId") Long actorId) {
         Result<Actor> result = new Result<>();
         Actor actor = actorService.getById(actorId);
@@ -61,9 +61,9 @@ public class ActorController {
                                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                               HttpServletRequest req) {
-        Result<IPage<Actor>> result = new Result<IPage<Actor>>();
+        Result<IPage<Actor>> result = new Result<>();
         QueryWrapper<Actor> queryWrapper = QueryGenerator.initQueryWrapper(actor, req.getParameterMap());
-        Page<Actor> page = new Page<Actor>(pageNo, pageSize);
+        Page<Actor> page = new Page<>(pageNo, pageSize);
         IPage<Actor> pageList = actorService.page(page, queryWrapper);
 
         result.setSuccess(true);
@@ -76,10 +76,10 @@ public class ActorController {
                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
-        Result<IPage<ActorPhoto>> result = new Result<IPage<ActorPhoto>>();
+        Result<IPage<ActorPhoto>> result = new Result<>();
 
         QueryWrapper<ActorPhoto> queryWrapper = QueryGenerator.initQueryWrapper(actorPhoto, req.getParameterMap());
-        Page<ActorPhoto> page = new Page<ActorPhoto>(pageNo, pageSize);
+        Page<ActorPhoto> page = new Page<>(pageNo, pageSize);
         IPage<ActorPhoto> pageList = actorPhotoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -91,10 +91,10 @@ public class ActorController {
                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                             HttpServletRequest req) {
-        Result<IPage<ActorComment>> result = new Result<IPage<ActorComment>>();
+        Result<IPage<ActorComment>> result = new Result<>();
 
         QueryWrapper<ActorComment> queryWrapper = QueryGenerator.initQueryWrapper(actorComment, req.getParameterMap());
-        Page<ActorComment> page = new Page<ActorComment>(pageNo, pageSize);
+        Page<ActorComment> page = new Page<>(pageNo, pageSize);
         IPage<ActorComment> pageList = actorCommentService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -103,7 +103,7 @@ public class ActorController {
 
     @DeleteMapping(value = "/comment/delete")
     public Result<ActorComment> deleteComment(@RequestParam(name = "id", required = true) String id) {
-        Result<ActorComment> result = new Result<ActorComment>();
+        Result<ActorComment> result = new Result<>();
         ActorComment actorComment = actorCommentService.getById(id);
         if (actorComment == null) {
             result.error500("未找到对应实体");
@@ -118,7 +118,7 @@ public class ActorController {
 
     @DeleteMapping(value = "/video/delete")
     public Result<ActorVideo> deleteVideo(@RequestParam(name = "id", required = true) String id) {
-        Result<ActorVideo> result = new Result<ActorVideo>();
+        Result<ActorVideo> result = new Result<>();
         ActorVideo actorVideo = actorVideoService.getById(id);
         if (actorVideo == null) {
             result.error500("未找到对应实体");
@@ -133,7 +133,7 @@ public class ActorController {
 
     @DeleteMapping(value = "/photo/delete")
     public Result<ActorPhoto> deletePhoto(@RequestParam(name = "id", required = true) String id) {
-        Result<ActorPhoto> result = new Result<ActorPhoto>();
+        Result<ActorPhoto> result = new Result<>();
         ActorPhoto actorPhoto = actorPhotoService.getById(id);
         if (actorPhoto == null) {
             result.error500("未找到对应实体");
@@ -148,7 +148,7 @@ public class ActorController {
 
     @PostMapping(value = "/comment/add")
     public Result<ActorComment> addComment(ActorComment actorComment) {
-        Result<ActorComment> result = new Result<ActorComment>();
+        Result<ActorComment> result = new Result<>();
         try {
             actorCommentService.save(actorComment);
             result.success("添加成功!");
@@ -161,13 +161,11 @@ public class ActorController {
 
     @PostMapping(value = "/video/add")
     public Result<ActorVideo> addVideo(ActorVideo actorVideo) {
-        Result<ActorVideo> result = new Result<ActorVideo>();
+        Result<ActorVideo> result = new Result<>();
         try {
             String videoUrl = actorVideo.getVideoUrl();
-            if (!Check.isNull(videoUrl)) {
-                if (!videoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    actorVideo.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + videoUrl);
-                }
+            if (!Check.isNull(videoUrl) && !videoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                actorVideo.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + videoUrl);
             }
             actorVideoService.save(actorVideo);
             result.success("添加成功!");
@@ -180,15 +178,12 @@ public class ActorController {
 
     @PostMapping(value = "/photo/add")
     public Result<ActorPhoto> addPhoto(ActorPhoto actorPhoto) {
-        Result<ActorPhoto> result = new Result<ActorPhoto>();
+        Result<ActorPhoto> result = new Result<>();
         try {
             String photoUrl = actorPhoto.getPhotoUrl();
-            if (!Check.isNull(photoUrl)) {
-                if (!photoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    actorPhoto.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + photoUrl);
-                }
+            if (!Check.isNull(photoUrl) && !photoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                actorPhoto.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + photoUrl);
             }
-
             actorPhotoService.save(actorPhoto);
             result.success("添加成功!");
         } catch (Exception e) {
@@ -203,9 +198,9 @@ public class ActorController {
                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
-        Result<IPage<ActorVideo>> result = new Result<IPage<ActorVideo>>();
+        Result<IPage<ActorVideo>> result = new Result<>();
         QueryWrapper<ActorVideo> queryWrapper = QueryGenerator.initQueryWrapper(actorVideo, req.getParameterMap());
-        Page<ActorVideo> page = new Page<ActorVideo>(pageNo, pageSize);
+        Page<ActorVideo> page = new Page<>(pageNo, pageSize);
         IPage<ActorVideo> pageList = actorVideoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -221,40 +216,33 @@ public class ActorController {
      */
     @PostMapping(value = "/add")
     public Result<Actor> add(@RequestBody Actor actor) {
-        Result<Actor> result = new Result<Actor>();
+        Result<Actor> result = new Result<>();
         try {
             String coverUrl = actor.getCoverUrl();
-            if (!Check.isNull(coverUrl)) {
-                if (!coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
-                }
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
             }
             actorService.save(actor);
-            if (actor.getImageUrl() != null && actor.getImageUrl().size() > 0) {
+            if (null != actor.getImageUrl() && !actor.getImageUrl().isEmpty()) {
                 for (String url : actor.getImageUrl()) {
                     ActorPhoto photo = new ActorPhoto();
                     photo.setActorId(actor.getId());
-                    if (!Check.isNull(url)) {
-                        if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                            photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
-                        }
+                    if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                        photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
                     }
                     actorPhotoService.save(photo);
                 }
             }
-            if (actor.getVideoUrl() != null && actor.getVideoUrl().size() > 0) {
+            if (actor.getVideoUrl() != null && !actor.getVideoUrl().isEmpty()) {
                 for (String url : actor.getVideoUrl()) {
                     ActorVideo video = new ActorVideo();
                     video.setActorId(actor.getId());
-                    if (!Check.isNull(url)) {
-                        if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                            video.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
-                        }
+                    if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                        video.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
                     }
                     actorVideoService.save(video);
                 }
             }
-
             result.success("添加成功!");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -271,18 +259,15 @@ public class ActorController {
      */
     @PutMapping(value = "/edit")
     public Result<Actor> edit(@RequestBody Actor actor) {
-        Result<Actor> result = new Result<Actor>();
+        Result<Actor> result = new Result<>();
 
         Actor actorEntity = actorService.getById(actor.getId());
         if (actorEntity == null) {
             result.error500("未找到对应实体");
         } else {
-
             String coverUrl = actor.getCoverUrl();
-            if (!Check.isNull(coverUrl)) {
-                if (!coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
-                }
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
             }
 
             boolean ok = actorService.updateById(actor);
@@ -290,7 +275,6 @@ public class ActorController {
                 result.success("修改成功!");
             }
         }
-
         return result;
     }
 }

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

@@ -36,13 +36,13 @@ public class AdCoverController {
     private ISysCategoryService sysCategoryService;
 
     @ResponseBody
-    @RequestMapping(value = "/summary/today", method = RequestMethod.GET)
+    @GetMapping("/summary/today")
     public Result<Map<String, Object>> getTodaySummary() {
-        Result<Map<String, Object>> result = new Result<Map<String, Object>>();
-        QueryWrapper<AppAd> appAdWrapper = new QueryWrapper<AppAd>();
-        QueryWrapper<AppVideo> appVideoWrapper = new QueryWrapper<AppVideo>();
-        QueryWrapper<KuaishouAdAccount> advertiserWrapper = new QueryWrapper<KuaishouAdAccount>();
-        QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<KuaishouAdAccount>();
+        Result<Map<String, Object>> result = new Result<>();
+        QueryWrapper<AppAd> appAdWrapper = new QueryWrapper<>();
+        QueryWrapper<AppVideo> appVideoWrapper = new QueryWrapper<>();
+        QueryWrapper<KuaishouAdAccount> advertiserWrapper = new QueryWrapper<>();
+        QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<>();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         String now = sdf.format(new Date());
         String startDate = now + " 00:00:00";
@@ -56,7 +56,7 @@ public class AdCoverController {
         int appVideoCount = appVideoService.count(appVideoWrapper);
         int advertiserCount = kuaishouAdAccountService.count(advertiserWrapper);
         int productCount = kuaishouAdAccountService.count(productWrapper);
-        Map<String, Object> map = new HashMap<String, Object>();
+        Map<String, Object> map = new HashMap<>();
         map.put("adCount", appAdCount);
         map.put("videoCount", appVideoCount);
         map.put("advertiserCount", advertiserCount);
@@ -67,16 +67,16 @@ public class AdCoverController {
     }
 
     @ResponseBody
-    @RequestMapping(value = "/summary/all", method = RequestMethod.GET)
+    @GetMapping("/summary/all")
     public Result<Map<String, Object>> getAllSummary() {
-        Result<Map<String, Object>> result = new Result<Map<String, Object>>();
-        QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<KuaishouAdAccount>();
+        Result<Map<String, Object>> result = new Result<>();
+        QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<>();
         productWrapper.groupBy("product");
         int appAdCount = appAdService.count();
         int appVideoCount = appVideoService.count();
         int advertiserCount = kuaishouAdAccountService.count();
         int productCount = kuaishouAdAccountService.count(productWrapper);
-        Map<String, Object> map = new HashMap<String, Object>();
+        Map<String, Object> map = new HashMap<>();
         map.put("adCount", appAdCount);
         map.put("videoCount", appVideoCount);
         map.put("advertiserCount", advertiserCount);
@@ -87,10 +87,9 @@ public class AdCoverController {
     }
 
     @ResponseBody
-    @RequestMapping(value="/feeds", method = RequestMethod.GET)
+    @GetMapping("/feeds")
     public Result<List<AppAd>> getVideoList(HttpServletRequest req){
-        Result<List<AppAd>> result = new Result<List<AppAd>>();
-        AppAd ad = new AppAd();
+        Result<List<AppAd>> result = new Result<>();
         Map<String,String[]> paramMap = req.getParameterMap();
         String industry = paramMap.get("industry")!=null?sysCategoryService.getById(paramMap.get("industry")[0]).getName():null;
         String company = paramMap.get("company")!=null?paramMap.get("company")[0]:null;
@@ -100,8 +99,8 @@ public class AdCoverController {
         String end = paramMap.get("end")!=null?paramMap.get("end")[0]:null;
         String orderByColumn = paramMap.get("orderByColumn")!=null?paramMap.get("orderByColumn")[0]:null;
         String orderByType = paramMap.get("orderByType")!=null?paramMap.get("orderByType")[0]:null;
-        Integer pageSize = paramMap.get("pageSize")!=null?Integer.parseInt(paramMap.get("pageSize")[0]):null;
-        Integer pageNo = paramMap.get("pageNo")!=null?Integer.parseInt(paramMap.get("pageNo")[0]):null;
+        Integer pageSize = paramMap.get("pageSize") != null ? Integer.parseInt(paramMap.get("pageSize")[0]) : 10;
+        Integer pageNo = paramMap.get("pageNo") != null ? Integer.parseInt(paramMap.get("pageNo")[0]) : 1;
         int pageStart = (pageNo-1)*pageSize;
         List<AppAd> list = appAdService.queryAdFeeds(userName, industry, company, product, start, end, orderByColumn, orderByType, pageStart, pageSize);
         result.setResult(list);
@@ -110,7 +109,7 @@ public class AdCoverController {
     }
 
     @ResponseBody
-    @RequestMapping(value="/detail", method = RequestMethod.GET)
+    @GetMapping("/detail")
     public Result<Map<String,Object>> getDetail(@RequestParam(name="photoId") Long photoId, @RequestParam(name="userId") Long userId){
         Result<Map<String, Object>> result = new Result<>();
         AppAd ad = new AppAd();
@@ -128,9 +127,9 @@ public class AdCoverController {
             video.setMvUrl(ad.getMvUrl());
         }
 
-        kuaishouAdAccount.setUrl("https://live.kuaishou.com/profile/" + ad.getShareInfo().substring(ad.getShareInfo().indexOf("=") + 1, ad.getShareInfo().indexOf("&")));
+        kuaishouAdAccount.setUrl("https://live.kuaishou.com/profile/" + ad.getShareInfo().substring(ad.getShareInfo().indexOf('=') + 1, ad.getShareInfo().indexOf('&')));
         video.setShareInfo("https://live.kuaishou.com/u/" + ad.getShareInfo().replace("userId=", "").replace("photoId=", "").replace("&", "/"));
-        Map<String,Object> map = new HashMap<String,Object>();
+        Map<String, Object> map = new HashMap<>();
         map.put("adlist",list);
         map.put("user",kuaishouAdAccount);
         map.put("video",video);
@@ -140,14 +139,13 @@ public class AdCoverController {
     }
 
     /**
-     * TODO 需要确认是否可以删除
      *
      * @param photoId
      * @param userId
      * @return
      */
     @ResponseBody
-    @RequestMapping(value="/adlist", method = RequestMethod.GET)
+    @GetMapping(value = "/adlist")
     public Result<List<AppAd>> getAdList(@RequestParam(name = "photoId") String photoId, @RequestParam(name = "userId") Long userId) {
         Result<List<AppAd>> result = new Result<>();
         AppAd ad = new AppAd();

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

@@ -1,12 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
+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;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.ResultMapUtils;
-import cn.com.ctop.common.module.utils.StatusCode;
-import cn.com.ctop.common.module.utils.StringUtils;
+import cn.com.ctop.common.module.utils.*;
 import com.alibaba.excel.EasyExcelFactory;
 import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.metadata.Sheet;
@@ -30,18 +28,16 @@ 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.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
 import java.util.*;
 
 /**
@@ -62,7 +58,7 @@ public class AdvertiserController {
     @Autowired
     private UserCompanyMapper userCompanyMapper;
     @Autowired
-    private MaterialReportMapper materialReportMapper;
+    private ISysRoleService sysRoleService;
     @Autowired
     private ProjectMapper projectMapper;
     @Autowired
@@ -81,9 +77,9 @@ public class AdvertiserController {
     public Result<List<Advertiser>> getAdvertiserByCompany(String userId) {
         Result<List<Advertiser>> result = new Result<>();
         try {
-            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+            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");
@@ -97,7 +93,6 @@ public class AdvertiserController {
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
-
         }
         return result;
     }
@@ -118,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<IPage<Advertiser>>();
-        String roleCode = materialReportMapper.getRoleCodeByUserId(advertiser.getUserId());
+        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<>();
@@ -136,32 +132,19 @@ public class AdvertiserController {
                 queryWrapper.eq("company_id", userCompany.getCompanyId());
             }
         }
-        Page<Advertiser> page = new Page<Advertiser>(pageNo, pageSize);
-        IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
-        if (pageList != null && pageList.getRecords() != null && pageList.getRecords().size() > 0) {
-            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;
-
     /**
      * 添加
      *
@@ -172,7 +155,7 @@ public class AdvertiserController {
     @ApiOperation(value = "广告主信息表-添加", notes = "广告主信息表-添加")
     @PostMapping(value = "/add")
     public Result<Advertiser> add(@RequestBody Advertiser advertiser) {
-        Result<Advertiser> result = new Result<Advertiser>();
+        Result<Advertiser> result = new Result<>();
         try {
             String userId = advertiser.getUserId();
             String name = advertiser.getName().trim();
@@ -195,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) {
@@ -217,11 +208,19 @@ public class AdvertiserController {
     @ApiOperation(value = "广告主信息表-编辑", notes = "广告主信息表-编辑")
     @PutMapping(value = "/edit")
     public Result<Advertiser> edit(@RequestBody Advertiser advertiser) {
-        Result<Advertiser> result = new Result<Advertiser>();
+        Result<Advertiser> result = new Result<>();
         Advertiser advertiserEntity = advertiserService.getById(advertiser.getId());
         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());
@@ -251,7 +250,7 @@ public class AdvertiserController {
     @ApiOperation(value = "广告主信息表-通过id删除", notes = "广告主信息表-通过id删除")
     @DeleteMapping(value = "/delete")
     public Result<Advertiser> delete(@RequestParam(name = "id", required = true) String id) {
-        Result<Advertiser> result = new Result<Advertiser>();
+        Result<Advertiser> result = new Result<>();
         Advertiser advertiser = advertiserService.getById(id);
         if (advertiser == null) {
             result.error500("未找到对应实体");
@@ -287,7 +286,7 @@ public class AdvertiserController {
     @ApiOperation(value = "广告主信息表-批量删除", notes = "广告主信息表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<Advertiser> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<Advertiser> result = new Result<Advertiser>();
+        Result<Advertiser> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -324,7 +323,7 @@ public class AdvertiserController {
      * @return
      */
     @RequestMapping(value = "/ydWeekReportList")
-    public Map<String, Object> ydReportList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) throws Exception {
+    public Map<String, Object> ydReportList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) {
         Map<String, Object> result = new HashMap<>();
         Long projectId = data.getLong("projectId");
         String startDate = data.getString("startDate");
@@ -343,13 +342,12 @@ public class AdvertiserController {
     @RequestMapping(value = "/exportYdDailyReport")
     @ResponseBody
     public void exportYdWeek(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) throws Exception {
-        Map<String, Object> result = new HashMap<>();
         Long projectId = data.getLong("projectId");
         String startDate = data.getString("startDate");
         String endDate = data.getString("endDate");
         List<SheetInfoVo> vos = advertiserService.getYdStatisticInfo(projectId, startDate, endDate);
         OutputStream outputStream = response.getOutputStream();
-        this.setResponseHeader(response, "伊对" + startDate + "至" + endDate + "周报.xls");
+        HttpUtils.setResponseHeader(response, "伊对" + startDate + "至" + endDate + "周报.xls");
         ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
         for (int i = 0; i < vos.size(); i++) {
             Sheet sheet = new Sheet(i + 1, 0, KuaishouXxlEntity.class);
@@ -368,27 +366,27 @@ public class AdvertiserController {
      */
     @RequestMapping(value = "/xxlDailyReportList")
     @ResponseBody
-    public Map<String, Object> xxlReportList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) throws Exception {
+    public Map<String, Object> xxlReportList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) {
         Map<String, Object> result = new HashMap<>();
         List<SheetInfoVo> sheets = new ArrayList<>();
         //查询总的消耗信息
         Long projectId = data.getLong("projectId");
         String systemType = data.getString("systemType");
-        if (null == systemType || systemType.trim().equals("")) {
+        if (null == systemType || "".equals(systemType.trim())) {
             systemType = null;
         }
         SheetInfoVo totalSheetVo = advertiserService.getXxlStatisticInfo(projectId, systemType, null, "汇总表");
         sheets.add(totalSheetVo);
         if (null == systemType) {
             List<SheetInfoVo> vos = advertiserService.getSystemTypeXxlStatisticInfo(projectId);
-            if (null != vos && vos.size() > 0) {
+            if (null != vos && !vos.isEmpty()) {
                 for (SheetInfoVo vo : vos) {
                     sheets.add(vo);
                 }
             }
         }
         List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
-        if (null != allocations && allocations.size() > 0) {
+        if (null != allocations && !allocations.isEmpty()) {
             for (UserAllocation allocation : allocations) {
                 SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
                 sheets.add(vo);
@@ -406,9 +404,9 @@ public class AdvertiserController {
      */
     @RequestMapping(value = "/exportXxlDailyReport")
     @ResponseBody
-    public void exportXxl(HttpServletRequest request, HttpServletResponse response, Long projectId, String systemType) throws Exception {
+    public void exportXxl(HttpServletRequest request, HttpServletResponse response, Long projectId, String systemType) throws IOException {
         List<SheetInfoVo> sheets = new ArrayList<>();
-        if (null == systemType || systemType.trim().equals("")) {
+        if (null == systemType || "".equals(systemType.trim())) {
             systemType = null;
         }
         //查询总的消耗信息
@@ -416,23 +414,22 @@ public class AdvertiserController {
         sheets.add(totalSheetVo);
         if (null == systemType) {
             List<SheetInfoVo> vos = advertiserService.getSystemTypeXxlStatisticInfo(projectId);
-            if (null != vos && vos.size() > 0) {
+            if (null != vos && !vos.isEmpty()) {
                 for (SheetInfoVo vo : vos) {
                     sheets.add(vo);
                 }
             }
         }
         List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
-        if (null != allocations && allocations.size() > 0) {
+        if (null != allocations && !allocations.isEmpty()) {
             for (UserAllocation allocation : allocations) {
                 SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
                 sheets.add(vo);
             }
         }
-
         OutputStream outputStream = response.getOutputStream();
         String date = DateUtils.formatDate(new Date());
-        this.setResponseHeader(response, "爱上消消消日报" + date + ".xls");
+        HttpUtils.setResponseHeader(response, "爱上消消消日报" + date + ".xlsx");
         ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
         for (int i = 0; i < sheets.size(); i++) {
             Sheet sheet = new Sheet(i + 1, 0, KuaishouXxlEntity.class);
@@ -443,21 +440,4 @@ public class AdvertiserController {
         outputStream.flush();
         outputStream.close();
     }
-
-    //发送响应流方法
-    public void setResponseHeader(HttpServletResponse response, String fileName) {
-        try {
-            try {
-                fileName = new String(fileName.getBytes(), "ISO8859-1");
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
-            response.setContentType("application/octet-stream;charset=ISO8859-1");
-            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
-            response.addHeader("Pargam", "no-cache");
-            response.addHeader("Cache-Control", "no-cache");
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-    }
 }

+ 9 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AgentInfoController.java

@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -64,7 +65,7 @@ public class AgentInfoController {
                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                   HttpServletRequest req) {
-        Result<IPage<AgentInfo>> result = new Result<IPage<AgentInfo>>();
+        Result<IPage<AgentInfo>> result = new Result<>();
         agentInfo.setEnabled(1);
         QueryWrapper<AgentInfo> queryWrapper = QueryGenerator.initQueryWrapper(agentInfo, req.getParameterMap());
         Page<AgentInfo> page = new Page<>(pageNo, pageSize);
@@ -84,7 +85,7 @@ public class AgentInfoController {
     @ApiOperation(value = "代理商信息-添加", notes = "代理商信息-添加")
     @PostMapping(value = "/add")
     public Result<AgentInfo> add(@RequestBody AgentInfo agentInfo) {
-        Result<AgentInfo> result = new Result<AgentInfo>();
+        Result<AgentInfo> result = new Result<>();
         try {
             agentInfo.setEnabled(1);
             agentInfo.setEnabled(1);
@@ -107,7 +108,7 @@ public class AgentInfoController {
     @ApiOperation(value = "代理商信息-编辑", notes = "代理商信息-编辑")
     @PutMapping(value = "/edit")
     public Result<AgentInfo> edit(@RequestBody AgentInfo agentInfo) {
-        Result<AgentInfo> result = new Result<AgentInfo>();
+        Result<AgentInfo> result = new Result<>();
         AgentInfo agentInfoEntity = agentInfoService.getById(agentInfo.getId());
         if (agentInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -130,7 +131,7 @@ public class AgentInfoController {
     @AutoLog(value = "代理商信息-通过id删除")
     @ApiOperation(value = "代理商信息-通过id删除", notes = "代理商信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             agentInfoService.removeById(id);
         } catch (Exception e) {
@@ -150,7 +151,7 @@ public class AgentInfoController {
     @ApiOperation(value = "代理商信息-批量删除", notes = "代理商信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<AgentInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<AgentInfo> result = new Result<AgentInfo>();
+        Result<AgentInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -170,7 +171,7 @@ public class AgentInfoController {
     @ApiOperation(value = "代理商信息-通过id查询", notes = "代理商信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<AgentInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<AgentInfo> result = new Result<AgentInfo>();
+        Result<AgentInfo> result = new Result<>();
         AgentInfo agentInfo = agentInfoService.getById(id);
         if (agentInfo == null) {
             result.error500("未找到对应实体");
@@ -194,14 +195,13 @@ public class AgentInfoController {
         try {
             String paramsStr = request.getParameter("paramsStr");
             if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                String deString = URLDecoder.decode(paramsStr, StandardCharsets.UTF_8.toString());
                 AgentInfo agentInfo = JSON.parseObject(deString, AgentInfo.class);
                 queryWrapper = QueryGenerator.initQueryWrapper(agentInfo, request.getParameterMap());
             }
         } catch (UnsupportedEncodingException e) {
             e.printStackTrace();
         }
-
         //Step.2 AutoPoi 导出Excel
         ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
         List<AgentInfo> pageList = agentInfoService.list(queryWrapper);
@@ -220,7 +220,7 @@ public class AgentInfoController {
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    @PostMapping("/importExcel")
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
@@ -247,5 +247,4 @@ public class AgentInfoController {
         }
         return Result.ok("文件导入失败!");
     }
-
 }

+ 12 - 96
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountAuthController.java

@@ -4,7 +4,6 @@ import cn.com.ctop.common.module.entity.BindAccountAuth;
 import cn.com.ctop.common.module.service.IBindAccountAuthService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.StringUtils;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -15,26 +14,12 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 账号绑定-授权
@@ -59,7 +44,7 @@ public class BindAccountAuthController {
     @PostMapping(value = "/authorization")
     public Result<IPage<BindAccountAuth>> authorization(@RequestBody JSONObject json) {
         log.info("授权入参:{}", json);
-        Result<IPage<BindAccountAuth>> result = new Result<IPage<BindAccountAuth>>();
+        Result<IPage<BindAccountAuth>> result = new Result<>();
         String codeUrl = null;
         try {
             String advertiserId = json.getString("advertiserId");
@@ -69,13 +54,13 @@ public class BindAccountAuthController {
             }
 
             String authorizationType = json.getString("authorizationType");
-            Integer agentType = json.getInteger("agentType"); // 0 三方代理商 1 本代理商
-
+            // 0 三方代理商 1 本代理商
+            Integer agentType = json.getInteger("agentType");
             if ("kuaishou".equals(authorizationType)) {
-                codeUrl = bindAccountAuthService.getKuaishouCodeUrl(JSONObject.toJSONString(json), agentType);
+                codeUrl = bindAccountAuthService.getKuaishouCodeUrl(json.toJSONString(), agentType);
             }
             if ("bytedance".equals(authorizationType)) {
-                codeUrl = bindAccountAuthService.getByteDanceCodeUrl(JSONObject.toJSONString(json));
+                codeUrl = bindAccountAuthService.getByteDanceCodeUrl(json.toJSONString());
             }
             result.setMessage(codeUrl);
             result.setSuccess(true);
@@ -106,9 +91,9 @@ public class BindAccountAuthController {
                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
-        Result<IPage<BindAccountAuth>> result = new Result<IPage<BindAccountAuth>>();
+        Result<IPage<BindAccountAuth>> result = new Result<>();
         QueryWrapper<BindAccountAuth> queryWrapper = QueryGenerator.initQueryWrapper(bindAccountAuth, req.getParameterMap());
-        Page<BindAccountAuth> page = new Page<BindAccountAuth>(pageNo, pageSize);
+        Page<BindAccountAuth> page = new Page<>(pageNo, pageSize);
         IPage<BindAccountAuth> pageList = bindAccountAuthService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -125,7 +110,7 @@ public class BindAccountAuthController {
     @ApiOperation(value = "账号绑定-授权-添加", notes = "账号绑定-授权-添加")
     @PostMapping(value = "/add")
     public Result<BindAccountAuth> add(@RequestBody BindAccountAuth bindAccountAuth) {
-        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        Result<BindAccountAuth> result = new Result<>();
         try {
             bindAccountAuthService.save(bindAccountAuth);
             result.success("添加成功!");
@@ -146,13 +131,12 @@ public class BindAccountAuthController {
     @ApiOperation(value = "账号绑定-授权-编辑", notes = "账号绑定-授权-编辑")
     @PutMapping(value = "/edit")
     public Result<BindAccountAuth> edit(@RequestBody BindAccountAuth bindAccountAuth) {
-        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        Result<BindAccountAuth> result = new Result<>();
         BindAccountAuth bindAccountAuthEntity = bindAccountAuthService.getById(bindAccountAuth.getId());
         if (bindAccountAuthEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = bindAccountAuthService.updateById(bindAccountAuth);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -170,7 +154,7 @@ public class BindAccountAuthController {
     @AutoLog(value = "账号绑定-授权-通过id删除")
     @ApiOperation(value = "账号绑定-授权-通过id删除", notes = "账号绑定-授权-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bindAccountAuthService.removeById(id);
         } catch (Exception e) {
@@ -190,7 +174,7 @@ public class BindAccountAuthController {
     @ApiOperation(value = "账号绑定-授权-批量删除", notes = "账号绑定-授权-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<BindAccountAuth> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        Result<BindAccountAuth> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -210,7 +194,7 @@ public class BindAccountAuthController {
     @ApiOperation(value = "账号绑定-授权-通过id查询", notes = "账号绑定-授权-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<BindAccountAuth> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        Result<BindAccountAuth> result = new Result<>();
         BindAccountAuth bindAccountAuth = bindAccountAuthService.getById(id);
         if (bindAccountAuth == null) {
             result.error500("未找到对应实体");
@@ -220,72 +204,4 @@ public class BindAccountAuthController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<BindAccountAuth> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                BindAccountAuth bindAccountAuth = JSON.parseObject(deString, BindAccountAuth.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(bindAccountAuth, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<BindAccountAuth> pageList = bindAccountAuthService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "账号绑定-授权列表");
-        mv.addObject(NormalExcelConstants.CLASS, BindAccountAuth.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("账号绑定-授权列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<BindAccountAuth> listBindAccountAuths = ExcelImportUtil.importExcel(file.getInputStream(), BindAccountAuth.class, params);
-                bindAccountAuthService.saveBatch(listBindAccountAuths);
-                return Result.ok("文件导入成功!数据行数:" + listBindAccountAuths.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

@@ -5,8 +5,8 @@ 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.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -19,29 +19,13 @@ 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.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -55,8 +39,6 @@ import java.util.Map;
 @RestController
 @RequestMapping("/ctop/bindAccountLogin")
 public class BindAccountLoginController {
-    private static final Logger logger = LoggerFactory.getLogger(BindAccountLoginController.class);
-
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
@@ -80,25 +62,26 @@ public class BindAccountLoginController {
         }
         //创建人
         String userId = json.getString("userId");
-        String password = json.getString("password");
         String loginType = json.getString("loginType");
         // 广告主名称
         String advertiserName = json.getString("advertiser_name");
+        //项目id
+        Long projectId = json.getLong("projectId");
         //账号
         String accountName = json.getString("accountName");
-        Map<String, Object> stringObjectMap = createInternalService.bindLogin(advertiserId, accountName, password, loginType, userId, advertiserName);
+        String password = json.getString("password");
+        Map<String, Object> stringObjectMap = createInternalService.bindLogin(projectId,advertiserId, accountName, password, loginType, userId, advertiserName);
         Boolean trueOrFalse = (Boolean) stringObjectMap.get("success");
-        if (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();
@@ -114,7 +97,7 @@ public class BindAccountLoginController {
             userAllocation.setSystemType(systemType);
             int i = userAllocationMapper.insert(userAllocation);
             if (i > 0) {
-                logger.info("用户分配入库完成,advertiserId:{}", advertiserId);
+                log.info("用户分配入库完成,advertiserId:{}", advertiserId);
             }
         }
         result.setSuccess(trueOrFalse);
@@ -184,7 +167,7 @@ public class BindAccountLoginController {
     @ApiOperation(value = "账号绑定-登陆-编辑", notes = "账号绑定-登陆-编辑")
     @PutMapping(value = "/edit")
     public Result<BindAccountLogin> edit(@RequestBody BindAccountLogin bindAccountLogin) {
-        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        Result<BindAccountLogin> result = new Result<>();
         BindAccountLogin bindAccountLoginEntity = bindAccountLoginService.getById(bindAccountLogin.getId());
         if (bindAccountLoginEntity == null) {
             result.error500("未找到对应实体");
@@ -207,7 +190,7 @@ public class BindAccountLoginController {
     @AutoLog(value = "账号绑定-登陆-通过id删除")
     @ApiOperation(value = "账号绑定-登陆-通过id删除", notes = "账号绑定-登陆-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bindAccountLoginService.removeById(id);
         } catch (Exception e) {
@@ -227,7 +210,7 @@ public class BindAccountLoginController {
     @ApiOperation(value = "账号绑定-登陆-批量删除", notes = "账号绑定-登陆-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<BindAccountLogin> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        Result<BindAccountLogin> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -247,7 +230,7 @@ public class BindAccountLoginController {
     @ApiOperation(value = "账号绑定-登陆-通过id查询", notes = "账号绑定-登陆-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<BindAccountLogin> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        Result<BindAccountLogin> result = new Result<>();
         BindAccountLogin bindAccountLogin = bindAccountLoginService.getById(id);
         if (bindAccountLogin == null) {
             result.error500("未找到对应实体");
@@ -257,72 +240,4 @@ public class BindAccountLoginController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<BindAccountLogin> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                BindAccountLogin bindAccountLogin = JSON.parseObject(deString, BindAccountLogin.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(bindAccountLogin, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<BindAccountLogin> pageList = bindAccountLoginService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "账号绑定-登陆列表");
-        mv.addObject(NormalExcelConstants.CLASS, BindAccountLogin.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("账号绑定-登陆列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<BindAccountLogin> listBindAccountLogins = ExcelImportUtil.importExcel(file.getInputStream(), BindAccountLogin.class, params);
-                bindAccountLoginService.saveBatch(listBindAccountLogins);
-                return Result.ok("文件导入成功!数据行数:" + listBindAccountLogins.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

@@ -1,294 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IFileInfoService;
-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.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.toutiao.entity.ByteDanceCustomAudience;
-import cn.com.ctop.toutiao.entity.ByteDanceUserOrientationTemplate;
-import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
-import cn.com.ctop.toutiao.service.IByteDanceCreativeService;
-import cn.com.ctop.toutiao.service.IByteDanceCustomAudienceService;
-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.apache.shiro.SecurityUtils;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.modules.system.entity.SysDictItem;
-import org.jeecg.modules.system.service.ISysDictItemService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.text.ParseException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 头条广告主相关 2019年7月10日14:13:04
- *
- * @author 宋英豪
- */
-@Slf4j
-@RestController
-@RequestMapping("toutiao")
-public class ByteDanceAdvertiserPostController {
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
-    private IByteDanceCreativeService creativeService;
-    @Autowired
-    private IFileInfoService fileInfoService;
-    @Autowired
-    private IByteDanceCustomAudienceService audienceService;
-    @Autowired
-    private ISysDictItemService sysDictItemService;
-
-    /**
-     * 1:获取广告主信息
-     *
-     * @param accountId 本平台广告主id
-     */
-    @RequestMapping("/advertiser/info")
-    public Map<String, Object> advertiserInfo(String accountId) {
-        return advertiserDataService.getAdvertiserInfo(accountId);
-    }
-
-    /**
-     * 2:获取广告主广告计划信息
-     * @param accountId 本平台广告主id
-     */
-   /* @RequestMapping("/advertiser/plan/get")
-    public Map<String, Object> advertiserPlan(String accountId, String ids) {
-        return advertiserDataService.getAdvertiserPlan(accountId, ids, null);
-    }*/
-
-    /**
-     * 3:修改广告计划信息状态
-     * @param accountId 本平台广告主id
-     */
-    /*@RequestMapping("/advertiser/plan/update/status")
-    public Map<String, Object> advertiserPlanUpdateStatus(String accountId, String adIds, String optStatus) {
-        return advertiserDataService.advertiserPlanUpdateStatus(accountId, adIds, optStatus);
-    }*/
-
-    /**
-     * 3:修改广告计划信息
-     *
-     * @param accountId 本平台广告主id
-     */
-    @RequestMapping("/advertiser/ad/update")
-    public Map<String, Object> advertiserAdUpdate(String accountId, Long adId, String optStatus) {
-        ByteDanceUserOrientationTemplate template = new ByteDanceUserOrientationTemplate();
-        return advertiserDataService.advertiserAdUpdate(accountId, adId, template);
-    }
-
-
-    /**
-     * 4:修改广告计划信息状态
-     * @param accountId 本平台广告主id
-     */
-   /* @RequestMapping("/advertiser/plan/update/bid")
-    public Map<String, Object> advertiserPlanUpdateBid(String accountId, String adIds, String bids) {
-        return advertiserDataService.advertiserPlanUpdateBid(accountId, adIds, bids);
-    }*/
-
-    /**
-     * 5:修改广告计划信息状态
-     * @param accountId 本平台广告主id
-     */
-    /*@RequestMapping("/advertiser/plan/update/budget")
-    public Map<String, Object> advertiserPlanUpdateBudget(String accountId, String adIds, String budgets) {
-        return advertiserDataService.advertiserPlanUpdateBudget(accountId, adIds, budgets);
-    }*/
-
-    /**
-     * 6:获取广告主广告预算信息
-     *
-     * @param accountId 本平台广告主id
-     */
-    @RequestMapping("/advertiser/budget/get/")
-    public Map<String, Object> advertiserBudget(String accountId) {
-        return advertiserDataService.getAdvertiserBudget(accountId);
-    }
-
-    /**
-     * 7:获取广告主广告组信息
-     *
-     * @param accountId 本平台广告主id
-     */
-    @RequestMapping("/advertiser/campaign/get")
-    public Map<String, Object> advertiserCampaign(String accountId, String ids) {
-        return advertiserDataService.getAdvertiserCampaign(accountId, ids, null);
-    }
-
-    /**
-     * 7:获取广告主广告组信息
-     *
-     * @param accountId 本平台广告主id
-     */
-    @GetMapping("/advertiser/campaign/list")
-    public Map<String, Object> advertiserCampaignList(String accountId) {
-        return advertiserDataService.getAdvertiserCampaignList(accountId);
-    }
-
-    /**
-     * 8:获取广告主广告创意信息
-     *
-     * @param accountId 本平台广告主id
-     */
-    @RequestMapping("/advertiser/creative/get")
-    public Map<String, Object> getAdvertiserCreative(String accountId, String ids) {
-        return creativeService.getAdvertiserCreative(accountId, ids, null);
-    }
-
-    /**
-     * 9:修改广告创意信息状态
-     *
-     * @param accountId 本平台广告主id
-     */
-    @RequestMapping("/advertiser/update/status/")
-    public Map<String, Object> advertiserCreativeUpdateStatus(String accountId, String creativeIds, String optStatus) {
-        return creativeService.advertiserCreativeUpdateStatus(accountId, creativeIds, optStatus);
-    }
-
-    /**
-     * 10:获取广告主广告创意素材信息
-     *
-     * @param accountId   本平台广告主id
-     * @param creativeIds 广告创意id
-     */
-    @RequestMapping("/advertiser/creative/material/read")
-    public Map<String, Object> advertiserCreativeMaterial(String accountId, String creativeIds) {
-        return advertiserDataService.getAdvertiserCreativeMaterial(accountId, creativeIds);
-    }
-
-    /**
-     * 12:广告组更新状态信息 @param accountId 本平台广告主id
-     */
-    @RequestMapping("/advertiser/campaign/update/status")
-    public Map<String, Object> advertiserCampaignUpdateStatus(String accountId, String campaignIds, String optStatus) {
-        return advertiserDataService.advertiserCampaignUpdateStatus(accountId, campaignIds, optStatus);
-    }
-
-    /**
-     * 13:广告组更新信息 @param accountId 本平台广告主id
-     */
-    @RequestMapping("/advertiser/campaign/update")
-    public Map<String, Object> advertiserCampaignUpdate(String accountId, Long campaignId, String budgetMode, Integer budget, String campaignName) {
-        return advertiserDataService.advertiserCampaignUpdate(accountId, campaignId, budgetMode, budget, campaignName);
-    }
-
-    /**
-     * 14:获取人群包信息
-     */
-    @RequestMapping("/advertiser/custom/audience/select")
-    public Map<String, Object> customAudienceSelect(String accountId) {
-        return advertiserDataService.advertiserCustomAudienceSelect(accountId);
-    }
-
-    /**
-     * 14:获取流量包数据
-     */
-    @RequestMapping("/advertiser/custom/package/get")
-    public Map<String, Object> flowPackageGet(String accountId) {
-        return advertiserDataService.flowPackageGet(accountId);
-    }
-
-
-    /**
-     * 15:上传视频信息
-     *
-     * @param accountId 本平台广告主id
-     * @
-     */
-    @RequestMapping("/advertiser/video/add")
-    public Map<String, Object> advertiserVideoAdd(String accountId, String videoUrl) {
-        return fileInfoService.uploadVideoToBytedance(accountId, videoUrl);
-    }
-
-    /**
-     * 15:上传图片信息
-     *
-     * @param accountId 本平台广告主id
-     * @
-     */
-    @RequestMapping("/advertiser/image/add")
-    public Map<String, Object> advertiserImageAdd(String accountId, String imageUrl) {
-        return fileInfoService.uploadImageToBytedance(accountId, imageUrl);
-    }
-
-    /**
-     * @param audience
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     * @功能:查询字典数据
-     */
-    @RequestMapping(value = "/audience/list", method = RequestMethod.GET)
-    public Result<IPage<ByteDanceCustomAudience>> audiencePageList(ByteDanceCustomAudience audience, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                                   @RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest req) {
-        Result<IPage<ByteDanceCustomAudience>> result = new Result<>();
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        audience.setAdvertiserId(user.getId());
-        QueryWrapper<ByteDanceCustomAudience> queryWrapper = QueryGenerator.initQueryWrapper(audience, req.getParameterMap());
-        queryWrapper.orderByAsc("sort_order");
-        Page<ByteDanceCustomAudience> page = new Page<>(pageNo, pageSize);
-        IPage<ByteDanceCustomAudience> pageList = audienceService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * @param sysDictItem
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     * @功能:查询字典数据
-     */
-    @RequestMapping(value = "dictitem/list", method = RequestMethod.GET)
-    public Result<IPage<SysDictItem>> dictitemPageList(SysDictItem sysDictItem, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                       @RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest req) {
-        Result<IPage<SysDictItem>> result = new Result<>();
-        QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
-        queryWrapper.orderByAsc("sort_order");
-        Page<SysDictItem> page = new Page<>(pageNo, pageSize);
-        IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-
-    @GetMapping("loadSingleData")
-    public Map<String, Object> loadSingleData(Long accountId) {
-        Map<String, Object> result = new HashMap<>();
-        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId + "");
-        if (null != token && token.getMediaId() == CtopAdConstant.PLATFORM_TYPE_KUAISHOU) {
-            try {
-                kuaishouInterfaceService.loadKuaishouDataSingle(token);
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-        } else {
-            log.info("token异常");
-        }
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS.getCode());
-        return result;
-    }
-
-
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-}

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

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

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

@@ -6,8 +6,9 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.IFileInfoService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.toutiao.entity.*;
-import cn.com.ctop.toutiao.service.*;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCampaign;
+import cn.com.ctop.toutiao.modules.material.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -36,89 +37,11 @@ public class ByteDanceTemplateController {
     @Autowired
     private IUserAllocationService userAllocationService;
     @Autowired
-    private IBytedanceUrlInfoService urlInfoService;
-    @Autowired
     private IFileInfoService fileInfoService;
     @Autowired
     private IByteDanceAdvertisePlanService planService;
     @Autowired
     private IByteDanceCampaignService campaignService;
-    @Autowired
-    private IByteDanceUserOrientationTemplateService orientationTemplateService;
-    @Autowired
-    private IByteDanceCampaignTemplateService campaignTemplateService;
-    @Autowired
-    private IByteDanceBudgetTemplateService budgetTemplateService;
-    @Autowired
-    private IBytedanceDeliveryTargetTemplateService deliveryTargetTemplateService;
-    @Autowired
-    private IBytedanceAdvertisePlanTemplateService advertisePlanTemplateService;
-
-    /**
-     * 广告组模板
-     *
-     * @param template 广告组模板信息
-     * @return map
-     */
-    @PostMapping("campaign/insert")
-    public Map<String, Object> campaignTemplateInsert(@RequestBody ByteDanceCampaignTemplate template) {
-        return campaignTemplateService.insertTemplate(template);
-    }
-
-    /**
-     * 智能封面
-     *
-     * @param accountId 广告主id
-     * @param videoId 视频id
-     * @return map
-     */
-    @GetMapping("cover/suggest")
-    public Map<String, Object> suggestCover(String accountId, String videoId) {
-        return campaignTemplateService.getSuggestCover(accountId, videoId);
-    }
-
-    /**
-     * 预算与出价模板
-     *
-     * @param template 预算与出价模板信息
-     * @return map
-     */
-    @PostMapping("budget/insert")
-    public Map<String, Object> budgetTemplateInsert(@RequestBody ByteDanceBudgetTemplate template) {
-        return budgetTemplateService.insertTemplate(template);
-    }
-
-    /**
-     * 投放目标
-     *
-     * @param template 投放目标信息
-     * @return map
-     */
-    @PostMapping("deliverytarget/insert")
-    public Map<String, Object> diliverytargetTemplateInsert(@RequestBody BytedanceDeliveryTargetTemplate template) {
-        return deliveryTargetTemplateService.insertTemplate(template);
-    }
-
-    /**
-     * 获取投放目标信息
-     *
-     * @param targetId 投放目标id
-     * @return map
-     */
-    @GetMapping("deliveryTarget/get")
-    public Map<String, Object> diliverytargetTemplateGet(Long targetId) {
-        return deliveryTargetTemplateService.get(targetId);
-    }
-
-    /**
-     * 广告创意创建
-     * @param template 广告创意信息
-     * @return map
-     */
-    @PostMapping("creative/insert")
-    public Map<String, Object> creativeInsert(@RequestBody JSONObject template) {
-        return creativeService.insertBatch(template);
-    }
 
     /**
      * 获取快手授权用户信息列表
@@ -172,76 +95,6 @@ public class ByteDanceTemplateController {
         return result;
     }
 
-    /**
-     * 用户定向
-     *
-     * @param template
-     * @param req
-     * @return
-     */
-    @PostMapping("userorentation/insert")
-    public Map<String, Object> userOrentationTemplateInsert(@RequestBody JSONObject template, HttpServletRequest req) {
-        return orientationTemplateService.insertTemplate(template);
-    }
-
-    /**
-     * 链接信息
-     *
-     * @param urlInfo
-     * @param req
-     * @return
-     */
-    @PostMapping("link/insert")
-    public Map<String, Object> linkInsert(@RequestBody BytedanceUrlInfo urlInfo, HttpServletRequest req) {
-        return urlInfoService.insertLink(urlInfo);
-    }
-
-    /**
-     * 广告计划模板
-     * 方法废弃
-     *
-     * @param template
-     * @param req
-     * @return
-     */
-    @PostMapping("advertiserplan/insert")
-    public Map<String, Object> advertiserplanTemplateInsert(@RequestBody BytedanceAdvertisePlanTemplate template, String accountId, HttpServletRequest req) {
-        return advertisePlanTemplateService.insertTemplate(template, accountId);
-    }
-
-    /**
-     * 用户定向模板列表
-     *
-     * @param template
-     * @param req
-     * @return
-     */
-    @PostMapping("userorentation/list")
-    public Result<IPage<ByteDanceUserOrientationTemplate>> userOrentationTemplateList(ByteDanceUserOrientationTemplate template, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
-        return orientationTemplateService.getList(template, pageNo, pageSize, req);
-    }
-
-    /**
-     * 预算与出价模板
-     *
-     * @param template
-     * @param req
-     * @return
-     */
-    @PostMapping("budget/list")
-    public Result<IPage<ByteDanceBudgetTemplate>> budgetTemplateList(ByteDanceBudgetTemplate template, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
-        return budgetTemplateService.getList(template, pageNo, pageSize, req);
-    }
-
-    /**
-     * 广告组模板
-     *
-     * @return
-     */
-    @PostMapping("campaign/list")
-    public Result<IPage<ByteDanceCampaignTemplate>> campaignTemplateList(ByteDanceCampaignTemplate template, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
-        return campaignTemplateService.getList(template, pageNo, pageSize, req);
-    }
 
     /**
      * @param pageNo
@@ -263,35 +116,6 @@ public class ByteDanceTemplateController {
         return result;
     }
 
-    /**
-     * @param accountId
-     * @return 查询计划可用转化id
-     */
-    @GetMapping(value = "convert/list")
-    public Map<String, Object> convertPageList(Long accountId, Long targetId) {
-        return planService.getAdConvertList(accountId, targetId);
-    }
-
-    /**
-     * @param accountId
-     * @param urlId     链接id
-     * @return 查询计划可用转化id
-     */
-    @GetMapping(value = "convert/list/url")
-    public Map<String, Object> convertListByUrlId(Long accountId, Long urlId) {
-        return planService.getAdConvertListByUrlId(accountId, urlId);
-    }
-
-    /**
-     * @param bindAccountId 绑定账号id
-     * @param urlId         链接id
-     * @return 查询计划可用转化id
-     */
-    @GetMapping(value = "convert/list/url/ng")
-    public Map<String, Object> convertListByBindAccountId(Long bindAccountId, Long urlId) {
-        return planService.getAdConvertListByUrlIdAndBindId(bindAccountId, urlId);
-    }
-
     @Autowired
     private ISysCategoryService sysCategoryService;
 
@@ -324,18 +148,6 @@ public class ByteDanceTemplateController {
         return result;
     }
 
-    /**
-     * 投放目标
-     *
-     * @param template
-     * @param req
-     * @return
-     */
-    @PostMapping("deliverytarget/list")
-    public Result<IPage<BytedanceDeliveryTargetTemplate>> diliverytargetTemplateList(BytedanceDeliveryTargetTemplate template, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
-        return deliveryTargetTemplateService.getList(template, pageNo, pageSize, req);
-    }
-
     @PostMapping("video/upload")
     public Map<String, Object> videoUpload(MultipartFile file) {
         return new HashMap<>();

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

@@ -1,164 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.modules.ctop.entity.BytedanceFundDaily;
-import org.jeecg.modules.ctop.service.IBytedanceFundDailyService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Arrays;
-
-/**
- * 账号日流水信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-04-08
- */
-@Slf4j
-@Api(tags = "账号日流水信息")
-@RestController
-@RequestMapping("/ctop/bytedanceFundDaily")
-public class BytedanceFundDailyController {
-    @Autowired
-    private IBytedanceFundDailyService bytedanceFundDailyService;
-
-    /**
-     * 分页列表查询
-     *
-     * @param bytedanceFundDaily
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "账号日流水信息-分页列表查询")
-    @ApiOperation(value = "账号日流水信息-分页列表查询", notes = "账号日流水信息-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<BytedanceFundDaily>> queryPageList(BytedanceFundDaily bytedanceFundDaily,
-                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                           HttpServletRequest req) {
-        Result<IPage<BytedanceFundDaily>> result = new Result<IPage<BytedanceFundDaily>>();
-        QueryWrapper<BytedanceFundDaily> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceFundDaily, req.getParameterMap());
-        Page<BytedanceFundDaily> page = new Page<BytedanceFundDaily>(pageNo, pageSize);
-        IPage<BytedanceFundDaily> pageList = bytedanceFundDailyService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 添加
-     *
-     * @param bytedanceFundDaily
-     * @return
-     */
-    @AutoLog(value = "账号日流水信息-添加")
-    @ApiOperation(value = "账号日流水信息-添加", notes = "账号日流水信息-添加")
-    @PostMapping(value = "/add")
-    public Result<BytedanceFundDaily> add(@RequestBody BytedanceFundDaily bytedanceFundDaily) {
-        Result<BytedanceFundDaily> result = new Result<BytedanceFundDaily>();
-        try {
-            bytedanceFundDailyService.save(bytedanceFundDaily);
-            result.success("添加成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 编辑
-     *
-     * @param bytedanceFundDaily
-     * @return
-     */
-    @AutoLog(value = "账号日流水信息-编辑")
-    @ApiOperation(value = "账号日流水信息-编辑", notes = "账号日流水信息-编辑")
-    @PutMapping(value = "/edit")
-    public Result<BytedanceFundDaily> edit(@RequestBody BytedanceFundDaily bytedanceFundDaily) {
-        Result<BytedanceFundDaily> result = new Result<BytedanceFundDaily>();
-        BytedanceFundDaily bytedanceFundDailyEntity = bytedanceFundDailyService.getById(bytedanceFundDaily.getId());
-        if (bytedanceFundDailyEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = bytedanceFundDailyService.updateById(bytedanceFundDaily);
-            if (ok) {
-                result.success("修改成功!");
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * 通过id删除
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "账号日流水信息-通过id删除")
-    @ApiOperation(value = "账号日流水信息-通过id删除", notes = "账号日流水信息-通过id删除")
-    @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
-        try {
-            bytedanceFundDailyService.removeById(id);
-        } catch (Exception e) {
-            log.error("删除失败", e.getMessage());
-            return Result.error("删除失败!");
-        }
-        return Result.ok("删除成功!");
-    }
-
-    /**
-     * 批量删除
-     *
-     * @param ids
-     * @return
-     */
-    @AutoLog(value = "账号日流水信息-批量删除")
-    @ApiOperation(value = "账号日流水信息-批量删除", notes = "账号日流水信息-批量删除")
-    @DeleteMapping(value = "/deleteBatch")
-    public Result<BytedanceFundDaily> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BytedanceFundDaily> result = new Result<BytedanceFundDaily>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.bytedanceFundDailyService.removeByIds(Arrays.asList(ids.split(",")));
-            result.success("删除成功!");
-        }
-        return result;
-    }
-
-    /**
-     * 通过id查询
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "账号日流水信息-通过id查询")
-    @ApiOperation(value = "账号日流水信息-通过id查询", notes = "账号日流水信息-通过id查询")
-    @GetMapping(value = "/queryById")
-    public Result<BytedanceFundDaily> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BytedanceFundDaily> result = new Result<BytedanceFundDaily>();
-        BytedanceFundDaily bytedanceFundDaily = bytedanceFundDailyService.getById(id);
-        if (bytedanceFundDaily == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(bytedanceFundDaily);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-}

+ 92 - 95
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
@@ -10,9 +9,12 @@ import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -22,14 +24,11 @@ import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysDepartService;
 import org.jeecg.modules.system.service.ISysUserService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -41,30 +40,30 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-@Controller
+@Slf4j
+@RestController
 public class CallbackController {
-    private static final Logger logger = LoggerFactory.getLogger(CallbackController.class);
     @Autowired
     private ISysUserService sysUserService;
-
     @Autowired
     private RedisUtil redisUtil;
     @Autowired
     private ISysDepartService sysDepartService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
-
     @Autowired
     private UserAllocationMapper allocationMapper;
-
     @Autowired
     private ICtopOauthTokenService ctopOauthTokenService;
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+    @Autowired
+    private IReportService reportService;
+
 
     @GetMapping("/qywexin")
-    @ResponseBody
     public void qywexin(HttpServletRequest request,
                         HttpServletResponse response,
                         @RequestParam("code") String code,
@@ -92,7 +91,7 @@ public class CallbackController {
         JSONObject obj = new JSONObject();
         List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
         obj.put("departs", departs);
-        if (departs == null || departs.size() == 0) {
+        if (departs == null || departs.isEmpty()) {
             obj.put("multi_depart", 0);
         } else if (departs.size() == 1) {
             sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
@@ -108,8 +107,6 @@ public class CallbackController {
     }
 
     /**
-     * TODO 授权绑定成功/失败 需要跳转特定页面
-     *
      * @param request
      * @param response
      * @param authCode
@@ -117,17 +114,13 @@ public class CallbackController {
      * @return
      */
     @GetMapping("/kuaishou")
-    @ResponseBody
-    public String kuaishou(HttpServletRequest request,
-                           HttpServletResponse response,
-                           @RequestParam("auth_code") String authCode,
-                           @RequestParam("state") String state) {
+    public String kuaishouCallback(HttpServletRequest request, HttpServletResponse response, @RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
         try {
             JSONObject json = JSONObject.parseObject(state);
             if (Check.isNull(json)) {
                 throw new Exception("回调信息为空");
             }
-            logger.info("快手授权返回信息:{}", json);
+            log.info("快手授权返回信息:{}", json);
             Integer agentType = json.getInteger("agentType");
             if (StringUtils.isNotBlank(authCode)) {
                 KuaishouResultToken accessToken = kuaishouInterfaceService.getAccessToken(authCode, agentType);
@@ -151,8 +144,8 @@ public class CallbackController {
                     //创建人
                     String userId = json.getString("userId");
                     Long projectId = json.getLong("projectId");
-                    BigDecimal WarningProportion = json.getBigDecimal("WarningProportion");
-                    BigDecimal WarningAmount = json.getBigDecimal("WarningAmount");
+                    BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
+                    BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
                     String systemType = json.getString("systemType");
 
                     CtopOauthToken topOauthToken = new CtopOauthToken();
@@ -199,8 +192,8 @@ public class CallbackController {
                     userAllocation.setAccountId(accountId);
                     userAllocation.setProjectId(projectId);
                     userAllocation.setProjectName(projectName);
-                    userAllocation.setWarningProportion(WarningProportion);
-                    userAllocation.setWarningAmount(WarningAmount);
+                    userAllocation.setWarningProportion(warningProportion);
+                    userAllocation.setWarningAmount(warningAmount);
 
                     userAllocation.setCreateTime(new Date());
                     userAllocation.setUpdateTime(new Date());
@@ -211,7 +204,7 @@ public class CallbackController {
                     allocationMapper.deleteByMap(deleteUserMap);
                     int i = allocationMapper.insert(userAllocation);
                     if (i > 0) {
-                        logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
+                        log.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
                     }
 
                     //账号绑定
@@ -237,7 +230,6 @@ public class CallbackController {
     }
 
     @RequestMapping("/bytedance")
-    @ResponseBody
     public String bytedance(HttpServletRequest request,
                             HttpServletResponse response,
                             @RequestParam("auth_code") String authCode,
@@ -245,27 +237,20 @@ public class CallbackController {
 
         if (StringUtils.isNotBlank(authCode)) {
             Map<String, Object> map = this.getByteDanceAccessToken(authCode, state);
-            Integer code = (Integer) map.get("code");
-            if (code == 0) {
-                return "授权绑定成功";
-            }
-            logger.info("返回信息:{}", map.toString());
+            log.info("返回信息:{}", map.toString());
             return (String) map.get("desc");
         }
         return "授权绑定失败";
     }
 
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-
     public Map<String, Object> getByteDanceAccessToken(String authCode, String state) {
         Map<String, Object> param = new HashMap<>();
         param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
         param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
         param.put("grant_type", "auth_code");
         param.put("auth_code", authCode);
-        logger.info("authCode:{}", authCode);
-        logger.info("state:{}", state);
+        log.info("authCode:{}", authCode);
+        log.info("state:{}", state);
         Map<String, Object> returnMap = new HashMap<>();
         try {
             JSONObject json = JSONObject.parseObject(state);
@@ -274,11 +259,11 @@ public class CallbackController {
             }
             String result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.AUTH_TOKEN, param, new HashMap<>());
             JSONObject resultObject = JSONObject.parseObject(result);
-            logger.info("返回信息:{}", resultObject);
+            log.info("返回信息:{}", resultObject);
             Integer code = resultObject.getInteger("code");
             String message = resultObject.getString("message");
             if (null == code || code != 0) {
-                logger.error("获取token失败,state:{},message:{}", state, message);
+                log.error("获取token失败,state:{},message:{}", state, message);
                 throw new Exception("token返回码异常");
             }
             //广告主id
@@ -294,69 +279,83 @@ public class CallbackController {
             String userName = json.getString("userName");
             Long projectId = json.getLong("projectId");
             String projectName = json.getString("projectName");
-            BigDecimal WarningProportion = json.getBigDecimal("WarningProportion");
-            BigDecimal WarningAmount = json.getBigDecimal("WarningAmount");
+            BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
+            BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
 
             JSONObject data = resultObject.getJSONObject("data");
-            CtopOauthToken token = new CtopOauthToken(advertiserId, data);
-            ctopOauthTokenService.saveOrUpdate(token);
-            //获取广告主信息
-            Map<String, Object> advertiserDataMap = advertiserDataService.getAdvertiserInfo(token.getAccountId() + "");
-            Boolean getSuccess = (Boolean) advertiserDataMap.get("success");
-            if (null == getSuccess || !getSuccess) {
-                logger.info("获取广告主信息失败,accountId:{},message:{}", token.getAccountId(), (String) advertiserDataMap.get("message"));
-                throw new Exception("获取广告主信息失败");
-            }
 
-            Long accountId = token.getAccountId();
-            QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
-            userAllocationQueryWrapper.eq("account_id", accountId);
-            userAllocationQueryWrapper.eq("media_id", 1);
-            userAllocationQueryWrapper.orderByDesc("create_time");
-            userAllocationQueryWrapper.last("limit 1");
-            UserAllocation checkUserAllocation = allocationMapper.selectOne(userAllocationQueryWrapper);
-            if (!Check.isNull(checkUserAllocation)) {
+            if (Check.isNull(data)) {
                 returnMap.put("code", -1);
-                returnMap.put("desc", "授权失败,账号已被:" + checkUserAllocation.getUserName() + "绑定");
+                returnMap.put("desc", "返回信息为空");
                 return returnMap;
+
             }
 
-            String systemType = json.getString("systemType");
-            UserAllocation userAllocation = new UserAllocation();
-            userAllocation.setUserId(userId);
-            userAllocation.setUserName(userName);
-            userAllocation.setAccountId(token.getAccountId());
-            userAllocation.setAdvertiserName(advertiserName);
-            userAllocation.setMediaId(mediaId);
-            userAllocation.setProjectId(projectId);
-            userAllocation.setProjectName(projectName);
-            userAllocation.setSystemType(systemType);
-            userAllocation.setAuthName((String) advertiserDataMap.get("name"));
-            userAllocation.setAdvertiserId(advertiserId);
-            userAllocation.setWarningProportion(WarningProportion);
-            userAllocation.setWarningAmount(WarningAmount);
-            userAllocation.setCreateTime(new Date());
-            userAllocation.setUpdateTime(new Date());
-            allocationMapper.deleteById(userAllocation.getId());
-            Map<String, Object> deleteUserMap = new HashMap<>();
-            deleteUserMap.put("advertiser_id", advertiserId);
-            deleteUserMap.put("account_id", token.getAccountId());
-            allocationMapper.deleteByMap(deleteUserMap);
-            int i = allocationMapper.insert(userAllocation);
-            if (i > 0) {
-                logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, token.getAccountId());
+            data.remove("advertiser_id");
+            JSONArray advertiser_ids = data.getJSONArray("advertiser_ids");
+            if (Check.isNull(advertiser_ids)) {
+                returnMap.put("code", -1);
+                returnMap.put("desc", "请选择需要授权的账号");
+                return returnMap;
+
             }
-            //账号绑定
-            bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiserId);
-            Thread thread = new Thread() {
-                @Override
-                public void run() {
-                    reportService.loadBytedanceHistoryData(token);
+
+            data.remove("advertiser_ids");
+            StringBuilder text = new StringBuilder();
+            for (int i = 0; i < advertiser_ids.size(); i++) {
+                Long advertiser_id = advertiser_ids.getLong(i);
+                data.put("advertiser_id", advertiser_id);
+                CtopOauthToken token = new CtopOauthToken(advertiserId, data);
+                ctopOauthTokenService.saveOrUpdate(token);
+                //获取广告主信息
+                Map<String, Object> advertiserDataMap = advertiserDataService.getAdvertiserInfo(token.getAccountId() + "");
+                Boolean getSuccess = (Boolean) advertiserDataMap.get("success");
+                if (null == getSuccess || !getSuccess) {
+                    log.info("获取广告主信息失败,accountId:{},message:{}", token.getAccountId(), (String) advertiserDataMap.get("message"));
+                    continue;
+                }
+
+                Long accountId = token.getAccountId();
+                QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
+                userAllocationQueryWrapper.eq("account_id", accountId);
+                userAllocationQueryWrapper.eq("media_id", 1);
+                userAllocationQueryWrapper.orderByDesc("create_time");
+                userAllocationQueryWrapper.last("limit 1");
+                UserAllocation checkUserAllocation = allocationMapper.selectOne(userAllocationQueryWrapper);
+                if (!Check.isNull(checkUserAllocation)) {
+                    text.append("accountId:" + accountId + ",授权名称为:" + (String) advertiserDataMap.get("name") + ",绑定失败,失败原因:已被" + checkUserAllocation.getUserName() + "绑定。")
+                            .append("<br/>");
+                    continue;
+                }
+                text.append("accountId:" + accountId + ",授权名称为:" + (String) advertiserDataMap.get("name") + ",绑定成功。").append("<br/>");
+                String systemType = json.getString("systemType");
+                UserAllocation userAllocation = new UserAllocation();
+                userAllocation.setUserId(userId);
+                userAllocation.setUserName(userName);
+                userAllocation.setAccountId(token.getAccountId());
+                userAllocation.setAdvertiserName(advertiserName);
+                userAllocation.setMediaId(mediaId);
+                userAllocation.setProjectId(projectId);
+                userAllocation.setProjectName(projectName);
+                userAllocation.setSystemType(systemType);
+                userAllocation.setAuthName((String) advertiserDataMap.get("name"));
+                userAllocation.setAdvertiserId(advertiserId);
+                userAllocation.setWarningProportion(warningProportion);
+                userAllocation.setWarningAmount(warningAmount);
+                userAllocation.setCreateTime(new Date());
+                userAllocation.setUpdateTime(new Date());
+                int j = allocationMapper.insert(userAllocation);
+                if (j > 0) {
+                    log.info("同步分配用户表完成,task_id:{},accountId:{}", state, token.getAccountId());
                 }
-            };
-            thread.start();
+                //账号绑定
+                bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiserId);
+                new Thread(() -> reportService.loadBytedanceHistoryData(token)).start();
+            }
+
             returnMap.put("code", 0);
-            returnMap.put("desc", "success");
+            returnMap.put("desc", text);
+
         } catch (Exception e) {
             e.printStackTrace();
             returnMap.put("code", -1);
@@ -365,7 +364,5 @@ public class CallbackController {
         return returnMap;
     }
 
-    @Autowired
-    private IReportService reportService;
 
 }

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

@@ -22,8 +22,6 @@ public class CreativeTitleController {
         result.setSuccess(true);
         result.setResult(labelArr);
         return result;
-
-
     }
 
 
@@ -34,8 +32,6 @@ public class CreativeTitleController {
         result.setSuccess(true);
         result.setResult(labelArr);
         return result;
-
-
     }
 
 
@@ -47,8 +43,6 @@ public class CreativeTitleController {
         result.setSuccess(true);
         result.setResult(labelArr);
         return result;
-
-
     }
 
 

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

@@ -67,7 +67,7 @@ public class CtopOauthTokenController {
                                                        HttpServletRequest req) {
         Result<IPage<CtopOauthToken>> result = new Result<>();
         QueryWrapper<CtopOauthToken> queryWrapper = QueryGenerator.initQueryWrapper(cTopOauthToken, req.getParameterMap());
-        Page<CtopOauthToken> page = new Page<CtopOauthToken>(pageNo, pageSize);
+        Page<CtopOauthToken> page = new Page<>(pageNo, pageSize);
         IPage<CtopOauthToken> pageList = ctopOauthTokenService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -84,7 +84,7 @@ public class CtopOauthTokenController {
     @ApiOperation(value = "oauth授权码-添加", notes = "oauth授权码-添加")
     @PostMapping(value = "/add")
     public Result<CtopOauthToken> add(@RequestBody CtopOauthToken ctopOauthToken) {
-        Result<CtopOauthToken> result = new Result<CtopOauthToken>();
+        Result<CtopOauthToken> result = new Result<>();
         try {
             ctopOauthTokenService.save(ctopOauthToken);
             result.success("添加成功!");
@@ -105,13 +105,12 @@ public class CtopOauthTokenController {
     @ApiOperation(value = "oauth授权码-编辑", notes = "oauth授权码-编辑")
     @PutMapping(value = "/edit")
     public Result<CtopOauthToken> edit(@RequestBody CtopOauthToken cTopOauthToken) {
-        Result<CtopOauthToken> result = new Result<CtopOauthToken>();
+        Result<CtopOauthToken> result = new Result<>();
         CtopOauthToken cTopOauthTokenEntity = ctopOauthTokenService.getById(cTopOauthToken.getId());
         if (cTopOauthTokenEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = ctopOauthTokenService.updateById(cTopOauthToken);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -129,7 +128,7 @@ public class CtopOauthTokenController {
     @AutoLog(value = "oauth授权码-通过id删除")
     @ApiOperation(value = "oauth授权码-通过id删除", notes = "oauth授权码-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             ctopOauthTokenService.removeById(id);
         } catch (Exception e) {
@@ -169,7 +168,7 @@ public class CtopOauthTokenController {
     @ApiOperation(value = "oauth授权码-通过id查询", notes = "oauth授权码-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<CtopOauthToken> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<CtopOauthToken> result = new Result<CtopOauthToken>();
+        Result<CtopOauthToken> result = new Result<>();
         CtopOauthToken cTopOauthToken = ctopOauthTokenService.getById(id);
         if (cTopOauthToken == null) {
             result.error500("未找到对应实体");
@@ -219,8 +218,8 @@ public class CtopOauthTokenController {
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+    @PostMapping("/importExcel")
+    public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

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

@@ -80,11 +80,11 @@ public class DramaInfoController {
 												  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 												  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 												  HttpServletRequest req) {
-		Result<IPage<DramaInfo>> result = new Result<IPage<DramaInfo>>();
+        Result<IPage<DramaInfo>> result = new Result<>();
 		QueryWrapper<DramaInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaInfo, req.getParameterMap());
-		Page<DramaInfo> page = new Page<DramaInfo>(pageNo, pageSize);
+        Page<DramaInfo> page = new Page<>(pageNo, pageSize);
 		IPage<DramaInfo> pageList = dramaInfoService.page(page, queryWrapper);
-		if (pageList != null && pageList.getRecords() != null && pageList.getRecords().size() > 0) {
+        if (pageList != null && pageList.getRecords() != null && !pageList.getRecords().isEmpty()) {
 			List<DramaInfo> list = new ArrayList<>();
 			for (int i = 0; i < pageList.getRecords().size(); i++) {
 				DramaInfo getDramaInfo = pageList.getRecords().get(i);
@@ -136,7 +136,7 @@ public class DramaInfoController {
 	@ApiOperation(value="剧本信息-编辑", notes="剧本信息-编辑")
 	@PostMapping(value = "/edit")
 	public Result<DramaInfo> edit(@RequestBody DramaInfo dramaInfo) {
-		Result<DramaInfo> result = new Result<DramaInfo>();
+        Result<DramaInfo> result = new Result<>();
 		DramaInfo dramaInfoEntity = dramaInfoService.getById(dramaInfo.getId());
 		if(dramaInfoEntity==null) {
 			result.error500("未找到对应实体");
@@ -158,14 +158,8 @@ public class DramaInfoController {
 	@AutoLog(value = "剧本信息-通过id删除")
 	@ApiOperation(value="剧本信息-通过id删除", notes="剧本信息-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
-		try {
-			dramaInfoService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
+    public Map<String, Object> delete(@RequestParam(name = "id", required = true) String id) {
+        return dramaInfoService.delete(id);
 	}
 
 	/**
@@ -177,7 +171,7 @@ public class DramaInfoController {
 	@ApiOperation(value="剧本信息-批量删除", notes="剧本信息-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<DramaInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<DramaInfo> result = new Result<DramaInfo>();
+        Result<DramaInfo> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -196,7 +190,7 @@ public class DramaInfoController {
 	@ApiOperation(value="剧本信息-通过id查询", notes="剧本信息-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<DramaInfo> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<DramaInfo> result = new Result<DramaInfo>();
+        Result<DramaInfo> result = new Result<>();
 		DramaInfo dramaInfo = dramaInfoService.getById(id);
 		if(dramaInfo==null) {
 			result.error500("未找到对应实体");

+ 7 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.Map;
 
 /**
  * 剧本内容信息
@@ -49,9 +50,9 @@ public class DramaItemInfoController {
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
-        Result<IPage<DramaItemInfo>> result = new Result<IPage<DramaItemInfo>>();
+        Result<IPage<DramaItemInfo>> result = new Result<>();
         QueryWrapper<DramaItemInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaItemInfo, req.getParameterMap());
-        Page<DramaItemInfo> page = new Page<DramaItemInfo>(pageNo, pageSize);
+        Page<DramaItemInfo> page = new Page<>(pageNo, pageSize);
         queryWrapper.orderByAsc("rank").orderByDesc("update_time");
         IPage<DramaItemInfo> pageList = dramaItemInfoService.page(page, queryWrapper);
         result.setSuccess(true);
@@ -114,14 +115,8 @@ public class DramaItemInfoController {
     @AutoLog(value = "剧本内容信息-通过id删除")
     @ApiOperation(value = "剧本内容信息-通过id删除", notes = "剧本内容信息-通过id删除")
     @PostMapping(value = "/delete")
-    public Result<?> delete(@RequestBody DramaItemInfo dramaItemInfo) {
-        try {
-            dramaItemInfoService.removeById(dramaItemInfo.getId());
-        } catch (Exception e) {
-            log.error("删除失败", e.getMessage());
-            return Result.error("删除失败!");
-        }
-        return Result.ok("删除成功!");
+    public Map<String, Object> delete(@RequestBody DramaItemInfo dramaItemInfo) {
+        return dramaItemInfoService.delete(dramaItemInfo.getId());
     }
 
     /**
@@ -134,7 +129,7 @@ public class DramaItemInfoController {
     @ApiOperation(value = "剧本内容信息-批量删除", notes = "剧本内容信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<DramaItemInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<DramaItemInfo> result = new Result<DramaItemInfo>();
+        Result<DramaItemInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -154,7 +149,7 @@ public class DramaItemInfoController {
     @ApiOperation(value = "剧本内容信息-通过id查询", notes = "剧本内容信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<DramaItemInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<DramaItemInfo> result = new Result<DramaItemInfo>();
+        Result<DramaItemInfo> result = new Result<>();
         DramaItemInfo dramaItemInfo = dramaItemInfoService.getById(id);
         if (dramaItemInfo == null) {
             result.error500("未找到对应实体");

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaRoleInfoController.java

@@ -48,9 +48,9 @@ public class DramaRoleInfoController {
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
-        Result<IPage<DramaRoleInfo>> result = new Result<IPage<DramaRoleInfo>>();
+        Result<IPage<DramaRoleInfo>> result = new Result<>();
         QueryWrapper<DramaRoleInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaRoleInfo, req.getParameterMap());
-        Page<DramaRoleInfo> page = new Page<DramaRoleInfo>(pageNo, pageSize);
+        Page<DramaRoleInfo> page = new Page<>(pageNo, pageSize);
         IPage<DramaRoleInfo> pageList = dramaRoleInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -67,7 +67,7 @@ public class DramaRoleInfoController {
     @ApiOperation(value = "剧本角色信息-添加", notes = "剧本角色信息-添加")
     @PostMapping(value = "/add")
     public Result<DramaRoleInfo> add(@RequestBody DramaRoleInfo dramaRoleInfo) {
-        Result<DramaRoleInfo> result = new Result<DramaRoleInfo>();
+        Result<DramaRoleInfo> result = new Result<>();
         try {
             dramaRoleInfoService.save(dramaRoleInfo);
             result.success("添加成功!");
@@ -88,7 +88,7 @@ public class DramaRoleInfoController {
     @ApiOperation(value = "剧本角色信息-编辑", notes = "剧本角色信息-编辑")
     @PutMapping(value = "/edit")
     public Result<DramaRoleInfo> edit(@RequestBody DramaRoleInfo dramaRoleInfo) {
-        Result<DramaRoleInfo> result = new Result<DramaRoleInfo>();
+        Result<DramaRoleInfo> result = new Result<>();
         DramaRoleInfo dramaRoleInfoEntity = dramaRoleInfoService.getById(dramaRoleInfo.getId());
         if (dramaRoleInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -111,7 +111,7 @@ public class DramaRoleInfoController {
     @AutoLog(value = "剧本角色信息-通过id删除")
     @ApiOperation(value = "剧本角色信息-通过id删除", notes = "剧本角色信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             dramaRoleInfoService.removeById(id);
         } catch (Exception e) {
@@ -131,7 +131,7 @@ public class DramaRoleInfoController {
     @ApiOperation(value = "剧本角色信息-批量删除", notes = "剧本角色信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<DramaRoleInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<DramaRoleInfo> result = new Result<DramaRoleInfo>();
+        Result<DramaRoleInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -151,7 +151,7 @@ public class DramaRoleInfoController {
     @ApiOperation(value = "剧本角色信息-通过id查询", notes = "剧本角色信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<DramaRoleInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<DramaRoleInfo> result = new Result<DramaRoleInfo>();
+        Result<DramaRoleInfo> result = new Result<>();
         DramaRoleInfo dramaRoleInfo = dramaRoleInfoService.getById(id);
         if (dramaRoleInfo == null) {
             result.error500("未找到对应实体");

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

@@ -5,13 +5,14 @@ import cn.com.ctop.manage.modules.edu.service.IEduLessonService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 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 org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Slf4j
 @Api(tags="在线培训")
@@ -81,7 +82,7 @@ public class EduLessonController {
     }
 
     @GetMapping(value = "/lesson/list")
-    public Result<List<EduLesson>> lessonList(String media,String title,String topic){
+    public Result<List<EduLesson>> lessonList(String media, String title, String topic){
         Result<List<EduLesson>> result = new Result<>();
         QueryWrapper<EduLesson> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("media",media);
@@ -92,4 +93,25 @@ public class EduLessonController {
         result.setSuccess(true);
         return result;
     }
+
+    @PostMapping(value = "/lesson/upload")
+    public Result<Map<String, String>> updaloadLesson(@RequestBody EduLesson eduLesson) {
+        Result<Map<String, String>> result = new Result();
+        Map<String, String> resultMap = new HashMap<>();
+
+        if (StringUtils.isBlank(eduLesson.getMedia()) || StringUtils.isBlank(eduLesson.getTitle()) ||
+                StringUtils.isBlank(eduLesson.getTopic()) || StringUtils.isBlank(eduLesson.getName()) ||
+                StringUtils.isBlank(eduLesson.getOssFileUrl()) || StringUtils.isBlank(eduLesson.getFileType())
+        ) {
+            result.error500("参数不可为空");
+            return result;
+        }
+        String lessonId = eduLessonService.uploadLesson(eduLesson);
+
+        resultMap.put("lessonId", lessonId);
+        result.setResult(resultMap);
+        result.setSuccess(true);
+
+        return result;
+    }
 }

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

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

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

@@ -3,7 +3,6 @@ package org.jeecg.modules.ctop.controller;
 import cn.com.ctop.common.module.entity.FileInfo;
 import cn.com.ctop.common.module.service.IFileInfoService;
 import cn.com.ctop.common.module.utils.StringUtils;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -13,23 +12,16 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -64,9 +56,9 @@ public class FileInfoController {
                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                  HttpServletRequest req) {
-        Result<IPage<FileInfo>> result = new Result<IPage<FileInfo>>();
+        Result<IPage<FileInfo>> result = new Result<>();
         QueryWrapper<FileInfo> queryWrapper = QueryGenerator.initQueryWrapper(fileInfo, req.getParameterMap());
-        Page<FileInfo> page = new Page<FileInfo>(pageNo, pageSize);
+        Page<FileInfo> page = new Page<>(pageNo, pageSize);
         IPage<FileInfo> pageList = fileInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +75,7 @@ public class FileInfoController {
     @ApiOperation(value = "文件信息-添加", notes = "文件信息-添加")
     @PostMapping(value = "/add")
     public Result<FileInfo> add(@RequestBody FileInfo fileInfo) {
-        Result<FileInfo> result = new Result<FileInfo>();
+        Result<FileInfo> result = new Result<>();
         try {
             fileInfoService.save(fileInfo);
             result.success("添加成功!");
@@ -104,13 +96,12 @@ public class FileInfoController {
     @ApiOperation(value = "文件信息-编辑", notes = "文件信息-编辑")
     @PutMapping(value = "/edit")
     public Result<FileInfo> edit(@RequestBody FileInfo fileInfo) {
-        Result<FileInfo> result = new Result<FileInfo>();
+        Result<FileInfo> result = new Result<>();
         FileInfo fileInfoEntity = fileInfoService.getById(fileInfo.getId());
         if (fileInfoEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = fileInfoService.updateById(fileInfo);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -128,7 +119,7 @@ public class FileInfoController {
     @AutoLog(value = "文件信息-通过id删除")
     @ApiOperation(value = "文件信息-通过id删除", notes = "文件信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             fileInfoService.removeById(id);
         } catch (Exception e) {
@@ -148,7 +139,7 @@ public class FileInfoController {
     @ApiOperation(value = "文件信息-批量删除", notes = "文件信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<FileInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<FileInfo> result = new Result<FileInfo>();
+        Result<FileInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -168,7 +159,7 @@ public class FileInfoController {
     @ApiOperation(value = "文件信息-通过id查询", notes = "文件信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<FileInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<FileInfo> result = new Result<FileInfo>();
+        Result<FileInfo> result = new Result<>();
         FileInfo fileInfo = fileInfoService.getById(id);
         if (fileInfo == null) {
             result.error500("未找到对应实体");
@@ -180,46 +171,14 @@ public class FileInfoController {
     }
 
     /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<FileInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                FileInfo fileInfo = JSON.parseObject(deString, FileInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(fileInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<FileInfo> pageList = fileInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "文件信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, FileInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("文件信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
      * 通过excel导入数据
      *
      * @param request
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+    @PostMapping("/importExcel")
+    public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
@@ -240,6 +199,7 @@ public class FileInfoController {
                     file.getInputStream().close();
                 } catch (IOException e) {
                     e.printStackTrace();
+                    log.error("服务异常");
                 }
             }
         }

+ 7 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/GraphqlController.java

@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
@@ -20,7 +19,7 @@ import java.util.Map;
 /**
  * @author jeecg-boot
  */
-@Controller
+@RestController
 @RequestMapping("/graphql")
 public class GraphqlController {
     @Autowired
@@ -37,12 +36,11 @@ public class GraphqlController {
         }
     }
 
-    @ResponseBody
-    @RequestMapping(value="/addkuaishouuser", method = RequestMethod.POST)
+    @PostMapping("/addkuaishouuser")
     public Result<Map<String,Object>> addKuaishouUser(@RequestBody JSONObject jsonObject){
         String url = jsonObject.getString("url");
         String uid = kuaishouWebInterfaceService.checkKuaishouUser(url);
-        Map<String,Object> resultMap = new HashMap<String, Object>();
+        Map<String, Object> resultMap = new HashMap<>();
         if(uid == null){
             resultMap.put("hasUser",false);
         }else {
@@ -59,19 +57,15 @@ public class GraphqlController {
             };
             thread.start();
         }
-        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        Result<Map<String, Object>> result = new Result<>();
         result.setSuccess(true);
         result.setResult(resultMap);
         return result;
     }
 
-    @ResponseBody
-    @RequestMapping(value="/publicfeeds", method = RequestMethod.GET)
-    public Result<IPage<KuaishouVideo>> getVideoList(@RequestParam("num") Integer num){
-        if(num==null){
-            num=99999999;
-        }
-        Result<IPage<KuaishouVideo>> result = new Result<IPage<KuaishouVideo>>();
+    @GetMapping("/publicfeeds")
+    public Result<IPage<KuaishouVideo>> getVideoList(@RequestParam(name = "num", defaultValue = "99999999") Integer num) {
+        Result<IPage<KuaishouVideo>> result = new Result<>();
         KuaishouVideo video = new KuaishouVideo();
         QueryWrapper<KuaishouVideo> queryWrapper = QueryGenerator.initQueryWrapper(video,null);
         queryWrapper.orderByDesc("num");

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

@@ -34,10 +34,9 @@ public class HotInformationCtroller {
     private IHotMaterialService hotMaterialService;
 
     @ResponseBody
-    @RequestMapping(value = "/douyin/feeds", method = RequestMethod.GET)
+    @GetMapping("/douyin/feeds")
     public Result<IPage<DouyinHot>> getVideoList(HttpServletRequest req) {
         Result<IPage<DouyinHot>> result = new Result<>();
-        DouyinHot hot = new DouyinHot();
         Map<String, String[]> paramMap = req.getParameterMap();
         String userName = paramMap.get("userName") != null ? paramMap.get("userName")[0] : null;
         String start = paramMap.get("start") != null ? paramMap.get("start")[0] : null;
@@ -53,7 +52,7 @@ public class HotInformationCtroller {
     }
 
     @ResponseBody
-    @RequestMapping(value = "/effectcase/feeds", method = RequestMethod.GET)
+    @GetMapping("/effectcase/feeds")
     public Result<IPage<EffectCase>> getEffectcaseList(HttpServletRequest req) {
         Result<IPage<EffectCase>> result = new Result<>();
         Map<String, String[]> paramMap = req.getParameterMap();
@@ -71,7 +70,7 @@ public class HotInformationCtroller {
     }
 
     @ResponseBody
-    @RequestMapping(value = "/material/feeds", method = RequestMethod.GET)
+    @GetMapping("/material/feeds")
     public Result<IPage<HotMaterial>> getMaterialList(HttpServletRequest req) {
         Result<IPage<HotMaterial>> result = new Result<>();
         Map<String, String[]> paramMap = req.getParameterMap();
@@ -89,7 +88,7 @@ public class HotInformationCtroller {
     }
 
     @ResponseBody
-    @RequestMapping(value = "/video/url", method = RequestMethod.GET)
+    @GetMapping("/video/url")
     public Map<String, Object> getVideoUrl(@RequestParam(name = "id") String id, @RequestParam(name = "type") Integer type) {
         try {
             return effectCaseService.getVideoUrl(id, type);

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

@@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
@@ -23,8 +24,6 @@ import java.util.zip.ZipOutputStream;
 @RestController
 @RequestMapping("/download")
 public class ImageDownloadController {
-
-
     @RequestMapping(value = "/zip")
     @ResponseBody
     public void downloadFiles(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject json) {
@@ -42,9 +41,9 @@ public class ImageDownloadController {
         String agent = request.getHeader("USER-AGENT");
         try {
             if (agent.contains("MSIE") || agent.contains("Trident")) {
-                downloadName = java.net.URLEncoder.encode(downloadName, "UTF-8");
+                downloadName = java.net.URLEncoder.encode(downloadName, StandardCharsets.UTF_8.toString());
             } else {
-                downloadName = new String(downloadName.getBytes("UTF-8"), "ISO-8859-1");
+                downloadName = new String(downloadName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -102,6 +101,7 @@ public class ImageDownloadController {
 
     }
 
+
     //url转file
     private File getFileByUrl(String fileUrl, String suffix) {
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
@@ -123,14 +123,18 @@ public class ImageDownloadController {
             stream = new BufferedOutputStream(fileOutputStream);
             stream.write(outStream.toByteArray());
         } catch (Exception e) {
+            e.printStackTrace();
         } finally {
             try {
-                if (inputStream != null)
+                if (inputStream != null){
                     inputStream.close();
-                if (stream != null)
+                }
+                if (stream != null){
                     stream.close();
+                }
                 outStream.close();
             } catch (Exception e) {
+                e.printStackTrace();
             }
         }
         return file;

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

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

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouDefectMaterialController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.KuaiShouDefectMaterial;
 import org.jeecg.modules.ctop.service.IKuaiShouDefectMaterialService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 快手缺失素材
@@ -64,9 +48,9 @@ public class KuaiShouDefectMaterialController {
                                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                HttpServletRequest req) {
-        Result<IPage<KuaiShouDefectMaterial>> result = new Result<IPage<KuaiShouDefectMaterial>>();
+        Result<IPage<KuaiShouDefectMaterial>> result = new Result<>();
         QueryWrapper<KuaiShouDefectMaterial> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDefectMaterial, req.getParameterMap());
-        Page<KuaiShouDefectMaterial> page = new Page<KuaiShouDefectMaterial>(pageNo, pageSize);
+        Page<KuaiShouDefectMaterial> page = new Page<>(pageNo, pageSize);
         IPage<KuaiShouDefectMaterial> pageList = kuaiShouDefectMaterialService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class KuaiShouDefectMaterialController {
     @ApiOperation(value = "快手缺失素材-添加", notes = "快手缺失素材-添加")
     @PostMapping(value = "/add")
     public Result<KuaiShouDefectMaterial> add(@RequestBody KuaiShouDefectMaterial kuaiShouDefectMaterial) {
-        Result<KuaiShouDefectMaterial> result = new Result<KuaiShouDefectMaterial>();
+        Result<KuaiShouDefectMaterial> result = new Result<>();
         try {
             kuaiShouDefectMaterialService.save(kuaiShouDefectMaterial);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class KuaiShouDefectMaterialController {
     @ApiOperation(value = "快手缺失素材-编辑", notes = "快手缺失素材-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaiShouDefectMaterial> edit(@RequestBody KuaiShouDefectMaterial kuaiShouDefectMaterial) {
-        Result<KuaiShouDefectMaterial> result = new Result<KuaiShouDefectMaterial>();
+        Result<KuaiShouDefectMaterial> result = new Result<>();
         KuaiShouDefectMaterial kuaiShouDefectMaterialEntity = kuaiShouDefectMaterialService.getById(kuaiShouDefectMaterial.getId());
         if (kuaiShouDefectMaterialEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class KuaiShouDefectMaterialController {
     @AutoLog(value = "快手缺失素材-通过id删除")
     @ApiOperation(value = "快手缺失素材-通过id删除", notes = "快手缺失素材-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaiShouDefectMaterialService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class KuaiShouDefectMaterialController {
     @ApiOperation(value = "快手缺失素材-批量删除", notes = "快手缺失素材-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouDefectMaterial> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaiShouDefectMaterial> result = new Result<KuaiShouDefectMaterial>();
+        Result<KuaiShouDefectMaterial> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class KuaiShouDefectMaterialController {
     @ApiOperation(value = "快手缺失素材-通过id查询", notes = "快手缺失素材-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaiShouDefectMaterial> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaiShouDefectMaterial> result = new Result<KuaiShouDefectMaterial>();
+        Result<KuaiShouDefectMaterial> result = new Result<>();
         KuaiShouDefectMaterial kuaiShouDefectMaterial = kuaiShouDefectMaterialService.getById(id);
         if (kuaiShouDefectMaterial == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class KuaiShouDefectMaterialController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaiShouDefectMaterial> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaiShouDefectMaterial kuaiShouDefectMaterial = JSON.parseObject(deString, KuaiShouDefectMaterial.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDefectMaterial, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaiShouDefectMaterial> pageList = kuaiShouDefectMaterialService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "快手缺失素材列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDefectMaterial.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手缺失素材列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<KuaiShouDefectMaterial> listKuaiShouDefectMaterials = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDefectMaterial.class, params);
-                kuaiShouDefectMaterialService.saveBatch(listKuaiShouDefectMaterials);
-                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDefectMaterials.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

@@ -61,7 +61,7 @@ public class KuaishouAdvertiserController {
                                                           @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                                           @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                                           HttpServletRequest req) {
-        Result<IPage<KuaishouAdAccount>> result = new Result<IPage<KuaishouAdAccount>>();
+        Result<IPage<KuaishouAdAccount>> result = new Result<>();
         Map<String, String[]> paramMap = new HashMap<>(req.getParameterMap());
         paramMap.remove("dataProcess");
         paramMap.remove("industry");
@@ -74,7 +74,7 @@ public class KuaishouAdvertiserController {
         QueryWrapper<KuaishouAdAccount> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAdAccount, paramMap);
         String dataProcess = req.getParameter("dataProcess");
         if (name != null) {
-            queryWrapper.like("name", "%" + name + "%");
+            queryWrapper.like("name", name);
         }
         if (sysCategory != null) {
             queryWrapper.eq("industry_category", sysCategory.getName()).or()
@@ -102,7 +102,7 @@ public class KuaishouAdvertiserController {
             }
         }
 
-        Page<KuaishouAdAccount> page = new Page<KuaishouAdAccount>(pageNo, pageSize);
+        Page<KuaishouAdAccount> page = new Page<>(pageNo, pageSize);
         IPage<KuaishouAdAccount> pageList = kuaishouAdAccountService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -118,7 +118,7 @@ public class KuaishouAdvertiserController {
     @ApiOperation(value="快手广告主信息表-添加", notes="快手广告主信息表-添加")
     @PostMapping(value = "/add")
     public Result<KuaishouAdAccount> add(@RequestBody KuaishouAdAccount kuaishouAdAccount) {
-        Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
+        Result<KuaishouAdAccount> result = new Result<>();
         try {
             String industry = kuaishouAdAccount.getIndustry();
             SysCategory secondCategory = sysCategoryService.getById(industry);
@@ -145,7 +145,7 @@ public class KuaishouAdvertiserController {
     @ApiOperation(value="快手广告主信息表-编辑", notes="快手广告主信息表-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaishouAdAccount> edit(@RequestBody KuaishouAdAccount kuaishouAdAccount) {
-        Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
+        Result<KuaishouAdAccount> result = new Result<>();
         KuaishouAdAccount kuaishouAdAccountEntity = kuaishouAdAccountService.getById(kuaishouAdAccount.getKsid());
 
         if(kuaishouAdAccountEntity==null) {
@@ -158,11 +158,9 @@ public class KuaishouAdvertiserController {
             kuaishouAdAccount.setFirstIndustry(firstCategory.getName());
             SysCategory industryCategory = sysCategoryService.getById(firstCategory.getPid());
             kuaishouAdAccount.setIndustryCategory(industryCategory.getName());
-            QueryWrapper<KuaishouAdAccount> queryWrapper = new QueryWrapper<KuaishouAdAccount>();
+            QueryWrapper<KuaishouAdAccount> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("ksid", kuaishouAdAccount.getKsid());
             boolean ok = kuaishouAdAccountService.update(kuaishouAdAccount, queryWrapper);
-//            boolean ok = kuaishouAdAccountService.updateById(kuaishouAdAccount);
-            //TODO 返回false说明什么?
             if(ok) {
                 result.success("修改成功!");
             }
@@ -179,7 +177,7 @@ public class KuaishouAdvertiserController {
     @AutoLog(value = "快手广告主信息表-通过id删除")
     @ApiOperation(value="快手广告主信息表-通过id删除", notes="快手广告主信息表-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaishouAdAccountService.removeById(id);
         } catch (Exception e) {
@@ -217,7 +215,7 @@ public class KuaishouAdvertiserController {
     @ApiOperation(value="快手广告主信息表-通过id查询", notes="快手广告主信息表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaishouAdAccount> queryById(@RequestParam(name="id",required=true) String id) {
-        Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
+        Result<KuaishouAdAccount> result = new Result<>();
         KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(id);
         if(kuaishouAdAccount==null) {
             result.error500("未找到对应实体");
@@ -267,8 +265,8 @@ public class KuaishouAdvertiserController {
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+    @PostMapping("/importExcel")
+    public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
@@ -295,19 +293,18 @@ public class KuaishouAdvertiserController {
         return Result.ok("文件导入失败!");
     }
     @ResponseBody
-    @RequestMapping(value="/companysugest", method = RequestMethod.GET)
+    @GetMapping("/companysugest")
     public Result<List<String>> getCompanySugest(@RequestParam("company") String company){
-        Result<List<String>> result = new Result<List<String>>();
+        Result<List<String>> result = new Result<>();
         List<String> list = kuaishouAdAccountService.companySugest(company);
         result.setResult(list);
         result.setSuccess(true);
         return result;
     }
 
-    @ResponseBody
-    @RequestMapping(value="/productsugest", method = RequestMethod.GET)
+    @GetMapping(value = "/productsugest")
     public Result<List<String>> getProductSugest(@RequestParam("product") String product){
-        Result<List<String>> result = new Result<List<String>>();
+        Result<List<String>> result = new Result<>();
         List<String> list = kuaishouAdAccountService.productSugest(product);
         result.setResult(list);
         result.setSuccess(true);

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

@@ -63,9 +63,9 @@ public class KuaishouAppAccountController {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<KuaishouAppAccount>> result = new Result<IPage<KuaishouAppAccount>>();
+        Result<IPage<KuaishouAppAccount>> result = new Result<>();
 		QueryWrapper<KuaishouAppAccount> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAppAccount, req.getParameterMap());
-		Page<KuaishouAppAccount> page = new Page<KuaishouAppAccount>(pageNo, pageSize);
+        Page<KuaishouAppAccount> page = new Page<>(pageNo, pageSize);
 		IPage<KuaishouAppAccount> pageList = kuaishouAppAccountService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -81,7 +81,7 @@ public class KuaishouAppAccountController {
 	@ApiOperation(value="快手APP账号表-添加", notes="快手APP账号表-添加")
 	@PostMapping(value = "/add")
 	public Result<KuaishouAppAccount> add(@RequestBody KuaishouAppAccount kuaishouAppAccount) {
-		Result<KuaishouAppAccount> result = new Result<KuaishouAppAccount>();
+        Result<KuaishouAppAccount> result = new Result<>();
 		try {
 			kuaishouAppAccountService.save(kuaishouAppAccount);
 			result.success("添加成功!");
@@ -101,13 +101,12 @@ public class KuaishouAppAccountController {
 	@ApiOperation(value="快手APP账号表-编辑", notes="快手APP账号表-编辑")
 	@PutMapping(value = "/edit")
 	public Result<KuaishouAppAccount> edit(@RequestBody KuaishouAppAccount kuaishouAppAccount) {
-		Result<KuaishouAppAccount> result = new Result<KuaishouAppAccount>();
+        Result<KuaishouAppAccount> result = new Result<>();
 		KuaishouAppAccount kuaishouAppAccountEntity = kuaishouAppAccountService.getById(kuaishouAppAccount.getId());
 		if(kuaishouAppAccountEntity==null) {
 			result.error500("未找到对应实体");
 		}else {
 			boolean ok = kuaishouAppAccountService.updateById(kuaishouAppAccount);
-			//TODO 返回false说明什么?
 			if(ok) {
 				result.success("修改成功!");
 			}
@@ -125,7 +124,7 @@ public class KuaishouAppAccountController {
 	@ApiOperation(value="快手APP账号表-通过id删除", notes="快手APP账号表-通过id删除")
 	@DeleteMapping(value = "/delete")
 	public Result<KuaishouAppAccount> delete(@RequestParam(name="id",required=true) String id) {
-		Result<KuaishouAppAccount> result = new Result<KuaishouAppAccount>();
+        Result<KuaishouAppAccount> result = new Result<>();
 		KuaishouAppAccount kuaishouAppAccount = kuaishouAppAccountService.getById(id);
 		if(kuaishouAppAccount==null) {
 			result.error500("未找到对应实体");
@@ -167,7 +166,7 @@ public class KuaishouAppAccountController {
 	@ApiOperation(value="快手APP账号表-通过id查询", notes="快手APP账号表-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<KuaishouAppAccount> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<KuaishouAppAccount> result = new Result<KuaishouAppAccount>();
+        Result<KuaishouAppAccount> result = new Result<>();
 		KuaishouAppAccount kuaishouAppAccount = kuaishouAppAccountService.getById(id);
 		if(kuaishouAppAccount==null) {
 			result.error500("未找到对应实体");
@@ -217,8 +216,8 @@ public class KuaishouAppAccountController {
    * @param response
    * @return
    */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+  @PostMapping("/importExcel")
+  public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
       MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
       Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
       for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

+ 35 - 37
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAppProductController.java

@@ -1,39 +1,37 @@
 package org.jeecg.modules.ctop.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
 import cn.com.ctop.kuaishou.modules.app.entity.KuaishouAppProduct;
 import cn.com.ctop.kuaishou.modules.app.service.IKuaishouAppProductService;
-import java.util.Date;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
  /**
  * 快手推广产品
@@ -48,7 +46,7 @@ import io.swagger.annotations.ApiOperation;
 public class KuaishouAppProductController {
 	@Autowired
 	private IKuaishouAppProductService kuaishouAppProductService;
-	
+
 	/**
 	  * 分页列表查询
 	 * @param kuaishouAppProduct
@@ -64,15 +62,15 @@ public class KuaishouAppProductController {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<KuaishouAppProduct>> result = new Result<IPage<KuaishouAppProduct>>();
+		Result<IPage<KuaishouAppProduct>> result = new Result<>();
 		QueryWrapper<KuaishouAppProduct> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAppProduct, req.getParameterMap());
-		Page<KuaishouAppProduct> page = new Page<KuaishouAppProduct>(pageNo, pageSize);
+		Page<KuaishouAppProduct> page = new Page<>(pageNo, pageSize);
 		IPage<KuaishouAppProduct> pageList = kuaishouAppProductService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
+
 	/**
 	  *   添加
 	 * @param kuaishouAppProduct
@@ -82,7 +80,7 @@ public class KuaishouAppProductController {
 	@ApiOperation(value="快手推广产品-添加", notes="快手推广产品-添加")
 	@PostMapping(value = "/add")
 	public Result<KuaishouAppProduct> add(@RequestBody KuaishouAppProduct kuaishouAppProduct) {
-		Result<KuaishouAppProduct> result = new Result<KuaishouAppProduct>();
+		Result<KuaishouAppProduct> result = new Result<>();
 		try {
 			kuaishouAppProductService.save(kuaishouAppProduct);
 			result.success("添加成功!");
@@ -92,7 +90,7 @@ public class KuaishouAppProductController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  *  编辑
 	 * @param kuaishouAppProduct
@@ -102,7 +100,7 @@ public class KuaishouAppProductController {
 	@ApiOperation(value="快手推广产品-编辑", notes="快手推广产品-编辑")
 	@PutMapping(value = "/edit")
 	public Result<KuaishouAppProduct> edit(@RequestBody KuaishouAppProduct kuaishouAppProduct) {
-		Result<KuaishouAppProduct> result = new Result<KuaishouAppProduct>();
+		Result<KuaishouAppProduct> result = new Result<>();
 		KuaishouAppProduct kuaishouAppProductEntity = kuaishouAppProductService.getById(kuaishouAppProduct.getId());
 		if(kuaishouAppProductEntity==null) {
 			result.error500("未找到对应实体");
@@ -112,11 +110,11 @@ public class KuaishouAppProductController {
 				result.success("修改成功!");
 			}
 		}
-		
+
 		return result;
 	}
-	
-	/**
+
+	 /**
 	  *   通过id删除
 	 * @param id
 	 * @return
@@ -124,7 +122,7 @@ public class KuaishouAppProductController {
 	@AutoLog(value = "快手推广产品-通过id删除")
 	@ApiOperation(value="快手推广产品-通过id删除", notes="快手推广产品-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			kuaishouAppProductService.removeById(id);
 		} catch (Exception e) {
@@ -133,8 +131,8 @@ public class KuaishouAppProductController {
 		}
 		return Result.ok("删除成功!");
 	}
-	
-	/**
+
+	 /**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -143,7 +141,7 @@ public class KuaishouAppProductController {
 	@ApiOperation(value="快手推广产品-批量删除", notes="快手推广产品-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<KuaishouAppProduct> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<KuaishouAppProduct> result = new Result<KuaishouAppProduct>();
+		Result<KuaishouAppProduct> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -152,8 +150,8 @@ public class KuaishouAppProductController {
 		}
 		return result;
 	}
-	
-	/**
+
+	 /**
 	  * 通过id查询
 	 * @param id
 	 * @return
@@ -162,7 +160,7 @@ public class KuaishouAppProductController {
 	@ApiOperation(value="快手推广产品-通过id查询", notes="快手推广产品-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<KuaishouAppProduct> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<KuaishouAppProduct> result = new Result<KuaishouAppProduct>();
+		Result<KuaishouAppProduct> result = new Result<>();
 		KuaishouAppProduct kuaishouAppProduct = kuaishouAppProductService.getById(id);
 		if(kuaishouAppProduct==null) {
 			result.error500("未找到对应实体");
@@ -212,8 +210,8 @@ public class KuaishouAppProductController {
    * @param response
    * @return
    */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+  @PostMapping("/importExcel")
+  public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
       MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
       Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
       for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

+ 7 - 94
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouChannelRegInfoController.java

@@ -1,7 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.excel.event.AnalysisEventListener;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -11,30 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.KuaishouChannelRegInfo;
 import org.jeecg.modules.ctop.service.IKuaishouChannelRegInfoService;
-import org.jeecg.modules.excelutil.ExcelUtils;
-import org.jeecg.modules.excelutil.KuaishouChannelRegInfoExcelListener;
-import org.jeecg.modules.excelutil.entity.KuaishouChannelRegInfoEntity;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 快手渠道注册信息表
@@ -67,9 +48,9 @@ public class KuaishouChannelRegInfoController {
                                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                HttpServletRequest req) {
-        Result<IPage<KuaishouChannelRegInfo>> result = new Result<IPage<KuaishouChannelRegInfo>>();
+        Result<IPage<KuaishouChannelRegInfo>> result = new Result<>();
         QueryWrapper<KuaishouChannelRegInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouChannelRegInfo, req.getParameterMap());
-        Page<KuaishouChannelRegInfo> page = new Page<KuaishouChannelRegInfo>(pageNo, pageSize);
+        Page<KuaishouChannelRegInfo> page = new Page<>(pageNo, pageSize);
         IPage<KuaishouChannelRegInfo> pageList = kuaishouChannelRegInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -86,7 +67,7 @@ public class KuaishouChannelRegInfoController {
     @ApiOperation(value = "快手渠道注册信息表-添加", notes = "快手渠道注册信息表-添加")
     @PostMapping(value = "/add")
     public Result<KuaishouChannelRegInfo> add(@RequestBody KuaishouChannelRegInfo kuaishouChannelRegInfo) {
-        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        Result<KuaishouChannelRegInfo> result = new Result<>();
         try {
             kuaishouChannelRegInfoService.save(kuaishouChannelRegInfo);
             result.success("添加成功!");
@@ -107,7 +88,7 @@ public class KuaishouChannelRegInfoController {
     @ApiOperation(value = "快手渠道注册信息表-编辑", notes = "快手渠道注册信息表-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaishouChannelRegInfo> edit(@RequestBody KuaishouChannelRegInfo kuaishouChannelRegInfo) {
-        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        Result<KuaishouChannelRegInfo> result = new Result<>();
         KuaishouChannelRegInfo kuaishouChannelRegInfoEntity = kuaishouChannelRegInfoService.getById(kuaishouChannelRegInfo.getId());
         if (kuaishouChannelRegInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -130,7 +111,7 @@ public class KuaishouChannelRegInfoController {
     @AutoLog(value = "快手渠道注册信息表-通过id删除")
     @ApiOperation(value = "快手渠道注册信息表-通过id删除", notes = "快手渠道注册信息表-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaishouChannelRegInfoService.removeById(id);
         } catch (Exception e) {
@@ -150,7 +131,7 @@ public class KuaishouChannelRegInfoController {
     @ApiOperation(value = "快手渠道注册信息表-批量删除", notes = "快手渠道注册信息表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaishouChannelRegInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        Result<KuaishouChannelRegInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -170,7 +151,7 @@ public class KuaishouChannelRegInfoController {
     @ApiOperation(value = "快手渠道注册信息表-通过id查询", notes = "快手渠道注册信息表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaishouChannelRegInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        Result<KuaishouChannelRegInfo> result = new Result<>();
         KuaishouChannelRegInfo kuaishouChannelRegInfo = kuaishouChannelRegInfoService.getById(id);
         if (kuaishouChannelRegInfo == null) {
             result.error500("未找到对应实体");
@@ -180,72 +161,4 @@ public class KuaishouChannelRegInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaishouChannelRegInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaishouChannelRegInfo kuaishouChannelRegInfo = JSON.parseObject(deString, KuaishouChannelRegInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouChannelRegInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaishouChannelRegInfo> pageList = kuaishouChannelRegInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "快手渠道注册信息表列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaishouChannelRegInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手渠道注册信息表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        //1.读Excel
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            FileInputStream fis = null;
-            try {
-                MultipartFile file = entity.getValue();
-                fis = (FileInputStream) file.getInputStream();
-                AnalysisEventListener listener = new KuaishouChannelRegInfoExcelListener();
-                Boolean flag = ExcelUtils.readExcel(fis, KuaishouChannelRegInfoEntity.class, listener);
-                System.out.println("导入是否成功:" + flag);
-            } catch (Exception e) {
-                e.printStackTrace();
-            } finally {
-                if (fis != null) {
-                    try {
-                        fis.close();
-                    } catch (IOException e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-        }
-        return Result.ok("文件导入成功!");
-    }
-
 }

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

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialAscription;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 素材归属标
@@ -41,7 +25,7 @@ import java.util.Map;
  * @date 2019-11-23
  */
 @Slf4j
-@Api(tags = "素材归属")
+@Api(tags = "素材归属")
 @RestController
 @RequestMapping("/ctop/materialAscription")
 public class MaterialAscriptionController {
@@ -64,9 +48,9 @@ public class MaterialAscriptionController {
                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
-        Result<IPage<MaterialAscription>> result = new Result<IPage<MaterialAscription>>();
+        Result<IPage<MaterialAscription>> result = new Result<>();
         QueryWrapper<MaterialAscription> queryWrapper = QueryGenerator.initQueryWrapper(materialAscription, req.getParameterMap());
-        Page<MaterialAscription> page = new Page<MaterialAscription>(pageNo, pageSize);
+        Page<MaterialAscription> page = new Page<>(pageNo, pageSize);
         IPage<MaterialAscription> pageList = materialAscriptionService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class MaterialAscriptionController {
     @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
     @PostMapping(value = "/add")
     public Result<MaterialAscription> add(@RequestBody MaterialAscription materialAscription) {
-        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        Result<MaterialAscription> result = new Result<>();
         try {
             materialAscriptionService.save(materialAscription);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class MaterialAscriptionController {
     @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
     @PutMapping(value = "/edit")
     public Result<MaterialAscription> edit(@RequestBody MaterialAscription materialAscription) {
-        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        Result<MaterialAscription> result = new Result<>();
         MaterialAscription materialAscriptionEntity = materialAscriptionService.getById(materialAscription.getId());
         if (materialAscriptionEntity == null) {
             result.error500("未找到对应实体");
@@ -140,7 +124,7 @@ public class MaterialAscriptionController {
     @AutoLog(value = "素材归属标-通过id删除")
     @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             materialAscriptionService.removeById(id);
         } catch (Exception e) {
@@ -160,7 +144,7 @@ public class MaterialAscriptionController {
     @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<MaterialAscription> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        Result<MaterialAscription> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -180,7 +164,7 @@ public class MaterialAscriptionController {
     @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialAscription> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        Result<MaterialAscription> result = new Result<>();
         MaterialAscription materialAscription = materialAscriptionService.getById(id);
         if (materialAscription == null) {
             result.error500("未找到对应实体");
@@ -190,72 +174,4 @@ public class MaterialAscriptionController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialAscription> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialAscription materialAscription = JSON.parseObject(deString, MaterialAscription.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialAscription, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialAscription> pageList = materialAscriptionService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialAscription.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialAscription> listMaterialAscriptions = ExcelImportUtil.importExcel(file.getInputStream(), MaterialAscription.class, params);
-                materialAscriptionService.saveBatch(listMaterialAscriptions);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialAscriptions.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialCutFrame;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,12 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 
 /**
@@ -44,7 +29,7 @@ import java.util.Map;
 @Slf4j
 @Api(tags = "截屏")
 @RestController
-@RequestMapping("/123/materialCutFrame")
+@RequestMapping("/cutFrame/material")
 public class MaterialCutFrameController {
     @Autowired
     private IMaterialCutFrameService materialCutFrameService;
@@ -65,15 +50,20 @@ public class MaterialCutFrameController {
                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                          HttpServletRequest req) {
-        Result<IPage<MaterialCutFrame>> result = new Result<IPage<MaterialCutFrame>>();
+        Result<IPage<MaterialCutFrame>> result = new Result<>();
         QueryWrapper<MaterialCutFrame> queryWrapper = QueryGenerator.initQueryWrapper(materialCutFrame, req.getParameterMap());
-        Page<MaterialCutFrame> page = new Page<MaterialCutFrame>(pageNo, pageSize);
+        queryWrapper.orderByAsc("image_index");
+        Page<MaterialCutFrame> page = new Page<>(pageNo, pageSize);
+        //TODO 这边代码有bug,先临时紧急处理,后续优化截帧任务
         IPage<MaterialCutFrame> pageList = materialCutFrameService.page(page, queryWrapper);
+        List<MaterialCutFrame> list = materialCutFrameService.getListByVideoSignature(materialCutFrame.getVideoSignature());
+        pageList.setRecords(list);
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
     }
 
+
     /**
      * 添加
      *
@@ -178,72 +168,4 @@ public class MaterialCutFrameController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialCutFrame> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialCutFrame materialCutFrame = JSON.parseObject(deString, MaterialCutFrame.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialCutFrame, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialCutFrame> pageList = materialCutFrameService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "截屏列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialCutFrame.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("截屏列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialCutFrame> listMaterialCutFrames = ExcelImportUtil.importExcel(file.getInputStream(), MaterialCutFrame.class, params);
-                materialCutFrameService.saveBatch(listMaterialCutFrames);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialCutFrames.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

@@ -40,6 +40,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -110,19 +111,21 @@ public class MaterialImageInfoController {
 
     /**
      * 分页列表查询
-     *
-     * @param MaterialImageInfo
-     * @param req
-     * @return
+     * * @return
      */
     @AutoLog(value = "素材-分页列表查询")
     @ApiOperation(value = "素材-分页列表查询", notes = "素材-分页列表查询")
     @GetMapping(value = "/list")
-    public Result<List<MaterialImageInfo>> queryPageList(MaterialImageInfo MaterialImageInfo,
-                                                         HttpServletRequest req) {
+    public Result<List<MaterialImageInfo>> queryPageList(String videoId) {
         Result<List<MaterialImageInfo>> result = new Result<>();
-        QueryWrapper<MaterialImageInfo> queryWrapper = QueryGenerator.initQueryWrapper(MaterialImageInfo, req.getParameterMap());
-        List<MaterialImageInfo> list = MaterialImageInfoService.list(queryWrapper);
+
+        List<MaterialImageInfo> list = new ArrayList<>();
+        if (!Check.isNull(videoId)) {
+            QueryWrapper<MaterialImageInfo> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("video_id", videoId);
+            list = MaterialImageInfoService.list(queryWrapper);
+        }
+
         result.setSuccess(true);
         result.setResult(list);
         return result;
@@ -385,5 +388,4 @@ public class MaterialImageInfoController {
         }
         return Result.ok("文件导入失败!");
     }
-
 }

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

@@ -1,13 +1,16 @@
 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;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import com.alibaba.fastjson.JSON;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
+import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -22,28 +25,14 @@ 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.common.util.oConvertUtils;
-import org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport;
-import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
-import org.jeecg.modules.ctop.service.IByteDanceCleanMaterialReportService;
-import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
+import org.jeecg.modules.ctop.entity.Project;
+import org.jeecg.modules.ctop.service.IKuaiShouUploadService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.modules.ctop.service.IProjectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.text.ParseException;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -76,6 +65,8 @@ public class MaterialInfoController {
     private IKuaiShouCleanMaterialReportService kuaiShouCleanMaterialReportService;
     @Autowired
     private IVideoWatermarkTaskService watermarkTaskService;
+    @Autowired
+    private IKuaiShouUploadService uploadService;
 
 
     @PostMapping("/correlationUpload")
@@ -140,11 +131,10 @@ public class MaterialInfoController {
                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                      HttpServletRequest req) {
         Result<IPage<MaterialInfo>> result = new Result<>();
-        QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
         materialInfo.setExcellent(1);
-        queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
+        QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
         if (!Check.isNull(createTime)) {
             try {
                 String dateString = DateUtils.getDateString(String.valueOf(createTime));
@@ -180,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)) {
@@ -244,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);
@@ -318,19 +313,22 @@ public class MaterialInfoController {
         } catch (Exception e) {
             result.setSuccess(false);
         }
-
-
         return result;
-
     }
 
-
     /**
      * 编辑
      *
      * @param materialInfo
      * @return
      */
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private IMessageTemplate messageTemplate;
+    @Autowired
+    private ISendMessageService sendMessageService;
+
     @AutoLog(value = "素材信息-编辑")
     @ApiOperation(value = "素材信息-编辑", notes = "素材信息-编辑")
     @PutMapping(value = "/edit")
@@ -348,10 +346,62 @@ 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)) {
+                if ("2".equals(project.getMediaId())) {
+                    if (!Check.isNull(materialInfo.getStatus())) {
+                        Integer status = materialInfo.getStatus();
+                        if (status == 1) {
+                            Thread thread = new Thread() {
+                                @Override
+                                public void run() {
+                                    log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
+                                    uploadService.upload(materialInfoEntity);
+                                }
+                            };
+                            thread.start();
+                        }
+                    }
+                }
+
+            }*/
+
             boolean ok = materialInfoService.updateById(materialInfo);
             if (ok) {
                 result.success("修改成功!");
             }
+
+            Integer status = materialInfo.getStatus();
+            // 如果状态为2 审核拒绝 给上传人发送消息
+            if (status == 2) {
+                Project project = projectService.getById(materialInfoEntity.getProjectId());
+                String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+                sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+            }
         }
 
         return result;
@@ -368,18 +418,20 @@ public class MaterialInfoController {
     @AutoLog(value = "素材信息-通过id删除")
     @ApiOperation(value = "素材信息-通过id删除", notes = "素材信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    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("删除失败!");
@@ -417,7 +469,7 @@ public class MaterialInfoController {
     @ApiOperation(value = "素材信息-通过id查询", notes = "素材信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialInfo> result = new Result<MaterialInfo>();
+        Result<MaterialInfo> result = new Result<>();
         MaterialInfo materialInfo = materialInfoService.getById(id);
         if (materialInfo == null) {
             result.error500("未找到对应实体");
@@ -428,74 +480,6 @@ public class MaterialInfoController {
         return result;
     }
 
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialInfo materialInfo = JSON.parseObject(deString, MaterialInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialInfo> pageList = materialInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialInfo> listMaterialInfos = ExcelImportUtil.importExcel(file.getInputStream(), MaterialInfo.class, params);
-                materialInfoService.saveBatch(listMaterialInfos);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialInfos.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
     @AutoLog(value = "获取有效素材")
     @ApiOperation(value = "获取有效素材", notes = "获取有效素材")
     @GetMapping(value = "/effiMaterialInfo")
@@ -509,6 +493,10 @@ public class MaterialInfoController {
         List<String> effiList = materialInfoService.getEffiCode();
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
+        Long projectId = materialInfo.getProjectId();
+        if(projectId != null){
+            queryWrapper.eq("project_id", projectId);
+        }
         queryWrapper.in("code", effiList);
         queryWrapper.groupBy("code");
         //queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialParameterController.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialParameter;
 import cn.com.ctop.common.module.service.IMaterialParameterService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 素材归属标
@@ -64,9 +48,9 @@ public class MaterialParameterController {
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                           HttpServletRequest req) {
-        Result<IPage<MaterialParameter>> result = new Result<IPage<MaterialParameter>>();
+        Result<IPage<MaterialParameter>> result = new Result<>();
         QueryWrapper<MaterialParameter> queryWrapper = QueryGenerator.initQueryWrapper(materialParameter, req.getParameterMap());
-        Page<MaterialParameter> page = new Page<MaterialParameter>(pageNo, pageSize);
+        Page<MaterialParameter> page = new Page<>(pageNo, pageSize);
         IPage<MaterialParameter> pageList = materialParameterService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class MaterialParameterController {
     @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
     @PostMapping(value = "/add")
     public Result<MaterialParameter> add(@RequestBody MaterialParameter materialParameter) {
-        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        Result<MaterialParameter> result = new Result<>();
         try {
             materialParameterService.save(materialParameter);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class MaterialParameterController {
     @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
     @PutMapping(value = "/edit")
     public Result<MaterialParameter> edit(@RequestBody MaterialParameter materialParameter) {
-        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        Result<MaterialParameter> result = new Result<>();
         MaterialParameter materialParameterEntity = materialParameterService.getById(materialParameter.getId());
         if (materialParameterEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class MaterialParameterController {
     @AutoLog(value = "素材归属标-通过id删除")
     @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             materialParameterService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class MaterialParameterController {
     @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<MaterialParameter> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        Result<MaterialParameter> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class MaterialParameterController {
     @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialParameter> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        Result<MaterialParameter> result = new Result<>();
         MaterialParameter materialParameter = materialParameterService.getById(id);
         if (materialParameter == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class MaterialParameterController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialParameter> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialParameter materialParameter = JSON.parseObject(deString, MaterialParameter.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialParameter, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialParameter> pageList = materialParameterService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialParameter.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialParameter> listMaterialParameters = ExcelImportUtil.importExcel(file.getInputStream(), MaterialParameter.class, params);
-                materialParameterService.saveBatch(listMaterialParameters);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialParameters.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

@@ -44,11 +44,10 @@ public class MaterialPartController {
     @ApiOperation(value = "片段合成", notes = "片段合成")
     @PostMapping(value = "/merge")
     public Result<Object> merge(@RequestBody JSONArray jsonArray, HttpServletRequest req) {
-        Result<Object> result = new Result<Object>();
+        Result<Object> result = new Result<>();
         List<String> jobIdList = new ArrayList<>();
         List<VideoMerge> videoMergeList = jsonArray.toJavaList(VideoMerge.class);
         try {
-            MpsUtils mpsUtils = new MpsUtils();
             for (VideoMerge videoMerge:videoMergeList){
                 MaterialInfo start = materialInfoService.getMaterialInfoByCode(videoMerge.getStartPart());
                 MaterialInfo end = materialInfoService.getMaterialInfoByCode(videoMerge.getEndPart());
@@ -57,19 +56,18 @@ public class MaterialPartController {
                 for (String part :parts){
                     MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(part);
                     String url = materialInfo.getUrl();
-                    int i = url.indexOf("/",10);
+                    int i = url.indexOf('/', 10);
                     partUrlList.add(url.substring(i+1,url.length()));
                 }
                 String startUrl = start.getUrl();
-                String startPath = startUrl.substring(startUrl.indexOf("/",10)+1,startUrl.length());
+                String startPath = startUrl.substring(startUrl.indexOf('/', 10) + 1, startUrl.length());
                 String endUrl = end.getUrl();
-                String endPath = endUrl.substring(endUrl.indexOf("/",10)+1,endUrl.length());
-                String jobId = mpsUtils.mergeOneVideo(startPath,partUrlList,endPath);
-                QueryJobListResponse.Job job = mpsUtils.getJobStatus(jobId);
+                String endPath = endUrl.substring(endUrl.indexOf('/', 10) + 1, endUrl.length());
+                String jobId = MpsUtils.mergeOneVideo(startPath,partUrlList,endPath);
+                QueryJobListResponse.Job job = MpsUtils.getJobStatus(jobId);
                 VideoMergeTask videoMergeTask = new VideoMergeTask();
                 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
                 videoMergeTask.setUserId(sysUser.getId());
-//                videoMergeTask.setUserId("1");
                 videoMergeTask.setJobId(jobId);
                 videoMergeTask.setStatus(job.getState());
                 videoMergeTaskService.save(videoMergeTask);

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTagController.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialTag;
 import cn.com.ctop.common.module.service.IMaterialTagService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 素材归属标
@@ -64,9 +48,9 @@ public class MaterialTagController {
                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                     HttpServletRequest req) {
-        Result<IPage<MaterialTag>> result = new Result<IPage<MaterialTag>>();
+        Result<IPage<MaterialTag>> result = new Result<>();
         QueryWrapper<MaterialTag> queryWrapper = QueryGenerator.initQueryWrapper(materialTag, req.getParameterMap());
-        Page<MaterialTag> page = new Page<MaterialTag>(pageNo, pageSize);
+        Page<MaterialTag> page = new Page<>(pageNo, pageSize);
         IPage<MaterialTag> pageList = materialTagService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class MaterialTagController {
     @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
     @PostMapping(value = "/add")
     public Result<MaterialTag> add(@RequestBody MaterialTag materialTag) {
-        Result<MaterialTag> result = new Result<MaterialTag>();
+        Result<MaterialTag> result = new Result<>();
         try {
             materialTagService.save(materialTag);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class MaterialTagController {
     @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
     @PutMapping(value = "/edit")
     public Result<MaterialTag> edit(@RequestBody MaterialTag materialTag) {
-        Result<MaterialTag> result = new Result<MaterialTag>();
+        Result<MaterialTag> result = new Result<>();
         MaterialTag materialTagEntity = materialTagService.getById(materialTag.getId());
         if (materialTagEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class MaterialTagController {
     @AutoLog(value = "素材归属标-通过id删除")
     @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             materialTagService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class MaterialTagController {
     @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<MaterialTag> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MaterialTag> result = new Result<MaterialTag>();
+        Result<MaterialTag> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class MaterialTagController {
     @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialTag> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialTag> result = new Result<MaterialTag>();
+        Result<MaterialTag> result = new Result<>();
         MaterialTag materialTag = materialTagService.getById(id);
         if (materialTag == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class MaterialTagController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialTag> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialTag materialTag = JSON.parseObject(deString, MaterialTag.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialTag, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialTag> pageList = materialTagService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialTag.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialTag> listMaterialTags = ExcelImportUtil.importExcel(file.getInputStream(), MaterialTag.class, params);
-                materialTagService.saveBatch(listMaterialTags);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialTags.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 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;
+    }
+}

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

@@ -6,13 +6,14 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.Api;
 import lombok.extern.slf4j.Slf4j;
+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;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -45,18 +46,10 @@ public class MaterialUploadController {
             if (Check.isNull(materialArray) || Check.isNull(accountArray)) {
                 throw new Exception("请选择账号或素材");
             }
-            Thread thread = new Thread() {
-                @Override
-                public void run() {
-                    try {
-                        materialUploadService.uploadAccount(mediaId, materialArray, accountArray);
-                    } catch (IOException e) {
-                        e.printStackTrace();
-                    }
-                }
-            };
-            thread.start();
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 
+
+            new Thread(() -> materialUploadService.uploadAccount(mediaId, materialArray, accountArray, sysUser.getId())).start();
             returnMap.put("success", true);
             returnMap.put("message", "开始上传文件");
             returnMap.put("code", 0);

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

@@ -0,0 +1,126 @@
+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.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;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+@RequestMapping("pangolin")
+public class PangolinController {
+    @Autowired
+    private PangolinReportAppHourService pangolinReportAppHourService;
+    @Autowired
+    private PangolinReportChannelDailyService pangolinReportChannelDailyService;
+    @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 roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
+            userId = null;
+        }
+        return pangolinReportAppHourService.getRealTimeData(userId,data);
+    }
+
+    /**
+     * 激活统计
+     */
+    @PostMapping("api/activation/list")
+    public Map<String, Object> activationList(@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 pangolinReportChannelDailyService.getActivationList(userId, data);
+    }
+
+    /**
+     * 对账单
+     */
+    @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 roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
+            userId = null;
+        }
+        PageInfo<PangolinReportAppMonthVO> pageInfo = pangolinReportBillMonthService.checkAppList(userId, data);
+        result.put("data",pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+}

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

@@ -1,11 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
-
-import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
+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;
 import cn.com.ctop.common.module.utils.Check;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -17,7 +16,6 @@ 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.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.Advertiser;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
@@ -28,24 +26,14 @@ 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.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.*;
 
 /**
@@ -71,15 +59,11 @@ public class ProjectController {
     @Autowired
     private ProjectMapper projectMapper;
     @Autowired
-    private MaterialReportMapper materialReportMapper;
-    @Autowired
     private ITransferAccountService transferAccountService;
     @Autowired
     private IUserAllocationService userAllocationService;
 
     /**
-     * 根据 项目 媒体类型 查看项目
-     *
      * @param advertiserId
      * @param mediaId
      * @return
@@ -98,7 +82,6 @@ public class ProjectController {
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
-
         }
         return result;
     }
@@ -115,10 +98,10 @@ public class ProjectController {
     @GetMapping(value = "/responsibleList")
     public Map<String, Object> responsibleList(String userId) {
         Map<String, Object> map = new HashMap<>();
-        String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+        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);
@@ -170,6 +153,8 @@ public class ProjectController {
         return map;
     }
 
+    @Autowired
+    private ISysCategoryService sysCategoryService;
 
     /**
      * 分页列表查询
@@ -187,21 +172,23 @@ public class ProjectController {
                                                 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                 HttpServletRequest req) {
-        Result<IPage<Project>> result = new Result<IPage<Project>>();
+        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<Project>(pageNo, pageSize);
-
+        Page<Project> page = new Page<>(pageNo, pageSize);
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        if (Check.isNull(sysUser)) {
-            result.setSuccess(false);
-            return result;
-        }
-
-        String roleCode = materialReportMapper.getRoleCodeByUserId(sysUser.getId());
-        if (!"admin".equals(roleCode) && "sale".equals(roleCode) && "saleDirector".equals(roleCode)) {
+        String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
+        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);
@@ -221,14 +208,18 @@ public class ProjectController {
     @ApiOperation(value = "项目-添加", notes = "项目-添加")
     @PostMapping(value = "/add")
     public Result<Project> add(@RequestBody Project project) {
-        Result<Project> result = new Result<Project>();
+        Result<Project> result = new Result<>();
         try {
             String advertiserId = project.getAdvertiserId();
             Advertiser advertiser = advertiserService.getById(advertiserId);
             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)) {
@@ -246,7 +237,6 @@ public class ProjectController {
 
             Long id = project.getId();
             for (Map.Entry<String, String> projectMember : memberMap.entrySet()) {
-
                 String userId = projectMember.getKey();
                 String userName = projectMember.getValue();
                 Map<String, Object> map = new HashMap<>();
@@ -258,14 +248,12 @@ public class ProjectController {
                 member.setProjectName(project.getProjectName());
                 member.setUserId(userId);
                 member.setUserName(userName);
-                String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+                String roleCode = sysRoleService.getRoleCodeByUserId(userId);
                 if (!Check.isNull(roleCode)) {
                     member.setRoleCode(roleCode);
                 }
                 projectMemberService.save(member);
             }
-
-
             result.success("添加成功!");
         } catch (Exception e) {
             e.printStackTrace();
@@ -274,6 +262,9 @@ public class ProjectController {
         return result;
     }
 
+    @Autowired
+    private ISysRoleService sysRoleService;
+
     /**
      * 编辑
      *
@@ -284,14 +275,18 @@ public class ProjectController {
     @ApiOperation(value = "项目-编辑", notes = "项目-编辑")
     @PutMapping(value = "/edit")
     public Result<Project> edit(@RequestBody Project project) {
-        Result<Project> result = new Result<Project>();
-
+        Result<Project> result = new Result<>();
         SysUser sysUser = sysUserService.getById(project.getResponsibleId());
         if (!Check.isNull(sysUser)) {
             project.setResponsibleName(sysUser.getRealname());
             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());
@@ -313,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) {
@@ -333,7 +329,7 @@ public class ProjectController {
     @AutoLog(value = "项目-通过id删除")
     @ApiOperation(value = "项目-通过id删除", notes = "项目-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             projectService.removeById(id);
             Map<String, Object> deleteMap = new HashMap<>();
@@ -357,7 +353,7 @@ public class ProjectController {
     @ApiOperation(value = "项目-批量删除", notes = "项目-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<Project> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<Project> result = new Result<Project>();
+        Result<Project> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -377,7 +373,7 @@ public class ProjectController {
     @ApiOperation(value = "项目-通过id查询", notes = "项目-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<Project> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<Project> result = new Result<Project>();
+        Result<Project> result = new Result<>();
         Project project = projectService.getById(id);
         if (project == null) {
             result.error500("未找到对应实体");
@@ -387,72 +383,4 @@ public class ProjectController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<Project> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                Project project = JSON.parseObject(deString, Project.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(project, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<Project> pageList = projectService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "项目列表");
-        mv.addObject(NormalExcelConstants.CLASS, Project.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("项目列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<Project> listProjects = ExcelImportUtil.importExcel(file.getInputStream(), Project.class, params);
-                projectService.saveBatch(listProjects);
-                return Result.ok("文件导入成功!数据行数:" + listProjects.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

@@ -1,8 +1,8 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
+import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
-import com.alibaba.fastjson.JSON;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -11,10 +11,11 @@ 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.util.oConvertUtils;
+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;
@@ -22,22 +23,11 @@ import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.*;
 
 /**
@@ -59,7 +49,7 @@ public class ProjectMemberController {
     @Autowired
     private IProjectService projectService;
     @Autowired
-    private MaterialReportMapper materialReportMapper;
+    private ISysRoleService sysRoleService;
     @Autowired
     private ISysUserService sysUserService;
 
@@ -105,7 +95,7 @@ public class ProjectMemberController {
         Map<String, Object> map = new HashMap<>();
         try {
             QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
-            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             if (!"admin".equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
@@ -120,10 +110,6 @@ public class ProjectMemberController {
                     }
                     Project project = projectService.getById(projectMember.getProjectId());
                     if (!Check.isNull(project)) {
-                        String mediaId = project.getMediaId();
-                        /*if ("1".equals(mediaId)) {
-                            continue;
-                        }*/
                         projectMember.setResponsibleName(project.getResponsibleName());
                         projectMember.setDesignResponsibleName(project.getDesignResponsibleName());
                         projectMember.setAdvertiserName(project.getAdvertiserName());
@@ -164,9 +150,9 @@ public class ProjectMemberController {
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
-        Result<IPage<ProjectMember>> result = new Result<IPage<ProjectMember>>();
+        Result<IPage<ProjectMember>> result = new Result<>();
         QueryWrapper<ProjectMember> queryWrapper = QueryGenerator.initQueryWrapper(projectMember, req.getParameterMap());
-        Page<ProjectMember> page = new Page<ProjectMember>(pageNo, pageSize);
+        Page<ProjectMember> page = new Page<>(pageNo, pageSize);
         IPage<ProjectMember> pageList = projectMemberService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -186,7 +172,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-添加", notes = "项目成员-添加")
     @PostMapping(value = "/batchAdd")
     public Result<ProjectMember> batchAdd(@RequestBody JSONObject jsonObject) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         try {
             if (Check.isNull(jsonObject)) {
                 throw new Exception("入参不能为空");
@@ -203,12 +189,12 @@ 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;
                     }
                     ProjectMember member = new ProjectMember();
-                    String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+                    String roleCode = sysRoleService.getRoleCodeByUserId(userId);
                     if (!Check.isNull(roleCode)) {
                         member.setRoleCode(roleCode);
                     }
@@ -242,7 +228,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-添加", notes = "项目成员-添加")
     @PostMapping(value = "/add")
     public Result<ProjectMember> add(@RequestBody ProjectMember projectMember) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         try {
             projectMemberService.save(projectMember);
             result.success("添加成功!");
@@ -263,7 +249,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-编辑", notes = "项目成员-编辑")
     @PutMapping(value = "/edit")
     public Result<ProjectMember> edit(@RequestBody ProjectMember projectMember) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         ProjectMember projectMemberEntity = projectMemberService.getById(projectMember.getId());
         if (projectMemberEntity == null) {
             result.error500("未找到对应实体");
@@ -286,7 +272,7 @@ public class ProjectMemberController {
     @AutoLog(value = "项目成员-通过id删除")
     @ApiOperation(value = "项目成员-通过id删除", notes = "项目成员-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             projectMemberService.removeById(id);
         } catch (Exception e) {
@@ -306,7 +292,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-批量删除", notes = "项目成员-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ProjectMember> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -326,7 +312,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-通过id查询", notes = "项目成员-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ProjectMember> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         ProjectMember projectMember = projectMemberService.getById(id);
         if (projectMember == null) {
             result.error500("未找到对应实体");
@@ -338,70 +324,48 @@ public class ProjectMemberController {
     }
 
     /**
-     * 导出excel
+     * 我参与项目
      *
-     * @param request
-     * @param response
+     * @return
      */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ProjectMember> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ProjectMember projectMember = JSON.parseObject(deString, ProjectMember.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(projectMember, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
+    @AutoLog(value = "头条视频报表-参与项目列表")
+    @ApiOperation(value = "头条视频报表-参与项目列表", notes = "头条视频报表-参与项目列表")
+    @GetMapping(value = "/bytedanceProjectParticipateInList")
+    public Result<List<ProjectMember>> bytedanceProjectParticipateInList() {
+        Result<List<ProjectMember>> result = new Result<>();
+        List<Integer> mediaIds = new ArrayList<>();
+        mediaIds.add(1);
+        mediaIds.add(3);
+        List<ProjectMember> projectMemberList = projectMemberService.getProjects(mediaIds);
+        if (projectMemberList == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(projectMemberList);
+            result.setSuccess(true);
         }
+        return result;
 
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ProjectMember> pageList = projectMemberService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "项目成员列表");
-        mv.addObject(NormalExcelConstants.CLASS, ProjectMember.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("项目成员列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
     }
 
     /**
-     * 通过excel导入数据
+     * 查询当前账户下的
      *
-     * @param request
-     * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<ProjectMember> listProjectMembers = ExcelImportUtil.importExcel(file.getInputStream(), ProjectMember.class, params);
-                projectMemberService.saveBatch(listProjectMembers);
-                return Result.ok("文件导入成功!数据行数:" + listProjectMembers.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
+    @GetMapping(value = "/getProjectAccountByUserId")
+    public Result<List<Map<String, Object>>> getProjectAccountBy() {
+        Result<List<Map<String, Object>>> resultBody = new Result<>();
+        try {
+            String userId=((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
+            List<Map<String, Object>> result = projectMemberService.getProjectAccountByUserId(userId);
+            resultBody.setSuccess(true);
+            resultBody.setResult(result);
+        } catch (Exception e) {
+            resultBody.setSuccess(false);
+            resultBody.success("查询失败");
         }
-        return Result.ok("文件导入失败!");
+        return resultBody;
     }
 
+
 }

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

@@ -0,0 +1,157 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.ctop.entity.ReleaseRecord;
+import org.jeecg.modules.ctop.service.IReleaseRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+ /**
+ * 发版记录信息
+ * @author jeecg-boot
+ * @date   2020-06-10
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="发版记录信息")
+@RestController
+@RequestMapping("/ctop/releaseRecord")
+public class ReleaseRecordController {
+	@Autowired
+	private IReleaseRecordService releaseRecordService;
+
+	/**
+	  * 分页列表查询
+	 * @param releaseRecord
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-分页列表查询")
+	@ApiOperation(value="发版记录信息-分页列表查询", notes="发版记录信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<ReleaseRecord>> queryPageList(ReleaseRecord releaseRecord,
+													  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													  HttpServletRequest req) {
+		Result<IPage<ReleaseRecord>> result = new Result<>();
+		QueryWrapper<ReleaseRecord> queryWrapper = QueryGenerator.initQueryWrapper(releaseRecord, req.getParameterMap());
+		Page<ReleaseRecord> page = new Page<ReleaseRecord>(pageNo, pageSize);
+		IPage<ReleaseRecord> pageList = releaseRecordService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param releaseRecord
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-添加")
+	@ApiOperation(value="发版记录信息-添加", notes="发版记录信息-添加")
+	@PostMapping(value = "/add")
+	public Result<ReleaseRecord> add(@RequestBody ReleaseRecord releaseRecord) {
+		Result<ReleaseRecord> result = new Result<>();
+		try {
+			releaseRecordService.save(releaseRecord);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param releaseRecord
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-编辑")
+	@ApiOperation(value="发版记录信息-编辑", notes="发版记录信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<ReleaseRecord> edit(@RequestBody ReleaseRecord releaseRecord) {
+		Result<ReleaseRecord> result = new Result<ReleaseRecord>();
+		ReleaseRecord releaseRecordEntity = releaseRecordService.getById(releaseRecord.getId());
+		if(releaseRecordEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = releaseRecordService.updateById(releaseRecord);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-通过id删除")
+	@ApiOperation(value="发版记录信息-通过id删除", notes="发版记录信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			releaseRecordService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-批量删除")
+	@ApiOperation(value="发版记录信息-批量删除", notes="发版记录信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<ReleaseRecord> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<ReleaseRecord> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.releaseRecordService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-通过id查询")
+	@ApiOperation(value="发版记录信息-通过id查询", notes="发版记录信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<ReleaseRecord> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<ReleaseRecord> result = new Result<>();
+		ReleaseRecord releaseRecord = releaseRecordService.getById(id);
+		if(releaseRecord==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(releaseRecord);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+}

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

@@ -0,0 +1,171 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.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.ReleaseViewRecord;
+import org.jeecg.modules.ctop.service.IReleaseViewRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+import java.util.Map;
+
+/**
+ * 发版记录信息
+ * @author jeecg-boot
+ * @date   2020-06-10
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="发版记录信息")
+@RestController
+@RequestMapping("/ctop/releaseViewRecord")
+public class ReleaseViewRecordController {
+	@Autowired
+	private IReleaseViewRecordService releaseViewRecordService;
+
+	@PostMapping("check")
+	public Map<String,Object>check(){
+		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		return releaseViewRecordService.check(user.getId());
+	}
+	@PostMapping("view")
+	public Map<String,Object>view(@RequestBody JSONObject data){
+		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		return releaseViewRecordService.view(user.getId(),data);
+	}
+	/**
+	  * 分页列表查询
+	 * @param releaseViewRecord
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-分页列表查询")
+	@ApiOperation(value="发版记录信息-分页列表查询", notes="发版记录信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<ReleaseViewRecord>> queryPageList(ReleaseViewRecord releaseViewRecord,
+														  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+														  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+														  HttpServletRequest req) {
+		Result<IPage<ReleaseViewRecord>> result = new Result<>();
+		QueryWrapper<ReleaseViewRecord> queryWrapper = QueryGenerator.initQueryWrapper(releaseViewRecord, req.getParameterMap());
+		Page<ReleaseViewRecord> page = new Page<>(pageNo, pageSize);
+		IPage<ReleaseViewRecord> pageList = releaseViewRecordService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param releaseViewRecord
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-添加")
+	@ApiOperation(value="发版记录信息-添加", notes="发版记录信息-添加")
+	@PostMapping(value = "/add")
+	public Result<ReleaseViewRecord> add(@RequestBody ReleaseViewRecord releaseViewRecord) {
+		Result<ReleaseViewRecord> result = new Result<>();
+		try {
+			releaseViewRecordService.save(releaseViewRecord);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param releaseViewRecord
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-编辑")
+	@ApiOperation(value="发版记录信息-编辑", notes="发版记录信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<ReleaseViewRecord> edit(@RequestBody ReleaseViewRecord releaseViewRecord) {
+		Result<ReleaseViewRecord> result = new Result<>();
+		ReleaseViewRecord releaseViewRecordEntity = releaseViewRecordService.getById(releaseViewRecord.getId());
+		if(releaseViewRecordEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = releaseViewRecordService.updateById(releaseViewRecord);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-通过id删除")
+	@ApiOperation(value="发版记录信息-通过id删除", notes="发版记录信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			releaseViewRecordService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-批量删除")
+	@ApiOperation(value="发版记录信息-批量删除", notes="发版记录信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<ReleaseViewRecord> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<ReleaseViewRecord> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.releaseViewRecordService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "发版记录信息-通过id查询")
+	@ApiOperation(value="发版记录信息-通过id查询", notes="发版记录信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<ReleaseViewRecord> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<ReleaseViewRecord> result = new Result<>();
+		ReleaseViewRecord releaseViewRecord = releaseViewRecordService.getById(id);
+		if(releaseViewRecord==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(releaseViewRecord);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+}

+ 9 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SalePerformanceDetailController.java

@@ -64,9 +64,9 @@ public class SalePerformanceDetailController {
                                                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                               HttpServletRequest req) {
-        Result<IPage<SalePerformanceDetail>> result = new Result<IPage<SalePerformanceDetail>>();
+        Result<IPage<SalePerformanceDetail>> result = new Result<>();
         QueryWrapper<SalePerformanceDetail> queryWrapper = QueryGenerator.initQueryWrapper(salePerformanceDetail, req.getParameterMap());
-        Page<SalePerformanceDetail> page = new Page<SalePerformanceDetail>(pageNo, pageSize);
+        Page<SalePerformanceDetail> page = new Page<>(pageNo, pageSize);
         IPage<SalePerformanceDetail> pageList = salePerformanceDetailService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +83,7 @@ public class SalePerformanceDetailController {
     @ApiOperation(value = "销售绩效详细信息-添加", notes = "销售绩效详细信息-添加")
     @PostMapping(value = "/add")
     public Result<SalePerformanceDetail> add(@RequestBody SalePerformanceDetail salePerformanceDetail) {
-        Result<SalePerformanceDetail> result = new Result<SalePerformanceDetail>();
+        Result<SalePerformanceDetail> result = new Result<>();
         try {
             salePerformanceDetailService.save(salePerformanceDetail);
             result.success("添加成功!");
@@ -104,7 +104,7 @@ public class SalePerformanceDetailController {
     @ApiOperation(value = "销售绩效详细信息-编辑", notes = "销售绩效详细信息-编辑")
     @PutMapping(value = "/edit")
     public Result<SalePerformanceDetail> edit(@RequestBody SalePerformanceDetail salePerformanceDetail) {
-        Result<SalePerformanceDetail> result = new Result<SalePerformanceDetail>();
+        Result<SalePerformanceDetail> result = new Result<>();
         SalePerformanceDetail salePerformanceDetailEntity = salePerformanceDetailService.getById(salePerformanceDetail.getId());
         if (salePerformanceDetailEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +127,7 @@ public class SalePerformanceDetailController {
     @AutoLog(value = "销售绩效详细信息-通过id删除")
     @ApiOperation(value = "销售绩效详细信息-通过id删除", notes = "销售绩效详细信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             salePerformanceDetailService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +147,7 @@ public class SalePerformanceDetailController {
     @ApiOperation(value = "销售绩效详细信息-批量删除", notes = "销售绩效详细信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<SalePerformanceDetail> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<SalePerformanceDetail> result = new Result<SalePerformanceDetail>();
+        Result<SalePerformanceDetail> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +167,7 @@ public class SalePerformanceDetailController {
     @ApiOperation(value = "销售绩效详细信息-通过id查询", notes = "销售绩效详细信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<SalePerformanceDetail> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<SalePerformanceDetail> result = new Result<SalePerformanceDetail>();
+        Result<SalePerformanceDetail> result = new Result<>();
         SalePerformanceDetail salePerformanceDetail = salePerformanceDetailService.getById(id);
         if (salePerformanceDetail == null) {
             result.error500("未找到对应实体");
@@ -186,7 +186,6 @@ public class SalePerformanceDetailController {
      */
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
         QueryWrapper<SalePerformanceDetail> queryWrapper = null;
         try {
             String paramsStr = request.getParameter("paramsStr");
@@ -217,8 +216,8 @@ public class SalePerformanceDetailController {
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+    @PostMapping("/importExcel")
+    public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ScriptTagInfoController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.ScriptTagInfo;
 import org.jeecg.modules.ctop.service.IScriptTagInfoService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 脚本库标签信息
@@ -64,9 +48,9 @@ public class ScriptTagInfoController {
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
-        Result<IPage<ScriptTagInfo>> result = new Result<IPage<ScriptTagInfo>>();
+        Result<IPage<ScriptTagInfo>> result = new Result<>();
         QueryWrapper<ScriptTagInfo> queryWrapper = QueryGenerator.initQueryWrapper(scriptTagInfo, req.getParameterMap());
-        Page<ScriptTagInfo> page = new Page<ScriptTagInfo>(pageNo, pageSize);
+        Page<ScriptTagInfo> page = new Page<>(pageNo, pageSize);
         IPage<ScriptTagInfo> pageList = scriptTagInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class ScriptTagInfoController {
     @ApiOperation(value = "脚本库标签信息-添加", notes = "脚本库标签信息-添加")
     @PostMapping(value = "/add")
     public Result<ScriptTagInfo> add(@RequestBody ScriptTagInfo scriptTagInfo) {
-        Result<ScriptTagInfo> result = new Result<ScriptTagInfo>();
+        Result<ScriptTagInfo> result = new Result<>();
         try {
             scriptTagInfoService.save(scriptTagInfo);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class ScriptTagInfoController {
     @ApiOperation(value = "脚本库标签信息-编辑", notes = "脚本库标签信息-编辑")
     @PutMapping(value = "/edit")
     public Result<ScriptTagInfo> edit(@RequestBody ScriptTagInfo scriptTagInfo) {
-        Result<ScriptTagInfo> result = new Result<ScriptTagInfo>();
+        Result<ScriptTagInfo> result = new Result<>();
         ScriptTagInfo scriptTagInfoEntity = scriptTagInfoService.getById(scriptTagInfo.getId());
         if (scriptTagInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class ScriptTagInfoController {
     @AutoLog(value = "脚本库标签信息-通过id删除")
     @ApiOperation(value = "脚本库标签信息-通过id删除", notes = "脚本库标签信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             scriptTagInfoService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class ScriptTagInfoController {
     @ApiOperation(value = "脚本库标签信息-批量删除", notes = "脚本库标签信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ScriptTagInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ScriptTagInfo> result = new Result<ScriptTagInfo>();
+        Result<ScriptTagInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class ScriptTagInfoController {
     @ApiOperation(value = "脚本库标签信息-通过id查询", notes = "脚本库标签信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ScriptTagInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ScriptTagInfo> result = new Result<ScriptTagInfo>();
+        Result<ScriptTagInfo> result = new Result<>();
         ScriptTagInfo scriptTagInfo = scriptTagInfoService.getById(id);
         if (scriptTagInfo == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class ScriptTagInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ScriptTagInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ScriptTagInfo scriptTagInfo = JSON.parseObject(deString, ScriptTagInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(scriptTagInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ScriptTagInfo> pageList = scriptTagInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "脚本库标签信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, ScriptTagInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("脚本库标签信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<ScriptTagInfo> listScriptTagInfos = ExcelImportUtil.importExcel(file.getInputStream(), ScriptTagInfo.class, params);
-                scriptTagInfoService.saveBatch(listScriptTagInfos);
-                return Result.ok("文件导入成功!数据行数:" + listScriptTagInfos.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

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

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

@@ -1,9 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
-import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
-import cn.com.ctop.bytedance.service.IBytedancePlanHourlyReportService;
-import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.service.*;
@@ -16,21 +12,25 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskServic
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
-import com.alibaba.fastjson.JSONObject;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanDailyReportService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanHourlyReportService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
 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.jeecg.modules.ctop.service.ICleanMaterialService;
-import org.jeecg.modules.ctop.service.ICreateInternalService;
+import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+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.*;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -44,8 +44,6 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
 @Slf4j
 public class TestController {
     @Autowired
-    private ICreateInternalService createInternalService;
-    @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
 
     @Autowired
@@ -62,15 +60,12 @@ public class TestController {
     private IMaterialTagService tagService;
     @Autowired
     private IMaterialImageInfoService iMaterialImageInfoService;
-
-    @PostMapping(value = "/create")
-    public Map<String, Object> authorization(@RequestBody JSONObject jsonObject) {
-        return createInternalService.createInternal(jsonObject);
-    }
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
 
     @GetMapping(value = "/t")
     public String test() {
-        Result<String> result = new Result<String>();
+        Result<String> result = new Result<>();
         try {
             String requestId = UUID.randomUUID().toString();
             String img = kuaishouWebInterfaceService.qrLogin(requestId);
@@ -97,48 +92,187 @@ 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) {
-        oauthTokenService.getKuaiShouRefreshToken(accountId, refreshToken, agentType);
+    public String getToken(Long accountId, String token, String refreshToken, Integer agentType) {
+        oauthTokenService.getKuaiShouRefreshToken(accountId, token, refreshToken, agentType);
         return "Success";
     }
 
 
+    @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();
         for (MaterialInfo info : list) {
-
-
             QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
             imageInfoQueryWrapper.eq("video_id", String.valueOf(info.getId()));
             MaterialImageInfo updateMaterialImageInfo = new MaterialImageInfo();
             updateMaterialImageInfo.setVideoId(info.getCode());
             iMaterialImageInfoService.update(updateMaterialImageInfo, imageInfoQueryWrapper);
-
-
             QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
             tagQueryWrapper.eq("material_id", String.valueOf(info.getId()));
             MaterialTag updateTag = new MaterialTag();
             updateTag.setMaterialId(info.getCode());
             tagService.update(updateTag, tagQueryWrapper);
-
             QueryWrapper<MaterialAscription> materialAscriptionQuery = new QueryWrapper<>();
             materialAscriptionQuery.eq("material_id", String.valueOf(info.getId()));
             MaterialAscription updateMaterialAscription = new MaterialAscription();
             updateMaterialAscription.setMaterialId(info.getCode());
             ascriptionService.update(updateMaterialAscription, materialAscriptionQuery);
-
-
             QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
             parameterQueryWrapper.eq("material_id", String.valueOf(info.getId()));
             MaterialParameter updateMaterialParameter = new MaterialParameter();
             updateMaterialParameter.setMaterialId(info.getCode());
             parameterService.update(updateMaterialParameter, parameterQueryWrapper);
-
-
         }
         List<MaterialImageInfo> list1 = iMaterialImageInfoService.list();
         for (MaterialImageInfo imageInfo : list1) {
@@ -169,11 +303,8 @@ public class TestController {
 
                 }
             }
-
         }
-
         return "SUCCESS";
-
     }
 
 
@@ -200,7 +331,7 @@ public class TestController {
 
     @GetMapping(value = "/getHistoryData")
     public String getHistoryData() {
-        Result<String> result = new Result<String>();
+        Result<String> result = new Result<>();
         try {
             String endDateStr = DateUtils.getDate("yyyy-MM-dd");
             String startDate = DateUtils.addMonth(endDateStr, -6);
@@ -223,14 +354,11 @@ public class TestController {
 
     @GetMapping(value = "/getTaskList")
     public String getTaskList() {
-        Result<String> result = new Result<String>();
+        Result<String> result = new Result<>();
         try {
-            String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-            String startDate = DateUtils.addMonth(endDateStr, -6);
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             historyReportTaskService.getTaskList();
-
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
@@ -248,7 +376,6 @@ public class TestController {
         List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
         for (CtopOauthToken token : ctopOauthTokens) {
 
-
             for (int i = 0; i < 7; i++) {
                 Date getStartDate = DateUtils.addDay(endDate, -i);
                 //3:获取广告组信息数据
@@ -348,13 +475,6 @@ public class TestController {
     @Autowired
     private IUserAllocationService userAllocationService;
 
-
-    public static void main(String[] args) throws ParseException {
-        String date = DateUtils.getDate("yyyy-MM-dd");
-        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
-    }
-
-
     @GetMapping(value = "/getPlanAndGroupByAccount")
     public void getPlanAndGroupByAccount(Long accountId) {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
@@ -369,8 +489,6 @@ public class TestController {
         } catch (Exception e) {
             e.printStackTrace();
         }
-
-
     }
 
 
@@ -397,74 +515,6 @@ public class TestController {
     @Autowired
     private ICtopOauthTokenService tokenService;
 
-    @GetMapping("loadBytedanceData")
-    public Map<String, Object> formatZybData(String date) {
-        Map<String, Object> result = new HashMap<>();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date getDate = null;
-        try {
-            getDate = simpleDateFormat.parse(date);
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-        //1:查询当日数据
-        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("project_id", 215);
-        List<UserAllocation> allocations = userAllocationService.list(queryWrapper);
-        if (null == allocations || allocations.size() <= 0) {
-            log.info("定时获取头条数据异常:获取用户信息失败");
-        }
-        Date finalGetDate = getDate;
-
-        allocations.forEach(allocation -> {
-            //3:获取广告计划信息数据
-            CtopOauthToken token = oauthTokenMapper.selectByAccountId(allocation.getAccountId());
-            reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        });
-
-        //清洗关于作业帮数据
-        //1:查询作业帮相关的用户数据
-        allocations.forEach(allocation -> {
-            //根据accountId和时间,查询相关的日报表信息
-            QueryWrapper<BytedancePlanDailyReport> reportQueryWrapper = new QueryWrapper<>();
-            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            String dateString = dateFormat.format(finalGetDate) + " 00:00:00";
-            queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                    .eq("stat_datetime", dateString)
-            ;
-            List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(reportQueryWrapper);
-            if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
-                bytedancePlanDailyReports.forEach(report -> {
-                    String adName = report.getAdName();
-                    String[] tags = adName.split("-");
-                    report.setAdsense(tags[1]);
-                    report.setPlanCode(tags[2]);
-                    String materialName = tags[3];
-                    report.setMaterialName(materialName);
-                    if (materialName.contains("其他")) {
-                        report.setMaterialType("其他");
-                    } else if (materialName.contains("图片轮播")) {
-                        report.setMaterialType("图片轮播");
-                    } else if (materialName.contains("大字报")) {
-                        report.setMaterialType("大字报");
-                    } else if (materialName.contains("文字动画")) {
-                        report.setMaterialType("文字动画");
-                    } else if (materialName.contains("采访形式")) {
-                        report.setMaterialType("采访形式");
-                    } else if (materialName.contains("剧情")) {
-                        report.setMaterialType("剧情");
-                    } else if (materialName.contains("口播")) {
-                        report.setMaterialType("口播");
-                    } else {
-                        report.setMaterialType("其他");
-                    }
-                    planDailyReportService.updateById(report);
-                });
-            }
-        });
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
 
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
@@ -474,8 +524,10 @@ public class TestController {
         Map<String, Object> result = new HashMap<>();
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             log.info("定时获取头条数据异常:为获取到可用的token");
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
+            return result;
         }
         tokens.forEach(token -> {
             advertiserDataService.getMaterialList(token);
@@ -484,282 +536,13 @@ public class TestController {
         return result;
     }
 
-    @GetMapping("formatZybData")
-    public Map<String, Object> formatZybData() {
-        //清洗关于作业帮数据
-        //1:查询作业帮相关的用户数据
-        QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
-        wrapper.eq("project_id", 215);
-        List<UserAllocation> allocations = userAllocationService.list(wrapper);
-        if (null != allocations && allocations.size() > 0) {
-            allocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-//                String dateString = dateFormat.format(getDate)+" 00:00:00";
-                queryWrapper.eq("advertiser_id", allocation.getAccountId())
-//                        .eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setAdsense(tags[1]);
-                        report.setPlanCode(tags[2]);
-                        String materialName = tags[3];
-                        report.setMaterialName(materialName);
-                        if (materialName.contains("其他")) {
-                            report.setMaterialType("其他");
-                        } else if (materialName.contains("图片轮播")) {
-                            report.setMaterialType("图片轮播");
-                        } else if (materialName.contains("大字报")) {
-                            report.setMaterialType("大字报");
-                        } else if (materialName.contains("文字动画")) {
-                            report.setMaterialType("文字动画");
-                        } else if (materialName.contains("采访形式")) {
-                            report.setMaterialType("采访形式");
-                        } else if (materialName.contains("剧情")) {
-                            report.setMaterialType("剧情");
-                        } else if (materialName.contains("口播")) {
-                            report.setMaterialType("口播");
-                        } else {
-                            report.setMaterialType("其他");
-                        }
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-        Map<String, Object> result = new HashMap<>();
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
     @Autowired
     private IReportService reportService;
 
-    @GetMapping("bytedanceHourReport")
-    public Map<String, Object> bytedanceHourReport() {
-        Map<String, Object> result = new HashMap<>();
-        log.info("头条时报数据获取开始");
-        Date getDate = new Date();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-        String hour = simpleDateFormat.format(getDate);
-        if (null != hour && "00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取头条小时数据异常:未获取到可用的token");
-            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
-            return result;
-        }
-        executorService = Executors.newFixedThreadPool(4);
-        Date finalGetDate = getDate;
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                }
-            });
-        });
-        log.info("头条时报数据获取结束");
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
-    //线程计数器
-    static CountDownLatch countDownLatch = null;
-
-    @GetMapping("getHourLyYddData")
-    public Map<String, Object> getData() {
-        log.info("头条时报数据获取开始");
-        Date getDate = new Date();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-        String hour = simpleDateFormat.format(getDate);
-        if (null != hour && "00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
-        //1:查询当日计划时报数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        Date finalGetDate = getDate;
-        executorService = Executors.newFixedThreadPool(10);
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> {
-            //1:获取当日广告计划数据
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        countDownLatch.countDown();
-                    }
-                }
-            });
-        });
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        log.info("头条计划时报数据获取完成");
-        Map<String, Object> result = new HashMap<>();
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
-    @GetMapping("formatYzData")
-    public Map<String, Object> formatYzData() {
-        Map<String, Object> result = new HashMap<>();
-        planDailyReportService.cleanYzData(151);
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
 
     @Autowired
     private IBytedancePlanHourlyReportService planHourlyReportService;
 
-    @GetMapping("loadCreativeData")
-    public Map<String, Object> loadCreaticeData() {
-        Map<String, Object> result = new HashMap<>();
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        log.info("头条创意素材数据开始获取");
-        //查询当日数据
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取头条数据异常:wei获取到可用的token");
-            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);
-            return result;
-        }
-        executorService = Executors.newFixedThreadPool(20);
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    // 获取广告创意信息数据
-                    try {
-                        advertiserDataService.getAdvertiserCreative(token, null);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        countDownLatch.countDown();
-                    }
-                }
-            });
-        });
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        log.info("头条创意素材数据获取完成");
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
-    @GetMapping("loadCreaticeReportData")
-    public Map<String, Object> loadCreaticeReportData() {
-        Map<String, Object> result = new HashMap<>();
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        for (int i = 51; i < 180; i++) {
-            Date getDate = DateUtils.addDay(new Date(), -i);
-            log.info(DateUtils.formatDate(getDate) + "头条创意日报数据开始获取");
-            //查询当日数据
-            if (null == tokens || tokens.size() <= 0) {
-                log.info("定时获取头条数据异常:为获取到可用的token");
-                continue;
-            }
-            executorService = Executors.newFixedThreadPool(10);
-            countDownLatch = new CountDownLatch(tokens.size());
-            tokens.forEach(token -> {
-                executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        //获取广告创意日报信息数据
-                        try {
-                            reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        } finally {
-                            countDownLatch.countDown();
-                        }
-                    }
-                });
-            });
-            try {
-                countDownLatch.await();
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-            log.info(DateUtils.formatDate(getDate) + "头条创意日报数据获取完成");
-        }
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
-    @GetMapping("loadVideoData")
-    public Map<String, Object> loadVideoData() {
-        log.info("素材数据获取开始");
-        //1:查询当日计划时报数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(10);
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> {
-            //1:获取当日广告计划数据
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        advertiserDataService.getMaterialList(token);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        countDownLatch.countDown();
-                    }
-                }
-            });
-        });
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        log.info("头条素材数据获取完成");
-        Map<String, Object> result = new HashMap<>();
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
-
-    @Autowired
-    private ICleanMaterialService cleanMaterialService;
-
-    @GetMapping("testReport")
-    public void testReport() {
-        List<String> signatureList = cleanMaterialService.getSignature();
-        if (Check.isNull(signatureList)) {
-            log.error("素材数据获取为空");
-            return;
-        }
-        executorService = Executors.newFixedThreadPool(5);
-        for (int i = 0; i < signatureList.size(); i++) {
-            String signature = signatureList.get(i);
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    cleanMaterialService.calculationReport(signature);
-                }
-            });
-        }
-
-
-    }
 
     @GetMapping(value = "/AccountReportByAccount")
     public void AccountReportByAccount(Long accountId, String startDateStr, String endDateStr) {
@@ -851,5 +634,50 @@ public class TestController {
 
     }
 
+    @GetMapping(value = "/KuaishouDailyAccountReportLoadJob")
+    public void KuaishouDailyAccountReportLoadJob() {
+        Date getDate = DateUtils.addDay(new Date(), -2);
+        //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, getDate, getDate);
+                }
+            });
+        });
+    }
+
+
+    @GetMapping(value = "/BytedanceDailyAsyncJob")
+    public void BytedanceDailyAsyncJob() {
+        String startDate = "2020-06-01";
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        String endDate = DateUtils.formatDate(getDate);
+        endDate = "2020-06-02";
+        log.info("头条广告计划异步任务开始执行,跑的是" + startDate + "~" + endDate + "的数据");
+
+        List<CtopOauthToken> tokens = tokenService.getToutiaoTokenByCreateTime(endDate);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("头条获取异步报表数据任务执行失败:未获取到可用的token");
+            return;
+        }
+
+        //1.创意 2.广告主 3.广告组 4.广告计划
+        for (CtopOauthToken token : tokens) {
+            bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, 1);
+            bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, 2);
+            bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, 3);
+            bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, 4);
+        }
+    }
 
 }

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

@@ -1,32 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.utils.ResultMapUtils;
-import cn.com.ctop.common.module.utils.StatusCode;
-import org.jeecg.modules.mq.Sender;
-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.util.HashMap;
-import java.util.Map;
-
-/**
- * @author jeecg-boot
- * 2019年12月5日19:57:58
- */
-@RestController
-@RequestMapping("mq")
-public class TestMqController {
-    @Autowired
-    private Sender sender;
-
-
-    @GetMapping("hello")
-    public Map<String, Object> sayHello() {
-        Map<String, Object> result = new HashMap<>();
-        sender.send();
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS.getCode());
-        return result;
-    }
-}

+ 13 - 95
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TransferAccountController.java

@@ -3,10 +3,9 @@ package org.jeecg.modules.ctop.controller;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.service.IMailLogService;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -14,32 +13,18 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.entity.TransferAccount;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.service.ITransferAccountService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 转户记录表
@@ -64,10 +49,9 @@ public class TransferAccountController {
     @Autowired
     private MailLogMapper mailLogMapper;
     @Autowired
-    private IProjectMemberService projectMemberService;
-
+    private ISysRoleService sysRoleService;
     @Autowired
-    private IMaterialInfoService materialInfoService;
+    private IProjectMemberService projectMemberService;
 
     /**
      * 添加
@@ -79,7 +63,7 @@ public class TransferAccountController {
     @ApiOperation(value = "转户记录表-添加", notes = "转户记录表-添加")
     @PostMapping(value = "/add")
     public Result<TransferAccount> add(@RequestBody TransferAccount transferAccount) {
-        Result<TransferAccount> result = new Result<TransferAccount>();
+        Result<TransferAccount> result = new Result<>();
         try {
             QueryWrapper<TransferAccount> transferAccountQueryWrapper = new QueryWrapper<>();
             transferAccountQueryWrapper.eq("account_id", transferAccount.getAccountId());
@@ -123,9 +107,11 @@ public class TransferAccountController {
         List<TransferAccount> records = transferAccountService.list(queryWrapper);
         if (!Check.isNull(records)) {
             for (TransferAccount transfer : records) {
-                String transferorName = mailLogMapper.getUserNameByUserId(transfer.getTransferor()); // 转让人姓名
+                // 转让人姓名
+                String transferorName = mailLogMapper.getUserNameByUserId(transfer.getTransferor());
                 transfer.setTransferorName(transferorName);
-                String assigneeName = mailLogMapper.getUserNameByUserId(transfer.getAssignee()); // 转让人姓名
+                // 转让人姓名
+                String assigneeName = mailLogMapper.getUserNameByUserId(transfer.getAssignee());
                 transfer.setAssigneeName(assigneeName);
             }
         }
@@ -146,7 +132,7 @@ public class TransferAccountController {
     @ApiOperation(value = "转户记录表-编辑", notes = "转户记录表-编辑")
     @PutMapping(value = "/edit")
     public Result<TransferAccount> edit(@RequestBody TransferAccount transferAccount) {
-        Result<TransferAccount> result = new Result<TransferAccount>();
+        Result<TransferAccount> result = new Result<>();
         TransferAccount transferAccountEntity = transferAccountService.getById(transferAccount.getId());
         if (transferAccountEntity == null) {
             result.error500("未找到对应实体");
@@ -172,7 +158,7 @@ public class TransferAccountController {
                 ProjectMember projectMember = projectMemberService.getOne(projectMemberQueryWrapper);
                 if (Check.isNull(projectMember)) {
                     ProjectMember addProjectMember = new ProjectMember();
-                    String roleCode = materialInfoService.getRoleCodeByUserId(transferAccountEntity.getAssignee());
+                    String roleCode = sysRoleService.getRoleCodeByUserId(transferAccountEntity.getAssignee());
                     addProjectMember.setRoleCode(roleCode);
                     addProjectMember.setUserId(transferAccountEntity.getAssignee());
                     addProjectMember.setUserName(userName);
@@ -200,7 +186,7 @@ public class TransferAccountController {
     @AutoLog(value = "转户记录表-通过id删除")
     @ApiOperation(value = "转户记录表-通过id删除", notes = "转户记录表-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             transferAccountService.removeById(id);
         } catch (Exception e) {
@@ -220,7 +206,7 @@ public class TransferAccountController {
     @ApiOperation(value = "转户记录表-批量删除", notes = "转户记录表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<TransferAccount> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<TransferAccount> result = new Result<TransferAccount>();
+        Result<TransferAccount> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -240,7 +226,7 @@ public class TransferAccountController {
     @ApiOperation(value = "转户记录表-通过id查询", notes = "转户记录表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<TransferAccount> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<TransferAccount> result = new Result<TransferAccount>();
+        Result<TransferAccount> result = new Result<>();
         TransferAccount transferAccount = transferAccountService.getById(id);
         if (transferAccount == null) {
             result.error500("未找到对应实体");
@@ -250,72 +236,4 @@ public class TransferAccountController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<TransferAccount> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                TransferAccount transferAccount = JSON.parseObject(deString, TransferAccount.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(transferAccount, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<TransferAccount> pageList = transferAccountService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "转户记录表列表");
-        mv.addObject(NormalExcelConstants.CLASS, TransferAccount.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("转户记录表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<TransferAccount> listTransferAccounts = ExcelImportUtil.importExcel(file.getInputStream(), TransferAccount.class, params);
-                transferAccountService.saveBatch(listTransferAccounts);
-                return Result.ok("文件导入成功!数据行数:" + listTransferAccounts.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

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

@@ -1,8 +1,8 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanDailyReportService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -74,7 +74,7 @@ public class UReportFileBindUserController {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         uReportFileBindUser.setUserId(user.getId());
         String fileName = null;
-        if (null != uReportFileBindUser.getFileName() && !uReportFileBindUser.getFileName().trim().equals("")) {
+        if (null != uReportFileBindUser.getFileName() && !"".equals(uReportFileBindUser.getFileName().trim())) {
             fileName = uReportFileBindUser.getFileName();
             uReportFileBindUser.setFileName(null);
         }
@@ -157,7 +157,7 @@ public class UReportFileBindUserController {
     @AutoLog(value = "用户绑定报表信息-通过id删除")
     @ApiOperation(value = "用户绑定报表信息-通过id删除", notes = "用户绑定报表信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             uReportFileBindUserService.removeById(id);
         } catch (Exception e) {

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

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -11,27 +10,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.UReportFile;
 import org.jeecg.modules.ctop.service.IUReportFileService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -65,9 +50,9 @@ public class UReportFileController {
                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                     HttpServletRequest req) {
-        Result<IPage<UReportFile>> result = new Result<IPage<UReportFile>>();
+        Result<IPage<UReportFile>> result = new Result<>();
         String name = null;
-        if (null != uReportFile.getName() && !uReportFile.getName().trim().equals("")) {
+        if (null != uReportFile.getName() && !"".equals(uReportFile.getName().trim())) {
             name = uReportFile.getName();
             uReportFile.setName(null);
         }
@@ -75,7 +60,7 @@ public class UReportFileController {
         if (null != name) {
             queryWrapper.like("name", name);
         }
-        Page<UReportFile> page = new Page<UReportFile>(pageNo, pageSize);
+        Page<UReportFile> page = new Page<>(pageNo, pageSize);
         IPage<UReportFile> pageList = uReportFileService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -92,7 +77,7 @@ public class UReportFileController {
     @ApiOperation(value = "报表文件存储-添加", notes = "报表文件存储-添加")
     @PostMapping(value = "/add")
     public Result<UReportFile> add(@RequestBody UReportFile uReportFile) {
-        Result<UReportFile> result = new Result<UReportFile>();
+        Result<UReportFile> result = new Result<>();
         try {
             uReportFileService.save(uReportFile);
             result.success("添加成功!");
@@ -113,7 +98,7 @@ public class UReportFileController {
     @ApiOperation(value = "报表文件存储-编辑", notes = "报表文件存储-编辑")
     @PutMapping(value = "/edit")
     public Result<UReportFile> edit(@RequestBody UReportFile uReportFile) {
-        Result<UReportFile> result = new Result<UReportFile>();
+        Result<UReportFile> result = new Result<>();
         UReportFile uReportFileEntity = uReportFileService.getById(uReportFile.getId());
         if (uReportFileEntity == null) {
             result.error500("未找到对应实体");
@@ -155,7 +140,7 @@ public class UReportFileController {
     @AutoLog(value = "报表文件存储-通过id删除")
     @ApiOperation(value = "报表文件存储-通过id删除", notes = "报表文件存储-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             uReportFileService.removeById(id);
         } catch (Exception e) {
@@ -175,7 +160,7 @@ public class UReportFileController {
     @ApiOperation(value = "报表文件存储-批量删除", notes = "报表文件存储-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<UReportFile> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<UReportFile> result = new Result<UReportFile>();
+        Result<UReportFile> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -195,7 +180,7 @@ public class UReportFileController {
     @ApiOperation(value = "报表文件存储-通过id查询", notes = "报表文件存储-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<UReportFile> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<UReportFile> result = new Result<UReportFile>();
+        Result<UReportFile> result = new Result<>();
         UReportFile uReportFile = uReportFileService.getById(id);
         if (uReportFile == null) {
             result.error500("未找到对应实体");
@@ -205,71 +190,4 @@ public class UReportFileController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<UReportFile> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                UReportFile uReportFile = JSON.parseObject(deString, UReportFile.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(uReportFile, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<UReportFile> pageList = uReportFileService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "报表文件存储列表");
-        mv.addObject(NormalExcelConstants.CLASS, UReportFile.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("报表文件存储列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<UReportFile> listUReportFiles = ExcelImportUtil.importExcel(file.getInputStream(), UReportFile.class, params);
-                uReportFileService.saveBatch(listUReportFiles);
-                return Result.ok("文件导入成功!数据行数:" + listUReportFiles.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
 }

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

@@ -1,12 +1,12 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
+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;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.StringUtils;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -18,31 +18,17 @@ 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.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 用户分配
@@ -63,16 +49,15 @@ public class UserAllocationController {
     @Autowired
     private IProjectService projectService;
     @Autowired
-    private MaterialReportMapper materialReportMapper;
+    private ISysRoleService sysRoleService;
     @Autowired
     private ProjectMemberMapper memberMapper;
     @Autowired
     private IProjectMemberService projectMemberService;
 
-
     @GetMapping(value = "/accountTurnProject")
-    public Result getAccountList(Long accountId, Long projectId) {
-        Result result = new Result<>();
+    public Result<Object> getAccountList(Long accountId, Long projectId) {
+        Result<Object> result = new Result<>();
         try {
             QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("account_id", accountId);
@@ -113,7 +98,7 @@ public class UserAllocationController {
                 addMember.setProjectName(project.getProjectName());
                 addMember.setUserId(userAllocations.getUserId());
                 addMember.setUserName(userAllocations.getUserName());
-                String roleCode = materialReportMapper.getRoleCodeByUserId(userAllocations.getUserId());
+                String roleCode = sysRoleService.getRoleCodeByUserId(userAllocations.getUserId());
                 if (!Check.isNull(roleCode)) {
                     addMember.setRoleCode(roleCode);
                 }
@@ -139,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);
@@ -163,14 +148,9 @@ public class UserAllocationController {
         try {
             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());
-            }
 
-            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode)
-                    && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            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");
@@ -197,13 +177,13 @@ public class UserAllocationController {
     public Result<List<UserAllocation>> getAccountListByProjectId(Long projectId) {
         Result<List<UserAllocation>> result = new Result<>();
         try {
-
             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());
-            }
+            queryWrapper.eq("account_status", 0);
+           /* 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);
@@ -234,15 +214,15 @@ public class UserAllocationController {
                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                        HttpServletRequest req) {
-        Result<IPage<UserAllocation>> result = new Result<IPage<UserAllocation>>();
+        Result<IPage<UserAllocation>> result = new Result<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
-        String roleCode = materialReportMapper.getRoleCodeByUserId(user.getId());
-        if (!"admin".equals(roleCode)) {
+        String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
+        if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
             queryWrapper.eq("user_id", user.getId());
             queryWrapper.orderByDesc("id");
         }
-        Page<UserAllocation> page = new Page<UserAllocation>(pageNo, pageSize);
+        Page<UserAllocation> page = new Page<>(pageNo, pageSize);
         IPage<UserAllocation> pageList = userAllocationService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -259,7 +239,7 @@ public class UserAllocationController {
     @ApiOperation(value = "用户分配-添加", notes = "用户分配-添加")
     @PostMapping(value = "/add")
     public Result<UserAllocation> add(@RequestBody UserAllocation userAllocation) {
-        Result<UserAllocation> result = new Result<UserAllocation>();
+        Result<UserAllocation> result = new Result<>();
         try {
             userAllocationService.save(userAllocation);
             result.success("添加成功!");
@@ -280,7 +260,7 @@ public class UserAllocationController {
     @ApiOperation(value = "用户分配-编辑", notes = "用户分配-编辑")
     @PutMapping(value = "/edit")
     public Result<UserAllocation> edit(@RequestBody UserAllocation userAllocation) {
-        Result<UserAllocation> result = new Result<UserAllocation>();
+        Result<UserAllocation> result = new Result<>();
         UserAllocation userAllocationEntity = userAllocationService.getById(userAllocation.getId());
         if (userAllocationEntity == null) {
             result.error500("未找到对应实体");
@@ -297,7 +277,7 @@ public class UserAllocationController {
                 addMember.setProjectName(userAllocation.getProjectName());
                 addMember.setUserId(userAllocation.getUserId());
                 addMember.setUserName(userAllocation.getUserName());
-                String roleCode = materialReportMapper.getRoleCodeByUserId(userAllocation.getUserId());
+                String roleCode = sysRoleService.getRoleCodeByUserId(userAllocation.getUserId());
                 if (!Check.isNull(roleCode)) {
                     addMember.setRoleCode(roleCode);
                 }
@@ -321,7 +301,7 @@ public class UserAllocationController {
     @AutoLog(value = "用户分配-通过id删除")
     @ApiOperation(value = "用户分配-通过id删除", notes = "用户分配-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             userAllocationService.removeById(id);
         } catch (Exception e) {
@@ -341,7 +321,7 @@ public class UserAllocationController {
     @ApiOperation(value = "用户分配-批量删除", notes = "用户分配-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<UserAllocation> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<UserAllocation> result = new Result<UserAllocation>();
+        Result<UserAllocation> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -373,71 +353,23 @@ public class UserAllocationController {
     }
 
     /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<UserAllocation> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                UserAllocation userAllocation = JSON.parseObject(deString, UserAllocation.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<UserAllocation> pageList = userAllocationService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "用户分配列表");
-        mv.addObject(NormalExcelConstants.CLASS, UserAllocation.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户分配列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
+     * 统计报表 查看所有账号
      *
-     * @param request
-     * @param response
+     * @param projectId
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            // 获取上传文件对象
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<UserAllocation> listUserAllocations = ExcelImportUtil.importExcel(file.getInputStream(), UserAllocation.class, params);
-                userAllocationService.saveBatch(listUserAllocations);
-                return Result.ok("文件导入成功!数据行数:" + listUserAllocations.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
+    @GetMapping(value = "/selectAccountListByProjectId")
+    public Result<List<UserAllocation>> selectAccountListByProjectId(Long projectId) {
+        Result<List<UserAllocation>> result = new Result<>();
+        try {
+            List<UserAllocation> userAllocations = userAllocationService.selectAccountListByProjectId(projectId);
+            result.setSuccess(true);
+            result.setResult(userAllocations);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success("查询失败");
         }
-        return Result.ok("文件导入失败!");
+        return result;
     }
 
 }

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

@@ -1,40 +1,21 @@
 package org.jeecg.modules.ctop.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import cn.com.ctop.common.module.entity.VideoMergeTask;
 import cn.com.ctop.common.module.service.IVideoMergeTaskService;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
-import java.util.Date;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
 
  /**
  * 视频合成任务
@@ -49,8 +30,8 @@ import io.swagger.annotations.ApiOperation;
 public class VideoMergeTaskController {
 	@Autowired
 	private IVideoMergeTaskService videoMergeTaskService;
-	
-	/**
+
+     /**
 	  * 分页列表查询
 	 * @param videoMergeTask
 	 * @param pageNo
@@ -65,16 +46,16 @@ public class VideoMergeTaskController {
 													   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 													   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 													   HttpServletRequest req) {
-		Result<IPage<VideoMergeTask>> result = new Result<IPage<VideoMergeTask>>();
+        Result<IPage<VideoMergeTask>> result = new Result<>();
 		QueryWrapper<VideoMergeTask> queryWrapper = QueryGenerator.initQueryWrapper(videoMergeTask, req.getParameterMap());
-		Page<VideoMergeTask> page = new Page<VideoMergeTask>(pageNo, pageSize);
+        Page<VideoMergeTask> page = new Page<>(pageNo, pageSize);
 		IPage<VideoMergeTask> pageList = videoMergeTaskService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
-	/**
+
+     /**
 	  *   添加
 	 * @param videoMergeTask
 	 * @return
@@ -83,7 +64,7 @@ public class VideoMergeTaskController {
 	@ApiOperation(value="视频合成任务-添加", notes="视频合成任务-添加")
 	@PostMapping(value = "/add")
 	public Result<VideoMergeTask> add(@RequestBody VideoMergeTask videoMergeTask) {
-		Result<VideoMergeTask> result = new Result<VideoMergeTask>();
+        Result<VideoMergeTask> result = new Result<>();
 		try {
 			videoMergeTaskService.save(videoMergeTask);
 			result.success("添加成功!");
@@ -93,8 +74,8 @@ public class VideoMergeTaskController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  *  编辑
 	 * @param videoMergeTask
 	 * @return
@@ -103,7 +84,7 @@ public class VideoMergeTaskController {
 	@ApiOperation(value="视频合成任务-编辑", notes="视频合成任务-编辑")
 	@PutMapping(value = "/edit")
 	public Result<VideoMergeTask> edit(@RequestBody VideoMergeTask videoMergeTask) {
-		Result<VideoMergeTask> result = new Result<VideoMergeTask>();
+        Result<VideoMergeTask> result = new Result<>();
 		VideoMergeTask videoMergeTaskEntity = videoMergeTaskService.getById(videoMergeTask.getId());
 		if(videoMergeTaskEntity==null) {
 			result.error500("未找到对应实体");
@@ -113,11 +94,11 @@ public class VideoMergeTaskController {
 				result.success("修改成功!");
 			}
 		}
-		
-		return result;
+
+        return result;
 	}
-	
-	/**
+
+     /**
 	  *   通过id删除
 	 * @param id
 	 * @return
@@ -125,7 +106,7 @@ public class VideoMergeTaskController {
 	@AutoLog(value = "视频合成任务-通过id删除")
 	@ApiOperation(value="视频合成任务-通过id删除", notes="视频合成任务-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			videoMergeTaskService.removeById(id);
 		} catch (Exception e) {
@@ -134,8 +115,8 @@ public class VideoMergeTaskController {
 		}
 		return Result.ok("删除成功!");
 	}
-	
-	/**
+
+     /**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -144,7 +125,7 @@ public class VideoMergeTaskController {
 	@ApiOperation(value="视频合成任务-批量删除", notes="视频合成任务-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<VideoMergeTask> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<VideoMergeTask> result = new Result<VideoMergeTask>();
+        Result<VideoMergeTask> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -153,8 +134,8 @@ public class VideoMergeTaskController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  * 通过id查询
 	 * @param id
 	 * @return
@@ -163,7 +144,7 @@ public class VideoMergeTaskController {
 	@ApiOperation(value="视频合成任务-通过id查询", notes="视频合成任务-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<VideoMergeTask> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<VideoMergeTask> result = new Result<VideoMergeTask>();
+        Result<VideoMergeTask> result = new Result<>();
 		VideoMergeTask videoMergeTask = videoMergeTaskService.getById(id);
 		if(videoMergeTask==null) {
 			result.error500("未找到对应实体");
@@ -173,72 +154,4 @@ public class VideoMergeTaskController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<VideoMergeTask> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              VideoMergeTask videoMergeTask = JSON.parseObject(deString, VideoMergeTask.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(videoMergeTask, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<VideoMergeTask> pageList = videoMergeTaskService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "视频合成任务列表");
-      mv.addObject(NormalExcelConstants.CLASS, VideoMergeTask.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("视频合成任务列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
-
-  /**
-      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();
-          ImportParams params = new ImportParams();
-          params.setTitleRows(2);
-          params.setHeadRows(1);
-          params.setNeedSave(true);
-          try {
-              List<VideoMergeTask> listVideoMergeTasks = ExcelImportUtil.importExcel(file.getInputStream(), VideoMergeTask.class, params);
-              videoMergeTaskService.saveBatch(listVideoMergeTasks);
-              return Result.ok("文件导入成功!数据行数:" + listVideoMergeTasks.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
-
 }

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

@@ -1,37 +1,21 @@
 package org.jeecg.modules.ctop.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import cn.com.ctop.common.module.entity.VideoPart;
 import cn.com.ctop.common.module.service.IVideoPartService;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
-import java.util.Date;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
 
  /**
  * 视频片段
@@ -46,7 +30,7 @@ import io.swagger.annotations.ApiOperation;
 public class VideoPartController {
 	@Autowired
 	private IVideoPartService videoPartService;
-	
+
 	/**
 	  * 分页列表查询
 	 * @param videoPart
@@ -62,15 +46,15 @@ public class VideoPartController {
 												  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 												  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 												  HttpServletRequest req) {
-		Result<IPage<VideoPart>> result = new Result<IPage<VideoPart>>();
+        Result<IPage<VideoPart>> result = new Result<>();
 		QueryWrapper<VideoPart> queryWrapper = QueryGenerator.initQueryWrapper(videoPart, req.getParameterMap());
-		Page<VideoPart> page = new Page<VideoPart>(pageNo, pageSize);
+        Page<VideoPart> page = new Page<>(pageNo, pageSize);
 		IPage<VideoPart> pageList = videoPartService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
+
 	/**
 	  *   添加
 	 * @param videoPart
@@ -80,7 +64,7 @@ public class VideoPartController {
 	@ApiOperation(value="视频片段-添加", notes="视频片段-添加")
 	@PostMapping(value = "/add")
 	public Result<VideoPart> add(@RequestBody VideoPart videoPart) {
-		Result<VideoPart> result = new Result<VideoPart>();
+        Result<VideoPart> result = new Result<>();
 		try {
 			videoPartService.save(videoPart);
 			result.success("添加成功!");
@@ -90,7 +74,7 @@ public class VideoPartController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  *  编辑
 	 * @param videoPart
@@ -100,7 +84,7 @@ public class VideoPartController {
 	@ApiOperation(value="视频片段-编辑", notes="视频片段-编辑")
 	@PutMapping(value = "/edit")
 	public Result<VideoPart> edit(@RequestBody VideoPart videoPart) {
-		Result<VideoPart> result = new Result<VideoPart>();
+        Result<VideoPart> result = new Result<>();
 		VideoPart videoPartEntity = videoPartService.getById(videoPart.getId());
 		if(videoPartEntity==null) {
 			result.error500("未找到对应实体");
@@ -110,11 +94,11 @@ public class VideoPartController {
 				result.success("修改成功!");
 			}
 		}
-		
-		return result;
+
+        return result;
 	}
-	
-	/**
+
+     /**
 	  *   通过id删除
 	 * @param id
 	 * @return
@@ -122,7 +106,7 @@ public class VideoPartController {
 	@AutoLog(value = "视频片段-通过id删除")
 	@ApiOperation(value="视频片段-通过id删除", notes="视频片段-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			videoPartService.removeById(id);
 		} catch (Exception e) {
@@ -131,8 +115,8 @@ public class VideoPartController {
 		}
 		return Result.ok("删除成功!");
 	}
-	
-	/**
+
+     /**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -141,7 +125,7 @@ public class VideoPartController {
 	@ApiOperation(value="视频片段-批量删除", notes="视频片段-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<VideoPart> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<VideoPart> result = new Result<VideoPart>();
+        Result<VideoPart> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -150,8 +134,8 @@ public class VideoPartController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  * 通过id查询
 	 * @param id
 	 * @return
@@ -160,7 +144,7 @@ public class VideoPartController {
 	@ApiOperation(value="视频片段-通过id查询", notes="视频片段-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<VideoPart> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<VideoPart> result = new Result<VideoPart>();
+        Result<VideoPart> result = new Result<>();
 		VideoPart videoPart = videoPartService.getById(id);
 		if(videoPart==null) {
 			result.error500("未找到对应实体");
@@ -170,72 +154,4 @@ public class VideoPartController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<VideoPart> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              VideoPart videoPart = JSON.parseObject(deString, VideoPart.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(videoPart, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<VideoPart> pageList = videoPartService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "视频片段列表");
-      mv.addObject(NormalExcelConstants.CLASS, VideoPart.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("视频片段列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
-
-  /**
-      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();
-          ImportParams params = new ImportParams();
-          params.setTitleRows(2);
-          params.setHeadRows(1);
-          params.setNeedSave(true);
-          try {
-              List<VideoPart> listVideoParts = ExcelImportUtil.importExcel(file.getInputStream(), VideoPart.class, params);
-              videoPartService.saveBatch(listVideoParts);
-              return Result.ok("文件导入成功!数据行数:" + listVideoParts.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
-
 }

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTaskController.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.VideoWatermarkTask;
 import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
  /**
  * 水印任务表
@@ -62,9 +46,9 @@ public class VideoWatermarkTaskController {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<VideoWatermarkTask>> result = new Result<IPage<VideoWatermarkTask>>();
+        Result<IPage<VideoWatermarkTask>> result = new Result<>();
 		QueryWrapper<VideoWatermarkTask> queryWrapper = QueryGenerator.initQueryWrapper(videoWatermarkTask, req.getParameterMap());
-		Page<VideoWatermarkTask> page = new Page<VideoWatermarkTask>(pageNo, pageSize);
+        Page<VideoWatermarkTask> page = new Page<>(pageNo, pageSize);
 		IPage<VideoWatermarkTask> pageList = videoWatermarkTaskService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -80,7 +64,7 @@ public class VideoWatermarkTaskController {
 	@ApiOperation(value="水印任务表-添加", notes="水印任务表-添加")
 	@PostMapping(value = "/add")
 	public Result<VideoWatermarkTask> add(@RequestBody VideoWatermarkTask videoWatermarkTask) {
-		Result<VideoWatermarkTask> result = new Result<VideoWatermarkTask>();
+        Result<VideoWatermarkTask> result = new Result<>();
 		try {
 			videoWatermarkTaskService.save(videoWatermarkTask);
 			result.success("添加成功!");
@@ -100,7 +84,7 @@ public class VideoWatermarkTaskController {
 	@ApiOperation(value="水印任务表-编辑", notes="水印任务表-编辑")
 	@PutMapping(value = "/edit")
 	public Result<VideoWatermarkTask> edit(@RequestBody VideoWatermarkTask videoWatermarkTask) {
-		Result<VideoWatermarkTask> result = new Result<VideoWatermarkTask>();
+        Result<VideoWatermarkTask> result = new Result<>();
 		VideoWatermarkTask videoWatermarkTaskEntity = videoWatermarkTaskService.getById(videoWatermarkTask.getId());
 		if(videoWatermarkTaskEntity==null) {
 			result.error500("未找到对应实体");
@@ -122,7 +106,7 @@ public class VideoWatermarkTaskController {
 	@AutoLog(value = "水印任务表-通过id删除")
 	@ApiOperation(value="水印任务表-通过id删除", notes="水印任务表-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			videoWatermarkTaskService.removeById(id);
 		} catch (Exception e) {
@@ -141,7 +125,7 @@ public class VideoWatermarkTaskController {
 	@ApiOperation(value="水印任务表-批量删除", notes="水印任务表-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<VideoWatermarkTask> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<VideoWatermarkTask> result = new Result<VideoWatermarkTask>();
+        Result<VideoWatermarkTask> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -160,7 +144,7 @@ public class VideoWatermarkTaskController {
 	@ApiOperation(value="水印任务表-通过id查询", notes="水印任务表-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<VideoWatermarkTask> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<VideoWatermarkTask> result = new Result<VideoWatermarkTask>();
+        Result<VideoWatermarkTask> result = new Result<>();
 		VideoWatermarkTask videoWatermarkTask = videoWatermarkTaskService.getById(id);
 		if(videoWatermarkTask==null) {
 			result.error500("未找到对应实体");
@@ -170,72 +154,4 @@ public class VideoWatermarkTaskController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<VideoWatermarkTask> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              VideoWatermarkTask videoWatermarkTask = JSON.parseObject(deString, VideoWatermarkTask.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(videoWatermarkTask, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<VideoWatermarkTask> pageList = videoWatermarkTaskService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "水印任务表列表");
-      mv.addObject(NormalExcelConstants.CLASS, VideoWatermarkTask.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("水印任务表列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
-
-  /**
-      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();
-          ImportParams params = new ImportParams();
-          params.setTitleRows(2);
-          params.setHeadRows(1);
-          params.setNeedSave(true);
-          try {
-              List<VideoWatermarkTask> listVideoWatermarkTasks = ExcelImportUtil.importExcel(file.getInputStream(), VideoWatermarkTask.class, params);
-              videoWatermarkTaskService.saveBatch(listVideoWatermarkTasks);
-              return Result.ok("文件导入成功!数据行数:" + listVideoWatermarkTasks.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
-
 }

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

@@ -1,39 +1,21 @@
 package org.jeecg.modules.ctop.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
 import cn.com.ctop.common.module.entity.VideoWatermarkTemplate;
 import cn.com.ctop.common.module.service.IVideoWatermarkTemplateService;
-import java.util.Date;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
 
  /**
  * 水印模板
@@ -48,8 +30,8 @@ import io.swagger.annotations.ApiOperation;
 public class VideoWatermarkTemplateController {
 	@Autowired
 	private IVideoWatermarkTemplateService videoWatermarkTemplateService;
-	
-	/**
+
+     /**
 	  * 分页列表查询
 	 * @param videoWatermarkTemplate
 	 * @param pageNo
@@ -64,16 +46,16 @@ public class VideoWatermarkTemplateController {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<VideoWatermarkTemplate>> result = new Result<IPage<VideoWatermarkTemplate>>();
+        Result<IPage<VideoWatermarkTemplate>> result = new Result<>();
 		QueryWrapper<VideoWatermarkTemplate> queryWrapper = QueryGenerator.initQueryWrapper(videoWatermarkTemplate, req.getParameterMap());
-		Page<VideoWatermarkTemplate> page = new Page<VideoWatermarkTemplate>(pageNo, pageSize);
+        Page<VideoWatermarkTemplate> page = new Page<>(pageNo, pageSize);
 		IPage<VideoWatermarkTemplate> pageList = videoWatermarkTemplateService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
-	/**
+
+     /**
 	  *   添加
 	 * @param videoWatermarkTemplate
 	 * @return
@@ -82,7 +64,7 @@ public class VideoWatermarkTemplateController {
 	@ApiOperation(value="水印模板-添加", notes="水印模板-添加")
 	@PostMapping(value = "/add")
 	public Result<VideoWatermarkTemplate> add(@RequestBody VideoWatermarkTemplate videoWatermarkTemplate) {
-		Result<VideoWatermarkTemplate> result = new Result<VideoWatermarkTemplate>();
+        Result<VideoWatermarkTemplate> result = new Result<>();
 		try {
 			videoWatermarkTemplateService.save(videoWatermarkTemplate);
 			result.success("添加成功!");
@@ -92,8 +74,8 @@ public class VideoWatermarkTemplateController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  *  编辑
 	 * @param videoWatermarkTemplate
 	 * @return
@@ -102,7 +84,7 @@ public class VideoWatermarkTemplateController {
 	@ApiOperation(value="水印模板-编辑", notes="水印模板-编辑")
 	@PutMapping(value = "/edit")
 	public Result<VideoWatermarkTemplate> edit(@RequestBody VideoWatermarkTemplate videoWatermarkTemplate) {
-		Result<VideoWatermarkTemplate> result = new Result<VideoWatermarkTemplate>();
+        Result<VideoWatermarkTemplate> result = new Result<>();
 		VideoWatermarkTemplate videoWatermarkTemplateEntity = videoWatermarkTemplateService.getById(videoWatermarkTemplate.getId());
 		if(videoWatermarkTemplateEntity==null) {
 			result.error500("未找到对应实体");
@@ -112,11 +94,11 @@ public class VideoWatermarkTemplateController {
 				result.success("修改成功!");
 			}
 		}
-		
-		return result;
+
+        return result;
 	}
-	
-	/**
+
+     /**
 	  *   通过id删除
 	 * @param id
 	 * @return
@@ -124,7 +106,7 @@ public class VideoWatermarkTemplateController {
 	@AutoLog(value = "水印模板-通过id删除")
 	@ApiOperation(value="水印模板-通过id删除", notes="水印模板-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			videoWatermarkTemplateService.removeById(id);
 		} catch (Exception e) {
@@ -133,8 +115,8 @@ public class VideoWatermarkTemplateController {
 		}
 		return Result.ok("删除成功!");
 	}
-	
-	/**
+
+     /**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -143,7 +125,7 @@ public class VideoWatermarkTemplateController {
 	@ApiOperation(value="水印模板-批量删除", notes="水印模板-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<VideoWatermarkTemplate> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<VideoWatermarkTemplate> result = new Result<VideoWatermarkTemplate>();
+        Result<VideoWatermarkTemplate> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -152,8 +134,8 @@ public class VideoWatermarkTemplateController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  * 通过id查询
 	 * @param id
 	 * @return
@@ -162,7 +144,7 @@ public class VideoWatermarkTemplateController {
 	@ApiOperation(value="水印模板-通过id查询", notes="水印模板-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<VideoWatermarkTemplate> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<VideoWatermarkTemplate> result = new Result<VideoWatermarkTemplate>();
+        Result<VideoWatermarkTemplate> result = new Result<>();
 		VideoWatermarkTemplate videoWatermarkTemplate = videoWatermarkTemplateService.getById(id);
 		if(videoWatermarkTemplate==null) {
 			result.error500("未找到对应实体");
@@ -172,72 +154,4 @@ public class VideoWatermarkTemplateController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<VideoWatermarkTemplate> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              VideoWatermarkTemplate videoWatermarkTemplate = JSON.parseObject(deString, VideoWatermarkTemplate.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(videoWatermarkTemplate, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<VideoWatermarkTemplate> pageList = videoWatermarkTemplateService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "水印模板列表");
-      mv.addObject(NormalExcelConstants.CLASS, VideoWatermarkTemplate.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("水印模板列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
-
-  /**
-      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();
-          ImportParams params = new ImportParams();
-          params.setTitleRows(2);
-          params.setHeadRows(1);
-          params.setNeedSave(true);
-          try {
-              List<VideoWatermarkTemplate> listVideoWatermarkTemplates = ExcelImportUtil.importExcel(file.getInputStream(), VideoWatermarkTemplate.class, params);
-              videoWatermarkTemplateService.saveBatch(listVideoWatermarkTemplates);
-              return Result.ok("文件导入成功!数据行数:" + listVideoWatermarkTemplates.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
-
 }

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

@@ -20,8 +20,8 @@ import javax.servlet.http.HttpServletRequest;
  * @author yumeng
  * 2019年11月12日10:04:00
  */
-@RestController
 @Slf4j
+@RestController
 @RequestMapping("/ctop/yard")
 public class YardController {
     @Autowired
@@ -35,28 +35,10 @@ public class YardController {
     @Autowired
     private IYardCommentService yardCommentService;
 
-    @ResponseBody
-    @RequestMapping(value = "/detail", method = RequestMethod.GET)
+    @GetMapping("/detail")
     public Result<Yard> getDetail(@RequestParam(name = "id") Long id) {
         Result<Yard> result = new Result<>();
         Yard yard = yardService.getById(id);
-//        YardPhoto yardPhoto = new YardPhoto();
-//        YardVideo yardVideo = new YardVideo();
-//        YardScheduler yardScheduler = new YardScheduler();
-//        yardPhoto.setYardId(yardId);
-//        yardVideo.setYardId(yardId);
-//        yardScheduler.setYardId(yardId);
-//        QueryWrapper<YardPhoto> yardPhotoQueryWrapper = QueryGenerator.initQueryWrapper(yardPhoto, null);
-//        QueryWrapper<YardVideo> yardVideoQueryWrapper = QueryGenerator.initQueryWrapper(yardVideo, null);
-//        QueryWrapper<YardScheduler> yardSchedulerQueryWrapper = QueryGenerator.initQueryWrapper(yardScheduler, null);
-//        List<YardPhoto> yardPhotoList = yardPhotoService.list(yardPhotoQueryWrapper);
-//        List<YardVideo> yardVideoList = yardVideoService.list(yardVideoQueryWrapper);
-//        List<YardScheduler> yardSchedulerList = yardSchedulerService.list(yardSchedulerQueryWrapper);
-//        Map<String, Object> map = new HashMap<String, Object>();
-//        map.put("yard", yard);
-//        map.put("yardPhotoList", yardPhotoList);
-//        map.put("yardVideoList", yardVideoList);
-//        map.put("yardSchedulerList", yardSchedulerList);
         result.setResult(yard);
         result.setSuccess(true);
         return result;
@@ -64,25 +46,9 @@ public class YardController {
 
     @PostMapping(value = "/add")
     public Result<Yard> add(@RequestBody Yard yard) {
-        Result<Yard> result = new Result<Yard>();
+        Result<Yard> result = new Result<>();
         try {
             yardService.save(yard);
-//            if (yard.getImageUrl() != null && yard.getImageUrl().size() > 0) {
-//                for (String url : yard.getImageUrl()) {
-//                    YardPhoto yardPhoto = new YardPhoto();
-//                    yardPhoto.setYardId(yard.getId());
-//                    yardPhoto.setPhotoUrl("http:" + url);
-//                    yardPhotoService.save(yardPhoto);
-//                }
-//            }
-//            if (yard.getVideoUrl() != null && yard.getVideoUrl().size() > 0) {
-//                for (String url : yard.getVideoUrl()) {
-//                    YardVideo yardVideo = new YardVideo();
-//                    yardVideo.setYardId(yard.getId());
-//                    yardVideo.setVideoUrl("http:" + url);
-//                    yardVideoService.save(yardVideo);
-//                }
-//            }
             result.success("添加成功!");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -93,39 +59,13 @@ public class YardController {
 
     @PutMapping(value = "/edit")
     public Result<Yard> edit(@RequestBody Yard yard) {
-        Result<Yard> result = new Result<Yard>();
+        Result<Yard> result = new Result<>();
 
         Yard yardEntity = yardService.getById(yard.getId());
         if (yardEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = yardService.updateById(yard);
-//            YardPhoto yardPhoto = new YardPhoto();
-//            yardPhoto.setYardId(yard.getId());
-//            QueryWrapper photoQueryWrapper = QueryGenerator.initQueryWrapper(yardPhoto, null);
-//            yardPhotoService.remove(photoQueryWrapper);
-//
-//            YardVideo yardVideo = new YardVideo();
-//            yardVideo.setYardId(yard.getId());
-//            QueryWrapper videoQueryWrapper = QueryGenerator.initQueryWrapper(yardVideo, null);
-//            yardVideoService.remove(videoQueryWrapper);
-//            if (yard.getImageUrl() != null && yard.getImageUrl().size() > 0) {
-//                for (String url : yard.getImageUrl()) {
-//                    YardPhoto photo = new YardPhoto();
-//                    photo.setYardId(yard.getId());
-//                    photo.setPhotoUrl("http:" + url);
-//                    yardPhotoService.save(photo);
-//                }
-//            }
-//            if (yard.getVideoUrl() != null && yard.getVideoUrl().size() > 0) {
-//                for (String url : yard.getVideoUrl()) {
-//                    YardVideo video = new YardVideo();
-//                    video.setYardId(yard.getId());
-//                    video.setVideoUrl("http:" + url);
-//                    yardVideoService.save(video);
-//                }
-//            }
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -153,10 +93,10 @@ public class YardController {
                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                        HttpServletRequest req) {
-        Result<IPage<YardPhoto>> result = new Result<IPage<YardPhoto>>();
+        Result<IPage<YardPhoto>> result = new Result<>();
 
         QueryWrapper<YardPhoto> queryWrapper = QueryGenerator.initQueryWrapper(yardPhoto, req.getParameterMap());
-        Page<YardPhoto> page = new Page<YardPhoto>(pageNo, pageSize);
+        Page<YardPhoto> page = new Page<>(pageNo, pageSize);
         IPage<YardPhoto> pageList = yardPhotoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -168,10 +108,10 @@ public class YardController {
                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
-        Result<IPage<YardComment>> result = new Result<IPage<YardComment>>();
+        Result<IPage<YardComment>> result = new Result<>();
 
         QueryWrapper<YardComment> queryWrapper = QueryGenerator.initQueryWrapper(yardComment, req.getParameterMap());
-        Page<YardComment> page = new Page<YardComment>(pageNo, pageSize);
+        Page<YardComment> page = new Page<>(pageNo, pageSize);
         IPage<YardComment> pageList = yardCommentService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -180,7 +120,7 @@ public class YardController {
 
     @DeleteMapping(value = "/comment/delete")
     public Result<YardComment> deleteComment(@RequestParam(name = "id", required = true) String id) {
-        Result<YardComment> result = new Result<YardComment>();
+        Result<YardComment> result = new Result<>();
         YardComment yardComment = yardCommentService.getById(id);
         if (yardComment == null) {
             result.error500("未找到对应实体");
@@ -195,7 +135,7 @@ public class YardController {
 
     @DeleteMapping(value = "/video/delete")
     public Result<YardVideo> deleteVideo(@RequestParam(name = "id", required = true) String id) {
-        Result<YardVideo> result = new Result<YardVideo>();
+        Result<YardVideo> result = new Result<>();
         YardVideo yardVideo = yardVideoService.getById(id);
         if (yardVideo == null) {
             result.error500("未找到对应实体");
@@ -210,7 +150,7 @@ public class YardController {
 
     @DeleteMapping(value = "/photo/delete")
     public Result<YardPhoto> deletePhoto(@RequestParam(name = "id", required = true) String id) {
-        Result<YardPhoto> result = new Result<YardPhoto>();
+        Result<YardPhoto> result = new Result<>();
         YardPhoto yardPhoto = yardPhotoService.getById(id);
         if (yardPhoto == null) {
             result.error500("未找到对应实体");
@@ -225,7 +165,7 @@ public class YardController {
 
     @PostMapping(value = "/comment/add")
     public Result<YardComment> addComment(YardComment yardComment) {
-        Result<YardComment> result = new Result<YardComment>();
+        Result<YardComment> result = new Result<>();
         try {
             yardCommentService.save(yardComment);
             result.success("添加成功!");
@@ -238,7 +178,7 @@ public class YardController {
 
     @PostMapping(value = "/video/add")
     public Result<YardVideo> addVideo(YardVideo yardVideo) {
-        Result<YardVideo> result = new Result<YardVideo>();
+        Result<YardVideo> result = new Result<>();
         try {
             yardVideoService.save(yardVideo);
             result.success("添加成功!");
@@ -251,7 +191,7 @@ public class YardController {
 
     @PostMapping(value = "/photo/add")
     public Result<YardPhoto> addPhoto(YardPhoto yardPhoto) {
-        Result<YardPhoto> result = new Result<YardPhoto>();
+        Result<YardPhoto> result = new Result<>();
         try {
             yardPhotoService.save(yardPhoto);
             result.success("添加成功!");
@@ -267,10 +207,10 @@ public class YardController {
                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                        HttpServletRequest req) {
-        Result<IPage<YardVideo>> result = new Result<IPage<YardVideo>>();
+        Result<IPage<YardVideo>> result = new Result<>();
 
         QueryWrapper<YardVideo> queryWrapper = QueryGenerator.initQueryWrapper(yardVideo, req.getParameterMap());
-        Page<YardVideo> page = new Page<YardVideo>(pageNo, pageSize);
+        Page<YardVideo> page = new Page<>(pageNo, pageSize);
         IPage<YardVideo> pageList = yardVideoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 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

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

@@ -1,107 +0,0 @@
-package org.jeecg.modules.ctop.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-
-/**
- * 头条-数据清洗
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-25
- */
-@Data
-@TableName("ctop_bytedance_clean_material_report")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_bytedance_clean_material_report对象", description = "头条-数据清洗")
-public class ByteDanceCleanMaterialReport {
-
-    /**
-     * md5 为id
-     */
-    @TableId(type = IdType.UUID)
-    @ApiModelProperty(value = "md5 为id")
-    private String id;
-    /**
-     * 花费(元)
-     */
-    @Excel(name = "花费(元)", width = 15)
-    @ApiModelProperty(value = "花费(元)")
-    private java.math.BigDecimal cost;
-    /**
-     * 展示量
-     */
-    @Excel(name = "展示量", width = 15)
-    @ApiModelProperty(value = "展示量")
-    private Integer showNum;
-    /**
-     * 点击量
-     */
-    @Excel(name = "点击量", width = 15)
-    @ApiModelProperty(value = "点击量")
-    private Integer click;
-    /**
-     * 转化量
-     */
-    @Excel(name = "转化量", width = 15)
-    @ApiModelProperty(value = "转化量")
-    private Integer convertNum;
-    /**
-     * 激活
-     */
-    @Excel(name = "激活", width = 15)
-    @ApiModelProperty(value = "激活")
-    private Integer active;
-    /**
-     * 下载-注册
-     */
-    @Excel(name = "下载-注册", width = 15)
-    @ApiModelProperty(value = "下载-注册")
-    private Integer register;
-    /**
-     * 表单提交
-     */
-    @Excel(name = "表单提交", width = 15)
-    @ApiModelProperty(value = "表单提交")
-    private Integer form;
-    /**
-     * 视频-总播放
-     */
-    @Excel(name = "视频-总播放", width = 15)
-    @ApiModelProperty(value = "视频-总播放")
-    private Integer totalPlay;
-    /**
-     * 视频-有效播放
-     */
-    @Excel(name = "视频-有效播放", width = 15)
-    @ApiModelProperty(value = "视频-有效播放")
-    private Integer validPlay;
-    /**
-     * 创建时间
-     */
-    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @ApiModelProperty(value = "创建时间")
-    private Date createTime;
-    /**
-     * 修改时间
-     */
-    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @ApiModelProperty(value = "修改时间")
-    private Date updateTime;
-}

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

@@ -1,135 +0,0 @@
-package org.jeecg.modules.ctop.entity;
-
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import com.alibaba.fastjson.JSONObject;
-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-04-08
- */
-@Data
-@TableName("ctop_bytedance_fund_daily")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_bytedance_fund_daily对象", description = "账号日流水信息")
-public class BytedanceFundDaily {
-
-    /**
-     * id
-     */
-    @TableId
-    @ApiModelProperty(value = "id")
-    private String id;
-    /**
-     * 广告主id
-     */
-    @Excel(name = "广告主id", width = 15)
-    @ApiModelProperty(value = "广告主id")
-    private Long advertiserId;
-    /**
-     * 日期
-     */
-    @Excel(name = "日期", width = 15)
-    @ApiModelProperty(value = "日期")
-    private String date;
-    /**
-     * 日终结于
-     */
-    @Excel(name = "日终结余", width = 15)
-    @ApiModelProperty(value = "日终结于")
-    private java.math.BigDecimal balance;
-    /**
-     * 现金支出
-     */
-    @Excel(name = "现金支出", width = 15)
-    @ApiModelProperty(value = "现金支出")
-    private java.math.BigDecimal cashCost;
-    /**
-     * 总支出
-     */
-    @Excel(name = "总支出", width = 15)
-    @ApiModelProperty(value = "总支出")
-    private java.math.BigDecimal cost;
-    /**
-     * 冻结
-     */
-    @Excel(name = "冻结", width = 15)
-    @ApiModelProperty(value = "冻结")
-    private java.math.BigDecimal frozen;
-    /**
-     * 总存入
-     */
-    @Excel(name = "总存入", width = 15)
-    @ApiModelProperty(value = "总存入")
-    private java.math.BigDecimal income;
-    /**
-     * 赠款支出
-     */
-    @Excel(name = "赠款支出", width = 15)
-    @ApiModelProperty(value = "赠款支出")
-    private java.math.BigDecimal rewardCost;
-    /**
-     * 返货支出
-     */
-    @Excel(name = "返货支出", width = 15)
-    @ApiModelProperty(value = "返货支出")
-    private java.math.BigDecimal returnGoodsCos;
-    /**
-     * 总转入
-     */
-    @Excel(name = "总转入", width = 15)
-    @ApiModelProperty(value = "总转入")
-    private java.math.BigDecimal transferIn;
-    /**
-     * 总转出
-     */
-    @Excel(name = "总转出", width = 15)
-    @ApiModelProperty(value = "总转出")
-    private java.math.BigDecimal transferOut;
-    /**
-     * createTime
-     */
-    @ApiModelProperty(value = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @ApiModelProperty(value = "updateTime")
-    private Date updateTime;
-
-    public BytedanceFundDaily(JSONObject data, CtopOauthToken token) {
-        System.out.println(data.toJSONString());
-        this.advertiserId = token.getAccountId();
-        this.date = data.getString("date");
-        this.id = this.advertiserId + "_" + this.date;
-        this.balance = data.getBigDecimal("balance");
-        this.cashCost = data.getBigDecimal("cash_cost");
-        this.cost = data.getBigDecimal("cost");
-        this.frozen = data.getBigDecimal("frozen");
-        this.income = data.getBigDecimal("income");
-        this.rewardCost = data.getBigDecimal("reward_cost");
-        this.returnGoodsCos = data.getBigDecimal("return_goods_cost");
-        this.transferIn = data.getBigDecimal("transfer_in");
-        this.transferOut = data.getBigDecimal("transfer_out");
-        this.createTime = new Date();
-        this.updateTime = new Date();
-    }
-
-    public BytedanceFundDaily() {
-        this.createTime = new Date();
-        this.updateTime = new Date();
-    }
-}

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

@@ -32,6 +32,7 @@ public class DramaInfo {
 	private Integer nonpublic;
 	private String introduction;
 	private Integer status;
+    private Integer enabled;
     /**
      * 场景
      */

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

@@ -1,100 +0,0 @@
-package org.jeecg.modules.ctop.entity;
-
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-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-04-22
- */
-@Data
-@TableName("ctop_edu_lesson_new")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_edu_lesson_new对象", description = "内部培训视频信息")
-public class EduLessonNew {
-
-    /**
-     * id
-     */
-    @TableId(type = IdType.UUID)
-    @ApiModelProperty(value = "id")
-    private Integer id;
-    /**
-     * name
-     */
-    @Excel(name = "name", width = 15)
-    @ApiModelProperty(value = "name")
-    private String name;
-    /**
-     * 文件类型
-     */
-    @Excel(name = "文件类型", width = 15)
-    @ApiModelProperty(value = "文件类型")
-    private Integer fileType;
-    /**
-     * 节点类型
-     */
-    @Excel(name = "节点类型", width = 15)
-    @ApiModelProperty(value = "节点类型")
-    private Integer nodeType;
-    /**
-     * 父id
-     */
-    @Excel(name = "父id", width = 15)
-    @ApiModelProperty(value = "父id")
-    private Integer parentId;
-    /**
-     * author
-     */
-    @Excel(name = "author", width = 15)
-    @ApiModelProperty(value = "author")
-    private String author;
-    /**
-     * desc
-     */
-    @Excel(name = "desc", width = 15)
-    @ApiModelProperty(value = "desc")
-    private String desc;
-    /**
-     * fileId
-     */
-    @Excel(name = "fileId", width = 15)
-    @ApiModelProperty(value = "fileId")
-    private String fileId;
-    /**
-     * enabled
-     */
-    @Excel(name = "enabled", width = 15)
-    @ApiModelProperty(value = "enabled")
-    private Integer enabled;
-    /**
-     * createTime
-     */
-    @ApiModelProperty(value = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @ApiModelProperty(value = "updateTime")
-    private Date updateTime;
-
-    public EduLessonNew() {
-        this.enabled = CtopAdConstant.COMMON_STATUS_ENABLED;
-        this.createTime = new Date();
-        this.updateTime = new Date();
-    }
-}

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

@@ -1,93 +0,0 @@
-package org.jeecg.modules.ctop.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-
-/**
- * 快手素材清洗数据
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-24
- */
-@Data
-@TableName("ctop_kuaishou_clean_material_report")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_kuaishou_clean_material_report对象", description = "快手素材清洗数据")
-public class KuaiShouCleanMaterialReport {
-
-    /**
-     * signature
-     */
-    @Excel(name = "id", width = 15)
-    @ApiModelProperty(value = "id")
-    private String id;
-    /**
-     * 花费(元)
-     */
-    @Excel(name = "花费(元)", width = 15)
-    @ApiModelProperty(value = "花费(元)")
-    private java.math.BigDecimal charge;
-    /**
-     * 曝光数
-     */
-    @Excel(name = "曝光数", width = 15)
-    @ApiModelProperty(value = "曝光数")
-    private Integer photoShow;
-    /**
-     * 封面点击数
-     */
-    @Excel(name = "封面点击数", width = 15)
-    @ApiModelProperty(value = "封面点击数")
-    private Integer photoClick;
-    /**
-     * 点击数
-     */
-    @Excel(name = "点击数", width = 15)
-    @ApiModelProperty(value = "点击数")
-    private Integer aclick;
-    /**
-     * 行为数
-     */
-    @Excel(name = "行为数", width = 15)
-    @ApiModelProperty(value = "行为数")
-    private Integer bclick;
-    /**
-     * 激活数
-     */
-    @Excel(name = "激活数", width = 15)
-    @ApiModelProperty(value = "激活数")
-    private Integer activation;
-    /**
-     * 表单提交数
-     */
-    @Excel(name = "表单提交数", width = 15)
-    @ApiModelProperty(value = "表单提交数")
-    private Integer formCount;
-    /**
-     * 创建时间
-     */
-    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @ApiModelProperty(value = "创建时间")
-    private Date createTime;
-    /**
-     * 修改时间
-     */
-    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @ApiModelProperty(value = "修改时间")
-    private Date updateTime;
-}

+ 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;
     /**
      * 创建人
      */

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java

@@ -13,6 +13,7 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -27,7 +28,7 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @ApiModel(value = "ctop_project_member对象", description = "项目成员")
-public class ProjectMember {
+public class ProjectMember implements  Serializable{
 
     /**
      * id

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

@@ -0,0 +1,46 @@
+package org.jeecg.modules.ctop.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
+ * @date   2020-06-10
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_release_record")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_release_record对象", description="发版记录信息")
+public class ReleaseRecord {
+
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Long id;
+	/**版本号*/
+	@Excel(name = "版本号", width = 15)
+    @ApiModelProperty(value = "版本号")
+	private String version;
+	/**更新详情*/
+	@Excel(name = "更新详情", width = 15)
+    @ApiModelProperty(value = "更新详情")
+	private String detail;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

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

@@ -0,0 +1,46 @@
+package org.jeecg.modules.ctop.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
+ * @date   2020-06-10
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_release_view_record")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_release_view_record对象", description="发版记录信息")
+public class ReleaseViewRecord {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+	private Long id;
+	/**userId*/
+	@Excel(name = "userId", width = 15)
+    @ApiModelProperty(value = "userId")
+	private String userId;
+	/**版本id*/
+	@Excel(name = "版本id", width = 15)
+    @ApiModelProperty(value = "版本id")
+	private Long releaseId;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

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

@@ -21,13 +21,6 @@ public class AccountBidJob implements Job {
      */
     @Override
     public void execute(JobExecutionContext jobExecutionContext) {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                bidWarningService.BidWarning();
-            }
-        };
-        thread.start();
-
+        bidWarningService.BidWarning();
     }
 }

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

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -23,8 +22,6 @@ import java.util.concurrent.Executors;
 public class AccountCpaBidJob implements Job {
     @Autowired
     private ICpaBidWarningService cpaBidWarningService;
-    @Autowired
-    private ICtopOauthTokenService tokenService;
     static ExecutorService executorService = null;
     @Autowired
     private IProjectService projectService;
@@ -38,8 +35,6 @@ public class AccountCpaBidJob implements Job {
     @Override
     public void execute(JobExecutionContext jobExecutionContext) {
         Thread thread = new Thread() {
-
-
             @Override
             public void run() {
                 executorService = Executors.newFixedThreadPool(4);
@@ -59,7 +54,6 @@ public class AccountCpaBidJob implements Job {
                         });
                     }
                     executorService.shutdown();
-
                 }
             }
         };

+ 4 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceCleanMaterialJob.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.modules.ctop.service.ICleanMaterialService;
 import org.quartz.Job;
@@ -17,7 +18,7 @@ import java.util.concurrent.Executors;
 @Slf4j
 public class ByteDanceCleanMaterialJob implements Job {
     @Autowired
-    private ICleanMaterialService cleanMaterialService;
+    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
     static ExecutorService executorService = null;
 
     @Override
@@ -25,7 +26,7 @@ public class ByteDanceCleanMaterialJob implements Job {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                List<String> signatureList = cleanMaterialService.getByteDanceSignature();
+                List<String> signatureList = byteDanceCleanMaterialReportService.getSignature();
                 if (Check.isNull(signatureList)) {
                     log.error("头条素材数据获取为空");
                     return;
@@ -36,7 +37,7 @@ public class ByteDanceCleanMaterialJob implements Job {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
-                            cleanMaterialService.calculationByteDanceReport(signature);
+                            byteDanceCleanMaterialReportService.calculationMaterialReport(signature);
                         }
                     });
                 }

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

@@ -1,9 +1,9 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.bytedance.service.IByteDanceHourlyAccountWarningService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceHourlyAccountWarningService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;

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

@@ -0,0 +1,30 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.service.IRefreshTokenService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class ByteDanceRefreshTokenJob implements Job {
+    @Autowired
+    private IRefreshTokenService refreshTokenService;
+
+    /**
+     * 刷新token
+     *
+     * @param jobExecutionContext
+     * @throws JobExecutionException
+     */
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                refreshTokenService.byteDanceRefresh();
+            }
+        };
+        thread.start();
+
+    }
+}

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

@@ -1,9 +1,9 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -29,27 +29,16 @@ public class BytedanceAdvertiserDailyReportLoadJob implements Job {
     private IReportService reportService;
     static ExecutorService executorService = null;
 
-
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         Date getDate = DateUtils.addDay(new Date(), -1);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             log.info("定时获取头条数据异常:为获取到可用的token");
             return;
         }
         executorService = Executors.newFixedThreadPool(5);
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    //获取广告主信息数据
-                    reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-                }
-            });
-        });
+        tokens.forEach(token -> executorService.submit(() -> reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY)));
     }
-
-
 }

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

@@ -3,8 +3,8 @@ package org.jeecg.modules.ctop.job;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
-import cn.com.ctop.toutiao.service.IByteDanceCreativeService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
@@ -38,24 +38,14 @@ public class BytedanceAdvertiserDataLoadJob implements Job {
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
         executorService = Executors.newFixedThreadPool(5);
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        //1:获取当日广告组数据
-                        advertiserDataService.getAdvertiserCampaign(token.getAccountId() + "", "", dateString);
-                        //2:获取当日广告计划数据
-                        advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
-                        //3:获取当日创意数据
-                        creativeService.getAdvertiserCreative(token.getAccountId() + "", "", dateString);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                    }
-                }
-            });
-        });
+        tokens.forEach(token -> executorService.submit(() -> {
+            //1:获取当日广告组数据
+            advertiserDataService.getAdvertiserCampaign(token.getAccountId() + "", "", dateString);
+            //2:获取当日广告计划数据
+            advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
+            //3:获取当日创意数据
+            creativeService.getAdvertiserCreative(token.getAccountId() + "", "", dateString);
+        }));
         log.info("物料数据同步完成");
     }
 }

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

@@ -1,9 +1,9 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;

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

@@ -1,9 +1,9 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;

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

@@ -1,9 +1,9 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;

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

@@ -0,0 +1,45 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 头条素材报表按天跑前一天的数据任务
+ *
+ * @author sunzhen
+ */
+@Slf4j
+public class BytedanceDailyAccountReportAsyncJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        String date = DateUtils.formatDate(getDate);
+        log.info("头条异步广告主报表执行开始。跑的是:" + date + "的数据");
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("头条获取异步报表数据任务执行失败:未获取到可用的token");
+            return;
+        }
+
+        for (CtopOauthToken token : tokens) {
+            bytedanceReportService.bytedanceAsyncTaskCreate(date, date, token, 2);  //1.创意 2.广告主 3.广告主 4.广告计划
+        }
+
+    }
+}

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

@@ -0,0 +1,51 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 头条数据异步报表  获取前一天绑定的账户,跑从2020-01-01到前一天的数据;目的是防止新绑定账户数据缺失;
+ *
+ * @author sunzhen
+ */
+@Slf4j
+public class BytedanceDailyAsyncJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String startDate = "2020-01-01";
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        String endDate = DateUtils.formatDate(getDate);
+
+        log.info("头条数据异步报表  获取前一天绑定的账户,跑从2020-01-01到前一天的数据,时间为:" + startDate + "~" + endDate + "的数据");
+
+        List<CtopOauthToken> tokens = tokenService.getToutiaoTokenByCreateTime(endDate);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("头条获取异步报表数据任务执行失败:未获取到可用的token");
+            return;
+        }
+
+        //1.创意 2.广告主 3.广告组 4.广告计划
+        for (CtopOauthToken token : tokens) {
+            bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, 1);
+            bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, 2);
+            bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, 3);
+            bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, 4);
+        }
+
+    }
+}

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

@@ -0,0 +1,45 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 头条素材报表按天跑前一天的数据任务
+ *
+ * @author sunzhen
+ */
+@Slf4j
+public class BytedanceDailyCampaignReportAsyncJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        String date = DateUtils.formatDate(getDate);
+        log.info("头条异步广告组报表数据执行开始,跑的是" + date + "的数据");
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("头条获取异步报表数据任务执行失败:未获取到可用的token");
+            return;
+        }
+
+        for (CtopOauthToken token : tokens) {
+            bytedanceReportService.bytedanceAsyncTaskCreate(date, date, token, 3);  //1.创意 2.广告主 3.广告组 4.广告计划
+        }
+
+    }
+}

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

@@ -0,0 +1,46 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 头条素材报表按天跑前一天的数据任务
+ *
+ * @author sunzhen
+ */
+@Slf4j
+public class BytedanceDailyCreativeReportAsyncJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        String date = DateUtils.formatDate(getDate);
+        log.info("头条创意报表异步任务执行开始.跑的是" + date + "的数据");
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("头条获取异步报表数据任务执行失败:未获取到可用的token");
+            return;
+        }
+
+        for (CtopOauthToken token : tokens) {
+            //1.创意 2.广告主 3.广告主 4.广告计划
+            bytedanceReportService.bytedanceAsyncTaskCreate(date, date, token, 1);
+        }
+
+    }
+}

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

@@ -0,0 +1,64 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 头条素材报表按天跑前一天的数据任务
+ *
+ * @author sunzhen
+ */
+@Slf4j
+public class BytedanceDailyMaterialReportJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Date getDate2 = DateUtils.addDay(new Date(), -2);
+        String date2 = DateUtils.formatDate(getDate2);
+
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        String date = DateUtils.formatDate(getDate);
+        log.info("头条获取素材报表数据任务开始,任务时间:" + date2 + "~" + date);
+
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("头条获取素材报表数据任务执行失败:未获取到可用的token");
+            return;
+        }
+
+        final ExecutorService executorService = Executors.newFixedThreadPool(3);
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        //获取头条素材报表两天前的数据
+                        bytedanceReportService.bytedanceMaterialReport(token, date2, date2);
+                        //获取头条素材报表数据
+                        bytedanceReportService.bytedanceMaterialReport(token, date, date);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                    }
+                }
+            });
+        });
+
+    }
+}

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

@@ -0,0 +1,75 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+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.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 头条素材报表错误重试定时任务
+ *
+ * @author sunzhen
+ */
+@Slf4j
+public class BytedanceDailyMaterialReportRetryJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        log.info("头条素材报表重试定时任务开始");
+        List<BytedanceReportMaterialRetry> retryList = bytedanceReportService.getRetryList();
+        //
+        //多线程
+        final ExecutorService executorService = Executors.newFixedThreadPool(3);
+        retryList.forEach(retry -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        String startDate = retry.getStartDate();
+                        String endDate = retry.getEndDate();
+                        Long accountId = retry.getAccountId();
+                        Integer type = retry.getType();
+                        CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
+                        log.info("头条素材报表重试定时任务,当前accountId为:" + token.getAccountId());
+
+                        Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
+                        String start = null;
+                        String end = null;
+                        for (int i = 0; i <= days; i++) {
+                            start = DateUtils.addDay(startDate, i);
+                            end = start;
+                            //获取头条素材报表数据
+                            int code = bytedanceReportService.bytedanceMaterialReportRetry(type, token, start, end);
+                            if(code ==200 || code == 1){
+                                if(type == 1){
+                                    //重试成功清洗数据
+                                    byteDanceVideoReportDailyService.videoInfoListByAccountId(start,end,accountId);
+                                }
+                            }
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                    }
+                }
+            });
+        });
+    }
+}

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

@@ -0,0 +1,46 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 头条素材报表按天跑前一天的数据任务
+ *
+ * @author sunzhen
+ */
+@Slf4j
+public class BytedanceDailyPlanReportAsyncJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        String date = DateUtils.formatDate(getDate);
+        log.info("头条广告计划异步任务开始执行,跑的是" + date + "的数据");
+
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("头条获取异步报表数据任务执行失败:未获取到可用的token");
+            return;
+        }
+
+        for (CtopOauthToken token : tokens) {
+            bytedanceReportService.bytedanceAsyncTaskCreate(date, date, token, 4);  //1.创意 2.广告主 3.广告组 4.广告计划
+        }
+
+    }
+}

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

@@ -0,0 +1,33 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 头条素材报表按天跑前一天的数据任务
+ *
+ * @author sunzhen
+ */
+@Slf4j
+public class BytedanceDailyReportAsyncTaskGetJob implements Job {
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        try {
+            log.info("头条获取素材报表数据定时任务执行开始");
+            Long starttime = System.currentTimeMillis();
+            bytedanceReportService.bytedanceAsyncTaskGet();
+            Long endtime = System.currentTimeMillis();
+            log.info("头条异步报表数据定时任务执行结束,执行耗时:{}秒", (endtime - starttime) / 1000);
+        } catch (Exception e) {
+            log.error("头条获取异步报表数据定时任务执行报错");
+            e.printStackTrace();
+        }
+    }
+}

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


Неке датотеке нису приказане због велике количине промена