7
0

7 کامیت‌ها 62f68833f7 ... f9f4b1879e

نویسنده SHA1 پیام تاریخ
  zhouzeyu@c-top.com.cn f9f4b1879e 盯盘 3 سال پیش
  yumeng 9d105bbaeb 修改地址 3 سال پیش
  yumeng 97d62c011c 修改地址 3 سال پیش
  yumeng 66efd17122 修改地址 3 سال پیش
  yumeng bdd69ade4d 修改地址 3 سال پیش
  yumeng ce3d122752 修改地址 3 سال پیش
  yumeng ef6774e252 修改地址 3 سال پیش
21فایلهای تغییر یافته به همراه3337 افزوده شده و 94 حذف شده
  1. 1 1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  2. 2 2
      jeecg-boot-material-view/pom.xml
  3. 2 3
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/JeecgBootMaterialApplication.java
  4. 1321 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/AccountReportConstants.java
  5. 66 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/Check.java
  6. 96 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/CtopAdConstant.java
  7. 331 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/ExportExcelUtils.java
  8. 936 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/HttpUtils.java
  9. 122 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/JsonResourceUtil.java
  10. 2 2
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/MaterialReportOverViewV2Controller.java
  11. 42 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/MaterialStareController.java
  12. 2 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialReportOverViewV3Mapper.java
  13. 25 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialStareMapper.java
  14. 69 43
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialReportOverViewV3Mapper.xml
  15. 93 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml
  16. 12 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/MaterialStareService.java
  17. 33 39
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialReportOverViewV2ServiceImpl.java
  18. 178 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java
  19. 1 1
      jeecg-boot-material-view/src/main/resources/application-dev.yml
  20. 2 2
      jeecg-boot-material-view/src/main/resources/application-prod.yml
  21. 1 1
      jeecg-boot-material-view/src/main/resources/application-test.yml

+ 1 - 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -241,7 +241,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/agent/**", "anon");
         filterChainDefinitionMap.put("/task/kuaishouHostingTask/**", "anon");
         filterChainDefinitionMap.put("/audienceReport/**", "anon");
-
+        filterChainDefinitionMap.put("/stare/**", "anon");
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);
         filterMap.put("jwt", new JwtFilter());

+ 2 - 2
jeecg-boot-material-view/pom.xml

@@ -68,10 +68,10 @@
             <version>3.15</version>
         </dependency>
 
-        <dependency>
+      <!--  <dependency>
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-boot-module-system</artifactId>
-        </dependency>
+        </dependency>-->
 
 
 

+ 2 - 3
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/JeecgBootMaterialApplication.java

@@ -1,6 +1,6 @@
 package org.jeecg.ctop.material;
 
-import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
+
 import org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration;
 import org.apache.shiro.spring.boot.autoconfigure.ShiroAutoConfiguration;
 import org.apache.shiro.spring.boot.autoconfigure.ShiroBeanAutoConfiguration;
@@ -10,8 +10,7 @@ import org.springframework.context.annotation.ComponentScan;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 @SpringBootApplication(exclude = {ShiroAnnotationProcessorAutoConfiguration.class, ShiroAutoConfiguration.class, ShiroBeanAutoConfiguration.class})
-@EnableDubbo
-@ComponentScan(basePackages = {"org.jeecg", "cn.com.ctop"})
+@ComponentScan(basePackages = {"org.jeecg"})
 @EnableTransactionManagement
 public class JeecgBootMaterialApplication {
     public static void main(String[] args) {

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1321 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/AccountReportConstants.java


+ 66 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/Check.java

@@ -0,0 +1,66 @@
+package org.jeecg.ctop.material.constants;
+
+import com.alibaba.fastjson.JSONArray;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+public class Check {
+    private Check() {
+    }
+
+    public static boolean isNull(List<?> list) {
+        return list == null || list.isEmpty();
+    }
+
+    public static boolean isNull(Long l) {
+        return l == null || l == 0;
+    }
+
+    public static boolean isNull(Collection<?> collection) {
+        return collection == null || collection.isEmpty();
+    }
+
+    public static boolean isNull(JSONArray jsonArray) {
+        return jsonArray == null || jsonArray.isEmpty();
+    }
+
+
+    public static boolean isNull(String str) {
+        return str == null || str.isEmpty();
+    }
+
+    public static boolean isNull(byte[] bytes) {
+        return bytes == null || bytes.length == 0;
+    }
+
+    public static boolean hasNull(Object... objects) {
+        for (Object obj : objects) {
+            if (obj == null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean allEmpty(String... strs) {
+        for (String str : strs) {
+            if (StringUtils.isNotEmpty(str)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static boolean isNull(Object object) {
+        return object == null;
+    }
+
+    public static boolean isNullMap(Map<?, ?> map) {
+        return map == null || map.isEmpty();
+    }
+}

+ 96 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/CtopAdConstant.java

@@ -0,0 +1,96 @@
+package org.jeecg.ctop.material.constants;
+
+import java.math.BigDecimal;
+
+/**
+ * 广告相关常量数据
+ */
+public class CtopAdConstant {
+    //头条
+    public static final String PLATFORM_TYPE_BYTEDANCE = "1";
+    public static final  int PLATFORM_TYPE_BYTEDANCE_INT = 1;
+    //快手
+    public static final String PLATFORM_TYPE_KUAISHOU = "2";
+    public static final  int   PLATFORM_TYPE_KUAISHOU_INT = 2;
+    //头条内广
+    public static final String PLATFORM_TYPE_BYTEDANCE_INSIDE = "3";
+    public static final  int PLATFORM_TYPE_BYTEDANCE_INSIDE_INT = 3;
+    //头条内广
+    public static final String PLATFORM_TYPE_KUAISHOU_INSIDE = "4";
+    public static final  int PLATFORM_TYPE_KUAISHOU_INSIDE_INT = 4;
+
+    public static final String PLATFORM_TYPE_PANGOLIN = "5";
+
+    public static final String PLATFORM_TYPE_BYTEDANCE_PY = "bytedance";
+    public static final String PLATFORM_TYPE_KUAISHOU_PY = "kuaishou";
+    public static final String PLATFORM_TYPE_PANGOLIN_PY = "pangolin";
+
+    public static final String BYTEDANCE_REPORT_TYPE_DAILY = "STAT_TIME_GRANULARITY_DAILY";
+    public static final String BYTEDANCE_REPORT_TYPE_HOURLY = "STAT_TIME_GRANULARITY_HOURLY";
+
+    public static final String UREPORT_PREVIEW_URL_PREFIX = "/jeecg-boot/ureport/designer?_u=mysql:";
+
+
+    public static final String CTOP_ORGCODE_NORTH_CHINA_PREFIX = "A01";
+    public static final String CTOP_ORGCODE_EAST_CHINA_PREFIX = "A02";
+
+    public static final String KUAISHOU_LOAD_JOB_TYPE_HISTORY = "history";
+    public static final String KUAISHOU_LOAD_JOB_TYPE_DAILY = "daily";
+
+    public static final String BYTEDANCE_LOAD_JOB_TYPE_ASYNC = "async";
+    public static final String BYTEDANCE_LOAD_JOB_TYPE_DAILY = "daily";
+
+    /**
+     * 销售角色Id
+     */
+    public static final String SYSTEM_SALE_CODE = "75ee837e6f3de29c0e3ed75d4629438e";
+
+    /**
+     * 销售AM角色Id
+     */
+    public static final String SYSTEM_SALE_AM_CODE = "f5a68aa2acf86e842100f0fa4b050d28";
+
+    /**
+     * 头条销售媒体季度任务
+     */
+    public static final BigDecimal BYTEDANCE_MEDIA_TASK_COST = new BigDecimal("150000000");
+    /**
+     * 快手销售媒体季度任务
+     */
+    public static final BigDecimal KUAISHOU_MEDIA_TASK_COST = new BigDecimal("147000000");
+    /**
+     * 头条销售季度个人任务
+     */
+    public static final BigDecimal BYTEDANCE_PERSONAL_TASK_COST = new BigDecimal("2400000");
+    /**
+     * 快手销售季度个人任务
+     */
+    public static final BigDecimal KUAISHOU_PERSONAL_TASK_COST = new BigDecimal("2400000");
+
+    /**
+     * 华北快手销售机构号
+     */
+    public static final String HB_KUAISHOU_SALE_ORG_CODE = "A01A11A01";
+    /**
+     * 华北头条销售机构号
+     */
+    public static final String HB_BYTEDANCE_SALE_ORG_CODE = "A01A11A02";
+
+    public static final String BYTEDANCE_GENDER_TYPE_NONE = "NONE";
+    public static final String BYTEDANCE_GENDER_TYPE_GENDER_MALE = "GENDER_MALE";
+    public static final String BYTEDANCE_GENDER_TYPE_GENDER_FEMALE = "GENDER_FEMALE";
+
+
+    public static final Integer COMMON_STATUS_ENABLED = 1;
+
+    public static final Integer COMMON_STATUS_NOT_ENABLED = 0;
+
+    public static final String COMMON_ORDER_TYPE_ASC = "asc";
+    public static final String COMMON_ORDER_TYPE_DESC = "desc";
+
+    /**
+     * 视频类型
+     */
+    public static final String VIDEO_TYPR_ZR = "真人";
+    public static final String VIDEO_TYPR_ZZ = "制作";
+}

