syh 5 年 前
コミット
d95037e584
31 ファイル変更324 行追加679 行削除
  1. 40 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportYeterdayLoadJob.java
  2. 12 18
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/FileCallBackController.java
  3. 13 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/UserCallBackController.java
  4. 0 25
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/UserImplController.java
  5. 38 85
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileController.java
  6. 3 87
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileVersionController.java
  7. 2 86
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileWatermarkController.java
  8. 3 87
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsUserAclController.java
  9. 3 87
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsUserController.java
  10. 16 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileDTO.java
  11. 16 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserAclBO.java
  12. 14 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserDTO.java
  13. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFile.java
  14. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFileVersion.java
  15. 6 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsUser.java
  16. 11 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsUserAcl.java
  17. 7 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/IWpsFileService.java
  18. 58 54
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsFileServiceImpl.java
  19. 10 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsUserServiceImpl.java
  20. 8 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/WpsUtil.java
  21. 7 45
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/oss/WpsOSSUtil.java
  22. 1 1
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  23. 2 5
      jeecg-boot-module-system/src/main/resources/application-test.yml
  24. 2 2
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  25. 0 15
      jeecg-boot-module-system/src/main/resources/application.yml
  26. 10 50
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  27. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  28. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  29. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java
  30. 22 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java
  31. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

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

@@ -0,0 +1,40 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+
+
+@Slf4j
+public class BytedancePlanDailyReportYeterdayLoadJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IReportService reportService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        //1:查询当日数据
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条数据异常:为获取到可用的token");
+            return;
+        }
+        tokens.forEach(token -> {
+            //获取广告计划信息数据
+            reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        });
+    }
+
+}

+ 12 - 18
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/FileCallBackController.java

@@ -11,6 +11,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.Map;
 
 /**
@@ -33,12 +34,15 @@ public class FileCallBackController{
      * 获取文件元数据
      */
     @GetMapping("info")
