فهرست منبع

Merge branch 'V2.0.1'

zhaoxian 3 سال پیش
والد
کامیت
f5f5dbfeaf
12فایلهای تغییر یافته به همراه1341 افزوده شده و 0 حذف شده
  1. 251 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/controller/ProductMaterialController.java
  2. 232 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/controller/ProjectPictureLibraryController.java
  3. 123 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/entity/ProductMaterial.java
  4. 156 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/entity/ProjectPictureLibrary.java
  5. 29 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/ProductMaterialMapper.java
  6. 17 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/ProjectPictureLibraryMapper.java
  7. 209 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/ProductMaterialMapper.xml
  8. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/ProjectPictureLibraryMapper.xml
  9. 26 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IProductMaterialService.java
  10. 13 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IProjectPictureLibraryService.java
  11. 255 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/ProductMaterialServiceImpl.java
  12. 25 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/ProjectPictureLibraryServiceImpl.java

+ 251 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/controller/ProductMaterialController.java

@@ -0,0 +1,251 @@
+package cn.com.ctop.kuaishou.modules.material.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.kuaishou.modules.material.entity.ProductMaterial;
+import cn.com.ctop.kuaishou.modules.material.service.IProductMaterialService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 选品库——产品与商品信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-04-19
+ */
+@Slf4j
+@Api(tags = "选品库——产品与商品信息")
+@RestController
+@RequestMapping("/product/material")
+public class ProductMaterialController {
+    @Autowired
+    private IProductMaterialService productMaterialService;
+
+    /**
+     * 分页列表查询
+     */
+    @GetMapping(value = "/materialList")
+    public Result<Object> materialList(Long productId, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        return productMaterialService.materialList(productId, pageNo, pageSize);
+    }
+
+    /**
+     * 分页列表查询
+     */
+    @GetMapping(value = "/list")
+    public Result<Object> queryPageList(ProductMaterial productMaterial,
+                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        return productMaterialService.queryPageList(productMaterial, pageNo, pageSize);
+    }
+
+    /**
+     * 分页列表查询
+     */
+    @GetMapping(value = "/videoList")
+    public Result<Object> videoList(ProductMaterial productMaterial,
+                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (Check.isNull(productMaterial.getProductId()) || Check.isNull(productMaterial.getProductId()) || Check.isNull(productMaterial.getTradeName()) || Check.isNull(productMaterial.getStartMonth())) {
+            return Result.error("缺少参数");
+        }
+
+        return productMaterialService.videoList(productMaterial, pageNo, pageSize);
+    }
+
+    /**
+     * 添加
+     */
+    @PostMapping(value = "/add")
+    public Result<Object> add(@RequestBody JSONObject data) {
+        try {
+            return productMaterialService.add(data);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return Result.error("操作失败");
+        }
+    }
+
+    /**
+     * 编辑
+     */
+    @PostMapping(value = "/edit")
+    public Result<ProductMaterial> edit(@RequestBody ProductMaterial productMaterial) {
+        Result<ProductMaterial> result = new Result<ProductMaterial>();
+        Long productId = productMaterial.getProductId();
+        String tradeName = productMaterial.getTradeName();
+        if (Check.isNull(productId) || Check.isNull(tradeName)) {
+            return result.error500("缺少参数");
+        }
+        QueryWrapper<ProductMaterial> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("product_id", productId);
+        queryWrapper.eq("trade_name", tradeName);
+        boolean ok = productMaterialService.update(productMaterial, queryWrapper);
+        if (ok) {
+            result.success("修改成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     */
+    @GetMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            if (Check.isNull(id)) {
+                return Result.error("缺少参数!");
+            }
+            productMaterialService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "选品库——产品与商品信息-通过id查询", notes = "选品库——产品与商品信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<ProductMaterial> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<ProductMaterial> result = new Result<>();
+        ProductMaterial productMaterial = productMaterialService.getById(id);
+        if (productMaterial == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(productMaterial);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 下载视频详情报表
+     */
+    @GetMapping(value = "/getVideoDetailsReportExcel")
+    public void getVideoDetailsReportExcel(HttpServletResponse response, ProductMaterial productMaterial) {
+        try {
+
+            List<JSONObject> list = productMaterialService.getVideoDetailsReportList(productMaterial);
+            List<List<Object>> excelList = new ArrayList<>();
+            if (!list.isEmpty()) {
+                list.forEach(data -> {
+                    String endMonth = data.getString("endMonth");
+                    if(Check.isNull(endMonth)){
+                        endMonth= "-";
+                    }
+                    List<Object> temp = new ArrayList<>();
+                    temp.add(data.getString("productName"));
+                    temp.add(data.getString("tradeName"));
+                    temp.add(data.getString("startMonth")+" ~ " +endMonth);
+                    temp.add(data.getString("videoUrl"));
+                    temp.add(data.getString("charge"));
+                    temp.add(data.getString("itemRun"));
+                    temp.add(data.getString("user"));
+                    excelList.add(temp);
+                });
+            }
+            List<String> titles = new ArrayList<>();
+            titles.add(0, "产品名称");
+            titles.add(1, "商品名称");
+            titles.add(2, "时间");
+            titles.add(3, "视频链接");
+            titles.add(4, "消耗");
+            titles.add(5, "是否跑量");
+            titles.add(6, "上传人");
+
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            String[] headers = titles.toArray(new String[titles.size()]);
+            eeu.exportExcelForAttendance(workbook, 0, "选品视频", headers, excelList);
+            workbook.write(os);
+            os.flush();
+            os.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("查询失败", e.getMessage());
+        }
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<ProductMaterial> listProductMaterials = ExcelImportUtil.importExcel(file.getInputStream(), ProductMaterial.class, params);
+                productMaterialService.saveBatch(listProductMaterials);
+                return Result.ok("文件导入成功!数据行数:" + listProductMaterials.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 232 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/controller/ProjectPictureLibraryController.java

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

+ 123 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/entity/ProductMaterial.java

@@ -0,0 +1,123 @@
+package cn.com.ctop.kuaishou.modules.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * 选品库——产品与商品信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-04-19
+ */
+@Data
+@TableName("ctop_product_material")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_product_material对象", description = "选品库——产品与商品信息")
+public class ProductMaterial {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 产品id
+     */
+    @Excel(name = "产品id", width = 15)
+    @ApiModelProperty(value = "产品id")
+    private Long productId;
+    /**
+     * 产品名
+     */
+    @Excel(name = "产品名", width = 15)
+    @ApiModelProperty(value = "产品名")
+    private java.lang.String productName;
+    /**
+     * 商品名
+     */
+    @Excel(name = "商品名", width = 15)
+    @ApiModelProperty(value = "商品名")
+    private java.lang.String tradeName;
+    /**
+     * 商品品类
+     */
+    @Excel(name = "商品品类", width = 15)
+    @ApiModelProperty(value = "商品品类")
+    private java.lang.String tradeType;
+    /**
+     * 跑量单品
+     */
+    @Excel(name = "跑量单品", width = 15)
+    @ApiModelProperty(value = "跑量单品")
+    private java.lang.String itemRun;
+    /**
+     * 视频链接
+     */
+    @Excel(name = "视频链接", width = 15)
+    @ApiModelProperty(value = "视频链接")
+    private java.lang.String videoUrl;
+    /**
+     * 唯一MD5码
+     */
+    @Excel(name = "唯一MD5码", width = 15)
+    @ApiModelProperty(value = "唯一MD5码")
+    private java.lang.String signature;
+    /**
+     * 开始月份
+     */
+    @Excel(name = "开始月份", width = 15)
+    @ApiModelProperty(value = "开始月份")
+    private java.lang.String startMonth;
+    /**
+     * 结束月份
+     */
+    @Excel(name = "结束月份", width = 15)
+    @ApiModelProperty(value = "结束月份")
+    private java.lang.String endMonth;
+    /**
+     * 创建人id
+     */
+    @Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+    private java.lang.String userId;
+    /**
+     * 视频上传人id
+     */
+    @Excel(name = "视频上传人", width = 15)
+    @ApiModelProperty(value = "视频上传人")
+    private java.lang.String uploaderId;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private java.util.Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private java.util.Date updateTime;
+
+    @TableField(exist = false)
+    private String startDate;
+    @TableField(exist = false)
+    private String endDate;
+}

+ 156 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/entity/ProjectPictureLibrary.java

@@ -0,0 +1,156 @@
+package cn.com.ctop.kuaishou.modules.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 项目奖图片库
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-05-05
+ */
+@Data
+@TableName("ctop_project_picture_library")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_project_picture_library对象", description = "项目奖图片库")
+public class ProjectPictureLibrary {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称", width = 15)
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+    /**
+     * 媒体类型 1-头条 2-快手
+     */
+    @Excel(name = "媒体类型 1-头条 2-快手", width = 15)
+    @ApiModelProperty(value = "媒体类型 1-头条 2-快手")
+    private String mediaId;
+    /**
+     * width
+     */
+    @Excel(name = "width", width = 15)
+    @ApiModelProperty(value = "width")
+    private String width;
+    /**
+     * 素材类型
+     */
+    @Excel(name = "素材类型", width = 15)
+    @ApiModelProperty(value = "素材类型")
+    private String type;
+    /**
+     * height
+     */
+    @Excel(name = "height", width = 15)
+    @ApiModelProperty(value = "height")
+    private String height;
+    /**
+     * size
+     */
+    @Excel(name = "size", width = 15)
+    @ApiModelProperty(value = "size")
+    private String size;
+
+    /**
+     * 唯一MD5码
+     */
+    @Excel(name = "唯一MD5码", width = 15)
+    @ApiModelProperty(value = "唯一MD5码")
+    private String signature;
+    /**
+     * 审核人员id
+     */
+    @Excel(name = "审核人员id", width = 15)
+    @ApiModelProperty(value = "审核人员id")
+    private String auditorId;
+    /**
+     * 设计人员id
+     */
+    @Excel(name = "设计人员id", width = 15)
+    @ApiModelProperty(value = "设计人员id")
+    private String designerId;
+    /**
+     * 设计名称
+     */
+    @Excel(name = "设计名称", width = 15)
+    @ApiModelProperty(value = "设计名称")
+    private String designerName;
+    /**
+     * 图片链接
+     */
+    @Excel(name = "图片链接", width = 15)
+    @ApiModelProperty(value = "图片链接")
+    private String url;
+    /**
+     * 时间
+     */
+    @Excel(name = "时间", width = 15)
+    @ApiModelProperty(value = "时间")
+    private String statDate;
+    /**
+     * 审核状态1-未审核,2-审核通过,3-审核拒绝
+     */
+    @Excel(name = "审核状态1-未审核,2-审核通过,3-审核拒绝", width = 15)
+    @ApiModelProperty(value = "审核状态1-未审核,2-审核通过,3-审核拒绝")
+    private String auditState;
+    /**
+     * 审核时间
+     */
+    @Excel(name = "审核时间", width = 15)
+    @ApiModelProperty(value = "审核时间")
+    private String auditTime;
+    /**
+     * 审核说明
+     */
+    @Excel(name = "审核说明", width = 15)
+    @ApiModelProperty(value = "审核说明")
+    private String auditMessage;
+    /**
+     * 图片创建人id
+     */
+    @Excel(name = "图片创建人id", width = 15)
+    @ApiModelProperty(value = "图片创建人id")
+    private String userId;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

+ 29 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/ProductMaterialMapper.java

@@ -0,0 +1,29 @@
+package cn.com.ctop.kuaishou.modules.material.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.material.entity.ProductMaterial;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 选品库——产品与商品信息
+ * @author jeecg-boot
+ * 2022-04-19
+ * @version V1.0
+ */
+public interface ProductMaterialMapper extends BaseMapper<ProductMaterial> {
+
+    void replaceBatch(@Param("list")  List<ProductMaterial> lists);
+
+    Long queryPageListTotal(ProductMaterial productMaterial);
+
+    List<JSONObject> queryPageList(ProductMaterial productMaterial);
+
+    Long videoListTotal(ProductMaterial productMaterial);
+
+    List<JSONObject> videoList(ProductMaterial productMaterial);
+
+    List<JSONObject> getVideoDetailsReportList(ProductMaterial productMaterial);
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/ProjectPictureLibraryMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.material.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.material.entity.ProjectPictureLibrary;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 项目奖图片库
+ * @author jeecg-boot
+ * 2022-05-05
+ * @version V1.0
+ */
+public interface ProjectPictureLibraryMapper extends BaseMapper<ProjectPictureLibrary> {
+
+}

+ 209 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/ProductMaterialMapper.xml

@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.material.mapper.ProductMaterialMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_product_material(
+        product_id,
+        product_name,
+        trade_name,
+        trade_type,
+        video_url,
+        signature,
+        start_month,
+        end_month,
+        user_id,
+        uploader_id
+        )
+        values
+        <foreach collection="list" item="pro" separator=",">
+            (
+            #{pro.productId},
+            #{pro.productName},
+            #{pro.tradeName},
+            #{pro.tradeType},
+            #{pro.videoUrl},
+            #{pro.signature},
+            #{pro.startMonth},
+            #{pro.endMonth},
+            #{pro.userId},
+            #{pro.uploaderId}
+            )
+        </foreach>
+    </insert>
+
+    <select id="queryPageListTotal" resultType="java.lang.Long">
+        SELECT
+        IFNULL(sum(1),0)
+        from (
+        select
+        trade_name
+        FROM ctop_product_material
+        <where>
+            <if test="productId!=null">
+                and product_id = #{productId}
+            </if>
+            <if test="tradeName!=null">
+                and trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
+            </if>
+            <if test="startMonth!=null">
+                and start_month >= #{startMonth}
+            </if>
+            <if test="endMonth!=null">
+                AND (end_month &lt;= #{endMonth} OR (end_month IS NULL AND start_month &lt;= #{endMonth}))
+            </if>
+            <if test="itemRun!=null">
+                and item_run = #{itemRun}
+            </if>
+        </where>
+        group by product_id,trade_name
+        ) t
+    </select>
+
+
+    <select id="queryPageList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.product_id as 'productId',
+        t1.product_name as 'productName',
+        t1.trade_name as 'tradeName',
+        t1.trade_type as 'tradeType',
+        t1.item_run as 'itemRun',
+        IF(t4.videoCount is null ,'-',IFNULL(sum(t2.charge),0.00)) as 'charge',
+        CONCAT_WS(' ~ ',t1.start_month,t1.end_month) AS 'time',
+        IFNULL(t3.realname,'-') as 'user',
+        IFNULL(t4.videoCount ,'-') as 'videoCount'
+        FROM ctop_product_material t1
+        LEFT JOIN
+        (
+        SELECT signature , sum(charge) as 'charge' FROM application.kuaishou_material_video_report_daily_dw
+        <where>
+            <if test="productId!=null">
+                and product_id = #{productId}
+            </if>
+            <if test="startDate!=null">
+                AND stat_date >=DATE_FORMAT(#{startDate}, '%Y%m%d' )
+            </if>
+            <if test="endDate!=null">
+                AND stat_date &lt;=DATE_FORMAT(#{endDate}, '%Y%m%d' )
+            </if>
+        </where>
+        GROUP BY signature
+        ) t2 ON t1.signature = t2.signature
+        LEFT JOIN (select id, realname from sys_user) t3 on t1.user_id =t3.id
+        LEFT JOIN ( SELECT product_id, trade_name, sum(1)AS 'videoCount' FROM ctop_product_material
+        WHERE video_url is not null
+        GROUP BY product_id,trade_name) t4 ON t1.product_id = t4.product_id AND t1.trade_name= t4.trade_name
+        <where>
+            <if test="productId!=null">
+                and t1.product_id = #{productId}
+            </if>
+            <if test="tradeName!=null">
+                and t1.trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
+            </if>
+            <if test="startMonth!=null">
+                and t1.start_month >= #{startMonth}
+            </if>
+            <if test="endMonth!=null">
+                AND (t1.end_month &lt;= #{endMonth} OR (t1.end_month IS NULL AND t1.start_month &lt;= #{endMonth}))
+            </if>
+            <if test="itemRun!=null">
+                and t1.item_run = #{itemRun}
+            </if>
+        </where>
+        group by t1.product_id,t1.trade_name
+        ORDER BY t1.create_time desc
+    </select>
+
+    <select id="videoListTotal" resultType="java.lang.Long">
+        SELECT IFNULL(sum(1), 0)
+        from (
+        select trade_name
+        FROM ctop_product_material
+        WHERE video_url is not null
+        and product_id = #{productId}
+        and trade_name = #{tradeName}
+        and start_month >= #{startMonth}
+        <if test="endMonth!=null">
+            and end_month &lt;= #{endMonth}
+        </if>
+        group by signature
+        ) t
+    </select>
+
+    <select id="videoList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.id,
+        t1.product_name as 'productName',
+        t1.trade_name as 'tradeName',
+        t1.video_url as 'videoUrl',
+        IFNULL(t2.charge, 0.00) as 'charge',
+        IFNULL(t3.realname, '-') as 'user'
+        FROM ctop_product_material t1
+        LEFT JOIN (
+        SELECT signature, sum(charge) as 'charge'
+        FROM application.kuaishou_material_video_report_daily_dw
+        where product_id = #{productId}
+        AND stat_date >= DATE_FORMAT(#{startDate}, '%Y%m%d')
+        AND stat_date &lt;= DATE_FORMAT(#{endDate}, '%Y%m%d')
+        GROUP BY signature
+        ) t2 ON t1.signature = t2.signature
+        LEFT JOIN (select id, realname from sys_user) t3 on t1.uploader_id = t3.id
+        WHERE video_url is not null
+        and product_id = #{productId}
+        and trade_name = #{tradeName}
+        and start_month >= #{startMonth}
+        <if test="endMonth!=null">
+            and end_month &lt;= #{endMonth}
+        </if>
+        ORDER BY t1.create_time desc
+    </select>
+
+    <select id="getVideoDetailsReportList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.product_name as 'productName',
+        t1.trade_name as 'tradeName',
+        t1.start_month as 'startMonth',
+        t1.end_month as 'endMonth',
+        t1.video_url as 'videoUrl',
+        IFNULL(t2.charge, 0.00) as 'charge',
+        case t1.item_run
+        WHEN 1 THEN '是'
+        WHEN 0 THEN '否'
+        ELSE '-' END as 'itemRun',
+        IFNULL(t3.realname, '-') as 'user'
+        FROM ctop_product_material t1
+        LEFT JOIN
+        ( SELECT product_id,signature , sum(charge) as 'charge' FROM application.kuaishou_material_video_report_daily_dw
+        <where>
+            <if test="productId!=null">
+                and product_id = #{productId}
+            </if>
+            <if test="startDate!=null">
+                AND stat_date >=DATE_FORMAT(#{startDate}, '%Y%m%d' )
+            </if>
+            <if test="endDate!=null">
+                AND stat_date &lt;=DATE_FORMAT(#{endDate}, '%Y%m%d' )
+            </if>
+        </where>
+        GROUP BY signature
+        ) t2 ON t1.signature = t2.signature AND t1.product_id=t2.product_id
+        LEFT JOIN (select id, realname from sys_user) t3 on t1.uploader_id =t3.id
+        where video_url is not null
+        <if test="productId!=null">
+            and t1.product_id = #{productId}
+        </if>
+        <if test="tradeName!=null">
+            and t1.trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
+        </if>
+        <if test="startMonth!=null">
+            and t1.start_month >= #{startMonth}
+        </if>
+        <if test="endMonth!=null">
+            AND (t1.end_month &lt;= #{endMonth} OR (t1.end_month IS NULL AND t1.start_month &lt;= #{endMonth}))
+        </if>
+        <if test="itemRun!=null">
+            and t1.item_run = #{itemRun}
+        </if>
+        ORDER BY t1.create_time desc
+    </select>
+
+</mapper>

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/ProjectPictureLibraryMapper.xml

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

+ 26 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IProductMaterialService.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.kuaishou.modules.material.service;
+
+import cn.com.ctop.kuaishou.modules.material.entity.ProductMaterial;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * 选品库——产品与商品信息
+ * 2022-04-19
+ */
+public interface IProductMaterialService extends IService<ProductMaterial> {
+
+    Result<Object> queryPageList(ProductMaterial productMaterial, Integer pageNo, Integer pageSize);
+
+    Result<Object> videoList(ProductMaterial productMaterial, Integer pageNo, Integer pageSize);
+
+    Result<Object> add(JSONObject data) throws IOException;
+
+    List<JSONObject> getVideoDetailsReportList(ProductMaterial productMaterial);
+
+    Result<Object> materialList(Long productId, Integer pageNo, Integer pageSize);
+}

+ 13 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IProjectPictureLibraryService.java

@@ -0,0 +1,13 @@
+package cn.com.ctop.kuaishou.modules.material.service;
+
+import cn.com.ctop.kuaishou.modules.material.entity.ProjectPictureLibrary;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+
+/**
+ * 项目图片库
+ */
+public interface IProjectPictureLibraryService extends IService<ProjectPictureLibrary> {
+
+    Result<Object> add(ProjectPictureLibrary projectPictureLibrary);
+}

+ 255 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/ProductMaterialServiceImpl.java

@@ -0,0 +1,255 @@
+package cn.com.ctop.kuaishou.modules.material.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CosUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.vo.ResFileDTO;
+import cn.com.ctop.kuaishou.modules.material.entity.ProductMaterial;
+import cn.com.ctop.kuaishou.modules.material.mapper.ProductMaterialMapper;
+import cn.com.ctop.kuaishou.modules.material.service.IProductMaterialService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.MD5Util;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 选品库——产品与商品信息
+ *
+ * @author jeecg-boot
+ * 2022-04-19
+ * @version V1.0
+ */
+@Service
+public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMapper, ProductMaterial> implements IProductMaterialService {
+
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+
+
+    @Value("${zip.local.download-path}")
+    private String downloadPath;
+
+    static ExecutorService videoService = Executors.newFixedThreadPool(8);
+    @Override
+    public Result<Object> queryPageList(ProductMaterial productMaterial, Integer pageNo, Integer pageSize) {
+        String startMonth = productMaterial.getStartMonth();
+        String endMonth = productMaterial.getEndMonth();
+        if (!Check.isNull(startMonth)) {
+            productMaterial.setStartDate(startMonth.concat("-01"));
+            if (!Check.isNull(endMonth)) {
+                String[] sp = endMonth.split("-");
+                String lastDayStr = "-" + DateUtils.getDaysOfMonth(Integer.valueOf(sp[0]), Integer.valueOf(sp[1]));
+                productMaterial.setEndDate(endMonth.concat(lastDayStr));
+            }
+        }
+        Long total = baseMapper.queryPageListTotal(productMaterial);
+        PageHelper.startPage(pageNo, pageSize, false);
+        List<JSONObject> list = baseMapper.queryPageList(productMaterial);
+        PageInfo pageInfo = new PageInfo(list);
+        pageInfo.setTotal(total);
+        return Result.ok(pageInfo);
+    }
+
+    @Override
+    public Result<Object> videoList(ProductMaterial productMaterial, Integer pageNo, Integer pageSize) {
+        String startMonth = productMaterial.getStartMonth();
+        String endMonth = productMaterial.getEndMonth();
+        if (!Check.isNull(startMonth)) {
+            productMaterial.setStartDate(startMonth.concat("-01"));
+            if (!Check.isNull(endMonth)) {
+                String[] sp = endMonth.split("-");
+                String lastDayStr = "-" + DateUtils.getDaysOfMonth(Integer.valueOf(sp[0]), Integer.valueOf(sp[1]));
+                productMaterial.setEndDate(endMonth.concat(lastDayStr));
+            }else{
+                productMaterial.setEndDate(DateUtils.date2Str());
+            }
+        }
+        Long total = baseMapper.videoListTotal(productMaterial);
+        PageHelper.startPage(pageNo, pageSize, false);
+        List<JSONObject> list = baseMapper.videoList(productMaterial);
+        PageInfo pageInfo = new PageInfo(list);
+        pageInfo.setTotal(total);
+        return Result.ok(pageInfo);
+    }
+
+    @Override
+    public Result<Object> add(JSONObject data) throws IOException {
+        String result = "添加完成";
+        JSONArray list = data.getJSONArray("list");
+        if (Check.isNull(list) || list.size() == 0) {
+            return Result.error("缺少参数");
+        }
+        ProductMaterial entity = JSONObject.parseObject(data.toJSONString(), ProductMaterial.class);
+
+        List<ProductMaterial> lists = new ArrayList<>();
+        boolean flag = false;
+        String msg = "";
+        for (int i = 0; i < list.size(); i++) {
+            JSONObject trade = list.getJSONObject(i);
+            String tradeName = trade.getString("tradeName");
+            String videoUrl = trade.getString("videoUrl");
+            String signature = trade.getString("signature");
+            String uploaderId = trade.getString("uploaderId");
+            QueryWrapper<ProductMaterial> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("product_id", entity.getProductId());
+            queryWrapper.eq("trade_name", tradeName).last("limit 1");
+            ProductMaterial one1 = this.getOne(queryWrapper);
+            if (!Check.isNull(one1)) {
+                entity.setStartMonth(one1.getStartMonth());
+                entity.setEndMonth(one1.getEndMonth());
+                result = "";
+            }
+            int count = 0;
+            queryWrapper.isNull("video_url");
+            ProductMaterial one = this.getOne(queryWrapper);
+            if (Check.isNull(one)) {
+                entity.setTradeName(tradeName);
+                lists.add(entity);
+            }
+            if (!Check.isNull(videoUrl)) {
+                if (Check.isNull(signature) && Check.isNull(uploaderId)) {
+                    List<String >urls = Arrays.asList(videoUrl.split(","));
+                    HashSet<String> set = new HashSet<>(urls);
+                    for (String url : set) {
+                        count++;
+                        //获取MD5
+                        String localPath = LoadFileUtil.downLoadFromUrl(url, downloadPath);
+                        String md5 = MD5Util.getMd5(localPath);
+                        LoadFileUtil.delFile(localPath);
+                        if (checkVideo(entity.getProductId(), tradeName, md5)) {
+                            videoService.submit(new Runnable() {
+                                @Override
+                                public void run() {
+                                    try {
+                                        ProductMaterial material = new ProductMaterial();
+                                        BeanUtils.copyProperties(entity, material);
+                                        material.setUploaderId(entity.getUserId());
+                                        material.setTradeName(tradeName);
+                                        material.setSignature(md5);
+                                        String cosUrl = getCosUrl(url);
+                                        material.setVideoUrl(cosUrl);
+                                       baseMapper.insert(material);
+                                    } catch (Exception e) {
+                                        e.printStackTrace();
+                                    }
+                                }
+                            });
+
+                        } else {
+                            flag = true;
+                            if (msg.contains(tradeName)) {
+                                msg += "第" + count + "条视频已存在,";
+                            } else {
+                                msg += "商品(" + tradeName + ")下的第" + count + "条视频已存在,";
+                            }
+                        }
+                    }
+                } else {
+                    ProductMaterial material = new ProductMaterial();
+                    BeanUtils.copyProperties(entity, material);
+                    material.setTradeName(tradeName);
+                    material.setVideoUrl(videoUrl);
+                    material.setSignature(signature);
+                    material.setUploaderId(entity.getUserId());
+                    if (checkVideo(entity.getProductId(), tradeName, signature)) {
+                        lists.add(material);
+                    }
+                }
+            }
+        }
+        if (!Check.isNull(lists)) {
+            baseMapper.replaceBatch(lists);
+        }
+        if (flag) {
+            return Result.ok("添加完成,其中" + msg.substring(0, msg.length() - 1));
+        }
+        return Result.ok("添加完成");
+    }
+
+    @Override
+    public List<JSONObject> getVideoDetailsReportList(ProductMaterial productMaterial) {
+        String startMonth = productMaterial.getStartMonth();
+        String endMonth = productMaterial.getEndMonth();
+        if (!Check.isNull(startMonth)) {
+            productMaterial.setStartDate(startMonth.concat("-01"));
+            if (!Check.isNull(endMonth)) {
+                String[] sp = endMonth.split("-");
+                String lastDayStr = "-" + DateUtils.getDaysOfMonth(Integer.valueOf(sp[0]), Integer.valueOf(sp[1]));
+                productMaterial.setEndDate(endMonth.concat(lastDayStr));
+            }
+        }
+        List<JSONObject> list = baseMapper.getVideoDetailsReportList(productMaterial);
+        return list;
+    }
+
+    @Override
+    public Result<Object> materialList(Long productId, Integer pageNo, Integer pageSize) {
+        PageHelper.startPage(pageNo, pageSize, false);
+        List<MaterialInfo> list = materialInfoService.getListByProduct(productId);
+        PageInfo pageInfo = new PageInfo(list);
+        return Result.ok(pageInfo);
+    }
+
+
+    private boolean checkVideo(Long productId, String tradeName, String signature) {
+        QueryWrapper<ProductMaterial> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("product_id", productId);
+        queryWrapper.eq("trade_name", tradeName);
+        queryWrapper.eq("signature", signature).last("limit 1");
+        ProductMaterial one = this.getOne(queryWrapper);
+        if (Check.isNull(one)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+    /**
+     * 根据原始视频链接,下载到cos上
+     */
+    private String getCosUrl(String url) {
+        try {
+            if (!url.contains("http")) {
+                url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
+            }
+            InputStream imageStream = LoadFileUtil.getFileStream(url);
+            if (!Check.isNull(imageStream)) {
+                String path = "XuanPinKu/" + DateUtils.formatDate(new Date(), DateUtils.SHORT_FORMAT) + "/";
+                String videoName = UUID.randomUUID().toString().replace("-", "") + ".mp4";
+                ResFileDTO file = CosUtils.uploadDetailInputStreamV2(imageStream, videoName, "mp4", 0L, path);
+                return file.getFileUrl();
+            }
+        } catch (Exception e) {
+            log.error("上传COS异常", e);
+            return "上传COS失败";
+        }
+        return null;
+    }
+
+
+}

+ 25 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/ProjectPictureLibraryServiceImpl.java

@@ -0,0 +1,25 @@
+package cn.com.ctop.kuaishou.modules.material.service.impl;
+
+import cn.com.ctop.kuaishou.modules.material.entity.ProjectPictureLibrary;
+import cn.com.ctop.kuaishou.modules.material.mapper.ProjectPictureLibraryMapper;
+import cn.com.ctop.kuaishou.modules.material.service.IProjectPictureLibraryService;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 项目图片库
+ *
+ */
+@Service
+public class ProjectPictureLibraryServiceImpl extends ServiceImpl<ProjectPictureLibraryMapper, ProjectPictureLibrary> implements IProjectPictureLibraryService {
+
+    @Override
+    public Result<Object> add(ProjectPictureLibrary projectPictureLibrary) {
+
+
+
+        return null;
+    }
+}