+ 331 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/ExportExcelUtils.java

@@ -0,0 +1,331 @@
+package org.jeecg.ctop.material.constants;
+
+
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+public class ExportExcelUtils {
+
+
+    /**
+     * @param workbook
+     * @param sheetNum   (sheet的位置,0表示第一个表格中的第一个sheet)
+     * @param sheetTitle (sheet的名称)
+     * @param headers    (表格的标题)
+     * @param result     (表格的数据)
+     * @return
+     * @throws Exception
+     * @Title: exportExcel
+     * @Description: 导出Excel的方法
+     */
+
+    public void exportExcel(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();
+        // 设置这些样式
+        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);
+
+        // 产生表格标题行
+        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;
+                for (Object obj : m) {
+                    XSSFCell cell = row.createCell((short) cellIndex);
+                    if (!Check.isNull(obj)) {
+                        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());
+                        }
+                    } else {
+                        cell.setCellValue(0);
+                    }
+
+                    cellIndex++;
+                }
+                index++;
+            }
+        }
+    }
+
+
+    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", "")) - 10 > 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) {
+        // 生成一个表格
+        XSSFSheet sheet = workbook.createSheet();
+        workbook.setSheetName(sheetNum, sheetTitle);
+        // 设置表格默认列宽度为20个字节
+        sheet.setDefaultColumnWidth((short) 20);
+        sheet.setColumnWidth(0, 15 * 256);
+        sheet.setColumnWidth(1, 40 * 256);
+        sheet.setColumnWidth(2, 30 * 256);
+        sheet.setColumnWidth(3, 35 * 256);
+        sheet.setColumnWidth(4, 20 * 256);
+        sheet.setColumnWidth(5, 20 * 256);
+        sheet.setColumnWidth(6, 20 * 256);
+        sheet.setColumnWidth(7, 20 * 256);
+        sheet.setColumnWidth(8, 15 * 256);
+        // 生成一个样式
+        XSSFCellStyle style = 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);
+
+        //同一行第一个cell
+        XSSFCellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setWrapText(true);
+
+        // 产生表格标题行
+        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;
+
+                for (Object obj : m) {
+                    XSSFCell cell = row.createCell((short) cellIndex);
+                    if (!Check.isNull(obj)) {
+                        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());
+                        }
+                    } else {
+                        cell.setCellValue(0);
+                    }
+                    cell.setCellStyle(cellStyle);
+
+                    cellIndex++;
+                }
+                index++;
+            }
+        }
+    }
+
+    //发送响应流方法
+    public void putResponseHeader(HttpServletResponse response, String fileName) {
+        try {
+            try {
+                fileName = new String(fileName.getBytes(), "ISO8859-1");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+//            response.setContentType("multipart/form-data;charset=ISO8859-1");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.addHeader("Pargam", "no-cache");
+            response.addHeader("Cache-Control", "no-cache");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public String getCellValue(Cell cell) {
+        String value = "";
+        if (cell != null) {
+            // 以下是判断数据的类型
+            switch (cell.getCellType()) {
+                case HSSFCell.CELL_TYPE_NUMERIC: // 数字
+                    value = cell.getNumericCellValue() + "";
+                    if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                        Date date = cell.getDateCellValue();
+                        if (date != null) {
+                            value = new SimpleDateFormat("yyyy-MM-dd").format(date);
+                        } else {
+                            value = "";
+                        }
+                    } else {
+                        value = new DecimalFormat("0").format(cell.getNumericCellValue());
+                    }
+                    break;
+                case HSSFCell.CELL_TYPE_STRING: // 字符串
+                    value = cell.getStringCellValue();
+                    break;
+                case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
+                    value = cell.getBooleanCellValue() + "";
+                    break;
+                case HSSFCell.CELL_TYPE_FORMULA: // 公式
+                    value = cell.getCellFormula() + "";
+                    break;
+                case HSSFCell.CELL_TYPE_BLANK: // 空值
+                    value = "";
+                    break;
+                case HSSFCell.CELL_TYPE_ERROR: // 故障
+                    value = "非法字符";
+                    break;
+                default:
+                    value = "未知类型";
+                    break;
+            }
+        }
+        return value.trim();
+    }
+}

+ 936 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/HttpUtils.java

@@ -0,0 +1,936 @@
+package org.jeecg.ctop.material.constants;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.http.*;
+import org.apache.http.client.CookieStore;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.CookieSpecs;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.TrustStrategy;
+import org.apache.http.cookie.Cookie;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.cookie.BasicClientCookie;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.SSLContext;
+import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.*;
+
+/**
+ * @author 宋英豪
+ */
+@Slf4j
+public class HttpUtils {
+
+    //发送响应流方法
+    public static void setResponseHeader(HttpServletResponse response, String fileName) {
+        try {
+            fileName = new String(fileName.getBytes(), StandardCharsets.UTF_8);
+            //response.setContentType("application/octet-stream;charset=ISO8859-1");
+            response.setContentType("application/vnd.ms-excel;charset=gb2312");
+
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.addHeader("Pargam", "no-cache");
+            response.addHeader("Cache-Control", "no-cache");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public static JSONObject bytedanceGetRequest(String accessToken, String url, JSONObject params) {
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+        httpEntity.setHeader("Access-Token", accessToken);
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(url));
+            httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+    public static JSONObject bytedancePostRequest(String accessToken, String url, JSONObject params) {
+        // 构造请求
+        HttpPost httpEntity = new HttpPost(url);
+        httpEntity.setHeader("Access-Token", accessToken);
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+    public static CookieStore COOKIESTORE = new BasicCookieStore();
+    /**
+     * setProxy(new HttpHost("106.125.239.179", 4245))
+     */
+    public static Map<String, Map<String, String>> fontsMap = new HashMap<>();
+    public static String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36";
+
+    public static CloseableHttpClient createSslClientDefault() {
+        try {
+            SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
+                //信任所有证书
+                @Override
+                public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+                    return true;
+                }
+            }).build();
+            RequestConfig globalConfig = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).setCookieSpec(CookieSpecs.STANDARD).build();
+            SSLConnectionSocketFactory sslFactory = new SSLConnectionSocketFactory(sslContext);
+            return HttpClients.custom().setDefaultCookieStore(COOKIESTORE).setDefaultRequestConfig(globalConfig).setConnectionReuseStrategy((response, context) -> false).setSSLSocketFactory(sslFactory).build();
+        } catch (Exception e) {
+            log.error("处理Https证书异常", e);
+        }
+        return HttpClients.createDefault();
+    }
+
+    public static String httpPostFormRequest(String url, Map<String, Object> param, Map<String, String> headers) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            if (headers != null) {
+                for (String key : headers.keySet()) {
+                    httppost.setHeader(key, headers.get(key));
+                }
+            }
+            List<NameValuePair> paramList = new ArrayList<NameValuePair>();
+            if (param != null) {
+                for (String key : param.keySet()) {
+                    BasicNameValuePair basicNameValuePair = new BasicNameValuePair(key, String.valueOf(param.get(key)));
+                    paramList.add(basicNameValuePair);
+                }
+                // 第二步:我们发现Entity是一个接口,所以只能找实现类,发现实现类又需要一个集合,集合的泛型是NameValuePair类型
+                UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(paramList);
+                // 第一步:通过setEntity 将我们的entity对象传递过去
+                httppost.setEntity(formEntity);
+            }
+
+            HttpEntity respentity;
+
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return httpPostFormRequest(newUrl, param, headers);
+            } else if (statusCode == HttpStatus.SC_OK) {
+                respentity = response.getEntity();
+                strReturn = EntityUtils.toString(respentity);
+                return strReturn;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+    public static String httpPostParamRequest(String url, Map<String, Object> param, Map<String, String> headers) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("User-Agent", USER_AGENT);
+            if (headers != null) {
+                for (String key : headers.keySet()) {
+                    httppost.setHeader(key, headers.get(key));
+                }
+            }
+            List<NameValuePair> paramList = new ArrayList<NameValuePair>();
+            for (String key : param.keySet()) {
+                BasicNameValuePair basicNameValuePair = new BasicNameValuePair(key, String.valueOf(param.get(key)));
+                paramList.add(basicNameValuePair);
+            }
+
+            // 第二步:我们发现Entity是一个接口,所以只能找实现类,发现实现类又需要一个集合,集合的泛型是NameValuePair类型
+            UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(paramList);
+            // 第一步:通过setEntity 将我们的entity对象传递过去
+            httppost.setEntity(formEntity);
+            httppost.setEntity(new StringEntity(new Gson().toJson(param), Charset.forName("UTF-8")));
+            HttpEntity respentity;
+
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return httpPostParamRequest(newUrl, param, headers);
+            } else if (statusCode == HttpStatus.SC_OK) {
+                respentity = response.getEntity();
+                strReturn = EntityUtils.toString(respentity);
+                return strReturn;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+    public static String httpPostRequest(String url, Map<String, Object> param, Map<String, String> headers) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("User-Agent", USER_AGENT);
+            httppost.addHeader("Content-Type", "application/json");
+            if (headers != null && headers.size() > 0) {
+                for (String key : headers.keySet()) {
+                    httppost.setHeader(key, headers.get(key));
+                }
+            }
+            if (param != null && param.size() > 0) {
+                httppost.setEntity(new StringEntity(new Gson().toJson(param), Charset.forName("UTF-8")));
+            }
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(300 * 1000).setConnectTimeout(300 * 1000).build();
+            httppost.setConfig(requestConfig);
+            HttpEntity respentity;
+
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return httpPostRequest(newUrl, param, headers);
+            } else if (statusCode == HttpStatus.SC_OK) {
+                respentity = response.getEntity();
+                strReturn = EntityUtils.toString(respentity);
+                return strReturn;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+    public static String httpPostNoParamRequest(String url) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("User-Agent", USER_AGENT);
+            httppost.addHeader("Content-Type", "application/json");
+            HttpEntity respentity;
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return httpPostNoParamRequest(newUrl);
+            } else if (statusCode == HttpStatus.SC_OK) {
+                respentity = response.getEntity();
+                strReturn = EntityUtils.toString(respentity);
+                return strReturn;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+
+    public static String httpPostRequestTest(String url, String body, Map<String, String> headers) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("User-Agent", USER_AGENT);
+            httppost.addHeader("Content-Type", "application/json");
+            if (!Check.isNull(headers)) {
+                for (String key : headers.keySet()) {
+                    httppost.setHeader(key, headers.get(key));
+                }
+            }
+
+            httppost.setEntity(new StringEntity(body, Charset.forName("UTF-8")));
+            HttpEntity respentity;
+
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return httpPostRequestTest(newUrl, body, headers);
+            } else if (statusCode == HttpStatus.SC_OK) {
+                respentity = response.getEntity();
+                strReturn = EntityUtils.toString(respentity);
+                return strReturn;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+
+    public static String kuaiShouhttpPostRequest(String url, String body, Map<String, String> headers) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(120000).setConnectTimeout(120000).build();
+            httppost.setConfig(requestConfig);
+            if (!Check.isNullMap(headers)) {
+                for (String key : headers.keySet()) {
+                    httppost.setHeader(key, headers.get(key));
+                }
+            }
+
+            httppost.setHeader("User-Agent", USER_AGENT);
+            if (!Check.isNull(body)) {
+                httppost.setEntity(new StringEntity(body, Charset.forName("UTF-8")));
+            }
+            HttpEntity respentity;
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_OK) {
+                respentity = response.getEntity();
+                strReturn = EntityUtils.toString(respentity);
+                return strReturn;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+
+    public static String httpPostRequest(String url, JSONObject params, Map<String, String> headers) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("User-Agent", USER_AGENT);
+            httppost.addHeader("Content-Type", "application/json");
+            for (String key : headers.keySet()) {
+                httppost.setHeader(key, headers.get(key));
+            }
+            httppost.setEntity(new StringEntity(params.toJSONString(), Charset.forName("UTF-8")));
+            HttpEntity respentity;
+
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return httpPostRequest(newUrl, params, headers);
+            } else if (statusCode == HttpStatus.SC_OK) {
+                respentity = response.getEntity();
+                strReturn = EntityUtils.toString(respentity);
+                return strReturn;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+    public static String postKuaishouVideoUrl(String url, String uid, String photoId) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        String paramBody = "{\"operationName\":\"FeedQuery\",\"variables\":{\"principalId\":\"" + uid + "\",\"photoId\":\"" + photoId + "\"},\"query\":\"query FeedQuery($principalId: String, $photoId: String) {\\n  feedById(principalId: $principalId, photoId: $photoId) {\\n    currentWork {\\n                 timestamp\\n           __typename\\n    }\\n       __typename\\n  }\\n}\\n\"}";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("User-Agent", USER_AGENT);
+            httppost.addHeader("Content-Type", "application/json");
+//            for (String key : headers.keySet()) {
+//                httppost.setHeader(key, headers.get(key));
+//            }
+            httppost.setEntity(new StringEntity(paramBody, Charset.forName("UTF-8")));
+            HttpEntity respentity;
+
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+
+            respentity = response.getEntity();
+            strReturn = EntityUtils.toString(respentity);
+            return strReturn;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+    public static String getKuaishouShareUrl(String url) {
+        HttpClient httpClient = HttpClientBuilder.create().build();
+        HttpResponse response = null;
+        HttpGet httpGet = new HttpGet(url);
+        httpGet.setConfig(RequestConfig.custom().setRedirectsEnabled(false).build());
+        String result = null;
+        try {
+            httpGet.setHeader("User-Agent", USER_AGENT);
+            httpGet.setHeader("Accept-Encoding", "gzip, deflate, br");
+            httpGet.setHeader("Connection", "keep-alive");
+            httpGet.setHeader("Host", "yongzhou.s.gifshow.com");
+            httpGet.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3");
+            httpGet.setHeader("Upgrade-Insecure-Requests", "1");
+            httpGet.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
+            response = httpClient.execute(httpGet);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return newUrl;
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+    public static String httpGetRequest(String url) {
+        HttpClient httpClient = createSslClientDefault();
+        HttpResponse response = null;
+        HttpGet httpGet = new HttpGet(url);
+        String result = null;
+        try {
+            httpGet.setHeader("User-Agent", USER_AGENT);
+            response = httpClient.execute(httpGet);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return httpGetRequest(newUrl);
+            } else if (statusCode == HttpStatus.SC_OK) {
+                BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                String line = null;
+                StringBuilder builder = new StringBuilder();
+                while ((line = reader.readLine()) != null) {
+                    builder.append(line);
+                }
+                result = builder.toString();
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+    public static String httpRequest(String url, String strParams) throws Exception {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+
+            HttpPost httppost = new HttpPost(url);
+            httppost.addHeader("Content-Type", "application/json");
+            httppost.setEntity(new StringEntity(strParams, Charset.forName("UTF-8")));
+            HttpEntity respentity;
+            HttpResponse response = httpClient.execute(httppost);
+            respentity = response.getEntity();
+            strReturn = EntityUtils.toString(respentity);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+    public static String httpRequest(String url, CookieStore cookies, Map<String, String> parameterMap) throws Exception {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("Content-Type", "application/json");
+            UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(
+                    getParam(parameterMap), "UTF-8");
+            httppost.setEntity(postEntity);
+            HttpEntity respentity;
+            HttpResponse response = httpClient.execute(httppost);
+            respentity = response.getEntity();
+            strReturn = EntityUtils.toString(respentity);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+    public static List<NameValuePair> getParam(Map parameterMap) {
+        List<NameValuePair> param = new ArrayList<>();
+        Iterator it = parameterMap.entrySet().iterator();
+        while (it.hasNext()) {
+            Map.Entry parmEntry = (Map.Entry) it.next();
+            param.add(new BasicNameValuePair((String) parmEntry.getKey(),
+                    (String) parmEntry.getValue()));
+        }
+        return param;
+    }
+
+    public static HttpClient getHttpclient() {
+        RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(180000).setConnectTimeout(30000)
+                .setConnectionRequestTimeout(30000).setStaleConnectionCheckEnabled(true).build();
+        CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();
+        return httpclient;
+    }
+
+    public static String callingGraph(String url, String json) {
+        HttpClient httpClient = createSslClientDefault();
+        HttpResponse response = null;
+        HttpPost httpPost = new HttpPost(url);
+        List<Cookie> list = COOKIESTORE.getCookies();
+        httpPost.setHeader("Content-Type", "application/json");
+        String result = null;
+
+        try {
+            StringEntity entity = new StringEntity(json, "utf-8");
+            httpPost.setHeader("User-Agent", USER_AGENT);
+            httpPost.setEntity(entity);
+            response = httpClient.execute(httpPost);
+            BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+            String line = null;
+            StringBuilder builder = new StringBuilder();
+            while ((line = reader.readLine()) != null) {
+                builder.append(line);
+            }
+            result = builder.toString();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+    public static Map<String, Integer> KUAISHOUNUMBERMAP;
+
+    public static Integer getKuaishouNumber(String key) {
+        if (KUAISHOUNUMBERMAP == null) {
+            KUAISHOUNUMBERMAP = new HashMap<>();
+//            kuaishouNumberMap.put("32.0#-6.0#526.0#729.0",0);//735
+//            kuaishouNumberMap.put("98.0#13.0#363.0#726.0",1);//713
+//            kuaishouNumberMap.put("32.0#13.0#527.0#732.0",2);//719
+//            kuaishouNumberMap.put("25.0#-6.0#525.0#730.0",3);//736
+//            kuaishouNumberMap.put("26.0#13.0#536.0#731.0",4);//718
+//            kuaishouNumberMap.put("33.0#-5.0#526.0#717.0",5);//722
+//            kuaishouNumberMap.put("39.0#-5.0#530.0#732.0",6);//737
+//            kuaishouNumberMap.put("38.0#13.0#536.0#717.0",7);//704
+//            kuaishouNumberMap.put("33.0#-7.0#525.0#731.0",8);//738
+//            kuaishouNumberMap.put("37.0#-7.0#521.0#730.0",9);//737
+            KUAISHOUNUMBERMAP.put("494.0#735.0", 0);
+            KUAISHOUNUMBERMAP.put("265.0#713.0", 1);
+            KUAISHOUNUMBERMAP.put("495.0#719.0", 2);
+            KUAISHOUNUMBERMAP.put("500.0#736.0", 3);
+            KUAISHOUNUMBERMAP.put("510.0#718.0", 4);
+            KUAISHOUNUMBERMAP.put("493.0#722.0", 5);
+            KUAISHOUNUMBERMAP.put("491.0#737.0", 6);
+            KUAISHOUNUMBERMAP.put("498.0#704.0", 7);
+            KUAISHOUNUMBERMAP.put("492.0#738.0", 8);
+            KUAISHOUNUMBERMAP.put("484.0#737.0", 9);
+        }
+        return KUAISHOUNUMBERMAP.get(key);
+    }
+
+
+
+    public static String mapParamsSortToStringBySeperator(TreeMap<String, Object> treeMap, String seperator) {
+        String result = "";
+        if (null != treeMap && !treeMap.isEmpty()) {
+            for (Map.Entry<String, Object> entry : treeMap.entrySet()) {
+                String key = entry.getKey();
+                String value = entry.getValue().toString();
+                result += (key + "=" + value + seperator);
+            }
+          result = result.substring(0, result.length() - seperator.length());
+        }
+        return result;
+    }
+
+    public static String httpGetRequest(String url, Map<String, String> headers, TreeMap<String, Object> params) {
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        try {
+            String uri = url + "?" + mapParamsSortToStringBySeperator(params, "&");
+            HttpGet httpGet = new HttpGet(uri);
+            if (headers != null) {
+                Iterator<String> keyIter = headers.keySet().iterator();
+                while (keyIter.hasNext()) {
+                    String curKey = keyIter.next();
+                    if (curKey != null && headers.get(curKey) != null) {
+                        httpGet.addHeader(curKey, headers.get(curKey));
+                    }
+                }
+            }
+            HttpEntity respentity;
+            HttpResponse response = httpClient.execute(httpGet);
+            respentity = response.getEntity();
+            strReturn = EntityUtils.toString(respentity);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+
+
+
+
+    public static String httpGet(String url, Map<String, Object> paramsMap, Map<String, String> headers) {
+        String result = null;
+        try {
+            //创建参数列表
+            HttpClient httpclient = getHttpclient();
+            StringBuilder postBody = null;
+            if (!Check.isNull(paramsMap)) {
+                postBody = new StringBuilder();
+                for (Map.Entry<String, Object> entry : paramsMap.entrySet()) {
+                    if (entry.getValue() == null) {
+                        continue;
+                    }
+                    postBody.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue().toString(),
+                            "utf-8")).append("&");
+                }
+                if (!paramsMap.isEmpty()) {
+                    postBody.deleteCharAt(postBody.length() - 1);
+                }
+            }
+            String urlStr;
+            if (!Check.isNull(postBody)) {
+                urlStr = url + "?" + postBody;
+            } else {
+                urlStr = url;
+            }
+            HttpGet httpget = new HttpGet(urlStr);
+//            httpget.setHeader("User-Agent", USER_AGENT);
+            if (!Check.isNullMap(headers)) {
+                for (String key : headers.keySet()) {
+                    httpget.setHeader(key, headers.get(key));
+                }
+            }
+            HttpEntity respEntity;
+            HttpResponse response = httpclient.execute(httpget);
+            respEntity = response.getEntity();
+            Header[] responseHeaders = response.getHeaders("Set-Cookie");
+            if (responseHeaders != null) {
+
+                for (Header header : responseHeaders) {
+                    String[] ckArray = header.getValue().split(";");
+                    BasicClientCookie ck = new BasicClientCookie(ckArray[0].split("=")[0], ckArray[0].split("=")[1]);
+                    ck.setPath(ckArray[1].split("=")[1]);
+                    ck.setDomain(ckArray[2].split("=")[1]);
+                    HttpUtils.COOKIESTORE.addCookie(ck);
+                }
+            }
+            result = EntityUtils.toString(respEntity);
+        } catch (Exception e) {
+            log.error("http get请求异常");
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+
+    public static JSONObject kuaiShouHttpGetRequest(String accessToken, String url, JSONObject params) {
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+        httpEntity.setHeader("Access-Token", accessToken);
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(url));
+            httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+
+    public static String KuaiShouttpGetRequest(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
+        HttpClient httpclient = getHttpclient();
+        String strReturn = "";
+        try {
+
+
+            StringBuilder postBody = new StringBuilder();
+            for (Map.Entry<String, Object> entry : params.entrySet()) {
+                if (entry.getValue() == null) {
+                    continue;
+                }
+                postBody.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue().toString(),
+                        "utf-8")).append("&");
+            }
+            if (!params.isEmpty()) {
+                postBody.deleteCharAt(postBody.length() - 1);
+            }
+
+            HttpGet httpget = new HttpGet(url + "?" + postBody);
+            if (headers != null) {
+                Iterator<String> keyIter = headers.keySet().iterator();
+                while (keyIter.hasNext()) {
+                    String curKey = keyIter.next();
+                    if (curKey != null && headers.get(curKey) != null) {
+                        httpget.addHeader(curKey, headers.get(curKey));
+                    }
+                }
+            }
+            HttpEntity respentity;
+            HttpResponse response = httpclient.execute(httpget);
+            respentity = response.getEntity();
+            strReturn = EntityUtils.toString(respentity);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return strReturn;
+    }
+
+    public static JSONObject feishuGetRequest(String url, JSONObject params) {
+        return feishuGetRequest(null, url, params);
+    }
+
+    public static JSONObject feishuPostRequest(String url, JSONObject params) {
+        return feishuPostRequest(null, url, params);
+    }
+
+    public static String feishuGetRequestString(String url) {
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(url));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return result.toString();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+    public static JSONObject feishuGetRequest(String accessToken, String url, JSONObject params) {
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+        if (accessToken != null) {
+            httpEntity.setHeader("Authorization", accessToken);
+        }
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(url));
+            if (params != null) {
+                httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            }
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+
+    public static JSONObject feishuPostRequest(String accessToken, String url, JSONObject params) {
+        // 构造请求
+        HttpPost httpEntity = new HttpPost(url);
+        if (accessToken != null) {
+            httpEntity.setHeader("Authorization", accessToken);
+        }
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+}

+ 122 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/constants/JsonResourceUtil.java

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

+ 2 - 2
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/MaterialReportOverViewV2Controller.java

@@ -1,16 +1,16 @@
 package org.jeecg.ctop.material.controller;
 
-import cn.com.ctop.common.module.utils.CtopAdConstant;
+
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.material.constants.CtopAdConstant;
 import org.jeecg.ctop.material.mapper.MaterialReportOverViewV3Mapper;
 import org.jeecg.ctop.material.service.IMaterialReportOverViewV2Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;

+ 42 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/MaterialStareController.java

@@ -0,0 +1,42 @@
+package org.jeecg.ctop.material.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.material.service.MaterialStareService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Set;
+
+/**
+ * 盯盘接口
+ */
+@Slf4j
+@RestController
+@RequestMapping("/stare")
+public class MaterialStareController {
+
+
+    @Autowired
+    MaterialStareService materialStareService;
+
+    /**
+     * 数据总览
+     */
+    @PostMapping("/sumData")
+    public Result<JSONObject> sumData(@RequestBody JSONObject params) {
+        Result<Set<JSONObject>> result = new Result<>();
+        return materialStareService.sumData(params.getInteger("mediaId"),
+                params.getInteger("userType"),
+                params.getString("userId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getInteger("type"));
+    }
+
+
+}

+ 2 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialReportOverViewV3Mapper.java

@@ -195,4 +195,6 @@ public interface MaterialReportOverViewV3Mapper {
     JSONObject getKuaishouMaterialCountByCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 
     List<JSONObject> getDesignTeamALLList();
+
+    String getRoleCodeByUserId(String userId);
 }

+ 25 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialStareMapper.java

@@ -0,0 +1,25 @@
+package org.jeecg.ctop.material.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+@Mapper
+public interface MaterialStareMapper {
+
+    List<Map> getCostByUserIdList(@Param("today") Long today, @Param("yesterday") Long yesterday, @Param("list") Set<String> operatorUserIds);
+
+    List<Map> getCostByUserIdListMoreDay(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("list")Set<String> operatorUserIds);
+
+    List<JSONObject> getCostByTop5List(@Param("startDate")Long start, @Param("list")Set<String> operatorUserIds);
+
+    List<JSONObject> getCostByTop5ListMoreDay(@Param("startDate")Long start, @Param("endDate")Long end, @Param("list")Set<String> operatorUserIds);
+
+    Set<String> getAffiliateId(@Param("leaderId")String userId);
+
+    Set<String> querySubordinateRecursive(@Param("leaderIds")Set<String> leaderIds);
+}

+ 69 - 43
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialReportOverViewV3Mapper.xml

@@ -10,14 +10,14 @@
           and del_flag = 0
     </select>
 
-    <select id="getDesignTeamList"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="getDesignTeamList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT id,depart_name as departName,leader_id as leaderId,leader_name as leaderName  from sys_depart where parent_id =(
         SELECT t1.parent_id from sys_user   t
         LEFT JOIN sys_depart t1 on  t.org_code=t1.org_code
         where t.id=#{userId})
     </select>
 
-    <select id="getDesignTeamALLList"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="getDesignTeamALLList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT id,depart_name as departName,leader_id as leaderId,leader_name as leaderName  from
         application.sys_depart_personal
     </select>
@@ -163,13 +163,13 @@
         count( tt.material_id) as count ,
         DATE_FORMAT(tt.media_time, '%Y-%m-%d') as time
         from (
-        SELECT  t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id  from
+        SELECT t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id from
         application.app_bytedance_material_info t
         left join
         ctop_user_allocation t1 on t.leader_id=t1.user_id
 
         <where>
-         t.media_time BETWEEN #{startDate} and #{endDate}
+            t.media_time BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -196,7 +196,7 @@
         count( tt.material_id) as count ,
         DATE_FORMAT(tt.media_time, '%Y-%m-%d') as time
         from (
-        SELECT  t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id from
+        SELECT t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id from
         application.app_kuaishou_material_info t
         left join
         ctop_user_allocation t1 on t.leader_id=t1.user_id
@@ -224,12 +224,12 @@
 
     <!-- 查询有消耗的素材 头条 -->
     <select id="queryMaterialCostList" resultType="long">
-        select  count(0) from (
-        SELECT  t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id  from
+        select count(0) from (
+        SELECT t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id from
         application.app_bytedance_material_info t
         left join
         ctop_user_allocation t1 on t.leader_id=t1.user_id
-        left  join application.bytedance_material_farst_cost_time t2 on t.material_id =t2.signature
+        left join application.bytedance_material_farst_cost_time t2 on t.material_id =t2.signature
         <where>
             t.media_time BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
@@ -289,7 +289,7 @@
         count( tt.material_id) as count ,
         DATE_FORMAT(tt.effect_date, '%Y-%m-%d') as time
         from (
-        SELECT  t.material_id ,t.effect_date,leader_id,clip_id,shot_id,plan_id,company_id  from
+        SELECT t.material_id ,t.effect_date,leader_id,clip_id,shot_id,plan_id,company_id from
         application.app_bytedance_material_info t
         left join
         ctop_user_allocation t1 on t.leader_id=t1.user_id
@@ -323,7 +323,7 @@
         count( tt.material_id) as count ,
         DATE_FORMAT(tt.effect_date, '%Y-%m-%d') as time
         from (
-        SELECT  t.material_id ,t.effect_date,leader_id,clip_id,shot_id,plan_id,company_id from
+        SELECT t.material_id ,t.effect_date,leader_id,clip_id,shot_id,plan_id,company_id from
         application.app_kuaishou_material_info t
         left join
         ctop_user_allocation t1 on t.leader_id=t1.user_id
@@ -357,7 +357,7 @@
         count( tt.material_id) as count ,
         DATE_FORMAT(tt.faddish_date, '%Y-%m-%d') as time
         from (
-        SELECT  t.material_id,t.faddish_date  from
+        SELECT t.material_id,t.faddish_date from
         application.app_bytedance_material_info t
         left join
         ctop_user_allocation t1 on t.leader_id=t1.user_id
@@ -389,7 +389,7 @@
             </if>
             AND t.company_id=#{companyId}
         </where>
-            group by t.material_id
+        group by t.material_id
         )tt
         GROUP BY time
         ORDER BY time
@@ -403,7 +403,7 @@
         count( tt.material_id) as count ,
         DATE_FORMAT(tt.faddish_date, '%Y-%m-%d') as time
         from (
-        SELECT  t.material_id,t.faddish_date  from
+        SELECT t.material_id,t.faddish_date from
         application.app_kuaishou_material_info t
         left join
         ctop_user_allocation t1 on t.leader_id=t1.user_id
@@ -578,13 +578,15 @@
     </select>
 
     <select id="queryBytedanceTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT ROUND(SUM(t1.cost),2) as charge,tt.material_id,t1.cover_url as 'coverUrl',tt.video_url as 'url',tt.material_name as
+        SELECT ROUND(SUM(t1.cost),2) as charge,tt.material_id,t1.cover_url as 'coverUrl',tt.video_url as
+        'url',tt.material_name as
         'materialName',
         tt.tag as 'tag'
         from (
         select t.material_id,t.material_name,GROUP_CONCAT(t2.tag_name) as tag,video_url,cover_url from
         application.app_bytedance_material_info t left join
-        application.app_material_tag_busi_info t2 on t.material_id=t2.material_id   where tag_category_id=1 and t.company_id=#{companyId}
+        application.app_material_tag_busi_info t2 on t.material_id=t2.material_id where tag_category_id=1 and
+        t.company_id=#{companyId}
 
         <if test='dimension=="designTeam" and leaderId!=null'>
             and t.leader_id=#{leaderId}
@@ -592,7 +594,7 @@
         <if test='dimension=="designer" and designerId!=null'>
             and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
         </if>
-         group by t.material_id
+        group by t.material_id
         ) tt
 
         left join
@@ -622,15 +624,21 @@
         application.kuaishou_material_video_report_daily_dw t1
 
         left JOIN sys_user t2 on
-        <if test="type == 1"> t1.shot_id =t2.id</if>
-        <if test="type == 2"> t1.clip_id =t2.id</if>
-        <if test="type == 3"> t1.plan_id =t2.id</if>
+        <if test="type == 1">t1.shot_id =t2.id</if>
+        <if test="type == 2">t1.clip_id =t2.id</if>
+        <if test="type == 3">t1.plan_id =t2.id</if>
         <where>
-            t1.stat_date  between #{startDate} and  #{endDate} and t1.company_id=#{companyId} and t2.status=1
+            t1.stat_date between #{startDate} and #{endDate} and t1.company_id=#{companyId} and t2.status=1
         </where>
-        <if test="type == 1">AND t1.shot_id is not null and t1.shot_id != '' AND t1.shot_name is not null and t1.shot_name != ''  GROUP BY t1.shot_id</if>
-        <if test="type == 2">AND t1.clip_id is not null and t1.clip_id != '' AND t1.clip_name is not null and t1.clip_name != '' GROUP BY t1.clip_id</if>
-        <if test="type == 3">AND t1.plan_id is not null and t1.plan_id != '' AND t1.plan_name is not null and t1.plan_name != '' GROUP BY t1.plan_id</if>
+        <if test="type == 1">AND t1.shot_id is not null and t1.shot_id != '' AND t1.shot_name is not null and
+            t1.shot_name != '' GROUP BY t1.shot_id
+        </if>
+        <if test="type == 2">AND t1.clip_id is not null and t1.clip_id != '' AND t1.clip_name is not null and
+            t1.clip_name != '' GROUP BY t1.clip_id
+        </if>
+        <if test="type == 3">AND t1.plan_id is not null and t1.plan_id != '' AND t1.plan_name is not null and
+            t1.plan_name != '' GROUP BY t1.plan_id
+        </if>
         ORDER BY cost desc
 
     </select>
@@ -640,11 +648,13 @@
         <if test="type == 1">t1.shot_name as userName, "摄像" as roleName,</if>
         <if test="type == 2">t1.clip_name as userName, "剪辑" as roleName,</if>
         <if test="type == 3">t1.plan_name as userName, "编导" as roleName,</if>
-        IFNULL(COUNT(DISTINCT t.material_id,IF(faddish_date BETWEEN #{startDate} and #{endDate} ,true,null)),0) as 'videoHotCount',
+        IFNULL(COUNT(DISTINCT t.material_id,IF(faddish_date BETWEEN #{startDate} and #{endDate} ,true,null)),0) as
+        'videoHotCount',
 
         ifnull( COUNT(DISTINCT t.material_id,IF(faddish_date BETWEEN #{startDate} and #{endDate} ,true,null))/
-        (SELECT COUNT(0) from application.app_bytedance_material_info where faddish_date BETWEEN #{startDate} and #{endDate} and company_id=#{companyId})*0.4,0)+
-         ifnull(SUM(t1.cost)/
+        (SELECT COUNT(0) from application.app_bytedance_material_info where faddish_date BETWEEN #{startDate} and
+        #{endDate} and company_id=#{companyId})*0.4,0)+
+        ifnull(SUM(t1.cost)/
         (SELECT SUM(cost) from application.bytedance_material_video_report_daily_dw where stat_datetime
         BETWEEN #{startDate} and #{endDate}
         )*0.6 ,0) as sort
@@ -653,16 +663,23 @@
         LEFT JOIN application.bytedance_material_video_report_daily_dw t1 on t.material_id=t1.signature
 
         left JOIN sys_user t2 on
-        <if test="type == 1"> t1.shot_id =t2.id</if>
-        <if test="type == 2"> t1.clip_id =t2.id</if>
-        <if test="type == 3"> t1.plan_id =t2.id</if>
+        <if test="type == 1">t1.shot_id =t2.id</if>
+        <if test="type == 2">t1.clip_id =t2.id</if>
+        <if test="type == 3">t1.plan_id =t2.id</if>
 
         <where>
-            t1.stat_datetime BETWEEN #{startDate} and #{endDate} and t.company_id=#{companyId} and t1.company_id=#{companyId} and t2.status=1
+            t1.stat_datetime BETWEEN #{startDate} and #{endDate} and t.company_id=#{companyId} and
+            t1.company_id=#{companyId} and t2.status=1
         </where>
-        <if test="type == 1">AND t1.shot_id is not null and t1.shot_id != '' AND t1.shot_name is not null and t1.shot_name != ''  GROUP BY t1.shot_id</if>
-        <if test="type == 2">AND t1.clip_id is not null and t1.clip_id != '' AND t1.clip_name is not null and t1.clip_name != '' GROUP BY t1.clip_id</if>
-        <if test="type == 3">AND t1.plan_id is not null and t1.plan_id != '' AND t1.plan_name is not null and t1.plan_name != '' GROUP BY t1.plan_id</if>
+        <if test="type == 1">AND t1.shot_id is not null and t1.shot_id != '' AND t1.shot_name is not null and
+            t1.shot_name != '' GROUP BY t1.shot_id
+        </if>
+        <if test="type == 2">AND t1.clip_id is not null and t1.clip_id != '' AND t1.clip_name is not null and
+            t1.clip_name != '' GROUP BY t1.clip_id
+        </if>
+        <if test="type == 3">AND t1.plan_id is not null and t1.plan_id != '' AND t1.plan_name is not null and
+            t1.plan_name != '' GROUP BY t1.plan_id
+        </if>
         ORDER BY sort desc
     </select>
 
@@ -711,10 +728,10 @@
             LEFT JOIN
             (select material_id from application.app_material_tag_busi_info
             <if test='materialType==1'>
-                where  parent_id=60156
+                where parent_id=60156
             </if>
             <if test='materialType==2'>
-                where  parent_id=60155
+                where parent_id=60155
             </if>
             GROUP BY material_id) t2 on t.material_id=t2.material_id
         </if>
@@ -785,13 +802,15 @@
 
 
     <select id="queryKuaishouTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT ROUND(SUM(t1.charge),2) as charge,tt.material_id,t1.cover_url as 'coverUrl',tt.video_url as 'url',tt.material_name as
+        SELECT ROUND(SUM(t1.charge),2) as charge,tt.material_id,t1.cover_url as 'coverUrl',tt.video_url as
+        'url',tt.material_name as
         'materialName',
         tt.tag as 'tag'
         from (
         select t.material_id,t.material_name,GROUP_CONCAT(t2.tag_name) as tag,video_url,cover_url from
         application.app_kuaishou_material_info t left join
-        application.app_material_tag_busi_info t2 on t.material_id=t2.material_id   where tag_category_id=1 and t.company_id=#{companyId}
+        application.app_material_tag_busi_info t2 on t.material_id=t2.material_id where tag_category_id=1 and
+        t.company_id=#{companyId}
 
         <if test='dimension=="designTeam" and leaderId!=null'>
             and t.leader_id=#{leaderId}
@@ -828,15 +847,15 @@
         FROM
         application.kuaishou_material_video_report_daily_dw t1
         LEFT JOIN
-        application.app_kuaishou_material_info t on  t1.signature=t.material_id
+        application.app_kuaishou_material_info t on t1.signature=t.material_id
         <if test="materialType!=null and materialType!=''">
             LEFT JOIN
             (select material_id from application.app_material_tag_busi_info
             <if test='materialType==1'>
-                where  parent_id=60156
+                where parent_id=60156
             </if>
             <if test='materialType==2'>
-                where  parent_id=60155
+                where parent_id=60155
             </if>
             GROUP BY material_id) t2 on t.material_id=t2.material_id
         </if>
@@ -1573,7 +1592,7 @@
         SELECT COUNT( distinct t.material_id) as 'size',
         case when t2.parent_name='其他' then 'other' when t2.parent_name='制作' then 'making' when t2.parent_name='真人' then
         'reality' end as 'label'
-        from  application.app_bytedance_material_info t
+        from application.app_bytedance_material_info t
         left join application.app_material_tag_busi_info t2 on t.material_id=t2.material_id
         left join ctop_user_allocation t1 on t.leader_id = t1.user_id
         <where>
@@ -1646,7 +1665,7 @@
         SELECT COUNT( distinct t.material_id) as 'size',
         case when t2.parent_name='其他' then 'other' when t2.parent_name='制作' then 'making' when t2.parent_name='真人' then
         'reality' end as 'label'
-        from  application.app_kuaishou_material_info t
+        from application.app_kuaishou_material_info t
         left join application.app_material_tag_busi_info t2 on t.material_id=t2.material_id
         left join ctop_user_allocation t1 on t.leader_id = t1.user_id
         <where>
@@ -1673,7 +1692,7 @@
 
 
     <!-- 快手根据标签查询消耗-->
-     <select id="getKuaishouMaterialCountByCost" resultType="com.alibaba.fastjson.JSONObject">
+    <select id="getKuaishouMaterialCountByCost" resultType="com.alibaba.fastjson.JSONObject">
 
         SELECT MAX(case tt.label WHEN 'making' then tt.cost ELSE 0 end ) 'making' ,
         MAX( case tt.label WHEN 'reality' then tt.cost ELSE 0 end ) 'reality',
@@ -1708,5 +1727,12 @@
         GROUP BY t2.parent_id
         ) tt
     </select>
+    <select id="getRoleCodeByUserId" resultType="java.lang.String">
+select c.role_code
+          from sys_user a
+                 left join sys_user_role b on a.id = b.user_id
+                 left join sys_role c on b.role_id = c.id
+        where a.id = #{userId}
+    </select>
 
 </mapper>

+ 93 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.ctop.material.mapper.MaterialStareMapper">
+
+    <select id="getCostByUserIdList" resultType="Map">
+        SELECT t.`hour`,ROUND(SUM(charge),2) as todayCost,
+        (SELECT IFNULL(ROUND(SUM(charge),2),0)
+        from application.kuaishou_account_report_hourly_dw
+        WHERE stat_date =#{today}
+        and `hour`=t.`hour`) as yesterdayCost
+        from application.kuaishou_account_report_hourly_dw t
+        WHERE t.stat_date =#{yesterday}
+        <if test='list!=null'>
+            AND t.user_id IN
+            <foreach collection="list" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY t.`hour` ORDER BY t.`hour`
+    </select>
+
+    <select id="getCostByUserIdListMoreDay" resultType="Map">
+        SELECT DATE_FORMAT(t.stat_date,'%Y-%m-%d') as date,ROUND(SUM(charge),2) as cost
+        FROM application.kuaishou_account_report_daily_dw t
+        WHERE t.stat_date BETWEEN #{startDate} and #{endDate}
+        <if test='list!=null'>
+            AND t.user_id IN
+            <foreach collection="list" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY t.stat_date ORDER BY t.stat_date;
+    </select>
+
+    <select id="getCostByTop5List" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT SUM(t.charge)as cost,t.`hour` from
+        (SELECT user_id,SUM(charge) from application.kuaishou_account_report_hourly_dw
+        WHERE stat_date =#{startDate}
+        <if test='list!=null'>
+            AND user_id IN
+            <foreach collection="list" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY user_id ORDER BY SUM(charge) DESC LIMIT 5) tt
+        LEFT JOIN application.kuaishou_account_report_hourly_dw t
+        on tt.user_id=t.user_id
+        WHERE t.stat_date =#{startDate} GROUP BY t.`hour`,tt.user_id ORDER BY t.`hour`,SUM(t.charge) ASC
+    </select>
+
+
+    <select id="getCostByTop5ListMoreDay" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT SUM(t.charge)as cost,t.stat_date as statDate from
+        (SELECT user_id,SUM(charge) from application.kuaishou_account_report_daily_dw
+        WHERE stat_date BETWEEN #{startDate}  and #{endDate}
+        <if test='list!=null'>
+            AND user_id IN
+            <foreach collection="list" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY user_id ORDER BY SUM(charge) DESC LIMIT 5) tt
+        LEFT JOIN application.kuaishou_account_report_daily_dw t
+        on tt.user_id=t.user_id
+        WHERE t.stat_date BETWEEN #{startDate}  and #{endDate} GROUP BY t.stat_date,tt.user_id ORDER BY t.stat_date,SUM(t.charge) ASC
+    </select>
+
+    <select id="getAffiliateId" resultType="java.lang.String">
+        SELECT distinct id
+        FROM sys_user
+        WHERE leader_id = #{leaderId}
+          and status = 1
+          and del_flag = 0
+    </select>
+
+    <select id="querySubordinateRecursive" resultType="java.lang.String">
+        SELECT distinct id
+        FROM sys_user
+        WHERE
+        status = 1
+        and del_flag = 0
+        and leader_id in
+        <foreach collection="leaderIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
+</mapper>

+ 12 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/MaterialStareService.java

@@ -0,0 +1,12 @@
+package org.jeecg.ctop.material.service;
+
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+
+/**
+ * 盯盘接口
+ */
+public interface MaterialStareService {
+
+    Result<JSONObject> sumData(Integer mediaId, Integer userType, String userId, String startDate, String endDate, Integer type);
+}

+ 33 - 39
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialReportOverViewV2ServiceImpl.java

@@ -1,9 +1,6 @@
 package org.jeecg.ctop.material.service.impl;
 
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.ExportExcelUtils;
-import cn.com.ctop.common.module.utils.HttpUtils;
+
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
@@ -11,16 +8,13 @@ import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.constant.AccountReportConstants;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.common.utils.JsonResourceUtil;
+import org.jeecg.ctop.material.constants.*;
 import org.jeecg.ctop.material.mapper.MaterialReportOverViewV3Mapper;
 import org.jeecg.ctop.material.service.IMaterialReportOverViewV2Service;
-import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -39,8 +33,8 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
     @Autowired
     private MaterialReportOverViewV3Mapper materialReportOverViewV3Mapper;
 
-    @Autowired
-    private ISysRoleService roleService;
+    /*@Autowired
+    private ISysRoleService roleService;*/
 
     @Override
     public Set<String> recursiveQuerySubordinate(String userId) {
@@ -62,9 +56,9 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
      */
     @Override
     public List<JSONObject> getDesignTeamList(String userId, int mediaId) {
-        String roleCode = roleService.getRoleCodeByUserId(userId);
-        List<JSONObject> designTeamList=new ArrayList<>();
-        if ("admin".equals(roleCode) ) {
+        String roleCode = materialReportOverViewV3Mapper.getRoleCodeByUserId(userId);
+        List<JSONObject> designTeamList = new ArrayList<>();
+        if ("admin".equals(roleCode)) {
             //管理员查询全部部门
             designTeamList = materialReportOverViewV3Mapper.getDesignTeamALLList();
         } else {
@@ -168,19 +162,19 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
         }
         //根据userID查询公司id
         String companyId = materialReportOverViewV3Mapper.getCompanyId(userId);
-        startDate=startDate.replace("-", "");
-        endDate=endDate.replace("-", "");
+        startDate = startDate.replace("-", "");
+        endDate = endDate.replace("-", "");
 
 
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
             //视频上新
-            List<Map<String, String>> videoList = materialReportOverViewV3Mapper.queryMaterialCountList(Long.parseLong(startDate) , Long.parseLong(endDate) , projects, dimension, leaderId, designerId, companyId);
+            List<Map<String, String>> videoList = materialReportOverViewV3Mapper.queryMaterialCountList(Long.parseLong(startDate), Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
             //总数
             long videoTotal = videoList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             result.put("videoList", videoList);
             result.put("videoTotal", videoTotal);
             //素材使用率 = 有消耗的素材 / 总数 * 100%
-            long videoCost = materialReportOverViewV3Mapper.queryMaterialCostList(Long.parseLong(startDate) , Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
+            long videoCost = materialReportOverViewV3Mapper.queryMaterialCostList(Long.parseLong(startDate), Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
             result.put("useCompare", Check.isNull(videoCost) ? 0 : new BigDecimal(videoCost).divide(new BigDecimal(videoTotal), 4, RoundingMode.HALF_UP));
             //有效视频
             List<Map<String, String>> effectiveList = materialReportOverViewV3Mapper.selectEffectiveMaterialVideoBytedance(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), projects, dimension, leaderId, designerId, companyId);
@@ -194,7 +188,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
 
             //视频上新
-            List<Map<String, String>> videoList = materialReportOverViewV3Mapper.queryMaterialCountListKs(Long.parseLong(startDate) , Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
+            List<Map<String, String>> videoList = materialReportOverViewV3Mapper.queryMaterialCountListKs(Long.parseLong(startDate), Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
             //总数
             long videoTotal = videoList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             result.put("videoList", videoList);
@@ -356,7 +350,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
     @Override
     public void exportBytedanceExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
         JSONArray projects = requestBody.getJSONArray("projects");
-        if (projects!=null && projects.isEmpty()) {
+        if (projects != null && projects.isEmpty()) {
             projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
         }
         JSONArray columns = requestBody.getJSONArray("columns");
@@ -420,7 +414,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
     @Override
     public void exportKuaishouExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
         JSONArray projects = requestBody.getJSONArray("projects");
-        if (projects!=null && projects.isEmpty()) {
+        if (projects != null && projects.isEmpty()) {
             projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
         }
         JSONArray columns2 = new JSONArray();
@@ -479,28 +473,28 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
     }
 
     @Override
-    public PageInfo getTopDesignList(Integer mediaId, String startDate, String endDate,String userId, Integer type, int pageNumber, int pageSize) {
+    public PageInfo getTopDesignList(Integer mediaId, String startDate, String endDate, String userId, Integer type, int pageNumber, int pageSize) {
 
         startDate = startDate.replace("-", "");
         endDate = endDate.replace("-", "");
         List<JSONObject> result = new ArrayList<>();
-        int total=0;
-        int page=pageNumber;
+        int total = 0;
+        int page = pageNumber;
         //根据userID查询公司id
         String companyId = materialReportOverViewV3Mapper.getCompanyId(userId);
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
-            total=materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type,companyId).size();
-            PageHelper.startPage(pageNumber, pageSize,false);
-            result = materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type,companyId);
+            total = materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId).size();
+            PageHelper.startPage(pageNumber, pageSize, false);
+            result = materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId);
 
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
-            total= materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type,companyId).size();
-            PageHelper.startPage(pageNumber, pageSize,false);
-            result = materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type,companyId);
+            total = materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId).size();
+            PageHelper.startPage(pageNumber, pageSize, false);
+            result = materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId);
         }
-        int number=(page-1)*10+1;
+        int number = (page - 1) * 10 + 1;
         for (JSONObject jsonObject : result) {
-            jsonObject.put("number",number);
+            jsonObject.put("number", number);
             number++;
         }
         PageInfo info = new PageInfo(result);
@@ -764,9 +758,9 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
             //组内人均消耗
             BigDecimal sumCost = materialReportOverViewV3Mapper.getBytedanceDesignTeamAvgCost(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId, companyId);
             //组人效
-            BigDecimal groupWork = materialReportOverViewV3Mapper.getBytedanceDesignTeamGroupWork(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId,companyId);
+            BigDecimal groupWork = materialReportOverViewV3Mapper.getBytedanceDesignTeamGroupWork(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId, companyId);
             //创新视频数
-            int innovativeVideoCount = materialReportOverViewV3Mapper.getBytedanceDesignTeaminnovativeVideoCount(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId,companyId);
+            int innovativeVideoCount = materialReportOverViewV3Mapper.getBytedanceDesignTeaminnovativeVideoCount(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId, companyId);
             //素材平均消耗
             BigDecimal avgCost = materialReportOverViewV3Mapper.getBytedanceMaterialCost(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId, companyId);
 
@@ -779,9 +773,9 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
             //组内人均消耗
             BigDecimal sumCost = materialReportOverViewV3Mapper.getKuaishouDesignTeamAvgCost(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId, companyId);
             //组人效
-            BigDecimal groupWork = materialReportOverViewV3Mapper.getKuaishouDesignTeamGroupWork(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId,companyId);
+            BigDecimal groupWork = materialReportOverViewV3Mapper.getKuaishouDesignTeamGroupWork(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId, companyId);
             //创新视频数
-            int innovativeVideoCount = materialReportOverViewV3Mapper.getKuaishouDesignTeaminnovativeVideoCount(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId,companyId);
+            int innovativeVideoCount = materialReportOverViewV3Mapper.getKuaishouDesignTeaminnovativeVideoCount(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId, companyId);
             //创新视频消耗
             BigDecimal innovativeVideoCost = materialReportOverViewV3Mapper.getKuaishouDesignTeaminnovativeVideoCost(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), leaderId, companyId);
             result.put("avgCost", sumCost);
@@ -804,8 +798,8 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
         if (projects != null && projects.isEmpty()) {
             projects = getProjectsByCurrentUser(mediaId);
         }
-        startDate=startDate.replace("-","");
-        endDate=endDate.replace("-","");
+        startDate = startDate.replace("-", "");
+        endDate = endDate.replace("-", "");
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
             //头条
             if (type == 0) {
@@ -845,7 +839,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
     public Result getRole(String userId) {
         Map map = new HashMap();
         Result result = new Result<>();
-        String roleCode = roleService.getRoleCodeByUserId(userId);
+        String roleCode = materialReportOverViewV3Mapper.getRoleCodeByUserId(userId);
         map.put("role", roleCode);
         if ("admin".equals(roleCode) || "designTeamLeader".equals(roleCode)) {
             map.put("permissions", true);
@@ -873,7 +867,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
         //String currentUser = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
         String currentUser = "e9ca23d68d884d4ebb19d07889727dae";
         //TODO 为了解决管理员等角色初始化查全部项目查询效率慢的问题判断角色,待优化
-        String roleCode = roleService.getRoleCodeByUserId(currentUser);
+        String roleCode = materialReportOverViewV3Mapper.getRoleCodeByUserId(currentUser);
         if ("admin".equals(roleCode)) {
             return null;
         }

+ 178 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java

@@ -0,0 +1,178 @@
+package org.jeecg.ctop.material.service.impl;
+
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.material.constants.CtopAdConstant;
+import org.jeecg.ctop.material.mapper.MaterialStareMapper;
+import org.jeecg.ctop.material.service.MaterialStareService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 盯盘接口
+ */
+@Slf4j
+@Service
+public class MaterialStareServiceImpl implements MaterialStareService {
+
+    @Resource
+    MaterialStareMapper materialStareMapper;
+
+
+    /**
+     * 数据总览
+     */
+    @Override
+    public Result<JSONObject> sumData(Integer mediaId, Integer userType, String userId, String startDate, String endDate, Integer type) {
+        Result result = new Result();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        Long start = Long.parseLong(startDate.replace("-", ""));
+        Long end = Long.parseLong(endDate.replace("-", ""));
+
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            //头条
+            //功能待完善
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            //快手
+            if (userType == 1) {  //运营经理界面
+                //查询当前人员所有下级
+                Set<String> operatorUserIds = getAffiliateId(userId);
+                if (type == 1) {  //汇总查看
+                    if (start.equals(end)) {  //查看当日
+                        Long beforeDay = dayBefore(start);
+                        //查询账户时报表当日数据
+                        List<Map> list = materialStareMapper.getCostByUserIdList(start, beforeDay, operatorUserIds);
+                        result.setResult(list);
+                        result.setSuccess(true);
+                        return result;
+                    } else { //查看多日
+                        //查询账户日报表当日数据
+                        List<Map> list = materialStareMapper.getCostByUserIdListMoreDay(start, end, operatorUserIds);
+                        result.setResult(list);
+                        result.setSuccess(true);
+                        return result;
+                    }
+
+                } else if (type == 2) {  //运营个人查看
+                    if (start.equals(end)) { //查看当日
+                        //查询个人top5当日时报
+                        List<JSONObject> resultList = new ArrayList<>();
+                        List<JSONObject> list = materialStareMapper.getCostByTop5List(start, operatorUserIds);
+                        int size = 0;
+                        int firstHour = list.get(0).getInteger("hour");
+                        //判断每个小时取出几条
+                        for (JSONObject jsonObject : list) {
+                            //判断每个小时取出几条
+                            Integer hour = jsonObject.getInteger("hour");
+                            if (hour == firstHour) {
+                                size++;
+                            }
+                        }
+                        for (int i = 0; i < list.size() / size; i++) {
+                            //没top条数据切割出来封装
+                            List<JSONObject> objects = list.subList(i * size, (i + 1) * size);
+                            JSONObject resultObj = new JSONObject();
+                            int j = 1;
+                            for (JSONObject object : objects) {
+                                resultObj.put("hours", object.getInteger("hour"));
+                                resultObj.put("top" + j, object.getBigDecimal("cost"));
+                                j++;
+                            }
+                            resultList.add(resultObj);
+                        }
+                        result.setResult(resultList);
+                        result.setSuccess(true);
+                        return result;
+                    } else {   //查看多日
+                        List<JSONObject> resultList = new ArrayList<>();
+                        //查询个人top5当日日报
+                        List<JSONObject> list = materialStareMapper.getCostByTop5ListMoreDay(start, end, operatorUserIds);
+                        int size = 0;
+                        int firstDate = list.get(0).getInteger("statDate");
+                        //判断每个小时取出几条
+                        for (JSONObject jsonObject : list) {
+                            //判断每个小时取出几条
+                            Integer hour = jsonObject.getInteger("statDate");
+                            if (hour == firstDate) {
+                                size++;
+                            }
+                        }
+                        for (int i = 0; i < list.size() / size; i++) {
+                            //没top条数据切割出来封装
+                            List<JSONObject> objects = list.subList(i * size, (i + 1) * size);
+                            JSONObject resultObj = new JSONObject();
+                            int j = 1;
+                            for (JSONObject object : objects) {
+                                resultObj.put("date", object.getInteger("statDate"));
+                                resultObj.put("top" + j, object.getBigDecimal("cost"));
+                                j++;
+                            }
+                            resultList.add(resultObj);
+                        }
+                        result.setResult(resultList);
+                        result.setSuccess(true);
+                        return result;
+                    }
+                }
+            } else if (userType == 2) {
+                //运营个人界面
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * 获取指定日期前一日 LONG类型
+     */
+    public Long dayBefore(Long date) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        Long beforeDay = null;
+        try {
+            Date parse = sdf.parse(date.toString());
+            Calendar c = Calendar.getInstance();
+            c.setTime(parse);
+            int day1 = c.get(Calendar.DATE);
+            c.set(Calendar.DATE, day1 - 1);
+            beforeDay = Long.parseLong(sdf.format(c.getTime()));
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return beforeDay;
+    }
+
+    /**
+     * 查询当前人员所有下级 返回自己和下属id
+     */
+
+    public Set<String> getAffiliateId(String userId) {
+        Set<String> result;
+        //查询当前用户是否存在下级
+        Set<String> subordinate = materialStareMapper.getAffiliateId(userId);
+        if (subordinate.isEmpty()) {
+            subordinate.add(userId);
+            return subordinate;
+        } else {
+            result = querySubordinate(subordinate, subordinate);
+            result.add(userId);
+        }
+        return result;
+    }
+
+    //递归查询
+    private Set<String> querySubordinate(Set<String> leaderIds, Set<String> result) {
+        if (leaderIds.isEmpty()) {
+            return result;
+        }
+        Set<String> temp = materialStareMapper.querySubordinateRecursive(leaderIds);
+        result.addAll(temp);
+        querySubordinate(temp, result);
+        return result;
+    }
+}

+ 1 - 1
jeecg-boot-material-view/src/main/resources/application-dev.yml

@@ -106,7 +106,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://192.168.0.184:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&serverTimezone=GMT%2B8
+          url: jdbc:mysql://111.206.86.186:3390/application?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&serverTimezone=GMT%2B8
           username: hcst
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver

+ 2 - 2
jeecg-boot-material-view/src/main/resources/application-prod.yml

@@ -106,8 +106,8 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://192.168.0.184:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&serverTimezone=GMT%2B8
-          username: data
+          url: jdbc:mysql://111.206.86.186:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&serverTimezone=GMT%2B8
+          username: hcst
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver
   #redis 配置

+ 1 - 1
jeecg-boot-material-view/src/main/resources/application-test.yml

@@ -106,7 +106,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://192.168.0.184:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&serverTimezone=GMT%2B8
+          url: jdbc:mysql://111.206.86.186:3390/application?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&serverTimezone=GMT%2B8
           username: hcst
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver