Przeglądaj źródła

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

hcst_sunzhen 5 lat temu
rodzic
commit
0991b37c21
100 zmienionych plików z 2388 dodań i 1038 usunięć
  1. 6 0
      jeecg-boot-module-system/pom.xml
  2. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  3. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  4. 1 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  5. 157 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CorpFeishuUserController.java
  6. 10 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  7. 170 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PropController.java
  8. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SalePerformanceDetailController.java
  9. 133 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  10. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  11. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/YardController.java
  12. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountBidJob.java
  13. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java
  14. 41 34
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyMaterialReportRetryJob.java
  15. 40 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportYeterdayLoadJob.java
  16. 2 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouMaterialsLoadJob.java
  17. 0 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/SalePerformanceDetailMapper.java
  18. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  19. 1 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBidWarningService.java
  20. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICpaBidWarningService.java
  21. 0 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ISalePerformanceDetailService.java
  22. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/AdvertiserServiceImpl.java
  23. 50 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BidWarningServiceImpl.java
  24. 51 25
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CpaBidWarningServiceImpl.java
  25. 7 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CrawlerServiceImpl.java
  26. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreativeTitleServiceImpl.java
  27. 1 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/KuaiShouDefectMaterialServiceImpl.java
  28. 3 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/KuaiShouUploadServiceImpl.java
  29. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/PerformanceSaleServiceImpl.java
  30. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  31. 0 19
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/SalePerformanceDetailServiceImpl.java
  32. 29 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/controller/PerformanceShowCtrl.java
  33. 63 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/entity/DesignDetail.java
  34. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/SalePerformanceDetail.java
  35. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/CalculatePerformanceMapper.java
  36. 8 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/DesignDetailMapper.java
  37. 22 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/SalePerformanceDetailMapper.java
  38. 59 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/CalculatePerformanceMapper.xml
  39. 29 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/DesignDetailMapper.xml
  40. 17 29
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/OperateDetailMapper.xml
  41. 28 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/SalePerformanceDetailMapper.xml
  42. 0 28
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/DesignDetailServiceImpl.java
  43. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/ICalculatePerformanceService.java
  44. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/IDesignDetailService.java
  45. 23 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/ISalePerformanceDetailService.java
  46. 49 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/CalculatePerformanceServiceImpl.java
  47. 82 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/DesignDetailServiceImpl.java
  48. 230 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/SalePerformanceDetailServiceImpl.java
  49. 22 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/testCtrl.java
  50. 89 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
  51. 12 18
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/FileCallBackController.java
  52. 13 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/UserCallBackController.java
  53. 0 25
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/UserImplController.java
  54. 49 85
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileController.java
  55. 3 87
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileVersionController.java
  56. 2 86
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileWatermarkController.java
  57. 3 87
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsUserAclController.java
  58. 3 87
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsUserController.java
  59. 16 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileDTO.java
  60. 16 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserAclBO.java
  61. 14 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserDTO.java
  62. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFile.java
  63. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFileVersion.java
  64. 6 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsUser.java
  65. 11 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsUserAcl.java
  66. 7 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/IWpsFileService.java
  67. 66 58
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsFileServiceImpl.java
  68. 10 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsUserServiceImpl.java
  69. 9 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/WpsUtil.java
  70. 11 60
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/oss/WpsOSSUtil.java
  71. 3 3
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  72. 168 0
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  73. 1 4
      jeecg-boot-module-system/src/main/resources/application-test.yml
  74. 6 5
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  75. 0 15
      jeecg-boot-module-system/src/main/resources/application.yml
  76. 5 3
      jeecg-boot-module-system/src/main/resources/quartz.properties
  77. 10 71
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  78. 123 0
      module-callback/pom.xml
  79. 23 0
      module-callback/src/main/java/cn/com/ctop/callback/StartApplication.java
  80. 29 0
      module-callback/src/main/java/cn/com/ctop/callback/config/XxlMqConf.java
  81. 28 0
      module-callback/src/main/java/cn/com/ctop/callback/controller/CallbackController.java
  82. 13 0
      module-callback/src/main/resources/application-dev.yml
  83. 13 0
      module-callback/src/main/resources/application-prod.yml
  84. 13 0
      module-callback/src/main/resources/application-test.yml
  85. 7 0
      module-callback/src/main/resources/application.yml
  86. 29 0
      module-callback/src/main/resources/logback-dev.xml
  87. 29 0
      module-callback/src/main/resources/logback-prod.xml
  88. 29 0
      module-callback/src/main/resources/logback-test.xml
  89. 20 0
      module-callback/src/test/java/org/jeecgframework/boot/AppTest.java
  90. 5 0
      module-common/pom.xml
  91. 0 6
      module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java
  92. 72 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/CorpFeishuUser.java
  93. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileType.java
  94. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileTypeJudge.java
  95. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileUtil.java
  96. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/CorpFeishuUserMapper.java
  97. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CorpFeishuUserMapper.xml
  98. 17 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICorpFeishuUserService.java
  99. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  100. 0 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java

+ 6 - 0
jeecg-boot-module-system/pom.xml

@@ -232,6 +232,12 @@
             </properties>
         </profile>
         <profile>
+            <id>prod2</id>
+            <properties>
+                <activatedProperties>prod2</activatedProperties>
+            </properties>
+        </profile>
+        <profile>
             <id>wps</id>
             <properties>
                 <activatedProperties>wps</activatedProperties>

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -131,6 +131,7 @@ public class ShiroConfig {
 
         filterChainDefinitionMap.put("/system/userCompany/**", "anon");
         filterChainDefinitionMap.put("/qywexin", "anon");
+        filterChainDefinitionMap.put("/sys/feishu/**", "anon");
         filterChainDefinitionMap.put("/test/getGroupData/**", "anon");
         filterChainDefinitionMap.put("/test/getVideoAndImage/**", "anon");
         filterChainDefinitionMap.put("/test/gerCreative/**", "anon");

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

@@ -385,7 +385,7 @@ public class AdvertiserController {
                 }
             }
         }
-        List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
+        List<UserAllocation> allocations = userAllocationService.getByParams(projectId, systemType,null);
         if (null != allocations && !allocations.isEmpty()) {
             for (UserAllocation allocation : allocations) {
                 SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
@@ -420,7 +420,7 @@ public class AdvertiserController {
                 }
             }
         }
