Преглед на файлове

Merge remote-tracking branch 'origin/test' into test

# Conflicts:
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
jiequan.bi преди 4 години
родител
ревизия
5cfc50c772
променени са 100 файла, в които са добавени 3477 реда и са изтрити 401 реда
  1. 33 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/GeneralConstant.java
  2. 139 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  3. 9 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java
  4. 27 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageCostController.java
  5. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java
  6. 73 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  7. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  8. 79 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TagInfoController.java
  9. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  10. 107 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  11. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceCleanMaterialJob.java
  12. 4 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  13. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IImageReportDailyService.java
  14. 133 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java
  15. 105 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/model/TagInfoTree.java
  16. 3 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  17. 3 0
      jeecg-boot-module-system/src/main/resources/application-test.yml
  18. 5 5
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  19. 3 3
      jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties
  20. 58 84
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  21. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/ByteDanceCleanMaterialReport.java
  22. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouCleanMaterialReport.java
  23. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialImageInfo.java
  24. 10 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/TagInfo.java
  25. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceCleanMaterialReportMapper.java
  26. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaiShouCleanMaterialReportMapper.java
  27. 2 2
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  28. 7 2
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  29. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceCleanMaterialReportMapper.xml
  30. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouCleanMaterialReportMapper.xml
  31. 35 17
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  32. 26 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  33. 2 7
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceCleanMaterialReportService.java
  34. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IKuaiShouCleanMaterialReportService.java
  35. 4 3
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageInfoService.java
  36. 2 2
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  37. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java
  38. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ITagInfoService.java
  39. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  40. 26 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ByteDanceCleanMaterialReportServiceImpl.java
  41. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/KuaiShouCleanMaterialReportServiceImpl.java
  42. 26 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java
  43. 70 20
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  44. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java
  45. 9 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/TagInfoServiceImpl.java
  46. 16 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  47. 99 34
      module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java
  48. 52 0
      module-common/src/main/java/com/xxl/job/core/enums/NoEn.java
  49. 10 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java
  50. 5 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/entity/MusicInfoKuaishou.java
  51. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java
  52. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java
  53. 12 0
      module-job-bytedance/pom.xml
  54. 0 1
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCleanMaterialJob.java
  55. 1 7
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceTodayPlaneLoadJob.java
  56. 8 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoDailyReportLoadJob.java
  57. 45 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatApproveAttendanceJob.java
  58. 43 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatAttendanceJob.java
  59. 0 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouCleanMaterialJob.java
  60. 99 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouRealTimeController.java
  61. 9 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouRealTimeDataService.java
  62. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java
  63. 17 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  64. 110 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouRealTimeDataServiceImpl.java
  65. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouCleanMaterialReportController.java
  66. 290 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyImage.java
  67. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java
  68. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyImageMapper.java
  69. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml
  70. 106 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml
  71. 0 29
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouCleanMaterialReportService.java
  72. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCreativeService.java
  73. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyImageService.java
  74. 0 41
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouCleanMaterialReportServiceImpl.java
  75. 27 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCreativeServiceImpl.java
  76. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyImageServiceImpl.java
  77. 3 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/constant/QYWxConstant.java
  78. 27 16
      module-oa/src/main/java/cn/com/ctop/oa/modules/controller/WechatCheckinDataController.java
  79. 28 1
      module-oa/src/main/java/cn/com/ctop/oa/modules/controller/WechatDepartmentController.java
  80. 368 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/controller/WechatNoListController.java
  81. 65 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatAttendance.java
  82. 15 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatCheckinData.java
  83. 67 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatNoList.java
  84. 63 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/enums/SpNoEnum.java
  85. 6 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/WechatCheckinDataMapper.java
  86. 3 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/WechatDepartmentMapper.java
  87. 23 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/WechatNoListMapper.java
  88. 65 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/xml/WechatCheckinDataMapper.xml
  89. 6 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/xml/WechatDepartmentMapper.xml
  90. 89 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/xml/WechatNoListMapper.xml
  91. 5 1
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatCheckinDataService.java
  92. 4 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatDepartmentService.java
  93. 49 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatNoListService.java
  94. 11 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatTokenService.java
  95. 0 1
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatUserListService.java
  96. 70 35
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatCheckinDataServiceImpl.java
  97. 5 11
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatDepartmentServiceImpl.java
  98. 388 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatNoListServiceImpl.java
  99. 30 7
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatTokenServiceImpl.java
  100. 0 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatUserListServiceImpl.java

+ 33 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/GeneralConstant.java

@@ -0,0 +1,33 @@
+package org.jeecg.common.constant;
+
+/**
+ * 项目中一般字符串常量
+ *
+ * @ClassName GeneralConstant
+ * @Author ZHAOXA
+ * @date 2020-09-29 10:33
+ */
+public class GeneralConstant {
+
+    /**
+     * code
+     */
+    public static final String CODE = "code";
+    public static final String MESSAGE = "message";
+    public static final String ERR_CODE = "errcode";
+    public static final String DAY_BEGIN = " 00:00:00";
+    public static final String DAY_END = " 23:59:59";
+    public static final String PAGE_NO = "pageNo";
+    public static final String PAGE_SIZE = "pageSize";
+    public static final String API_START_TIME = "starttime";
+    public static final String API_END_TIME = "endtime";
+    public static final String START_TIME = "startTime";
+    public static final String STOP_TIME = "stopTime";
+    public static final String ACCESS_TOKEN = "accessToken";
+    public static final String TYPE = "type";
+    public static final String VALUE = "value";
+
+
+
+
+}

+ 139 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -10,7 +10,14 @@ import java.sql.Timestamp;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 /**
  * 类描述:时间操作定义类
@@ -71,6 +78,21 @@ public class DateUtils extends PropertyEditorSupport {
     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 final static String SHORT_FORMAT = "yyyyMMdd";
+    public final static String LONG_FORMAT = "yyyyMMddHHmmss";
+    public final static String YEARHOUR_FORMAT = "yyyyMMddHH";
+    public final static String WEB_FORMAT = "yyyy-MM-dd";
+    public final static String TIME_FORMAT = "HHmmss";
+    public final static String COLON_TIME_FORMAT = "HH:mm:ss";
+    public final static String CHINESEDT_FORMAT = "yyyy年MM月dd日";
+    public final static String NEW_FORMAT = "yyyy-MM-dd HH:mm:ss";
+    public final static String WEB_FORMAT_ALL = "yyyy MM dd HH mm ss";
+    public final static String SECOND_FORMAT = "yyyy-MM-dd HH";
+    public final static String GREGORIAN_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+    public final static String NOMS_GREGORIAN_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
 
     public static String getNowHour(Date date) {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
@@ -731,9 +753,79 @@ public class DateUtils extends PropertyEditorSupport {
         return temp;
     }
 
+    private static Calendar zeroFromHour(long milliseconds) {
+        Calendar calendar = Calendar.getInstance(); // 获得一个日历
+
+        calendar.setTimeInMillis(completMilliseconds(milliseconds));
+        zeroFromHour(calendar);
+        return calendar;
+    }
+
+    private static long completMilliseconds(long milliseconds) {
+        String milStr = Long.toString(milliseconds);
+        if (milStr.length() == 10) {
+            milliseconds = milliseconds * 1000;
+        }
+        return milliseconds;
+    }
+
+    private static void zeroFromHour(Calendar calendar) {
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+    }
+
+
+    public static String getWhatDay(long timeStamp) {
+        Calendar cal = zeroFromHour(timeStamp);
+        String whatDay = "";
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
+            whatDay = "星期六";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+            whatDay = "星期日";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
+            whatDay = "星期一";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY) {
+            whatDay = "星期二";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
+            whatDay = "星期三";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
+            whatDay = "星期四";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) {
+            whatDay = "星期五";
+        }
+        return whatDay;
+    }
+
+    /* //日期转换为时间戳 */
+    public static long timeToStamp(String timers) {
+        Date d = new Date();
+        long timeStemp = 0;
+        try {
+            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            d = sf.parse(timers);// 日期转换为时间戳
+        } catch (ParseException e) {
+
+            e.printStackTrace();
+        }
+        timeStemp = d.getTime();
+        return timeStemp / 1000;
+    }
+
+
     public static void main(String[] args) throws ParseException {
-        Date date = stampToTime(1599524171L);
-        System.err.println(date);
+        /*Date date = stampToTime(1599458521L);
+        String s = formatDate(date);
+        System.err.println(s);*/
+        Long s1 = timeToStamp("2020-09-23 21:30:00");
+        System.err.println(s1);
     }
 
     /**
@@ -1409,6 +1501,50 @@ public class DateUtils extends PropertyEditorSupport {
         return lDate;
     }
 
+    /**
+     * 获取前一天的日期
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    public static String getLastDay(String time) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        Date date = null;
+        try {
+            date = sdf.parse(time);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        calendar.setTime(date);
+        int day = calendar.get(Calendar.DATE);
+        //                      此处修改为+1则是获取后一天
+        calendar.set(Calendar.DATE, day - 1);
+
+        String lastDay = sdf.format(calendar.getTime());
+        return lastDay;
+    }
+
+    /**
+     * 获取当月1号零时零分的时间
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    public static String initDateByMonth() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return sdf.format(calendar.getTime());
+    }
 }
 
 

Файловите разлики са ограничени, защото са твърде много
+ 9 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java


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

@@ -0,0 +1,27 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportMaterialDailyService;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.ctop.service.IImageReportDailyService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+@RestController
+@RequestMapping("image")
+public class ImageCostController {
+    @Autowired
+    private IBytedanceReportMaterialDailyService materialDailyService;
+    @Autowired
+    private IImageReportDailyService imageReportDailyService;
+    @PostMapping("bytedance/cost")
+    public Map<String,Object> bytedanceImageCost(@RequestBody JSONObject data){
+        return imageReportDailyService.bytedanceImageCost(data);
+    }
+
+    @PostMapping("kuaishou/cost")
+    public Map<String,Object> kuaishouImageCost(@RequestBody JSONObject data){
+        return imageReportDailyService.kuaishouImageCost(data);
+    }
+}

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

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

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

@@ -6,12 +6,9 @@ import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
 import cn.com.ctop.common.module.utils.JsonUtil;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-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;
@@ -26,16 +23,15 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
+import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.net.URLDecoder;
 import java.text.ParseException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 素材信息
@@ -196,8 +192,9 @@ public class MaterialInfoController {
         return result;
     }
 
-    @AutoLog(value = "素材信息-分页列表查询")
-    @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
+    @Autowired
+    private ISysRoleService roleService;
+
     @GetMapping(value = "/list")
     public Result<IPage<MaterialInfo>> queryPageList(MaterialInfo materialInfo,
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@@ -216,7 +213,7 @@ public class MaterialInfoController {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         materialInfo.setCreateTime(null);
         if (!Check.isNull(materialInfo.getUserId())) {
-            String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
+            String roleCode = roleService.getRoleCodeByUserId(materialInfo.getUserId());
             if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {
                 materialInfo.setUserId(null);
                 queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
@@ -290,6 +287,7 @@ public class MaterialInfoController {
                     material.setMediaId(project.getMediaId());
                     material.setProjectName(project.getProjectName());
                 }
+
                 QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
                 imageInfoQueryWrapper.eq("video_id", material.getCode());
                 imageInfoQueryWrapper.eq("status", 0);
@@ -310,6 +308,44 @@ public class MaterialInfoController {
         return result;
     }
 
+    @GetMapping(value = "/listV2")
+    public Map<String,Object> queryPageList(String type,Integer status,Long projectId,String materialName,String code,
+                                                     String startDate,String endDate,String tagCode,
+                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        List<Long>projectIds = null;
+        String userId = user.getId();
+        String roleCode = roleService.getRoleCodeByUserId(userId);
+        if(null == tagCode||tagCode.trim().equals("")){
+            tagCode = null;
+        }
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")){
+            //查询所有
+            if(null!=projectId&&projectId!=0){
+                projectIds = new ArrayList<>();
+                projectIds.add(projectId);
+            }
+            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,null,pageNo,pageSize);
+        }else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)){
+            //查询自己所在项目下的数据
+            if(null == projectId||projectId == 0){
+                projectIds = memberService.selectProjectsByUserId(userId);
+            }else{
+                projectIds = new ArrayList<>();
+                projectIds.add(projectId);
+            }
+            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,null,pageNo,pageSize);
+        }else{
+            //查询自己上传的视频
+            if(null!=projectId&&projectId!=0){
+                projectIds = new ArrayList<>();
+                projectIds.add(projectId);
+            }
+            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,userId,pageNo,pageSize);
+        }
+    }
+
 
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
@@ -331,7 +367,7 @@ public class MaterialInfoController {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
 
         if (!Check.isNull(materialInfo.getUserId())) {
-            String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
+            String roleCode = roleService.getRoleCodeByUserId(materialInfo.getUserId());
             if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
                 materialInfo.setUserId(null);
             } else {
@@ -468,6 +504,28 @@ public class MaterialInfoController {
                 url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
             }
             materialInfo.setUrl(url);
+            MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(materialInfo.getCode());
+            if (Check.isNull(cutFrame)) {
+                String videoUrl = URLDecoder.decode(url).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+                String loadImage = "cutFrame/" + materialInfo.getCode() + "/zero.jpg";
+                String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
+                materialInfo.setCoverUrl(coverUrl);
+                Thread thread = new Thread() {
+                    @Override
+                    public void run() {
+                        try {
+                            log.info("开始抽帧,code:{}", materialInfo.getCode());
+                            materialCutFrameService.getTencentCutFrame(videoUrl, materialInfo.getCode(), coverUrl);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                };
+                thread.start();
+            } else {
+                materialInfo.setCoverUrl(cutFrame.getUrl());
+            }
+
         }
 
         //  修改素材库 相关联code
@@ -647,7 +705,7 @@ public class MaterialInfoController {
     }
 
     /**
-     *  adlab 新加查询素材库接口
+     * adlab 新加查询素材库接口
      */
     @PostMapping(value = "/listByAccountIds")
     public Result<IPage<MaterialInfo>> listByAccountIds(@RequestBody JSONObject requestBody) {
@@ -655,13 +713,13 @@ public class MaterialInfoController {
         Result<IPage<MaterialInfo>> result = new Result<>();
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         if (!Check.isNull(requestBody.getString("userId"))) {
-            queryWrapper.eq("user_id",requestBody.getString("userId"));
+            queryWrapper.eq("user_id", requestBody.getString("userId"));
             List<Long> projects = memberService.getProjectByAccountIds(requestBody.getJSONArray("accountIds"));
             if (!Check.isNull(projects)) {
                 queryWrapper.in("project_id", projects);
             }
         }
-        queryWrapper.orderByDesc(true,"create_time");
+        queryWrapper.orderByDesc(true, "create_time");
         Page<MaterialInfo> page = new Page<>(requestBody.getInteger("pageNo"), requestBody.getInteger("pageSize"));
         IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -330,6 +330,7 @@ public class ProjectController {
                 projectMemberService.removeByMap(map);
                 ProjectMember member = new ProjectMember();
                 member.setProjectId(id);
+                member.setProjectName(project.getProjectName());
                 member.setUserId(userId);
                 member.setUserName(userName);
                 String roleCode = sysRoleService.getRoleCodeByUserId(userId);

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

@@ -1,7 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.entity.TagCategoryInfo;
 import cn.com.ctop.common.module.entity.TagInfo;
 import cn.com.ctop.common.module.model.TagInfoTreeModel;
+import cn.com.ctop.common.module.service.ITagCategoryInfoService;
 import cn.com.ctop.common.module.service.ITagInfoService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -9,12 +11,16 @@ 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.constant.CommonConstant;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.system.model.TagInfoTree;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -32,6 +38,72 @@ public class TagInfoController {
 	@Autowired
 	private ITagInfoService tagInfoService;
 
+	 /**
+	  * 加载数据节点
+	  *
+	  * @return
+	  */
+	 @RequestMapping(value = "/treeList", method = RequestMethod.GET)
+	 public Result<IPage<TagInfo>> list(@RequestParam(defaultValue = "10")Integer pageSize,@RequestParam(defaultValue = "1")Integer pageNo) {
+		 Result<IPage<TagInfo>> result = new Result<>();
+		 try {
+			QueryWrapper<TagInfo> query = new QueryWrapper<>();
+		 	query.eq("del_flag", CommonConstant.DEL_FLAG_0);
+		 	query.eq("level",1);
+		 	query.orderByAsc("tag_order");
+		 	Page<TagInfo> page = new Page<>(pageNo, pageSize);
+		 	IPage<TagInfo> pageList = tagInfoService.page(page,query);
+		 	List<TagInfo>recordsLevel1 = pageList.getRecords();
+
+			 List<TagInfo>setRecordsLevel1 = new ArrayList<>();
+			 if(null!=recordsLevel1&&!recordsLevel1.isEmpty()){
+		 		for (TagInfo level1tag:recordsLevel1) {
+					if(!level1tag.isLeaf()){
+						//非叶子节点
+						List<TagInfo>recordsLevel2 = tagInfoService.getByParentId(level1tag.getId());
+						List<TagInfo>setRecordsLevel2 = new ArrayList<>();
+						if(null!=recordsLevel2&&!recordsLevel2.isEmpty()){
+							for(TagInfo level2Tag:recordsLevel2){
+								if(!level2Tag.isLeaf()){
+									List<TagInfo>recordsLevel3 = tagInfoService.getByParentId(level2Tag.getId());
+									level2Tag.setChildren(recordsLevel3);
+								}
+								setRecordsLevel2.add(level2Tag);
+							}
+						}
+						level1tag.setChildren(setRecordsLevel2);
+					}
+					setRecordsLevel1.add(level1tag);
+				}
+			}
+			pageList.setRecords(setRecordsLevel1);
+		 	result.setSuccess(true);
+		 	result.setResult(pageList);
+		 } catch (Exception e) {
+			 log.error(e.getMessage(), e);
+		 }
+		 return result;
+	 }
+
+	 private void getTreeList(List<TagInfoTree> treeList, List<TagInfo> metaList, TagInfoTree temp) {
+		 for (TagInfo tagInfo : metaList) {
+			 Long tempPid = tagInfo.getParentId();
+			 TagInfoTree tree = new TagInfoTree(tagInfo);
+			 if (temp == null && oConvertUtils.isEmpty(tempPid)) {
+				 treeList.add(tree);
+				 if (!tree.isLeaf()) {
+					 getTreeList(treeList, metaList, tree);
+				 }
+			 } else if (temp != null && tempPid != null && tempPid.equals(temp.getId())) {
+				 temp.getChildren().add(tree);
+				 if (!tree.isLeaf()) {
+					 getTreeList(treeList, metaList, tree);
+				 }
+			 }
+
+		 }
+	 }
+
 	/**
 	  * 分页列表查询
 	 * @param tagInfo
@@ -54,15 +126,16 @@ public class TagInfoController {
 		return result;
 	}
 
-	/**
-	  *   添加
-	 * @param tagInfo
-	 * @return
-	 */
+	@Autowired
+	private ITagCategoryInfoService tagCategoryInfoService;
 	@PostMapping(value = "/add")
 	public Result<TagInfo> add(@RequestBody TagInfo tagInfo) {
 		Result<TagInfo> result = new Result<>();
 		try {
+			TagCategoryInfo categoryInfo = tagCategoryInfoService.getById(tagInfo.getTagCategoryId());
+			if(null!=categoryInfo){
+				tagInfo.setTagCategoryName(categoryInfo.getName());
+			}
 			TagInfo getTag = tagInfoService.getByTagCode(tagInfo.getTagCode());
 			if(null!=getTag){
 				result.error500("标签编码已存在");
@@ -74,6 +147,7 @@ public class TagInfoController {
 				tagInfo.setStatus(1);
 			}
 			tagInfo.setUserId(user.getId());
+
 			int level = 1;
 			Long parentId = tagInfo.getParentId();
 			if(null!=parentId){

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

@@ -133,7 +133,7 @@ public class TestController {
 
         List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
 
-        while (list != null) {
+        while (list != null && list.size() > 0) {
             for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                 MusicInfo musicInfo = new MusicInfo();
                 musicInfo.setExtId(crawlerDouyinMusicTask.getId());
@@ -157,7 +157,7 @@ public class TestController {
                     QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("status", "init").likeLeft("id", j).orderByDesc("id").last(" limit 20");
                     List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
-                    while (list != null) {
+                    while (list != null && list.size() > 0) {
                         log.info("【同步歌曲】第" + j + "线程正在处理:" + list.size() + "条数据");
                         for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                             MusicInfo musicInfo = new MusicInfo();
@@ -184,7 +184,7 @@ public class TestController {
                     QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("status", "done").likeLeft("id", j).orderByDesc("id").last(" limit 20");
                     List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
-                    while (list != null) {
+                    while (list != null && list.size() > 0) {
                         log.info("【解析分类】第" + j + "线程正在处理:" + list.size() + "条数据");
                         for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                             QueryWrapper<MusicInfo> queryWrapper1 = new QueryWrapper<>();

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

@@ -2,14 +2,19 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISysRoleExtService;
 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 cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+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;
@@ -29,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 用户分配
@@ -55,6 +61,14 @@ public class UserAllocationController {
     @Autowired
     private IProjectMemberService projectMemberService;
 
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+
+
     @GetMapping(value = "/accountTurnProject")
     public Result<Object> getAccountList(Long accountId, Long projectId) {
         Result<Object> result = new Result<>();
@@ -196,6 +210,99 @@ public class UserAllocationController {
     }
 
 
+    @GetMapping(value = "/updateAuthName")
+    public Result<UserAllocation> updateAuthName(Long accountId, String mediaId) {
+        Result<UserAllocation> result = new Result<>();
+        try {
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+
+            String authName = null;
+            if (mediaId.equals("2") || mediaId.equals("4")) {
+                Map<String, Object> advertiseBaseInfoMap = kuaishouInterfaceService.advertiserInfo(accountId, oauthToken.getAccessToken());
+                Integer code = (Integer) advertiseBaseInfoMap.get("code");
+                if (code != 0) {
+                    throw new Exception("更新授权名称失败");
+
+                }
+                authName = (String) advertiseBaseInfoMap.get("userName");
+            } else if (mediaId.equals("1") || mediaId.equals("3")) {
+                Map<String, Object> advertiserDataMap = advertiserDataService.getAdvertiserInfo(String.valueOf(accountId), oauthToken.getAccessToken());
+                Integer code = (Integer) advertiserDataMap.get("code");
+                if (code != 0) {
+                    throw new Exception("更新授权名称失败");
+
+                }
+                authName = (String) advertiserDataMap.get("name");
+            }
+            UserAllocation allocation = new UserAllocation();
+            allocation.setAuthName(authName);
+
+            QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            queryWrapper.eq("media_id", mediaId);
+
+            boolean update = userAllocationService.update(allocation, queryWrapper);
+            if (update) {
+                result.setSuccess(true);
+            } else {
+                result.setSuccess(false);
+            }
+
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+
+    }
+
+
+    /**
+     * 统计报表 查看所有账号
+     *
+     * @param projectId
+     * @return
+     */
+    @GetMapping(value = "/getUserIdListByProjectId")
+    public Result<List<JSONObject>> getUserIdListByProjectId(Long projectId) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            if (Check.isNull(projectId)) {
+                throw new Exception("请选择项目id");
+            }
+            List<JSONObject> userIdList = userAllocationService.getUserIdListByProjectId(projectId);
+            result.setSuccess(true);
+            result.setResult(userIdList);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+
+
+    @GetMapping(value = "/getAccountIdListByUserId")
+    public Result<List<JSONObject>> getAccountIdListByUserId(Long userId) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            if (Check.isNull(userId)) {
+                throw new Exception("请选择快手id");
+            }
+            List<JSONObject> accountIdList = userAllocationService.getAccountIdListByUserId(userId);
+            result.setSuccess(true);
+            result.setResult(accountIdList);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+
+
     /**
      * 分页列表查询
      *

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

@@ -1,7 +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 cn.com.ctop.toutiao.modules.report.service.IBytedanceCreativeDailyReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
@@ -18,7 +18,7 @@ import java.util.concurrent.Executors;
 @Slf4j
 public class ByteDanceCleanMaterialJob implements Job {
     @Autowired
-    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
+    private IBytedanceCreativeDailyReportService bytedanceCreativeDailyReportService;
     static ExecutorService executorService = null;
 
     @Override
@@ -26,7 +26,7 @@ public class ByteDanceCleanMaterialJob implements Job {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                List<String> signatureList = byteDanceCleanMaterialReportService.getSignature();
+                List<String> signatureList = bytedanceCreativeDailyReportService.getSignatureList();
                 if (Check.isNull(signatureList)) {
                     log.error("头条素材数据获取为空");
                     return;
@@ -37,7 +37,7 @@ public class ByteDanceCleanMaterialJob implements Job {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
-                            byteDanceCleanMaterialReportService.calculationMaterialReport(signature);
+                            bytedanceCreativeDailyReportService.calculationMaterialReport(signature);
                         }
                     });
                 }

+ 4 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml

@@ -112,7 +112,10 @@
     <select id="queryProjectMemberByUserId" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
         distinct b.project_id as projectId,
-        b.project_name as projectName,
+         (
+         select project_name  from ctop_project
+         where id = b.project_id
+        )as projectName,
         a.advertiser_id as advertiserId,
         (
         select name from ctop_advertiser where id = a.advertiser_id

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

@@ -0,0 +1,11 @@
+package org.jeecg.modules.ctop.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.Map;
+
+public interface IImageReportDailyService {
+    Map<String,Object> bytedanceImageCost(JSONObject data);
+
+    Map<String, Object> kuaishouImageCost(JSONObject data);
+}

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

@@ -0,0 +1,133 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.entity.SysUser;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.toutiao.modules.report.DTO.ImageCostVO;
+import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.modules.ctop.service.IImageReportDailyService;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ImageReportDailyServiceImpl implements IImageReportDailyService {
+
+    @Override
+    public Map<String,Object> bytedanceImageCost(JSONObject data) {
+        Map<String,Object>result = new HashMap<>();
+        String startDate = data.getString("startDate");
+        if(null == startDate||startDate.trim().equals("")){
+            startDate = null;
+        }
+        String endDate = data.getString("endDate");
+        if(null == endDate||endDate.trim().equals("")){
+            endDate = null;
+        }
+        JSONArray accountList = data.getJSONArray("accountList");
+        if(null==accountList||accountList.isEmpty()){
+            accountList = null;
+        }
+        String code = data.getString("code");
+        if(null == code||code.trim().equals("")){
+            code = null;
+        }
+        Integer pageSize = data.getInteger("pageSize");
+        Integer pageNumber = data.getInteger("pageNumber");
+        if(null == pageNumber||pageNumber ==0){
+            pageNumber = 1;
+        }
+        if(null == pageSize||pageSize ==0){
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNumber,pageSize);
+        List<ImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,(pageNumber-1)*pageSize,pageSize);
+        PageInfo<ImageCostVO> pageInfo = new PageInfo<>(vos);
+        if(null!=vos&&!vos.isEmpty()){
+            List<ImageCostVO>setVos = new ArrayList<>();
+            for(ImageCostVO vo:vos){
+                MaterialImageInfo imageInfo = imageInfoService.getByCode(vo.getSignature());
+                if(null!=imageInfo){
+                    vo.setUserId(imageInfo.getUserId());
+                    SysUser user = sysUserService.getById(imageInfo.getUserId());
+                    vo.setUserName(user.getUsername());
+                }else{
+                    vo.setUserName("-");
+                }
+                setVos.add(vo);
+            }
+            pageInfo.setList(setVos);
+        }
+        result.put("data",pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> kuaishouImageCost(JSONObject data) {
+        Map<String,Object>result = new HashMap<>();
+        String startDate = data.getString("startDate");
+        if(null == startDate||startDate.trim().equals("")){
+            startDate = null;
+        }
+        String endDate = data.getString("endDate");
+        if(null == endDate||endDate.trim().equals("")){
+            endDate = null;
+        }
+        JSONArray accountList = data.getJSONArray("accountList");
+        if(null==accountList||accountList.isEmpty()){
+            accountList = null;
+        }
+        String code = data.getString("code");
+        if(null == code||code.trim().equals("")){
+            code = null;
+        }
+        Integer pageSize = data.getInteger("pageSize");
+        Integer pageNumber = data.getInteger("pageNumber");
+        if(null == pageNumber||pageNumber ==0){
+            pageNumber = 1;
+        }
+        if(null == pageSize||pageSize ==0){
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNumber,pageSize);
+        List<ImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,(pageNumber-1)*pageSize,pageSize);
+        PageInfo<ImageCostVO> pageInfo = new PageInfo<>(vos);
+        if(null!=vos&&!vos.isEmpty()){
+            List<ImageCostVO>setVos = new ArrayList<>();
+            for(ImageCostVO vo:vos){
+                MaterialImageInfo imageInfo = imageInfoService.getByCode(vo.getSignature());
+                if(null!=imageInfo){
+                    vo.setUserId(imageInfo.getUserId());
+                    SysUser user = sysUserService.getById(imageInfo.getUserId());
+                    vo.setUserName(user.getUsername());
+                }else{
+                    vo.setUserName("-");
+                }
+                setVos.add(vo);
+            }
+            pageInfo.setList(setVos);
+        }
+        result.put("data",pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Autowired
+    private IMaterialImageInfoService imageInfoService;
+    @Autowired
+    private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
+    @Autowired
+    private ISysUserService sysUserService;
+}

+ 105 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/model/TagInfoTree.java

@@ -0,0 +1,105 @@
+package org.jeecg.modules.system.model;
+
+import cn.com.ctop.common.module.entity.TagInfo;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class TagInfoTree implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private String id;
+
+    private String key;
+    private String title;
+
+    /**
+     * 父id
+     */
+    private String parentId;
+
+    /**
+     * 标签名称
+     */
+    private String tagName;
+
+    /**
+     * 编码
+     */
+    private String tagCode;
+    /**
+     * 排序
+     */
+    private Integer tagOrder;
+
+    /**
+     * 所属一级标签id
+     */
+    private Long firstTagId;
+
+    /**
+     * 所属二级标签id
+     */
+    private Long secendTagId;
+
+    /**
+     * 简介
+     */
+    private String description;
+
+    private String model;
+
+    private Integer status;
+
+    private Integer delFlag;
+
+    private Integer level;
+
+    private Long tagCategoryId;
+
+    private String userId;
+    /**
+     * 是否叶子节点: 1:是 0:不是
+     */
+    private boolean isLeaf;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    private List<TagInfoTree> children;
+
+    public TagInfoTree(TagInfo tagInfo) {
+        this.key = tagInfo.getId()+"";
+        this.id = tagInfo.getId()+"";
+        this.title = tagInfo.getTagName();
+        this.parentId = tagInfo.getParentId()+"";
+        this.tagName = tagInfo.getTagName();
+        this.tagCode = tagInfo.getTagCode();
+        this.tagOrder = tagInfo.getTagOrder();
+        this.delFlag = tagInfo.getDelFlag();
+        this.description = tagInfo.getDescription();
+        this.firstTagId = tagInfo.getFirstTagId();
+        this.secendTagId = tagInfo.getSecendTagId();
+        this.description = tagInfo.getDescription();
+        this.model = tagInfo.getModel();
+        this.status = tagInfo.getStatus();
+        this.delFlag = tagInfo.getDelFlag();
+        this.level = tagInfo.getLevel();
+        this.tagCategoryId = tagInfo.getTagCategoryId();
+        this.userId = tagInfo.getUserId();
+        this.createTime = tagInfo.getCreateTime();
+        this.updateTime = tagInfo.getUpdateTime();
+        this.isLeaf = tagInfo.isLeaf();
+    }
+}

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

@@ -16,6 +16,9 @@ management:
         include: metrics,httptrace
 
 spring:
+  devtools:
+    restart:
+      enabled: true
   servlet:
     multipart:
       max-file-size: 10MB

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

@@ -13,6 +13,9 @@ management:
         include: metrics,httptrace
 
 spring:
+  devtools:
+    restart:
+      enabled: true
   servlet:
     multipart:
       max-file-size: -1

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

@@ -126,8 +126,8 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-#  configuration:
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
   elasticsearch:
@@ -162,8 +162,8 @@ jeecg:
     chrome-driver: D://chromedriver.exe
     csv-upload: /mnt/upload/csv/
     bak-database-file: /mnt/data/bak/
-    report-history: /mnt/upload/report/history/
-    report-daily: /mnt/upload/report/daily/
+    report-history: D://mnt//reportKs//
+    report-daily: D://mnt//reportKs//
 kuaishou:
   group-control:
     path: http://39.106.184.70
@@ -181,4 +181,4 @@ oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: /mnt/file/video/
+    download: D://mnt//image//

+ 3 - 3
jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties

@@ -1,8 +1,8 @@
 #mysql
 diver_name=com.mysql.jdbc.Driver
-url=jdbc:mysql://127.0.0.1:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8
-username=root
-password=123456
+url=jdbc:mysql://139.186.27.96:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8
+username=hcst
+password=test@20190531
 database_name=jeecg-boot
 #oracle
 #diver_name=oracle.jdbc.driver.OracleDriver

+ 58 - 84
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -5,12 +5,13 @@ import cn.com.ctop.check.entity.CtopCheckTaskList;
 import cn.com.ctop.check.service.ICtopCheckTaskListService;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UReportSubscriber;
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
 import cn.com.ctop.common.module.entity.UserAllocation;
-import cn.com.ctop.common.module.message.handle.impl.EmailSendMsgHandle;
-import cn.com.ctop.common.module.service.*;
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
@@ -21,7 +22,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.log.XxlJobLogger;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.constant.SystemDateConstant;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -30,7 +30,6 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import java.io.File;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -50,15 +49,27 @@ public class SampleTest {
     @Autowired
     private IReportService reportService;
     @Autowired
-    private IUserAllocationService userAllocationService;
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
     @Autowired
-    private IKuaiShouDailyReportTaskService dailyReportTaskService;
-
+    private IMaterialImageInfoService imageInfoService;
+    @Test
+    public void loadBytedanceMatData(){
+        executorService = Executors.newFixedThreadPool(5);
+        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
+        for (CtopOauthToken token:tokens) {
+            reportService.getAdvertiserPlanReport(token,new Date(),new Date(),CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        }
+    }
 
+    @Test
+    public void initImageCode(){
+        QueryWrapper<MaterialImageInfo>queryWrapper = new QueryWrapper<>();
+        queryWrapper.le("update_time","2020-09-23 18:35:00");
+        List<MaterialImageInfo> imageInfos = imageInfoService.list(queryWrapper);
+        for (MaterialImageInfo image:imageInfos) {
+            imageInfoService.initImageCode(image);
+        }
+    }
 
 
     @Test
@@ -66,10 +77,10 @@ public class SampleTest {
         QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("media_id", 2);
         List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
-       // for (CtopOauthToken token : list) {
-            kuaiShouHistoryReportTaskService.createTask(1872430L, "9cd4d43ea697ad9f2aa91fc0f4b921e5", "2020-03-15", "2020-09-15", "history");
+         for (CtopOauthToken token : list) {
+        kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
 
-       // }
+         }
 
     }
 
@@ -102,7 +113,6 @@ public class SampleTest {
     }
 
     static ExecutorService executorService = null;
-    //线程计数器/bytedance/bytedanceMaterialReport
     static CountDownLatch countDownLatch = null;
 
     @Test
@@ -136,12 +146,12 @@ public class SampleTest {
 
     @Test
     public void testLoadBytedanceData() {
-        List<UserAllocation> allocations = allocationService.getByParams(435L, null, 0);
+        List<UserAllocation> allocations = allocationService.getByParams(430L, null, 0);
         for (UserAllocation allocation : allocations) {
-            for (int i = 2; i < 10; i++) {
+            for (int i = 0; i < 10; i++) {
                 CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
                 Date getDate = DateUtils.addDay(new Date(), -i);
-                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
             }
         }
     }
@@ -149,18 +159,18 @@ public class SampleTest {
     @Test
     public void loadKuaishouAgentData() {
         kuaishouReportDailyAgentService.loginAgent();
-        for (int i = 0; i < 20; i++) {
-            String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
-            kuaishouReportDailyAgentService.getReport(currentDate, DateUtils.getNowDate("yyyy-MM-dd"));
-        }
-//
-//        try {
-//            for (int i = 1; i < 30; i++) {
-//                kuaishouReportDailyAgentService.getAccount(i);
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
+//        for (int i = 0; i < 20; i++) {
+//            String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
+//            kuaishouReportDailyAgentService.getReport(currentDate, DateUtils.getNowDate("yyyy-MM-dd"));
 //        }
+//
+        try {
+            for (int i = 1; i < 30; i++) {
+                kuaishouReportDailyAgentService.getAccount(i);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
     @Autowired
@@ -183,69 +193,33 @@ public class SampleTest {
         CtopOauthToken token = oauthTokenService.getTokenByAccountId(1665922219192387L);
         reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-09-01", "yy-MM-dd"), DateUtils.parseDate("2020-09-01", "yy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
     }
-    @Autowired
-    private ICtopOauthTokenService tokenService;
 
     @Test
-    public void loadAllHourReport(){
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        String getDate="2020-09-27";
-        tokens.forEach(token -> {
-            reportService.getAdvertiserReport(token, DateUtils.parseDate(getDate, SystemDateConstant.yyyy_MM_dd), DateUtils.parseDate(getDate, SystemDateConstant.yyyy_MM_dd), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        });
+    public void testBytedanceVideoReport(){
+        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
+        for(int i=2;i<100;i++){
+            String date = DateUtils.formatDate(DateUtils.addDay(new Date(),-i));
+            for (CtopOauthToken token:tokens) {
+//                bytedanceReportService.bytedanceVideoMaterialReport(token, date, date);
+            }
+        }
     }
 
-    @Autowired
-    IUReportExportService uReportExportService;
-    @Autowired
-    EmailSendMsgHandle emailSendMsgHandle;
-    @Autowired
-    IUReportService uReportService;
-
     @Test
-    public void sendUReport() {
-        uReportService.uReportList().forEach(uReport -> {
-            List<UReportSubscriber> uReportSubscriber = uReportService.getUReportSubscriberByFileId(uReport.getString("id"));
-            if (!uReportSubscriber.isEmpty()) {
-                String title = uReport.getString("name").replace(".ureport.xml", "");
-                String content = "您订阅的日报在附件中请注意查收》》》";
-                //下载文件到本地
-                uReportExportService.exportExcel(uReport.getString("name"));
-                uReportSubscriber.forEach(sender -> {
-                    emailSendMsgHandle.SendAttachment("bijiequan@c-top.com.cn", title, content,
-                            new File(System.getProperty("user.dir") + File.separator + "uReport" + File.separator + uReport.getString("name").replace("ureport.xml", "") + "xlsx"));
-                });
-            }
-        });
-        //发完全部订阅,删除文件
-        File file = new File(System.getProperty("user.dir") + File.separator + "uReport");
-        File[] files = file.listFiles();
-        if (files != null && files.length > 0) {
-            for (File f : files) {
-                f.delete();
-            }
+    public void loadKuaishouReportData() {
+        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("media_id", 2);
+        List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
+        for (CtopOauthToken token : list) {
+            kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-17", "2020-09-19", "history");
+            kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
         }
     }
 
     @Autowired
-    IBytedanceReportService bytedanceReportService;
-    //头条素材报表拉数据
+    private IKuaiShouHistoryReportTaskService historyReportTaskService;
     @Test
-    public void getMaterialReportByDate() {
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        String startDate="2020-09-29";
-        String endDate="2020-09-29";
-        tokens.forEach(token -> {
-                    try {
-                        //获取头条素材报表数据
-                        XxlJobLogger.log("账户" + token.getAccountId() + "素材报表数据任务开始,任务时间:" +new Date());
-                        bytedanceReportService.bytedanceMaterialReport(token, startDate, endDate);
-                        XxlJobLogger.log("账户" + token.getAccountId() + "素材报表数据任务完成,任务时间:" + new Date());
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                    }
-
-            });
+    public void loadHistoryJob(){
+        historyReportTaskService.getTaskList();
     }
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/ByteDanceCleanMaterialReport.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.toutiao.modules.report.entity;
+package cn.com.ctop.common.module.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouCleanMaterialReport.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.kuaishou.modules.report.entity;
+package cn.com.ctop.common.module.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;

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

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

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

@@ -2,6 +2,7 @@ package cn.com.ctop.common.module.entity;
 
 import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 标签信息
@@ -27,8 +29,8 @@ public class TagInfo {
 	private Long id;
 	@Dict(dicCode = "id",dictTable="ctop_tag_info",dicText="tag_name")
 	private Long parentId;
-	@Dict(dicCode = "id",dictTable="ctop_tag_category",dicText="name")
 	private Long tagCategoryId;
+	private String tagCategoryName;
 	@Dict(dicCode = "id",dictTable="ctop_tag_info",dicText="tag_name")
 	private Long firstTagId;
 	@Dict(dicCode = "id",dictTable="ctop_tag_info",dicText="tag_name")
@@ -43,6 +45,13 @@ public class TagInfo {
 	private Integer level;
 	private Integer status;
 	private Integer delFlag;
+	@TableField(value="is_leaf")
+	private boolean leaf;
 	private Date createTime;
 	private Date updateTime;
+
+	@TableField(exist = false)
+	List<TagInfo> children;
+
+
 }

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceCleanMaterialReportMapper.java

@@ -1,6 +1,6 @@
-package cn.com.ctop.toutiao.modules.report.mapper;
+package cn.com.ctop.common.module.mapper;
 
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaiShouCleanMaterialReportMapper.java

@@ -1,6 +1,6 @@
-package cn.com.ctop.kuaishou.modules.report.mapper;
+package cn.com.ctop.common.module.mapper;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**

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

@@ -21,8 +21,6 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
 
     Integer selectCountByMap(Map<String, Object> requestMap);
 
-    String getRoleCodeByUserId(@Param("userId") String userId);
-
     Integer getKuaishouUpVideoCount(@Param("code") String code);
 
     Integer getToutiaoUpVideoCount(@Param("code") String code);
@@ -36,4 +34,6 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
     Long getProjectIdByAccountId(@Param("accountId") Long accountId);
 
     List<MaterialInfo> getListByDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
+
+    List<MaterialInfo> getListByParams(@Param("tagCode")String tagCode,@Param("type")String type, @Param("status")Integer status, @Param("projectIds")List<Long> projectIds, @Param("materialName")String materialName, @Param("code")String code, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("userId")String userId);
 }

+ 7 - 2
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -14,8 +14,13 @@ import java.util.List;
  * @Version: V1.0
  */
 public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
-    List<UserAllocation> selectAccountListByProjectId(@Param("projectId")Long projectId);
-    String queryAdvertiserId(@Param("accountId")Long accountId);
+    List<UserAllocation> selectAccountListByProjectId(@Param("projectId") Long projectId);
+
+    String queryAdvertiserId(@Param("accountId") Long accountId);
 
     List<JSONObject> getAccountListByProject(@Param("projectId") Long projectId);
+
+    List<JSONObject> getUserIdListByProjectId(@Param("projectId") Long projectId);
+
+    List<JSONObject> getAccountIdListByUserId(@Param("userId") Long userId);
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceCleanMaterialReportMapper.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.ByteDanceCleanMaterialReportMapper">
+<mapper namespace="cn.com.ctop.common.module.mapper.ByteDanceCleanMaterialReportMapper">
 
 </mapper>

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouCleanMaterialReportMapper.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouCleanMaterialReportMapper">
+<mapper namespace="cn.com.ctop.common.module.mapper.KuaiShouCleanMaterialReportMapper">
 
 </mapper>

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

@@ -33,23 +33,6 @@
 
     </select>
 
-    <select id="getRoleCodeByUserId" resultType="java.lang.String">
-   SELECT
-    role_code
-    FROM
-    sys_role
-    WHERE
-    id = (
-    SELECT
-    t2.role_id
-    FROM
-    sys_user t1
-    LEFT JOIN sys_user_role t2 ON t1.id = t2.user_id
-    WHERE
-    t1.id = #{userId,jdbcType=VARCHAR}
-    )
-    </select>
-
     <select id="getKuaishouUpVideoCount" resultType="java.lang.Integer">
         select
         count(1)
@@ -130,6 +113,41 @@
         limit 1
     </select>
 
+    <select id="getListByParams" resultType="cn.com.ctop.common.module.entity.MaterialInfo">
+        select
+        distinct matInfo.code,
+        matInfo.project_id,
+        matInfo.id
+        from ctop_material_info matInfo
+        left join ctop_material_tag_info tagInfo on tagInfo.code = matInfo.code
+        where 1=1
+        <if test="tagCode!=null">
+            and tagInfo.tag_code like concat(#{tagCode},'%')
+        </if>
+        <if test="status!=null">
+            and matInfo.status = #{status}
+        </if>
+        <if test="userId!=null">
+            and matInfo.user_id = #{userId}
+        </if>
+        <if test="materialName!=null">
+            and matInfo.material_name like concat('%',#{materialName},'%')
+        </if>
+        <if test="projectIds!=null">
+            and matInfo.project_id in
+            <foreach item="item" index="index" collection="projectIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="startDate!=null">
+            and matInfo.create_time &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            and matInfo.create_time &lt;= #{endDate}
+        </if>
+        order by matInfo.create_time desc
+
+    </select>
     <select id="getListByDate" resultType="cn.com.ctop.common.module.entity.MaterialInfo">
         select  *  from
         ctop_material_info

+ 26 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -31,4 +31,30 @@
        where project_id = #{projectId}
        order by create_time desc
     </select>
+
+    <select id="getUserIdListByProjectId" resultType="com.alibaba.fastjson.JSONObject">
+   SELECT t1.user_id as 'userId',
+    t1.account_id as 'accountId',
+    t1.user_name  as 'userName'
+    from  ctop_kuaishou_advertiser_base_info t1  LEFT JOIN
+    ctop_user_allocation  t2
+    ON t1.account_id = t2.account_id
+    WHERE t2.project_id = #{projectId}
+    GROUP BY t1.user_id;
+    </select>
+
+
+    <select id="getAccountIdListByUserId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+    t1.account_id as 'accountId',
+    t1.auth_name  as 'authName',
+    t1.user_name as 'userName'
+    from ctop_user_allocation   t1  LEFT JOIN
+    ctop_kuaishou_advertiser_base_info t2
+    ON t1.account_id = t2.account_id
+    WHERE t2.user_id = #{userId}
+    AND t1.account_status = 0
+    </select>
+
+
 </mapper>

+ 2 - 7
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceCleanMaterialReportService.java

@@ -1,10 +1,8 @@
-package cn.com.ctop.toutiao.modules.report.service;
+package cn.com.ctop.common.module.service;
 
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
 import com.baomidou.mybatisplus.extension.service.IService;
 
-import java.util.List;
-
 /**
  * 头条-数据清洗
  *
@@ -14,8 +12,5 @@ import java.util.List;
  */
 public interface IByteDanceCleanMaterialReportService extends IService<ByteDanceCleanMaterialReport> {
 
-    List<String> getSignature();
-
-
     void calculationMaterialReport(String signature);
 }

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 快手素材清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-24
+ */
+public interface IKuaiShouCleanMaterialReportService extends IService<KuaiShouCleanMaterialReport> {
+
+}

+ 4 - 3
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageInfoService.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.MaterialImageInfo;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -16,7 +15,6 @@ import java.util.Map;
  * @date 2020-03-16
  */
 public interface IMaterialImageInfoService extends IService<MaterialImageInfo> {
-
     /**
      * 根据视频id  关联封面
      */
@@ -24,8 +22,11 @@ public interface IMaterialImageInfoService extends IService<MaterialImageInfo> {
 
     Map<String, Object> checkMaterialInfo(String code, String videoId);
 
-
     List<String> getCodeList();
 
     List<JSONObject> getUrlList(String videoId);
+
+    void initImageCode(MaterialImageInfo image);
+
+    MaterialImageInfo getByCode(String signature);
 }

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

@@ -38,8 +38,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     JSONObject report(String userId);
 
-    String getRoleCodeByUserId(String userId);
-
     void watermarkVideo(String materialId, Long videoWatermarkTemplateId, String userId);
 
     void getFile(MaterialInfo materialInfo, String mediaId);
@@ -75,4 +73,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     List<String> getEffiCode();
 
     List<MaterialInfo> getListByDate(String startDate, String endDate);
+
+    Map<String,Object> getListByParams(String tagCode,String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize);
 }

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

@@ -17,4 +17,6 @@ public interface IMaterialTagInfoService extends IService<MaterialTagInfo> {
     Map<String, Object> mark(JSONObject data, LoginUser loginUser);
 
     Map<String, Object> getTagDetail(MaterialTagInfo materialTagInfo);
+
+    void deleteByCode(String code);
 }

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

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

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

@@ -28,4 +28,8 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     String getAdvertiserIdByAccountId(Long accountId);
 
     List<JSONObject> getAccountListByProject(Long projectId);
+
+    List<JSONObject> getUserIdListByProjectId(Long projectId);
+
+    List<JSONObject> getAccountIdListByUserId(Long userId);
 }

+ 26 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ByteDanceCleanMaterialReportServiceImpl.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.mapper.ByteDanceCleanMaterialReportMapper;
+import cn.com.ctop.common.module.service.IByteDanceCleanMaterialReportService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Service;
+
+/**
+ * 头条-数据清洗
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-25
+ */
+@Service
+@Primary
+
+public class ByteDanceCleanMaterialReportServiceImpl extends ServiceImpl<ByteDanceCleanMaterialReportMapper, ByteDanceCleanMaterialReport> implements IByteDanceCleanMaterialReportService {
+
+    @Override
+    public void calculationMaterialReport(String signature) {
+
+    }
+}

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/KuaiShouCleanMaterialReportServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.mapper.KuaiShouCleanMaterialReportMapper;
+import cn.com.ctop.common.module.service.IKuaiShouCleanMaterialReportService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手素材清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-24
+ */
+@Service
+public class KuaiShouCleanMaterialReportServiceImpl extends ServiceImpl<KuaiShouCleanMaterialReportMapper, KuaiShouCleanMaterialReport> implements IKuaiShouCleanMaterialReportService {
+}

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

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

+ 70 - 20
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -13,6 +13,8 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.tencentcloudapi.mps.v20190612.models.DescribeTaskDetailResponse;
 import it.sauronsoftware.jave.Encoder;
 import it.sauronsoftware.jave.EncoderException;
@@ -376,11 +378,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public String getRoleCodeByUserId(String userId) {
-        return materialInfoMapper.getRoleCodeByUserId(userId);
-    }
-
-    @Override
     public void getFile(MaterialInfo materialInfo, String mediaId) {
         uploadExecutorService.submit(new Runnable() {
             @Override
@@ -413,7 +410,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                         String height = String.valueOf(m.getVideo().getSize().getHeight());
                         materialParameter.setHeight(height);
 
-
                         fis = new FileInputStream(file);
                         FileChannel fc = fis.getChannel();
                         BigDecimal fileSize = new BigDecimal(fc.size());
@@ -522,7 +518,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             MaterialInfo info = new MaterialInfo();
             Long projectId = json.getLong("projectId");
             String code = json.getString("code");
-            info.setId(code + projectId);
+            info.setId(code + "_" + projectId);
             info.setCode(code);
             if (!Check.isNull(json.getString("watermarkUrl"))) {
                 info.setWatermarkUrl(json.getString("watermarkUrl"));
@@ -551,13 +547,15 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
                 info.setCoverUrl(coverUrl);
                 Thread thread = new Thread() {
-                        @Override
-                        public void run() { try {
+                    @Override
+                    public void run() {
+                        try {
                             log.info("开始抽帧,code:{}", code);
                             materialCutFrameService.getTencentCutFrame(videoUrl, code, coverUrl);
                         } catch (Exception e) {
                             e.printStackTrace();
-                        } }
+                        }
+                    }
                 };
                 thread.start();
             } else {
@@ -589,15 +587,15 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
                 }
             }
-
+            materialTagInfoService.deleteByCode(code);
             JSONArray modalityTagList = json.getJSONArray("modalityTagList");
-            insertTagList(code,userId,modalityTagList);
+            insertTagList(code, userId, modalityTagList);
             JSONArray contentTagList = json.getJSONArray("contentTagList");
-            insertTagList(code,userId,contentTagList);
+            insertTagList(code, userId, contentTagList);
             JSONArray senceTagList = json.getJSONArray("senceTagList");
-            insertTagList(code,userId,senceTagList);
+            insertTagList(code, userId, senceTagList);
             JSONArray modTagList = json.getJSONArray("modTagList");
-            insertTagList(code,userId,modTagList);
+            insertTagList(code, userId, modTagList);
             getFile(info, project.getMediaId());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
@@ -607,17 +605,18 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return resultMap;
     }
 
-    private void insertTagList(String code,String userId,JSONArray tagList){
-        if(null!=tagList&&!tagList.isEmpty()){
-            for(int m=0;m<tagList.size();m++){
+    private void insertTagList(String code, String userId, JSONArray tagList) {
+        if (null != tagList && !tagList.isEmpty()) {
+            for (int m = 0; m < tagList.size(); m++) {
                 Long tagId = tagList.getLong(m);
                 TagInfo tagInfo = tagInfoService.getById(tagId);
-                MaterialTagInfo setTag= new MaterialTagInfo(code,tagInfo,userId);
+                MaterialTagInfo setTag = new MaterialTagInfo(code, tagInfo, userId);
                 setTag.setCategoryId(tagInfo.getTagCategoryId());
                 materialTagInfoService.save(setTag);
             }
         }
     }
+
     @Autowired
     private ITagInfoService tagInfoService;
     @Autowired
@@ -649,7 +648,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         List<String> effiSignatureList = materialInfoMapper.getEffiSignature();
         for (String code : effiSignatureList) {
             MaterialInfo materialInfo = materialInfoMapper.getMaterialInfoByCode(code);
-
             if (materialInfo == null) {
                 continue;
             }
@@ -677,6 +675,58 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     public List<MaterialInfo> getListByDate(String startDate, String endDate) {
         return materialInfoMapper.getListByDate(startDate, endDate);
     }
+
+    @Override
+    public Map<String,Object> getListByParams(String tagCode,String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
+        Map<String,Object> result = new HashMap<>();
+        PageHelper.startPage(pageNo,pageSize);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate, userId);
+        List<MaterialInfo> setList = new ArrayList<>();
+        PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
+        if(null!=dailyList&&!dailyList.isEmpty()){
+            for(MaterialInfo info:dailyList){
+                MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
+                //判断是否已经同步到快手平台
+                Integer kuaishouMaterialUpCount = this.getKuaishouUpVideoCount(info.getCode());
+                if (kuaishouMaterialUpCount > 0) {
+                    materialInfo.setKuaishouVideoIsUp(1);
+                } else {
+                    materialInfo.setKuaishouVideoIsUp(0);
+                }
+                //判断是否已经同步到抖音平台
+                Integer toutiaoMaterialUpCount = this.getToutiaoUpVideoCount(info.getCode());
+                if (toutiaoMaterialUpCount > 0) {
+                    materialInfo.setToutiaoVideoIsUp(1);
+                } else {
+                    materialInfo.setToutiaoVideoIsUp(0);
+                }
+
+                //TODO 消耗统计
+
+                Project project = projectService.getById(info.getProjectId());
+                if (!Check.isNull(project)) {
+                    materialInfo.setMediaId(project.getMediaId());
+                    materialInfo.setProjectName(project.getProjectName());
+                }
+
+                QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
+                imageInfoQueryWrapper.eq("video_id", info.getCode());
+                imageInfoQueryWrapper.eq("status", 0);
+                List<MaterialImageInfo> imageInfoList = materialImageInfoService.list(imageInfoQueryWrapper);
+                if (Check.isNull(imageInfoList)) {
+                    materialInfo.setWhetherUnaudited(false);
+                } else {
+                    materialInfo.setWhetherUnaudited(true);
+                }
+
+                setList.add(materialInfo);
+            }
+        }
+        pageInfo.setList(setList);
+        result.put("data",pageInfo);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
 }
 
 

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

@@ -96,7 +96,8 @@ public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMappe
         return this.list(queryWrapper);
     }
 
-    private void deleteByCode(String code) {
+    @Override
+    public void deleteByCode(String code) {
         UpdateWrapper<MaterialTagInfo>updateWrapper = new UpdateWrapper<>();
         updateWrapper.eq("code",code).set("status",0).set("update_time",new Date());
         this.update(updateWrapper);

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

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

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

@@ -103,4 +103,20 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     public List<JSONObject> getAccountListByProject(Long projectId) {
         return userAllocationMapper.getAccountListByProject(projectId);
     }
+
+    /**
+     * 获取项目下的所有userId
+     *
+     * @param projectId
+     * @return
+     */
+    @Override
+    public List<JSONObject> getUserIdListByProjectId(Long projectId) {
+        return userAllocationMapper.getUserIdListByProjectId(projectId);
+    }
+
+    @Override
+    public List<JSONObject> getAccountIdListByUserId(Long userId) {
+        return userAllocationMapper.getAccountIdListByUserId(userId);
+    }
 }

+ 99 - 34
module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java

@@ -1,8 +1,18 @@
 package cn.com.ctop.common.module.utils;
 
 
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.xssf.usermodel.*;
+import org.apache.poi.ss.usermodel.BorderStyle;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
+import org.apache.poi.xssf.usermodel.XSSFFont;
+import org.apache.poi.xssf.usermodel.XSSFRichTextString;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -92,8 +102,94 @@ public class ExportExcelUtils {
         }
     }
 
+
+    public void exportExcelForAttendance(XSSFWorkbook workbook, int sheetNum, String sheetTitle, String[] headers, List<List<Object>> result) {
+        // 生成一个表格
+        XSSFSheet sheet = workbook.createSheet();
+        workbook.setSheetName(sheetNum, sheetTitle);
+        // 设置表格默认列宽度为20个字节
+        sheet.setDefaultColumnWidth((short) 20);
+        // 生成一个样式
+        XSSFCellStyle style = workbook.createCellStyle();
+        XSSFCellStyle style2 = workbook.createCellStyle();
+        XSSFCellStyle style3 = workbook.createCellStyle();
+        // 设置这些样式
+        style.setFillForegroundColor(IndexedColors.PALE_BLUE.index);
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setBorderTop(BorderStyle.THIN);
+        // style.setAlignment(HorizontalAlignment.CENTER);
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
+        // 生成一个字体
+        XSSFFont font = workbook.createFont();
+        font.setColor(IndexedColors.BLACK.index);
+        font.setFontHeightInPoints((short) 12);
+        font.setBold(true);
+        // 把字体应用到当前的样式
+        style.setFont(font);
+
+        // 指定当单元格内容显示不下时自动换行
+        style.setWrapText(true);
+        //迟到时间超过15分钟的考勤记录样式(标黄)
+        style2.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.index);
+        style2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style2.setBorderBottom(BorderStyle.THIN);
+        style2.setBorderLeft(BorderStyle.THIN);
+        style2.setBorderRight(BorderStyle.THIN);
+        style2.setBorderTop(BorderStyle.THIN);
+        // 产生表格标题行
+        XSSFRow row = sheet.createRow(0);
+        for (int i = 0; i < headers.length; i++) {
+            XSSFCell cell = row.createCell((short) i);
+            cell.setCellStyle(style);
+            XSSFRichTextString text = new XSSFRichTextString(headers[i]);
+            cell.setCellValue(text.toString());
+        }
+        // 遍历集合数据,产生数据行
+        if (result != null) {
+            int index = 1;
+            for (List<Object> m : result) {
+                row = sheet.createRow(index);
+                int cellIndex = 0;
+                //迟到时间超过15分钟的考勤记录判断
+                boolean changeColor = false;
+                if (m.contains("迟到")) {
+                    String duration = String.valueOf(m.get(m.size() - 2));
+                    if (!Check.isNull(duration) && Integer.valueOf(duration.replace(" min", "")) - 15 > 0) {
+                        changeColor = true;
+                    }
+                }
+                for (Object obj : m) {
+                    XSSFCell cell = row.createCell((short) cellIndex);
+                    if (!Check.isNull(obj)) {
+                        if (changeColor) {
+                            cell.setCellStyle(style2);
+                        }
+                        if (obj instanceof String) {
+                            cell.setCellValue((String) obj);
+                        } else if (obj instanceof Double) {
+                            cell.setCellValue((Double) obj);
+                        } else if (obj instanceof BigDecimal) {
+                            BigDecimal bigDecimal = (BigDecimal) obj;
+                            cell.setCellValue(bigDecimal.doubleValue());
+                        } else if (obj instanceof Long) {
+                            cell.setCellValue(String.valueOf(obj));
+                        } else {
+                            cell.setCellValue(obj.toString());
+                        }
+                    }
+                    cellIndex++;
+                }
+                index++;
+            }
+        }
+    }
+
     public void exportExcelForMediaReport(XSSFWorkbook workbook, int sheetNum,
-                            String sheetTitle, String[] headers, List<List<Object>> result) {
+                                          String sheetTitle, String[] headers, List<List<Object>> result) {
         // 生成一个表格
         XSSFSheet sheet = workbook.createSheet();
         workbook.setSheetName(sheetNum, sheetTitle);
@@ -180,35 +276,4 @@ public class ExportExcelUtils {
     }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 }

+ 52 - 0
module-common/src/main/java/com/xxl/job/core/enums/NoEn.java

@@ -0,0 +1,52 @@
+package com.xxl.job.core.enums;
+
+/**
+ * 项目中0~25数字字符串枚举
+ *
+ * @ClassName GeneralConstant
+ * @Author ZHAOXA
+ * @date 2020-09-29 10:33
+ */
+public enum NoEn {
+    NO0("0", 0),
+    NO1("1", 1),
+    NO2("2", 2),
+    NO3("3", 3),
+    NO4("4", 4),
+    NO5("5", 5),
+    NO6("6", 6),
+    NO7("7", 7),
+    NO8("8", 8),
+    NO9("9", 9),
+    NO10("10", 10),
+    NO11("11", 11),
+    NO12("12", 12),
+    NO13("13", 13),
+    NO14("14", 14),
+    NO15("15", 15),
+    NO16("16", 16),
+    NO17("17", 17),
+    NO18("18", 18),
+    NO19("19", 19),
+    NO20("20", 20),
+    NO21("21", 21),
+    NO22("22", 21),
+    NO23("23", 23),
+    NO24("24", 24),
+    NO25("25", 25);
+    private final String strValue;
+    private final int intValue;
+
+    private NoEn(String strValue, int intValue) {
+        this.strValue = strValue;
+        this.intValue = intValue;
+    }
+
+    public String valueStr() {
+        return strValue;
+    }
+
+    public int valueInt() {
+        return intValue;
+    }
+}

+ 10 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java

@@ -112,6 +112,10 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
             crawlerDouyinMusicTask.setStatus("parsed");
             crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusicTask);
         }catch (Exception e){
+            CrawlerDouyinMusicTask crawlerDouyinMusicTask = new CrawlerDouyinMusicTask();
+            crawlerDouyinMusicTask.setId(musicInfo.getExtId());
+            crawlerDouyinMusicTask.setStatus("error");
+            crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusicTask);
             e.printStackTrace();
         }
     }
@@ -153,7 +157,7 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
                     for (int i = 0; i < size; i++){
                         CrawlerDouyinMusicTask crawlerDouyinMusicTask = crawlerDouyinMusicTaskService.getById(dataNode.get(i).asLong());
                         if(crawlerDouyinMusicTask == null){
-                            crawlerDouyinMusicTask = new CrawlerDouyinMusicTask(); 
+                            crawlerDouyinMusicTask = new CrawlerDouyinMusicTask();
                             crawlerDouyinMusicTask.setId(dataNode.get(i).asLong());
                             crawlerDouyinMusicTask.setStatus("init");
                             crawlerDouyinMusicTaskService.replaceInto(crawlerDouyinMusicTask);
@@ -162,6 +166,10 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
                 }
             }
         } catch (IOException e) {
+            CrawlerDouyinMusicTask crawlerDouyinMusic = new CrawlerDouyinMusicTask();
+            crawlerDouyinMusic.setId(musicInfo.getExtId());
+            crawlerDouyinMusic.setStatus("error");
+            crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusic);
             e.printStackTrace();
         }
         return musicInfo;
@@ -169,7 +177,7 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
     public static void main(String[] args){
         DouyinMusicServiceImpl douyinMusicService = new DouyinMusicServiceImpl();
         MusicInfo musicInfo = new MusicInfo();
-        musicInfo.setExtId(6705193173741733889L);
+        musicInfo.setExtId(12646L);
         douyinMusicService.getMusicInfo(musicInfo);
     }
 }

+ 5 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/entity/MusicInfoKuaishou.java

@@ -59,7 +59,7 @@ public class MusicInfoKuaishou {
 		this.begin = music.getLong("begin");
 		this.end = music.getLong("end");
 		this.name = music.getString("name");
-		this.id = music.getString("id");
+		this.id = music.getString("id")+"-"+channelType;
 		this.type = music.getInteger("type");
 		JSONArray lrcUrls = music.getJSONArray("lrcUrls");
 		if(null!=lrcUrls&&!lrcUrls.isEmpty()){
@@ -70,7 +70,10 @@ public class MusicInfoKuaishou {
 			this.audioUrl = audioUrls.getJSONObject(0).getString("url");
 		}
 		this.avatarUrl = music.getString("avatarUrl");
-		this.snippetUrl = music.getString("snippetUrls");
+		JSONArray snippetUrls = music.getJSONArray("snippetUrls");
+		if(null!=snippetUrls&&!snippetUrls.isEmpty()){
+			this.snippetUrl = snippetUrls.getJSONObject(0).getString("url");
+		}
 		this.singingCount = music.getLong("singingCount");
 		this.snippetDuration = music.getLong("snippetDuration");
 		this.url = music.getString("url");

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java

@@ -58,7 +58,7 @@ public class TaobaoJhsbybtServiceImpl implements TaobaoJhsbybtService {
 
     public static void main(String[] args) {
         try {
-            PrintStream out = new PrintStream("D:/bybt0916.csv");
+            PrintStream out = new PrintStream("D:/bybt0929.csv");
             System.setOut(out);
         } catch (FileNotFoundException e) {
             e.printStackTrace();

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java

@@ -57,7 +57,7 @@ public class TaobaoTttmServiceImpl implements TaobaoTttmService {
 
     public static void main(String[] args) {
         try {
-            PrintStream out = new PrintStream("D:/tttm0831.csv");
+            PrintStream out = new PrintStream("D:/tttm0903.csv");
             System.setOut(out);
         } catch (FileNotFoundException e) {
             e.printStackTrace();

+ 12 - 0
module-job-bytedance/pom.xml

@@ -79,6 +79,12 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-oa</artifactId>
+            <version>2.0.2</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
             <groupId>com.aliyun.oss</groupId>
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>3.5.0</version>
@@ -139,6 +145,12 @@
             <artifactId>module-check</artifactId>
             <version>2.0.2</version>
         </dependency>
+        <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-oa</artifactId>
+            <version>2.0.2</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <dependencyManagement>

+ 0 - 1
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCleanMaterialJob.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;

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

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

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

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

+ 45 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatApproveAttendanceJob.java

@@ -0,0 +1,45 @@
+package cn.com.ctop.job.bytedance.handler;
+
+
+import cn.com.ctop.oa.modules.service.IWechatNoListService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 异常考勤审批数据入库
+ *
+ * @param
+ * @author ZHAOXA
+ * @return
+ * @throws
+ */
+@Component
+public class WechatApproveAttendanceJob {
+    @Autowired
+    private IWechatNoListService wechatNoListService;
+
+    /**
+     * 异常考勤审批数据入库
+     * 频率:每月2日凌晨2点同步审批数据 cron:0 0 2 2 * ?
+     * 审批状态表
+     * starttime 统计开始时间,上个月1号零时零分的时间 例:2020-08-01 00:00:00;
+     * endtime 统计结束时间,本月1号零时零分的时间 例:2020-09-01 00:00:00;
+     *
+     * @author ZHAOXA
+     */
+    @XxlJob("wechatApproveAttendanceJob")
+    public ReturnT<String> execute() throws Exception {
+        XxlJobLogger.log("--------异常考勤审批数据入库 start ");
+        String initMonth = DateUtils.initDateByMonth();
+        long starttime = DateUtils.timeToStamp(DateUtils.getMonthBefore(DateUtils.NEW_FORMAT, initMonth, -1));
+        long endtime = DateUtils.timeToStamp(initMonth);
+        //更新审批状态表
+        wechatNoListService.getNoDateByNo(String.valueOf(starttime), String.valueOf(endtime));
+        XxlJobLogger.log("--------异常考勤审批数据入库 end ");
+        return ReturnT.SUCCESS;
+    }
+}

+ 43 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatAttendanceJob.java

@@ -0,0 +1,43 @@
+package cn.com.ctop.job.bytedance.handler;
+
+
+import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
+import cn.com.ctop.oa.modules.service.IWechatUserListService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class WechatAttendanceJob {
+    @Autowired
+    private IWechatCheckinDataService wechatCheckinDataService;
+    @Autowired
+    private IWechatUserListService wechatUserInfoService;
+
+    /**
+     * 考勤数据入库
+     * 员工打卡明细表 每日凌晨2点统计前一天的考勤数据 cron:0 0 2 * * ?
+     * <p>
+     * 人员信息表 每日凌晨2点统计前一天的人员数据 cron:0 0 2 * * ?
+     *
+     * @author ZHAOXA
+     */
+    @XxlJob("wechatAttendanceJob")
+    public ReturnT<String> execute(String params) throws Exception {
+        XxlJobLogger.log("--------考勤数据入库 start ");
+        String beforeDay = DateUtils.getLastDay(DateUtils.formatDate(new Date()));
+        long starttime = DateUtils.timeToStamp(beforeDay + " 00:00:00");
+        long endtime = DateUtils.timeToStamp(beforeDay + " 23:59:59");
+        //更新员工打卡明细表
+        wechatCheckinDataService.getCheckinData(String.valueOf(starttime), String.valueOf(endtime));
+        //更新人员信息表
+        wechatUserInfoService.getUserList();
+        XxlJobLogger.log("--------考勤数据入库 end ");
+        return ReturnT.SUCCESS;
+    }
+}

+ 0 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouCleanMaterialJob.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.job.kuaishou.handler;
 
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;

+ 99 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouRealTimeController.java

@@ -0,0 +1,99 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouRealTimeDataService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+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;
+
+/**
+ * @Description: 广告组-app信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+@Slf4j
+@RestController
+@RequestMapping("/kuaishou/realTime")
+public class KuaiShouRealTimeController {
+    @Autowired
+    private IKuaishouRealTimeDataService realTimeDataService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+
+
+    @PostMapping(value = "/getCampaignDate")
+    public Result<JSONArray> getCampaignDate(@RequestBody JSONObject requestJson) {
+        Result<JSONArray> result = new Result<>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                throw new Exception("请传入账户id");
+            }
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+            Long campaignId = requestJson.getLong("campaignId");
+            if (Check.isNull(campaignId)) {
+                throw new Exception("请传入计划id");
+            }
+            String startDate = requestJson.getString("startDate");
+            String endDate = requestJson.getString("endDate");
+            if (Check.isNull(startDate) || Check.isNull(endDate)) {
+                throw new Exception("请选择开始、结束查询时间");
+            }
+            JSONArray campaignDate = realTimeDataService.getCampaignDate(accountId, oauthToken.getAccessToken(), campaignId, startDate, endDate);
+            result.setSuccess(true);
+            result.setResult(campaignDate);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
+
+    @PostMapping(value = "/getUnitDate")
+    public Result<JSONArray> getUnitDate(@RequestBody JSONObject requestJson) {
+        Result<JSONArray> result = new Result<>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                throw new Exception("请传入账户id");
+            }
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+            Long unitId = requestJson.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                throw new Exception("请传入组id");
+            }
+            String startDate = requestJson.getString("startDate");
+            String endDate = requestJson.getString("endDate");
+            if (Check.isNull(startDate) || Check.isNull(endDate)) {
+                throw new Exception("请选择开始、结束查询时间");
+            }
+            JSONArray unitData = realTimeDataService.getUnitDate(accountId, oauthToken.getAccessToken(), unitId, startDate, endDate);
+            result.setSuccess(true);
+            result.setResult(unitData);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
+}

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

@@ -0,0 +1,9 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import com.alibaba.fastjson.JSONArray;
+
+public interface IKuaishouRealTimeDataService {
+    JSONArray getCampaignDate(Long accountId, String token, Long campaignId, String startDate, String endDate);
+
+    JSONArray getUnitDate(Long accountId, String token, Long unitId, String startDate, String endDate);
+}

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

@@ -154,7 +154,7 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
 
                     };
                     thread.start();
-
+                }else if(task.getViewType() == 7){
 
                 }
             }

+ 17 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -12,10 +12,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskServ
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -159,6 +156,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     public void getTaskList() {
         log.info("开始历史数据文件检查下载");
         QueryWrapper<KuaiShouHistoryReportTask> taskQueryWrapper = new QueryWrapper<>();
+        taskQueryWrapper.eq("view_type",7);
         taskQueryWrapper.eq("task_status", 0);
         taskQueryWrapper.orderByDesc("create_time");
         List<KuaiShouHistoryReportTask> taskList = this.list(taskQueryWrapper);
@@ -251,6 +249,9 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
                     };
                     thread.start();
+                }else if (task.getViewType() == 7){
+                    //封面报表
+                    kuaishouReportDailyImageMapper.loadImageDailyReport(task.getAccountId(),localPath);
                 }
 
 
@@ -265,27 +266,32 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
     }
 
+    @Autowired
+    private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
+
 
     private void getHistoryTypeList() {
 
         historyTypeList = new ArrayList<>();
-        historyTypeList.add(5);
+       /* historyTypeList.add(5);
         historyTypeList.add(1);
         historyTypeList.add(2);
         historyTypeList.add(3);
         historyTypeList.add(10);
-        historyTypeList.add(4);
+        historyTypeList.add(4);*/
+        historyTypeList.add(7);
 
 
     }
 
     private void getDailyTypeList() {
         dailyTypeList = new ArrayList<>();
-        dailyTypeList.add(2);
-        dailyTypeList.add(3);
-        dailyTypeList.add(4);
-        dailyTypeList.add(5);
-        dailyTypeList.add(10);
+//        dailyTypeList.add(2);
+//        dailyTypeList.add(3);
+//        dailyTypeList.add(4);
+//        dailyTypeList.add(5);
+//        dailyTypeList.add(10);
+        historyTypeList.add(7);
     }
 
 

+ 110 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouRealTimeDataServiceImpl.java

@@ -0,0 +1,110 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouRealTimeDataService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class KuaishouRealTimeDataServiceImpl implements IKuaishouRealTimeDataService {
+    /**
+     * 获取计划实时数据
+     *
+     * @param accountId
+     * @param token
+     * @param campaignId
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @Override
+    public JSONArray getCampaignDate(Long accountId, String token, Long campaignId, String startDate, String endDate) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_REPORT;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token);
+        Map<String, Object> param = new HashMap<>();
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
+        param.put("advertiser_id", accountId);
+        param.put("temporal_granularity", "DAILY");
+        param.put("page_size", 2000);
+        param.put("page", 1);
+
+        JSONArray array = new JSONArray();
+        array.add(campaignId);
+        param.put("campaign_ids", array);
+        try {
+            String result = HttpUtils.httpPostRequest(url, param, headers);
+            System.err.println(result);
+            JSONObject jsonObject = JSONObject.parseObject(result);
+            if (!Check.isNull(jsonObject)) {
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    JSONObject data = jsonObject.getJSONObject("data");
+                    if (!Check.isNull(data)) {
+                        return data.getJSONArray("details");
+                    }
+
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 获取组实时数据
+     *
+     * @param accountId
+     * @param token
+     * @param unitId
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @Override
+    public JSONArray getUnitDate(Long accountId, String token, Long unitId, String startDate, String endDate) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token);
+        Map<String, Object> param = new HashMap<>();
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
+        param.put("advertiser_id", accountId);
+        param.put("temporal_granularity", "DAILY");
+        param.put("page_size", 2000);
+        param.put("page", 1);
+
+        JSONArray array = new JSONArray();
+        array.add(unitId);
+        param.put("unit_ids", array);
+        try {
+            String result = HttpUtils.httpPostRequest(url, param, headers);
+            JSONObject jsonObject = JSONObject.parseObject(result);
+            if (!Check.isNull(jsonObject)) {
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    JSONObject data = jsonObject.getJSONObject("data");
+                    if (!Check.isNull(data)) {
+                        return data.getJSONArray("details");
+                    }
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouCleanMaterialReportController.java

@@ -1,8 +1,8 @@
 package cn.com.ctop.kuaishou.modules.report.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.service.IKuaiShouCleanMaterialReportService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

+ 290 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyImage.java

@@ -0,0 +1,290 @@
+package cn.com.ctop.kuaishou.modules.report.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
+ * @date   2020-09-28
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_report_daily_image")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_kuaishou_report_daily_image对象", description="快手图片报表")
+public class KuaishouReportDailyImage {
+
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**账户ID*/
+	@Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+	private Integer coverId;
+	/**计划ID*/
+	@Excel(name = "计划ID", width = 15)
+    @ApiModelProperty(value = "计划ID")
+	private Integer photoId;
+	/**channelType*/
+	@Excel(name = "channelType", width = 15)
+    @ApiModelProperty(value = "channelType")
+	private Integer channelType;
+	/**signature*/
+	@Excel(name = "signature", width = 15)
+    @ApiModelProperty(value = "signature")
+	private String signature;
+	/**封面token*/
+	@Excel(name = "封面token", width = 15)
+    @ApiModelProperty(value = "封面token")
+	private String imageToken;
+	/**封面url*/
+	@Excel(name = "封面url", width = 15)
+    @ApiModelProperty(value = "封面url")
+	private String coverUrl;
+	/**视频uel*/
+	@Excel(name = "视频uel", width = 15)
+    @ApiModelProperty(value = "视频uel")
+	private String photoUrl;
+	/**素材类型*/
+	@Excel(name = "素材类型", width = 15)
+    @ApiModelProperty(value = "素材类型")
+	private String creativeMaterialTypeString;
+	/**场景*/
+	@Excel(name = "场景", width = 15)
+    @ApiModelProperty(value = "场景")
+	private String adScene;
+	/**花费(元)*/
+	@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 aclick;
+	/**行为数*/
+	@Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+	private Integer bclick;
+	/**分享数*/
+	@Excel(name = "分享数", width = 15)
+    @ApiModelProperty(value = "分享数")
+	private Integer photoShare;
+	/**评论数*/
+	@Excel(name = "评论数", width = 15)
+    @ApiModelProperty(value = "评论数")
+	private Integer photoComment;
+	/**点赞数*/
+	@Excel(name = "点赞数", width = 15)
+    @ApiModelProperty(value = "点赞数")
+	private Integer photoLike;
+	/**新增关注数*/
+	@Excel(name = "新增关注数", width = 15)
+    @ApiModelProperty(value = "新增关注数")
+	private Integer follow;
+	/**取消关注数*/
+	@Excel(name = "取消关注数", width = 15)
+    @ApiModelProperty(value = "取消关注数")
+	private Integer cancelFollow;
+	/**举报数*/
+	@Excel(name = "举报数", width = 15)
+    @ApiModelProperty(value = "举报数")
+	private Integer report;
+	/**拉黑数*/
+	@Excel(name = "拉黑数", width = 15)
+    @ApiModelProperty(value = "拉黑数")
+	private Integer block;
+	/**减少此类作品数*/
+	@Excel(name = "减少此类作品数", width = 15)
+    @ApiModelProperty(value = "减少此类作品数")
+	private Integer negative;
+	/**应用下载数据-安卓下载开始数*/
+	@Excel(name = "应用下载数据-安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
+	private Integer downloadStarted;
+	/**应用下载数据-安卓下载完成数*/
+	@Excel(name = "应用下载数据-安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
+	private Integer downloadCompleted;
+	/**应用下载数据-激活数*/
+	@Excel(name = "应用下载数据-激活数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-激活数")
+	private Integer activation;
+	/**提交按钮点击数*/
+	@Excel(name = "提交按钮点击数", width = 15)
+    @ApiModelProperty(value = "提交按钮点击数")
+	private Integer submit;
+	/**日期*/
+	@Excel(name = "日期", width = 15)
+    @ApiModelProperty(value = "日期")
+	private String statDate;
+	/**封面点击数*/
+	@Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+	private Integer photoClick;
+	/**封面点击率*/
+	@Excel(name = "封面点击率", width = 15)
+    @ApiModelProperty(value = "封面点击率")
+	private Double photoClickRatio;
+	/**行为率*/
+	@Excel(name = "行为率", width = 15)
+    @ApiModelProperty(value = "行为率")
+	private Double actionRatio;
+	/**平均千次曝光花费(元)*/
+	@Excel(name = "平均千次曝光花费(元)", width = 15)
+    @ApiModelProperty(value = "平均千次曝光花费(元)")
+	private java.math.BigDecimal impression1kCost;
+	/**平均点击单价(元)*/
+	@Excel(name = "平均点击单价(元)", width = 15)
+    @ApiModelProperty(value = "平均点击单价(元)")
+	private java.math.BigDecimal photoClickCost;
+	/**平均行为单价(元)*/
+	@Excel(name = "平均行为单价(元)", width = 15)
+    @ApiModelProperty(value = "平均行为单价(元)")
+	private java.math.BigDecimal actionCost;
+	/**应用下载数据-首日付费次数*/
+	@Excel(name = "应用下载数据-首日付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费次数")
+	private Integer eventPayFirstDay;
+	/**应用下载数据-首日付费金额*/
+	@Excel(name = "应用下载数据-首日付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费金额")
+	private java.math.BigDecimal eventPayPurchaseAmountFirstDay;
+	/**应用下载数据-首日ROI*/
+	@Excel(name = "应用下载数据-首日ROI", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日ROI")
+	private Double eventPayFirstDayRoi;
+	/**应用下载数据-付费次数*/
+	@Excel(name = "应用下载数据-付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费次数")
+	private Integer eventPay;
+	/**应用下载数据-付费金额*/
+	@Excel(name = "应用下载数据-付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费金额")
+	private java.math.BigDecimal eventPayPurchaseAmount;
+	/**应用下载数据-ROI*/
+	@Excel(name = "应用下载数据-ROI", width = 15)
+    @ApiModelProperty(value = "应用下载数据-ROI")
+	private Double eventPayRoi;
+	/**应用下载数据-注册数*/
+	@Excel(name = "应用下载数据-注册数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册数")
+	private Integer eventRegister;
+	/**应用下载数据-注册成本*/
+	@Excel(name = "应用下载数据-注册成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册成本")
+	private java.math.BigDecimal eventRegisterCost;
+	/**应用下载数据-注册率*/
+	@Excel(name = "应用下载数据-注册率", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册率")
+	private Double eventRegisterRatio;
+	/**应用下载数据-完件数*/
+	@Excel(name = "应用下载数据-完件数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件数")
+	private Integer eventJinJianApp;
+	/**应用下载数据-完件成本*/
+	@Excel(name = "应用下载数据-完件成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件成本")
+	private java.math.BigDecimal eventJinJianAppCost;
+	/**应用下载数据-授信数*/
+	@Excel(name = "应用下载数据-授信数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信数")
+	private Integer eventCreditGrantApp;
+	/**应用下载数据-授信成本*/
+	@Excel(name = "应用下载数据-授信成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信成本")
+	private java.math.BigDecimal eventCreditGrantAppCost;
+	/**应用下载数据-授信率*/
+	@Excel(name = "应用下载数据-授信率", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信率")
+	private Double eventCreditGrantAppRatio;
+	/**应用下载数据-付款成功数*/
+	@Excel(name = "应用下载数据-付款成功数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功数")
+	private Integer eventOrderPaid;
+	/**应用下载数据-付款成功金额*/
+	@Excel(name = "应用下载数据-付款成功金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功金额")
+	private java.math.BigDecimal eventOrderPaidPurchaseAmount;
+	/**落地页数据-落地页完件数*/
+	@Excel(name = "落地页数据-落地页完件数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页完件数")
+	private Integer eventJinJianLandingPage;
+	/**落地页数据-落地页完件成本*/
+	@Excel(name = "落地页数据-落地页完件成本", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页完件成本")
+	private java.math.BigDecimal eventJinJianLandingPageCost;
+	/**落地页数据-落地页授信数*/
+	@Excel(name = "落地页数据-落地页授信数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信数")
+	private Integer eventCreditGrantLandingPage;
+	/**落地页数据-落地页授信成本*/
+	@Excel(name = "落地页数据-落地页授信成本", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信成本")
+	private java.math.BigDecimal eventCreditGrantLandingPageCost;
+	/**落地页数据-落地页授信率*/
+	@Excel(name = "落地页数据-落地页授信率", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信率")
+	private Double eventCreditGrantLandingRatio;
+	/**应用下载数据-次留成本(仅支持分日查询)*/
+	@Excel(name = "应用下载数据-次留成本(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留成本(仅支持分日查询)")
+	private java.math.BigDecimal eventNextDayStayCost;
+	/**应用下载数据-次留率(仅支持分日查询)*/
+	@Excel(name = "应用下载数据-次留率(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留率(仅支持分日查询)")
+	private Integer eventNextDayStayRatio;
+	/**落地页数据-表单提交点击率*/
+	@Excel(name = "落地页数据-表单提交点击率", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交点击率")
+	private Double formActionRatio;
+	/**应用下载数据-单次付款成本*/
+	@Excel(name = "应用下载数据-单次付款成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-单次付款成本")
+	private java.math.BigDecimal eventOrderPaidCost;
+	/**应用下载数据-次留数(仅支持分日查询)*/
+	@Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
+	private Integer eventNextDayStay;
+	/**落地页数据-表单提交单价*/
+	@Excel(name = "落地页数据-表单提交单价", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交单价")
+	private java.math.BigDecimal formCost;
+	/**落地页数据-表单提交数*/
+	@Excel(name = "落地页数据-表单提交数", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交数")
+	private Integer formCount;
+	/**3s播放率*/
+	@Excel(name = "3s播放率", width = 15)
+    @ApiModelProperty(value = "3s播放率")
+	private Double play3sRatio;
+	/**创建时间*/
+	@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;
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java

@@ -1,6 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyImageMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyImage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手图片报表
+ * @author: jeecg-boot
+ * @date:   2020-09-28
+ * @cersion: V1.0
+ */
+public interface KuaishouReportDailyImageMapper extends BaseMapper<KuaishouReportDailyImage> {
+
+    void loadImageDailyReport(Long accountId, String localPath);
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml

@@ -266,7 +266,7 @@
     </select>
 
     <select id="calculationMaterialReport"
-            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport">
+            resultType="cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport">
         select
         signature id,
         sum(charge) charge,

+ 106 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml

@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyImageMapper">
+
+    <insert id="loadImageDailyReport">
+        LOAD DATA local INFILE  #{localPath}
+	    REPLACE INTO TABLE ctop_kuaishou_report_daily_image CHARACTER SET utf8mb4
+		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
+		IGNORE 1 LINES
+		(cover_id,
+		image_token,
+		cover_url,
+		@ad_scene,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        @stat_hour,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        @click_1k_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_order_paid_cost,
+        form_count,
+        form_cost,
+        form_action_ratio,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio,
+        event_next_day_stay_cost,
+        event_next_day_stay_ratio,
+        event_next_day_stay,
+        play_3s_ratio,
+        @event_valid_clues,
+        @event_valid_clues_cost,
+        @ad_product_cnt,
+        @event_goods_view,
+        @merchant_reco_fans,
+        @event_order_amount_roi,
+        @event_goods_view_cost,
+        @merchant_reco_fans_cost,
+        @event_new_user_pay,
+        @event_new_user_pay_cost,
+        @event_new_user_pay_ratio,
+        @event_button_click,
+        @event_button_click_cost,
+        @event_button_click_ratio,
+        @play_5s_ratio,
+        @play_end_ratio,
+        @event_order_paid_roi,
+        @event_new_user_jinjian_app,
+        @event_new_user_jinjian_app_cost,
+        @event_new_user_jinjian_app_roi,
+        @event_new_user_credit_grant_app,
+        @event_new_user_credit_grant_app_cost,
+        @event_new_user_credit_grant_app_roi,
+        @event_new_user_jinjian_page,
+        @event_new_user_jinjian_page_cost,
+        @event_new_user_jinjian_page_roi,
+        @event_new_user_credit_grant_page,
+        @event_new_user_credit_grant_page_cost,
+        @event_new_user_credit_grant_page_roi,
+        @event_appoint_form,
+        @event_appoint_form_cost,
+        @event_appoint_form_ratio,
+        @event_appoint_jump_click,
+        @event_appoint_jump_click_cost,
+        @event_appoint_jump_click_ratio
+        )
+          set account_id = #{accountId}
+    </insert>
+</mapper>

+ 0 - 29
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouCleanMaterialReportService.java

@@ -1,29 +0,0 @@
-package cn.com.ctop.kuaishou.modules.report.service;
-
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-/**
- * 快手素材清洗数据
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-24
- */
-public interface IKuaiShouCleanMaterialReportService extends IService<KuaiShouCleanMaterialReport> {
-    /**
-     * 快手 唯一素材MD5标识
-     *
-     * @return
-     */
-    List<String> getSignature();
-
-    /**
-     * 计算快手素材报表
-     *
-     * @param signature
-     */
-    void calculationReport(String signature);
-}

+ 10 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCreativeService.java

@@ -3,5 +3,15 @@ package cn.com.ctop.kuaishou.modules.report.service;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 public interface IKuaishouReportDailyCreativeService extends IService<KuaishouReportDailyCreative> {
+    List<String> getSignature();
+
+    /**
+     * 计算快手素材报表
+     *
+     * @param signature
+     */
+    void calculationReport(String signature);
 }

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyImageService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyImage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手图片报表
+ * @Author: jeecg-boot
+ * @Date:   2020-09-28
+ * @Version: V1.0
+ */
+public interface IKuaishouReportDailyImageService extends IService<KuaishouReportDailyImage> {
+
+}

+ 0 - 41
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouCleanMaterialReportServiceImpl.java

@@ -1,41 +0,0 @@
-package cn.com.ctop.kuaishou.modules.report.service.impl;
-
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouCleanMaterialReportMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 快手素材清洗数据
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-24
- */
-@Service
-public class KuaiShouCleanMaterialReportServiceImpl extends ServiceImpl<KuaiShouCleanMaterialReportMapper, KuaiShouCleanMaterialReport> implements IKuaiShouCleanMaterialReportService {
-    @Autowired
-    private KuaishouReportDailyCreativeMapper kuaishouReportDailyCreativeMapper;
-
-    @Override
-    public List<String> getSignature() {
-        return kuaishouReportDailyCreativeMapper.getSignatureList();
-    }
-
-    @Override
-    public void calculationReport(String signature) {
-        if (Check.isNull(signature)) {
-            return;
-        }
-        KuaiShouCleanMaterialReport calculationMaterialReport = kuaishouReportDailyCreativeMapper.calculationMaterialReport(signature);
-        if (!Check.isNull(calculationMaterialReport)) {
-            this.saveOrUpdate(calculationMaterialReport);
-        }
-    }
-}

+ 27 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCreativeServiceImpl.java

@@ -1,11 +1,38 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.service.IKuaiShouCleanMaterialReportService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class KuaishouReportDailyCreativeServiceImpl extends ServiceImpl<KuaishouReportDailyCreativeMapper, KuaishouReportDailyCreative> implements IKuaishouReportDailyCreativeService {
+    @Autowired
+    private KuaishouReportDailyCreativeMapper kuaishouReportDailyCreativeMapper;
+    @Autowired
+    private IKuaiShouCleanMaterialReportService cleanMaterialReportService;
+
+    @Override
+    public List<String> getSignature() {
+        return kuaishouReportDailyCreativeMapper.getSignatureList();
+    }
+
+    @Override
+    public void calculationReport(String signature) {
+        if (Check.isNull(signature)) {
+            return;
+        }
+        KuaiShouCleanMaterialReport calculationMaterialReport = kuaishouReportDailyCreativeMapper.calculationMaterialReport(signature);
+        if (!Check.isNull(calculationMaterialReport)) {
+            cleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
+        }
+    }
+
 }

+ 18 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyImageServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyImage;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyImageMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手图片报表
+ * @author jeecg-boot
+ * @date   2020-09-28
+ * @version V1.0
+ */
+@Service
+public class KuaishouReportDailyImageServiceImpl extends ServiceImpl<KuaishouReportDailyImageMapper, KuaishouReportDailyImage> implements IKuaishouReportDailyImageService {
+
+}

+ 3 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/constant/QYWxConstant.java

@@ -8,6 +8,7 @@ public class QYWxConstant {
 
     public static final Integer QYWX_OA_AGENT_ID = 3010011;
     public static final String QYWX_OA_CORP_SECRET = "MDeiFSCwIlcmcR1zrYvmjNlsoYFGl8I770uuUezWgGE";
+    public static final String QYWX_APPROVA_CORP_SECRET = "qlk4nSc1vjxy0AHyX1f5bnGh7y2WtqN9lR__0WJA6zM";
 
 
     public static final String QYWX_API_URL = "https://qyapi.weixin.qq.com";  //企业微信api域名
@@ -15,6 +16,8 @@ public class QYWxConstant {
     public static final String QYWX_GET_TOKEN = "/cgi-bin/gettoken";  //获取token
     public static final String QYWX_USER_SIMPLELIST = "https://qyapi.weixin.qq.com/cgi-bin/user/simplelist";  //获取部门下员工简单信息
     public static final String QYWX_CHECKIN_DATA = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata";  //获取部门下员工简单信息
+    public static final String APP_ROVAL_INFO = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovalinfo";  //批量获取审批单号
+    public static final String APP_ROVAL_DETAIL = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail";  //获取审批申请详情
 
 
 }

+ 27 - 16
module-oa/src/main/java/cn/com/ctop/oa/modules/controller/WechatCheckinDataController.java

@@ -1,12 +1,12 @@
 package cn.com.ctop.oa.modules.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.oa.modules.entity.WechatCheckinData;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
 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 com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -19,7 +19,15 @@ 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.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
@@ -57,22 +65,25 @@ public class WechatCheckinDataController {
      * @param req
      * @return
      */
-    @AutoLog(value = "企业微信用户-分页列表查询")
-    @ApiOperation(value = "企业微信用户-分页列表查询", notes = "企业微信用户-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<WechatCheckinData>> queryPageList(WechatCheckinData wechatCheckinData,
-                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                          HttpServletRequest req) {
-        Result<IPage<WechatCheckinData>> result = new Result<>();
-        QueryWrapper<WechatCheckinData> queryWrapper = QueryGenerator.initQueryWrapper(wechatCheckinData, req.getParameterMap());
-        Page<WechatCheckinData> page = new Page<WechatCheckinData>(pageNo, pageSize);
-        IPage<WechatCheckinData> pageList = wechatCheckinDataService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
+    @AutoLog(value = "考勤打卡明细-分页列表查询")
+    @ApiOperation(value = "考勤打卡明细-分页列表查询", notes = "考勤打卡明细-分页列表查询")
+    @PostMapping(value = "/queryPageList")
+    public Result<PageInfo<WechatCheckinData>> queryPageList(@RequestBody Map<String, Object> paramsMap) {
+        Result<PageInfo<WechatCheckinData>> result = new Result<>();
+        try {
+            PageInfo<WechatCheckinData> pageData = wechatCheckinDataService.selectPageList(paramsMap);
+            if (!Check.isNull(pageData)) {
+                result.setResult(pageData);
+                result.setSuccess(true);
+            }
+        } catch (Exception e) {
+            log.error("考勤打卡明细-分页列表查询 error ", e);
+            result.error500("操作失败");
+        }
         return result;
     }
 
+
     /**
      * 添加
      *

+ 28 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/controller/WechatDepartmentController.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.oa.modules.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.oa.modules.entity.WechatDepartment;
 import cn.com.ctop.oa.modules.service.IWechatDepartmentService;
 import com.alibaba.fastjson.JSON;
@@ -19,7 +20,15 @@ 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.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
@@ -73,6 +82,24 @@ public class WechatDepartmentController {
         return result;
     }
 
+    @AutoLog(value = "部门列表List-列表查询")
+    @ApiOperation(value = "部门列表List-列表查询", notes = "部门列表List-列表查询")
+    @PostMapping(value = "/queryList")
+    public Result<List<WechatDepartment>> queryList() {
+        Result<List<WechatDepartment>> result = new Result<>();
+        try {
+            List<WechatDepartment> pageList = wechatDepartmentService.queryList();
+            if (!Check.isNull(pageList)) {
+                result.setResult(pageList);
+                result.setSuccess(true);
+            }
+        } catch (Exception e) {
+            log.error("部门列表List-列表查询 error ", e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
     /**
      * 添加
      *

+ 368 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/controller/WechatNoListController.java

@@ -0,0 +1,368 @@
+package cn.com.ctop.oa.modules.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.oa.modules.entity.WechatAttendance;
+import cn.com.ctop.oa.modules.entity.WechatNoList;
+import cn.com.ctop.oa.modules.service.IWechatNoListService;
+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 com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecg.common.api.vo.Result;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+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.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 审批信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-09-23
+ */
+@Slf4j
+@Api(tags = "审批信息")
+@RestController
+@RequestMapping("/oa/wechatNoList")
+public class WechatNoListController {
+    @Autowired
+    private IWechatNoListService wechatNoListService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param wechatNoList
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "审批信息-分页列表查询")
+    @ApiOperation(value = "审批信息-分页列表查询", notes = "审批信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<WechatNoList>> queryPageList(WechatNoList wechatNoList,
+                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                     HttpServletRequest req) {
+        Result<IPage<WechatNoList>> result = new Result<>();
+        QueryWrapper<WechatNoList> queryWrapper = QueryGenerator.initQueryWrapper(wechatNoList, req.getParameterMap());
+        Page<WechatNoList> page = new Page<WechatNoList>(pageNo, pageSize);
+        IPage<WechatNoList> pageList = wechatNoListService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param wechatNoList
+     * @return
+     */
+    @AutoLog(value = "审批信息-添加")
+    @ApiOperation(value = "审批信息-添加", notes = "审批信息-添加")
+    @PostMapping(value = "/add")
+    public Result<WechatNoList> add(@RequestBody WechatNoList wechatNoList) {
+        Result<WechatNoList> result = new Result<>();
+        try {
+            wechatNoListService.save(wechatNoList);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param wechatNoList
+     * @return
+     */
+    @AutoLog(value = "审批信息-编辑")
+    @ApiOperation(value = "审批信息-编辑", notes = "审批信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<WechatNoList> edit(@RequestBody WechatNoList wechatNoList) {
+        Result<WechatNoList> result = new Result<WechatNoList>();
+        WechatNoList wechatNoListEntity = wechatNoListService.getById(wechatNoList.getId());
+        if (wechatNoListEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = wechatNoListService.updateById(wechatNoList);
+            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 {
+            wechatNoListService.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<WechatNoList> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<WechatNoList> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.wechatNoListService.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<WechatNoList> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<WechatNoList> result = new Result<>();
+        WechatNoList wechatNoList = wechatNoListService.getById(id);
+        if (wechatNoList == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(wechatNoList);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<WechatNoList> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                WechatNoList wechatNoList = JSON.parseObject(deString, WechatNoList.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(wechatNoList, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<WechatNoList> pageList = wechatNoListService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "审批信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, WechatNoList.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("审批信息列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return AbnormalAttendance
+     */
+    @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<WechatNoList> listWechatNoLists = ExcelImportUtil.importExcel(file.getInputStream(), WechatNoList.class, params);
+                wechatNoListService.saveBatch(listWechatNoLists);
+                return Result.ok("文件导入成功!数据行数:" + listWechatNoLists.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("文件导入失败!");
+    }
+
+    /**
+     * 考勤异常记录 导出数据
+     *
+     * @param requestBody
+     * @param response
+     */
+    @PostMapping("/excel")
+    public void getExcelReport(HttpServletResponse response, @RequestBody Map<String, Object> paramsMap) {
+
+        List<WechatAttendance> excelData = wechatNoListService.queryAttendanceData(paramsMap);
+        List<WechatAttendance> overtimeData = wechatNoListService.queryOverTimeData(paramsMap);
+        try {
+            List<List<Object>> excelList = new ArrayList<>();
+            List<List<Object>> overtimeExcelList = new ArrayList<>();
+            if (!excelData.isEmpty()) {
+                excelData.forEach(data -> {
+                    List<Object> temp = new ArrayList<>();
+                    temp.add(data.getUserName());
+                    temp.add(data.getDepartName());
+                    temp.add(data.getCheckinDate());
+                    temp.add(data.getCheckinType());
+                    temp.add(data.getExceptionType());
+                    temp.add(data.getCheckinTime());
+                    temp.add(data.getType());
+                    temp.add(data.getStateDuration());
+                    if (!Check.isNull(data.getStatus())) {
+                        temp.add("1".equals(data.getStatus()) ? "审批中" : "已通过");
+                    } else {
+                        temp.add("");
+                    }
+                    excelList.add(temp);
+                });
+            }
+            if (!overtimeData.isEmpty()) {
+                overtimeData.forEach(data -> {
+                    List<Object> temp = new ArrayList<>();
+                    temp.add(data.getUserName());
+                    temp.add(data.getDepartName());
+                    temp.add(data.getCheckinDate());
+                    temp.add(data.getOvertime());
+                    overtimeExcelList.add(temp);
+                });
+            }
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            String[] titles = {"姓名", "部门", "考勤日期", "考勤类型", "考勤状态", "考勤时间", "审核状态", "状态时长", "审批状态"};
+            String[] overtimeTitles = {"姓名", "部门", "加班日期", "加班时长"};
+            eeu.exportExcelForAttendance(workbook, 0, "异常考勤", titles, excelList);
+            eeu.exportExcel(workbook, 1, "加班考勤", overtimeTitles, overtimeExcelList);
+            HttpUtils.setResponseHeader(response, "考勤记录.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        } catch (IOException e) {
+            log.error(e.getMessage());
+        }
+    }
+
+    /**
+     * 考勤异常数据查询(分页)
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "异常考勤数据-分页列表查询")
+    @PostMapping(value = "/selectNoListPage")
+    public Result<PageInfo<WechatAttendance>> selectNoListPage(@RequestBody Map<String, Object> paramsMap) {
+        Result<PageInfo<WechatAttendance>> result = new Result<>();
+        try {
+            PageInfo<WechatAttendance> pageData = wechatNoListService.selectNoListPage(paramsMap);
+            if (!Check.isNull(pageData)) {
+                result.setResult(pageData);
+                result.setSuccess(true);
+            }
+        } catch (Exception e) {
+            log.error("异常考勤数据-分页列表查询 error ", e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 加班考勤数据查询(分页)
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "加班考勤数据-分页列表查询")
+    @PostMapping(value = "/selectOverTimePage")
+    public Result<PageInfo<WechatAttendance>> selectOverTimePage(@RequestBody Map<String, Object> paramsMap) {
+        Result<PageInfo<WechatAttendance>> result = new Result<>();
+        try {
+            PageInfo<WechatAttendance> pageData = wechatNoListService.selectOverTimePage(paramsMap);
+            if (!Check.isNull(pageData)) {
+                result.setResult(pageData);
+                result.setSuccess(true);
+            }
+        } catch (Exception e) {
+            log.error("加班考勤数据-分页列表查询 error ", e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+}

+ 65 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatAttendance.java

@@ -0,0 +1,65 @@
+package cn.com.ctop.oa.modules.entity;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 考勤异常统计数据
+ *
+ * @ClassName WechatAttendance
+ * @Author ZHAOXA
+ * @date 2020-09-24 21:00
+ */
+@Data
+public class WechatAttendance {
+    /**
+     * 员工Id
+     */
+    private String userId;
+    /**
+     * 员工名
+     */
+    private String userName;
+    /**
+     * 部门名
+     */
+    private String departName;
+    /**
+     * 审批状态 1-审批中;2-已通过;
+     */
+    private String status;
+    /**
+     * 部门编号
+     */
+    private String departId;
+    /**
+     * 签到日期
+     */
+    private String checkinDate;
+    /**
+     * 打卡类型
+     */
+    private String checkinType;
+    /**
+     * 异常打卡状态
+     */
+    private String exceptionType;
+    /**
+     * 考勤时间
+     */
+    private String checkinTime;
+    /**
+     * 异常考勤状态
+     */
+    private String type;
+    /**
+     * 状态时长
+     */
+    private String stateDuration;
+    /**
+     * 加班时长
+     */
+    private String overtime;
+
+}

+ 15 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatCheckinData.java

@@ -121,6 +121,12 @@ public class WechatCheckinData {
     @Excel(name = "打卡设备id", width = 15)
     @ApiModelProperty(value = "打卡设备id")
     private String deviceid;
+
+
+    private Integer overtimeOrNot; // 是否加班
+    private Double overtime; // 加班时长
+
+
     /**
      * createTime
      */
@@ -131,4 +137,13 @@ public class WechatCheckinData {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+
+    /**
+     * 员工名
+     */
+    private String userName;
+    /**
+     * 部门名
+     */
+    private String departName;
 }

+ 67 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatNoList.java

@@ -0,0 +1,67 @@
+package cn.com.ctop.oa.modules.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 审批信息
+ * @author jeecg-boot
+ * @date   2020-09-23
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_wechat_no_list")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_wechat_no_list对象", description="审批信息")
+public class WechatNoList {
+    
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private String id;
+	/**单号*/
+	@Excel(name = "单号", width = 15)
+    @ApiModelProperty(value = "单号")
+	private String spNo;
+	/**单号*/
+	@Excel(name = "1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付", width = 15)
+    @ApiModelProperty(value = "1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付")
+	private String status;
+	/**成员id*/
+	@Excel(name = "成员id", width = 15)
+    @ApiModelProperty(value = "成员id")
+	private String userId;
+	/**type时长*/
+	@Excel(name = "type时长", width = 15)
+    @ApiModelProperty(value = "type时长")
+	private String newDuration;
+	/**1-请假;2-补卡;3-出差;4-外出;5-加班*/
+	@Excel(name = "1-请假;2-补卡;3-出差;4-外出;5-加班", width = 15)
+    @ApiModelProperty(value = "1-请假;2-补卡;3-出差;4-外出;5-加班")
+	private String type;
+	/**开始时间*/
+    @ApiModelProperty(value = "开始时间")
+	private Date newBegin;
+	/**结束时间*/
+    @ApiModelProperty(value = "结束时间")
+	private Date newEnd;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 63 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/enums/SpNoEnum.java

@@ -0,0 +1,63 @@
+package cn.com.ctop.oa.modules.enums;
+
+
+import cn.com.ctop.common.module.utils.Check;
+
+public enum SpNoEnum {
+
+
+    control1("Attendance", "假勤"),
+    control2("Vacation", "请假"),
+    control3("PunchCorrection", "补卡"),
+    type1("1", "请假"),
+    type2("2", "补卡"),
+    type3("3", "出差"),
+    type4("4", "外出"),
+    type5("5", "加班"),
+    vacation1("101","年假"),
+    vacation2("102","事假"),
+    vacation3("103","病假"),
+    vacation4("104","调休"),
+    vacation5("105","婚假"),
+    vacation6("106","产假"),
+    vacation7("107","陪产假"),
+    vacation8("108","其他"),
+    vacation9("109","丧假");
+    private String code;
+    private String name;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public static SpNoEnum getSpNoEnum(String code) {
+        if (Check.isNull(code)) {
+            return null;
+        }
+        for (SpNoEnum value : SpNoEnum.values()) {
+            if (value.code.equals(code)) {
+                return value;
+            }
+        }
+        return null;
+    }
+
+
+    private SpNoEnum(String code, String name) {
+        this.code = code;
+        this.name = name;
+
+    }
+}

+ 6 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/WechatCheckinDataMapper.java

@@ -3,6 +3,9 @@ package cn.com.ctop.oa.modules.mapper;
 import cn.com.ctop.oa.modules.entity.WechatCheckinData;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * 企业微信用户
  *
@@ -12,4 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface WechatCheckinDataMapper extends BaseMapper<WechatCheckinData> {
 
+    WechatCheckinData queryEntityByMap(Map<String, Object> paramsMap);
+
+    List<WechatCheckinData> selectPageList(Map<String, Object> paramsMap);
 }

+ 3 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/WechatDepartmentMapper.java

@@ -3,6 +3,8 @@ package cn.com.ctop.oa.modules.mapper;
 import cn.com.ctop.oa.modules.entity.WechatDepartment;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 部门列表
  *
@@ -12,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface WechatDepartmentMapper extends BaseMapper<WechatDepartment> {
 
+    List<WechatDepartment> queryList();
 }

+ 23 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/WechatNoListMapper.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.oa.modules.mapper;
+
+import cn.com.ctop.oa.modules.entity.WechatAttendance;
+import cn.com.ctop.oa.modules.entity.WechatNoList;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 审批信息
+ *
+ * @author: jeecg-boot
+ * @date: 2020-09-23
+ * @cersion: V1.0
+ */
+public interface WechatNoListMapper extends BaseMapper<WechatNoList> {
+
+    List<WechatAttendance> queryAttendanceData(Map<String, Object> paramsMap);
+
+    List<WechatAttendance> queryOverTimeData(Map<String, Object> paramsMap);
+
+}

+ 65 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/xml/WechatCheckinDataMapper.xml

@@ -1,5 +1,70 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.oa.modules.mapper.WechatCheckinDataMapper">
+    <select id="queryEntityByMap" resultType="cn.com.ctop.oa.modules.entity.WechatCheckinData">
+        SELECT
+        *
+        FROM ctop_wechat_checkin_data
+        <where>
+            <if test="userId != null and userId != '' ">
+                and user_id = #{userId}
+            </if>
+            <if test="departId != null and departId != '' ">
+                and depart_id = #{departId}
+            </if>
+            <if test="checkinType != null">
+                and checkin_type = #{checkinType}
+            </if>
+            <if test="checkinDate != null ">
+                and checkin_time like concat(#{checkinDate},"%")
+            </if>
+        </where>
+    </select>
 
+
+    <select id="selectPageList" resultType="cn.com.ctop.oa.modules.entity.WechatCheckinData">
+        SELECT
+        ck.id,
+        ck.depart_id,
+        ck.user_id,
+        us.user_name,
+        dpt.depart_name,
+        ck.group_name,
+        ck.checkin_type,
+        ck.exception_type,
+        ck.checkin_time,
+        ck.location_title,
+        ck.location_detail,
+        ck.wifiname,
+        ck.notes,
+        ck.wifimac,
+        ck.mediaids,
+        ck.lat,
+        ck.lng,
+        ck.deviceid,
+        ck.overtime_or_not,
+        ck.overtime,
+        ck.create_time,
+        ck.update_time
+        FROM ctop_wechat_checkin_data as ck
+        LEFT JOIN ctop_wechat_user_list as us ON ck.user_id = us.user_id
+        LEFT JOIN ctop_wechat_department as dpt ON dpt.depart_id = us.depart_id
+        <where>
+            <if test="userId != null and userId != '' ">
+                and ck.user_id = #{userId}
+            </if>
+            <if test="departId != null and departId != '' ">
+                and ck.depart_id = #{departId}
+            </if>
+            <if test="userName != null ">
+                and us.user_name like concat(#{userName},"%")
+            </if>
+            <if test="startTime != null">
+                and ck.checkin_time &gt;= #{startTime}
+            </if>
+            <if test="stopTime != null ">
+                and ck.checkin_time &lt;= #{stopTime}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 6 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/xml/WechatDepartmentMapper.xml

@@ -2,4 +2,10 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.oa.modules.mapper.WechatDepartmentMapper">
 
+
+    <select id="queryList" resultType="cn.com.ctop.oa.modules.entity.WechatDepartment">
+        SELECT
+            *
+        FROM ctop_wechat_department
+    </select>
 </mapper>

+ 89 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/xml/WechatNoListMapper.xml

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.oa.modules.mapper.WechatNoListMapper">
+
+    <select id="queryAttendanceData" resultType="cn.com.ctop.oa.modules.entity.WechatAttendance">
+        SELECT DISTINCT
+        us.user_id AS userId,
+        us.user_name AS userName,
+        dpt.depart_id AS departId,
+        dpt.depart_name AS departName,
+        DATE_FORMAT(ck.checkin_time,'%Y-%m-%d') AS checkinDate,
+        ck.checkin_type AS checkinType,
+        ck.exception_type AS exceptionType,
+        nl.status as status,
+        DATE_FORMAT(ck.checkin_time, '%Y-%m-%d %H:%i:%s') AS checkinTime,
+        case when nl.type !='' THEN nl.type
+        when ck.checkin_type ='上班打卡' AND exception_type ='时间异常' then '迟到'
+        when ck.checkin_type ='下班打卡' AND exception_type ='时间异常' then '早退'
+        end AS type,
+        case when nl.type!=''and nl.type !='补卡' then CONCAT(nl.new_duration,' h')
+        when ck.checkin_type ='上班打卡'and ck.exception_type ='时间异常' then
+        CONCAT(TIMESTAMPDIFF(MINUTE,DATE_FORMAT(CONCAT(DATE_FORMAT(ck.checkin_time,'%Y-%m-%d '),'09:30:00'),'%Y-%m-%d
+        %H:%i:%s'),ck.checkin_time),' min')
+        when ck.checkin_type ='下班打卡'and ck.exception_type ='时间异常' then
+        CONCAT(TIMESTAMPDIFF(MINUTE,ck.checkin_time,DATE_FORMAT(CONCAT(DATE_FORMAT(ck.checkin_time,'%Y-%m-%d
+        '),'19:00:00'),'%Y-%m-%d %H:%i:%s')),' min')
+        end AS stateDuration
+        FROM ctop_wechat_user_list AS us
+        LEFT JOIN ctop_wechat_department AS dpt ON us.depart_id = dpt.depart_id
+        LEFT JOIN ctop_wechat_checkin_data AS ck ON ck.user_id = us.user_id
+        LEFT JOIN ctop_wechat_no_list AS nl ON nl.user_id = us.user_id and
+        nl.new_begin Like CONCAT(DATE_FORMAT(ck.checkin_time,'%Y-%m-%d'),'%')
+        WHERE ck.exception_type!='' and ISNULL(ck.exception_type)= 0
+        <if test="userId != null and userId != '' ">
+            and us.user_id = #{userId}
+        </if>
+        <if test="userName != null and userName != '' ">
+            and us.user_Name LIKE CONCAT("%",#{userName},"%")
+        </if>
+        <if test="departId != null and departId != '' ">
+            and dpt.depart_id = #{departId}
+        </if>
+        <if test="departName != null and departName != '' ">
+            and dpt.depart_name LIKE CONCAT("%",#{departName},"%")
+        </if>
+        <if test="startTime != null">
+            and ck.checkin_time &gt;= #{startTime}
+        </if>
+        <if test="stopTime != null ">
+            and ck.checkin_time &lt;= #{stopTime}
+        </if>
+        order by us.depart_id,us.user_name ,ck.checkin_time
+    </select>
+
+
+    <select id="queryOverTimeData" resultType="cn.com.ctop.oa.modules.entity.WechatAttendance">
+        SELECT
+        us.user_id AS userId,
+        us.user_name AS userName,
+        dpt.depart_id AS departId,
+        dpt.depart_name AS departName,
+        DATE_FORMAT(ck.checkin_time,'%Y-%m-%d') AS checkinDate,
+        CONCAT(ck.overtime,' h') AS overtime
+        FROM ctop_wechat_checkin_data as ck
+        LEFT JOIN ctop_wechat_user_list as us ON ck.user_id = us.user_id
+        LEFT JOIN ctop_wechat_department as dpt ON dpt.depart_id = us.depart_id
+        WHERE ck.overtime_or_not = 1
+        <if test="userId != null and userId != '' ">
+            and us.user_id = #{userId}
+        </if>
+        <if test="userName != null and userName != '' ">
+            and us.user_Name LIKE CONCAT("%",#{userName},"%")
+        </if>
+        <if test="departId != null and departId != '' ">
+            and dpt.depart_id = #{departId}
+        </if>
+        <if test="departName != null and departName != '' ">
+            and dpt.depart_name LIKE CONCAT("%",#{departName},"%")
+        </if>
+        <if test="startTime != null">
+            and ck.checkin_time &gt;= #{startTime}
+        </if>
+        <if test="stopTime != null ">
+            and ck.checkin_time &lt;= #{stopTime}
+        </if>
+        order by us.depart_id,us.user_name ,ck.checkin_time
+    </select>
+
+</mapper>

+ 5 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatCheckinDataService.java

@@ -2,6 +2,9 @@ package cn.com.ctop.oa.modules.service;
 
 import cn.com.ctop.oa.modules.entity.WechatCheckinData;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+
+import java.util.Map;
 
 /**
  * @Description: 企业微信用户
@@ -10,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface IWechatCheckinDataService extends IService<WechatCheckinData> {
-    void getCheckinData();
+    void getCheckinData(String starttime, String endtime);
 
+    PageInfo<WechatCheckinData> selectPageList(Map<String, Object> paramsMap);
 }

+ 4 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatDepartmentService.java

@@ -3,6 +3,8 @@ package cn.com.ctop.oa.modules.service;
 import cn.com.ctop.oa.modules.entity.WechatDepartment;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 部门列表
  * @Author: jeecg-boot
@@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IWechatDepartmentService extends IService<WechatDepartment> {
     void getDepartment();
+
+    List<WechatDepartment> queryList();
 }

+ 49 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatNoListService.java

@@ -0,0 +1,49 @@
+package cn.com.ctop.oa.modules.service;
+
+import cn.com.ctop.oa.modules.entity.WechatAttendance;
+import cn.com.ctop.oa.modules.entity.WechatNoList;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 审批信息
+ * @Author: jeecg-boot
+ * @Date: 2020-09-23
+ * @Version: V1.0
+ */
+public interface IWechatNoListService extends IService<WechatNoList> {
+    /**
+     * 批量获取审批单号,单号!
+     *
+     * @param page      查询起始数,分页查询游标,默认为0
+     * @param starttime 审批单提交的时间范围,开始时间,UNix时间戳
+     * @param endtime   批单提交的时间范围,结束时间,Unix时间戳
+     * @return com.alibaba.fastjson.JSONObject
+     * @throws
+     * @author ZHAOXA
+     */
+    JSONObject getNoList(Integer page, String starttime, String endtime);
+
+    /**
+     * 审批申请数据入库
+     *
+     * @param starttime 审批单提交的时间范围,开始时间,UNix时间戳
+     * @param endtime   批单提交的时间范围,结束时间,Unix时间戳
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    void getNoDateByNo(String starttime, String endtime);
+
+    List<WechatAttendance> queryAttendanceData(Map<String, Object> paramsMap);
+
+    List<WechatAttendance> queryOverTimeData(Map<String, Object> paramsMap);
+
+    PageInfo<WechatAttendance> selectNoListPage(Map<String, Object> paramsMap);
+
+    PageInfo<WechatAttendance> selectOverTimePage(Map<String, Object> paramsMap);
+}

+ 11 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatTokenService.java

@@ -4,5 +4,16 @@ import java.util.Map;
 
 public interface IWechatTokenService {
     Map<String, Object> getQYWXAccessToken();
+
     Map<String, Object> getOAAccessToken();
+
+    /**
+     * 审批token
+     *
+     * @return java.util.Map<java.lang.String, java.lang.Object>
+     * @throws
+     * @author ZHAOXA
+     * @Param []
+     */
+    Map<String, Object> getApprovaAccessToken();
 }

+ 0 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatUserListService.java

@@ -11,5 +11,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IWechatUserListService extends IService<WechatUserList> {
     void getUserList();
-
 }

+ 70 - 35
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatCheckinDataServiceImpl.java

@@ -12,16 +12,22 @@ import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.xxl.job.core.enums.NoEn;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import static org.jeecg.common.constant.GeneralConstant.*;
+
 /**
- * 企业微信用户
+ * 员工考勤
  *
  * @author jeecg-boot
  * @version V1.0
@@ -34,86 +40,115 @@ public class WechatCheckinDataServiceImpl extends ServiceImpl<WechatCheckinDataM
     private IWechatTokenService tokenService;
     @Autowired
     private IWechatUserListService userListService;
+    @Autowired
+    private WechatCheckinDataMapper wechatCheckinDataMapper;
 
     @Override
-    public void getCheckinData() {
+    public void getCheckinData(String starttime, String endtime) {
         try {
             Map<String, Object> qywxAccessToken = tokenService.getOAAccessToken();
-            System.err.println(qywxAccessToken);
-            if ((Integer) qywxAccessToken.get("code") != 0) {
-                log.error("企业微信获取token失败,返回信息:{}", qywxAccessToken.get("message"));
-                throw new Exception("企业微信获取token失败");
+            if ((Integer) qywxAccessToken.get(CODE) != 0) {
+                log.error("员工考勤获取token失败,返回信息:{}", qywxAccessToken.get(MESSAGE));
+                throw new Exception("员工考勤获取token失败");
             }
-
             List<WechatUserList> list = userListService.list();
             if (Check.isNull(list)) {
                 return;
             }
-
-
-            //  params.put("access_token", (String) qywxAccessToken.get("accessToken"));
             for (WechatUserList userList : list) {
-                // params.remove("useridlist");
                 JSONObject params = new JSONObject();
-
                 String userId = userList.getUserId();
                 String departId = userList.getDepartId();
                 params.put("opencheckindatatype", 3);
-
                 JSONArray userArr = new JSONArray();
-
                 userArr.add(userId);
                 params.put("useridlist", userArr);
-                params.put("starttime", 1598889600);
-                params.put("endtime", 1600099200);
-
-
-                String resultStr = HttpUtils.httpPostRequestTest(QYWxConstant.QYWX_CHECKIN_DATA + "?access_token=" + qywxAccessToken.get("accessToken"), params.toJSONString(), null);
+                params.put(API_START_TIME, starttime);
+                params.put(API_END_TIME, endtime);
+                String resultStr = HttpUtils.httpPostRequestTest(QYWxConstant.QYWX_CHECKIN_DATA + "?access_token=" + qywxAccessToken.get(ACCESS_TOKEN), params.toJSONString(), null);
                 JSONObject resultJson = JSONObject.parseObject(resultStr);
-                System.err.println(resultJson);
-                Integer errcode = resultJson.getInteger("errcode");
-                if (errcode == 0) {
+                if (resultJson.getInteger(ERR_CODE) == 0) {
                     JSONArray checkindata = resultJson.getJSONArray("checkindata");
                     if (!Check.isNull(checkindata)) {
+                        StringBuffer buf = null;
+                        String checkinType = "";
+                        String checkinTypeCode = "";
                         for (int i = 0; i < checkindata.size(); i++) {
                             JSONObject jsonObject = checkindata.getJSONObject(i);
+                            if ("JiLei".equals(userId)) {
+                                System.out.println(jsonObject);
+                            }
                             if (!Check.isNull(jsonObject)) {
                                 WechatCheckinData checkinData = new WechatCheckinData();
+                                checkinType = jsonObject.getString("checkin_type");
+                                //1上班,2下班
+                                checkinTypeCode = "上班打卡".equals(checkinType) ? NoEn.NO1.valueStr() : NoEn.NO2.valueStr();
+                                //下班打卡时间
+                                Long checkinTimeStamp = jsonObject.getLong("checkin_time");
+                                Date checkDate = DateUtils.stampToTime(checkinTimeStamp);
+                                String dateStr = DateUtils.formatDate(checkDate);
+                                long dateLong = DateUtils.timeToStamp(dateStr + DAY_BEGIN);
+                                buf = new StringBuffer();
+                                String id = buf.append(userId).append("_").append(checkinTypeCode).append("_").append(dateLong).toString();
+                                checkinData.setId(id);
                                 checkinData.setDepartId(departId);
                                 checkinData.setUserId(userId);
-                                java.util.Date checkDate = DateUtils.stampToTime(jsonObject.getLong("checkin_time"));
+                                checkinData.setCheckinType(checkinType);
                                 checkinData.setCheckinTime(checkDate);
+                                Long dateStamp = DateUtils.timeToStamp(dateStr + " 21:30:00"); // 每天九点半时间戳
+                                if (checkinTimeStamp >= dateStamp) {
+                                    checkinData.setOvertimeOrNot(1);
+                                    String overtimeStr = DateUtils.formatDate(checkDate) + " 19:00:00";
+                                    Long overtimeStamp = DateUtils.timeToStamp(overtimeStr); // 每天九点半时间戳
+                                    Double overtime = Double.valueOf(checkinTimeStamp - overtimeStamp) / 3600;
+                                    checkinData.setOvertime(overtime);
+                                }
                                 checkinData.setWifiname(jsonObject.getString("wifiname"));
                                 checkinData.setNotes(jsonObject.getString("notes"));
                                 checkinData.setLat(jsonObject.getString("lng"));
                                 checkinData.setLocationDetail(jsonObject.getString("location_detail"));
                                 checkinData.setGroupName(jsonObject.getString("groupname"));
                                 checkinData.setDeviceid(jsonObject.getString("deviceid"));
-                                checkinData.setCheckinType(jsonObject.getString("checkin_type"));
                                 checkinData.setExceptionType(jsonObject.getString("exception_type"));
                                 checkinData.setLocationTitle(jsonObject.getString("location_title"));
                                 checkinData.setWifimac(jsonObject.getString("wifimac"));
                                 checkinData.setMediaids(jsonObject.getJSONArray("mediaids").toJSONString());
                                 checkinData.setLat(jsonObject.getString("lat"));
-                                this.save(checkinData);
-
+                                this.saveOrUpdate(checkinData);
                             }
                         }
-
                     }
-
-
                 } else {
-                    //     throw new Exception("企业微信获取部门列表");
-
+                    log.error("获取打卡数据异常");
                 }
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("员工考勤入库异常,", e);
         }
-
-
     }
 
-
+    @Override
+    public PageInfo<WechatCheckinData> selectPageList(Map<String, Object> paramsMap) {
+        Integer pageNo = (Integer) paramsMap.get(PAGE_NO);
+        if (null == pageNo || pageNo == 0) {
+            pageNo = 1;
+        }
+        Integer pageSize = (Integer) paramsMap.get(PAGE_SIZE);
+        if (null == pageSize || pageSize == 0) {
+            pageSize = 10;
+        }
+        String startTime = (String) paramsMap.get(START_TIME);
+        if (!Check.isNull(startTime)) {
+            startTime += DAY_BEGIN;
+            paramsMap.put(START_TIME, startTime);
+        }
+        String stopTime = (String) paramsMap.get(STOP_TIME);
+        if (!Check.isNull(stopTime)) {
+            stopTime += DAY_END;
+            paramsMap.put(STOP_TIME, stopTime);
+        }
+        PageHelper.startPage(pageNo, pageSize);
+        List<WechatCheckinData> list = wechatCheckinDataMapper.selectPageList(paramsMap);
+        return new PageInfo<>(list);
+    }
 }

+ 5 - 11
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatDepartmentServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
@@ -34,7 +35,6 @@ public class WechatDepartmentServiceImpl extends ServiceImpl<WechatDepartmentMap
     @Autowired
     private WechatDepartmentMapper wechatDepartmentMapper;
 
-
     @Override
     public void getDepartment() {
         try {
@@ -43,11 +43,8 @@ public class WechatDepartmentServiceImpl extends ServiceImpl<WechatDepartmentMap
                 log.error("企业微信获取token失败,返回信息:{}", qywxAccessToken.get("message"));
                 throw new Exception("企业微信获取token失败");
             }
-
-
             TreeMap<String, Object> params = new TreeMap<>();
             params.put("access_token", qywxAccessToken.get("accessToken"));
-
             String resultStr = HttpUtils.httpGetRequest(QYWxConstant.QYWX_DEPART_LIST, null, params);
             JSONObject resultJson = JSONObject.parseObject(resultStr);
             System.err.println(resultJson);
@@ -71,22 +68,19 @@ public class WechatDepartmentServiceImpl extends ServiceImpl<WechatDepartmentMap
                             depart.setParentId(departJson.getString("parentid"));
                             depart.setDepartOrder(departJson.getString("order"));
                             wechatDepartmentMapper.insert(depart);
-
                         }
-
                     }
-
                 }
-
-
             } else {
                 throw new Exception("企业微信获取部门列表");
-
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
+    }
 
-
+    @Override
+    public List<WechatDepartment> queryList() {
+        return wechatDepartmentMapper.queryList();
     }
 }

+ 388 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatNoListServiceImpl.java

@@ -0,0 +1,388 @@
+package cn.com.ctop.oa.modules.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.oa.modules.constant.QYWxConstant;
+import cn.com.ctop.oa.modules.entity.WechatAttendance;
+import cn.com.ctop.oa.modules.entity.WechatCheckinData;
+import cn.com.ctop.oa.modules.entity.WechatNoList;
+import cn.com.ctop.oa.modules.enums.SpNoEnum;
+import cn.com.ctop.oa.modules.mapper.WechatCheckinDataMapper;
+import cn.com.ctop.oa.modules.mapper.WechatNoListMapper;
+import cn.com.ctop.oa.modules.service.IWechatNoListService;
+import cn.com.ctop.oa.modules.service.IWechatTokenService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.xxl.job.core.enums.NoEn;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.jeecg.common.constant.GeneralConstant.*;
+
+/**
+ * 审批信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-09-23
+ */
+@Service
+@Slf4j
+public class WechatNoListServiceImpl extends ServiceImpl<WechatNoListMapper, WechatNoList> implements IWechatNoListService {
+    @Autowired
+    private IWechatTokenService tokenService;
+    @Autowired
+    private WechatNoListMapper wechatNoListMapper;
+    @Autowired
+    private WechatCheckinDataMapper wechatCheckinDataMapper;
+
+    /**
+     * 获取审批token
+     *
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     * @Param []
+     */
+    private String getToken() throws Exception {
+        Map<String, Object> approvaAccessToken = tokenService.getApprovaAccessToken();
+        if ((Integer) approvaAccessToken.get("code") != 0) {
+            log.error("企业微信获取token失败,返回信息:{}", approvaAccessToken.get("message"));
+            throw new Exception("企业微信获取token失败");
+        }
+        return approvaAccessToken.get("accessToken").toString();
+    }
+
+    @Override
+    public JSONObject getNoList(Integer page, String starttime, String endtime) {
+        try {
+            JSONObject params = new JSONObject();
+            params.put("starttime", starttime);
+            params.put("endtime", endtime);
+            params.put("cursor", page);
+            params.put("size", 100);
+            StringBuffer buf = new StringBuffer();
+            //批量获取审批单号 URL
+            buf.append(QYWxConstant.APP_ROVAL_INFO).append("?access_token=").append(getToken());
+            System.err.println(buf.toString());
+            String resultStr = HttpUtils.httpPostRequestTest(buf.toString(), params.toJSONString(), null);
+            JSONObject resultJson = JSONObject.parseObject(resultStr);
+            System.err.println(resultJson);
+            Integer errcode = resultJson.getInteger("errcode");
+            if (errcode == 0) {
+                return resultJson;
+            } else {
+                throw new Exception("批量获取审批单号");
+            }
+        } catch (Exception e) {
+            log.error("批量获取审批单号异常", e);
+        }
+        return new JSONObject();
+    }
+
+    //递归获取审批数据
+    private JSONArray getAllNoList(Integer page, JSONArray spNoList, String starttime, String endtime) {
+        JSONObject data = getNoList(page, starttime, endtime);
+        spNoList.addAll(data.getJSONArray("sp_no_list"));
+        Integer nextCursor = data.getInteger("next_cursor");
+        if (!Check.isNull(nextCursor)) {
+            return getAllNoList(nextCursor, spNoList, starttime, endtime);
+        }
+        return spNoList;
+    }
+
+    @Override
+    public void getNoDateByNo(String starttime, String endtime) {
+        Map<String, Object> returnMap = new HashMap<>();
+        try {
+            Integer page = 0;
+            JSONArray noList = getAllNoList(page, new JSONArray(), starttime, endtime);
+            boolean sleep = false;
+            if (noList.size() > 600) {
+                sleep = true;
+            }
+            if (!Check.isNull(noList)) {
+                StringBuffer buf = new StringBuffer();
+                //获取审批申请详情 URL;
+                buf.append(QYWxConstant.APP_ROVAL_DETAIL).append("?access_token=").append(getToken());
+                String userId = null;
+                Map<String, String> parameterMap = null;
+                for (Object spNo : noList) {
+                    parameterMap = new HashMap<>();
+                    //接口频率限制 600次/分钟
+                    if (sleep) {
+                        Thread.sleep(100);
+                    }
+                    JSONObject params = new JSONObject();
+                    params.put("sp_no", spNo);
+                    String resultStr = HttpUtils.httpPostRequestTest(buf.toString(), params.toJSONString(), null);
+                    JSONObject resultJson = JSONObject.parseObject(resultStr);
+                    Integer errcode = resultJson.getInteger("errcode");
+                    if (errcode == 0) {
+                        JSONObject info = resultJson.getJSONObject("info");
+                        String spStatus = info.getString("sp_status");
+                        String spName = info.getString("sp_name");
+                        /**申请单状态:1-审批中;2-已通过,只记录这两种状态数据
+                         * 而且只记录请假、打卡补卡类型
+                         **/
+                        boolean statusisOK = "2".equals(spStatus) || "1".equals(spStatus);
+                        boolean typeisOK = spName.contains("打卡补卡") || spName.contains("请假") || spName.contains("外出") || spName.contains("出差");
+                        if (statusisOK && typeisOK) {
+                            JSONObject applyer = info.getJSONObject("applyer");
+                            if (!Check.isNull(applyer)) {
+                                userId = applyer.getString("userid");
+                                if ("LiuJing".equals(userId)) {
+                                    System.out.println(info);
+                                }
+                            }
+                            //审批申请数据
+                            JSONObject applyData = info.getJSONObject("apply_data");
+                            //获取审批状态数据
+                            getParameterMap(applyData, parameterMap);
+                            WechatNoList noEntity = new WechatNoList();
+                            noEntity.setUserId(userId);
+                            noEntity.setSpNo(spNo.toString());
+                            noEntity.setStatus(spStatus);
+                            if (!Check.isNull(parameterMap.get("newBegin"))) {
+                                noEntity.setNewBegin(DateUtils.stampToTime(Long.valueOf(parameterMap.get("newBegin"))));
+                            }
+                            if (!Check.isNull(parameterMap.get("newEnd"))) {
+                                noEntity.setNewEnd(DateUtils.stampToTime(Long.valueOf(parameterMap.get("newEnd"))));
+                            }
+                            noEntity.setType(parameterMap.get(TYPE));
+                            noEntity.setNewDuration(parameterMap.get("newDuration"));
+                            wechatNoListMapper.insert(noEntity);
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            returnMap.put("code", -1);
+            returnMap.put("message", "系统错误");
+            log.error("审批异常", e);
+        }
+    }
+
+    /**
+     * 获取审批状态数据
+     *
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     * @Param [applyData, parameterMap]
+     */
+    private void getParameterMap(JSONObject applyData, Map<String, String> parameterMap) {
+        String control = null;
+        if (!Check.isNull(applyData)) {
+            //审批申请详情,由多个表单控件及其内容组成
+            JSONArray contents = applyData.getJSONArray("contents");
+            if (!Check.isNull(contents)) {
+                for (int i = 0; i < contents.size(); i++) {
+                    //获取content 对象数据
+                    JSONObject contentEntity = contents.getJSONObject(i);
+                    if (!Check.isNull(contentEntity)) {
+                        control = contentEntity.getString("control");
+                        //如果补卡组件为PunchCorrection,直接判断为补卡
+                        if (SpNoEnum.control3.getCode().equals(control)) {
+                            JSONObject value = contentEntity.getJSONObject(VALUE);
+                            if (!Check.isNull(value)) {
+                                JSONObject punch = value.getJSONObject("punch_correction");
+                                if (!Check.isNull(punch)) {
+                                    parameterMap.put(TYPE, SpNoEnum.type2.getName());
+                                    parameterMap.put("newBegin", punch.getString("time"));
+                                    parameterMap.put("newEnd", punch.getString("time"));
+                                }
+                            }
+                            //假勤组件-请假组件 Vacation
+                        } else if (SpNoEnum.control2.getCode().equals(control)) {
+                            JSONObject value = contentEntity.getJSONObject(VALUE);
+                            if (!Check.isNull(value)) {
+                                JSONObject vacation = value.getJSONObject("vacation");
+                                if (!Check.isNull(vacation)) {
+                                    JSONObject selector = vacation.getJSONObject("selector");
+                                    if (!Check.isNull(selector)) {
+                                        getVacation(selector, parameterMap);
+                                    }
+                                    JSONObject attendance = vacation.getJSONObject("attendance");
+                                    if (!Check.isNull(attendance)) {
+                                        getTimeData(attendance, parameterMap);
+                                    }
+                                }
+                            }
+                            //假勤组件-出差/外出/加班组件Attendance
+                        } else if (SpNoEnum.control1.getCode().equals(control)) {
+                            JSONObject value = contentEntity.getJSONObject(VALUE);
+                            if (!Check.isNull(value)) {
+                                JSONObject attendance = value.getJSONObject("attendance");
+                                if (!Check.isNull(attendance)) {
+                                    getTimeData(attendance, parameterMap);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取组件中的假勤类型,假勤开始、结束时间以及时长。
+     *
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     * @Param [attendance, parameterMap]
+     */
+    private void getTimeData(JSONObject attendance, Map<String, String> parameterMap) {
+        String type = attendance.getString(TYPE);
+        //假勤类型,排除类型为1的请假,因为有具体的请假类型,例如:年假,事假等具体类型
+        if (!NoEn.NO1.valueStr().equals(type)) {
+            parameterMap.put(TYPE, SpNoEnum.getSpNoEnum(type).getName());
+        }
+        JSONObject dateRange = attendance.getJSONObject("date_range");
+        if (!Check.isNull(dateRange)) {
+            parameterMap.put("newBegin", dateRange.getString("new_begin"));
+            parameterMap.put("newEnd", dateRange.getString("new_end"));
+            BigDecimal duration = dateRange.getBigDecimal("new_duration");
+            if (!Check.isNull(duration)) {
+                //除以3600,取小时数
+                BigDecimal second = new BigDecimal(3600);
+                parameterMap.put("newDuration", String.valueOf(duration.divide(second, 1, 4)));
+            }
+        }
+    }
+
+    /**
+     * 获取假期类型
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void getVacation(JSONObject selector, Map<String, String> parameterMap) {
+        JSONArray options = selector.getJSONArray("options");
+        if (!Check.isNull(options)) {
+            for (int j = 0; j < options.size(); j++) {
+                JSONObject option = options.getJSONObject(j);
+                JSONArray values = option.getJSONArray(VALUE);
+                if (!Check.isNull(values)) {
+                    for (int k = 0; k < values.size(); k++) {
+                        JSONObject val = values.getJSONObject(k);
+                        parameterMap.put(TYPE, val.getString("text"));
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public List<WechatAttendance> queryAttendanceData(Map<String, Object> paramsMap) {
+        finishingTime(paramsMap);
+        List<WechatAttendance> list = wechatNoListMapper.queryAttendanceData(paramsMap);
+        if (!Check.isNull(list)) {
+            checkOverTimeData(list);
+        }
+        return list;
+    }
+
+    /**
+     * 整理时间
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void finishingTime(Map<String, Object> paramsMap) {
+        String startTime = (String) paramsMap.get(START_TIME);
+        if (!Check.isNull(startTime)) {
+            startTime += DAY_BEGIN;
+            paramsMap.put(START_TIME, startTime);
+        }
+        String stopTime = (String) paramsMap.get(STOP_TIME);
+        if (!Check.isNull(stopTime)) {
+            stopTime += DAY_END;
+            paramsMap.put(STOP_TIME, stopTime);
+        }
+    }
+
+    @Override
+    public List<WechatAttendance> queryOverTimeData(Map<String, Object> paramsMap) {
+        finishingTime(paramsMap);
+        return wechatNoListMapper.queryOverTimeData(paramsMap);
+    }
+
+    @Override
+    public PageInfo<WechatAttendance> selectNoListPage(Map<String, Object> paramsMap) {
+        finishingTime(paramsMap);
+        Integer pageNo = (Integer) paramsMap.get(PAGE_NO);
+        if (null == pageNo || pageNo == 0) {
+            pageNo = NoEn.NO1.valueInt();
+        }
+        Integer pageSize = (Integer) paramsMap.get(PAGE_SIZE);
+        if (null == pageSize || pageSize == 0) {
+            pageSize = NoEn.NO10.valueInt();
+        }
+        PageHelper.startPage(pageNo, pageSize);
+        List<WechatAttendance> list = wechatNoListMapper.queryAttendanceData(paramsMap);
+        if (!Check.isNull(list)) {
+            checkOverTimeData(list);
+        }
+        return new PageInfo<>(list);
+    }
+
+    /**
+     * 筛选10:30以后打卡的迟到数据,判断前一天是否加班,更新迟到时长
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void checkOverTimeData(List<WechatAttendance> list) {
+        for (WechatAttendance attendance : list) {
+            if ("迟到".equals(attendance.getType())) {
+                Integer dur = Integer.valueOf(attendance.getStateDuration().replace(" min", ""));
+                if (dur - 60 >= 0) {
+                    String checkinDate = attendance.getCheckinDate();
+                    String lastDay = DateUtils.getLastDay(checkinDate);
+                    Map<String, Object> map = new HashMap<>();
+                    map.put("userId", attendance.getUserId());
+                    map.put("checkinDate", lastDay);
+                    map.put("checkinType", "下班打卡");
+                    WechatCheckinData data = wechatCheckinDataMapper.queryEntityByMap(map);
+                    if (!Check.isNull(data) && 1 == data.getOvertimeOrNot()) {
+                        attendance.setStateDuration((dur - 60) + " min");
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public PageInfo<WechatAttendance> selectOverTimePage(Map<String, Object> paramsMap) {
+        finishingTime(paramsMap);
+        Integer pageNo = (Integer) paramsMap.get("pageNo");
+        if (null == pageNo || pageNo == 0) {
+            pageNo = 1;
+        }
+        Integer pageSize = (Integer) paramsMap.get("pageSize");
+        if (null == pageSize || pageSize == 0) {
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNo, pageSize);
+        List<WechatAttendance> list = wechatNoListMapper.queryOverTimeData(paramsMap);
+        return new PageInfo<>(list);
+    }
+}

+ 30 - 7
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatTokenServiceImpl.java

@@ -14,7 +14,6 @@ import java.util.TreeMap;
 public class WechatTokenServiceImpl implements IWechatTokenService {
     public Map<String, Object> getQYWXAccessToken() {
         Map<String, Object> returnMap = new HashMap<>();
-
         try {
             TreeMap<String, Object> params = new TreeMap<>();
             params.put("corpid", QYWxConstant.QYWX_CORP_ID);
@@ -26,8 +25,6 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             if (errcode == 0) {
                 returnMap.put("code", 0);
                 returnMap.put("accessToken", resultJson.getString("access_token"));
-
-
             } else {
                 returnMap.put("code", errcode);
                 returnMap.put("message", resultJson.getString("errmsg"));
@@ -36,13 +33,11 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             returnMap.put("code", -1);
             returnMap.put("message", "系统错误");
         }
-
         return returnMap;
     }
 
     public Map<String, Object> getOAAccessToken() {
         Map<String, Object> returnMap = new HashMap<>();
-
         try {
             TreeMap<String, Object> params = new TreeMap<>();
             params.put("corpid", QYWxConstant.QYWX_CORP_ID);
@@ -54,8 +49,6 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             if (errcode == 0) {
                 returnMap.put("code", 0);
                 returnMap.put("accessToken", resultJson.getString("access_token"));
-
-
             } else {
                 returnMap.put("code", errcode);
                 returnMap.put("message", resultJson.getString("errmsg"));
@@ -64,7 +57,37 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             returnMap.put("code", -1);
             returnMap.put("message", "系统错误");
         }
+        return returnMap;
+    }
 
+    /**
+     * @return java.util.Map<java.lang.String, java.lang.Object>
+     * @throws 获取审批
+     * @author ZHAOXA
+     * @Param []
+     */
+    @Override
+    public Map<String, Object> getApprovaAccessToken() {
+        Map<String, Object> returnMap = new HashMap<>();
+        try {
+            TreeMap<String, Object> params = new TreeMap<>();
+            params.put("corpid", QYWxConstant.QYWX_CORP_ID);
+            params.put("corpsecret", QYWxConstant.QYWX_APPROVA_CORP_SECRET);
+            String resultStr = HttpUtils.httpGetRequest(QYWxConstant.QYWX_API_URL + QYWxConstant.QYWX_GET_TOKEN, null, params);
+            //System.out.println(resultStr);
+            JSONObject resultJson = JSONObject.parseObject(resultStr);
+            Integer errcode = resultJson.getInteger("errcode");
+            if (errcode == 0) {
+                returnMap.put("code", 0);
+                returnMap.put("accessToken", resultJson.getString("access_token"));
+            } else {
+                returnMap.put("code", errcode);
+                returnMap.put("message", resultJson.getString("errmsg"));
+            }
+        } catch (Exception e) {
+            returnMap.put("code", -1);
+            returnMap.put("message", "系统错误");
+        }
         return returnMap;
     }
 

+ 0 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatUserListServiceImpl.java


Някои файлове не бяха показани, защото твърде много файлове са промени