-    public ResponseEntity<Object> getFileInfo(String _w_userid, String _w_filepath, String _w_filetype){
+    public ResponseEntity<Object> getFileInfo(String _w_userid, String _w_filepath, String _w_filetype, HttpServletRequest request){
+        String fileId = request.getHeader("x-weboffice-file-id");
+        log.info("获取文件id:{}",fileId);
         log.info("获取文件元数据userId:{},path:{},type:{}",_w_userid,_w_filepath,_w_filetype);
         try {
-            Map<String,Object> map = wpsFileService.getFileInfo(_w_userid,_w_filepath,_w_filetype);
+            Map<String,Object> map = wpsFileService.getFileInfo(_w_userid,_w_filepath,_w_filetype,fileId);
             return Response.success(map);
         }catch (Exception e){
+            e.printStackTrace();
             return Response.bad("获取文件元数据异常");
         }
     }
@@ -56,9 +60,10 @@ public class FileCallBackController{
      * 上传文件新版本
      */
     @PostMapping("save")
-    public ResponseEntity<Object> fileSave(@RequestBody MultipartFile file, String _w_userid){
+    public ResponseEntity<Object> fileSave(@RequestBody MultipartFile file, String _w_userid,HttpServletRequest request){
         log.info("上传文件新版本");
-        Map<String,Object> map = wpsFileService.fileSave(file,_w_userid);
+        String fileId = request.getHeader("x-weboffice-file-id");
+        Map<String,Object> map = wpsFileService.fileSave(file,_w_userid,fileId);
         return Response.success(map);
     }
 
@@ -76,9 +81,10 @@ public class FileCallBackController{
      * 文件重命名
      */
     @PutMapping("rename")
-    public ResponseEntity<Object> fileRename(@RequestBody FileReqDTO req, String _w_userid){
+    public ResponseEntity<Object> fileRename(@RequestBody FileReqDTO req, String _w_userid,HttpServletRequest request){
         log.info("文件重命名param:{},userId:{}", JSON.toJSON(req),_w_userid);
-        wpsFileService.fileRename(req.getName(),_w_userid);
+        String fileId = request.getHeader("x-weboffice-file-id");
+        wpsFileService.fileRename(req.getName(),_w_userid,fileId);
         return Response.success();
     }
 
@@ -101,16 +107,4 @@ public class FileCallBackController{
         Map<String,Object> res = wpsFileService.fileNew(file,_w_userid);
         return Response.success(res);
     }
-
-    /**
-     * 回调通知
-     */
-    @PostMapping("onnotify")
-    public ResponseEntity<Object> onNotify(@RequestBody JSONObject obj){
-        log.info("回调通知param:{}", JSON.toJSON(obj));
-        // TODO
-        // 返回数据暂不处理
-        return Response.success();
-    }
-
 }

+ 13 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/UserCallBackController.java

@@ -20,7 +20,7 @@ import java.util.Map;
  */
 @Slf4j
 @RestController
-@RequestMapping("v1/3rd/user")
+@RequestMapping("v1/3rd")
 public class UserCallBackController{
 
     @Autowired
@@ -29,7 +29,7 @@ public class UserCallBackController{
     /**
      * 获取用户信息
      */
-    @PostMapping("info")
+    @PostMapping("user/info")
     public ResponseEntity<Object> userInfo(@RequestBody JSONObject reqObj){
         log.info("获取用户信息param:{}", JSON.toJSON(reqObj));
         try {
@@ -41,4 +41,15 @@ public class UserCallBackController{
         }
     }
 
+    /**
+     * 回调通知
+     */
+    @PostMapping("onnotify")
+    public ResponseEntity<Object> onNotify(@RequestBody JSONObject obj){
+        log.info("回调通知param:{}", JSON.toJSON(obj));
+        // TODO
+        // 返回数据暂不处理
+        return Response.success();
+    }
+
 }

+ 0 - 25
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/UserImplController.java

@@ -8,7 +8,6 @@ import org.jeecg.modules.wps.util.Token;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 import java.util.Map;
@@ -76,20 +75,6 @@ public class UserImplController{
     }
 
     /**
-     * 上传文件
-     */
-    @PostMapping("uploadFile")
-    public ResponseEntity<Object> uploadFile(@RequestParam("file") MultipartFile file){
-        try {
-            wpsFileService.uploadFile(file);
-            return Response.success(true,"上传成功");
-        }catch (Exception e){
-            e.printStackTrace();
-            return Response.success(false,"上传失败");
-        }
-    }
-
-    /**
      * 通过fileId获取wpsUrl以及token
      * @param fileId 文件id
      * @return token(包含url)
@@ -105,14 +90,4 @@ public class UserImplController{
         }
     }
 
-    /**
-     * 通过wps官方模版新建文件
-     * template值 {"word", "excel", "ppt"}
-     */
-    @GetMapping("createTemplateFile")
-    public ResponseEntity<Object> createTemplateFile(String template){
-        String newUrl = wpsFileService.createTemplateFile(template);
-        return Response.success(newUrl);
-    }
-
 }

+ 38 - 85
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileController.java

@@ -1,39 +1,29 @@
 package org.jeecg.modules.wps.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.wps.base.Response;
 import org.jeecg.modules.wps.entity.WpsFile;
 import org.jeecg.modules.wps.service.IWpsFileService;
-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.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
 import java.util.Map;
 
- /**
+/**
  * wps文件
  * @author jeecg-boot
  * @date   2020-06-01
@@ -47,6 +37,25 @@ public class WpsFileController {
 	@Autowired
 	private IWpsFileService wpsFileService;
 
+	@PostMapping("bindProject")
+	public Map<String,Object> bindProject(String fileId,Long projectId){
+		return wpsFileService.bindProject(fileId,projectId);
+	}
+
+	/**
+	 * 上传文件
+	 */
+	@PostMapping("uploadFile")
+	public ResponseEntity<Object> uploadFile(@RequestParam("file") MultipartFile file){
+		try {
+			LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+			wpsFileService.uploadFile(file,user.getId());
+			return Response.success(true,"上传成功");
+		}catch (Exception e){
+			e.printStackTrace();
+			return Response.success(false,"上传失败");
+		}
+	}
 	/**
 	  * 分页列表查询
 	 * @param wpsFile
@@ -64,7 +73,9 @@ public class WpsFileController {
 												HttpServletRequest req) {
 		Result<IPage<WpsFile>> result = new Result<>();
 		QueryWrapper<WpsFile> queryWrapper = QueryGenerator.initQueryWrapper(wpsFile, req.getParameterMap());
-		Page<WpsFile> page = new Page<WpsFile>(pageNo, pageSize);
+		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		queryWrapper.eq("creator",sysUser.getId());
+		Page<WpsFile> page = new Page<>(pageNo, pageSize);
 		IPage<WpsFile> pageList = wpsFileService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -100,7 +111,7 @@ public class WpsFileController {
 	@ApiOperation(value="wps文件-编辑", notes="wps文件-编辑")
 	@PutMapping(value = "/edit")
 	public Result<WpsFile> edit(@RequestBody WpsFile wpsFile) {
-		Result<WpsFile> result = new Result<WpsFile>();
+		Result<WpsFile> result = new Result<>();
 		WpsFile wpsFileEntity = wpsFileService.getById(wpsFile.getId());
 		if(wpsFileEntity==null) {
 			result.error500("未找到对应实体");
@@ -122,7 +133,7 @@ public class WpsFileController {
 	@AutoLog(value = "wps文件-通过id删除")
 	@ApiOperation(value="wps文件-通过id删除", notes="wps文件-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
 		try {
 			wpsFileService.removeById(id);
 		} catch (Exception e) {
@@ -171,71 +182,13 @@ public class WpsFileController {
 		return result;
 	}
 
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<WpsFile> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              WpsFile wpsFile = JSON.parseObject(deString, WpsFile.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(wpsFile, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<WpsFile> pageList = wpsFileService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "wps文件列表");
-      mv.addObject(NormalExcelConstants.CLASS, WpsFile.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("wps文件列表数据", "导出人: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<WpsFile> listWpsFiles = ExcelImportUtil.importExcel(file.getInputStream(), WpsFile.class, params);
-              wpsFileService.saveBatch(listWpsFiles);
-              return Result.ok("文件导入成功!数据行数:" + listWpsFiles.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("文件导入失败!");
-  }
-
+	/**
+	 * 通过wps官方模版新建文件
+	 * template值 {"word", "excel", "ppt"}
+	 */
+	@GetMapping("createTemplateFile")
+	public ResponseEntity<Object> createTemplateFile(String template){
+		String newUrl = wpsFileService.createTemplateFile(template);
+		return Response.success(newUrl);
+	}
 }

+ 3 - 87
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileVersionController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.wps.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.wps.entity.WpsFileVersion;
 import org.jeecg.modules.wps.service.IWpsFileVersionService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
  /**
  * wps文件版本号
@@ -64,7 +48,7 @@ public class WpsFileVersionController {
 													   HttpServletRequest req) {
 		Result<IPage<WpsFileVersion>> result = new Result<>();
 		QueryWrapper<WpsFileVersion> queryWrapper = QueryGenerator.initQueryWrapper(wpsFileVersion, req.getParameterMap());
-		Page<WpsFileVersion> page = new Page<WpsFileVersion>(pageNo, pageSize);
+		Page<WpsFileVersion> page = new Page<>(pageNo, pageSize);
 		IPage<WpsFileVersion> pageList = wpsFileVersionService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -100,7 +84,7 @@ public class WpsFileVersionController {
 	@ApiOperation(value="wps文件版本号-编辑", notes="wps文件版本号-编辑")
 	@PutMapping(value = "/edit")
 	public Result<WpsFileVersion> edit(@RequestBody WpsFileVersion wpsFileVersion) {
-		Result<WpsFileVersion> result = new Result<WpsFileVersion>();
+		Result<WpsFileVersion> result = new Result<>();
 		WpsFileVersion wpsFileVersionEntity = wpsFileVersionService.getById(wpsFileVersion.getId());
 		if(wpsFileVersionEntity==null) {
 			result.error500("未找到对应实体");
@@ -122,7 +106,7 @@ public class WpsFileVersionController {
 	@AutoLog(value = "wps文件版本号-通过id删除")
 	@ApiOperation(value="wps文件版本号-通过id删除", notes="wps文件版本号-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
 		try {
 			wpsFileVersionService.removeById(id);
 		} catch (Exception e) {
@@ -170,72 +154,4 @@ public class WpsFileVersionController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<WpsFileVersion> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              WpsFileVersion wpsFileVersion = JSON.parseObject(deString, WpsFileVersion.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(wpsFileVersion, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<WpsFileVersion> pageList = wpsFileVersionService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "wps文件版本号列表");
-      mv.addObject(NormalExcelConstants.CLASS, WpsFileVersion.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("wps文件版本号列表数据", "导出人: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<WpsFileVersion> listWpsFileVersions = ExcelImportUtil.importExcel(file.getInputStream(), WpsFileVersion.class, params);
-              wpsFileVersionService.saveBatch(listWpsFileVersions);
-              return Result.ok("文件导入成功!数据行数:" + listWpsFileVersions.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("文件导入失败!");
-  }
-
 }

+ 2 - 86
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileWatermarkController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.wps.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.wps.entity.WpsFileWatermark;
 import org.jeecg.modules.wps.service.IWpsFileWatermarkService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
  /**
  * wps文件水印
@@ -100,7 +84,7 @@ public class WpsFileWatermarkController {
 	@ApiOperation(value="wps文件水印-编辑", notes="wps文件水印-编辑")
 	@PutMapping(value = "/edit")
 	public Result<WpsFileWatermark> edit(@RequestBody WpsFileWatermark wpsFileWatermark) {
-		Result<WpsFileWatermark> result = new Result<WpsFileWatermark>();
+		Result<WpsFileWatermark> result = new Result<>();
 		WpsFileWatermark wpsFileWatermarkEntity = wpsFileWatermarkService.getById(wpsFileWatermark.getId());
 		if(wpsFileWatermarkEntity==null) {
 			result.error500("未找到对应实体");
@@ -122,7 +106,7 @@ public class WpsFileWatermarkController {
 	@AutoLog(value = "wps文件水印-通过id删除")
 	@ApiOperation(value="wps文件水印-通过id删除", notes="wps文件水印-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
 		try {
 			wpsFileWatermarkService.removeById(id);
 		} catch (Exception e) {
@@ -170,72 +154,4 @@ public class WpsFileWatermarkController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<WpsFileWatermark> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              WpsFileWatermark wpsFileWatermark = JSON.parseObject(deString, WpsFileWatermark.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(wpsFileWatermark, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<WpsFileWatermark> pageList = wpsFileWatermarkService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "wps文件水印列表");
-      mv.addObject(NormalExcelConstants.CLASS, WpsFileWatermark.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("wps文件水印列表数据", "导出人: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<WpsFileWatermark> listWpsFileWatermarks = ExcelImportUtil.importExcel(file.getInputStream(), WpsFileWatermark.class, params);
-              wpsFileWatermarkService.saveBatch(listWpsFileWatermarks);
-              return Result.ok("文件导入成功!数据行数:" + listWpsFileWatermarks.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
-
 }

+ 3 - 87
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsUserAclController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.wps.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.wps.entity.WpsUserAcl;
 import org.jeecg.modules.wps.service.IWpsUserAclService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
  /**
  * wps用户权限
@@ -64,7 +48,7 @@ public class WpsUserAclController {
 												   HttpServletRequest req) {
 		Result<IPage<WpsUserAcl>> result = new Result<>();
 		QueryWrapper<WpsUserAcl> queryWrapper = QueryGenerator.initQueryWrapper(wpsUserAcl, req.getParameterMap());
-		Page<WpsUserAcl> page = new Page<WpsUserAcl>(pageNo, pageSize);
+		Page<WpsUserAcl> page = new Page<>(pageNo, pageSize);
 		IPage<WpsUserAcl> pageList = wpsUserAclService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -100,7 +84,7 @@ public class WpsUserAclController {
 	@ApiOperation(value="wps用户权限-编辑", notes="wps用户权限-编辑")
 	@PutMapping(value = "/edit")
 	public Result<WpsUserAcl> edit(@RequestBody WpsUserAcl wpsUserAcl) {
-		Result<WpsUserAcl> result = new Result<WpsUserAcl>();
+		Result<WpsUserAcl> result = new Result<>();
 		WpsUserAcl wpsUserAclEntity = wpsUserAclService.getById(wpsUserAcl.getId());
 		if(wpsUserAclEntity==null) {
 			result.error500("未找到对应实体");
@@ -122,7 +106,7 @@ public class WpsUserAclController {
 	@AutoLog(value = "wps用户权限-通过id删除")
 	@ApiOperation(value="wps用户权限-通过id删除", notes="wps用户权限-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
 		try {
 			wpsUserAclService.removeById(id);
 		} catch (Exception e) {
@@ -170,72 +154,4 @@ public class WpsUserAclController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<WpsUserAcl> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              WpsUserAcl wpsUserAcl = JSON.parseObject(deString, WpsUserAcl.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(wpsUserAcl, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<WpsUserAcl> pageList = wpsUserAclService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "wps用户权限列表");
-      mv.addObject(NormalExcelConstants.CLASS, WpsUserAcl.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("wps用户权限列表数据", "导出人: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<WpsUserAcl> listWpsUserAcls = ExcelImportUtil.importExcel(file.getInputStream(), WpsUserAcl.class, params);
-              wpsUserAclService.saveBatch(listWpsUserAcls);
-              return Result.ok("文件导入成功!数据行数:" + listWpsUserAcls.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
-
 }

+ 3 - 87
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsUserController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.wps.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.wps.entity.WpsUser;
 import org.jeecg.modules.wps.service.IWpsUserService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
  /**
  * wps用户
@@ -64,7 +48,7 @@ public class WpsUserController {
 												HttpServletRequest req) {
 		Result<IPage<WpsUser>> result = new Result<>();
 		QueryWrapper<WpsUser> queryWrapper = QueryGenerator.initQueryWrapper(wpsUser, req.getParameterMap());
-		Page<WpsUser> page = new Page<WpsUser>(pageNo, pageSize);
+		Page<WpsUser> page = new Page<>(pageNo, pageSize);
 		IPage<WpsUser> pageList = wpsUserService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -100,7 +84,7 @@ public class WpsUserController {
 	@ApiOperation(value="wps用户-编辑", notes="wps用户-编辑")
 	@PutMapping(value = "/edit")
 	public Result<WpsUser> edit(@RequestBody WpsUser wpsUser) {
-		Result<WpsUser> result = new Result<WpsUser>();
+		Result<WpsUser> result = new Result<>();
 		WpsUser wpsUserEntity = wpsUserService.getById(wpsUser.getId());
 		if(wpsUserEntity==null) {
 			result.error500("未找到对应实体");
@@ -122,7 +106,7 @@ public class WpsUserController {
 	@AutoLog(value = "wps用户-通过id删除")
 	@ApiOperation(value="wps用户-通过id删除", notes="wps用户-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
 		try {
 			wpsUserService.removeById(id);
 		} catch (Exception e) {
@@ -170,72 +154,4 @@ public class WpsUserController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<WpsUser> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              WpsUser wpsUser = JSON.parseObject(deString, WpsUser.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(wpsUser, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<WpsUser> pageList = wpsUserService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "wps用户列表");
-      mv.addObject(NormalExcelConstants.CLASS, WpsUser.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("wps用户列表数据", "导出人: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<WpsUser> listWpsUsers = ExcelImportUtil.importExcel(file.getInputStream(), WpsUser.class, params);
-              wpsUserService.saveBatch(listWpsUsers);
-              return Result.ok("文件导入成功!数据行数:" + listWpsUsers.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
-
 }

+ 16 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileDTO.java

@@ -49,5 +49,21 @@ public class FileDTO {
     private UserAclBO user_acl;
     private WatermarkBO watermark;
 
+    @Override
+    public String toString() {
+        return "FileDTO{" +
+                "id='" + id + '\'' +
+                ", name='" + name + '\'' +
+                ", version=" + version +
+                ", size=" + size +
+                ", creator='" + creator + '\'' +
+                ", modifier='" + modifier + '\'' +
+                ", create_time=" + create_time +
+                ", modify_time=" + modify_time +
+                ", download_url='" + download_url + '\'' +
+                ", user_acl=" + user_acl +
+                ", watermark=" + watermark +
+                '}';
+    }
 }
 

+ 16 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserAclBO.java

@@ -4,8 +4,22 @@ import lombok.Data;
 
 @Data
 public class UserAclBO {
+    /**
+     * 历史版本权限,1为打开该权限,0为关闭该权限,默认为1
+     */
+    private int history = 1;
+    /**
+     * 重命名权限,1为打开该权限,0为关闭该权限,默认为0
+     */
+    private int rename=1;
 
-    private int rename = 0; //重命名权限,1为打开该权限,0为关闭该权限,默认为0
-    private int history = 0; //历史版本权限,1为打开该权限,0为关闭该权限,默认为1
+    /**
+     * 打印
+     */
+    private int print=1;
+
+    private int copy = 1;
+
+    private int export=1;
 
 }

+ 14 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserDTO.java

@@ -7,10 +7,10 @@ import lombok.Data;
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class UserDTO {
 
-    private String id = "-1";
-    private String name = " ";
-    private String permission = "read";
-    private String avatar_url = "";
+    private String id;
+    private String name;
+    private String permission;
+    private String avatar_url;
 
     public UserDTO(){super();}
 
@@ -20,4 +20,14 @@ public class UserDTO {
         this.permission = permission;
         this.avatar_url = avatar_url;
     }
+
+    @Override
+    public String toString() {
+        return "UserDTO{" +
+                "id='" + id + '\'' +
+                ", name='" + name + '\'' +
+                ", permission='" + permission + '\'' +
+                ", avatar_url='" + avatar_url + '\'' +
+                '}';
+    }
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFile.java

@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 /**
@@ -42,6 +43,7 @@ public class WpsFile {
 	/**creator*/
 	@Excel(name = "creator", width = 15)
     @ApiModelProperty(value = "creator")
+	@Dict(dicCode = "id", dictTable = "sys_user", dicText = "realname")
 	private String creator;
 	/**createTime*/
 	@Excel(name = "createTime", width = 15)
@@ -67,6 +69,10 @@ public class WpsFile {
 	@Excel(name = "canDelete", width = 15)
     @ApiModelProperty(value = "canDelete")
 	private String canDelete;
+	@Dict(dicCode = "id", dictTable = "ctop_project", dicText = "project_name")
+	private Long projectId;
+
+	private String code;
 
 	public WpsFile(){super();}
 

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFileVersion.java

@@ -24,9 +24,9 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 public class WpsFileVersion {
 
 	/**id*/
-	@TableId(type = IdType.UUID)
+	@TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-	private Integer id;
+	private Long id;
 	/**fileId*/
 	@Excel(name = "fileId", width = 15)
     @ApiModelProperty(value = "fileId")

+ 6 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsUser.java

@@ -36,7 +36,12 @@ public class WpsUser {
     @ApiModelProperty(value = "avatarUrl")
 	private Object avatarUrl;
 
-	public WpsUser(String userId, String fileId) {
+	public WpsUser() {
+	}
 
+	public WpsUser(String id, String name, Object avatarUrl) {
+		this.id = id;
+		this.name = name;
+		this.avatarUrl = avatarUrl;
 	}
 }

+ 11 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsUserAcl.java

@@ -24,9 +24,9 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 public class WpsUserAcl {
 
 	/**id*/
-	@TableId(type = IdType.UUID)
+	@TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-	private Integer id;
+	private Long id;
 	/**userId*/
 	@Excel(name = "userId", width = 15)
     @ApiModelProperty(value = "userId")
@@ -48,6 +48,12 @@ public class WpsUserAcl {
     @ApiModelProperty(value = "history")
 	private Integer history;
 
+	private Integer cp;
+
+	private Integer expt;
+
+	private Integer prt;
+
 	public WpsUserAcl() {
 	}
 
@@ -57,5 +63,8 @@ public class WpsUserAcl {
 		this.permission = "write";
 		this.reName = 1;
 		this.history = 1;
+		this.cp = 1;
+		this.expt = 1;
+		this.prt = 1;
 	}
 }

+ 7 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/IWpsFileService.java

@@ -18,17 +18,17 @@ import java.util.Map;
  */
 public interface IWpsFileService extends IService<WpsFile> {
 
-    Map<String, Object> getFileInfo(String w_userid, String w_filepath, String w_filetype);
+    Map<String, Object> getFileInfo(String userId, String filePath, String fileType,String fileId);
 
-    Map<String, Object> fileSave(MultipartFile file, String w_userid);
+    Map<String, Object> fileSave(MultipartFile file, String userId,String fileId);
 
     Map<String, Object> fileVersion(Integer version);
 
-    void fileRename(String name, String w_userid);
+    void fileRename(String name, String userId,String fileId);
 
     Map<String, Object> fileHistory(FileReqDTO req);
 
-    Map<String, Object> fileNew(MultipartFile file, String w_userid);
+    Map<String, Object> fileNew(MultipartFile file, String userId);
 
     Token getViewUrl(String fileUrl, boolean b);
 
@@ -40,7 +40,9 @@ public interface IWpsFileService extends IService<WpsFile> {
 
     int delFile(String id);
 
-    void uploadFile(MultipartFile file);
+    void uploadFile(MultipartFile file,String userId);
 
     String createTemplateFile(String template);
+
+    Map<String, Object> bindProject(String fileId, Long projectId);
 }

+ 58 - 54
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsFileServiceImpl.java

@@ -6,6 +6,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.ctop.entity.Project;
+import org.jeecg.modules.ctop.service.IProjectService;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.wps.config.Context;
 import org.jeecg.modules.wps.dto.*;
 import org.jeecg.modules.wps.entity.*;
@@ -18,10 +24,10 @@ import org.jeecg.modules.wps.util.upload.ResFileDTO;
 import org.jeecg.modules.wps.util.upload.oss.WpsOSSUtil;
 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 org.springframework.web.multipart.MultipartFile;
 
+import java.net.URLEncoder;
 import java.util.*;
 
 /**
@@ -43,6 +49,10 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
     private IWpsUserService wpsUserService;
     @Autowired
     private WpsUtil wpsUtil;
+    @Autowired
+    private ISysUserService sysUserService;
+
+    private static final String OSS_URL_PREFIX = "https://ctop-media.oss-cn-beijing.aliyuncs.com/script-lib/wps/";
     @Override
     public Token getViewUrl(String fileUrl, boolean checkToken){
         Token t = new Token();
@@ -54,7 +64,7 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
 
         Map<String,String> values = new HashMap<String,String>(){
             {
-                put("_w_appid", appid);
+                put("_w_appid", WpsUtil.appid);
                 if (checkToken){
                     put("_w_tokentype","1");
                 }
@@ -72,16 +82,6 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
 
         return t;
     }
-    @Value("wps.domain")
-    private String domain;
-    @Value("wps.appid")
-    private String appid;
-    @Value("wps.appsecret")
-    private String appsecret;
-    @Value("wps.download_host")
-    private String downloadHost;
-    @Value("wps.local_Dir")
-    private String localDir;
 
     @Override
     public Token getViewUrl(String fileId,String userId,boolean checkToken){
@@ -95,7 +95,7 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
             String uuid = randomUuid.toString().replace("-","");
 
             Map<String,String> values = new HashMap<>();
-            values.put("_w_appid", appid);
+            values.put("_w_appid", WpsUtil.appid);
             if (checkToken){
                 values.put("_w_tokentype","1");
             }
@@ -114,11 +114,11 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
     }
 
     @Override
-    public Map<String,Object> getFileInfo(String userId, String filePath,String _w_filetype){
-        if ("web".equalsIgnoreCase(_w_filetype)){
+    public Map<String,Object> getFileInfo(String userId, String filePath,String fileType,String fileId){
+        if ("web".equalsIgnoreCase(fileType)){
             return getWebFileInfo(filePath);
-        }else if ("db".equalsIgnoreCase(_w_filetype)){
-            return getDbFileInfo(userId);
+        }else if ("db".equalsIgnoreCase(fileType)){
+            return getDbFileInfo(userId,fileId);
         }
         return null;
     }
@@ -143,54 +143,43 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
         return result;
     }
 
-    private Map<String,Object> getDbFileInfo(String userId){
-        String fileId = Context.getFileId();
-        // 获取文件信息
+    private Map<String,Object> getDbFileInfo(String userId,String fileId){
+        log.info("获取dbfileInfo");
+        Map<String,Object>result = new HashMap<>();
         WpsFile fileEntity = this.getById(fileId);
+        String permission = "write";
 
-        // 初始化文件读写权限为read
-        String permission = "read";
-
-        // 增加用户权限
-        WpsUserAcl userAclEntity = wpsUserAclService.findFirstByFileIdAndUserId(fileId,userId);
         UserAclBO userAcl = new UserAclBO();
-        if (userAclEntity != null){
-            BeanUtils.copyProperties(userAclEntity,userAcl);
-            permission = userAclEntity.getPermission();
-        }
-
         // 增加水印
         WpsFileWatermark watermarkEntity = wpsFileWatermarkService.findFirstByFileId(fileId);
         WatermarkBO watermark = new WatermarkBO();
         if (watermarkEntity != null){
             BeanUtils.copyProperties(watermarkEntity,watermark);
         }
-
         //获取user
-        WpsUser wpsUser = wpsUserService.getById(userId);
+        SysUser loginUser = sysUserService.getById(userId);
         UserDTO user = new UserDTO();
-        if (wpsUser != null){
-            BeanUtils.copyProperties(wpsUser,user);
+        if (loginUser != null){
+            user.setId(loginUser.getId());
+            user.setName(loginUser.getRealname());
             user.setPermission(permission);
         }
 
         // 构建fileInfo
         FileDTO file = new FileDTO();
         BeanUtils.copyProperties(fileEntity,file);
+        String url = fileEntity.getDownloadUrl();
+        url = URLEncoder.encode(url.replace(OSS_URL_PREFIX,""));
+        file.setDownload_url(OSS_URL_PREFIX+url);
         file.setUser_acl(userAcl);
         file.setWatermark(watermark);
-
-        return new HashMap<String, Object>(){
-            {
-                put("file", file);
-                put("user", user);
-            }
-        };
+        result.put("file",file);
+        result.put("user",user);
+        return result;
     }
 
     @Override
-    public void fileRename(String fileName, String userId){
-        String fileId = Context.getFileId();
+    public void fileRename(String fileName, String userId,String fileId){
         WpsFile file = this.getById(fileId);
         if (file != null){
             file.setName(fileName);
@@ -213,13 +202,10 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
         // 保存文件
         WpsFile f = new WpsFile(fileName,1,fileSize,userId,userId,dataTime,dataTime,fileUrl);
         this.save(f);
-
         // 处理权限
         wpsUserAclService.saveUserFileAcl(userId,f.getId());
-
         // 处理水印
         wpsFileWatermarkService.saveWatermark(f.getId());
-
         // 处理返回
         Map<String,Object> map = new HashMap<>();
         map.put("redirect_url",this.getViewUrl(f.getId(),userId,false).getWpsUrl());
@@ -276,13 +262,11 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
     }
 
     @Override
-    public Map<String,Object> fileSave(MultipartFile mFile,String userId){
+    public Map<String,Object> fileSave(MultipartFile mFile,String userId,String fileId){
         Date date = new Date();
         // 上传
         ResFileDTO resFileDTO = WpsOSSUtil.uploadMultipartFile(mFile);
         int size = (int) resFileDTO.getFileSize();
-
-        String fileId = Context.getFileId();
         WpsFile file = this.getById(fileId);
         FileDTO fileInfo = new FileDTO();
 
@@ -363,19 +347,18 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
     }
 
     @Override
-    public void uploadFile(MultipartFile file){
-        String uploadUserId = "3";
+    public void uploadFile(MultipartFile file,String userId){
         ResFileDTO resFileDTO = WpsOSSUtil.uploadMultipartFile(file);
         // 上传成功后,处理数据库记录值
         Date date = new Date();
         long dataTime = date.getTime();
         // 保存文件
         WpsFile f = new WpsFile(resFileDTO.getFileName(),1,((int) resFileDTO.getFileSize()),
-                uploadUserId,uploadUserId,dataTime,dataTime, resFileDTO.getFileUrl());
+                userId,userId,dataTime,dataTime, resFileDTO.getFileUrl());
         this.save(f);
 
         // 处理权限
-        wpsUserAclService.saveUserFileAcl(uploadUserId,f.getId());
+        wpsUserAclService.saveUserFileAcl(userId,f.getId());
 
         // 处理水印
         wpsFileWatermarkService.saveWatermark(f.getId());
@@ -383,10 +366,31 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
 
     @Override
     public String createTemplateFile(String template){
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         boolean typeTrue = FileUtil.checkCode(template);
         if (typeTrue){
-            return wpsUtil.getTemplateWpsUrl(template,"3");
+            return wpsUtil.getTemplateWpsUrl(template,sysUser.getId());
         }
         return "";
     }
+    @Autowired
+    private IProjectService projectService;
+    @Override
+    public Map<String, Object> bindProject(String fileId, Long projectId) {
+        Map<String,Object> result = new HashMap<>();
+        WpsFile wpsFile = this.getById(fileId);
+        if(null == wpsFile){
+            ResultMapUtils.setResultMap(result,StatusCode.CTOP_SCRIPT_FILE_NOT_EXIST);
+            return result;
+        }
+        Project project = projectService.getById(projectId);
+        if(null == project){
+            ResultMapUtils.setResultMap(result,StatusCode.CTOP_PROJECT_NOT_EXIST);
+            return result;
+        }
+        wpsFile.setProjectId(projectId);
+        this.updateById(wpsFile);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
 }

+ 10 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsUserServiceImpl.java

@@ -3,9 +3,12 @@ package org.jeecg.modules.wps.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.wps.mapper.WpsUserMapper;
 import org.jeecg.modules.wps.entity.WpsUser;
 import org.jeecg.modules.wps.service.IWpsUserService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -22,6 +25,8 @@ import java.util.Map;
 @Service
 public class WpsUserServiceImpl extends ServiceImpl<WpsUserMapper, WpsUser> implements IWpsUserService {
 
+    @Autowired
+    private ISysUserService sysUserService;
     @Override
     public Map<String,Object> userInfo(JSONObject reqObj){
         List<String> ids = null;
@@ -35,10 +40,12 @@ public class WpsUserServiceImpl extends ServiceImpl<WpsUserMapper, WpsUser> impl
         Map<String,Object> map = new HashMap<>();
         List<WpsUser> users = new ArrayList<>();
         if(ids != null && !ids.isEmpty()) {
-            WpsUser user;
             for (String id : ids) {
-                user = this.getById(id);
-                if (user != null){
+                SysUser getUser = sysUserService.getById(id);
+                if (getUser != null){
+                    WpsUser user = new WpsUser();
+                    user.setId(getUser.getId());
+                    user.setName(getUser.getRealname());
                     users.add(user);
                 }
             }

+ 8 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/WpsUtil.java

@@ -1,24 +1,21 @@
 package org.jeecg.modules.wps.util;
 
 import org.jeecg.modules.wps.util.file.FileUtil;
-import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.stereotype.Component;
 
 import java.util.HashMap;
 import java.util.Map;
 
 @Component
+@Configuration
 public class WpsUtil {
-    @Value("wps.domain")
-    private String domain;
-    @Value("wps.appid")
-    private String appid;
-    @Value("wps.appsecret")
-    private String appsecret;
-    @Value("wps.download_host")
-    private String downloadHost;
-    @Value("wps.local_Dir")
-    private String localDir;
+
+    public static final String domain = "https://wwo.wps.cn/office/";
+    public static final String appid = "aba9d3b0553f4eb4a69980b26927dc7a";
+    public static final String appsecret = "017d85f689d54d05a7a2ad2187f9e645";
+    public static final String downloadHost = "";
+    public static final String localDir = "";
     public String getWpsUrl(Map<String,String> values,String fileType,String fileId){
         String keyValueStr = SignatureUtil.getKeyValueStr(values);
         String signature = SignatureUtil.getSignature(values, appsecret);

+ 7 - 45
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/oss/WpsOSSUtil.java

@@ -9,7 +9,6 @@ import org.jeecg.modules.wps.util.file.FileType;
 import org.jeecg.modules.wps.util.file.FileTypeJudge;
 import org.jeecg.modules.wps.util.file.FileUtil;
 import org.jeecg.modules.wps.util.upload.ResFileDTO;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -22,62 +21,26 @@ import java.util.*;
 
 @Component
 public class WpsOSSUtil {
-    private static String fileUrlPrefix;
+    public static final String fileUrlPrefix = "https://ctop-media.oss-cn-beijing.aliyuncs.com/";
     /**
      * 阿里云API的bucket名称
      */
-    private static String bucketName;
-    private static String diskName;
-    private static String regionId;
+    public static final String bucketName = "ctop-media";
+    public static final String diskName = "script-lib/wps/";
+    public static final String regionId = "cn-bejing";
 
     /**
      * 阿里云API的内或外网域名
      */
-    private static String endpoint;
+    public static final String endpoint = "http://oss-cn-beijing.aliyuncs.com";
     /**
      * 阿里云API的密钥Access Key ID
      */
-    private static String accessKey;
+    public static final String accessKey = "LTAIbNbqWzSOklQV";
     /**
      * 阿里云API的密钥Access Key Secret
      */
-    private static String accessSecret;
-
-    @Value("${wps.oss.file_url_prefix}")
-    public static void setFileUrlPrefix(String fileUrlPrefix) {
-        WpsOSSUtil.fileUrlPrefix = fileUrlPrefix;
-    }
-
-    @Value("${wps.oss.disk_name}")
-    public static void setDiskName(String diskName) {
-        WpsOSSUtil.diskName = diskName;
-    }
-
-    @Value("${wps.oss.region_Id}")
-    public static void setRegionId(String regionId) {
-        WpsOSSUtil.regionId = regionId;
-    }
-
-    @Value("${wps.oss.bucket_name}")
-    public void setBucketName(String bucketName) {
-        WpsOSSUtil.bucketName = bucketName;
-    }
-
-    @Value("${wps.oss.access_key}")
-    public void setAccessKey(String accessKey) {
-        WpsOSSUtil.accessKey = accessKey;
-    }
-
-    @Value("${wps.oss.access_secret}")
-    public void setAccessSecret(String accessSecret) {
-        WpsOSSUtil.accessSecret = accessSecret;
-    }
-
-    @Value("${wps.oss.endpoint}")
-    public void setEndpoint(String endpoint) {
-        WpsOSSUtil.endpoint = endpoint;
-    }
-
+    public static final String accessSecret = "1rkPz7JNoXk8sJevPaeYHWqfkQXBGh";
 
     private static OSSClient getOSSClient(){
         return new OSSClient(endpoint,accessKey, accessSecret);
@@ -284,7 +247,6 @@ public class WpsOSSUtil {
             OSSClient client =  getOSSClient();
             InputStream is = new FileInputStream(file);
             String fileName = file.getName();
-            long fileSize = file.length();
             //创建上传Object的Metadata
             ObjectMetadata metadata = new ObjectMetadata();
             metadata.setContentLength(is.available());

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

@@ -1,5 +1,5 @@
 server:
-  port: 8804
+  port: 8080
   ip: 39.97.120.42
   servlet:
     context-path: /jeecg-boot

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

@@ -1,8 +1,7 @@
 server:
   port: 8088
-  ip: 39.106.184.70
   servlet:
-    context-path: /jeecg-boot
+    context-path: /
     compression:
       enabled: true
       mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
@@ -30,8 +29,6 @@ spring:
             enable: true
             required: true
   ## quartz定时任务,采用数据库方式
-  quartz:
-    job-store-type: jdbc
   #json 时间戳统一转换
   jackson:
     date-format:   yyyy-MM-dd HH:mm:ss
@@ -108,7 +105,7 @@ spring:
   #redis 配置
   redis:
     database: 0
-    host: 127.0.0.1
+    host: 172.30.0.17
     lettuce:
       pool:
         max-active: 8   #最大连接数据库连接数,设 0 为没有限制

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

@@ -1,5 +1,5 @@
 server:
-  port: 8081
+  port: 8088
   ip: 39.97.120.42
   servlet:
     context-path: /jeecg-boot
@@ -95,7 +95,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://39.97.120.42:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
           password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver

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

@@ -14,18 +14,3 @@ swagger:
     enable: true
     username: jeecg
     password: jeecg1314
-
-wps:
-  domain: https://wwo.wps.cn/office/
-  appid: AK20200318KOAZAO
-  appsecret: 1114ea897ee04c644e3d886c1578562b
-  download_host:
-  local_dir:
-  oss:
-    file_url_prefix: https://ctop-media.oss-cn-beijing.aliyuncs.com/
-    bucket_name: ctop-media
-    disk_name:  script-lib/wps/
-    region_id: cn-bejing
-    endpoint: http://oss-cn-beijing.aliyuncs.com
-    access_key: LTAIbNbqWzSOklQV
-    access_secret: 1rkPz7JNoXk8sJevPaeYHWqfkQXBGh

+ 10 - 50
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -2,10 +2,11 @@ package org.jeecg;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
@@ -15,8 +16,6 @@ import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -29,7 +28,6 @@ import org.springframework.test.context.junit4.SpringRunner;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -46,55 +44,17 @@ public class SampleTest {
     private ICtopOauthTokenService oauthTokenService;
     @Autowired
     private IReportService reportService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
     @Test
     public void testOceanEngineJob() {
-        try {
-            String url = "https://ad.e.kuaishou.com/rest/openapi/v1/tool/key_frame";
-            JSONArray ptotoArr = new JSONArray();
-            ptotoArr.add("5188991225263567823");
-
-            Map<String, String> headers = new HashMap<>();
-            headers.put("Access-Token", "e251db4aa139eb36623818581003bcec");
-            headers.put("Content-Type", "application/json");
-            JSONObject requestJson = new JSONObject();
-            requestJson.put("advertiser_id", 161468);
-            requestJson.put("photo_ids", ptotoArr);
-            //  requestJson.put("type", type);
-            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
-            System.err.println(result);
-            //     CtopOauthToken byId = oauthTokenService.getById(1654059015242756L);
-
-          /*  SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            Date start = simpleDateFormat.parse("2020-01-01");
-            Date end = simpleDateFormat.parse("2020-06-03");*/
-
-
-            /*String nowDate = "2020-06-03";
-            String endDate = "2020-01-01";
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            Date start = simpleDateFormat.parse(nowDate);
-            Date end = simpleDateFormat.parse(endDate);
-            List<Date> dates = DateUtils.findDates(end, start);
-            for (int i = 0; i < dates.size(); i++) {
-                String formatDate = simpleDateFormat.format(dates.get(i));
-                Date parse = simpleDateFormat.parse(formatDate);
-                reportService.getAdvertiserReport(byId, parse, parse, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            }*/
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        String account = "3248395570@qq.com";
-       /* String password = "Ydxq-704127411";
-        oceanEngineService.login(account,password);
-        oceanEngineService.douyinHotHandler(1,1);
-        oceanEngineService.effectCaseHandler(1);
-        oceanEngineService.hotMaterialHandler(1,4,"抖音");
-        oceanEngineService.hotMaterialHandler(1,8,"头条");
-        oceanEngineService.hotMaterialHandler(1,1,"西瓜");
-        oceanEngineService.hotMaterialHandler(1,3,"火山");
-        oceanEngineService.hotMaterialHandler(1,9,"穿山甲");
-        log.info("巨量创意抓取完成");*/
+       List<UserAllocation>tokens = userAllocationService.getByProjectId(107L,null);
+       Date startDate = DateUtils.getDate();
+       tokens.forEach(token -> {
+           CtopOauthToken getToken  = oauthTokenService.getTokenByAccountId(token.getAccountId());
+           reportService.getAdvertiserReport(getToken,startDate,startDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+       });
     }
 
     @Autowired

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

@@ -31,4 +31,6 @@ public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
     CtopOauthToken getAccessTokenByAccountIdAndMediaId(Integer mediaId, Long accountId);
 
     List<CtopOauthToken> getToutiaoTokenByCreateTime(String createTime);
+
+    List<CtopOauthToken> getByProjectId(long projectId);
 }

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

@@ -212,5 +212,12 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         calendar.add(Calendar.SECOND, seconds);
         return calendar.getTime();
     }
+    @Override
+    public List<CtopOauthToken> getByProjectId(long projectId) {
+        QueryWrapper<CtopOauthToken>queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("project_id",projectId).eq("account_status",0);
+        return this.list(queryWrapper);
+    }
+
 
 }

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

@@ -35,6 +35,8 @@ public enum StatusCode {
     FILE_HAS_UPLOAD("文件已经上传过", 0, false),
     COMMON_SERVER_ERROR("服务器内部错误", -102, false),
     CTOP_HAS_NO_PERFORMANCE_STATISTIC_LOGIC("绩效统计逻辑尚未确定", -103, false),
+    CTOP_SCRIPT_FILE_NOT_EXIST("脚本文件不存在", -104, false),
+    CTOP_PROJECT_NOT_EXIST("项目不存在", -105, false),
     KUAISHOU_CRAWLER_APP_EXIT("快手app异常退出", -1001, false),
     KUAISHOU_CRAWLER_APP_ELEMENT_ERROR("快手元素异常", -1002, false),
     KUAISHOU_CRAWLER_APP_ELEMENT_IS_NULL("此快手元素获取不到", -1003, false),

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

@@ -77,6 +77,28 @@ public class StringUtils {
         return sb.toString();
     }
 
+    //中文转Unicode
+    public static String cnToUnicode(String cn) {
+        char[] chars = cn.toCharArray();
+        String returnStr = "";
+        for (int i = 0; i < chars.length; i++) {
+            returnStr += "\\u" + Integer.toString(chars[i], 16);
+        }
+        return returnStr;
+    }
+
+    //Unicode转中文方法
+    public static String unicodeToCn(String unicode) {
+        /** 以 \ u 分割,因为java注释也能识别unicode,因此中间加了一个空格*/
+        String[] strs = unicode.split("\\\\u");
+        String returnStr = "";
+        // 由于unicode字符串以 \ u 开头,因此分割出的第一个字符是""。
+        for (int i = 1; i < strs.length; i++) {
+            returnStr += (char) Integer.valueOf(strs[i], 16).intValue();
+        }
+        return returnStr;
+    }
+
     public static String replaceBlank(String str) {
         String dest = "";
         if (str!=null) {

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -631,6 +631,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 
     @Override
     public void getkuaishouWebLoginCookie(BindAccountLogin login){
+        System.setProperty("webdriver.chrome.driver", chromeDriver);
 
         ChromeDriverService service = new ChromeDriverService.Builder().usingDriverExecutable(new File(chromeDriver)).usingAnyFreePort().build();
         try {