-        List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
+        List<UserAllocation> allocations = userAllocationService.getByParams(projectId, systemType,null);
         if (null != allocations && !allocations.isEmpty()) {
             for (UserAllocation allocation : allocations) {
                 SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());

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

@@ -62,8 +62,6 @@ public class CallbackController {
     @Autowired
     private IReportService reportService;
 
-
-
     @GetMapping("/qywexin")
     public void qywexin(HttpServletRequest request,
                         HttpServletResponse response,
@@ -322,8 +320,6 @@ public class CallbackController {
                 userAllocationQueryWrapper.eq("media_id", 1);
                 userAllocationQueryWrapper.orderByDesc("create_time");
                 userAllocationQueryWrapper.last("limit 1");
-
-
                 UserAllocation checkUserAllocation = allocationMapper.selectOne(userAllocationQueryWrapper);
                 if (!Check.isNull(checkUserAllocation)) {
                     text.append("accountId:" + accountId + ",授权名称为:" + (String) advertiserDataMap.get("name") + ",绑定失败,失败原因:已被" + checkUserAllocation.getUserName() + "绑定。")
@@ -347,11 +343,6 @@ public class CallbackController {
                 userAllocation.setWarningAmount(warningAmount);
                 userAllocation.setCreateTime(new Date());
                 userAllocation.setUpdateTime(new Date());
-                allocationMapper.deleteById(userAllocation.getId());
-                Map<String, Object> deleteUserMap = new HashMap<>();
-                deleteUserMap.put("advertiser_id", advertiserId);
-                deleteUserMap.put("account_id", token.getAccountId());
-                allocationMapper.deleteByMap(deleteUserMap);
                 int j = allocationMapper.insert(userAllocation);
                 if (j > 0) {
                     log.info("同步分配用户表完成,task_id:{},accountId:{}", state, token.getAccountId());
@@ -362,7 +353,7 @@ public class CallbackController {
             }
 
             returnMap.put("code", 0);
-            returnMap.put("desc", text);
+            returnMap.put("desc", text.toString());
 
         } catch (Exception e) {
             e.printStackTrace();
@@ -373,6 +364,4 @@ public class CallbackController {
     }
 
 
-
-
 }

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

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

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

@@ -165,6 +165,8 @@ public class MaterialInfoController {
                                                      HttpServletRequest req) {
 
         Result<IPage<MaterialInfo>> result = new Result<>();
+        String materialName = materialInfo.getMaterialName();
+        materialInfo.setMaterialName(null);
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
@@ -201,6 +203,10 @@ public class MaterialInfoController {
                 }
             }
         }
+        if (!Check.isNull(materialName)) {
+            queryWrapper.like("material_name", materialName);
+
+        }
         Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
         IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
         List<MaterialInfo> materialInfoList = pageList.getRecords();
@@ -401,6 +407,9 @@ public class MaterialInfoController {
                 Project project = projectService.getById(materialInfoEntity.getProjectId());
                 String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
                 sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+
+                String feishuText = messageTemplate.getFeishuMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+                sendMessageService.sendFeishuMessage(materialInfoEntity.getUserId(), feishuText);
             }
         }
 
@@ -494,7 +503,7 @@ public class MaterialInfoController {
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
         Long projectId = materialInfo.getProjectId();
-        if(projectId != null){
+        if (projectId != null) {
             queryWrapper.eq("project_id", projectId);
         }
         queryWrapper.in("code", effiList);

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

@@ -0,0 +1,170 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.manage.modules.actor.entity.*;
+import cn.com.ctop.manage.modules.actor.service.*;
+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.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author jeecg-boot
+ */
+@RestController
+@Slf4j
+@RequestMapping("/ctop/prop")
+public class PropController {
+    @Autowired
+    private IPropService propService;
+    @Autowired
+    private IPropPhotoService propPhotoService;
+
+    @ResponseBody
+    @GetMapping("/detail")
+    public Result<Prop> getDetail(@RequestParam(name = "propId") Long propId) {
+        Result<Prop> result = new Result<>();
+        Prop prop = propService.getById(propId);
+        result.setResult(prop);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     * 分页列表查询
+     *
+     * @param prop
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @GetMapping(value = "/list")
+    public Result<IPage<Prop>> queryPageList(Prop prop,
+                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                              HttpServletRequest req) {
+        Result<IPage<Prop>> result = new Result<>();
+        QueryWrapper<Prop> queryWrapper = QueryGenerator.initQueryWrapper(prop, req.getParameterMap());
+        Page<Prop> page = new Page<>(pageNo, pageSize);
+        IPage<Prop> pageList = propService.page(page, queryWrapper);
+
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    @GetMapping(value = "/photo/list")
+    public Result<IPage<PropPhoto>> queryPhotoPageList(PropPhoto propPhoto,
+                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                        HttpServletRequest req) {
+        Result<IPage<PropPhoto>> result = new Result<>();
+
+        QueryWrapper<PropPhoto> queryWrapper = QueryGenerator.initQueryWrapper(propPhoto, req.getParameterMap());
+        Page<PropPhoto> page = new Page<>(pageNo, pageSize);
+        IPage<PropPhoto> pageList = propPhotoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    @DeleteMapping(value = "/photo/delete")
+    public Result<PropPhoto> deletePhoto(@RequestParam(name = "id", required = true) String id) {
+        Result<PropPhoto> result = new Result<>();
+        PropPhoto propPhoto = propPhotoService.getById(id);
+        if (propPhoto == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = propPhotoService.removeById(id);
+            if (ok) {
+                result.success("删除成功!");
+            }
+        }
+        return result;
+    }
+
+    @PostMapping(value = "/photo/add")
+    public Result<PropPhoto> addPhoto(PropPhoto propPhoto) {
+        Result<PropPhoto> result = new Result<>();
+        try {
+            String photoUrl = propPhoto.getPhotoUrl();
+            if (!Check.isNull(photoUrl) && !photoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                propPhoto.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + photoUrl);
+            }
+            propPhotoService.save(propPhoto);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param prop
+     * @return
+     */
+    @PostMapping(value = "/add")
+    public Result<Prop> add(@RequestBody Prop prop) {
+        Result<Prop> result = new Result<>();
+        try {
+            String coverUrl = prop.getCoverUrl();
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                prop.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
+            }
+            propService.save(prop);
+            if (null != prop.getImageList() && !prop.getImageList().isEmpty()) {
+                for (String url : prop.getImageList()) {
+                    PropPhoto photo = new PropPhoto();
+                    photo.setPropId(prop.getId());
+                    if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                        photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
+                    }
+                    propPhotoService.save(photo);
+                }
+            }
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param prop
+     * @return
+     */
+    @PutMapping(value = "/edit")
+    public Result<Prop> edit(@RequestBody Prop prop) {
+        Result<Prop> result = new Result<>();
+
+        Prop propEntity = propService.getById(prop.getId());
+        if (propEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            String coverUrl = prop.getCoverUrl();
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                prop.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
+            }
+
+            boolean ok = propService.updateById(prop);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+        return result;
+    }
+}

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

@@ -11,8 +11,8 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.ctop.entity.SalePerformanceDetail;
-import org.jeecg.modules.ctop.service.ISalePerformanceDetailService;
+import org.jeecg.modules.performance.entity.SalePerformanceDetail;
+import org.jeecg.modules.performance.service.ISalePerformanceDetailService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;

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

@@ -7,10 +7,8 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanDailyReportService;
@@ -62,6 +60,9 @@ public class TestController {
     private IMaterialImageInfoService iMaterialImageInfoService;
     @Autowired
     private IBytedanceReportService bytedanceReportService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    static ExecutorService videoService = Executors.newFixedThreadPool(5);
+    static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
 
     @GetMapping(value = "/t")
     public String test() {
@@ -94,6 +95,76 @@ public class TestController {
 
     @Autowired
     private IMaterialCutFrameService cutFrameService;
+    @Autowired
+    IKuaiShouVideoGetService videoGetService;
+    @Autowired
+    private IKuaiShouVideoTimeService timeService;
+
+
+    @GetMapping(value = "/getVideoTime")
+    public void getVideoTime() throws InterruptedException {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                QueryWrapper<KuaiShouVideoGet> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("channel_type", 0);
+                List<KuaiShouVideoGet> list = videoGetService.list(queryWrapper);
+                for (KuaiShouVideoGet video : list) {
+                    videoService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            Date date = timeService.getVideoTime(video.getPhotoId(), video.getAccountId());
+                            if (!Check.isNull(date)) {
+                                video.setUploadDate(date);
+                                videoGetService.updateById(video);
+                            }
+
+                            try {
+                                Thread.sleep(1000);
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+                }
+            }
+        };
+        thread.start();
+
+    }
+
+
+    @GetMapping(value = "/getSuZhao")
+    public void getSuZhao() throws InterruptedException {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                QueryWrapper<KuaiShouVideoGet> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("channel_type", 1);
+                List<KuaiShouVideoGet> list = videoGetService.list(queryWrapper);
+                for (KuaiShouVideoGet video : list) {
+                    suzhaoService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            Date date = timeService.getVideoTime(video.getPhotoId(), video.getAccountId());
+                            if (!Check.isNull(date)) {
+                                video.setUploadDate(date);
+                                videoGetService.updateById(video);
+                            }
+
+                            try {
+                                Thread.sleep(1000);
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+                }
+            }
+        };
+        thread.start();
+
+    }
 
 
     @GetMapping(value = "/getAccountList")
@@ -139,12 +210,9 @@ public class TestController {
 
         try {
 
-
             Thread thread = new Thread() {
                 @Override
                 public void run() {
-
-
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
                     tokenQueryWrapper.eq("media_id", 2);
                     List<CtopOauthToken> list = tokenService.list(tokenQueryWrapper);
@@ -155,10 +223,20 @@ public class TestController {
                             @Override
                             public void run() {
                                 try {
-                                    //获取全量视频素材数据
-                                    kuaishouInterfaceService.getVideoList(token, null, null);
-                                    // 获取图片信息数据
-                                    //   kuaishouInterfaceService.getImageList(token, startDate, endDate);
+                                    kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1);
+                                    String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                                    String videoEndDate = DateUtils.addDay(nowDate, -180);
+                                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                                    Date end = simpleDateFormat.parse(nowDate);
+                                    Date start = simpleDateFormat.parse(videoEndDate);
+                                    List<Date> dates = DateUtils.findDates(start, end);
+                                    for (int i = 0; i < dates.size(); i++) {
+                                        String formatDate = simpleDateFormat.format(dates.get(i));
+                                        kuaishouInterfaceService.getVideoList(token, formatDate);
+                                        kuaishouInterfaceService.getImageList(token, formatDate);
+                                        Thread.sleep(500);
+                                    }
+
                                 } catch (Exception e) {
                                     e.printStackTrace();
                                 } finally {
@@ -176,6 +254,50 @@ public class TestController {
         return "Success";
     }
 
+
+    @GetMapping(value = "/getVideoByAccountId")
+    public String getVideoByAccountId(Long accountId) throws IOException {
+
+        try {
+
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+                    tokenQueryWrapper.eq("media_id", 2);
+                    tokenQueryWrapper.eq("account_id", accountId);
+                    CtopOauthToken one = tokenService.getOne(tokenQueryWrapper);
+                    try {
+                        kuaishouInterfaceService.getSuZaoList(one.getAccessToken(), one.getAccountId(), 1);
+                        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                        String videoEndDate = DateUtils.addDay(nowDate, -180);
+                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                        Date end = simpleDateFormat.parse(nowDate);
+                        Date start = simpleDateFormat.parse(videoEndDate);
+                        List<Date> dates = DateUtils.findDates(start, end);
+                        for (int i = 0; i < dates.size(); i++) {
+                            String formatDate = simpleDateFormat.format(dates.get(i));
+                            kuaishouInterfaceService.getVideoList(one, formatDate);
+                            kuaishouInterfaceService.getImageList(one, formatDate);
+                            Thread.sleep(100);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                    }
+
+
+                    log.info("快手物料数据同步完成");
+                }
+            };
+            thread.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "Success";
+    }
+
+
     @GetMapping(value = "/createCutTask")
     public String createCutTask(String startDate, String endDate) throws IOException {
 
@@ -398,8 +520,6 @@ public class TestController {
         return "Success";
     }
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(10);
-
 
     @GetMapping(value = "/gerCreative")
     public void gerCreative() {

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

@@ -362,7 +362,7 @@ public class UserAllocationController {
     public Result<List<UserAllocation>> selectAccountListByProjectId(Long projectId) {
         Result<List<UserAllocation>> result = new Result<>();
         try {
-            List<UserAllocation> userAllocations = userAllocationService.selectAccountListByProjectId(projectId);
+            List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
             result.setSuccess(true);
             result.setResult(userAllocations);
         } catch (Exception e) {

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

@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.File;
 
 /**
  * @author yumeng

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

@@ -21,6 +21,6 @@ public class AccountBidJob implements Job {
      */
     @Override
     public void execute(JobExecutionContext jobExecutionContext) {
-        bidWarningService.BidWarning();
+        bidWarningService.bidWarning();
     }
 }

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

@@ -48,7 +48,7 @@ public class AccountCpaBidJob implements Job {
                         executorService.submit(new Runnable() {
                             @Override
                             public void run() {
-                                cpaBidWarningService.CpaBidWarning(project);
+                                cpaBidWarningService.cpaBidWarning(project);
                             }
 
                         });

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

@@ -33,43 +33,50 @@ public class BytedanceDailyMaterialReportRetryJob implements Job {
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         log.info("头条素材报表重试定时任务开始");
-        List<BytedanceReportMaterialRetry> retryList = bytedanceReportService.getRetryList();
-        //
-        //多线程
-        final ExecutorService executorService = Executors.newFixedThreadPool(3);
-        retryList.forEach(retry -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        String startDate = retry.getStartDate();
-                        String endDate = retry.getEndDate();
-                        Long accountId = retry.getAccountId();
-                        Integer type = retry.getType();
-                        CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
-                        log.info("头条素材报表重试定时任务,当前accountId为:" + token.getAccountId());
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
 
-                        Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
-                        String start = null;
-                        String end = null;
-                        for (int i = 0; i <= days; i++) {
-                            start = DateUtils.addDay(startDate, i);
-                            end = start;
-                            //获取头条素材报表数据
-                            int code = bytedanceReportService.bytedanceMaterialReportRetry(type, token, start, end);
-                            if(code ==200 || code == 1){
-                                if(type == 1){
-                                    //重试成功清洗数据
-                                    byteDanceVideoReportDailyService.videoInfoListByAccountId(start,end,accountId);
+                List<BytedanceReportMaterialRetry> retryList = bytedanceReportService.getRetryList();
+                //
+                //多线程
+                final ExecutorService executorService = Executors.newFixedThreadPool(3);
+                retryList.forEach(retry -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                String startDate = retry.getStartDate();
+                                String endDate = retry.getEndDate();
+                                Long accountId = retry.getAccountId();
+                                Integer type = retry.getType();
+                                CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
+                                log.info("头条素材报表重试定时任务,当前accountId为:" + token.getAccountId());
+                                Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
+                                String start = null;
+                                String end = null;
+                                for (int i = 0; i <= days; i++) {
+                                    start = DateUtils.addDay(startDate, i);
+                                    end = start;
+                                    //获取头条素材报表数据
+                                    int code = bytedanceReportService.bytedanceMaterialReportRetry(type, token, start, end);
+                                    if (code == 200 || code == 1) {
+                                        if (type == 1) {
+                                            //重试成功清洗数据
+                                            byteDanceVideoReportDailyService.videoInfoListByAccountId(start, end, accountId);
+                                        }
+                                    }
                                 }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
                             }
                         }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                    }
-                }
-            });
-        });
+                    });
+                });
+            }
+        };
+        thread.start();
+
     }
 }

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

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

@@ -2,7 +2,6 @@ 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.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -43,9 +42,9 @@ public class KuaishouMaterialsLoadJob implements Job {
                             try {
 
                                 //获取全量视频素材数据
-                                kuaishouInterfaceService.getVideoList(token, startDate, endDate);
+                                kuaishouInterfaceService.getVideoList(token, DateUtils.getNowDate("yyyy-MM-dd"));
                                 // 获取图片信息数据
-                                kuaishouInterfaceService.getImageList(token, startDate, endDate);
+                                kuaishouInterfaceService.getImageList(token, DateUtils.getNowDate("yyyy-MM-dd"));
                             } catch (Exception e) {
                                 e.printStackTrace();
                             } finally {

+ 0 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/SalePerformanceDetailMapper.java

@@ -1,15 +0,0 @@
-package org.jeecg.modules.ctop.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.jeecg.modules.ctop.entity.SalePerformanceDetail;
-
-/**
- * 销售绩效详细信息
- *
- * @author: jeecg-boot
- * @date: 2020-04-01
- * @cersion: V1.0
- */
-public interface SalePerformanceDetailMapper extends BaseMapper<SalePerformanceDetail> {
-
-}

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

@@ -107,7 +107,7 @@
 
     <select id="queryProjectMemberByUserId" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
-        distinct b.id as projectId,
+        distinct b.project_id as projectId,
         b.project_name as projectName,
         a.advertiser_id as advertiserId,
         a.advertiser_name as advertiserName,

+ 1 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBidWarningService.java

@@ -1,7 +1,5 @@
 package org.jeecg.modules.ctop.service;
 
 public interface IBidWarningService {
-    void BidWarning();
-
-
+    void bidWarning();
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICpaBidWarningService.java

@@ -3,7 +3,7 @@ package org.jeecg.modules.ctop.service;
 import org.jeecg.modules.ctop.entity.Project;
 
 public interface ICpaBidWarningService {
-    void CpaBidWarning(Project project);
+    void cpaBidWarning(Project project);
 
 
 }

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

@@ -1,15 +0,0 @@
-package org.jeecg.modules.ctop.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.SalePerformanceDetail;
-
-/**
- * 销售绩效详细信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-04-01
- */
-public interface ISalePerformanceDetailService extends IService<SalePerformanceDetail> {
-
-}

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/AdvertiserServiceImpl.java

@@ -114,7 +114,7 @@ public class AdvertiserServiceImpl extends ServiceImpl<AdvertiserMapper, Adverti
 
     private List<YdPlanAggregateEntity> getYdPlanStatisticInfo(Long projectId, String startDate, String endDate) {
         List<YdPlanAggregateEntity> result = new ArrayList<>();
-        List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, null);
+        List<UserAllocation> allocations = userAllocationService.getByParams(projectId, null,null);
         if (null != allocations && !allocations.isEmpty()) {
             allocations.forEach(allocation -> {
                 List<YdPlanAggregateEntity> plans = statisticWeekInfoByAccount(allocation, startDate, endDate);

+ 50 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BidWarningServiceImpl.java

@@ -3,14 +3,17 @@ package org.jeecg.modules.ctop.service.impl;
 import cn.com.ctop.common.module.entity.MailLog;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
-import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.service.ICorpFeishuUserService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import cn.com.ctop.common.module.utils.SendMailUtil;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
+import cn.com.feishu.provider.MessageProvider;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -35,7 +38,7 @@ public class BidWarningServiceImpl implements IBidWarningService {
     @Autowired
     private ProjectMapper projectMapper;
     @Autowired
-    private UserAllocationMapper userAllocationMapper;
+    private IUserAllocationService userAllocationService;
     @Autowired
     private KuaiShouGroupMapper groupMapper;
     @Autowired
@@ -49,7 +52,7 @@ public class BidWarningServiceImpl implements IBidWarningService {
      */
 
     @Override
-    public void BidWarning() {
+    public void bidWarning() {
         log.info("开始出价预警定时任务");
         long l = System.currentTimeMillis();
         try {
@@ -62,7 +65,7 @@ public class BidWarningServiceImpl implements IBidWarningService {
                     }
                     Long maxBid = project.getMaxBid();
                     Long projectId = project.getId();
-                    List<UserAllocation> userAllocations = getUserAllocationsByProjectId(projectId);
+                    List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
                     if (!Check.isNull(userAllocations)) {
                         for (UserAllocation userAllocation : userAllocations) {
                             if (userAllocation.getAccountStatus() == 1) {
@@ -80,6 +83,7 @@ public class BidWarningServiceImpl implements IBidWarningService {
 
                             if (!Check.isNull(unitWarning)) {
                                 sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
+                                sendFeishumessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
                             }
                         }
                     }
@@ -93,24 +97,59 @@ public class BidWarningServiceImpl implements IBidWarningService {
 
 
     }
+    private void sendFeishumessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) throws Exception {
+        String createTime = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, Integer.getInteger(mediaId));
+        StringBuilder text = new StringBuilder();
+        String s = "";
+        for (int i = 0; i < unitWarning.size(); i++) {
+            s += unitWarning.get(i) + "," + "\n\r";
+
+        }
+        text.append("项目出价预警").append("\n\r").append("您的项目:").append(projectName + ",").append("\n\r")
+                .append("授权名称为:" + authName + " 下的,").append("\n\r").append(s)
+                .append("大于项目设置的最高出价:").append(maxBid / 1000).append(" 元! 请您及时调整。");
+        if (count < 3) {
+            List<String> mailList = mailLogMapper.selectMailList(projectId);
+            String subject;
+            if ("1".equals(mediaId)) {
+                subject = "头条-广告计划出价预警";
+
+            } else {
+                subject = "快手-广告组出价预警";
+            }
+            try {
+                SendMailUtil.sendMail(mailList, subject, text.toString());
+                MailLog mailLog = new MailLog();
+                mailLog.setAccountId(accountId);
+                mailLog.setMailType(1);
+                mailLog.setContent(text.toString());
+                mailLog.setSendEmil(JSON.toJSONString(mailList));
+                mailLog.setSubject(subject);
+                mailLogMapper.insert(mailLog);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
 
-    private List<UserAllocation> getUserAllocationsByProjectId(Long projectId) {
-        QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
-        userAllocationQueryWrapper.eq("project_id", projectId);
-        List<UserAllocation> userAllocations = userAllocationMapper.selectList(userAllocationQueryWrapper);
-        return userAllocations;
+        JSONArray openIds = corpFeishuUserService.getOpenIdByParams(projectId);
+        if(null == openIds||openIds.isEmpty()){
+            log.error("该项目下运营飞书账号尚未绑定邮箱=>projectId:{}",projectId);
+            return;
+        }
+        MessageProvider.batchSend(null,openIds,null,text.toString());
     }
 
+    @Autowired
+    private ICorpFeishuUserService corpFeishuUserService;
 
     private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {
-
         String createTime = DateUtils.getNowDate("yyyy-MM-dd");
         Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, 1);
         StringBuilder text = new StringBuilder();
         String s = "";
         for (int i = 0; i < unitWarning.size(); i++) {
             s += unitWarning.get(i) + "," + "<br/>";
-
         }
         text.append("项目出价预警").append("<br/>").append("您的项目:").append(projectName + ",").append("<br/>")
                 .append("授权名称为:" + authName + " 下的,").append("<br/>").append(s)
@@ -120,7 +159,6 @@ public class BidWarningServiceImpl implements IBidWarningService {
             String subject;
             if ("1".equals(mediaId)) {
                 subject = "头条-广告计划出价预警";
-
             } else {
                 subject = "快手-广告组出价预警";
             }
@@ -141,8 +179,6 @@ public class BidWarningServiceImpl implements IBidWarningService {
 
         List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
         CorpWexinUtils.sendMessage(wexinIds, text.toString());
-
-
     }
 
 

+ 51 - 25
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CpaBidWarningServiceImpl.java

@@ -3,19 +3,20 @@ package org.jeecg.modules.ctop.service.impl;
 import cn.com.ctop.common.module.entity.MailLog;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
-import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.service.ICorpFeishuUserService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import cn.com.ctop.common.module.utils.SendMailUtil;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
+import cn.com.feishu.provider.MessageProvider;
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.alibaba.fastjson.JSONArray;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.entity.Project;
-import org.jeecg.modules.ctop.mapper.ProjectMapper;
 import org.jeecg.modules.ctop.service.ICpaBidWarningService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -31,31 +32,25 @@ import java.util.List;
 @Slf4j
 @Service
 public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
-
-    @Autowired
-    private ProjectMapper projectMapper;
     @Autowired
-    private UserAllocationMapper userAllocationMapper;
+    private IUserAllocationService userAllocationService;
     @Autowired
     private KuaiShouGroupMapper groupMapper;
     @Autowired
     private MailLogMapper mailLogMapper;
     @Autowired
     private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
-
+    @Autowired
+    private ICorpFeishuUserService corpFeishuUserService;
 
     /**
      * 预警
      */
-
     @Override
-    public void CpaBidWarning(Project project) {
+    public void cpaBidWarning(Project project) {
         try {
-
             BigDecimal maxDeepCpaBid = project.getMaxDeepCpaBid();
-
-
-            List<UserAllocation> userAllocations = getUserAllocationsByProjectId(project.getId());
+            List<UserAllocation> userAllocations = userAllocationService.getByParams(project.getId(),null,null);
             if (!Check.isNull(userAllocations)) {
                 for (UserAllocation userAllocation : userAllocations) {
                     if (userAllocation.getAccountStatus() == 1) {
@@ -72,6 +67,7 @@ public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
 
                     if (!Check.isNull(unitWarning)) {
                         sendMessage(project.getMediaId(), accountId, project.getId(), project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxDeepCpaBid);
+                        sendFeishuMessage(project.getMediaId(), accountId, project.getId(), project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxDeepCpaBid);
                     }
                 }
             }
@@ -79,22 +75,54 @@ public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
         } catch (Exception e) {
             e.printStackTrace();
         }
+    }
 
+    private void sendFeishuMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, BigDecimal maxCpaBid) throws Exception {
+        BigDecimal maxBid = BigDecimalUtil.divideBigDecimal(maxCpaBid, new BigDecimal(1000));
+        String createTime = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, Integer.getInteger(mediaId));
+        StringBuilder text = new StringBuilder();
+        String s = "";
+        for (int i = 0; i < unitWarning.size(); i++) {
+            s += unitWarning.get(i) + "," + "\n\r";
 
-    }
+        }
+        text.append("项目深度出价预警").append("\n\r").append("您的项目:").append(projectName + ",").append("\n\r")
+                .append("授权名称为:" + authName + " 下的,").append("\n\r").append(s)
+                .append("大于项目设置的最高深度转化出价:").append(maxBid).append(" 元! 请您及时调整。");
+        if (count < 3) {
+            List<String> mailList = mailLogMapper.selectMailList(projectId);
+            String subject;
+            if ("1".equals(mediaId)) {
+                subject = "头条-广告计划深度转化出价预警";
 
-    private List<UserAllocation> getUserAllocationsByProjectId(Long projectId) {
-        QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
-        userAllocationQueryWrapper.eq("project_id", projectId);
-        List<UserAllocation> userAllocations = userAllocationMapper.selectList(userAllocationQueryWrapper);
-        return userAllocations;
-    }
+            } else {
+                subject = "快手-广告组深度转化出价预警";
+            }
 
+            try {
+                SendMailUtil.sendMail(mailList, subject, text.toString());
+                MailLog mailLog = new MailLog();
+                mailLog.setAccountId(accountId);
+                mailLog.setMailType(1);
+                mailLog.setContent(text.toString());
+                mailLog.setSendEmil(JSON.toJSONString(mailList));
+                mailLog.setSubject(subject);
+                mailLogMapper.insert(mailLog);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        JSONArray openIds = corpFeishuUserService.getOpenIdByParams(projectId);
+        if(null == openIds||openIds.isEmpty()){
+            log.error("该项目下运营飞书账号尚未绑定邮箱=>projectId:{}",projectId);
+            return;
+        }
+        MessageProvider.batchSend(null,openIds,null,text.toString());
+    }
 
     private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, BigDecimal maxCpaBid) {
-
         BigDecimal maxBid = BigDecimalUtil.divideBigDecimal(maxCpaBid, new BigDecimal(1000));
-
         String createTime = DateUtils.getNowDate("yyyy-MM-dd");
         Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, 1);
         StringBuilder text = new StringBuilder();
@@ -133,8 +161,6 @@ public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
 
         List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
         CorpWexinUtils.sendMessage(wexinIds, text.toString());
-
-
     }
 
 

+ 7 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CrawlerServiceImpl.java

@@ -19,14 +19,19 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ExecutorService;
 
 @Service
 @Slf4j
 public class CrawlerServiceImpl implements ICrawlerService {
-    static ExecutorService executorService = null;
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
+    @Autowired
+    private IKuaishouInspiredAdService inspiredAdService;
+    @Autowired
+    private IKuaishouHotPhotoInfoService hotPhotoInfoService;
+    @Autowired
+    private IKuaishouEffectAdInfoService effectAdInfoService;
+
 
     @Override
     public Map<String, Object> loadInspiration() {
@@ -97,13 +102,6 @@ public class CrawlerServiceImpl implements ICrawlerService {
         loadInspiredAdByPage(pageSize, pageNumber + 1);
     }
 
-    @Autowired
-    private IKuaishouInspiredAdService inspiredAdService;
-    @Autowired
-    private IKuaishouHotPhotoInfoService hotPhotoInfoService;
-    @Autowired
-    private IKuaishouEffectAdInfoService effectAdInfoService;
-
     private void loadeffectAdByPage(int pageSize, int pageNum) {
         String url = "https://cc.e.kuaishou.com/rest/creativeCentor/adCase/effectAd/list";
         JSONObject param = new JSONObject();

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

@@ -48,7 +48,6 @@ public class CreativeTitleServiceImpl implements ICreativeTitleService {
             if (!Check.isNull(dataJson)) {
                 return dataJson.getJSONArray("titles");
             }
-
         }
         return null;
     }
@@ -73,7 +72,6 @@ public class CreativeTitleServiceImpl implements ICreativeTitleService {
             if (!Check.isNull(dataJson)) {
                 return dataJson.getJSONArray("titles");
             }
-
         }
         return null;
     }

+ 1 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/KuaiShouDefectMaterialServiceImpl.java

@@ -42,11 +42,9 @@ public class KuaiShouDefectMaterialServiceImpl extends ServiceImpl<KuaiShouDefec
 
     @Override
     public void getDefectVideo(String startDate, String endDate) {
-
         List<JSONObject> list = creativeMapper.selectCodeByDate(startDate, endDate);
         if (!Check.isNull(list)) {
             for (int i = 0; i < list.size(); i++) {
-
                 JSONObject codeJson = list.get(i);
                 // charge signature
                 String signature = codeJson.getString("signature");
@@ -72,19 +70,13 @@ public class KuaiShouDefectMaterialServiceImpl extends ServiceImpl<KuaiShouDefec
                         continue;
                     }
                     defectMaterial.setUrl(videoGet.getUrl());
-                    QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
-                    userAllocationQueryWrapper.eq("account_id", videoGet.getAccountId());
-                    userAllocationQueryWrapper.last("limit 1");
-                    UserAllocation userAllocation = userAllocationService.getOne(userAllocationQueryWrapper);
+                    UserAllocation userAllocation = userAllocationService.getByAccountId(videoGet.getAccountId());
                     if (!Check.isNull(userAllocation)) {
                         defectMaterial.setProjectId(userAllocation.getProjectId());
                     }
                     this.save(defectMaterial);
-
                 }
             }
-
         }
-
     }
 }

+ 3 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/KuaiShouUploadServiceImpl.java

@@ -5,8 +5,8 @@ import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.entity.MaterialParameter;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.enums.MaterialEnum;
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -54,7 +54,7 @@ public class KuaiShouUploadServiceImpl implements IKuaiShouUploadService {
     @Autowired
     private IUserAllocationService allocationService;
     @Autowired
-    private CtopOauthTokenMapper oauthTokenMapper;
+    private ICtopOauthTokenService oauthTokenService;
     @Autowired
     private MaterialParameterMapper parameterMapper;
     @Autowired
@@ -94,12 +94,7 @@ public class KuaiShouUploadServiceImpl implements IKuaiShouUploadService {
             if (!Check.isNull(list)) {
                 for (UserAllocation allocation : list) {
                     Long accountId = allocation.getAccountId();
-                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-                    tokenQueryWrapper.eq("account_id", accountId);
-                    tokenQueryWrapper.eq("media_id", 2);
-                    tokenQueryWrapper.orderByDesc("create_time");
-                    tokenQueryWrapper.last("limit 1");
-                    CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    CtopOauthToken ctopOauthToken = oauthTokenService.getAccessTokenByAccountIdAndMediaId(2,accountId);
                     if (Check.isNull(ctopOauthToken)) {
                         log.error("快手账户信息为空,accountId:{}", accountId);
                         continue;

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/PerformanceSaleServiceImpl.java

@@ -6,10 +6,10 @@ import cn.com.ctop.performanceappraisal.service.IPerformanceService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.entity.Advertiser;
-import org.jeecg.modules.ctop.entity.SalePerformanceDetail;
 import org.jeecg.modules.ctop.service.IAdvertiserService;
 import org.jeecg.modules.ctop.service.IPerformanceSaleService;
-import org.jeecg.modules.ctop.service.ISalePerformanceDetailService;
+import org.jeecg.modules.performance.entity.SalePerformanceDetail;
+import org.jeecg.modules.performance.service.ISalePerformanceDetailService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.entity.SysUserRole;
 import org.jeecg.modules.system.service.ISysUserRoleService;

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

@@ -5,7 +5,6 @@ import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.SpringUtils;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.shiro.SecurityUtils;
@@ -16,7 +15,6 @@ import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;

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

@@ -1,19 +0,0 @@
-package org.jeecg.modules.ctop.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.ctop.entity.SalePerformanceDetail;
-import org.jeecg.modules.ctop.mapper.SalePerformanceDetailMapper;
-import org.jeecg.modules.ctop.service.ISalePerformanceDetailService;
-import org.springframework.stereotype.Service;
-
-/**
- * 销售绩效详细信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-04-01
- */
-@Service
-public class SalePerformanceDetailServiceImpl extends ServiceImpl<SalePerformanceDetailMapper, SalePerformanceDetail> implements ISalePerformanceDetailService {
-
-}

+ 29 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/controller/PerformanceShowCtrl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.performance.controller;
 
+
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import com.alibaba.fastjson.JSONObject;
@@ -8,9 +9,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.performance.entity.PerformanceQuarter;
-import org.jeecg.modules.performance.service.IOperateDetailService;
-import org.jeecg.modules.performance.service.IPerformanceInfoService;
-import org.jeecg.modules.performance.service.IPerformanceQuarterService;
+import org.jeecg.modules.performance.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -35,6 +34,10 @@ public class PerformanceShowCtrl {
     IPerformanceQuarterService performanceQuarterService;
     @Autowired
     IOperateDetailService operateDetailService;
+    @Autowired
+    IDesignDetailService designDetailService;
+    @Autowired
+    ISalePerformanceDetailService salePerformanceDetailService;
 
     @GetMapping("/getPerformanceInfo")
     public Result<Map<String, Object>> getPerformanceInfo() {
@@ -46,9 +49,9 @@ public class PerformanceShowCtrl {
 
     @PostMapping("/{pageNo}/{pageSize}/{order}")
     public Result<PageInfo<PerformanceQuarter>> showPerformance(@PathVariable int pageNo,
-                                                               @PathVariable int pageSize,
-                                                               @PathVariable String order,
-                                                               @RequestBody JSONObject requestBody) {
+                                                                @PathVariable int pageSize,
+                                                                @PathVariable String order,
+                                                                @RequestBody JSONObject requestBody) {
         Result<PageInfo<PerformanceQuarter>> result = new Result<>();
         PageInfo<PerformanceQuarter> pageInfo = performanceQuarterService.getPerformanceByConditionsPage(pageNo, pageSize, order, requestBody);
         result.setSuccess(true);
@@ -65,11 +68,11 @@ public class PerformanceShowCtrl {
     @PostMapping("/excel")
     public void getExcelReport(@RequestBody JSONObject requestBody,
                                HttpServletResponse response) {
-        List<PerformanceQuarter> excelData= performanceQuarterService.getPerformanceByConditions(requestBody);
+        List<PerformanceQuarter> excelData = performanceQuarterService.getPerformanceByConditions(requestBody);
         if (excelData.isEmpty()) {
             return;
         }
-        String[] titles={"姓名","公司","职位","媒体类型","年份","季度","消耗","提成比例","绩效","管理岗绩效"};
+        String[] titles = {"姓名", "公司", "职位", "媒体类型", "年份", "季度", "消耗", "提成比例", "绩效", "管理岗绩效"};
 
         List<List<Object>> excelList = new ArrayList<>();
         excelData.forEach(data -> {
@@ -77,7 +80,7 @@ public class PerformanceShowCtrl {
             temp.add(data.getUserName());
             temp.add(data.getCompanyName());
             temp.add(data.getRoleName());
-            temp.add(data.getMediaType()==1?"头条":"快手");
+            temp.add(data.getMediaType() == 1 ? "头条" : "快手");
             temp.add(data.getYear());
             temp.add(data.getQuarter());
             temp.add(data.getCost());
@@ -101,11 +104,27 @@ public class PerformanceShowCtrl {
     }
 
     @PostMapping("/operateDetail")
-    public Result<List<JSONObject>> getOperateDetail(@RequestBody JSONObject requestBody){
+    public Result<List<JSONObject>> getOperateDetail(@RequestBody JSONObject requestBody) {
         Result<List<JSONObject>> result = new Result<>();
         result.setResult(operateDetailService.getOperateGroupAccountByUser(requestBody));
         result.setSuccess(true);
         return result;
     }
 
+    @PostMapping("/designDetail/{pageNo}/{pageSize}")
+    public Result<PageInfo<JSONObject>> getOperateDetail(@PathVariable int pageNo,
+                                                     @PathVariable int pageSize,
+                                                     @RequestBody JSONObject requestBody) {
+        Result<PageInfo<JSONObject>> result = new Result<>();
+        result.setResult(designDetailService.getDesignGroupMaterialByUser(requestBody,pageNo,pageSize));
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/saleDetail")
+    public Result<List<JSONObject>> getSaleDetail(@RequestBody JSONObject requestBody) {
+        Result<List<JSONObject>> result = new Result<>();
+        result.setResult(salePerformanceDetailService.getSaleGroupAdByUser(requestBody));
+        result.setSuccess(true);
+        return result;
+    }
 }

+ 63 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/entity/DesignDetail.java

@@ -1,8 +1,13 @@
 package org.jeecg.modules.performance.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 /**
  * 设计消耗详细
  */
@@ -10,4 +15,62 @@ import lombok.Data;
 @TableName("ctop_performance_design_detail")
 public class DesignDetail {
 
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 媒体类型 1:头条 2:快手
+     */
+    private Integer mediaType;
+    /**
+     * 素材md5
+     */
+    private String materialCode;
+    /**
+     * 素材消耗
+     */
+    private BigDecimal materialCost;
+
+    /**
+     * 个人消耗
+     */
+    private BigDecimal personCost;
+    /**
+     * 提成比例
+     */
+    private BigDecimal percent;
+    /**
+     * leaderId
+     */
+    private String leaderId;
+    /**
+     * createTime
+     */
+    private String startDate;
+    /**
+     * updateTime
+     */
+    private String endDate;
+    /**
+     * createTime
+     */
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    private Date updateTime;
+
+    /**
+     * 预留字段
+     */
+    private BigDecimal cost1;
+    private BigDecimal cost2;
+
 }
+

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

@@ -1,4 +1,4 @@
-package org.jeecg.modules.ctop.entity;
+package org.jeecg.modules.performance.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/CalculatePerformanceMapper.java

@@ -10,4 +10,8 @@ public interface CalculatePerformanceMapper {
 
     List<JSONObject> queryOperateCostGroupByUser(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("mediaType")int mediaType);
 
+    List<JSONObject> queryDesignCostGroupByUser(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("mediaType")int mediaType);
+
+    List<JSONObject> querySaleCostGroupByUser(@Param("year")int year, @Param("quarter")int quarter, @Param("mediaType")int mediaType);
+
 }

+ 8 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/DesignDetailMapper.java

@@ -2,10 +2,16 @@ package org.jeecg.modules.performance.mapper;
 
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.performance.entity.DesignDetail;
 
 import java.util.List;
 
-public interface DesignDetailMapper {
+public interface DesignDetailMapper extends BaseMapper<DesignDetail> {
+
+    List<JSONObject> queryMaterialDetailByDate(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("mediaType") int mediaType);
+
+    List<JSONObject> queryDesignDetailBy(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("userId") String userId,@Param("mediaType") int mediaType);
 
-    List<JSONObject> queryMaterialDetailByDate(String startDate,String endDate, int mediaType);
 }

+ 22 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/SalePerformanceDetailMapper.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.performance.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.pagehelper.PageInfo;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.performance.entity.SalePerformanceDetail;
+
+import java.util.List;
+
+/**
+ * 销售绩效详细信息
+ *
+ * @author: jeecg-boot
+ * @date: 2020-04-01
+ * @cersion: V1.0
+ */
+public interface SalePerformanceDetailMapper extends BaseMapper<SalePerformanceDetail> {
+
+    List<JSONObject> querySaleGroupAdByUser(@Param("year") int year, @Param("quarter") int quarter, @Param("userId") String userId, @Param("mediaType") int mediaType);
+
+}

+ 59 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/CalculatePerformanceMapper.xml

@@ -4,24 +4,66 @@
 
     <select id="queryOperateCostGroupByUser" resultType="com.alibaba.fastjson.JSONObject">
         SELECT res.*,
-        (SELECT realname from sys_user user where user.id=res.userId limit 1) as userName,
-        (SELECT company_id from user_company company where company.user_id=res.userId limit 1) as 'companyId',
-        (SELECT company_name from user_company company where company.user_id=res.userId limit 1) as 'companyName',
-        (SELECT role_code from sys_role role LEFT JOIN sys_user_role ur on role.id=ur.role_id where ur.user_id=res.userId limit 1) as 'roleCode',
-        (SELECT role_name from sys_role role LEFT JOIN sys_user_role ur on role.id=ur.role_id where ur.user_id=res.userId limit 1) as 'roleName'
+               (SELECT realname from sys_user user where user.id=res.userId limit 1) as userName,
+               (SELECT company_id from user_company company where company.user_id=res.userId limit 1) as 'companyId',
+               (SELECT company_name from user_company company where company.user_id=res.userId limit 1) as 'companyName',
+               (SELECT role_code from sys_role role LEFT JOIN sys_user_role ur on role.id=ur.role_id where ur.user_id=res.userId limit 1) as 'roleCode',
+               (SELECT role_name from sys_role role LEFT JOIN sys_user_role ur on role.id=ur.role_id where ur.user_id=res.userId limit 1) as 'roleName'
         from (
-        SELECT
-        user_id as userId,
-        leader_id as leaderId,
-        sum(cost) as cost
-        FROM
-        ctop_performance_operate_detail
-        WHERE
-        media_type= #{mediaType}
-        AND	stat_date &gt;= #{startDate}
-        AND stat_date &lt;= #{endDate}
-        GROUP BY user_id
-        ) res
+                 SELECT
+                     user_id as userId,
+                     leader_id as leaderId,
+                     sum(cost) as cost
+                 FROM
+                     ctop_performance_operate_detail
+                 WHERE
+                     media_type= #{mediaType}
+                 AND	stat_date &gt;= #{startDate}
+                 AND stat_date &lt;= #{endDate}
+                 GROUP BY user_id
+             ) res
+    </select>
+
+    <select id="queryDesignCostGroupByUser" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT res.*,
+               (SELECT realname from sys_user user where user.id=res.userId limit 1) as userName,
+               (SELECT company_id from user_company company where company.user_id=res.userId limit 1) as 'companyId',
+               (SELECT company_name from user_company company where company.user_id=res.userId limit 1) as 'companyName',
+               (SELECT role_code from sys_role role LEFT JOIN sys_user_role ur on role.id=ur.role_id where ur.user_id=res.userId limit 1) as 'roleCode',
+               (SELECT role_name from sys_role role LEFT JOIN sys_user_role ur on role.id=ur.role_id where ur.user_id=res.userId limit 1) as 'roleName'
+        from (
+                 SELECT
+                     user_id as userId,
+                     sum(person_cost) as cost
+                 FROM
+                     ctop_performance_design_detail
+                 WHERE
+                     media_type= #{mediaType}
+                   and start_date= #{startDate}
+                   and end_date=#{endDate}
+                 GROUP BY user_id
+             ) res
+    </select>
+
+    <select id="querySaleCostGroupByUser" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT res.*,
+               (SELECT realname from sys_user user where user.id=res.userId limit 1) as userName,
+               (SELECT company_id from user_company company where company.user_id=res.userId limit 1) as 'companyId',
+               (SELECT company_name from user_company company where company.user_id=res.userId limit 1) as 'companyName',
+               (SELECT role_code from sys_role role LEFT JOIN sys_user_role ur on role.id=ur.role_id where ur.user_id=res.userId limit 1) as 'roleCode',
+               (SELECT role_name from sys_role role LEFT JOIN sys_user_role ur on role.id=ur.role_id where ur.user_id=res.userId limit 1) as 'roleName'
+        from (
+                 SELECT
+                     sale_id as userId,
+                     sum(total_cost) as cost
+                 FROM
+                     ctop_sale_performance_detail
+                 WHERE
+                     media_type= #{mediaType}
+                   and year= #{year}
+                   and quarter= #{quarter}
+                 GROUP BY sale_id
+             ) res
     </select>
 
 </mapper>

+ 29 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/DesignDetailMapper.xml

@@ -27,21 +27,21 @@
         FROM
         (
         SELECT
-        report.CODE,
+        report.code,
         sum(report.cost) AS cost,
-        ascription.clip_id as clipID,
+        ascription.clip_id as clipId,
         ascription.plane_id as planeId,
-        ascription.plan_id as planID,
-        ascription.shot_id as shotID,
+        ascription.plan_id as planId,
+        ascription.shot_id as shotId,
         ascription.material_id as materialId
         FROM
         ctop_material_report_total_result report
         LEFT JOIN ctop_material_info info on report.code=info.code
         LEFT JOIN ctop_material_ascription ascription ON info. CODE = ascription.material_id
         WHERE
-        report.media_type = #{param3}
-        AND report.stat_date &gt;= #{param1}
-        AND report.stat_date &lt;= #{param2}
+        report.media_type = #{mediaType}
+        AND report.stat_date &gt;= #{startDate}
+        AND report.stat_date &lt;= #{endDate}
         GROUP BY
         report.CODE
         ) res
@@ -49,4 +49,26 @@
         res.cost > 0
     </select>
 
+    <select id="queryDesignDetailBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            t1.media_type AS mediaType,
+            (select realname from sys_user where id=t1.leader_id) AS leaderName,
+            t3.project_name AS projectName,
+            t2.material_name AS materialName,
+            t2.url,
+            t1.material_cost AS materialCost,
+            t1.person_cost AS personCost,
+            t1.percent
+        FROM
+            ctop_performance_design_detail t1
+                LEFT JOIN ctop_material_info t2 ON t1.material_code = t2. CODE
+                LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
+        WHERE
+            t1.user_id = #{userId}
+          AND t1.start_date = #{startDate}
+          AND t1.media_type = #{mediaType}
+        GROUP BY
+            t1.material_code
+        ORDER BY person_cost desc
+    </select>
 </mapper>

+ 17 - 29
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/OperateDetailMapper.xml

@@ -33,46 +33,34 @@
 
     <select id="ByteDanceOperateDetailGroupAccountByDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t2.project_name AS projectName,
-        t2.auth_name AS authName,
+        (SELECT project_name from ctop_user_allocation where account_id=t1.account_id ) AS projectName,
+        (SELECT auth_name from ctop_user_allocation where account_id=t1.account_id ) AS authName,
         ROUND(sum(t1.cost), 2) cost
         FROM
-        ctop_bytedance_report_advertiser_daily t1
-        LEFT JOIN ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
+        ctop_performance_operate_detail  t1
         WHERE
-        t1.stat_datetime &gt;= #{startDate} '00:00:00'
-        AND t1.stat_datetime &lt;= #{endDate}
-        AND t1.advertiser_id IN (
-        SELECT
-        account_id
-        FROM
-        ctop_user_allocation
-        WHERE
-        user_id = #{userId}
-        AND media_id = 1
-        ) GROUP BY t2.account_id
+        t1.stat_date &gt;=#{startDate}
+        AND t1.stat_date &lt;=#{endDate}
+        and t1.user_id=#{userId}
+        and t1.media_type=1
+        GROUP BY
+        t1.account_id
     </select>
 
     <select id="kuaiShouOperateDetailGroupAccountByDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t2.project_name AS projectName,
-        t2.auth_name AS authName,
-        ROUND(sum(t1.charge), 2) cost
+        (SELECT project_name from ctop_user_allocation where account_id=t1.account_id ) AS projectName,
+        (SELECT auth_name from ctop_user_allocation where account_id=t1.account_id ) AS authName,
+        ROUND(sum(t1.cost), 2) cost
         FROM
-        ctop_kuaishou_report_daily_account t1
-        LEFT JOIN ctop_user_allocation t2 on t1.account_id=t2.account_id
+        ctop_performance_operate_detail  t1
         WHERE
         t1.stat_date &gt;=#{startDate}
         AND t1.stat_date &lt;=#{endDate}
-        AND t1.account_id IN (
-        SELECT
-        account_id
-        FROM
-        ctop_user_allocation
-        WHERE
-        user_id = #{userId}
-        AND media_id = 2
-        ) GROUP BY t2.account_id
+        and t1.user_id=#{userId}
+        and t1.media_type=2
+        GROUP BY
+            t1.account_id
     </select>
 
 </mapper>

+ 28 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/mapper/xml/SalePerformanceDetailMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.performance.mapper.SalePerformanceDetailMapper">
+
+    <select id="querySaleGroupAdByUser" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.advertiser_id as ad,
+               t2.name,
+               sum(t1.total_cost) as totalCost,
+               sum(case when brand_new = 0
+                            then t1.total_cost else 0 end ) 'oldCost',
+               sum(case when brand_new = 1
+                            then t1.total_cost else 0 end ) 'newCost',
+               sum(case when brand_new = 0
+                            then t1.percent else 0 end ) 'oldPercent',
+               sum(case when brand_new = 1
+                            then t1.percent else 0 end ) 'newPercent'
+        FROM
+            ctop_sale_performance_detail t1
+                LEFT JOIN ctop_advertiser t2 on t1.advertiser_id=t2.id
+        WHERE
+            t1.sale_id = #{userId}
+          AND t1.YEAR = #{year}
+          AND t1.QUARTER = #{quarter}
+        GROUP BY
+            t1.advertiser_id
+    </select>
+
+</mapper>

+ 0 - 28
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/DesignDetailServiceImpl.java

@@ -1,28 +0,0 @@
-package org.jeecg.modules.performance.service;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.modules.performance.mapper.DesignDetailMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-@Slf4j
-public class DesignDetailServiceImpl implements IDesignDetailService {
-
-    @Autowired
-    DesignDetailMapper designDetailMapper;
-
-    @Override
-    public void UserCostCalculateByMaterial(String startDate, String endDate, int mediaType) {
-        //查询出来素材对应的cost
-        List<JSONObject> jsonObjectList=designDetailMapper.queryMaterialDetailByDate(startDate,endDate,mediaType);
-        if(jsonObjectList.isEmpty()){
-            log.error("没有素材数据");
-        }
-
-
-    }
-}

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/ICalculatePerformanceService.java

@@ -5,8 +5,8 @@ public interface ICalculatePerformanceService {
     //运营绩效计算
     void CalculateOperatePerformance(int year, String quarter, int mediaType);
     //设计绩效计算
-    void CalculateDesignPerformance();
+    void CalculateDesignPerformance(int year, String quarter, int mediaType);
     //销售绩效计算
-    void CalculateSalePerformance();
+    void CalculateSalePerformance(int year, String quarter, int mediaType);
 
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/IDesignDetailService.java

@@ -1,7 +1,12 @@
 package org.jeecg.modules.performance.service;
 
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+
 public interface IDesignDetailService {
 
     void UserCostCalculateByMaterial(String startDate, String endDate, int mediaType);
 
+    PageInfo<JSONObject> getDesignGroupMaterialByUser(JSONObject requestBody,int pageNo,int pageSize);
+
 }

+ 23 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/ISalePerformanceDetailService.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.performance.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.modules.performance.entity.SalePerformanceDetail;
+
+import java.util.List;
+
+/**
+ * 销售绩效详细信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-04-01
+ */
+public interface ISalePerformanceDetailService extends IService<SalePerformanceDetail> {
+
+    void loadSalesPerformance(String startDate, String endDate);
+
+    List<JSONObject> getSaleGroupAdByUser(JSONObject requestBody);
+
+}

+ 49 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/CalculatePerformanceServiceImpl.java

@@ -64,12 +64,57 @@ public class CalculatePerformanceServiceImpl implements ICalculatePerformanceSer
     }
 
     @Override
-    public void CalculateDesignPerformance() {
-
+    public void CalculateDesignPerformance(int year, String quarter, int mediaType) {
+        String startDate= year+"-"+ PeriodConstant.valueOf(quarter).getStart();
+        String endDate= year+"-"+PeriodConstant.valueOf(quarter).getEnd();
+        List<JSONObject> designCost = calculatePerformanceMapper.queryDesignCostGroupByUser(startDate, endDate, mediaType);
+        List<PerformanceQuarter> performanceQuarters = new ArrayList<>();
+        PerformanceQuarter performanceQuarter;
+        for(JSONObject op:designCost){
+            performanceQuarter = new PerformanceQuarter();
+            performanceQuarter.setUserId(op.getString("userId"));
+            performanceQuarter.setUserName(op.getString("userName"));
+            performanceQuarter.setCompanyId(op.getString("companyId"));
+            performanceQuarter.setCompanyName(op.getString("companyName"));
+            performanceQuarter.setDepartment("设计部");
+            performanceQuarter.setRoleCode(op.getString("roleCode"));
+            performanceQuarter.setRoleName(op.getString("roleName"));
+            performanceQuarter.setYear(year);
+            performanceQuarter.setQuarter(quarter);
+            BigDecimal cost=op.getBigDecimal("cost");
+            performanceQuarter.setCost(cost);
+            performanceQuarter.setPerformance(RateConstant.PERCENT_0);
+            performanceQuarter.setPoint(RateConstant.PERCENT_0);
+            performanceQuarter.setMediaType(mediaType);
+            performanceQuarters.add(performanceQuarter);
+        }
+        performanceQuarterService.saveBatch(performanceQuarters);
     }
 
     @Override
-    public void CalculateSalePerformance() {
-
+    public void CalculateSalePerformance(int year, String quarter, int mediaType) {
+        int quarterInt= Integer.parseInt(quarter.substring(1));
+        List<JSONObject> saleCost = calculatePerformanceMapper.querySaleCostGroupByUser(year, quarterInt, mediaType);
+        List<PerformanceQuarter> performanceQuarters = new ArrayList<>();
+        PerformanceQuarter performanceQuarter;
+        for(JSONObject op:saleCost){
+            performanceQuarter = new PerformanceQuarter();
+            performanceQuarter.setUserId(op.getString("userId"));
+            performanceQuarter.setUserName(op.getString("userName"));
+            performanceQuarter.setCompanyId(op.getString("companyId"));
+            performanceQuarter.setCompanyName(op.getString("companyName"));
+            performanceQuarter.setDepartment("销售部");
+            performanceQuarter.setRoleCode(op.getString("roleCode"));
+            performanceQuarter.setRoleName(op.getString("roleName"));
+            performanceQuarter.setYear(year);
+            performanceQuarter.setQuarter(quarter);
+            BigDecimal cost=op.getBigDecimal("cost");
+            performanceQuarter.setCost(cost);
+            performanceQuarter.setPerformance(RateConstant.PERCENT_0);
+            performanceQuarter.setPoint(RateConstant.PERCENT_0);
+            performanceQuarter.setMediaType(mediaType);
+            performanceQuarters.add(performanceQuarter);
+        }
+        performanceQuarterService.saveBatch(performanceQuarters);
     }
 }

+ 82 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/DesignDetailServiceImpl.java

@@ -0,0 +1,82 @@
+package org.jeecg.modules.performance.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+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.jeecg.modules.performance.constants.PeriodConstant;
+import org.jeecg.modules.performance.constants.RateConstant;
+import org.jeecg.modules.performance.entity.DesignDetail;
+import org.jeecg.modules.performance.mapper.DesignDetailMapper;
+import org.jeecg.modules.performance.service.IDesignDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  Created by JQ.bi on 2020.6.22
+ */
+@Service
+@Slf4j
+public class DesignDetailServiceImpl extends ServiceImpl<DesignDetailMapper, DesignDetail> implements IDesignDetailService {
+
+    @Autowired
+    DesignDetailMapper designDetailMapper;
+
+    @Override
+    public void UserCostCalculateByMaterial(String startDate, String endDate, int mediaType) {
+        //查询出来素材对应的cost
+        List<JSONObject> jsonObjectList = designDetailMapper.queryMaterialDetailByDate(startDate, endDate, mediaType);
+        if (jsonObjectList.isEmpty()) {
+            log.error("没有素材数据");
+        }
+        List<DesignDetail> designDetailList = new ArrayList<>();
+        jsonObjectList.forEach(it -> {
+            String leaderId=it.getString("leaderId")==null?"":it.getString("leaderId");
+            //TODO 暂时没有平面
+            if (!(null == it.getString("clipId") || it.getString("clipId").isEmpty())) {
+                designDetailList.add(this.getDesignDetail(it,"clipId",leaderId,RateConstant.PERCENT_30,startDate,endDate,mediaType));
+            }
+            if (!(null == it.getString("plan") || it.getString("plan").isEmpty())) {
+                designDetailList.add(this.getDesignDetail(it,"plan",leaderId,RateConstant.PERCENT_40,startDate,endDate,mediaType));
+            }
+            if (!(null == it.getString("shotId") || it.getString("shotId").isEmpty())) {
+                designDetailList.add(this.getDesignDetail(it,"clipId",leaderId,RateConstant.PERCENT_10,startDate,endDate,mediaType));
+            }
+            if (!(null == it.getString("leaderId") || it.getString("leaderId").isEmpty())) {
+                designDetailList.add(this.getDesignDetail(it,"leaderId",leaderId,RateConstant.PERCENT_20,startDate,endDate,mediaType));
+            }
+        });
+        this.saveBatch(designDetailList);
+    }
+
+    @Override
+    public PageInfo<JSONObject> getDesignGroupMaterialByUser(JSONObject requestBody,int pageNo,int pageSize) {
+        String userId=requestBody.getString("userId");
+        int year= requestBody.getInteger("year");
+        String quarter=requestBody.getString("quarter");
+        int mediaType=requestBody.getInteger("mediaType");
+        String startDate= year+"-"+ PeriodConstant.valueOf(quarter).getStart();
+        String endDate= year+"-"+PeriodConstant.valueOf(quarter).getEnd();
+        PageHelper.startPage(pageNo,pageSize);
+        return new PageInfo(designDetailMapper.queryDesignDetailBy(startDate,endDate,userId,mediaType));
+    }
+
+    private DesignDetail getDesignDetail(JSONObject jsonObject,String job, String leaderId,BigDecimal percent,String startDate, String endDate, int mediaType){
+        DesignDetail designDetail = new DesignDetail();
+        designDetail.setUserId(jsonObject.getString(job));
+        designDetail.setMediaType(mediaType);
+        designDetail.setMaterialCode(jsonObject.getString("code"));
+        designDetail.setMaterialCost(jsonObject.getBigDecimal("cost"));
+        designDetail.setPersonCost(jsonObject.getBigDecimal("cost").multiply(percent));
+        designDetail.setPercent(percent);
+        designDetail.setStartDate(startDate);
+        designDetail.setEndDate(endDate);
+        designDetail.setLeaderId(leaderId);
+        return designDetail;
+    }
+}

+ 230 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/SalePerformanceDetailServiceImpl.java

@@ -0,0 +1,230 @@
+package org.jeecg.modules.performance.service.impl;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.performanceappraisal.service.IPerformanceService;
+import com.alibaba.fastjson.JSONObject;
+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.jeecg.common.util.DateUtils;
+import org.jeecg.modules.ctop.entity.Advertiser;
+import org.jeecg.modules.performance.constants.PeriodConstant;
+import org.jeecg.modules.performance.entity.SalePerformanceDetail;
+import org.jeecg.modules.performance.mapper.SalePerformanceDetailMapper;
+import org.jeecg.modules.ctop.service.IAdvertiserService;
+import org.jeecg.modules.performance.service.ISalePerformanceDetailService;
+import org.jeecg.modules.performance.constants.RateConstant;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.entity.SysUserRole;
+import org.jeecg.modules.system.service.ISysUserRoleService;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 销售绩效详细信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-04-01
+ */
+@Service
+@Slf4j
+public class SalePerformanceDetailServiceImpl extends ServiceImpl<SalePerformanceDetailMapper, SalePerformanceDetail> implements ISalePerformanceDetailService {
+
+    @Autowired
+    private ISysUserService sysUserService;
+    @Autowired
+    private IPerformanceService performanceService;
+    @Autowired
+    private ISysUserRoleService userRoleService;
+    @Autowired
+    private IAdvertiserService advertiserService;
+    @Autowired
+    private SalePerformanceDetailMapper salePerformanceDetailMapper;
+
+    @Override
+    public void loadSalesPerformance(String startDate, String endDate) {
+        //1:获取销售列表
+        List<SysUser> sales = sysUserService.getUserListByRoleId(CtopAdConstant.SYSTEM_SALE_CODE);
+        if (null != sales && sales.size() > 0) {
+            sales.forEach(this::countPerformance
+            );
+        }
+        //2:获取销售AM列表
+        List<SysUser> saleAms = sysUserService.getUserListByRoleId(CtopAdConstant.SYSTEM_SALE_AM_CODE);
+        if (null != saleAms && saleAms.size() > 0) {
+            saleAms.forEach(this::countPerformance
+            );
+        }
+    }
+
+
+    private void countPerformance(SysUser user) {
+//        Date getDate = DateUtils.addDay(new Date(), -1)
+        log.info("销售人员名称:{}", user.getRealname());
+        Date getDate = DateUtils.addDay(new Date(), -18);
+        String startDateStr = DateUtils.getQuarterStartDate(getDate);
+        String endDateStr = DateUtils.getQuarterEndDate(getDate);
+        //获取用户角色信息
+        SysUserRole userRole = userRoleService.getUserRoleByUserId(user.getId());
+        //1:获取快手季度总消耗 TODO 后续需要改成动态获取
+        BigDecimal kuaishouFinishMediaTask = RateConstant.PERCENT_0;
+        //2:获取快手个人季度总消耗
+        BigDecimal kuaishouFinishPersonnalTask = performanceService.getKuaishouSalesSeasonTotalCostByParams(startDateStr, endDateStr, user.getId(), null, null);
+        //1:获取头条季度总消耗 TODO 后续需要改成动态获取
+        BigDecimal bytedanceFinishMediaTask = CtopAdConstant.BYTEDANCE_MEDIA_TASK_COST;
+        //2:获取头条个人季度总消耗
+        BigDecimal bytedanceFinishPersonnalTask = performanceService.getBytedanceSalesSeasonTotalCostByParams(startDateStr, endDateStr, user.getId(), null, null);
+        //获取销售所属的广告主信息
+        List<Advertiser> advertiserList = advertiserService.getBySaleId(user.getId());
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date startSeasonDate = null;
+        Date endSeasonDate = null;
+        try {
+            startSeasonDate = dateFormat.parse(startDateStr);
+            endSeasonDate = dateFormat.parse(endDateStr);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        if (null != advertiserList && advertiserList.size() > 0) {
+            for (Advertiser advertiser : advertiserList) {
+                //1:根据广告主查询用户绑定信息
+                List<UserAllocation> allocations = advertiserService.getAllocationsByAdvertiserId(advertiser.getId());
+                if (null != allocations && allocations.size() > 0) {
+                    Date finalStartSeasonDate = startSeasonDate;
+                    Date finalEndSeasonDate = endSeasonDate;
+                    allocations.forEach(allocation -> {
+                        Date endOldDate = DateUtils.addDay(allocation.getCreateTime(), 90);
+                        if (finalStartSeasonDate.after(endOldDate)) {
+                            //季度开始时间大于新户结束时间(全部按照老户逻辑计算)
+                            saveSalePerformanceDetail(allocation, advertiser, user, userRole, DateUtils.getYear(getDate), DateUtils.getQuarter(getDate),
+                                    startDateStr, endDateStr, bytedanceFinishMediaTask, bytedanceFinishPersonnalTask, kuaishouFinishMediaTask,
+                                    kuaishouFinishPersonnalTask, 0);
+                        } else if (endOldDate.after(finalEndSeasonDate)) {
+                            saveSalePerformanceDetail(allocation, advertiser, user, userRole, DateUtils.getYear(getDate), DateUtils.getQuarter(getDate),
+                                    startDateStr, endDateStr, bytedanceFinishMediaTask, bytedanceFinishPersonnalTask, kuaishouFinishMediaTask,
+                                    kuaishouFinishPersonnalTask, 1);
+                        } else {
+                            //新户结束时间处于本季度中间
+                            String endduring1Date = DateUtils.formatDate(endOldDate);
+                            saveSalePerformanceDetail(allocation, advertiser, user, userRole, DateUtils.getYear(getDate), DateUtils.getQuarter(getDate),
+                                    startDateStr, endduring1Date, bytedanceFinishMediaTask, bytedanceFinishPersonnalTask, kuaishouFinishMediaTask,
+                                    kuaishouFinishPersonnalTask, 1);
+                            saveSalePerformanceDetail(allocation, advertiser, user, userRole, DateUtils.getYear(getDate), DateUtils.getQuarter(getDate),
+                                    startDateStr, endduring1Date, bytedanceFinishMediaTask, bytedanceFinishPersonnalTask, kuaishouFinishMediaTask,
+                                    kuaishouFinishPersonnalTask, 0);
+                        }
+                    });
+                }
+            }
+        }
+    }
+
+    private void saveSalePerformanceDetail(UserAllocation allocation, Advertiser advertiser, SysUser user, SysUserRole userRole, int year, int quarter, String startDate, String endDate, BigDecimal bytedanceFinishMediaTask, BigDecimal bytedanceFinishPersonnalTask, BigDecimal kuaishouFinishMediaTask, BigDecimal kuaishouFinishPersonnalTask, Integer brandNew) {
+        SalePerformanceDetail detail = new SalePerformanceDetail();
+        detail.setAccountId(allocation.getAccountId());
+        detail.setAdvertiserId(advertiser.getId());
+        detail.setSaleId(user.getId());
+        detail.setRoleId(userRole.getRoleId());
+        detail.setYear(year);
+        detail.setQuarter(quarter);
+        detail.setStartDate(startDate);
+        detail.setEndDate(endDate);
+        detail.setExtensionSelf(advertiser.getAdvertiserType());
+        detail.setBrandNew(brandNew);
+        if (null != user.getOrgCode()) {
+            if (user.getOrgCode().startsWith(CtopAdConstant.HB_BYTEDANCE_SALE_ORG_CODE)) {
+                detail.setMediaType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+                BigDecimal totalCost = performanceService.getSalesSeasonTotalCostByParams(startDate, endDate, null, null, allocation.getAccountId(), CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+                if (null == totalCost) {
+                    totalCost = BigDecimal.ZERO;
+                }
+                detail.setTotalCost(totalCost);
+                detail.setMediaTask(CtopAdConstant.BYTEDANCE_MEDIA_TASK_COST);
+                detail.setDoMediaTask(bytedanceFinishMediaTask);
+                detail.setPersonnalTask(CtopAdConstant.BYTEDANCE_PERSONAL_TASK_COST);
+                detail.setDoPersonalTask(bytedanceFinishPersonnalTask);
+                detail.setPercent(getPercentagePercent(detail));
+                detail.setPercentage(detail.getTotalCost().multiply(detail.getPercent()).setScale(2, RoundingMode.HALF_UP));
+                this.save(detail);
+            } else if (user.getOrgCode().startsWith(CtopAdConstant.HB_KUAISHOU_SALE_ORG_CODE)) {
+                detail.setMediaType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                BigDecimal totalCost = performanceService.getSalesSeasonTotalCostByParams(startDate, endDate, null, null, allocation.getAccountId(), CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                if (null == totalCost) {
+                    totalCost = BigDecimal.ZERO;
+                }
+                detail.setTotalCost(totalCost);
+                detail.setMediaTask(CtopAdConstant.KUAISHOU_MEDIA_TASK_COST);
+                detail.setDoMediaTask(kuaishouFinishMediaTask);
+                detail.setPersonnalTask(CtopAdConstant.KUAISHOU_PERSONAL_TASK_COST);
+                detail.setDoPersonalTask(kuaishouFinishPersonnalTask);
+                //提成比例
+                detail.setPercent(getPercentagePercent(detail));
+                detail.setPercentage(detail.getTotalCost().multiply(detail.getPercent()).setScale(2, RoundingMode.HALF_UP));
+                this.save(detail);
+            }
+        }
+    }
+
+    private BigDecimal getPercentagePercent(SalePerformanceDetail detail) {
+        BigDecimal percent = detail.getDoMediaTask().divide(detail.getMediaTask(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
+        //AM非自拓客户
+        if (detail.getRoleId().equals(CtopAdConstant.SYSTEM_SALE_AM_CODE) && detail.getExtensionSelf() != 1) {
+            return new BigDecimal("0.0005");
+        }
+        if (detail.getMediaType().equals(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE)) {
+            //头条
+            if (detail.getBrandNew() == 0) {
+                return new BigDecimal("0.001");
+            }
+            if (percent.compareTo(new BigDecimal("100")) >= 0) {
+                return new BigDecimal("0.003");
+            } else if (percent.compareTo(new BigDecimal("80")) >= 0) {
+                return new BigDecimal("0.0025");
+            } else if (percent.compareTo(new BigDecimal("60")) >= 0) {
+                return new BigDecimal("0.002");
+            } else {
+                return BigDecimal.ZERO;
+            }
+        } else {
+            //快手
+            if (detail.getBrandNew() == 1) {
+                if (percent.compareTo(new BigDecimal("100")) >= 0) {
+                    return new BigDecimal("0.005");
+                } else if (percent.compareTo(new BigDecimal("80")) >= 0) {
+                    return new BigDecimal("0.004");
+                } else if (percent.compareTo(new BigDecimal("60")) >= 0) {
+                    return new BigDecimal("0.003");
+                } else {
+                    return BigDecimal.ZERO;
+                }
+            }
+            //自拓
+            if (detail.getExtensionSelf() == 1) {
+                return new BigDecimal("0.0015");
+            } else {
+                return new BigDecimal("0.001");
+            }
+        }
+    }
+
+    @Override
+    public List<JSONObject> getSaleGroupAdByUser(JSONObject requestBody) {
+        String userId=requestBody.getString("userId");
+        int year= requestBody.getInteger("year");
+        int quarter= Integer.parseInt(requestBody.getString("quarter").substring(1));
+        int mediaType=requestBody.getInteger("mediaType");
+        return salePerformanceDetailMapper.querySaleGroupAdByUser(year,quarter,userId,mediaType);
+    }
+
+}

+ 22 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/testCtrl.java

@@ -1,7 +1,9 @@
 package org.jeecg.modules.performance;
 
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.performance.service.ISalePerformanceDetailService;
 import org.jeecg.modules.performance.service.ICalculatePerformanceService;
+import org.jeecg.modules.performance.service.IDesignDetailService;
 import org.jeecg.modules.performance.service.IOperateDetailService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -16,19 +18,34 @@ public class testCtrl {
     IOperateDetailService operateDetailService;
 
     @Autowired
+    IDesignDetailService designDetailService;
+
+    @Autowired
+    ISalePerformanceDetailService  salePerformanceDetailService;
+
+    @Autowired
     ICalculatePerformanceService  calculatePerformanceService;
 
     @GetMapping("/job/test/operator")
     public String testOperator(){
-/*
-        Date nowDate= new Date();
 
+        Date nowDate= new Date();
         String startStatDate = DateUtils.getQuarterStartDate(nowDate);
         String endStatDate = DateUtils.getQuarterEndDate(nowDate);
 
-        operateDetailService.KsCostCalculateByAccount(startStatDate,endStatDate);
-        operateDetailService.BtCostCalculateByAccount(startStatDate,endStatDate);*/
-        calculatePerformanceService.CalculateOperatePerformance(2020,"Q2",2);
+        //计算运营消耗
+        /*operateDetailService.KsCostCalculateByAccount(startStatDate,endStatDate);
+        operateDetailService.(startStatDate,endStatDate);*/
+        //计算运营绩效
+        //calculatePerformanceService.CalculateOperatePerformance(2020,"Q2",2);
+        //计算设计消耗
+        //designDetailService.UserCostCalculateByMaterial(startStatDate,endStatDate,1);
+        //计算设计绩效
+        calculatePerformanceService.CalculateDesignPerformance(2020,"Q2",2);
+        //计算销售消耗
+        //salePerformanceDetailService.loadSalesPerformance(startStatDate,endStatDate);
+        //计算销售绩效
+        //calculatePerformanceService.CalculateSalePerformance(2020,"Q2",2);
         return "success";
     }
 

+ 89 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -1,9 +1,14 @@
 package org.jeecg.modules.system.controller;
 
+import cn.com.ctop.common.module.entity.CorpFeishuUser;
 import cn.com.ctop.common.module.entity.CtopCorpWexinUser;
+import cn.com.ctop.common.module.service.ICorpFeishuUserService;
 import cn.com.ctop.common.module.service.ICtopCorpWexinUserService;
 import cn.com.ctop.common.module.utils.AesEncryptUtil;
 import cn.com.ctop.common.module.utils.EncryptedString;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.feishu.provider.AuthProvider;
 import cn.hutool.core.util.RandomUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.exceptions.ClientException;
@@ -42,6 +47,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.*;
 
 /**
@@ -53,6 +59,7 @@ import java.util.*;
 @Api(tags = "用户登录")
 @Slf4j
 public class LoginController {
+    private static final String DOMAIN_SERVER = "http://adsp.tjyourong.com.cn/";
     @Autowired
     private ISysUserService sysUserService;
     @Autowired
@@ -65,11 +72,92 @@ public class LoginController {
     private ISysDepartService sysDepartService;
     @Autowired
     private ICtopCorpWexinUserService ctopCorpWexinUserService;
+    @Autowired
+    private ICorpFeishuUserService corpFeishuUserService;
+    @GetMapping("feishu/url")
+    public Map<String,Object> getUrl(){
+        Map<String,Object>result = new HashMap<>();
+        try {
+            String url = AuthProvider.getAuthUrl("");
+            result.put("url",url);
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+            return result;
+        } catch (Exception e) {
+            e.printStackTrace();
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);
+            return result;
+        }
+    }
+    @GetMapping("/feishu/auth")
+    public Result<JSONObject> feishuAuth(HttpServletRequest request,
+                           HttpServletResponse response,
+                           @RequestParam(name = "code",defaultValue = "code") String code,
+                           @RequestParam(name = "state",defaultValue = "_t") String state) throws IOException {
+        Result<JSONObject> result = new Result<>();
+        //1:根据code值获取用户飞书信息
+        try {
+            if(code.trim().equals("code")){
+                JSONObject setData = new JSONObject();
+                String url = AuthProvider.getAuthUrl("");
+                setData.put("url",url);
+                setData.put("type",1);
+                result.setResult(setData);
+                result.success("重定向");
+                return result;
+            }
+            JSONObject data = AuthProvider.getFeishuUserInfo(code);
+            String accessToken = data.getJSONObject("data").getString("access_token");
+            String openId = data.getJSONObject("data").getString("open_id");
+            //根据accessToken
+            JSONObject userData = AuthProvider.getUserInfo(accessToken);
+            JSONObject dataObject = userData.getJSONObject("data");
+            String email = dataObject.getString("email");
+            if(null == email||email.trim().equals("")){
+                return result.error500(StatusCode.CTOP_FEISHU_EMAIL_NOT_EXIST.getDesc());
+            }
+            SysUser sysUser = sysUserService.getUserByEmail(email);
+            if (sysUser == null) {
+                return result.error500(StatusCode.CTOP_FEISHU_ACCOUNT_NOT_EXIST.getDesc());
+            }
+            if(sysUser.getStatus() != 1){
+                return result.error500(StatusCode.CTOP_FEISHU_ACCOUNT_NOT_EXIST.getDesc());
+            }
+            String departId = sysDepartService.selectIdByOrdCode(sysUser.getOrgCode());
+            sysUser.setDepartId(departId);
+            Result<JSONObject> getResult = sysUserService.checkUserIsEffective(sysUser);
+            if (!getResult.isSuccess()) {
+                return result.error500(StatusCode.COMMON_ACCOUNT_ERROR.getDesc());
+            }
+            //用户登录信息
+            userInfo(sysUser, getResult);
+            sysBaseApi.addLog("用户名: " + email + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
+            CorpFeishuUser feishuUser = corpFeishuUserService.getByUserId(sysUser.getId());
+            if (feishuUser == null) {
+                feishuUser = new CorpFeishuUser();
+                feishuUser.setOpenId(openId);
+                feishuUser.setUserId(sysUser.getId());
+                feishuUser.setEmail(sysUser.getEmail());
+                feishuUser.setAvatarBig(dataObject.getString("avatar_big"));
+                feishuUser.setAvatarMiddle(dataObject.getString("avatar_middle"));
+                feishuUser.setAvatarThumb(dataObject.getString("avatar_thumb"));
+                feishuUser.setAvatarUrl(dataObject.getString("avatar_url"));
+                feishuUser.setName(dataObject.getString("name"));
+                feishuUser.setMobile(dataObject.getString("mobile"));
+                feishuUser.setCreateTime(new Date());
+                feishuUser.setUpdateTime(new Date());
+                corpFeishuUserService.save(feishuUser);
+            }
+            return getResult;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return result.error500(StatusCode.COMMON_SERVER_ERROR.getDesc());
+        }
+    }
 
     @RequestMapping(value = "/wxlogin", method = RequestMethod.POST)
     @ApiOperation("企业微信登录接口")
     public Result<JSONObject> wxlogin(@RequestParam(name = "code") String code) throws Exception {
-        Result<JSONObject> result = new Result<JSONObject>();
+        Result<JSONObject> result = new Result<>();
         val configStorage = new WxCpDefaultConfigImpl();
         configStorage.setCorpId("ww24b8a47826f5875f");
         configStorage.setAgentId(1000002);

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

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

@@ -1,39 +1,31 @@
 package org.jeecg.modules.wps.controller;
 
-import com.alibaba.fastjson.JSON;
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
+import cn.com.ctop.common.module.service.ISysRoleService;
 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
@@ -46,8 +38,28 @@ import java.util.Map;
 public class WpsFileController {
 	@Autowired
 	private IWpsFileService wpsFileService;
+	@Autowired
+	private ISysRoleService sysRoleService;
+	@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
 	 * @param pageNo
@@ -62,9 +74,19 @@ public class WpsFileController {
 												@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 												@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 												HttpServletRequest req) {
+		String name = wpsFile.getName();
+		wpsFile.setName(null);
 		Result<IPage<WpsFile>> result = new Result<>();
 		QueryWrapper<WpsFile> queryWrapper = QueryGenerator.initQueryWrapper(wpsFile, req.getParameterMap());
-		Page<WpsFile> page = new Page<WpsFile>(pageNo, pageSize);
+		if(null!=name&&!name.trim().equals("")){
+			queryWrapper.like("name",name);
+		}
+		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
+		if(null==roleCode||!roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
+			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 +122,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 +144,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 +193,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);
 }

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

@@ -1,27 +1,37 @@
 package org.jeecg.modules.wps.service.impl;
 
+import cn.com.ctop.common.module.file.FileUtil;
+import cn.com.ctop.common.module.utils.CosUtils;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.common.module.vo.ResFileDTO;
 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.*;
+import org.jeecg.modules.wps.entity.WpsFile;
+import org.jeecg.modules.wps.entity.WpsFileVersion;
+import org.jeecg.modules.wps.entity.WpsFileWatermark;
+import org.jeecg.modules.wps.entity.WpsUser;
 import org.jeecg.modules.wps.mapper.WpsFileMapper;
 import org.jeecg.modules.wps.service.*;
 import org.jeecg.modules.wps.util.Token;
 import org.jeecg.modules.wps.util.WpsUtil;
-import org.jeecg.modules.wps.util.file.FileUtil;
-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 +53,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 +68,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 +86,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 +99,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 +118,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 +147,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 +206,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 +266,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);
+        ResFileDTO resFileDTO = CosUtils.uploadMultipartFile(mFile,"script-lib/wps/");
         int size = (int) resFileDTO.getFileSize();
-
-        String fileId = Context.getFileId();
         WpsFile file = this.getById(fileId);
         FileDTO fileInfo = new FileDTO();
 
@@ -363,19 +351,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 +370,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);
                 }
             }

+ 9 - 12
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 cn.com.ctop.common.module.file.FileUtil;
+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);

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

@@ -1,15 +1,14 @@
 package org.jeecg.modules.wps.util.upload.oss;
 
+import cn.com.ctop.common.module.file.FileType;
+import cn.com.ctop.common.module.file.FileTypeJudge;
+import cn.com.ctop.common.module.file.FileUtil;
+import cn.com.ctop.common.module.vo.ResFileDTO;
 import com.aliyun.oss.HttpMethod;
 import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClient;
 import com.aliyun.oss.model.*;
 import org.apache.commons.lang.StringUtils;
-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,78 +21,31 @@ 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);
     }
 
-    public static String simpleUploadFilePath(String filePath){
-        File file = new File(filePath);
-        return simpleUploadFile(file);
-    }
-
-    public static String simpleUploadFile(File file){
-        String fileName = file.getName();
-        String newFileName = FileUtil.makeNewFileName(fileName);
-        getOSSClient().putObject(bucketName, diskName + newFileName, file);
-        return (fileUrlPrefix + diskName + newFileName);
-    }
 
     public String simpleUploadMultipartFile(MultipartFile file){
         String fileName = file.getOriginalFilename();
@@ -284,7 +236,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());

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

@@ -28,8 +28,8 @@ spring:
             enable: true
             required: true
   ## quartz定时任务,采用数据库方式
-  quartz:
-    job-store-type: jdbc
+  #quartz:
+    #job-store-type: jdbc
   #json 时间戳统一转换
   jackson:
     date-format:   yyyy-MM-dd HH:mm:ss
@@ -118,7 +118,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: foobared
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -0,0 +1,168 @@
+server:
+  port: 8804
+  ip: 39.97.120.42
+  servlet:
+    context-path: /jeecg-boot
+    compression:
+      enabled: true
+      mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
+management:
+  endpoints:
+    web:
+      exposure:
+        include: metrics,httptrace
+spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
+  mail:
+    host: smtp.163.com
+    username: jeecgos@163.com
+    password: ??
+    properties:
+      mail:
+        smtp:
+          auth: true
+          starttls:
+            enable: true
+            required: true
+  ## quartz定时任务,采用数据库方式
+  quartz:
+    job-store-type: jdbc
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    url: jdbc:mysql://172.30.0.4:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    username: hcst
+    password: test@20190531
+    driver-class-name: com.mysql.jdbc.Driver
+    druid:
+      stat-view-servlet:
+        loginUsername: admin
+        loginPassword: hcst2016
+        enabled: true
+      web-stat-filter:
+        enabled: true
+    #      remove-abandoned: false
+    dynamic:
+      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        connection-init-sql: set names utf8mb4
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://172.30.0.4:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: test@20190531
+          driver-class-name: com.mysql.jdbc.Driver
+          # 多数据源配置
+          #multi-datasource1:
+          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
+          #username: root
+          #password: root
+          #driver-class-name: com.mysql.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    host: 172.30.0.17
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+    password: foobared
+    port: 6379
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: 4
+      # 默认数据库表下划线命名
+      table-underline: true
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#jeecg专用配置
+jeecg:
+  ffmpeg:
+    bin: ffmpeg
+  path:
+    #文件上传根目录 设置
+    upload: /data/upload
+    #webapp文件路径
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/upload/image/
+    chrome-driver: /usr/bin/chromedriver
+    csv-upload: /data/upload/csv/
+    bak-database-file: /data/data/bak/
+    report-history: /data/upload/report/history/
+    report-daily: /data/upload/report/daily/
+kuaishou:
+  group-control:
+    path: http://39.106.184.70
+    port: 4723
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml
+chrome:
+  script:
+    clean: sh /data/webapp/cleanProcess.sh
+
+oss:
+  replace:
+    replace-value: oss-cn-beijing
+    replace-old-value: oss-cn-beijing
+    download: /data/file/video/

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

@@ -1,6 +1,5 @@
 server:
   port: 8088
-  ip: 39.106.184.70
   servlet:
     context-path: /jeecg-boot
     compression:
@@ -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
@@ -116,7 +113,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: foobared
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 6 - 5
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
@@ -56,7 +56,7 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
     username: hcst
     password: test@20190531
     driver-class-name: com.mysql.jdbc.Driver
@@ -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://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
           password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
@@ -108,6 +108,7 @@ spring:
   #redis 配置
   redis:
     database: 0
+#    host: 172.30.0.17
     host: 127.0.0.1
     lettuce:
       pool:
@@ -116,7 +117,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password:
     port: 6379
 #mybatis plus 设置
 mybatis-plus:
@@ -142,7 +143,7 @@ jeecg:
     webapp: /mnt/webapp
     video-upload: /mnt/upload/video/
     image-upload: /mnt/upload/image/
-    chrome-driver: /usr/bin/chromedriver
+    chrome-driver: D://chromedriver.exe
     csv-upload: /mnt/upload/csv/
     bak-database-file: /mnt/data/bak/
     report-history: /mnt/upload/report/history/

+ 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

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

@@ -1,6 +1,8 @@
 org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
-org.quartz.threadPool.threadCount=20
+org.quartz.threadPool.threadCount=50
+org.quartz.scheduler.batchTriggerAcquisitionMaxCount=50
 org.quartz.threadPool.threadPriority=5
 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
-org.quartz.jobStore.misfireThreshold=60000
-org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
+org.quartz.jobStore.misfireThreshold=600000
+org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
+

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

@@ -5,18 +5,12 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 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;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 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 +23,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;
@@ -39,62 +32,19 @@ import java.util.concurrent.Executors;
 @Slf4j
 public class SampleTest {
     @Autowired
-    private IBytedanceReportService bytedanceReportService;
-    @Autowired
-    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
-    @Autowired
     private ICtopOauthTokenService oauthTokenService;
     @Autowired
-    private IReportService reportService;
-
+    private IKuaishouInterfaceService kuaishouInterfaceService;
     @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<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
+        Date startDate = DateUtils.addDay(new Date(),-1);
+        Date startDate2 = DateUtils.addDay(new Date(),-2);
+        for(CtopOauthToken token:tokens){
+            kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate, startDate);
+            //1: 获取广告主信息数据
+            kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate2, startDate2);
+       }
     }
 
     @Autowired
@@ -193,17 +143,6 @@ public class SampleTest {
             }
         }
     }
-
-    @Autowired
-    private IKuaiShouDailyReportTaskService dailyReportTaskService;
-    @Test
-    public void testLoadKuaishouData(){
-        CtopOauthToken token = oauthTokenService.getTokenByAccountId(4801739L);
-        for(int i=0;i<50;i++){
-            Date startDate = DateUtils.addDay(new Date(),-(i+30));
-            dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), DateUtils.formatDate(startDate));
-        }
-    }
 }
 
 

+ 123 - 0
module-callback/pom.xml

@@ -0,0 +1,123 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>cn.com.ctop</groupId>
+  <artifactId>module-callback</artifactId>
+  <version>2.0.2</version>
+  <parent>
+    <groupId>org.jeecgframework.boot</groupId>
+    <artifactId>jeecg-boot-parent</artifactId>
+    <version>2.0.2</version>
+  </parent>
+  <name>module-callback</name>
+  <!-- FIXME change it to the project's website -->
+  <url>http://www.example.com</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>cn.com.ctop</groupId>
+      <artifactId>module-common</artifactId>
+      <version>2.0.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>1.7.25</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.25</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jeecgframework.boot</groupId>
+      <artifactId>jeecg-boot-base-common</artifactId>
+      <version>2.0.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>1.7.25</version>
+    </dependency>
+    <dependency>
+      <groupId>com.xuxueli</groupId>
+      <artifactId>xxl-mq-client</artifactId>
+      <version>1.2.2</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.mybatis.generator</groupId>
+        <artifactId>mybatis-generator-maven-plugin</artifactId>
+        <version>1.3.6</version>
+        <configuration>
+          <!-- 是否覆盖,true表示会替换生成的JAVA文件,false则不覆盖 -->
+          <overwrite>true</overwrite>
+        </configuration>
+        <dependencies>
+          <!--mysql驱动包-->
+          <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.45</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+    <resources>
+      <!-- 解决MyBatis配置文件引入问题 -->
+      <resource>
+        <directory>src/main/java</directory>
+        <includes>
+          <include>**/*.properties</include>
+          <include>**/*.xml</include>
+        </includes>
+        <!-- 是否替换资源中的属性-->
+        <filtering>true</filtering>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>dev</id>
+      <properties>
+        <!-- 环境标识,需要与配置文件的名称相对应 -->
+        <activatedProperties>dev</activatedProperties>
+      </properties>
+      <activation>
+        <!-- 默认环境 -->
+        <activeByDefault>true</activeByDefault>
+      </activation>
+    </profile>
+    <profile>
+      <id>test</id>
+      <properties>
+        <activatedProperties>test</activatedProperties>
+      </properties>
+    </profile>
+    <profile>
+      <id>prod</id>
+      <properties>
+        <activatedProperties>prod</activatedProperties>
+      </properties>
+    </profile>
+  </profiles>
+</project>

+ 23 - 0
module-callback/src/main/java/cn/com/ctop/callback/StartApplication.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.callback;
+import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
+import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroAutoConfiguration;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroBeanAutoConfiguration;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+
+@Slf4j
+@SpringBootApplication(exclude = {DynamicDataSourceAutoConfiguration.class,DruidDataSourceAutoConfigure.class,DataSourceAutoConfiguration.class,ShiroAnnotationProcessorAutoConfiguration.class, ShiroAutoConfiguration.class, ShiroBeanAutoConfiguration.class})
+@ComponentScan(basePackages = {"cn.com.ctop.callback"})
+@Configuration
+public class StartApplication {
+    public static void main(String[] args){
+        SpringApplication.run(StartApplication.class, args);
+    }
+}

+ 29 - 0
module-callback/src/main/java/cn/com/ctop/callback/config/XxlMqConf.java

@@ -0,0 +1,29 @@
+package cn.com.ctop.callback.config;
+
+import com.xxl.mq.client.factory.impl.XxlMqSpringClientFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+@Component
+public class XxlMqConf {
+
+    // ---------------------- param ----------------------
+
+    @Value("${xxl.mq.admin.address}")
+    private String adminAddress;
+    @Value("${xxl.mq.accessToken}")
+    private String accessToken;
+
+
+    @Bean
+    public XxlMqSpringClientFactory getXxlMqConsumer(){
+
+        XxlMqSpringClientFactory xxlMqSpringClientFactory = new XxlMqSpringClientFactory();
+        xxlMqSpringClientFactory.setAdminAddress(adminAddress);
+        xxlMqSpringClientFactory.setAccessToken(accessToken);
+
+        return xxlMqSpringClientFactory;
+    }
+
+}

+ 28 - 0
module-callback/src/main/java/cn/com/ctop/callback/controller/CallbackController.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.callback.controller;
+
+import com.xxl.mq.client.message.XxlMqMessage;
+import com.xxl.mq.client.producer.XxlMqProducer;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Controller
+@RequestMapping("/")
+public class CallbackController {
+    @RequestMapping("/{group}/{topic}")
+    @ResponseBody
+    public Result<String> callbackMethod(HttpServletRequest request,
+                                         HttpServletResponse response,
+                                         @PathVariable(name = "group") String group,
+                                         @PathVariable(name = "topic") String topic){
+        Result<String> result = new Result<>();
+        XxlMqProducer.produce(new XxlMqMessage(group+"_"+topic, request.getQueryString()));
+        result.success("success");
+        return result;
+    }
+}

+ 13 - 0
module-callback/src/main/resources/application-dev.yml

@@ -0,0 +1,13 @@
+server:
+  port: 8801
+  servlet:
+    context-path: /
+xxl:
+  mq:
+    accessToken:
+    admin:
+      address: http://129.28.150.229:8808/xxl-mq-admin
+logging:
+  level:
+    root: info
+  config: classpath:logback-dev.xml

+ 13 - 0
module-callback/src/main/resources/application-prod.yml

@@ -0,0 +1,13 @@
+server:
+  port: 8801
+  servlet:
+    context-path: /
+xxl:
+  mq:
+    accessToken:
+    admin:
+      address: http://129.28.150.229:8808/xxl-mq-admin
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml

+ 13 - 0
module-callback/src/main/resources/application-test.yml

@@ -0,0 +1,13 @@
+server:
+  port: 8801
+  servlet:
+    context-path: /
+xxl:
+  mq:
+    accessToken:
+    admin:
+      address: http://129.28.150.229:8808/xxl-mq-admin
+logging:
+  level:
+    root: info
+  config: classpath:logback-test.xml

+ 7 - 0
module-callback/src/main/resources/application.yml

@@ -0,0 +1,7 @@
+server:
+  port: 8801
+xxl:
+  mq:
+    accessToken:
+    admin:
+      address: http://129.28.150.229:8808/xxl-mq-admin

+ 29 - 0
module-callback/src/main/resources/logback-dev.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false" scan="true" scanPeriod="1 seconds">
+
+    <contextName>logback</contextName>
+    <property name="log.path" value="/data/applogs/xxl-mq/xxl-mq-samples-springboot.log"/>
+
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <root level="info">
+        <appender-ref ref="console"/>
+        <appender-ref ref="file"/>
+    </root>
+
+</configuration>

+ 29 - 0
module-callback/src/main/resources/logback-prod.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false" scan="true" scanPeriod="1 seconds">
+
+    <contextName>logback</contextName>
+    <property name="log.path" value="/data/applogs/xxl-mq/xxl-mq-samples-springboot.log"/>
+
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <root level="info">
+        <appender-ref ref="console"/>
+        <appender-ref ref="file"/>
+    </root>
+
+</configuration>

+ 29 - 0
module-callback/src/main/resources/logback-test.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false" scan="true" scanPeriod="1 seconds">
+
+    <contextName>logback</contextName>
+    <property name="log.path" value="/data/applogs/xxl-mq/xxl-mq-samples-springboot.log"/>
+
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <root level="info">
+        <appender-ref ref="console"/>
+        <appender-ref ref="file"/>
+    </root>
+
+</configuration>

+ 20 - 0
module-callback/src/test/java/org/jeecgframework/boot/AppTest.java

@@ -0,0 +1,20 @@
+package org.jeecgframework.boot;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+{
+    /**
+     * Rigorous Test :-)
+     */
+    @Test
+    public void shouldAnswerWithTrue()
+    {
+        assertTrue( true );
+    }
+}

+ 5 - 0
module-common/pom.xml

@@ -78,6 +78,11 @@
             <artifactId>groovy</artifactId>
             <version>${groovy.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.qcloud</groupId>
+            <artifactId>cos_api</artifactId>
+            <version>5.6.25</version>
+        </dependency>
 
     </dependencies>
 

+ 0 - 6
module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java

@@ -3,14 +3,12 @@ package cn.com.ctop.common.module.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;
 
@@ -87,16 +85,12 @@ public class BindAccountLogin {
      * 创建时间
      */
     @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;
 

+ 72 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/CorpFeishuUser.java

@@ -0,0 +1,72 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_corp_feishu_user")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_corp_feishu_user对象", description="飞书用户信息")
+public class CorpFeishuUser {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+	private Long id;
+	/**email*/
+	@Excel(name = "email", width = 15)
+    @ApiModelProperty(value = "email")
+	private String email;
+	/**name*/
+	@Excel(name = "name", width = 15)
+    @ApiModelProperty(value = "name")
+	private String name;
+
+	private String openId;
+	/**avatarUrl*/
+	@Excel(name = "avatarUrl", width = 15)
+    @ApiModelProperty(value = "avatarUrl")
+	private String avatarUrl;
+	/**avatarThumb*/
+	@Excel(name = "avatarThumb", width = 15)
+    @ApiModelProperty(value = "avatarThumb")
+	private String avatarThumb;
+	/**avatarMiddle*/
+	@Excel(name = "avatarMiddle", width = 15)
+    @ApiModelProperty(value = "avatarMiddle")
+	private String avatarMiddle;
+	/**avatarBig*/
+	@Excel(name = "avatarBig", width = 15)
+    @ApiModelProperty(value = "avatarBig")
+	private String avatarBig;
+	/**userId*/
+	@Excel(name = "userId", width = 15)
+    @ApiModelProperty(value = "userId")
+	private String userId;
+	/**mobile*/
+	@Excel(name = "mobile", width = 15)
+    @ApiModelProperty(value = "mobile")
+	private String mobile;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileType.java

@@ -1,4 +1,4 @@
-package org.jeecg.modules.wps.util.file;
+package cn.com.ctop.common.module.file;
 
 /**
  * 文件类型枚取

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileTypeJudge.java

@@ -1,4 +1,4 @@
-package org.jeecg.modules.wps.util.file;
+package cn.com.ctop.common.module.file;
 
 import org.springframework.stereotype.Component;
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileUtil.java

@@ -1,4 +1,4 @@
-package org.jeecg.modules.wps.util.file;
+package cn.com.ctop.common.module.file;
 
 import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/CorpFeishuUserMapper.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.CorpFeishuUser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 飞书用户信息
+ * @author: jeecg-boot
+ * @date:   2020-06-23
+ * @cersion: V1.0
+ */
+public interface CorpFeishuUserMapper extends BaseMapper<CorpFeishuUser> {
+
+    List<String> getOpenIdByParams(@Param(value = "projectId") Long projectId);
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CorpFeishuUserMapper.xml

@@ -0,0 +1,14 @@
+<?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.common.module.mapper.CorpFeishuUserMapper">
+
+    <select id="getOpenIdByParams" resultType="java.lang.String">
+        select
+            fuser.open_id
+        from
+            ctop_corp_feishu_user fuser
+        left join ctop_user_allocation allocation on allocation.user_id = fuser.user_id
+        where
+            allocation.project_id = #{projectId}
+    </select>
+</mapper>

+ 17 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/ICorpFeishuUserService.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.CorpFeishuUser;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+public interface ICorpFeishuUserService extends IService<CorpFeishuUser> {
+    CorpFeishuUser getByUserId(String userId);
+
+    JSONArray getOpenIdByParams(Long projectId);
+}

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

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


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików